diff options
author | Steve French <sfrench@us.ibm.com> | 2005-11-10 18:34:57 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-11-10 18:34:57 -0500 |
commit | 9551583e55e26a0940894828c2d1066e9276325e (patch) | |
tree | ff412949400da94aa788bd094ced2138e9175935 /include | |
parent | a2653ebab3a96c6e6183360821faa492c1f88c3f (diff) | |
parent | 985834a1c3a2e9639145bd8ea16af6e25f2143ad (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'include')
111 files changed, 4715 insertions, 1201 deletions
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h index 68934a25931f..6126afe27380 100644 --- a/include/asm-alpha/ide.h +++ b/include/asm-alpha/ide.h | |||
@@ -15,10 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
17 | 17 | ||
18 | #ifndef MAX_HWIFS | ||
19 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | ||
20 | #endif | ||
21 | |||
22 | #define IDE_ARCH_OBSOLETE_DEFAULTS | 18 | #define IDE_ARCH_OBSOLETE_DEFAULTS |
23 | 19 | ||
24 | static inline int ide_default_irq(unsigned long base) | 20 | static inline int ide_default_irq(unsigned long base) |
diff --git a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h index 55d85eea8c1a..cfb413c845f7 100644 --- a/include/asm-arm/arch-ixp4xx/hardware.h +++ b/include/asm-arm/arch-ixp4xx/hardware.h | |||
@@ -44,5 +44,6 @@ extern unsigned int processor_id; | |||
44 | #include "ixdp425.h" | 44 | #include "ixdp425.h" |
45 | #include "coyote.h" | 45 | #include "coyote.h" |
46 | #include "prpmc1100.h" | 46 | #include "prpmc1100.h" |
47 | #include "nslu2.h" | ||
47 | 48 | ||
48 | #endif /* _ASM_ARCH_HARDWARE_H */ | 49 | #endif /* _ASM_ARCH_HARDWARE_H */ |
diff --git a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h index ca808281c7f9..2cf4930372bc 100644 --- a/include/asm-arm/arch-ixp4xx/irqs.h +++ b/include/asm-arm/arch-ixp4xx/irqs.h | |||
@@ -93,4 +93,11 @@ | |||
93 | #define IRQ_COYOTE_PCI_SLOT1 IRQ_IXP4XX_GPIO11 | 93 | #define IRQ_COYOTE_PCI_SLOT1 IRQ_IXP4XX_GPIO11 |
94 | #define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5 | 94 | #define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5 |
95 | 95 | ||
96 | /* | ||
97 | * NSLU2 board IRQs | ||
98 | */ | ||
99 | #define IRQ_NSLU2_PCI_INTA IRQ_IXP4XX_GPIO11 | ||
100 | #define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10 | ||
101 | #define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9 | ||
102 | |||
96 | #endif | 103 | #endif |
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h new file mode 100644 index 000000000000..b8b347a559c7 --- /dev/null +++ b/include/asm-arm/arch-ixp4xx/nslu2.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * include/asm-arm/arch-ixp4xx/nslu2.h | ||
3 | * | ||
4 | * NSLU2 platform specific definitions | ||
5 | * | ||
6 | * Author: Mark Rakes <mrakes AT mac.com> | ||
7 | * Maintainers: http://www.nslu2-linux.org | ||
8 | * | ||
9 | * based on ixdp425.h: | ||
10 | * Copyright 2004 (c) MontaVista, Software, Inc. | ||
11 | * | ||
12 | * This file is licensed under the terms of the GNU General Public | ||
13 | * License version 2. This program is licensed "as is" without any | ||
14 | * warranty of any kind, whether express or implied. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_ARCH_HARDWARE_H__ | ||
18 | #error "Do not include this directly, instead #include <asm/hardware.h>" | ||
19 | #endif | ||
20 | |||
21 | #define NSLU2_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS | ||
22 | #define NSLU2_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE | ||
23 | |||
24 | #define NSLU2_SDA_PIN 7 | ||
25 | #define NSLU2_SCL_PIN 6 | ||
26 | |||
27 | /* | ||
28 | * NSLU2 PCI IRQs | ||
29 | */ | ||
30 | #define NSLU2_PCI_MAX_DEV 3 | ||
31 | #define NSLU2_PCI_IRQ_LINES 3 | ||
32 | |||
33 | |||
34 | /* PCI controller GPIO to IRQ pin mappings */ | ||
35 | #define NSLU2_PCI_INTA_PIN 11 | ||
36 | #define NSLU2_PCI_INTB_PIN 10 | ||
37 | #define NSLU2_PCI_INTC_PIN 9 | ||
38 | #define NSLU2_PCI_INTD_PIN 8 | ||
39 | |||
40 | |||
41 | /* NSLU2 Timer */ | ||
42 | #define NSLU2_FREQ 66000000 | ||
43 | #define NSLU2_CLOCK_TICK_RATE (((NSLU2_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) | ||
44 | #define NSLU2_CLOCK_TICKS_PER_USEC ((NSLU2_CLOCK_TICK_RATE + USEC_PER_SEC/2) / USEC_PER_SEC) | ||
45 | |||
46 | /* GPIO */ | ||
47 | |||
48 | #define NSLU2_GPIO0 0 | ||
49 | #define NSLU2_GPIO1 1 | ||
50 | #define NSLU2_GPIO2 2 | ||
51 | #define NSLU2_GPIO3 3 | ||
52 | #define NSLU2_GPIO4 4 | ||
53 | #define NSLU2_GPIO5 5 | ||
54 | #define NSLU2_GPIO6 6 | ||
55 | #define NSLU2_GPIO7 7 | ||
56 | #define NSLU2_GPIO8 8 | ||
57 | #define NSLU2_GPIO9 9 | ||
58 | #define NSLU2_GPIO10 10 | ||
59 | #define NSLU2_GPIO11 11 | ||
60 | #define NSLU2_GPIO12 12 | ||
61 | #define NSLU2_GPIO13 13 | ||
62 | #define NSLU2_GPIO14 14 | ||
63 | #define NSLU2_GPIO15 15 | ||
64 | |||
65 | /* Buttons */ | ||
66 | |||
67 | #define NSLU2_PB_GPIO NSLU2_GPIO5 | ||
68 | #define NSLU2_PO_GPIO NSLU2_GPIO8 /* power off */ | ||
69 | #define NSLU2_RB_GPIO NSLU2_GPIO12 | ||
70 | |||
71 | #define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 | ||
72 | #define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 | ||
73 | |||
74 | #define NSLU2_PB_BM (1L << NSLU2_PB_GPIO) | ||
75 | #define NSLU2_PO_BM (1L << NSLU2_PO_GPIO) | ||
76 | #define NSLU2_RB_BM (1L << NSLU2_RB_GPIO) | ||
77 | |||
78 | /* Buzzer */ | ||
79 | |||
80 | #define NSLU2_GPIO_BUZZ 4 | ||
81 | #define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) | ||
82 | /* LEDs */ | ||
83 | |||
84 | #define NSLU2_LED_RED NSLU2_GPIO0 | ||
85 | #define NSLU2_LED_GRN NSLU2_GPIO1 | ||
86 | |||
87 | #define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED) | ||
88 | #define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN) | ||
89 | |||
90 | #define NSLU2_LED_DISK1 NSLU2_GPIO2 | ||
91 | #define NSLU2_LED_DISK2 NSLU2_GPIO3 | ||
92 | |||
93 | #define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2) | ||
94 | #define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3) | ||
95 | |||
96 | |||
diff --git a/include/asm-arm/arch-omap/board-h4.h b/include/asm-arm/arch-omap/board-h4.h index d64ee9211eed..33ea29a41654 100644 --- a/include/asm-arm/arch-omap/board-h4.h +++ b/include/asm-arm/arch-omap/board-h4.h | |||
@@ -34,5 +34,11 @@ | |||
34 | #define OMAP24XX_ETHR_START 0x08000300 | 34 | #define OMAP24XX_ETHR_START 0x08000300 |
35 | #define OMAP24XX_ETHR_GPIO_IRQ 92 | 35 | #define OMAP24XX_ETHR_GPIO_IRQ 92 |
36 | 36 | ||
37 | #define H4_CS0_BASE 0x04000000 | ||
38 | |||
39 | #define H4_CS0_BASE 0x04000000 | ||
40 | |||
41 | #define H4_CS0_BASE 0x04000000 | ||
42 | |||
37 | #endif /* __ASM_ARCH_OMAP_H4_H */ | 43 | #endif /* __ASM_ARCH_OMAP_H4_H */ |
38 | 44 | ||
diff --git a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h index 79574e0ed13d..b3cf33441f6e 100644 --- a/include/asm-arm/arch-omap/board-innovator.h +++ b/include/asm-arm/arch-omap/board-innovator.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #ifndef __ASM_ARCH_OMAP_INNOVATOR_H | 26 | #ifndef __ASM_ARCH_OMAP_INNOVATOR_H |
27 | #define __ASM_ARCH_OMAP_INNOVATOR_H | 27 | #define __ASM_ARCH_OMAP_INNOVATOR_H |
28 | 28 | ||
29 | #if defined (CONFIG_ARCH_OMAP1510) | 29 | #if defined (CONFIG_ARCH_OMAP15XX) |
30 | 30 | ||
31 | #ifndef OMAP_SDRAM_DEVICE | 31 | #ifndef OMAP_SDRAM_DEVICE |
32 | #define OMAP_SDRAM_DEVICE D256M_1X16_4B | 32 | #define OMAP_SDRAM_DEVICE D256M_1X16_4B |
@@ -44,7 +44,7 @@ void fpga_write(unsigned char val, int reg); | |||
44 | unsigned char fpga_read(int reg); | 44 | unsigned char fpga_read(int reg); |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #endif /* CONFIG_ARCH_OMAP1510 */ | 47 | #endif /* CONFIG_ARCH_OMAP15XX */ |
48 | 48 | ||
49 | #if defined (CONFIG_ARCH_OMAP16XX) | 49 | #if defined (CONFIG_ARCH_OMAP16XX) |
50 | 50 | ||
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h new file mode 100644 index 000000000000..740c297eb11c --- /dev/null +++ b/include/asm-arm/arch-omap/clock.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-omap/clock.h | ||
3 | * | ||
4 | * Copyright (C) 2004 - 2005 Nokia corporation | ||
5 | * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | ||
6 | * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ARCH_ARM_OMAP_CLOCK_H | ||
14 | #define __ARCH_ARM_OMAP_CLOCK_H | ||
15 | |||
16 | struct module; | ||
17 | |||
18 | struct clk { | ||
19 | struct list_head node; | ||
20 | struct module *owner; | ||
21 | const char *name; | ||
22 | struct clk *parent; | ||
23 | unsigned long rate; | ||
24 | __u32 flags; | ||
25 | void __iomem *enable_reg; | ||
26 | __u8 enable_bit; | ||
27 | __u8 rate_offset; | ||
28 | __u8 src_offset; | ||
29 | __s8 usecount; | ||
30 | void (*recalc)(struct clk *); | ||
31 | int (*set_rate)(struct clk *, unsigned long); | ||
32 | long (*round_rate)(struct clk *, unsigned long); | ||
33 | void (*init)(struct clk *); | ||
34 | int (*enable)(struct clk *); | ||
35 | void (*disable)(struct clk *); | ||
36 | }; | ||
37 | |||
38 | struct clk_functions { | ||
39 | int (*clk_enable)(struct clk *clk); | ||
40 | void (*clk_disable)(struct clk *clk); | ||
41 | int (*clk_use)(struct clk *clk); | ||
42 | void (*clk_unuse)(struct clk *clk); | ||
43 | long (*clk_round_rate)(struct clk *clk, unsigned long rate); | ||
44 | int (*clk_set_rate)(struct clk *clk, unsigned long rate); | ||
45 | int (*clk_set_parent)(struct clk *clk, struct clk *parent); | ||
46 | struct clk * (*clk_get_parent)(struct clk *clk); | ||
47 | void (*clk_allow_idle)(struct clk *clk); | ||
48 | void (*clk_deny_idle)(struct clk *clk); | ||
49 | }; | ||
50 | |||
51 | extern unsigned int mpurate; | ||
52 | extern struct list_head clocks; | ||
53 | extern spinlock_t clockfw_lock; | ||
54 | |||
55 | extern int clk_init(struct clk_functions * custom_clocks); | ||
56 | extern int clk_register(struct clk *clk); | ||
57 | extern void clk_unregister(struct clk *clk); | ||
58 | extern void propagate_rate(struct clk *clk); | ||
59 | extern void followparent_recalc(struct clk * clk); | ||
60 | extern void clk_allow_idle(struct clk *clk); | ||
61 | extern void clk_deny_idle(struct clk *clk); | ||
62 | |||
63 | /* Clock flags */ | ||
64 | #define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */ | ||
65 | #define RATE_FIXED (1 << 1) /* Fixed clock rate */ | ||
66 | #define RATE_PROPAGATES (1 << 2) /* Program children too */ | ||
67 | #define VIRTUAL_CLOCK (1 << 3) /* Composite clock from table */ | ||
68 | #define ALWAYS_ENABLED (1 << 4) /* Clock cannot be disabled */ | ||
69 | #define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */ | ||
70 | #define VIRTUAL_IO_ADDRESS (1 << 6) /* Clock in virtual address */ | ||
71 | #define CLOCK_IDLE_CONTROL (1 << 7) | ||
72 | #define CLOCK_NO_IDLE_PARENT (1 << 8) | ||
73 | #define DELAYED_APP (1 << 9) /* Delay application of clock */ | ||
74 | #define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */ | ||
75 | #define CM_MPU_SEL1 (1 << 11) /* Domain divider/source */ | ||
76 | #define CM_DSP_SEL1 (1 << 12) | ||
77 | #define CM_GFX_SEL1 (1 << 13) | ||
78 | #define CM_MODEM_SEL1 (1 << 14) | ||
79 | #define CM_CORE_SEL1 (1 << 15) /* Sets divider for many */ | ||
80 | #define CM_CORE_SEL2 (1 << 16) /* sets parent for GPT */ | ||
81 | #define CM_WKUP_SEL1 (1 << 17) | ||
82 | #define CM_PLL_SEL1 (1 << 18) | ||
83 | #define CM_PLL_SEL2 (1 << 19) | ||
84 | #define CM_SYSCLKOUT_SEL1 (1 << 20) | ||
85 | #define CLOCK_IN_OMAP730 (1 << 21) | ||
86 | #define CLOCK_IN_OMAP1510 (1 << 22) | ||
87 | #define CLOCK_IN_OMAP16XX (1 << 23) | ||
88 | #define CLOCK_IN_OMAP242X (1 << 24) | ||
89 | #define CLOCK_IN_OMAP243X (1 << 25) | ||
90 | |||
91 | #endif | ||
diff --git a/include/asm-arm/arch-omap/common.h b/include/asm-arm/arch-omap/common.h index 2a676b4f13b5..08d58abd8218 100644 --- a/include/asm-arm/arch-omap/common.h +++ b/include/asm-arm/arch-omap/common.h | |||
@@ -31,6 +31,6 @@ struct sys_timer; | |||
31 | 31 | ||
32 | extern void omap_map_common_io(void); | 32 | extern void omap_map_common_io(void); |
33 | extern struct sys_timer omap_timer; | 33 | extern struct sys_timer omap_timer; |
34 | extern void omap_serial_init(int ports[]); | 34 | extern void omap_serial_init(void); |
35 | 35 | ||
36 | #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ | 36 | #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ |
diff --git a/include/asm-arm/arch-omap/cpu.h b/include/asm-arm/arch-omap/cpu.h index 1119e2b53e72..ec7eb675d922 100644 --- a/include/asm-arm/arch-omap/cpu.h +++ b/include/asm-arm/arch-omap/cpu.h | |||
@@ -28,12 +28,7 @@ | |||
28 | 28 | ||
29 | extern unsigned int system_rev; | 29 | extern unsigned int system_rev; |
30 | 30 | ||
31 | #define OMAP_DIE_ID_0 0xfffe1800 | 31 | #define omap2_cpu_rev() ((system_rev >> 8) & 0x0f) |
32 | #define OMAP_DIE_ID_1 0xfffe1804 | ||
33 | #define OMAP_PRODUCTION_ID_0 0xfffe2000 | ||
34 | #define OMAP_PRODUCTION_ID_1 0xfffe2004 | ||
35 | #define OMAP32_ID_0 0xfffed400 | ||
36 | #define OMAP32_ID_1 0xfffed404 | ||
37 | 32 | ||
38 | /* | 33 | /* |
39 | * Test if multicore OMAP support is needed | 34 | * Test if multicore OMAP support is needed |
@@ -50,7 +45,7 @@ extern unsigned int system_rev; | |||
50 | # define OMAP_NAME omap730 | 45 | # define OMAP_NAME omap730 |
51 | # endif | 46 | # endif |
52 | #endif | 47 | #endif |
53 | #ifdef CONFIG_ARCH_OMAP1510 | 48 | #ifdef CONFIG_ARCH_OMAP15XX |
54 | # ifdef OMAP_NAME | 49 | # ifdef OMAP_NAME |
55 | # undef MULTI_OMAP1 | 50 | # undef MULTI_OMAP1 |
56 | # define MULTI_OMAP1 | 51 | # define MULTI_OMAP1 |
@@ -79,9 +74,11 @@ extern unsigned int system_rev; | |||
79 | * Macros to group OMAP into cpu classes. | 74 | * Macros to group OMAP into cpu classes. |
80 | * These can be used in most places. | 75 | * These can be used in most places. |
81 | * cpu_is_omap7xx(): True for OMAP730 | 76 | * cpu_is_omap7xx(): True for OMAP730 |
82 | * cpu_is_omap15xx(): True for OMAP1510 and OMAP5910 | 77 | * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 |
83 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 | 78 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 |
84 | * cpu_is_omap24xx(): True for OMAP2420 | 79 | * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 |
80 | * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 | ||
81 | * cpu_is_omap243x(): True for OMAP2430 | ||
85 | */ | 82 | */ |
86 | #define GET_OMAP_CLASS (system_rev & 0xff) | 83 | #define GET_OMAP_CLASS (system_rev & 0xff) |
87 | 84 | ||
@@ -91,22 +88,35 @@ static inline int is_omap ##class (void) \ | |||
91 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ | 88 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ |
92 | } | 89 | } |
93 | 90 | ||
91 | #define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff) | ||
92 | |||
93 | #define IS_OMAP_SUBCLASS(subclass, id) \ | ||
94 | static inline int is_omap ##subclass (void) \ | ||
95 | { \ | ||
96 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ | ||
97 | } | ||
98 | |||
94 | IS_OMAP_CLASS(7xx, 0x07) | 99 | IS_OMAP_CLASS(7xx, 0x07) |
95 | IS_OMAP_CLASS(15xx, 0x15) | 100 | IS_OMAP_CLASS(15xx, 0x15) |
96 | IS_OMAP_CLASS(16xx, 0x16) | 101 | IS_OMAP_CLASS(16xx, 0x16) |
97 | IS_OMAP_CLASS(24xx, 0x24) | 102 | IS_OMAP_CLASS(24xx, 0x24) |
98 | 103 | ||
104 | IS_OMAP_SUBCLASS(242x, 0x242) | ||
105 | IS_OMAP_SUBCLASS(243x, 0x243) | ||
106 | |||
99 | #define cpu_is_omap7xx() 0 | 107 | #define cpu_is_omap7xx() 0 |
100 | #define cpu_is_omap15xx() 0 | 108 | #define cpu_is_omap15xx() 0 |
101 | #define cpu_is_omap16xx() 0 | 109 | #define cpu_is_omap16xx() 0 |
102 | #define cpu_is_omap24xx() 0 | 110 | #define cpu_is_omap24xx() 0 |
111 | #define cpu_is_omap242x() 0 | ||
112 | #define cpu_is_omap243x() 0 | ||
103 | 113 | ||
104 | #if defined(MULTI_OMAP1) | 114 | #if defined(MULTI_OMAP1) |
105 | # if defined(CONFIG_ARCH_OMAP730) | 115 | # if defined(CONFIG_ARCH_OMAP730) |
106 | # undef cpu_is_omap7xx | 116 | # undef cpu_is_omap7xx |
107 | # define cpu_is_omap7xx() is_omap7xx() | 117 | # define cpu_is_omap7xx() is_omap7xx() |
108 | # endif | 118 | # endif |
109 | # if defined(CONFIG_ARCH_OMAP1510) | 119 | # if defined(CONFIG_ARCH_OMAP15XX) |
110 | # undef cpu_is_omap15xx | 120 | # undef cpu_is_omap15xx |
111 | # define cpu_is_omap15xx() is_omap15xx() | 121 | # define cpu_is_omap15xx() is_omap15xx() |
112 | # endif | 122 | # endif |
@@ -119,7 +129,7 @@ IS_OMAP_CLASS(24xx, 0x24) | |||
119 | # undef cpu_is_omap7xx | 129 | # undef cpu_is_omap7xx |
120 | # define cpu_is_omap7xx() 1 | 130 | # define cpu_is_omap7xx() 1 |
121 | # endif | 131 | # endif |
122 | # if defined(CONFIG_ARCH_OMAP1510) | 132 | # if defined(CONFIG_ARCH_OMAP15XX) |
123 | # undef cpu_is_omap15xx | 133 | # undef cpu_is_omap15xx |
124 | # define cpu_is_omap15xx() 1 | 134 | # define cpu_is_omap15xx() 1 |
125 | # endif | 135 | # endif |
@@ -129,13 +139,18 @@ IS_OMAP_CLASS(24xx, 0x24) | |||
129 | # endif | 139 | # endif |
130 | # if defined(CONFIG_ARCH_OMAP24XX) | 140 | # if defined(CONFIG_ARCH_OMAP24XX) |
131 | # undef cpu_is_omap24xx | 141 | # undef cpu_is_omap24xx |
142 | # undef cpu_is_omap242x | ||
143 | # undef cpu_is_omap243x | ||
132 | # define cpu_is_omap24xx() 1 | 144 | # define cpu_is_omap24xx() 1 |
145 | # define cpu_is_omap242x() is_omap242x() | ||
146 | # define cpu_is_omap243x() is_omap243x() | ||
133 | # endif | 147 | # endif |
134 | #endif | 148 | #endif |
135 | 149 | ||
136 | /* | 150 | /* |
137 | * Macros to detect individual cpu types. | 151 | * Macros to detect individual cpu types. |
138 | * These are only rarely needed. | 152 | * These are only rarely needed. |
153 | * cpu_is_omap330(): True for OMAP330 | ||
139 | * cpu_is_omap730(): True for OMAP730 | 154 | * cpu_is_omap730(): True for OMAP730 |
140 | * cpu_is_omap1510(): True for OMAP1510 | 155 | * cpu_is_omap1510(): True for OMAP1510 |
141 | * cpu_is_omap1610(): True for OMAP1610 | 156 | * cpu_is_omap1610(): True for OMAP1610 |
@@ -144,6 +159,9 @@ IS_OMAP_CLASS(24xx, 0x24) | |||
144 | * cpu_is_omap1621(): True for OMAP1621 | 159 | * cpu_is_omap1621(): True for OMAP1621 |
145 | * cpu_is_omap1710(): True for OMAP1710 | 160 | * cpu_is_omap1710(): True for OMAP1710 |
146 | * cpu_is_omap2420(): True for OMAP2420 | 161 | * cpu_is_omap2420(): True for OMAP2420 |
162 | * cpu_is_omap2422(): True for OMAP2422 | ||
163 | * cpu_is_omap2423(): True for OMAP2423 | ||
164 | * cpu_is_omap2430(): True for OMAP2430 | ||
147 | */ | 165 | */ |
148 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) | 166 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) |
149 | 167 | ||
@@ -153,6 +171,7 @@ static inline int is_omap ##type (void) \ | |||
153 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ | 171 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ |
154 | } | 172 | } |
155 | 173 | ||
174 | IS_OMAP_TYPE(310, 0x0310) | ||
156 | IS_OMAP_TYPE(730, 0x0730) | 175 | IS_OMAP_TYPE(730, 0x0730) |
157 | IS_OMAP_TYPE(1510, 0x1510) | 176 | IS_OMAP_TYPE(1510, 0x1510) |
158 | IS_OMAP_TYPE(1610, 0x1610) | 177 | IS_OMAP_TYPE(1610, 0x1610) |
@@ -161,7 +180,11 @@ IS_OMAP_TYPE(5912, 0x1611) | |||
161 | IS_OMAP_TYPE(1621, 0x1621) | 180 | IS_OMAP_TYPE(1621, 0x1621) |
162 | IS_OMAP_TYPE(1710, 0x1710) | 181 | IS_OMAP_TYPE(1710, 0x1710) |
163 | IS_OMAP_TYPE(2420, 0x2420) | 182 | IS_OMAP_TYPE(2420, 0x2420) |
183 | IS_OMAP_TYPE(2422, 0x2422) | ||
184 | IS_OMAP_TYPE(2423, 0x2423) | ||
185 | IS_OMAP_TYPE(2430, 0x2430) | ||
164 | 186 | ||
187 | #define cpu_is_omap310() 0 | ||
165 | #define cpu_is_omap730() 0 | 188 | #define cpu_is_omap730() 0 |
166 | #define cpu_is_omap1510() 0 | 189 | #define cpu_is_omap1510() 0 |
167 | #define cpu_is_omap1610() 0 | 190 | #define cpu_is_omap1610() 0 |
@@ -170,31 +193,33 @@ IS_OMAP_TYPE(2420, 0x2420) | |||
170 | #define cpu_is_omap1621() 0 | 193 | #define cpu_is_omap1621() 0 |
171 | #define cpu_is_omap1710() 0 | 194 | #define cpu_is_omap1710() 0 |
172 | #define cpu_is_omap2420() 0 | 195 | #define cpu_is_omap2420() 0 |
196 | #define cpu_is_omap2422() 0 | ||
197 | #define cpu_is_omap2423() 0 | ||
198 | #define cpu_is_omap2430() 0 | ||
173 | 199 | ||
174 | #if defined(MULTI_OMAP1) | 200 | #if defined(MULTI_OMAP1) |
175 | # if defined(CONFIG_ARCH_OMAP730) | 201 | # if defined(CONFIG_ARCH_OMAP730) |
176 | # undef cpu_is_omap730 | 202 | # undef cpu_is_omap730 |
177 | # define cpu_is_omap730() is_omap730() | 203 | # define cpu_is_omap730() is_omap730() |
178 | # endif | 204 | # endif |
179 | # if defined(CONFIG_ARCH_OMAP1510) | ||
180 | # undef cpu_is_omap1510 | ||
181 | # define cpu_is_omap1510() is_omap1510() | ||
182 | # endif | ||
183 | #else | 205 | #else |
184 | # if defined(CONFIG_ARCH_OMAP730) | 206 | # if defined(CONFIG_ARCH_OMAP730) |
185 | # undef cpu_is_omap730 | 207 | # undef cpu_is_omap730 |
186 | # define cpu_is_omap730() 1 | 208 | # define cpu_is_omap730() 1 |
187 | # endif | 209 | # endif |
188 | # if defined(CONFIG_ARCH_OMAP1510) | ||
189 | # undef cpu_is_omap1510 | ||
190 | # define cpu_is_omap1510() 1 | ||
191 | # endif | ||
192 | #endif | 210 | #endif |
193 | 211 | ||
194 | /* | 212 | /* |
195 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish | 213 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish |
196 | * between 1611B/5912 and 1710. | 214 | * between 330 vs. 1510 and 1611B/5912 vs. 1710. |
197 | */ | 215 | */ |
216 | #if defined(CONFIG_ARCH_OMAP15XX) | ||
217 | # undef cpu_is_omap310 | ||
218 | # undef cpu_is_omap1510 | ||
219 | # define cpu_is_omap310() is_omap310() | ||
220 | # define cpu_is_omap1510() is_omap1510() | ||
221 | #endif | ||
222 | |||
198 | #if defined(CONFIG_ARCH_OMAP16XX) | 223 | #if defined(CONFIG_ARCH_OMAP16XX) |
199 | # undef cpu_is_omap1610 | 224 | # undef cpu_is_omap1610 |
200 | # undef cpu_is_omap1611 | 225 | # undef cpu_is_omap1611 |
@@ -208,9 +233,20 @@ IS_OMAP_TYPE(2420, 0x2420) | |||
208 | # define cpu_is_omap1710() is_omap1710() | 233 | # define cpu_is_omap1710() is_omap1710() |
209 | #endif | 234 | #endif |
210 | 235 | ||
211 | #if defined(CONFIG_ARCH_OMAP2420) | 236 | #if defined(CONFIG_ARCH_OMAP24XX) |
212 | # undef cpu_is_omap2420 | 237 | # undef cpu_is_omap2420 |
213 | # define cpu_is_omap2420() 1 | 238 | # undef cpu_is_omap2422 |
239 | # undef cpu_is_omap2423 | ||
240 | # undef cpu_is_omap2430 | ||
241 | # define cpu_is_omap2420() is_omap2420() | ||
242 | # define cpu_is_omap2422() is_omap2422() | ||
243 | # define cpu_is_omap2423() is_omap2423() | ||
244 | # define cpu_is_omap2430() is_omap2430() | ||
214 | #endif | 245 | #endif |
215 | 246 | ||
247 | /* Macros to detect if we have OMAP1 or OMAP2 */ | ||
248 | #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ | ||
249 | cpu_is_omap16xx()) | ||
250 | #define cpu_class_is_omap2() cpu_is_omap24xx() | ||
251 | |||
216 | #endif | 252 | #endif |
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h index 04ebef5c6e95..ccbcb580a5c1 100644 --- a/include/asm-arm/arch-omap/dma.h +++ b/include/asm-arm/arch-omap/dma.h | |||
@@ -22,9 +22,109 @@ | |||
22 | #define __ASM_ARCH_DMA_H | 22 | #define __ASM_ARCH_DMA_H |
23 | 23 | ||
24 | #define MAX_DMA_ADDRESS 0xffffffff | 24 | #define MAX_DMA_ADDRESS 0xffffffff |
25 | #define MAX_DMA_CHANNELS 0 | ||
26 | |||
27 | /* Hardware registers for omap1 */ | ||
28 | #define OMAP_DMA_BASE (0xfffed800) | ||
29 | #define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400) | ||
30 | #define OMAP_DMA_GSCR (OMAP_DMA_BASE + 0x404) | ||
31 | #define OMAP_DMA_GRST (OMAP_DMA_BASE + 0x408) | ||
32 | #define OMAP_DMA_HW_ID (OMAP_DMA_BASE + 0x442) | ||
33 | #define OMAP_DMA_PCH2_ID (OMAP_DMA_BASE + 0x444) | ||
34 | #define OMAP_DMA_PCH0_ID (OMAP_DMA_BASE + 0x446) | ||
35 | #define OMAP_DMA_PCH1_ID (OMAP_DMA_BASE + 0x448) | ||
36 | #define OMAP_DMA_PCHG_ID (OMAP_DMA_BASE + 0x44a) | ||
37 | #define OMAP_DMA_PCHD_ID (OMAP_DMA_BASE + 0x44c) | ||
38 | #define OMAP_DMA_CAPS_0_U (OMAP_DMA_BASE + 0x44e) | ||
39 | #define OMAP_DMA_CAPS_0_L (OMAP_DMA_BASE + 0x450) | ||
40 | #define OMAP_DMA_CAPS_1_U (OMAP_DMA_BASE + 0x452) | ||
41 | #define OMAP_DMA_CAPS_1_L (OMAP_DMA_BASE + 0x454) | ||
42 | #define OMAP_DMA_CAPS_2 (OMAP_DMA_BASE + 0x456) | ||
43 | #define OMAP_DMA_CAPS_3 (OMAP_DMA_BASE + 0x458) | ||
44 | #define OMAP_DMA_CAPS_4 (OMAP_DMA_BASE + 0x45a) | ||
45 | #define OMAP_DMA_PCH2_SR (OMAP_DMA_BASE + 0x460) | ||
46 | #define OMAP_DMA_PCH0_SR (OMAP_DMA_BASE + 0x480) | ||
47 | #define OMAP_DMA_PCH1_SR (OMAP_DMA_BASE + 0x482) | ||
48 | #define OMAP_DMA_PCHD_SR (OMAP_DMA_BASE + 0x4c0) | ||
49 | |||
50 | /* Hardware registers for omap2 */ | ||
51 | #define OMAP24XX_DMA_BASE (L4_24XX_BASE + 0x56000) | ||
52 | #define OMAP_DMA4_REVISION (OMAP24XX_DMA_BASE + 0x00) | ||
53 | #define OMAP_DMA4_GCR_REG (OMAP24XX_DMA_BASE + 0x78) | ||
54 | #define OMAP_DMA4_IRQSTATUS_L0 (OMAP24XX_DMA_BASE + 0x08) | ||
55 | #define OMAP_DMA4_IRQSTATUS_L1 (OMAP24XX_DMA_BASE + 0x0c) | ||
56 | #define OMAP_DMA4_IRQSTATUS_L2 (OMAP24XX_DMA_BASE + 0x10) | ||
57 | #define OMAP_DMA4_IRQSTATUS_L3 (OMAP24XX_DMA_BASE + 0x14) | ||
58 | #define OMAP_DMA4_IRQENABLE_L0 (OMAP24XX_DMA_BASE + 0x18) | ||
59 | #define OMAP_DMA4_IRQENABLE_L1 (OMAP24XX_DMA_BASE + 0x1c) | ||
60 | #define OMAP_DMA4_IRQENABLE_L2 (OMAP24XX_DMA_BASE + 0x20) | ||
61 | #define OMAP_DMA4_IRQENABLE_L3 (OMAP24XX_DMA_BASE + 0x24) | ||
62 | #define OMAP_DMA4_SYSSTATUS (OMAP24XX_DMA_BASE + 0x28) | ||
63 | #define OMAP_DMA4_CAPS_0 (OMAP24XX_DMA_BASE + 0x64) | ||
64 | #define OMAP_DMA4_CAPS_2 (OMAP24XX_DMA_BASE + 0x6c) | ||
65 | #define OMAP_DMA4_CAPS_3 (OMAP24XX_DMA_BASE + 0x70) | ||
66 | #define OMAP_DMA4_CAPS_4 (OMAP24XX_DMA_BASE + 0x74) | ||
67 | |||
68 | #ifdef CONFIG_ARCH_OMAP1 | ||
25 | 69 | ||
26 | #define OMAP_LOGICAL_DMA_CH_COUNT 17 | 70 | #define OMAP_LOGICAL_DMA_CH_COUNT 17 |
27 | 71 | ||
72 | /* Common channel specific registers for omap1 */ | ||
73 | #define OMAP_DMA_CSDP_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x00) | ||
74 | #define OMAP_DMA_CCR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x02) | ||
75 | #define OMAP_DMA_CICR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x04) | ||
76 | #define OMAP_DMA_CSR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x06) | ||
77 | #define OMAP_DMA_CEN_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x10) | ||
78 | #define OMAP_DMA_CFN_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x12) | ||
79 | #define OMAP_DMA_CSFI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x14) | ||
80 | #define OMAP_DMA_CSEI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x16) | ||
81 | #define OMAP_DMA_CSAC_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x18) | ||
82 | #define OMAP_DMA_CDAC_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1a) | ||
83 | #define OMAP_DMA_CDEI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1c) | ||
84 | #define OMAP_DMA_CDFI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1e) | ||
85 | #define OMAP_DMA_CLNK_CTRL_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x28) | ||
86 | |||
87 | #else | ||
88 | |||
89 | #define OMAP_LOGICAL_DMA_CH_COUNT 32 /* REVISIT: Is this 32 + 2? */ | ||
90 | |||
91 | /* Common channel specific registers for omap2 */ | ||
92 | #define OMAP_DMA_CCR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x80) | ||
93 | #define OMAP_DMA_CLNK_CTRL_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x84) | ||
94 | #define OMAP_DMA_CICR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x88) | ||
95 | #define OMAP_DMA_CSR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x8c) | ||
96 | #define OMAP_DMA_CSDP_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x90) | ||
97 | #define OMAP_DMA_CEN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x94) | ||
98 | #define OMAP_DMA_CFN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x98) | ||
99 | #define OMAP_DMA_CSEI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa4) | ||
100 | #define OMAP_DMA_CSFI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa8) | ||
101 | #define OMAP_DMA_CDEI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xac) | ||
102 | #define OMAP_DMA_CDFI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb0) | ||
103 | #define OMAP_DMA_CSAC_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb4) | ||
104 | #define OMAP_DMA_CDAC_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb8) | ||
105 | |||
106 | #endif | ||
107 | |||
108 | /* Channel specific registers only on omap1 */ | ||
109 | #define OMAP1_DMA_CSSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x08) | ||
110 | #define OMAP1_DMA_CSSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0a) | ||
111 | #define OMAP1_DMA_CDSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0c) | ||
112 | #define OMAP1_DMA_CDSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0e) | ||
113 | #define OMAP1_DMA_COLOR_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x20) | ||
114 | #define OMAP1_DMA_CCR2_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x24) | ||
115 | #define OMAP1_DMA_COLOR_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x22) | ||
116 | #define OMAP1_DMA_LCH_CTRL_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x2a) | ||
117 | |||
118 | /* Channel specific registers only on omap2 */ | ||
119 | #define OMAP2_DMA_CSSA_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x9c) | ||
120 | #define OMAP2_DMA_CDSA_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa0) | ||
121 | #define OMAP2_DMA_CCEN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xbc) | ||
122 | #define OMAP2_DMA_CCFN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xc0) | ||
123 | #define OMAP2_DMA_COLOR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xc4) | ||
124 | |||
125 | /*----------------------------------------------------------------------------*/ | ||
126 | |||
127 | /* DMA channels for omap1 */ | ||
28 | #define OMAP_DMA_NO_DEVICE 0 | 128 | #define OMAP_DMA_NO_DEVICE 0 |
29 | #define OMAP_DMA_MCSI1_TX 1 | 129 | #define OMAP_DMA_MCSI1_TX 1 |
30 | #define OMAP_DMA_MCSI1_RX 2 | 130 | #define OMAP_DMA_MCSI1_RX 2 |
@@ -85,29 +185,72 @@ | |||
85 | #define OMAP_DMA_MMC2_RX 55 | 185 | #define OMAP_DMA_MMC2_RX 55 |
86 | #define OMAP_DMA_CRYPTO_DES_OUT 56 | 186 | #define OMAP_DMA_CRYPTO_DES_OUT 56 |
87 | 187 | ||
188 | /* DMA channels for 24xx */ | ||
189 | #define OMAP24XX_DMA_NO_DEVICE 0 | ||
190 | #define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */ | ||
191 | #define OMAP24XX_DMA_EXT_NDMA_REQ0 2 /* S_DMA_1 */ | ||
192 | #define OMAP24XX_DMA_EXT_NDMA_REQ1 3 /* S_DMA_2 */ | ||
193 | #define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */ | ||
194 | #define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */ | ||
195 | #define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */ | ||
196 | #define OMAP24XX_DMA_VLYNQ_TX 7 /* S_DMA_6 */ | ||
197 | #define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */ | ||
198 | #define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */ | ||
199 | #define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */ | ||
200 | #define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */ | ||
201 | #define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */ | ||
202 | #define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */ | ||
88 | 203 | ||
89 | #define OMAP_DMA_BASE (0xfffed800) | 204 | #define OMAP24XX_DMA_EAC_AC_RD 17 /* S_DMA_16 */ |
90 | #define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400) | 205 | #define OMAP24XX_DMA_EAC_AC_WR 18 /* S_DMA_17 */ |
91 | #define OMAP_DMA_GSCR (OMAP_DMA_BASE + 0x404) | 206 | #define OMAP24XX_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */ |
92 | #define OMAP_DMA_GRST (OMAP_DMA_BASE + 0x408) | 207 | #define OMAP24XX_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */ |
93 | #define OMAP_DMA_HW_ID (OMAP_DMA_BASE + 0x442) | 208 | #define OMAP24XX_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */ |
94 | #define OMAP_DMA_PCH2_ID (OMAP_DMA_BASE + 0x444) | 209 | #define OMAP24XX_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */ |
95 | #define OMAP_DMA_PCH0_ID (OMAP_DMA_BASE + 0x446) | 210 | #define OMAP24XX_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */ |
96 | #define OMAP_DMA_PCH1_ID (OMAP_DMA_BASE + 0x448) | 211 | #define OMAP24XX_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */ |
97 | #define OMAP_DMA_PCHG_ID (OMAP_DMA_BASE + 0x44a) | 212 | #define OMAP24XX_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */ |
98 | #define OMAP_DMA_PCHD_ID (OMAP_DMA_BASE + 0x44c) | 213 | #define OMAP24XX_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */ |
99 | #define OMAP_DMA_CAPS_0_U (OMAP_DMA_BASE + 0x44e) | 214 | #define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */ |
100 | #define OMAP_DMA_CAPS_0_L (OMAP_DMA_BASE + 0x450) | 215 | #define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */ |
101 | #define OMAP_DMA_CAPS_1_U (OMAP_DMA_BASE + 0x452) | 216 | #define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */ |
102 | #define OMAP_DMA_CAPS_1_L (OMAP_DMA_BASE + 0x454) | 217 | #define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */ |
103 | #define OMAP_DMA_CAPS_2 (OMAP_DMA_BASE + 0x456) | 218 | #define OMAP24XX_DMA_MCBSP1_TX 31 /* SDMA_30 */ |
104 | #define OMAP_DMA_CAPS_3 (OMAP_DMA_BASE + 0x458) | 219 | #define OMAP24XX_DMA_MCBSP1_RX 32 /* SDMA_31 */ |
105 | #define OMAP_DMA_CAPS_4 (OMAP_DMA_BASE + 0x45a) | 220 | #define OMAP24XX_DMA_MCBSP2_TX 33 /* SDMA_32 */ |
106 | #define OMAP_DMA_PCH2_SR (OMAP_DMA_BASE + 0x460) | 221 | #define OMAP24XX_DMA_MCBSP2_RX 34 /* SDMA_33 */ |
107 | #define OMAP_DMA_PCH0_SR (OMAP_DMA_BASE + 0x480) | 222 | #define OMAP24XX_DMA_SPI1_TX0 35 /* SDMA_34 */ |
108 | #define OMAP_DMA_PCH1_SR (OMAP_DMA_BASE + 0x482) | 223 | #define OMAP24XX_DMA_SPI1_RX0 36 /* SDMA_35 */ |
109 | #define OMAP_DMA_PCHD_SR (OMAP_DMA_BASE + 0x4c0) | 224 | #define OMAP24XX_DMA_SPI1_TX1 37 /* SDMA_36 */ |
225 | #define OMAP24XX_DMA_SPI1_RX1 38 /* SDMA_37 */ | ||
226 | #define OMAP24XX_DMA_SPI1_TX2 39 /* SDMA_38 */ | ||
227 | #define OMAP24XX_DMA_SPI1_RX2 40 /* SDMA_39 */ | ||
228 | #define OMAP24XX_DMA_SPI1_TX3 41 /* SDMA_40 */ | ||
229 | #define OMAP24XX_DMA_SPI1_RX3 42 /* SDMA_41 */ | ||
230 | #define OMAP24XX_DMA_SPI2_TX0 43 /* SDMA_42 */ | ||
231 | #define OMAP24XX_DMA_SPI2_RX0 44 /* SDMA_43 */ | ||
232 | #define OMAP24XX_DMA_SPI2_TX1 45 /* SDMA_44 */ | ||
233 | #define OMAP24XX_DMA_SPI2_RX1 46 /* SDMA_45 */ | ||
110 | 234 | ||
235 | #define OMAP24XX_DMA_UART1_TX 49 /* SDMA_48 */ | ||
236 | #define OMAP24XX_DMA_UART1_RX 50 /* SDMA_49 */ | ||
237 | #define OMAP24XX_DMA_UART2_TX 51 /* SDMA_50 */ | ||
238 | #define OMAP24XX_DMA_UART2_RX 52 /* SDMA_51 */ | ||
239 | #define OMAP24XX_DMA_UART3_TX 53 /* SDMA_52 */ | ||
240 | #define OMAP24XX_DMA_UART3_RX 54 /* SDMA_53 */ | ||
241 | #define OMAP24XX_DMA_USB_W2FC_TX0 55 /* SDMA_54 */ | ||
242 | #define OMAP24XX_DMA_USB_W2FC_RX0 56 /* SDMA_55 */ | ||
243 | #define OMAP24XX_DMA_USB_W2FC_TX1 57 /* SDMA_56 */ | ||
244 | #define OMAP24XX_DMA_USB_W2FC_RX1 58 /* SDMA_57 */ | ||
245 | #define OMAP24XX_DMA_USB_W2FC_TX2 59 /* SDMA_58 */ | ||
246 | #define OMAP24XX_DMA_USB_W2FC_RX2 60 /* SDMA_59 */ | ||
247 | #define OMAP24XX_DMA_MMC1_TX 61 /* SDMA_60 */ | ||
248 | #define OMAP24XX_DMA_MMC1_RX 62 /* SDMA_61 */ | ||
249 | #define OMAP24XX_DMA_MS 63 /* SDMA_62 */ | ||
250 | |||
251 | /*----------------------------------------------------------------------------*/ | ||
252 | |||
253 | /* Hardware registers for LCD DMA */ | ||
111 | #define OMAP1510_DMA_LCD_BASE (0xfffedb00) | 254 | #define OMAP1510_DMA_LCD_BASE (0xfffedb00) |
112 | #define OMAP1510_DMA_LCD_CTRL (OMAP1510_DMA_LCD_BASE + 0x00) | 255 | #define OMAP1510_DMA_LCD_CTRL (OMAP1510_DMA_LCD_BASE + 0x00) |
113 | #define OMAP1510_DMA_LCD_TOP_F1_L (OMAP1510_DMA_LCD_BASE + 0x02) | 256 | #define OMAP1510_DMA_LCD_TOP_F1_L (OMAP1510_DMA_LCD_BASE + 0x02) |
@@ -116,7 +259,7 @@ | |||
116 | #define OMAP1510_DMA_LCD_BOT_F1_U (OMAP1510_DMA_LCD_BASE + 0x08) | 259 | #define OMAP1510_DMA_LCD_BOT_F1_U (OMAP1510_DMA_LCD_BASE + 0x08) |
117 | 260 | ||
118 | #define OMAP1610_DMA_LCD_BASE (0xfffee300) | 261 | #define OMAP1610_DMA_LCD_BASE (0xfffee300) |
119 | #define OMAP1610_DMA_LCD_CSDP (OMAP1610_DMA_LCD_BASE + 0xc0) | 262 | #define OMAP1610_DMA_LCD_CSDP (OMAP1610_DMA_LCD_BASE + 0xc0) |
120 | #define OMAP1610_DMA_LCD_CCR (OMAP1610_DMA_LCD_BASE + 0xc2) | 263 | #define OMAP1610_DMA_LCD_CCR (OMAP1610_DMA_LCD_BASE + 0xc2) |
121 | #define OMAP1610_DMA_LCD_CTRL (OMAP1610_DMA_LCD_BASE + 0xc4) | 264 | #define OMAP1610_DMA_LCD_CTRL (OMAP1610_DMA_LCD_BASE + 0xc4) |
122 | #define OMAP1610_DMA_LCD_TOP_B1_L (OMAP1610_DMA_LCD_BASE + 0xc8) | 265 | #define OMAP1610_DMA_LCD_TOP_B1_L (OMAP1610_DMA_LCD_BASE + 0xc8) |
@@ -134,37 +277,18 @@ | |||
134 | #define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea) | 277 | #define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea) |
135 | #define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4) | 278 | #define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4) |
136 | 279 | ||
137 | 280 | #define OMAP_DMA_TOUT_IRQ (1 << 0) /* Only on omap1 */ | |
138 | /* Every LCh has its own set of the registers below */ | ||
139 | #define OMAP_DMA_CSDP(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x00) | ||
140 | #define OMAP_DMA_CCR(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x02) | ||
141 | #define OMAP_DMA_CICR(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x04) | ||
142 | #define OMAP_DMA_CSR(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x06) | ||
143 | #define OMAP_DMA_CSSA_L(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x08) | ||
144 | #define OMAP_DMA_CSSA_U(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x0a) | ||
145 | #define OMAP_DMA_CDSA_L(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x0c) | ||
146 | #define OMAP_DMA_CDSA_U(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x0e) | ||
147 | #define OMAP_DMA_CEN(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x10) | ||
148 | #define OMAP_DMA_CFN(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x12) | ||
149 | #define OMAP_DMA_CSFI(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x14) | ||
150 | #define OMAP_DMA_CSEI(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x16) | ||
151 | #define OMAP_DMA_CSAC(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x18) | ||
152 | #define OMAP_DMA_CDAC(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x1a) | ||
153 | #define OMAP_DMA_CDEI(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x1c) | ||
154 | #define OMAP_DMA_CDFI(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x1e) | ||
155 | #define OMAP_DMA_COLOR_L(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x20) | ||
156 | #define OMAP_DMA_COLOR_U(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x22) | ||
157 | #define OMAP_DMA_CCR2(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x24) | ||
158 | #define OMAP_DMA_CLNK_CTRL(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x28) | ||
159 | #define OMAP_DMA_LCH_CTRL(n) (OMAP_DMA_BASE + 0x40 * (n) + 0x2a) | ||
160 | |||
161 | #define OMAP_DMA_TOUT_IRQ (1 << 0) | ||
162 | #define OMAP_DMA_DROP_IRQ (1 << 1) | 281 | #define OMAP_DMA_DROP_IRQ (1 << 1) |
163 | #define OMAP_DMA_HALF_IRQ (1 << 2) | 282 | #define OMAP_DMA_HALF_IRQ (1 << 2) |
164 | #define OMAP_DMA_FRAME_IRQ (1 << 3) | 283 | #define OMAP_DMA_FRAME_IRQ (1 << 3) |
165 | #define OMAP_DMA_LAST_IRQ (1 << 4) | 284 | #define OMAP_DMA_LAST_IRQ (1 << 4) |
166 | #define OMAP_DMA_BLOCK_IRQ (1 << 5) | 285 | #define OMAP_DMA_BLOCK_IRQ (1 << 5) |
167 | #define OMAP_DMA_SYNC_IRQ (1 << 6) | 286 | #define OMAP1_DMA_SYNC_IRQ (1 << 6) |
287 | #define OMAP2_DMA_PKT_IRQ (1 << 7) | ||
288 | #define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8) | ||
289 | #define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9) | ||
290 | #define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10) | ||
291 | #define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11) | ||
168 | 292 | ||
169 | #define OMAP_DMA_DATA_TYPE_S8 0x00 | 293 | #define OMAP_DMA_DATA_TYPE_S8 0x00 |
170 | #define OMAP_DMA_DATA_TYPE_S16 0x01 | 294 | #define OMAP_DMA_DATA_TYPE_S16 0x01 |
@@ -194,6 +318,7 @@ enum { | |||
194 | OMAP_LCD_DMA_B2_BOTTOM | 318 | OMAP_LCD_DMA_B2_BOTTOM |
195 | }; | 319 | }; |
196 | 320 | ||
321 | /* REVISIT: Check if BURST_4 is really 1 (or 2) */ | ||
197 | enum omap_dma_burst_mode { | 322 | enum omap_dma_burst_mode { |
198 | OMAP_DMA_DATA_BURST_DIS = 0, | 323 | OMAP_DMA_DATA_BURST_DIS = 0, |
199 | OMAP_DMA_DATA_BURST_4, | 324 | OMAP_DMA_DATA_BURST_4, |
@@ -206,6 +331,31 @@ enum omap_dma_color_mode { | |||
206 | OMAP_DMA_TRANSPARENT_COPY | 331 | OMAP_DMA_TRANSPARENT_COPY |
207 | }; | 332 | }; |
208 | 333 | ||
334 | struct omap_dma_channel_params { | ||
335 | int data_type; /* data type 8,16,32 */ | ||
336 | int elem_count; /* number of elements in a frame */ | ||
337 | int frame_count; /* number of frames in a element */ | ||
338 | |||
339 | int src_port; /* Only on OMAP1 REVISIT: Is this needed? */ | ||
340 | int src_amode; /* constant , post increment, indexed , double indexed */ | ||
341 | int src_start; /* source address : physical */ | ||
342 | int src_ei; /* source element index */ | ||
343 | int src_fi; /* source frame index */ | ||
344 | |||
345 | int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */ | ||
346 | int dst_amode; /* constant , post increment, indexed , double indexed */ | ||
347 | int dst_start; /* source address : physical */ | ||
348 | int dst_ei; /* source element index */ | ||
349 | int dst_fi; /* source frame index */ | ||
350 | |||
351 | int trigger; /* trigger attached if the channel is synchronized */ | ||
352 | int sync_mode; /* sycn on element, frame , block or packet */ | ||
353 | int src_or_dst_synch; /* source synch(1) or destination synch(0) */ | ||
354 | |||
355 | int ie; /* interrupt enabled */ | ||
356 | }; | ||
357 | |||
358 | |||
209 | extern void omap_set_dma_priority(int dst_port, int priority); | 359 | extern void omap_set_dma_priority(int dst_port, int priority); |
210 | extern int omap_request_dma(int dev_id, const char *dev_name, | 360 | extern int omap_request_dma(int dev_id, const char *dev_name, |
211 | void (* callback)(int lch, u16 ch_status, void *data), | 361 | void (* callback)(int lch, u16 ch_status, void *data), |
@@ -217,24 +367,30 @@ extern void omap_start_dma(int lch); | |||
217 | extern void omap_stop_dma(int lch); | 367 | extern void omap_stop_dma(int lch); |
218 | extern void omap_set_dma_transfer_params(int lch, int data_type, | 368 | extern void omap_set_dma_transfer_params(int lch, int data_type, |
219 | int elem_count, int frame_count, | 369 | int elem_count, int frame_count, |
220 | int sync_mode); | 370 | int sync_mode, |
371 | int dma_trigger, int src_or_dst_synch); | ||
221 | extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, | 372 | extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, |
222 | u32 color); | 373 | u32 color); |
223 | 374 | ||
224 | extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, | 375 | extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, |
225 | unsigned long src_start); | 376 | unsigned long src_start, |
377 | int src_ei, int src_fi); | ||
226 | extern void omap_set_dma_src_index(int lch, int eidx, int fidx); | 378 | extern void omap_set_dma_src_index(int lch, int eidx, int fidx); |
227 | extern void omap_set_dma_src_data_pack(int lch, int enable); | 379 | extern void omap_set_dma_src_data_pack(int lch, int enable); |
228 | extern void omap_set_dma_src_burst_mode(int lch, | 380 | extern void omap_set_dma_src_burst_mode(int lch, |
229 | enum omap_dma_burst_mode burst_mode); | 381 | enum omap_dma_burst_mode burst_mode); |
230 | 382 | ||
231 | extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, | 383 | extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, |
232 | unsigned long dest_start); | 384 | unsigned long dest_start, |
385 | int dst_ei, int dst_fi); | ||
233 | extern void omap_set_dma_dest_index(int lch, int eidx, int fidx); | 386 | extern void omap_set_dma_dest_index(int lch, int eidx, int fidx); |
234 | extern void omap_set_dma_dest_data_pack(int lch, int enable); | 387 | extern void omap_set_dma_dest_data_pack(int lch, int enable); |
235 | extern void omap_set_dma_dest_burst_mode(int lch, | 388 | extern void omap_set_dma_dest_burst_mode(int lch, |
236 | enum omap_dma_burst_mode burst_mode); | 389 | enum omap_dma_burst_mode burst_mode); |
237 | 390 | ||
391 | extern void omap_set_dma_params(int lch, | ||
392 | struct omap_dma_channel_params * params); | ||
393 | |||
238 | extern void omap_dma_link_lch (int lch_head, int lch_queue); | 394 | extern void omap_dma_link_lch (int lch_head, int lch_queue); |
239 | extern void omap_dma_unlink_lch (int lch_head, int lch_queue); | 395 | extern void omap_dma_unlink_lch (int lch_head, int lch_queue); |
240 | 396 | ||
@@ -244,9 +400,6 @@ extern int omap_get_dma_src_addr_counter(int lch); | |||
244 | extern void omap_clear_dma(int lch); | 400 | extern void omap_clear_dma(int lch); |
245 | extern int omap_dma_running(void); | 401 | extern int omap_dma_running(void); |
246 | 402 | ||
247 | /* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */ | ||
248 | extern int omap_dma_in_1510_mode(void); | ||
249 | |||
250 | /* LCD DMA functions */ | 403 | /* LCD DMA functions */ |
251 | extern int omap_request_lcd_dma(void (* callback)(u16 status, void *data), | 404 | extern int omap_request_lcd_dma(void (* callback)(u16 status, void *data), |
252 | void *data); | 405 | void *data); |
diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S index 0d29b9c56a95..f8814a84910e 100644 --- a/include/asm-arm/arch-omap/entry-macro.S +++ b/include/asm-arm/arch-omap/entry-macro.S | |||
@@ -10,6 +10,20 @@ | |||
10 | 10 | ||
11 | #if defined(CONFIG_ARCH_OMAP1) | 11 | #if defined(CONFIG_ARCH_OMAP1) |
12 | 12 | ||
13 | #if defined(CONFIG_ARCH_OMAP730) && \ | ||
14 | (defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)) | ||
15 | #error "FIXME: OMAP730 doesn't support multiple-OMAP" | ||
16 | #elif defined(CONFIG_ARCH_OMAP730) | ||
17 | #define INT_IH2_IRQ INT_730_IH2_IRQ | ||
18 | #elif defined(CONFIG_ARCH_OMAP15XX) | ||
19 | #define INT_IH2_IRQ INT_1510_IH2_IRQ | ||
20 | #elif defined(CONFIG_ARCH_OMAP16XX) | ||
21 | #define INT_IH2_IRQ INT_1610_IH2_IRQ | ||
22 | #else | ||
23 | #warning "IH2 IRQ defaulted" | ||
24 | #define INT_IH2_IRQ INT_1510_IH2_IRQ | ||
25 | #endif | ||
26 | |||
13 | .macro disable_fiq | 27 | .macro disable_fiq |
14 | .endm | 28 | .endm |
15 | 29 | ||
diff --git a/include/asm-arm/arch-omap/fpga.h b/include/asm-arm/arch-omap/fpga.h index 676807dc50e1..6a883e0bdbb8 100644 --- a/include/asm-arm/arch-omap/fpga.h +++ b/include/asm-arm/arch-omap/fpga.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #ifndef __ASM_ARCH_OMAP_FPGA_H | 19 | #ifndef __ASM_ARCH_OMAP_FPGA_H |
20 | #define __ASM_ARCH_OMAP_FPGA_H | 20 | #define __ASM_ARCH_OMAP_FPGA_H |
21 | 21 | ||
22 | #if defined(CONFIG_MACH_OMAP_INNOVATOR) && defined(CONFIG_ARCH_OMAP1510) | 22 | #if defined(CONFIG_MACH_OMAP_INNOVATOR) && defined(CONFIG_ARCH_OMAP15XX) |
23 | extern void omap1510_fpga_init_irq(void); | 23 | extern void omap1510_fpga_init_irq(void); |
24 | #else | 24 | #else |
25 | #define omap1510_fpga_init_irq() (0) | 25 | #define omap1510_fpga_init_irq() (0) |
@@ -77,6 +77,8 @@ struct h2p2_dbg_fpga { | |||
77 | #define H2P2_DBG_FPGA_LOAD_METER_SIZE 11 | 77 | #define H2P2_DBG_FPGA_LOAD_METER_SIZE 11 |
78 | #define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1) | 78 | #define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1) |
79 | 79 | ||
80 | #define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0) | ||
81 | #define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1) | ||
80 | 82 | ||
81 | /* | 83 | /* |
82 | * --------------------------------------------------------------------------- | 84 | * --------------------------------------------------------------------------- |
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h index 74cb2b93b700..1b3885741ac1 100644 --- a/include/asm-arm/arch-omap/gpio.h +++ b/include/asm-arm/arch-omap/gpio.h | |||
@@ -67,7 +67,7 @@ | |||
67 | 67 | ||
68 | #define OMAP_GPIO_IRQ(nr) (OMAP_GPIO_IS_MPUIO(nr) ? \ | 68 | #define OMAP_GPIO_IRQ(nr) (OMAP_GPIO_IS_MPUIO(nr) ? \ |
69 | IH_MPUIO_BASE + ((nr) & 0x0f) : \ | 69 | IH_MPUIO_BASE + ((nr) & 0x0f) : \ |
70 | IH_GPIO_BASE + ((nr) & 0x3f)) | 70 | IH_GPIO_BASE + (nr)) |
71 | 71 | ||
72 | extern int omap_gpio_init(void); /* Call from board init only */ | 72 | extern int omap_gpio_init(void); /* Call from board init only */ |
73 | extern int omap_request_gpio(int gpio); | 73 | extern int omap_request_gpio(int gpio); |
diff --git a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h index 60201e1dd6ad..5406b875c422 100644 --- a/include/asm-arm/arch-omap/hardware.h +++ b/include/asm-arm/arch-omap/hardware.h | |||
@@ -267,8 +267,6 @@ | |||
267 | #define OMAP_LPG2_LCR (OMAP_LPG2_BASE + 0x00) | 267 | #define OMAP_LPG2_LCR (OMAP_LPG2_BASE + 0x00) |
268 | #define OMAP_LPG2_PMR (OMAP_LPG2_BASE + 0x04) | 268 | #define OMAP_LPG2_PMR (OMAP_LPG2_BASE + 0x04) |
269 | 269 | ||
270 | #ifndef __ASSEMBLER__ | ||
271 | |||
272 | /* | 270 | /* |
273 | * --------------------------------------------------------------------------- | 271 | * --------------------------------------------------------------------------- |
274 | * Processor specific defines | 272 | * Processor specific defines |
@@ -277,13 +275,11 @@ | |||
277 | 275 | ||
278 | #include "omap730.h" | 276 | #include "omap730.h" |
279 | #include "omap1510.h" | 277 | #include "omap1510.h" |
280 | |||
281 | #ifdef CONFIG_ARCH_OMAP24XX | ||
282 | #include "omap24xx.h" | 278 | #include "omap24xx.h" |
283 | #endif | ||
284 | |||
285 | #include "omap16xx.h" | 279 | #include "omap16xx.h" |
286 | 280 | ||
281 | #ifndef __ASSEMBLER__ | ||
282 | |||
287 | /* | 283 | /* |
288 | * --------------------------------------------------------------------------- | 284 | * --------------------------------------------------------------------------- |
289 | * Board specific defines | 285 | * Board specific defines |
diff --git a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h index 3d5bcd545082..f5bcc9a1aed6 100644 --- a/include/asm-arm/arch-omap/io.h +++ b/include/asm-arm/arch-omap/io.h | |||
@@ -52,23 +52,33 @@ | |||
52 | * ---------------------------------------------------------------------------- | 52 | * ---------------------------------------------------------------------------- |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #define PCIO_BASE 0 | ||
56 | |||
55 | #if defined(CONFIG_ARCH_OMAP1) | 57 | #if defined(CONFIG_ARCH_OMAP1) |
58 | |||
56 | #define IO_PHYS 0xFFFB0000 | 59 | #define IO_PHYS 0xFFFB0000 |
57 | #define IO_OFFSET -0x01000000 /* Virtual IO = 0xfefb0000 */ | 60 | #define IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ |
58 | #define IO_SIZE 0x40000 | 61 | #define IO_SIZE 0x40000 |
62 | #define IO_VIRT (IO_PHYS - IO_OFFSET) | ||
63 | #define IO_ADDRESS(pa) ((pa) - IO_OFFSET) | ||
64 | #define io_p2v(pa) ((pa) - IO_OFFSET) | ||
65 | #define io_v2p(va) ((va) + IO_OFFSET) | ||
59 | 66 | ||
60 | #elif defined(CONFIG_ARCH_OMAP2) | 67 | #elif defined(CONFIG_ARCH_OMAP2) |
61 | #define IO_PHYS 0x48000000 /* L4 peripherals; other stuff has to be mapped * | ||
62 | * manually. */ | ||
63 | #define IO_OFFSET 0x90000000 /* Virtual IO = 0xd8000000 */ | ||
64 | #define IO_SIZE 0x08000000 | ||
65 | #endif | ||
66 | 68 | ||
67 | #define IO_VIRT (IO_PHYS + IO_OFFSET) | 69 | /* We map both L3 and L4 on OMAP2 */ |
68 | #define IO_ADDRESS(x) ((x) + IO_OFFSET) | 70 | #define L3_24XX_PHYS L3_24XX_BASE /* 0x68000000 */ |
69 | #define PCIO_BASE 0 | 71 | #define L3_24XX_VIRT 0xf8000000 |
70 | #define io_p2v(x) ((x) + IO_OFFSET) | 72 | #define L3_24XX_SIZE SZ_1M /* 44kB of 128MB used, want 1MB sect */ |
71 | #define io_v2p(x) ((x) - IO_OFFSET) | 73 | #define L4_24XX_PHYS L4_24XX_BASE /* 0x48000000 */ |
74 | #define L4_24XX_VIRT 0xd8000000 | ||
75 | #define L4_24XX_SIZE SZ_1M /* 1MB of 128MB used, want 1MB sect */ | ||
76 | #define IO_OFFSET 0x90000000 | ||
77 | #define IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ | ||
78 | #define io_p2v(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ | ||
79 | #define io_v2p(va) ((va) - IO_OFFSET) /* Works for L3 and L4 */ | ||
80 | |||
81 | #endif | ||
72 | 82 | ||
73 | #ifndef __ASSEMBLER__ | 83 | #ifndef __ASSEMBLER__ |
74 | 84 | ||
diff --git a/include/asm-arm/arch-omap/irqs.h b/include/asm-arm/arch-omap/irqs.h index 74e108ccac16..9779686bdceb 100644 --- a/include/asm-arm/arch-omap/irqs.h +++ b/include/asm-arm/arch-omap/irqs.h | |||
@@ -22,8 +22,8 @@ | |||
22 | * are different. | 22 | * are different. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef __ASM_ARCH_OMAP1510_IRQS_H | 25 | #ifndef __ASM_ARCH_OMAP15XX_IRQS_H |
26 | #define __ASM_ARCH_OMAP1510_IRQS_H | 26 | #define __ASM_ARCH_OMAP15XX_IRQS_H |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * IRQ numbers for interrupt handler 1 | 29 | * IRQ numbers for interrupt handler 1 |
@@ -31,7 +31,6 @@ | |||
31 | * NOTE: See also the OMAP-1510 and 1610 specific IRQ numbers below | 31 | * NOTE: See also the OMAP-1510 and 1610 specific IRQ numbers below |
32 | * | 32 | * |
33 | */ | 33 | */ |
34 | #define INT_IH2_IRQ 0 | ||
35 | #define INT_CAMERA 1 | 34 | #define INT_CAMERA 1 |
36 | #define INT_FIQ 3 | 35 | #define INT_FIQ 3 |
37 | #define INT_RTDX 6 | 36 | #define INT_RTDX 6 |
@@ -60,6 +59,7 @@ | |||
60 | /* | 59 | /* |
61 | * OMAP-1510 specific IRQ numbers for interrupt handler 1 | 60 | * OMAP-1510 specific IRQ numbers for interrupt handler 1 |
62 | */ | 61 | */ |
62 | #define INT_1510_IH2_IRQ 0 | ||
63 | #define INT_1510_RES2 2 | 63 | #define INT_1510_RES2 2 |
64 | #define INT_1510_SPI_TX 4 | 64 | #define INT_1510_SPI_TX 4 |
65 | #define INT_1510_SPI_RX 5 | 65 | #define INT_1510_SPI_RX 5 |
@@ -71,6 +71,7 @@ | |||
71 | /* | 71 | /* |
72 | * OMAP-1610 specific IRQ numbers for interrupt handler 1 | 72 | * OMAP-1610 specific IRQ numbers for interrupt handler 1 |
73 | */ | 73 | */ |
74 | #define INT_1610_IH2_IRQ 0 | ||
74 | #define INT_1610_IH2_FIQ 2 | 75 | #define INT_1610_IH2_FIQ 2 |
75 | #define INT_1610_McBSP2_TX 4 | 76 | #define INT_1610_McBSP2_TX 4 |
76 | #define INT_1610_McBSP2_RX 5 | 77 | #define INT_1610_McBSP2_RX 5 |
@@ -231,6 +232,12 @@ | |||
231 | #define INT_730_DMA_CH15 (62 + IH2_BASE) | 232 | #define INT_730_DMA_CH15 (62 + IH2_BASE) |
232 | #define INT_730_NAND (63 + IH2_BASE) | 233 | #define INT_730_NAND (63 + IH2_BASE) |
233 | 234 | ||
235 | #define INT_24XX_SYS_NIRQ 7 | ||
236 | #define INT_24XX_SDMA_IRQ0 12 | ||
237 | #define INT_24XX_SDMA_IRQ1 13 | ||
238 | #define INT_24XX_SDMA_IRQ2 14 | ||
239 | #define INT_24XX_SDMA_IRQ3 15 | ||
240 | #define INT_24XX_DSS_IRQ 25 | ||
234 | #define INT_24XX_GPIO_BANK1 29 | 241 | #define INT_24XX_GPIO_BANK1 29 |
235 | #define INT_24XX_GPIO_BANK2 30 | 242 | #define INT_24XX_GPIO_BANK2 30 |
236 | #define INT_24XX_GPIO_BANK3 31 | 243 | #define INT_24XX_GPIO_BANK3 31 |
diff --git a/include/asm-arm/arch-omap/memory.h b/include/asm-arm/arch-omap/memory.h index bf545b6e0a26..df50dd53e1dd 100644 --- a/include/asm-arm/arch-omap/memory.h +++ b/include/asm-arm/arch-omap/memory.h | |||
@@ -61,7 +61,7 @@ | |||
61 | * Note that the is_lbus_device() test is not very efficient on 1510 | 61 | * Note that the is_lbus_device() test is not very efficient on 1510 |
62 | * because of the strncmp(). | 62 | * because of the strncmp(). |
63 | */ | 63 | */ |
64 | #ifdef CONFIG_ARCH_OMAP1510 | 64 | #ifdef CONFIG_ARCH_OMAP15XX |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * OMAP-1510 Local Bus address offset | 67 | * OMAP-1510 Local Bus address offset |
@@ -84,7 +84,7 @@ | |||
84 | virt_to_lbus(addr) : \ | 84 | virt_to_lbus(addr) : \ |
85 | __virt_to_bus(addr);}) | 85 | __virt_to_bus(addr);}) |
86 | 86 | ||
87 | #endif /* CONFIG_ARCH_OMAP1510 */ | 87 | #endif /* CONFIG_ARCH_OMAP15XX */ |
88 | 88 | ||
89 | #endif | 89 | #endif |
90 | 90 | ||
diff --git a/include/asm-arm/arch-omap/menelaus.h b/include/asm-arm/arch-omap/menelaus.h new file mode 100644 index 000000000000..46be8b8d6346 --- /dev/null +++ b/include/asm-arm/arch-omap/menelaus.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-omap/menelaus.h | ||
3 | * | ||
4 | * Functions to access Menelaus power management chip | ||
5 | */ | ||
6 | |||
7 | #ifndef __ASM_ARCH_MENELAUS_H | ||
8 | #define __ASM_ARCH_MENELAUS_H | ||
9 | |||
10 | extern void menelaus_mmc_register(void (*callback)(u8 card_mask), | ||
11 | unsigned long data); | ||
12 | extern void menelaus_mmc_remove(void); | ||
13 | extern void menelaus_mmc_opendrain(int enable); | ||
14 | |||
15 | #if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_MENELAUS) | ||
16 | #define omap_has_menelaus() 1 | ||
17 | #else | ||
18 | #define omap_has_menelaus() 0 | ||
19 | #endif | ||
20 | |||
21 | #endif | ||
22 | |||
diff --git a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h index 1b1ad4105349..13415a9aab06 100644 --- a/include/asm-arm/arch-omap/mux.h +++ b/include/asm-arm/arch-omap/mux.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Table of the Omap register configurations for the FUNC_MUX and | 4 | * Table of the Omap register configurations for the FUNC_MUX and |
5 | * PULL_DWN combinations. | 5 | * PULL_DWN combinations. |
6 | * | 6 | * |
7 | * Copyright (C) 2003 Nokia Corporation | 7 | * Copyright (C) 2003 - 2005 Nokia Corporation |
8 | * | 8 | * |
9 | * Written by Tony Lindgren <tony.lindgren@nokia.com> | 9 | * Written by Tony Lindgren <tony.lindgren@nokia.com> |
10 | * | 10 | * |
@@ -58,6 +58,16 @@ | |||
58 | .pu_pd_reg = PU_PD_SEL_##reg, \ | 58 | .pu_pd_reg = PU_PD_SEL_##reg, \ |
59 | .pu_pd_val = status, | 59 | .pu_pd_val = status, |
60 | 60 | ||
61 | #define MUX_REG_730(reg, mode_offset, mode) .mux_reg_name = "OMAP730_IO_CONF_"#reg, \ | ||
62 | .mux_reg = OMAP730_IO_CONF_##reg, \ | ||
63 | .mask_offset = mode_offset, \ | ||
64 | .mask = mode, | ||
65 | |||
66 | #define PULL_REG_730(reg, bit, status) .pull_name = "OMAP730_IO_CONF_"#reg, \ | ||
67 | .pull_reg = OMAP730_IO_CONF_##reg, \ | ||
68 | .pull_bit = bit, \ | ||
69 | .pull_val = status, | ||
70 | |||
61 | #else | 71 | #else |
62 | 72 | ||
63 | #define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \ | 73 | #define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \ |
@@ -71,6 +81,15 @@ | |||
71 | #define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \ | 81 | #define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \ |
72 | .pu_pd_val = status, | 82 | .pu_pd_val = status, |
73 | 83 | ||
84 | #define MUX_REG_730(reg, mode_offset, mode) \ | ||
85 | .mux_reg = OMAP730_IO_CONF_##reg, \ | ||
86 | .mask_offset = mode_offset, \ | ||
87 | .mask = mode, | ||
88 | |||
89 | #define PULL_REG_730(reg, bit, status) .pull_reg = OMAP730_IO_CONF_##reg, \ | ||
90 | .pull_bit = bit, \ | ||
91 | .pull_val = status, | ||
92 | |||
74 | #endif /* CONFIG_OMAP_MUX_DEBUG */ | 93 | #endif /* CONFIG_OMAP_MUX_DEBUG */ |
75 | 94 | ||
76 | #define MUX_CFG(desc, mux_reg, mode_offset, mode, \ | 95 | #define MUX_CFG(desc, mux_reg, mode_offset, mode, \ |
@@ -84,13 +103,44 @@ | |||
84 | PU_PD_REG(pu_pd_reg, pu_pd_status) \ | 103 | PU_PD_REG(pu_pd_reg, pu_pd_status) \ |
85 | }, | 104 | }, |
86 | 105 | ||
106 | |||
107 | /* | ||
108 | * OMAP730 has a slightly different config for the pin mux. | ||
109 | * - config regs are the OMAP730_IO_CONF_x regs (see omap730.h) regs and | ||
110 | * not the FUNC_MUX_CTRL_x regs from hardware.h | ||
111 | * - for pull-up/down, only has one enable bit which is is in the same register | ||
112 | * as mux config | ||
113 | */ | ||
114 | #define MUX_CFG_730(desc, mux_reg, mode_offset, mode, \ | ||
115 | pull_reg, pull_bit, pull_status, \ | ||
116 | pu_pd_reg, pu_pd_status, debug_status)\ | ||
117 | { \ | ||
118 | .name = desc, \ | ||
119 | .debug = debug_status, \ | ||
120 | MUX_REG_730(mux_reg, mode_offset, mode) \ | ||
121 | PULL_REG_730(mux_reg, pull_bit, pull_status) \ | ||
122 | PU_PD_REG(pu_pd_reg, pu_pd_status) \ | ||
123 | }, | ||
124 | |||
125 | #define MUX_CFG_24XX(desc, reg_offset, mode, \ | ||
126 | pull_en, pull_mode, dbg) \ | ||
127 | { \ | ||
128 | .name = desc, \ | ||
129 | .debug = dbg, \ | ||
130 | .mux_reg = reg_offset, \ | ||
131 | .mask = mode, \ | ||
132 | .pull_val = pull_en, \ | ||
133 | .pu_pd_val = pull_mode, \ | ||
134 | }, | ||
135 | |||
136 | |||
87 | #define PULL_DISABLED 0 | 137 | #define PULL_DISABLED 0 |
88 | #define PULL_ENABLED 1 | 138 | #define PULL_ENABLED 1 |
89 | 139 | ||
90 | #define PULL_DOWN 0 | 140 | #define PULL_DOWN 0 |
91 | #define PULL_UP 1 | 141 | #define PULL_UP 1 |
92 | 142 | ||
93 | typedef struct { | 143 | struct pin_config { |
94 | char *name; | 144 | char *name; |
95 | unsigned char busy; | 145 | unsigned char busy; |
96 | unsigned char debug; | 146 | unsigned char debug; |
@@ -108,13 +158,23 @@ typedef struct { | |||
108 | const char *pu_pd_name; | 158 | const char *pu_pd_name; |
109 | const unsigned int pu_pd_reg; | 159 | const unsigned int pu_pd_reg; |
110 | const unsigned char pu_pd_val; | 160 | const unsigned char pu_pd_val; |
111 | } reg_cfg_set; | 161 | }; |
112 | 162 | ||
113 | /* | 163 | enum omap730_index { |
114 | * Lookup table for FUNC_MUX and PULL_DWN register combinations for each | 164 | /* OMAP 730 keyboard */ |
115 | * device. See also reg_cfg_table below for the register values. | 165 | E2_730_KBR0, |
116 | */ | 166 | J7_730_KBR1, |
117 | typedef enum { | 167 | E1_730_KBR2, |
168 | F3_730_KBR3, | ||
169 | D2_730_KBR4, | ||
170 | C2_730_KBC0, | ||
171 | D3_730_KBC1, | ||
172 | E4_730_KBC2, | ||
173 | F4_730_KBC3, | ||
174 | E3_730_KBC4, | ||
175 | }; | ||
176 | |||
177 | enum omap1xxx_index { | ||
118 | /* UART1 (BT_UART_GATING)*/ | 178 | /* UART1 (BT_UART_GATING)*/ |
119 | UART1_TX = 0, | 179 | UART1_TX = 0, |
120 | UART1_RTS, | 180 | UART1_RTS, |
@@ -331,245 +391,34 @@ typedef enum { | |||
331 | V10_1610_CF_IREQ, | 391 | V10_1610_CF_IREQ, |
332 | W10_1610_CF_RESET, | 392 | W10_1610_CF_RESET, |
333 | W11_1610_CF_CD1, | 393 | W11_1610_CF_CD1, |
334 | } reg_cfg_t; | 394 | }; |
335 | 395 | ||
336 | #if defined(__MUX_C__) && defined(CONFIG_OMAP_MUX) | 396 | enum omap24xx_index { |
397 | /* 24xx I2C */ | ||
398 | M19_24XX_I2C1_SCL, | ||
399 | L15_24XX_I2C1_SDA, | ||
400 | J15_24XX_I2C2_SCL, | ||
401 | H19_24XX_I2C2_SDA, | ||
337 | 402 | ||
338 | /* | 403 | /* 24xx Menelaus interrupt */ |
339 | * Table of various FUNC_MUX and PULL_DWN combinations for each device. | 404 | W19_24XX_SYS_NIRQ, |
340 | * See also reg_cfg_t above for the lookup table. | ||
341 | */ | ||
342 | static const reg_cfg_set __initdata_or_module | ||
343 | reg_cfg_table[] = { | ||
344 | /* | ||
345 | * description mux mode mux pull pull pull pu_pd pu dbg | ||
346 | * reg offset mode reg bit ena reg | ||
347 | */ | ||
348 | MUX_CFG("UART1_TX", 9, 21, 1, 2, 3, 0, NA, 0, 0) | ||
349 | MUX_CFG("UART1_RTS", 9, 12, 1, 2, 0, 0, NA, 0, 0) | ||
350 | |||
351 | /* UART2 (COM_UART_GATING), conflicts with USB2 */ | ||
352 | MUX_CFG("UART2_TX", C, 27, 1, 3, 3, 0, NA, 0, 0) | ||
353 | MUX_CFG("UART2_RX", C, 18, 0, 3, 1, 1, NA, 0, 0) | ||
354 | MUX_CFG("UART2_CTS", C, 21, 0, 3, 1, 1, NA, 0, 0) | ||
355 | MUX_CFG("UART2_RTS", C, 24, 1, 3, 2, 0, NA, 0, 0) | ||
356 | |||
357 | /* UART3 (GIGA_UART_GATING) */ | ||
358 | MUX_CFG("UART3_TX", 6, 0, 1, 0, 30, 0, NA, 0, 0) | ||
359 | MUX_CFG("UART3_RX", 6, 3, 0, 0, 31, 1, NA, 0, 0) | ||
360 | MUX_CFG("UART3_CTS", 5, 12, 2, 0, 24, 0, NA, 0, 0) | ||
361 | MUX_CFG("UART3_RTS", 5, 15, 2, 0, 25, 0, NA, 0, 0) | ||
362 | MUX_CFG("UART3_CLKREQ", 9, 27, 0, 2, 5, 0, NA, 0, 0) | ||
363 | MUX_CFG("UART3_BCLK", A, 0, 0, 2, 6, 0, NA, 0, 0) | ||
364 | MUX_CFG("Y15_1610_UART3_RTS", A, 0, 1, 2, 6, 0, NA, 0, 0) | ||
365 | |||
366 | /* PWT & PWL, conflicts with UART3 */ | ||
367 | MUX_CFG("PWT", 6, 0, 2, 0, 30, 0, NA, 0, 0) | ||
368 | MUX_CFG("PWL", 6, 3, 1, 0, 31, 1, NA, 0, 0) | ||
369 | |||
370 | /* USB internal master generic */ | ||
371 | MUX_CFG("R18_USB_VBUS", 7, 9, 2, 1, 11, 0, NA, 0, 1) | ||
372 | MUX_CFG("R18_1510_USB_GPIO0", 7, 9, 0, 1, 11, 1, NA, 0, 1) | ||
373 | /* works around erratum: W4_USB_PUEN and W4_USB_PUDIS are switched! */ | ||
374 | MUX_CFG("W4_USB_PUEN", D, 3, 3, 3, 5, 1, NA, 0, 1) | ||
375 | MUX_CFG("W4_USB_CLKO", D, 3, 1, 3, 5, 0, NA, 0, 1) | ||
376 | MUX_CFG("W4_USB_HIGHZ", D, 3, 4, 3, 5, 0, 3, 0, 1) | ||
377 | MUX_CFG("W4_GPIO58", D, 3, 7, 3, 5, 0, 3, 0, 1) | ||
378 | |||
379 | /* USB1 master */ | ||
380 | MUX_CFG("USB1_SUSP", 8, 27, 2, 1, 27, 0, NA, 0, 1) | ||
381 | MUX_CFG("USB1_SE0", 9, 0, 2, 1, 28, 0, NA, 0, 1) | ||
382 | MUX_CFG("W13_1610_USB1_SE0", 9, 0, 4, 1, 28, 0, NA, 0, 1) | ||
383 | MUX_CFG("USB1_TXEN", 9, 3, 2, 1, 29, 0, NA, 0, 1) | ||
384 | MUX_CFG("USB1_TXD", 9, 24, 1, 2, 4, 0, NA, 0, 1) | ||
385 | MUX_CFG("USB1_VP", A, 3, 1, 2, 7, 0, NA, 0, 1) | ||
386 | MUX_CFG("USB1_VM", A, 6, 1, 2, 8, 0, NA, 0, 1) | ||
387 | MUX_CFG("USB1_RCV", A, 9, 1, 2, 9, 0, NA, 0, 1) | ||
388 | MUX_CFG("USB1_SPEED", A, 12, 2, 2, 10, 0, NA, 0, 1) | ||
389 | MUX_CFG("R13_1610_USB1_SPEED", A, 12, 5, 2, 10, 0, NA, 0, 1) | ||
390 | MUX_CFG("R13_1710_USB1_SEO", A, 12, 5, 2, 10, 0, NA, 0, 1) | ||
391 | |||
392 | /* USB2 master */ | ||
393 | MUX_CFG("USB2_SUSP", B, 3, 1, 2, 17, 0, NA, 0, 1) | ||
394 | MUX_CFG("USB2_VP", B, 6, 1, 2, 18, 0, NA, 0, 1) | ||
395 | MUX_CFG("USB2_TXEN", B, 9, 1, 2, 19, 0, NA, 0, 1) | ||
396 | MUX_CFG("USB2_VM", C, 18, 1, 3, 0, 0, NA, 0, 1) | ||
397 | MUX_CFG("USB2_RCV", C, 21, 1, 3, 1, 0, NA, 0, 1) | ||
398 | MUX_CFG("USB2_SE0", C, 24, 2, 3, 2, 0, NA, 0, 1) | ||
399 | MUX_CFG("USB2_TXD", C, 27, 2, 3, 3, 0, NA, 0, 1) | ||
400 | |||
401 | /* OMAP-1510 GPIO */ | ||
402 | MUX_CFG("R18_1510_GPIO0", 7, 9, 0, 1, 11, 1, 0, 0, 1) | ||
403 | MUX_CFG("R19_1510_GPIO1", 7, 6, 0, 1, 10, 1, 0, 0, 1) | ||
404 | MUX_CFG("M14_1510_GPIO2", 7, 3, 0, 1, 9, 1, 0, 0, 1) | ||
405 | |||
406 | /* OMAP1610 GPIO */ | ||
407 | MUX_CFG("P18_1610_GPIO3", 7, 0, 0, 1, 8, 0, NA, 0, 1) | ||
408 | MUX_CFG("Y15_1610_GPIO17", A, 0, 7, 2, 6, 0, NA, 0, 1) | ||
409 | |||
410 | /* OMAP-1710 GPIO */ | ||
411 | MUX_CFG("R18_1710_GPIO0", 7, 9, 0, 1, 11, 1, 1, 1, 1) | ||
412 | MUX_CFG("V2_1710_GPIO10", F, 27, 1, 4, 3, 1, 4, 1, 1) | ||
413 | MUX_CFG("N21_1710_GPIO14", 6, 9, 0, 1, 1, 1, 1, 1, 1) | ||
414 | MUX_CFG("W15_1710_GPIO40", 9, 27, 7, 2, 5, 1, 2, 1, 1) | ||
415 | |||
416 | /* MPUIO */ | ||
417 | MUX_CFG("MPUIO2", 7, 18, 0, 1, 14, 1, NA, 0, 1) | ||
418 | MUX_CFG("N15_1610_MPUIO2", 7, 18, 0, 1, 14, 1, 1, 0, 1) | ||
419 | MUX_CFG("MPUIO4", 7, 15, 0, 1, 13, 1, NA, 0, 1) | ||
420 | MUX_CFG("MPUIO5", 7, 12, 0, 1, 12, 1, NA, 0, 1) | ||
421 | |||
422 | MUX_CFG("T20_1610_MPUIO5", 7, 12, 0, 1, 12, 0, 3, 0, 1) | ||
423 | MUX_CFG("W11_1610_MPUIO6", 10, 15, 2, 3, 8, 0, 3, 0, 1) | ||
424 | MUX_CFG("V10_1610_MPUIO7", A, 24, 2, 2, 14, 0, 2, 0, 1) | ||
425 | MUX_CFG("W11_1610_MPUIO9", 10, 15, 1, 3, 8, 0, 3, 0, 1) | ||
426 | MUX_CFG("V10_1610_MPUIO10", A, 24, 1, 2, 14, 0, 2, 0, 1) | ||
427 | MUX_CFG("W10_1610_MPUIO11", A, 18, 2, 2, 11, 0, 2, 0, 1) | ||
428 | MUX_CFG("E20_1610_MPUIO13", 3, 21, 1, 0, 7, 0, 0, 0, 1) | ||
429 | MUX_CFG("U20_1610_MPUIO14", 9, 6, 6, 0, 30, 0, 0, 0, 1) | ||
430 | MUX_CFG("E19_1610_MPUIO15", 3, 18, 1, 0, 6, 0, 0, 0, 1) | ||
431 | |||
432 | /* MCBSP2 */ | ||
433 | MUX_CFG("MCBSP2_CLKR", C, 6, 0, 2, 27, 1, NA, 0, 1) | ||
434 | MUX_CFG("MCBSP2_CLKX", C, 9, 0, 2, 29, 1, NA, 0, 1) | ||
435 | MUX_CFG("MCBSP2_DR", C, 0, 0, 2, 26, 1, NA, 0, 1) | ||
436 | MUX_CFG("MCBSP2_DX", C, 15, 0, 2, 31, 1, NA, 0, 1) | ||
437 | MUX_CFG("MCBSP2_FSR", C, 12, 0, 2, 30, 1, NA, 0, 1) | ||
438 | MUX_CFG("MCBSP2_FSX", C, 3, 0, 2, 27, 1, NA, 0, 1) | ||
439 | |||
440 | /* MCBSP3 NOTE: Mode must 1 for clock */ | ||
441 | MUX_CFG("MCBSP3_CLKX", 9, 3, 1, 1, 29, 0, NA, 0, 1) | ||
442 | |||
443 | /* Misc ballouts */ | ||
444 | MUX_CFG("BALLOUT_V8_ARMIO3", B, 18, 0, 2, 25, 1, NA, 0, 1) | ||
445 | MUX_CFG("N20_HDQ", 6, 18, 1, 1, 4, 0, 1, 4, 0) | ||
446 | |||
447 | /* OMAP-1610 MMC2 */ | ||
448 | MUX_CFG("W8_1610_MMC2_DAT0", B, 21, 6, 2, 23, 1, 2, 1, 1) | ||
449 | MUX_CFG("V8_1610_MMC2_DAT1", B, 27, 6, 2, 25, 1, 2, 1, 1) | ||
450 | MUX_CFG("W15_1610_MMC2_DAT2", 9, 12, 6, 2, 5, 1, 2, 1, 1) | ||
451 | MUX_CFG("R10_1610_MMC2_DAT3", B, 18, 6, 2, 22, 1, 2, 1, 1) | ||
452 | MUX_CFG("Y10_1610_MMC2_CLK", B, 3, 6, 2, 17, 0, 2, 0, 1) | ||
453 | MUX_CFG("Y8_1610_MMC2_CMD", B, 24, 6, 2, 24, 1, 2, 1, 1) | ||
454 | MUX_CFG("V9_1610_MMC2_CMDDIR", B, 12, 6, 2, 20, 0, 2, 1, 1) | ||
455 | MUX_CFG("V5_1610_MMC2_DATDIR0", B, 15, 6, 2, 21, 0, 2, 1, 1) | ||
456 | MUX_CFG("W19_1610_MMC2_DATDIR1", 8, 15, 6, 1, 23, 0, 1, 1, 1) | ||
457 | MUX_CFG("R18_1610_MMC2_CLKIN", 7, 9, 6, 1, 11, 0, 1, 11, 1) | ||
458 | |||
459 | /* OMAP-1610 External Trace Interface */ | ||
460 | MUX_CFG("M19_1610_ETM_PSTAT0", 5, 27, 1, 0, 29, 0, 0, 0, 1) | ||
461 | MUX_CFG("L15_1610_ETM_PSTAT1", 5, 24, 1, 0, 28, 0, 0, 0, 1) | ||
462 | MUX_CFG("L18_1610_ETM_PSTAT2", 5, 21, 1, 0, 27, 0, 0, 0, 1) | ||
463 | MUX_CFG("L19_1610_ETM_D0", 5, 18, 1, 0, 26, 0, 0, 0, 1) | ||
464 | MUX_CFG("J19_1610_ETM_D6", 5, 0, 1, 0, 20, 0, 0, 0, 1) | ||
465 | MUX_CFG("J18_1610_ETM_D7", 5, 27, 1, 0, 19, 0, 0, 0, 1) | ||
466 | |||
467 | /* OMAP16XX GPIO */ | ||
468 | MUX_CFG("P20_1610_GPIO4", 6, 27, 0, 1, 7, 0, 1, 1, 1) | ||
469 | MUX_CFG("V9_1610_GPIO7", B, 12, 1, 2, 20, 0, 2, 1, 1) | ||
470 | MUX_CFG("W8_1610_GPIO9", B, 21, 0, 2, 23, 0, 2, 1, 1) | ||
471 | MUX_CFG("N20_1610_GPIO11", 6, 18, 0, 1, 4, 0, 1, 1, 1) | ||
472 | MUX_CFG("N19_1610_GPIO13", 6, 12, 0, 1, 2, 0, 1, 1, 1) | ||
473 | MUX_CFG("P10_1610_GPIO22", C, 0, 7, 2, 26, 0, 2, 1, 1) | ||
474 | MUX_CFG("V5_1610_GPIO24", B, 15, 7, 2, 21, 0, 2, 1, 1) | ||
475 | MUX_CFG("AA20_1610_GPIO_41", 9, 9, 7, 1, 31, 0, 1, 1, 1) | ||
476 | MUX_CFG("W19_1610_GPIO48", 8, 15, 7, 1, 23, 1, 1, 0, 1) | ||
477 | MUX_CFG("M7_1610_GPIO62", 10, 0, 0, 4, 24, 0, 4, 0, 1) | ||
478 | MUX_CFG("V14_16XX_GPIO37", 9, 18, 7, 2, 2, 0, 2, 2, 0) | ||
479 | MUX_CFG("R9_16XX_GPIO18", C, 18, 7, 3, 0, 0, 3, 0, 0) | ||
480 | MUX_CFG("L14_16XX_GPIO49", 6, 3, 7, 0, 31, 0, 0, 31, 0) | ||
481 | |||
482 | /* OMAP-1610 uWire */ | ||
483 | MUX_CFG("V19_1610_UWIRE_SCLK", 8, 6, 0, 1, 20, 0, 1, 1, 1) | ||
484 | MUX_CFG("U18_1610_UWIRE_SDI", 8, 0, 0, 1, 18, 0, 1, 1, 1) | ||
485 | MUX_CFG("W21_1610_UWIRE_SDO", 8, 3, 0, 1, 19, 0, 1, 1, 1) | ||
486 | MUX_CFG("N14_1610_UWIRE_CS0", 8, 9, 1, 1, 21, 0, 1, 1, 1) | ||
487 | MUX_CFG("P15_1610_UWIRE_CS3", 8, 12, 1, 1, 22, 0, 1, 1, 1) | ||
488 | MUX_CFG("N15_1610_UWIRE_CS1", 7, 18, 2, 1, 14, 0, NA, 0, 1) | ||
489 | |||
490 | /* OMAP-1610 Flash */ | ||
491 | MUX_CFG("L3_1610_FLASH_CS2B_OE",10, 6, 1, NA, 0, 0, NA, 0, 1) | ||
492 | MUX_CFG("M8_1610_FLASH_CS2B_WE",10, 3, 1, NA, 0, 0, NA, 0, 1) | ||
493 | |||
494 | /* First MMC interface, same on 1510, 1610 and 1710 */ | ||
495 | MUX_CFG("MMC_CMD", A, 27, 0, 2, 15, 1, 2, 1, 1) | ||
496 | MUX_CFG("MMC_DAT1", A, 24, 0, 2, 14, 1, 2, 1, 1) | ||
497 | MUX_CFG("MMC_DAT2", A, 18, 0, 2, 12, 1, 2, 1, 1) | ||
498 | MUX_CFG("MMC_DAT0", B, 0, 0, 2, 16, 1, 2, 1, 1) | ||
499 | MUX_CFG("MMC_CLK", A, 21, 0, NA, 0, 0, NA, 0, 1) | ||
500 | MUX_CFG("MMC_DAT3", 10, 15, 0, 3, 8, 1, 3, 1, 1) | ||
501 | MUX_CFG("M15_1710_MMC_CLKI", 6, 21, 2, 0, 0, 0, NA, 0, 1) | ||
502 | MUX_CFG("P19_1710_MMC_CMDDIR", 6, 24, 6, 0, 0, 0, NA, 0, 1) | ||
503 | MUX_CFG("P20_1710_MMC_DATDIR0", 6, 27, 5, 0, 0, 0, NA, 0, 1) | ||
504 | |||
505 | /* OMAP-1610 USB0 alternate configuration */ | ||
506 | MUX_CFG("W9_USB0_TXEN", B, 9, 5, 2, 19, 0, 2, 0, 1) | ||
507 | MUX_CFG("AA9_USB0_VP", B, 6, 5, 2, 18, 0, 2, 0, 1) | ||
508 | MUX_CFG("Y5_USB0_RCV", C, 21, 5, 3, 1, 0, 1, 0, 1) | ||
509 | MUX_CFG("R9_USB0_VM", C, 18, 5, 3, 0, 0, 3, 0, 1) | ||
510 | MUX_CFG("V6_USB0_TXD", C, 27, 5, 3, 3, 0, 3, 0, 1) | ||
511 | MUX_CFG("W5_USB0_SE0", C, 24, 5, 3, 2, 0, 3, 0, 1) | ||
512 | MUX_CFG("V9_USB0_SPEED", B, 12, 5, 2, 20, 0, 2, 0, 1) | ||
513 | MUX_CFG("Y10_USB0_SUSP", B, 3, 5, 2, 17, 0, 2, 0, 1) | ||
514 | |||
515 | /* USB2 interface */ | ||
516 | MUX_CFG("W9_USB2_TXEN", B, 9, 1, NA, 0, 0, NA, 0, 1) | ||
517 | MUX_CFG("AA9_USB2_VP", B, 6, 1, NA, 0, 0, NA, 0, 1) | ||
518 | MUX_CFG("Y5_USB2_RCV", C, 21, 1, NA, 0, 0, NA, 0, 1) | ||
519 | MUX_CFG("R9_USB2_VM", C, 18, 1, NA, 0, 0, NA, 0, 1) | ||
520 | MUX_CFG("V6_USB2_TXD", C, 27, 2, NA, 0, 0, NA, 0, 1) | ||
521 | MUX_CFG("W5_USB2_SE0", C, 24, 2, NA, 0, 0, NA, 0, 1) | ||
522 | |||
523 | /* 16XX UART */ | ||
524 | MUX_CFG("R13_1610_UART1_TX", A, 12, 6, 2, 10, 0, 2, 10, 1) | ||
525 | MUX_CFG("V14_16XX_UART1_RX", 9, 18, 0, 2, 2, 0, 2, 2, 1) | ||
526 | MUX_CFG("R14_1610_UART1_CTS", 9, 15, 0, 2, 1, 0, 2, 1, 1) | ||
527 | MUX_CFG("AA15_1610_UART1_RTS", 9, 12, 1, 2, 0, 0, 2, 0, 1) | ||
528 | MUX_CFG("R9_16XX_UART2_RX", C, 18, 0, 3, 0, 0, 3, 0, 1) | ||
529 | MUX_CFG("L14_16XX_UART3_RX", 6, 3, 0, 0, 31, 0, 0, 31, 1) | ||
530 | |||
531 | /* I2C interface */ | ||
532 | MUX_CFG("I2C_SCL", 7, 24, 0, NA, 0, 0, NA, 0, 0) | ||
533 | MUX_CFG("I2C_SDA", 7, 27, 0, NA, 0, 0, NA, 0, 0) | ||
534 | |||
535 | /* Keypad */ | ||
536 | MUX_CFG("F18_1610_KBC0", 3, 15, 0, 0, 5, 1, 0, 0, 0) | ||
537 | MUX_CFG("D20_1610_KBC1", 3, 12, 0, 0, 4, 1, 0, 0, 0) | ||
538 | MUX_CFG("D19_1610_KBC2", 3, 9, 0, 0, 3, 1, 0, 0, 0) | ||
539 | MUX_CFG("E18_1610_KBC3", 3, 6, 0, 0, 2, 1, 0, 0, 0) | ||
540 | MUX_CFG("C21_1610_KBC4", 3, 3, 0, 0, 1, 1, 0, 0, 0) | ||
541 | MUX_CFG("G18_1610_KBR0", 4, 0, 0, 0, 10, 1, 0, 1, 0) | ||
542 | MUX_CFG("F19_1610_KBR1", 3, 27, 0, 0, 9, 1, 0, 1, 0) | ||
543 | MUX_CFG("H14_1610_KBR2", 3, 24, 0, 0, 8, 1, 0, 1, 0) | ||
544 | MUX_CFG("E20_1610_KBR3", 3, 21, 0, 0, 7, 1, 0, 1, 0) | ||
545 | MUX_CFG("E19_1610_KBR4", 3, 18, 0, 0, 6, 1, 0, 1, 0) | ||
546 | MUX_CFG("N19_1610_KBR5", 6, 12, 1, 1, 2, 1, 1, 1, 0) | ||
547 | |||
548 | /* Power management */ | ||
549 | MUX_CFG("T20_1610_LOW_PWR", 7, 12, 1, NA, 0, 0, NA, 0, 0) | ||
550 | |||
551 | /* MCLK Settings */ | ||
552 | MUX_CFG("V5_1710_MCLK_ON", B, 15, 0, NA, 0, 0, NA, 0, 0) | ||
553 | MUX_CFG("V5_1710_MCLK_OFF", B, 15, 6, NA, 0, 0, NA, 0, 0) | ||
554 | MUX_CFG("R10_1610_MCLK_ON", B, 18, 0, NA, 22, 0, NA, 1, 0) | ||
555 | MUX_CFG("R10_1610_MCLK_OFF", B, 18, 6, 2, 22, 1, 2, 1, 1) | ||
556 | |||
557 | /* CompactFlash controller, conflicts with MMC1 */ | ||
558 | MUX_CFG("P11_1610_CF_CD2", A, 27, 3, 2, 15, 1, 2, 1, 1) | ||
559 | MUX_CFG("R11_1610_CF_IOIS16", B, 0, 3, 2, 16, 1, 2, 1, 1) | ||
560 | MUX_CFG("V10_1610_CF_IREQ", A, 24, 3, 2, 14, 0, 2, 0, 1) | ||
561 | MUX_CFG("W10_1610_CF_RESET", A, 18, 3, 2, 12, 1, 2, 1, 1) | ||
562 | MUX_CFG("W11_1610_CF_CD1", 10, 15, 3, 3, 8, 1, 3, 1, 1) | ||
563 | }; | ||
564 | 405 | ||
565 | #endif /* __MUX_C__ */ | 406 | /* 24xx GPIO */ |
407 | Y20_24XX_GPIO60, | ||
408 | M15_24XX_GPIO92, | ||
409 | }; | ||
566 | 410 | ||
567 | #ifdef CONFIG_OMAP_MUX | 411 | #ifdef CONFIG_OMAP_MUX |
568 | /* setup pin muxing in Linux */ | 412 | /* setup pin muxing in Linux */ |
569 | extern int omap_cfg_reg(reg_cfg_t reg_cfg); | 413 | extern int omap1_mux_init(void); |
414 | extern int omap2_mux_init(void); | ||
415 | extern int omap_mux_register(struct pin_config * pins, unsigned long size); | ||
416 | extern int omap_cfg_reg(unsigned long reg_cfg); | ||
570 | #else | 417 | #else |
571 | /* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */ | 418 | /* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */ |
572 | static inline int omap_cfg_reg(reg_cfg_t reg_cfg) { return 0; } | 419 | static inline int omap1_mux_init(void) { return 0; } |
420 | static inline int omap2_mux_init(void) { return 0; } | ||
421 | static inline int omap_cfg_reg(unsigned long reg_cfg) { return 0; } | ||
573 | #endif | 422 | #endif |
574 | 423 | ||
575 | #endif | 424 | #endif |
diff --git a/include/asm-arm/arch-omap/omap1510.h b/include/asm-arm/arch-omap/omap1510.h index f086a3933906..c575d354850f 100644 --- a/include/asm-arm/arch-omap/omap1510.h +++ b/include/asm-arm/arch-omap/omap1510.h | |||
@@ -25,8 +25,8 @@ | |||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef __ASM_ARCH_OMAP1510_H | 28 | #ifndef __ASM_ARCH_OMAP15XX_H |
29 | #define __ASM_ARCH_OMAP1510_H | 29 | #define __ASM_ARCH_OMAP15XX_H |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * ---------------------------------------------------------------------------- | 32 | * ---------------------------------------------------------------------------- |
@@ -44,5 +44,5 @@ | |||
44 | #define OMAP1510_DSPREG_SIZE SZ_128K | 44 | #define OMAP1510_DSPREG_SIZE SZ_128K |
45 | #define OMAP1510_DSPREG_START 0xE1000000 | 45 | #define OMAP1510_DSPREG_START 0xE1000000 |
46 | 46 | ||
47 | #endif /* __ASM_ARCH_OMAP1510_H */ | 47 | #endif /* __ASM_ARCH_OMAP15XX_H */ |
48 | 48 | ||
diff --git a/include/asm-arm/arch-omap/omap24xx.h b/include/asm-arm/arch-omap/omap24xx.h index a9105466a417..6e59805fa654 100644 --- a/include/asm-arm/arch-omap/omap24xx.h +++ b/include/asm-arm/arch-omap/omap24xx.h | |||
@@ -1,15 +1,24 @@ | |||
1 | #ifndef __ASM_ARCH_OMAP24XX_H | 1 | #ifndef __ASM_ARCH_OMAP24XX_H |
2 | #define __ASM_ARCH_OMAP24XX_H | 2 | #define __ASM_ARCH_OMAP24XX_H |
3 | 3 | ||
4 | #define OMAP24XX_L4_IO_BASE 0x48000000 | 4 | /* |
5 | * Please place only base defines here and put the rest in device | ||
6 | * specific headers. Note also that some of these defines are needed | ||
7 | * for omap1 to compile without adding ifdefs. | ||
8 | */ | ||
9 | |||
10 | #define L4_24XX_BASE 0x48000000 | ||
11 | #define L3_24XX_BASE 0x68000000 | ||
5 | 12 | ||
6 | /* interrupt controller */ | 13 | /* interrupt controller */ |
7 | #define OMAP24XX_IC_BASE (OMAP24XX_L4_IO_BASE + 0xfe000) | 14 | #define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000) |
8 | #define VA_IC_BASE IO_ADDRESS(OMAP24XX_IC_BASE) | 15 | #define VA_IC_BASE IO_ADDRESS(OMAP24XX_IC_BASE) |
9 | |||
10 | #define OMAP24XX_IVA_INTC_BASE 0x40000000 | 16 | #define OMAP24XX_IVA_INTC_BASE 0x40000000 |
11 | |||
12 | #define IRQ_SIR_IRQ 0x0040 | 17 | #define IRQ_SIR_IRQ 0x0040 |
13 | 18 | ||
19 | #define OMAP24XX_32KSYNCT_BASE (L4_24XX_BASE + 0x4000) | ||
20 | #define OMAP24XX_PRCM_BASE (L4_24XX_BASE + 0x8000) | ||
21 | #define OMAP24XX_SDRC_BASE (L3_24XX_BASE + 0x9000) | ||
22 | |||
14 | #endif /* __ASM_ARCH_OMAP24XX_H */ | 23 | #endif /* __ASM_ARCH_OMAP24XX_H */ |
15 | 24 | ||
diff --git a/include/asm-arm/arch-omap/omapfb.h b/include/asm-arm/arch-omap/omapfb.h new file mode 100644 index 000000000000..4ba2622cc142 --- /dev/null +++ b/include/asm-arm/arch-omap/omapfb.h | |||
@@ -0,0 +1,281 @@ | |||
1 | /* | ||
2 | * File: include/asm-arm/arch-omap/omapfb.h | ||
3 | * | ||
4 | * Framebuffer driver for TI OMAP boards | ||
5 | * | ||
6 | * Copyright (C) 2004 Nokia Corporation | ||
7 | * Author: Imre Deak <imre.deak@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef __OMAPFB_H | ||
25 | #define __OMAPFB_H | ||
26 | |||
27 | /* IOCTL commands. */ | ||
28 | |||
29 | #define OMAP_IOW(num, dtype) _IOW('O', num, dtype) | ||
30 | #define OMAP_IOR(num, dtype) _IOR('O', num, dtype) | ||
31 | #define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype) | ||
32 | #define OMAP_IO(num) _IO('O', num) | ||
33 | |||
34 | #define OMAPFB_MIRROR OMAP_IOW(31, int) | ||
35 | #define OMAPFB_SYNC_GFX OMAP_IO(37) | ||
36 | #define OMAPFB_VSYNC OMAP_IO(38) | ||
37 | #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, enum omapfb_update_mode) | ||
38 | #define OMAPFB_GET_CAPS OMAP_IOR(42, unsigned long) | ||
39 | #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, enum omapfb_update_mode) | ||
40 | #define OMAPFB_LCD_TEST OMAP_IOW(45, int) | ||
41 | #define OMAPFB_CTRL_TEST OMAP_IOW(46, int) | ||
42 | #define OMAPFB_UPDATE_WINDOW OMAP_IOW(47, struct omapfb_update_window) | ||
43 | #define OMAPFB_SETUP_PLANE OMAP_IOW(48, struct omapfb_setup_plane) | ||
44 | #define OMAPFB_ENABLE_PLANE OMAP_IOW(49, struct omapfb_enable_plane) | ||
45 | #define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) | ||
46 | |||
47 | #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff | ||
48 | #define OMAPFB_CAPS_LCDC_MASK 0x00fff000 | ||
49 | #define OMAPFB_CAPS_PANEL_MASK 0xff000000 | ||
50 | |||
51 | #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 | ||
52 | #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 | ||
53 | |||
54 | /* Values from DSP must map to lower 16-bits */ | ||
55 | #define OMAPFB_FORMAT_MASK 0x00ff | ||
56 | #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 | ||
57 | |||
58 | enum omapfb_color_format { | ||
59 | OMAPFB_COLOR_RGB565 = 0, | ||
60 | OMAPFB_COLOR_YUV422, | ||
61 | OMAPFB_COLOR_YUV420, | ||
62 | OMAPFB_COLOR_CLUT_8BPP, | ||
63 | OMAPFB_COLOR_CLUT_4BPP, | ||
64 | OMAPFB_COLOR_CLUT_2BPP, | ||
65 | OMAPFB_COLOR_CLUT_1BPP, | ||
66 | }; | ||
67 | |||
68 | struct omapfb_update_window { | ||
69 | u32 x, y; | ||
70 | u32 width, height; | ||
71 | u32 format; | ||
72 | }; | ||
73 | |||
74 | enum omapfb_plane { | ||
75 | OMAPFB_PLANE_GFX = 0, | ||
76 | OMAPFB_PLANE_VID1, | ||
77 | OMAPFB_PLANE_VID2, | ||
78 | }; | ||
79 | |||
80 | enum omapfb_channel_out { | ||
81 | OMAPFB_CHANNEL_OUT_LCD = 0, | ||
82 | OMAPFB_CHANNEL_OUT_DIGIT, | ||
83 | }; | ||
84 | |||
85 | struct omapfb_setup_plane { | ||
86 | u8 plane; | ||
87 | u8 channel_out; | ||
88 | u32 offset; | ||
89 | u32 pos_x, pos_y; | ||
90 | u32 width, height; | ||
91 | u32 color_mode; | ||
92 | }; | ||
93 | |||
94 | struct omapfb_enable_plane { | ||
95 | u8 plane; | ||
96 | u8 enable; | ||
97 | }; | ||
98 | |||
99 | enum omapfb_color_key_type { | ||
100 | OMAPFB_COLOR_KEY_DISABLED = 0, | ||
101 | OMAPFB_COLOR_KEY_GFX_DST, | ||
102 | OMAPFB_COLOR_KEY_VID_SRC, | ||
103 | }; | ||
104 | |||
105 | struct omapfb_color_key { | ||
106 | u8 channel_out; | ||
107 | u32 background; | ||
108 | u32 trans_key; | ||
109 | u8 key_type; | ||
110 | }; | ||
111 | |||
112 | enum omapfb_update_mode { | ||
113 | OMAPFB_UPDATE_DISABLED = 0, | ||
114 | OMAPFB_AUTO_UPDATE, | ||
115 | OMAPFB_MANUAL_UPDATE | ||
116 | }; | ||
117 | |||
118 | #ifdef __KERNEL__ | ||
119 | |||
120 | #include <linux/completion.h> | ||
121 | #include <linux/interrupt.h> | ||
122 | #include <linux/fb.h> | ||
123 | |||
124 | #define OMAP_LCDC_INV_VSYNC 0x0001 | ||
125 | #define OMAP_LCDC_INV_HSYNC 0x0002 | ||
126 | #define OMAP_LCDC_INV_PIX_CLOCK 0x0004 | ||
127 | #define OMAP_LCDC_INV_OUTPUT_EN 0x0008 | ||
128 | #define OMAP_LCDC_HSVS_RISING_EDGE 0x0010 | ||
129 | #define OMAP_LCDC_HSVS_OPPOSITE 0x0020 | ||
130 | |||
131 | #define OMAP_LCDC_SIGNAL_MASK 0x003f | ||
132 | |||
133 | #define OMAP_LCDC_PANEL_TFT 0x0100 | ||
134 | |||
135 | #ifdef CONFIG_ARCH_OMAP1 | ||
136 | #define OMAPFB_PLANE_NUM 1 | ||
137 | #else | ||
138 | #define OMAPFB_PLANE_NUM 3 | ||
139 | #endif | ||
140 | |||
141 | struct omapfb_device; | ||
142 | |||
143 | struct lcd_panel { | ||
144 | const char *name; | ||
145 | int config; /* TFT/STN, signal inversion */ | ||
146 | int bpp; /* Pixel format in fb mem */ | ||
147 | int data_lines; /* Lines on LCD HW interface */ | ||
148 | |||
149 | int x_res, y_res; | ||
150 | int pixel_clock; /* In kHz */ | ||
151 | int hsw; /* Horizontal synchronization | ||
152 | pulse width */ | ||
153 | int hfp; /* Horizontal front porch */ | ||
154 | int hbp; /* Horizontal back porch */ | ||
155 | int vsw; /* Vertical synchronization | ||
156 | pulse width */ | ||
157 | int vfp; /* Vertical front porch */ | ||
158 | int vbp; /* Vertical back porch */ | ||
159 | int acb; /* ac-bias pin frequency */ | ||
160 | int pcd; /* pixel clock divider. | ||
161 | Obsolete use pixel_clock instead */ | ||
162 | |||
163 | int (*init) (struct omapfb_device *fbdev); | ||
164 | void (*cleanup) (void); | ||
165 | int (*enable) (void); | ||
166 | void (*disable) (void); | ||
167 | unsigned long (*get_caps) (void); | ||
168 | int (*set_bklight_level)(unsigned int level); | ||
169 | unsigned int (*get_bklight_level)(void); | ||
170 | unsigned int (*get_bklight_max) (void); | ||
171 | int (*run_test) (int test_num); | ||
172 | }; | ||
173 | |||
174 | struct omapfb_device; | ||
175 | |||
176 | struct extif_timings { | ||
177 | int cs_on_time; | ||
178 | int cs_off_time; | ||
179 | int we_on_time; | ||
180 | int we_off_time; | ||
181 | int re_on_time; | ||
182 | int re_off_time; | ||
183 | int we_cycle_time; | ||
184 | int re_cycle_time; | ||
185 | int cs_pulse_width; | ||
186 | int access_time; | ||
187 | }; | ||
188 | |||
189 | struct lcd_ctrl_extif { | ||
190 | int (*init) (void); | ||
191 | void (*cleanup) (void); | ||
192 | void (*set_timings) (const struct extif_timings *timings); | ||
193 | void (*write_command) (u32 cmd); | ||
194 | u32 (*read_data) (void); | ||
195 | void (*write_data) (u32 data); | ||
196 | void (*transfer_area) (int width, int height, | ||
197 | void (callback)(void * data), void *data); | ||
198 | }; | ||
199 | |||
200 | struct lcd_ctrl { | ||
201 | const char *name; | ||
202 | void *data; | ||
203 | |||
204 | int (*init) (struct omapfb_device *fbdev, | ||
205 | int ext_mode, int req_vram_size); | ||
206 | void (*cleanup) (void); | ||
207 | void (*get_vram_layout)(unsigned long *size, | ||
208 | void **virt_base, | ||
209 | dma_addr_t *phys_base); | ||
210 | unsigned long (*get_caps) (void); | ||
211 | int (*set_update_mode)(enum omapfb_update_mode mode); | ||
212 | enum omapfb_update_mode (*get_update_mode)(void); | ||
213 | int (*setup_plane) (int plane, int channel_out, | ||
214 | unsigned long offset, | ||
215 | int screen_width, | ||
216 | int pos_x, int pos_y, int width, | ||
217 | int height, int color_mode); | ||
218 | int (*enable_plane) (int plane, int enable); | ||
219 | int (*update_window) (struct omapfb_update_window *win, | ||
220 | void (*callback)(void *), | ||
221 | void *callback_data); | ||
222 | void (*sync) (void); | ||
223 | void (*suspend) (void); | ||
224 | void (*resume) (void); | ||
225 | int (*run_test) (int test_num); | ||
226 | int (*setcolreg) (u_int regno, u16 red, u16 green, | ||
227 | u16 blue, u16 transp, | ||
228 | int update_hw_mem); | ||
229 | int (*set_color_key) (struct omapfb_color_key *ck); | ||
230 | |||
231 | }; | ||
232 | |||
233 | enum omapfb_state { | ||
234 | OMAPFB_DISABLED = 0, | ||
235 | OMAPFB_SUSPENDED= 99, | ||
236 | OMAPFB_ACTIVE = 100 | ||
237 | }; | ||
238 | |||
239 | struct omapfb_device { | ||
240 | int state; | ||
241 | int ext_lcdc; /* Using external | ||
242 | LCD controller */ | ||
243 | struct semaphore rqueue_sema; | ||
244 | |||
245 | void *vram_virt_base; | ||
246 | dma_addr_t vram_phys_base; | ||
247 | unsigned long vram_size; | ||
248 | |||
249 | int color_mode; | ||
250 | int palette_size; | ||
251 | int mirror; | ||
252 | u32 pseudo_palette[17]; | ||
253 | |||
254 | struct lcd_panel *panel; /* LCD panel */ | ||
255 | struct lcd_ctrl *ctrl; /* LCD controller */ | ||
256 | struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */ | ||
257 | struct lcd_ctrl_extif *ext_if; /* LCD ctrl external | ||
258 | interface */ | ||
259 | struct fb_info *fb_info; | ||
260 | |||
261 | struct device *dev; | ||
262 | }; | ||
263 | |||
264 | extern struct lcd_panel h3_panel; | ||
265 | extern struct lcd_panel h2_panel; | ||
266 | extern struct lcd_panel p2_panel; | ||
267 | extern struct lcd_panel osk_panel; | ||
268 | extern struct lcd_panel innovator1610_panel; | ||
269 | extern struct lcd_panel innovator1510_panel; | ||
270 | |||
271 | #ifdef CONFIG_ARCH_OMAP1 | ||
272 | extern struct lcd_ctrl omap1_lcd_ctrl; | ||
273 | #else | ||
274 | extern struct lcd_ctrl omap2_disp_ctrl; | ||
275 | #endif | ||
276 | |||
277 | extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval); | ||
278 | |||
279 | #endif /* __KERNEL__ */ | ||
280 | |||
281 | #endif /* __OMAPFB_H */ | ||
diff --git a/include/asm-arm/arch-omap/pm.h b/include/asm-arm/arch-omap/pm.h index fbd742d0c499..7c790425e363 100644 --- a/include/asm-arm/arch-omap/pm.h +++ b/include/asm-arm/arch-omap/pm.h | |||
@@ -98,7 +98,14 @@ | |||
98 | #define OMAP1610_IDLECT3 0xfffece24 | 98 | #define OMAP1610_IDLECT3 0xfffece24 |
99 | #define OMAP1610_IDLE_LOOP_REQUEST 0x0400 | 99 | #define OMAP1610_IDLE_LOOP_REQUEST 0x0400 |
100 | 100 | ||
101 | #if !defined(CONFIG_ARCH_OMAP1510) && \ | 101 | #define OMAP730_IDLECT1_SLEEP_VAL 0x16c7 |
102 | #define OMAP730_IDLECT2_SLEEP_VAL 0x09c7 | ||
103 | #define OMAP730_IDLECT3_VAL 0x3f | ||
104 | #define OMAP730_IDLECT3 0xfffece24 | ||
105 | #define OMAP730_IDLE_LOOP_REQUEST 0x0C00 | ||
106 | |||
107 | #if !defined(CONFIG_ARCH_OMAP730) && \ | ||
108 | !defined(CONFIG_ARCH_OMAP15XX) && \ | ||
102 | !defined(CONFIG_ARCH_OMAP16XX) && \ | 109 | !defined(CONFIG_ARCH_OMAP16XX) && \ |
103 | !defined(CONFIG_ARCH_OMAP24XX) | 110 | !defined(CONFIG_ARCH_OMAP24XX) |
104 | #error "Power management for this processor not implemented yet" | 111 | #error "Power management for this processor not implemented yet" |
@@ -107,8 +114,10 @@ | |||
107 | #ifndef __ASSEMBLER__ | 114 | #ifndef __ASSEMBLER__ |
108 | extern void omap_pm_idle(void); | 115 | extern void omap_pm_idle(void); |
109 | extern void omap_pm_suspend(void); | 116 | extern void omap_pm_suspend(void); |
117 | extern void omap730_cpu_suspend(unsigned short, unsigned short); | ||
110 | extern void omap1510_cpu_suspend(unsigned short, unsigned short); | 118 | extern void omap1510_cpu_suspend(unsigned short, unsigned short); |
111 | extern void omap1610_cpu_suspend(unsigned short, unsigned short); | 119 | extern void omap1610_cpu_suspend(unsigned short, unsigned short); |
120 | extern void omap730_idle_loop_suspend(void); | ||
112 | extern void omap1510_idle_loop_suspend(void); | 121 | extern void omap1510_idle_loop_suspend(void); |
113 | extern void omap1610_idle_loop_suspend(void); | 122 | extern void omap1610_idle_loop_suspend(void); |
114 | 123 | ||
@@ -118,6 +127,8 @@ extern void omap_serial_wake_trigger(int enable); | |||
118 | #define omap_serial_wake_trigger(x) {} | 127 | #define omap_serial_wake_trigger(x) {} |
119 | #endif /* CONFIG_OMAP_SERIAL_WAKE */ | 128 | #endif /* CONFIG_OMAP_SERIAL_WAKE */ |
120 | 129 | ||
130 | extern unsigned int omap730_cpu_suspend_sz; | ||
131 | extern unsigned int omap730_idle_loop_suspend_sz; | ||
121 | extern unsigned int omap1510_cpu_suspend_sz; | 132 | extern unsigned int omap1510_cpu_suspend_sz; |
122 | extern unsigned int omap1510_idle_loop_suspend_sz; | 133 | extern unsigned int omap1510_idle_loop_suspend_sz; |
123 | extern unsigned int omap1610_cpu_suspend_sz; | 134 | extern unsigned int omap1610_cpu_suspend_sz; |
@@ -131,6 +142,10 @@ extern unsigned int omap1610_idle_loop_suspend_sz; | |||
131 | #define ULPD_RESTORE(x) omap_writew((ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]), (x)) | 142 | #define ULPD_RESTORE(x) omap_writew((ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]), (x)) |
132 | #define ULPD_SHOW(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x] | 143 | #define ULPD_SHOW(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x] |
133 | 144 | ||
145 | #define MPUI730_SAVE(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x] = omap_readl(x) | ||
146 | #define MPUI730_RESTORE(x) omap_writel((mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x]), (x)) | ||
147 | #define MPUI730_SHOW(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x] | ||
148 | |||
134 | #define MPUI1510_SAVE(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] = omap_readl(x) | 149 | #define MPUI1510_SAVE(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] = omap_readl(x) |
135 | #define MPUI1510_RESTORE(x) omap_writel((mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]), (x)) | 150 | #define MPUI1510_RESTORE(x) omap_writel((mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]), (x)) |
136 | #define MPUI1510_SHOW(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] | 151 | #define MPUI1510_SHOW(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] |
@@ -188,13 +203,34 @@ enum mpui1510_save_state { | |||
188 | MPUI1510_SLEEP_SAVE_EMIFS_CONFIG, | 203 | MPUI1510_SLEEP_SAVE_EMIFS_CONFIG, |
189 | MPUI1510_SLEEP_SAVE_OMAP_IH1_MIR, | 204 | MPUI1510_SLEEP_SAVE_OMAP_IH1_MIR, |
190 | MPUI1510_SLEEP_SAVE_OMAP_IH2_MIR, | 205 | MPUI1510_SLEEP_SAVE_OMAP_IH2_MIR, |
191 | #if defined(CONFIG_ARCH_OMAP1510) | 206 | #if defined(CONFIG_ARCH_OMAP15XX) |
192 | MPUI1510_SLEEP_SAVE_SIZE | 207 | MPUI1510_SLEEP_SAVE_SIZE |
193 | #else | 208 | #else |
194 | MPUI1510_SLEEP_SAVE_SIZE = 0 | 209 | MPUI1510_SLEEP_SAVE_SIZE = 0 |
195 | #endif | 210 | #endif |
196 | }; | 211 | }; |
197 | 212 | ||
213 | enum mpui730_save_state { | ||
214 | MPUI730_SLEEP_SAVE_START = 0, | ||
215 | /* | ||
216 | * MPUI registers 32 bits | ||
217 | */ | ||
218 | MPUI730_SLEEP_SAVE_MPUI_CTRL, | ||
219 | MPUI730_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG, | ||
220 | MPUI730_SLEEP_SAVE_MPUI_DSP_API_CONFIG, | ||
221 | MPUI730_SLEEP_SAVE_MPUI_DSP_STATUS, | ||
222 | MPUI730_SLEEP_SAVE_EMIFF_SDRAM_CONFIG, | ||
223 | MPUI730_SLEEP_SAVE_EMIFS_CONFIG, | ||
224 | MPUI730_SLEEP_SAVE_OMAP_IH1_MIR, | ||
225 | MPUI730_SLEEP_SAVE_OMAP_IH2_0_MIR, | ||
226 | MPUI730_SLEEP_SAVE_OMAP_IH2_1_MIR, | ||
227 | #if defined(CONFIG_ARCH_OMAP730) | ||
228 | MPUI730_SLEEP_SAVE_SIZE | ||
229 | #else | ||
230 | MPUI730_SLEEP_SAVE_SIZE = 0 | ||
231 | #endif | ||
232 | }; | ||
233 | |||
198 | enum mpui1610_save_state { | 234 | enum mpui1610_save_state { |
199 | MPUI1610_SLEEP_SAVE_START = 0, | 235 | MPUI1610_SLEEP_SAVE_START = 0, |
200 | /* | 236 | /* |
diff --git a/include/asm-arm/arch-omap/prcm.h b/include/asm-arm/arch-omap/prcm.h new file mode 100644 index 000000000000..7b48a5cbb15f --- /dev/null +++ b/include/asm-arm/arch-omap/prcm.h | |||
@@ -0,0 +1,429 @@ | |||
1 | /* | ||
2 | * prcm.h - Access definations for use in OMAP24XX clock and power management | ||
3 | * | ||
4 | * Copyright (C) 2005 Texas Instruments, Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __ASM_ARM_ARCH_DPM_PRCM_H | ||
22 | #define __ASM_ARM_ARCH_DPM_PRCM_H | ||
23 | |||
24 | /* SET_PERFORMANCE_LEVEL PARAMETERS */ | ||
25 | #define PRCM_HALF_SPEED 1 | ||
26 | #define PRCM_FULL_SPEED 2 | ||
27 | |||
28 | #ifndef __ASSEMBLER__ | ||
29 | |||
30 | #define PRCM_REG32(offset) __REG32(OMAP24XX_PRCM_BASE + (offset)) | ||
31 | |||
32 | #define PRCM_REVISION PRCM_REG32(0x000) | ||
33 | #define PRCM_SYSCONFIG PRCM_REG32(0x010) | ||
34 | #define PRCM_IRQSTATUS_MPU PRCM_REG32(0x018) | ||
35 | #define PRCM_IRQENABLE_MPU PRCM_REG32(0x01C) | ||
36 | #define PRCM_VOLTCTRL PRCM_REG32(0x050) | ||
37 | #define PRCM_VOLTST PRCM_REG32(0x054) | ||
38 | #define PRCM_CLKSRC_CTRL PRCM_REG32(0x060) | ||
39 | #define PRCM_CLKOUT_CTRL PRCM_REG32(0x070) | ||
40 | #define PRCM_CLKEMUL_CTRL PRCM_REG32(0x078) | ||
41 | #define PRCM_CLKCFG_CTRL PRCM_REG32(0x080) | ||
42 | #define PRCM_CLKCFG_STATUS PRCM_REG32(0x084) | ||
43 | #define PRCM_VOLTSETUP PRCM_REG32(0x090) | ||
44 | #define PRCM_CLKSSETUP PRCM_REG32(0x094) | ||
45 | #define PRCM_POLCTRL PRCM_REG32(0x098) | ||
46 | |||
47 | /* GENERAL PURPOSE */ | ||
48 | #define GENERAL_PURPOSE1 PRCM_REG32(0x0B0) | ||
49 | #define GENERAL_PURPOSE2 PRCM_REG32(0x0B4) | ||
50 | #define GENERAL_PURPOSE3 PRCM_REG32(0x0B8) | ||
51 | #define GENERAL_PURPOSE4 PRCM_REG32(0x0BC) | ||
52 | #define GENERAL_PURPOSE5 PRCM_REG32(0x0C0) | ||
53 | #define GENERAL_PURPOSE6 PRCM_REG32(0x0C4) | ||
54 | #define GENERAL_PURPOSE7 PRCM_REG32(0x0C8) | ||
55 | #define GENERAL_PURPOSE8 PRCM_REG32(0x0CC) | ||
56 | #define GENERAL_PURPOSE9 PRCM_REG32(0x0D0) | ||
57 | #define GENERAL_PURPOSE10 PRCM_REG32(0x0D4) | ||
58 | #define GENERAL_PURPOSE11 PRCM_REG32(0x0D8) | ||
59 | #define GENERAL_PURPOSE12 PRCM_REG32(0x0DC) | ||
60 | #define GENERAL_PURPOSE13 PRCM_REG32(0x0E0) | ||
61 | #define GENERAL_PURPOSE14 PRCM_REG32(0x0E4) | ||
62 | #define GENERAL_PURPOSE15 PRCM_REG32(0x0E8) | ||
63 | #define GENERAL_PURPOSE16 PRCM_REG32(0x0EC) | ||
64 | #define GENERAL_PURPOSE17 PRCM_REG32(0x0F0) | ||
65 | #define GENERAL_PURPOSE18 PRCM_REG32(0x0F4) | ||
66 | #define GENERAL_PURPOSE19 PRCM_REG32(0x0F8) | ||
67 | #define GENERAL_PURPOSE20 PRCM_REG32(0x0FC) | ||
68 | |||
69 | /* MPU */ | ||
70 | #define CM_CLKSEL_MPU PRCM_REG32(0x140) | ||
71 | #define CM_CLKSTCTRL_MPU PRCM_REG32(0x148) | ||
72 | #define RM_RSTST_MPU PRCM_REG32(0x158) | ||
73 | #define PM_WKDEP_MPU PRCM_REG32(0x1C8) | ||
74 | #define PM_EVGENCTRL_MPU PRCM_REG32(0x1D4) | ||
75 | #define PM_EVEGENONTIM_MPU PRCM_REG32(0x1D8) | ||
76 | #define PM_EVEGENOFFTIM_MPU PRCM_REG32(0x1DC) | ||
77 | #define PM_PWSTCTRL_MPU PRCM_REG32(0x1E0) | ||
78 | #define PM_PWSTST_MPU PRCM_REG32(0x1E4) | ||
79 | |||
80 | /* CORE */ | ||
81 | #define CM_FCLKEN1_CORE PRCM_REG32(0x200) | ||
82 | #define CM_FCLKEN2_CORE PRCM_REG32(0x204) | ||
83 | #define CM_FCLKEN3_CORE PRCM_REG32(0x208) | ||
84 | #define CM_ICLKEN1_CORE PRCM_REG32(0x210) | ||
85 | #define CM_ICLKEN2_CORE PRCM_REG32(0x214) | ||
86 | #define CM_ICLKEN3_CORE PRCM_REG32(0x218) | ||
87 | #define CM_ICLKEN4_CORE PRCM_REG32(0x21C) | ||
88 | #define CM_IDLEST1_CORE PRCM_REG32(0x220) | ||
89 | #define CM_IDLEST2_CORE PRCM_REG32(0x224) | ||
90 | #define CM_IDLEST3_CORE PRCM_REG32(0x228) | ||
91 | #define CM_IDLEST4_CORE PRCM_REG32(0x22C) | ||
92 | #define CM_AUTOIDLE1_CORE PRCM_REG32(0x230) | ||
93 | #define CM_AUTOIDLE2_CORE PRCM_REG32(0x234) | ||
94 | #define CM_AUTOIDLE3_CORE PRCM_REG32(0x238) | ||
95 | #define CM_AUTOIDLE4_CORE PRCM_REG32(0x23C) | ||
96 | #define CM_CLKSEL1_CORE PRCM_REG32(0x240) | ||
97 | #define CM_CLKSEL2_CORE PRCM_REG32(0x244) | ||
98 | #define CM_CLKSTCTRL_CORE PRCM_REG32(0x248) | ||
99 | #define PM_WKEN1_CORE PRCM_REG32(0x2A0) | ||
100 | #define PM_WKEN2_CORE PRCM_REG32(0x2A4) | ||
101 | #define PM_WKST1_CORE PRCM_REG32(0x2B0) | ||
102 | #define PM_WKST2_CORE PRCM_REG32(0x2B4) | ||
103 | #define PM_WKDEP_CORE PRCM_REG32(0x2C8) | ||
104 | #define PM_PWSTCTRL_CORE PRCM_REG32(0x2E0) | ||
105 | #define PM_PWSTST_CORE PRCM_REG32(0x2E4) | ||
106 | |||
107 | /* GFX */ | ||
108 | #define CM_FCLKEN_GFX PRCM_REG32(0x300) | ||
109 | #define CM_ICLKEN_GFX PRCM_REG32(0x310) | ||
110 | #define CM_IDLEST_GFX PRCM_REG32(0x320) | ||
111 | #define CM_CLKSEL_GFX PRCM_REG32(0x340) | ||
112 | #define CM_CLKSTCTRL_GFX PRCM_REG32(0x348) | ||
113 | #define RM_RSTCTRL_GFX PRCM_REG32(0x350) | ||
114 | #define RM_RSTST_GFX PRCM_REG32(0x358) | ||
115 | #define PM_WKDEP_GFX PRCM_REG32(0x3C8) | ||
116 | #define PM_PWSTCTRL_GFX PRCM_REG32(0x3E0) | ||
117 | #define PM_PWSTST_GFX PRCM_REG32(0x3E4) | ||
118 | |||
119 | /* WAKE-UP */ | ||
120 | #define CM_FCLKEN_WKUP PRCM_REG32(0x400) | ||
121 | #define CM_ICLKEN_WKUP PRCM_REG32(0x410) | ||
122 | #define CM_IDLEST_WKUP PRCM_REG32(0x420) | ||
123 | #define CM_AUTOIDLE_WKUP PRCM_REG32(0x430) | ||
124 | #define CM_CLKSEL_WKUP PRCM_REG32(0x440) | ||
125 | #define RM_RSTCTRL_WKUP PRCM_REG32(0x450) | ||
126 | #define RM_RSTTIME_WKUP PRCM_REG32(0x454) | ||
127 | #define RM_RSTST_WKUP PRCM_REG32(0x458) | ||
128 | #define PM_WKEN_WKUP PRCM_REG32(0x4A0) | ||
129 | #define PM_WKST_WKUP PRCM_REG32(0x4B0) | ||
130 | |||
131 | /* CLOCKS */ | ||
132 | #define CM_CLKEN_PLL PRCM_REG32(0x500) | ||
133 | #define CM_IDLEST_CKGEN PRCM_REG32(0x520) | ||
134 | #define CM_AUTOIDLE_PLL PRCM_REG32(0x530) | ||
135 | #define CM_CLKSEL1_PLL PRCM_REG32(0x540) | ||
136 | #define CM_CLKSEL2_PLL PRCM_REG32(0x544) | ||
137 | |||
138 | /* DSP */ | ||
139 | #define CM_FCLKEN_DSP PRCM_REG32(0x800) | ||
140 | #define CM_ICLKEN_DSP PRCM_REG32(0x810) | ||
141 | #define CM_IDLEST_DSP PRCM_REG32(0x820) | ||
142 | #define CM_AUTOIDLE_DSP PRCM_REG32(0x830) | ||
143 | #define CM_CLKSEL_DSP PRCM_REG32(0x840) | ||
144 | #define CM_CLKSTCTRL_DSP PRCM_REG32(0x848) | ||
145 | #define RM_RSTCTRL_DSP PRCM_REG32(0x850) | ||
146 | #define RM_RSTST_DSP PRCM_REG32(0x858) | ||
147 | #define PM_WKEN_DSP PRCM_REG32(0x8A0) | ||
148 | #define PM_WKDEP_DSP PRCM_REG32(0x8C8) | ||
149 | #define PM_PWSTCTRL_DSP PRCM_REG32(0x8E0) | ||
150 | #define PM_PWSTST_DSP PRCM_REG32(0x8E4) | ||
151 | #define PRCM_IRQSTATUS_DSP PRCM_REG32(0x8F0) | ||
152 | #define PRCM_IRQENABLE_DSP PRCM_REG32(0x8F4) | ||
153 | |||
154 | /* IVA */ | ||
155 | #define PRCM_IRQSTATUS_IVA PRCM_REG32(0x8F8) | ||
156 | #define PRCM_IRQENABLE_IVA PRCM_REG32(0x8FC) | ||
157 | |||
158 | /* Modem on 2430 */ | ||
159 | #define CM_FCLKEN_MDM PRCM_REG32(0xC00) | ||
160 | #define CM_ICLKEN_MDM PRCM_REG32(0xC10) | ||
161 | #define CM_IDLEST_MDM PRCM_REG32(0xC20) | ||
162 | #define CM_CLKSEL_MDM PRCM_REG32(0xC40) | ||
163 | |||
164 | /* FIXME: Move to header for 2430 */ | ||
165 | #define DISP_BASE (OMAP24XX_L4_IO_BASE+0x50000) | ||
166 | #define DISP_REG32(offset) __REG32(DISP_BASE + (offset)) | ||
167 | |||
168 | #define OMAP24XX_GPMC_BASE (L3_24XX_BASE + 0xa000) | ||
169 | #define GPMC_BASE (OMAP24XX_GPMC_BASE) | ||
170 | #define GPMC_REG32(offset) __REG32(GPMC_BASE + (offset)) | ||
171 | |||
172 | #define GPT1_BASE (OMAP24XX_GPT1) | ||
173 | #define GPT1_REG32(offset) __REG32(GPT1_BASE + (offset)) | ||
174 | |||
175 | /* Misc sysconfig */ | ||
176 | #define DISPC_SYSCONFIG DISP_REG32(0x410) | ||
177 | #define SPI_BASE (OMAP24XX_L4_IO_BASE+0x98000) | ||
178 | #define MCSPI1_SYSCONFIG __REG32(SPI_BASE + 0x10) | ||
179 | #define MCSPI2_SYSCONFIG __REG32(SPI_BASE+0x2000 + 0x10) | ||
180 | |||
181 | //#define DSP_MMU_SYSCONFIG 0x5A000010 | ||
182 | #define CAMERA_MMU_SYSCONFIG __REG32(DISP_BASE+0x2C10) | ||
183 | //#define IVA_MMU_SYSCONFIG 0x5D000010 | ||
184 | //#define DSP_DMA_SYSCONFIG 0x00FCC02C | ||
185 | #define CAMERA_DMA_SYSCONFIG __REG32(DISP_BASE+0x282C) | ||
186 | #define SYSTEM_DMA_SYSCONFIG __REG32(DISP_BASE+0x602C) | ||
187 | #define GPMC_SYSCONFIG GPMC_REG32(0x010) | ||
188 | #define MAILBOXES_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x94010) | ||
189 | #define UART1_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6A054) | ||
190 | #define UART2_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6C054) | ||
191 | #define UART3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6E054) | ||
192 | //#define IVA_SYSCONFIG 0x5C060010 | ||
193 | #define SDRC_SYSCONFIG __REG32(OMAP24XX_SDRC_BASE+0x10) | ||
194 | #define SMS_SYSCONFIG __REG32(OMAP24XX_SMS_BASE+0x10) | ||
195 | #define SSI_SYSCONFIG __REG32(DISP_BASE+0x8010) | ||
196 | //#define VLYNQ_SYSCONFIG 0x67FFFE10 | ||
197 | |||
198 | /* rkw - good cannidates for PM_ to start what nm was trying */ | ||
199 | #define OMAP24XX_GPT2 (OMAP24XX_L4_IO_BASE+0x2A000) | ||
200 | #define OMAP24XX_GPT3 (OMAP24XX_L4_IO_BASE+0x78000) | ||
201 | #define OMAP24XX_GPT4 (OMAP24XX_L4_IO_BASE+0x7A000) | ||
202 | #define OMAP24XX_GPT5 (OMAP24XX_L4_IO_BASE+0x7C000) | ||
203 | #define OMAP24XX_GPT6 (OMAP24XX_L4_IO_BASE+0x7E000) | ||
204 | #define OMAP24XX_GPT7 (OMAP24XX_L4_IO_BASE+0x80000) | ||
205 | #define OMAP24XX_GPT8 (OMAP24XX_L4_IO_BASE+0x82000) | ||
206 | #define OMAP24XX_GPT9 (OMAP24XX_L4_IO_BASE+0x84000) | ||
207 | #define OMAP24XX_GPT10 (OMAP24XX_L4_IO_BASE+0x86000) | ||
208 | #define OMAP24XX_GPT11 (OMAP24XX_L4_IO_BASE+0x88000) | ||
209 | #define OMAP24XX_GPT12 (OMAP24XX_L4_IO_BASE+0x8A000) | ||
210 | |||
211 | #define GPTIMER1_SYSCONFIG GPT1_REG32(0x010) | ||
212 | #define GPTIMER2_SYSCONFIG __REG32(OMAP24XX_GPT2 + 0x10) | ||
213 | #define GPTIMER3_SYSCONFIG __REG32(OMAP24XX_GPT3 + 0x10) | ||
214 | #define GPTIMER4_SYSCONFIG __REG32(OMAP24XX_GPT4 + 0x10) | ||
215 | #define GPTIMER5_SYSCONFIG __REG32(OMAP24XX_GPT5 + 0x10) | ||
216 | #define GPTIMER6_SYSCONFIG __REG32(OMAP24XX_GPT6 + 0x10) | ||
217 | #define GPTIMER7_SYSCONFIG __REG32(OMAP24XX_GPT7 + 0x10) | ||
218 | #define GPTIMER8_SYSCONFIG __REG32(OMAP24XX_GPT8 + 0x10) | ||
219 | #define GPTIMER9_SYSCONFIG __REG32(OMAP24XX_GPT9 + 0x10) | ||
220 | #define GPTIMER10_SYSCONFIG __REG32(OMAP24XX_GPT10 + 0x10) | ||
221 | #define GPTIMER11_SYSCONFIG __REG32(OMAP24XX_GPT11 + 0x10) | ||
222 | #define GPTIMER12_SYSCONFIG __REG32(OMAP24XX_GPT12 + 0x10) | ||
223 | |||
224 | #define GPIOX_BASE(X) (OMAP24XX_GPIO_BASE+(0x2000*((X)-1))) | ||
225 | |||
226 | #define GPIO1_SYSCONFIG __REG32((GPIOX_BASE(1)+0x10)) | ||
227 | #define GPIO2_SYSCONFIG __REG32((GPIOX_BASE(2)+0x10)) | ||
228 | #define GPIO3_SYSCONFIG __REG32((GPIOX_BASE(3)+0x10)) | ||
229 | #define GPIO4_SYSCONFIG __REG32((GPIOX_BASE(4)+0x10)) | ||
230 | |||
231 | /* GP TIMER 1 */ | ||
232 | #define GPTIMER1_TISTAT GPT1_REG32(0x014) | ||
233 | #define GPTIMER1_TISR GPT1_REG32(0x018) | ||
234 | #define GPTIMER1_TIER GPT1_REG32(0x01C) | ||
235 | #define GPTIMER1_TWER GPT1_REG32(0x020) | ||
236 | #define GPTIMER1_TCLR GPT1_REG32(0x024) | ||
237 | #define GPTIMER1_TCRR GPT1_REG32(0x028) | ||
238 | #define GPTIMER1_TLDR GPT1_REG32(0x02C) | ||
239 | #define GPTIMER1_TTGR GPT1_REG32(0x030) | ||
240 | #define GPTIMER1_TWPS GPT1_REG32(0x034) | ||
241 | #define GPTIMER1_TMAR GPT1_REG32(0x038) | ||
242 | #define GPTIMER1_TCAR1 GPT1_REG32(0x03C) | ||
243 | #define GPTIMER1_TSICR GPT1_REG32(0x040) | ||
244 | #define GPTIMER1_TCAR2 GPT1_REG32(0x044) | ||
245 | |||
246 | /* rkw -- base fix up please... */ | ||
247 | #define GPTIMER3_TISR __REG32(OMAP24XX_L4_IO_BASE+0x78018) | ||
248 | |||
249 | /* SDRC */ | ||
250 | #define SDRC_DLLA_CTRL __REG32(OMAP24XX_SDRC_BASE+0x060) | ||
251 | #define SDRC_DLLA_STATUS __REG32(OMAP24XX_SDRC_BASE+0x064) | ||
252 | #define SDRC_DLLB_CTRL __REG32(OMAP24XX_SDRC_BASE+0x068) | ||
253 | #define SDRC_DLLB_STATUS __REG32(OMAP24XX_SDRC_BASE+0x06C) | ||
254 | #define SDRC_POWER __REG32(OMAP24XX_SDRC_BASE+0x070) | ||
255 | #define SDRC_MR_0 __REG32(OMAP24XX_SDRC_BASE+0x084) | ||
256 | |||
257 | /* GPIO 1 */ | ||
258 | #define GPIO1_BASE GPIOX_BASE(1) | ||
259 | #define GPIO1_REG32(offset) __REG32(GPIO1_BASE + (offset)) | ||
260 | #define GPIO1_IRQENABLE1 GPIO1_REG32(0x01C) | ||
261 | #define GPIO1_IRQSTATUS1 GPIO1_REG32(0x018) | ||
262 | #define GPIO1_IRQENABLE2 GPIO1_REG32(0x02C) | ||
263 | #define GPIO1_IRQSTATUS2 GPIO1_REG32(0x028) | ||
264 | #define GPIO1_WAKEUPENABLE GPIO1_REG32(0x020) | ||
265 | #define GPIO1_RISINGDETECT GPIO1_REG32(0x048) | ||
266 | #define GPIO1_DATAIN GPIO1_REG32(0x038) | ||
267 | #define GPIO1_OE GPIO1_REG32(0x034) | ||
268 | #define GPIO1_DATAOUT GPIO1_REG32(0x03C) | ||
269 | |||
270 | /* GPIO2 */ | ||
271 | #define GPIO2_BASE GPIOX_BASE(2) | ||
272 | #define GPIO2_REG32(offset) __REG32(GPIO2_BASE + (offset)) | ||
273 | #define GPIO2_IRQENABLE1 GPIO2_REG32(0x01C) | ||
274 | #define GPIO2_IRQSTATUS1 GPIO2_REG32(0x018) | ||
275 | #define GPIO2_IRQENABLE2 GPIO2_REG32(0x02C) | ||
276 | #define GPIO2_IRQSTATUS2 GPIO2_REG32(0x028) | ||
277 | #define GPIO2_WAKEUPENABLE GPIO2_REG32(0x020) | ||
278 | #define GPIO2_RISINGDETECT GPIO2_REG32(0x048) | ||
279 | #define GPIO2_DATAIN GPIO2_REG32(0x038) | ||
280 | #define GPIO2_OE GPIO2_REG32(0x034) | ||
281 | #define GPIO2_DATAOUT GPIO2_REG32(0x03C) | ||
282 | |||
283 | /* GPIO 3 */ | ||
284 | #define GPIO3_BASE GPIOX_BASE(3) | ||
285 | #define GPIO3_REG32(offset) __REG32(GPIO3_BASE + (offset)) | ||
286 | #define GPIO3_IRQENABLE1 GPIO3_REG32(0x01C) | ||
287 | #define GPIO3_IRQSTATUS1 GPIO3_REG32(0x018) | ||
288 | #define GPIO3_IRQENABLE2 GPIO3_REG32(0x02C) | ||
289 | #define GPIO3_IRQSTATUS2 GPIO3_REG32(0x028) | ||
290 | #define GPIO3_WAKEUPENABLE GPIO3_REG32(0x020) | ||
291 | #define GPIO3_RISINGDETECT GPIO3_REG32(0x048) | ||
292 | #define GPIO3_FALLINGDETECT GPIO3_REG32(0x04C) | ||
293 | #define GPIO3_DATAIN GPIO3_REG32(0x038) | ||
294 | #define GPIO3_OE GPIO3_REG32(0x034) | ||
295 | #define GPIO3_DATAOUT GPIO3_REG32(0x03C) | ||
296 | #define GPIO3_DEBOUNCENABLE GPIO3_REG32(0x050) | ||
297 | #define GPIO3_DEBOUNCINGTIME GPIO3_REG32(0x054) | ||
298 | |||
299 | /* GPIO 4 */ | ||
300 | #define GPIO4_BASE GPIOX_BASE(4) | ||
301 | #define GPIO4_REG32(offset) __REG32(GPIO4_BASE + (offset)) | ||
302 | #define GPIO4_IRQENABLE1 GPIO4_REG32(0x01C) | ||
303 | #define GPIO4_IRQSTATUS1 GPIO4_REG32(0x018) | ||
304 | #define GPIO4_IRQENABLE2 GPIO4_REG32(0x02C) | ||
305 | #define GPIO4_IRQSTATUS2 GPIO4_REG32(0x028) | ||
306 | #define GPIO4_WAKEUPENABLE GPIO4_REG32(0x020) | ||
307 | #define GPIO4_RISINGDETECT GPIO4_REG32(0x048) | ||
308 | #define GPIO4_FALLINGDETECT GPIO4_REG32(0x04C) | ||
309 | #define GPIO4_DATAIN GPIO4_REG32(0x038) | ||
310 | #define GPIO4_OE GPIO4_REG32(0x034) | ||
311 | #define GPIO4_DATAOUT GPIO4_REG32(0x03C) | ||
312 | #define GPIO4_DEBOUNCENABLE GPIO4_REG32(0x050) | ||
313 | #define GPIO4_DEBOUNCINGTIME GPIO4_REG32(0x054) | ||
314 | |||
315 | |||
316 | /* IO CONFIG */ | ||
317 | #define CONTROL_BASE (OMAP24XX_CTRL_BASE) | ||
318 | #define CONTROL_REG32(offset) __REG32(CONTROL_BASE + (offset)) | ||
319 | |||
320 | #define CONTROL_PADCONF_SPI1_NCS2 CONTROL_REG32(0x104) | ||
321 | #define CONTROL_PADCONF_SYS_XTALOUT CONTROL_REG32(0x134) | ||
322 | #define CONTROL_PADCONF_UART1_RX CONTROL_REG32(0x0C8) | ||
323 | #define CONTROL_PADCONF_MCBSP1_DX CONTROL_REG32(0x10C) | ||
324 | #define CONTROL_PADCONF_GPMC_NCS4 CONTROL_REG32(0x090) | ||
325 | #define CONTROL_PADCONF_DSS_D5 CONTROL_REG32(0x0B8) | ||
326 | #define CONTROL_PADCONF_DSS_D9 CONTROL_REG32(0x0BC) | ||
327 | #define CONTROL_PADCONF_DSS_D13 CONTROL_REG32(0x0C0) | ||
328 | #define CONTROL_PADCONF_DSS_VSYNC CONTROL_REG32(0x0CC) | ||
329 | |||
330 | /* CONTROL */ | ||
331 | #define CONTROL_DEVCONF CONTROL_REG32(0x274) | ||
332 | |||
333 | /* INTERRUPT CONTROLLER */ | ||
334 | #define INTC_BASE (OMAP24XX_L4_IO_BASE+0xfe000) | ||
335 | #define INTC_REG32(offset) __REG32(INTC_BASE + (offset)) | ||
336 | |||
337 | #define INTC1_U_BASE INTC_REG32(0x000) | ||
338 | #define INTC_MIR0 INTC_REG32(0x084) | ||
339 | #define INTC_MIR_SET0 INTC_REG32(0x08C) | ||
340 | #define INTC_MIR_CLEAR0 INTC_REG32(0x088) | ||
341 | #define INTC_ISR_CLEAR0 INTC_REG32(0x094) | ||
342 | #define INTC_MIR1 INTC_REG32(0x0A4) | ||
343 | #define INTC_MIR_SET1 INTC_REG32(0x0AC) | ||
344 | #define INTC_MIR_CLEAR1 INTC_REG32(0x0A8) | ||
345 | #define INTC_ISR_CLEAR1 INTC_REG32(0x0B4) | ||
346 | #define INTC_MIR2 INTC_REG32(0x0C4) | ||
347 | #define INTC_MIR_SET2 INTC_REG32(0x0CC) | ||
348 | #define INTC_MIR_CLEAR2 INTC_REG32(0x0C8) | ||
349 | #define INTC_ISR_CLEAR2 INTC_REG32(0x0D4) | ||
350 | #define INTC_SIR_IRQ INTC_REG32(0x040) | ||
351 | #define INTC_CONTROL INTC_REG32(0x048) | ||
352 | #define INTC_ILR11 INTC_REG32(0x12C) | ||
353 | #define INTC_ILR32 INTC_REG32(0x180) | ||
354 | #define INTC_ILR37 INTC_REG32(0x194) | ||
355 | #define INTC_SYSCONFIG INTC_REG32(0x010) | ||
356 | |||
357 | /* RAM FIREWALL */ | ||
358 | #define RAMFW_BASE (0x68005000) | ||
359 | #define RAMFW_REG32(offset) __REG32(RAMFW_BASE + (offset)) | ||
360 | |||
361 | #define RAMFW_REQINFOPERM0 RAMFW_REG32(0x048) | ||
362 | #define RAMFW_READPERM0 RAMFW_REG32(0x050) | ||
363 | #define RAMFW_WRITEPERM0 RAMFW_REG32(0x058) | ||
364 | |||
365 | /* GPMC CS1 FPGA ON USER INTERFACE MODULE */ | ||
366 | //#define DEBUG_BOARD_LED_REGISTER 0x04000014 | ||
367 | |||
368 | /* GPMC CS0 */ | ||
369 | #define GPMC_CONFIG1_0 GPMC_REG32(0x060) | ||
370 | #define GPMC_CONFIG2_0 GPMC_REG32(0x064) | ||
371 | #define GPMC_CONFIG3_0 GPMC_REG32(0x068) | ||
372 | #define GPMC_CONFIG4_0 GPMC_REG32(0x06C) | ||
373 | #define GPMC_CONFIG5_0 GPMC_REG32(0x070) | ||
374 | #define GPMC_CONFIG6_0 GPMC_REG32(0x074) | ||
375 | #define GPMC_CONFIG7_0 GPMC_REG32(0x078) | ||
376 | |||
377 | /* GPMC CS1 */ | ||
378 | #define GPMC_CONFIG1_1 GPMC_REG32(0x090) | ||
379 | #define GPMC_CONFIG2_1 GPMC_REG32(0x094) | ||
380 | #define GPMC_CONFIG3_1 GPMC_REG32(0x098) | ||
381 | #define GPMC_CONFIG4_1 GPMC_REG32(0x09C) | ||
382 | #define GPMC_CONFIG5_1 GPMC_REG32(0x0a0) | ||
383 | #define GPMC_CONFIG6_1 GPMC_REG32(0x0a4) | ||
384 | #define GPMC_CONFIG7_1 GPMC_REG32(0x0a8) | ||
385 | |||
386 | /* DSS */ | ||
387 | #define DSS_CONTROL DISP_REG32(0x040) | ||
388 | #define DISPC_CONTROL DISP_REG32(0x440) | ||
389 | #define DISPC_SYSSTATUS DISP_REG32(0x414) | ||
390 | #define DISPC_IRQSTATUS DISP_REG32(0x418) | ||
391 | #define DISPC_IRQENABLE DISP_REG32(0x41C) | ||
392 | #define DISPC_CONFIG DISP_REG32(0x444) | ||
393 | #define DISPC_DEFAULT_COLOR0 DISP_REG32(0x44C) | ||
394 | #define DISPC_DEFAULT_COLOR1 DISP_REG32(0x450) | ||
395 | #define DISPC_TRANS_COLOR0 DISP_REG32(0x454) | ||
396 | #define DISPC_TRANS_COLOR1 DISP_REG32(0x458) | ||
397 | #define DISPC_LINE_NUMBER DISP_REG32(0x460) | ||
398 | #define DISPC_TIMING_H DISP_REG32(0x464) | ||
399 | #define DISPC_TIMING_V DISP_REG32(0x468) | ||
400 | #define DISPC_POL_FREQ DISP_REG32(0x46C) | ||
401 | #define DISPC_DIVISOR DISP_REG32(0x470) | ||
402 | #define DISPC_SIZE_DIG DISP_REG32(0x478) | ||
403 | #define DISPC_SIZE_LCD DISP_REG32(0x47C) | ||
404 | #define DISPC_GFX_BA0 DISP_REG32(0x480) | ||
405 | #define DISPC_GFX_BA1 DISP_REG32(0x484) | ||
406 | #define DISPC_GFX_POSITION DISP_REG32(0x488) | ||
407 | #define DISPC_GFX_SIZE DISP_REG32(0x48C) | ||
408 | #define DISPC_GFX_ATTRIBUTES DISP_REG32(0x4A0) | ||
409 | #define DISPC_GFX_FIFO_THRESHOLD DISP_REG32(0x4A4) | ||
410 | #define DISPC_GFX_ROW_INC DISP_REG32(0x4AC) | ||
411 | #define DISPC_GFX_PIXEL_INC DISP_REG32(0x4B0) | ||
412 | #define DISPC_GFX_WINDOW_SKIP DISP_REG32(0x4B4) | ||
413 | #define DISPC_GFX_TABLE_BA DISP_REG32(0x4B8) | ||
414 | #define DISPC_DATA_CYCLE1 DISP_REG32(0x5D4) | ||
415 | #define DISPC_DATA_CYCLE2 DISP_REG32(0x5D8) | ||
416 | #define DISPC_DATA_CYCLE3 DISP_REG32(0x5DC) | ||
417 | |||
418 | /* Wake up define for board */ | ||
419 | #define GPIO97 (1 << 1) | ||
420 | #define GPIO88 (1 << 24) | ||
421 | |||
422 | #endif /* __ASSEMBLER__ */ | ||
423 | |||
424 | #endif | ||
425 | |||
426 | |||
427 | |||
428 | |||
429 | |||
diff --git a/include/asm-arm/arch-omap/sram.h b/include/asm-arm/arch-omap/sram.h new file mode 100644 index 000000000000..e72ccbf0fe06 --- /dev/null +++ b/include/asm-arm/arch-omap/sram.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-omap/sram.h | ||
3 | * | ||
4 | * Interface for functions that need to be run in internal SRAM | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ARCH_ARM_OMAP_SRAM_H | ||
12 | #define __ARCH_ARM_OMAP_SRAM_H | ||
13 | |||
14 | extern void * omap_sram_push(void * start, unsigned long size); | ||
15 | extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl); | ||
16 | |||
17 | extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, | ||
18 | u32 base_cs, u32 force_unlock); | ||
19 | extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, | ||
20 | u32 mem_type); | ||
21 | extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); | ||
22 | |||
23 | |||
24 | /* Do not use these */ | ||
25 | extern void sram_reprogram_clock(u32 ckctl, u32 dpllctl); | ||
26 | extern unsigned long sram_reprogram_clock_sz; | ||
27 | |||
28 | extern void sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, | ||
29 | u32 base_cs, u32 force_unlock); | ||
30 | extern unsigned long sram_ddr_init_sz; | ||
31 | |||
32 | extern u32 sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); | ||
33 | extern unsigned long sram_set_prcm_sz; | ||
34 | |||
35 | extern void sram_reprogram_sdrc(u32 perf_level, u32 dll_val, u32 mem_type); | ||
36 | extern unsigned long sram_reprogram_sdrc_sz; | ||
37 | |||
38 | #endif | ||
diff --git a/include/asm-arm/arch-omap/system.h b/include/asm-arm/arch-omap/system.h index ff37bc27e603..b43cdd2a3874 100644 --- a/include/asm-arm/arch-omap/system.h +++ b/include/asm-arm/arch-omap/system.h | |||
@@ -6,18 +6,21 @@ | |||
6 | #define __ASM_ARCH_SYSTEM_H | 6 | #define __ASM_ARCH_SYSTEM_H |
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | #include <asm/mach-types.h> | 8 | #include <asm/mach-types.h> |
9 | #include <asm/hardware/clock.h> | ||
9 | #include <asm/arch/hardware.h> | 10 | #include <asm/arch/hardware.h> |
10 | #include <asm/mach-types.h> | 11 | #include <asm/arch/prcm.h> |
12 | |||
13 | #ifndef CONFIG_MACH_VOICEBLUE | ||
14 | #define voiceblue_reset() do {} while (0) | ||
15 | #endif | ||
11 | 16 | ||
12 | static inline void arch_idle(void) | 17 | static inline void arch_idle(void) |
13 | { | 18 | { |
14 | cpu_do_idle(); | 19 | cpu_do_idle(); |
15 | } | 20 | } |
16 | 21 | ||
17 | static inline void arch_reset(char mode) | 22 | static inline void omap1_arch_reset(char mode) |
18 | { | 23 | { |
19 | |||
20 | #ifdef CONFIG_ARCH_OMAP16XX | ||
21 | /* | 24 | /* |
22 | * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 | 25 | * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 |
23 | * "Global Software Reset Affects Traffic Controller Frequency". | 26 | * "Global Software Reset Affects Traffic Controller Frequency". |
@@ -27,13 +30,31 @@ static inline void arch_reset(char mode) | |||
27 | DPLL_CTL); | 30 | DPLL_CTL); |
28 | omap_writew(0x8, ARM_RSTCT1); | 31 | omap_writew(0x8, ARM_RSTCT1); |
29 | } | 32 | } |
30 | #endif | 33 | |
31 | #ifdef CONFIG_MACH_VOICEBLUE | ||
32 | if (machine_is_voiceblue()) | 34 | if (machine_is_voiceblue()) |
33 | voiceblue_reset(); | 35 | voiceblue_reset(); |
34 | else | 36 | else |
35 | #endif | ||
36 | omap_writew(1, ARM_RSTCT1); | 37 | omap_writew(1, ARM_RSTCT1); |
37 | } | 38 | } |
38 | 39 | ||
40 | static inline void omap2_arch_reset(char mode) | ||
41 | { | ||
42 | u32 rate; | ||
43 | struct clk *vclk, *sclk; | ||
44 | |||
45 | vclk = clk_get(NULL, "virt_prcm_set"); | ||
46 | sclk = clk_get(NULL, "sys_ck"); | ||
47 | rate = clk_get_rate(sclk); | ||
48 | clk_set_rate(vclk, rate); /* go to bypass for OMAP limitation */ | ||
49 | RM_RSTCTRL_WKUP |= 2; | ||
50 | } | ||
51 | |||
52 | static inline void arch_reset(char mode) | ||
53 | { | ||
54 | if (!cpu_is_omap24xx()) | ||
55 | omap1_arch_reset(mode); | ||
56 | else | ||
57 | omap2_arch_reset(mode); | ||
58 | } | ||
59 | |||
39 | #endif | 60 | #endif |
diff --git a/include/asm-arm/arch-omap/timex.h b/include/asm-arm/arch-omap/timex.h index b61ddb491e83..21f2e367185a 100644 --- a/include/asm-arm/arch-omap/timex.h +++ b/include/asm-arm/arch-omap/timex.h | |||
@@ -28,6 +28,14 @@ | |||
28 | #if !defined(__ASM_ARCH_OMAP_TIMEX_H) | 28 | #if !defined(__ASM_ARCH_OMAP_TIMEX_H) |
29 | #define __ASM_ARCH_OMAP_TIMEX_H | 29 | #define __ASM_ARCH_OMAP_TIMEX_H |
30 | 30 | ||
31 | /* | ||
32 | * OMAP 32KHz timer updates time one jiffie at a time from a secondary timer, | ||
33 | * and that's why the CLOCK_TICK_RATE is not 32768. | ||
34 | */ | ||
35 | #ifdef CONFIG_OMAP_32K_TIMER | ||
36 | #define CLOCK_TICK_RATE (CONFIG_OMAP_32K_TIMER_HZ) | ||
37 | #else | ||
31 | #define CLOCK_TICK_RATE (HZ * 100000UL) | 38 | #define CLOCK_TICK_RATE (HZ * 100000UL) |
39 | #endif | ||
32 | 40 | ||
33 | #endif /* __ASM_ARCH_OMAP_TIMEX_H */ | 41 | #endif /* __ASM_ARCH_OMAP_TIMEX_H */ |
diff --git a/include/asm-arm/arch-omap/uncompress.h b/include/asm-arm/arch-omap/uncompress.h index 3545c86859cc..c718264affbd 100644 --- a/include/asm-arm/arch-omap/uncompress.h +++ b/include/asm-arm/arch-omap/uncompress.h | |||
@@ -36,10 +36,14 @@ putstr(const char *s) | |||
36 | volatile u8 * uart = 0; | 36 | volatile u8 * uart = 0; |
37 | int shift = 2; | 37 | int shift = 2; |
38 | 38 | ||
39 | #ifdef CONFIG_MACH_OMAP_PALMTE | ||
40 | return; | ||
41 | #endif | ||
42 | |||
39 | #ifdef CONFIG_ARCH_OMAP | 43 | #ifdef CONFIG_ARCH_OMAP |
40 | #ifdef CONFIG_OMAP_LL_DEBUG_UART3 | 44 | #ifdef CONFIG_OMAP_LL_DEBUG_UART3 |
41 | uart = (volatile u8 *)(OMAP_UART3_BASE); | 45 | uart = (volatile u8 *)(OMAP_UART3_BASE); |
42 | #elif CONFIG_OMAP_LL_DEBUG_UART2 | 46 | #elif defined(CONFIG_OMAP_LL_DEBUG_UART2) |
43 | uart = (volatile u8 *)(OMAP_UART2_BASE); | 47 | uart = (volatile u8 *)(OMAP_UART2_BASE); |
44 | #else | 48 | #else |
45 | uart = (volatile u8 *)(OMAP_UART1_BASE); | 49 | uart = (volatile u8 *)(OMAP_UART1_BASE); |
diff --git a/include/asm-arm/arch-pxa/sharpsl.h b/include/asm-arm/arch-pxa/sharpsl.h index 311f2bb5386a..0b43495d24b4 100644 --- a/include/asm-arm/arch-pxa/sharpsl.h +++ b/include/asm-arm/arch-pxa/sharpsl.h | |||
@@ -21,12 +21,18 @@ struct corgits_machinfo { | |||
21 | void (*wait_hsync)(void); | 21 | void (*wait_hsync)(void); |
22 | }; | 22 | }; |
23 | 23 | ||
24 | |||
24 | /* | 25 | /* |
25 | * SharpSL Backlight | 26 | * SharpSL Backlight |
26 | */ | 27 | */ |
27 | |||
28 | struct corgibl_machinfo { | 28 | struct corgibl_machinfo { |
29 | int max_intensity; | 29 | int max_intensity; |
30 | void (*set_bl_intensity)(int intensity); | 30 | void (*set_bl_intensity)(int intensity); |
31 | }; | 31 | }; |
32 | extern void corgibl_limit_intensity(int limit); | ||
33 | |||
32 | 34 | ||
35 | /* | ||
36 | * SharpSL Battery/PM Driver | ||
37 | */ | ||
38 | extern void sharpsl_battery_kick(void); | ||
diff --git a/include/asm-arm/arch-pxa/ssp.h b/include/asm-arm/arch-pxa/ssp.h index 6ec67b018c09..949878c0d908 100644 --- a/include/asm-arm/arch-pxa/ssp.h +++ b/include/asm-arm/arch-pxa/ssp.h | |||
@@ -18,6 +18,11 @@ | |||
18 | #ifndef SSP_H | 18 | #ifndef SSP_H |
19 | #define SSP_H | 19 | #define SSP_H |
20 | 20 | ||
21 | /* | ||
22 | * SSP initialisation flags | ||
23 | */ | ||
24 | #define SSP_NO_IRQ 0x1 /* don't register an irq handler in SSP driver */ | ||
25 | |||
21 | struct ssp_state { | 26 | struct ssp_state { |
22 | u32 cr0; | 27 | u32 cr0; |
23 | u32 cr1; | 28 | u32 cr1; |
@@ -31,6 +36,7 @@ struct ssp_dev { | |||
31 | u32 flags; | 36 | u32 flags; |
32 | u32 psp_flags; | 37 | u32 psp_flags; |
33 | u32 speed; | 38 | u32 speed; |
39 | int irq; | ||
34 | }; | 40 | }; |
35 | 41 | ||
36 | int ssp_write_word(struct ssp_dev *dev, u32 data); | 42 | int ssp_write_word(struct ssp_dev *dev, u32 data); |
@@ -40,7 +46,7 @@ void ssp_enable(struct ssp_dev *dev); | |||
40 | void ssp_disable(struct ssp_dev *dev); | 46 | void ssp_disable(struct ssp_dev *dev); |
41 | void ssp_save_state(struct ssp_dev *dev, struct ssp_state *ssp); | 47 | void ssp_save_state(struct ssp_dev *dev, struct ssp_state *ssp); |
42 | void ssp_restore_state(struct ssp_dev *dev, struct ssp_state *ssp); | 48 | void ssp_restore_state(struct ssp_dev *dev, struct ssp_state *ssp); |
43 | int ssp_init(struct ssp_dev *dev, u32 port); | 49 | int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags); |
44 | int ssp_config(struct ssp_dev *dev, u32 mode, u32 flags, u32 psp_flags, u32 speed); | 50 | int ssp_config(struct ssp_dev *dev, u32 mode, u32 flags, u32 psp_flags, u32 speed); |
45 | void ssp_exit(struct ssp_dev *dev); | 51 | void ssp_exit(struct ssp_dev *dev); |
46 | 52 | ||
diff --git a/include/asm-i386/ide.h b/include/asm-i386/ide.h index 79dfab87135d..454440193eac 100644 --- a/include/asm-i386/ide.h +++ b/include/asm-i386/ide.h | |||
@@ -41,6 +41,12 @@ static __inline__ int ide_default_irq(unsigned long base) | |||
41 | 41 | ||
42 | static __inline__ unsigned long ide_default_io_base(int index) | 42 | static __inline__ unsigned long ide_default_io_base(int index) |
43 | { | 43 | { |
44 | /* | ||
45 | * If PCI is present then it is not safe to poke around | ||
46 | * the other legacy IDE ports. Only 0x1f0 and 0x170 are | ||
47 | * defined compatibility mode ports for PCI. A user can | ||
48 | * override this using ide= but we must default safe. | ||
49 | */ | ||
44 | if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) { | 50 | if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) { |
45 | switch(index) { | 51 | switch(index) { |
46 | case 2: return 0x1e8; | 52 | case 2: return 0x1e8; |
diff --git a/include/asm-ppc64/abs_addr.h b/include/asm-powerpc/abs_addr.h index dc3fc3fefef2..18415108fc56 100644 --- a/include/asm-ppc64/abs_addr.h +++ b/include/asm-powerpc/abs_addr.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _ABS_ADDR_H | 1 | #ifndef _ASM_POWERPC_ABS_ADDR_H |
2 | #define _ABS_ADDR_H | 2 | #define _ASM_POWERPC_ABS_ADDR_H |
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
@@ -70,4 +70,4 @@ static inline unsigned long phys_to_abs(unsigned long pa) | |||
70 | #define iseries_hv_addr(virtaddr) \ | 70 | #define iseries_hv_addr(virtaddr) \ |
71 | (0x8000000000000000 | virt_to_abs(virtaddr)) | 71 | (0x8000000000000000 | virt_to_abs(virtaddr)) |
72 | 72 | ||
73 | #endif /* _ABS_ADDR_H */ | 73 | #endif /* _ASM_POWERPC_ABS_ADDR_H */ |
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h new file mode 100644 index 000000000000..8b133efc9f79 --- /dev/null +++ b/include/asm-powerpc/asm-compat.h | |||
@@ -0,0 +1,55 @@ | |||
1 | #ifndef _ASM_POWERPC_ASM_COMPAT_H | ||
2 | #define _ASM_POWERPC_ASM_COMPAT_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <asm/types.h> | ||
6 | |||
7 | #ifdef __ASSEMBLY__ | ||
8 | # define stringify_in_c(...) __VA_ARGS__ | ||
9 | # define ASM_CONST(x) x | ||
10 | #else | ||
11 | /* This version of stringify will deal with commas... */ | ||
12 | # define __stringify_in_c(...) #__VA_ARGS__ | ||
13 | # define stringify_in_c(...) __stringify_in_c(__VA_ARGS__) " " | ||
14 | # define __ASM_CONST(x) x##UL | ||
15 | # define ASM_CONST(x) __ASM_CONST(x) | ||
16 | #endif | ||
17 | |||
18 | #ifdef __powerpc64__ | ||
19 | |||
20 | /* operations for longs and pointers */ | ||
21 | #define PPC_LL stringify_in_c(ld) | ||
22 | #define PPC_STL stringify_in_c(std) | ||
23 | #define PPC_LCMPI stringify_in_c(cmpdi) | ||
24 | #define PPC_LONG stringify_in_c(.llong) | ||
25 | #define PPC_TLNEI stringify_in_c(tdnei) | ||
26 | #define PPC_LLARX stringify_in_c(ldarx) | ||
27 | #define PPC_STLCX stringify_in_c(stdcx.) | ||
28 | #define PPC_CNTLZL stringify_in_c(cntlzd) | ||
29 | |||
30 | #else /* 32-bit */ | ||
31 | |||
32 | /* operations for longs and pointers */ | ||
33 | #define PPC_LL stringify_in_c(lwz) | ||
34 | #define PPC_STL stringify_in_c(stw) | ||
35 | #define PPC_LCMPI stringify_in_c(cmpwi) | ||
36 | #define PPC_LONG stringify_in_c(.long) | ||
37 | #define PPC_TLNEI stringify_in_c(twnei) | ||
38 | #define PPC_LLARX stringify_in_c(lwarx) | ||
39 | #define PPC_STLCX stringify_in_c(stwcx.) | ||
40 | #define PPC_CNTLZL stringify_in_c(cntlzw) | ||
41 | |||
42 | #endif | ||
43 | |||
44 | #ifdef CONFIG_IBM405_ERR77 | ||
45 | /* Erratum #77 on the 405 means we need a sync or dcbt before every | ||
46 | * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this. | ||
47 | */ | ||
48 | #define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;) | ||
49 | #define PPC405_ERR77_SYNC stringify_in_c(sync;) | ||
50 | #else | ||
51 | #define PPC405_ERR77(ra,rb) | ||
52 | #define PPC405_ERR77_SYNC | ||
53 | #endif | ||
54 | |||
55 | #endif /* _ASM_POWERPC_ASM_COMPAT_H */ | ||
diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h index ed4b345ed75d..9c0b372a46e1 100644 --- a/include/asm-powerpc/atomic.h +++ b/include/asm-powerpc/atomic.h | |||
@@ -9,21 +9,13 @@ typedef struct { volatile int counter; } atomic_t; | |||
9 | 9 | ||
10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
11 | #include <asm/synch.h> | 11 | #include <asm/synch.h> |
12 | #include <asm/asm-compat.h> | ||
12 | 13 | ||
13 | #define ATOMIC_INIT(i) { (i) } | 14 | #define ATOMIC_INIT(i) { (i) } |
14 | 15 | ||
15 | #define atomic_read(v) ((v)->counter) | 16 | #define atomic_read(v) ((v)->counter) |
16 | #define atomic_set(v,i) (((v)->counter) = (i)) | 17 | #define atomic_set(v,i) (((v)->counter) = (i)) |
17 | 18 | ||
18 | /* Erratum #77 on the 405 means we need a sync or dcbt before every stwcx. | ||
19 | * The old ATOMIC_SYNC_FIX covered some but not all of this. | ||
20 | */ | ||
21 | #ifdef CONFIG_IBM405_ERR77 | ||
22 | #define PPC405_ERR77(ra,rb) "dcbt " #ra "," #rb ";" | ||
23 | #else | ||
24 | #define PPC405_ERR77(ra,rb) | ||
25 | #endif | ||
26 | |||
27 | static __inline__ void atomic_add(int a, atomic_t *v) | 19 | static __inline__ void atomic_add(int a, atomic_t *v) |
28 | { | 20 | { |
29 | int t; | 21 | int t; |
@@ -205,5 +197,183 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) | |||
205 | #define smp_mb__before_atomic_inc() smp_mb() | 197 | #define smp_mb__before_atomic_inc() smp_mb() |
206 | #define smp_mb__after_atomic_inc() smp_mb() | 198 | #define smp_mb__after_atomic_inc() smp_mb() |
207 | 199 | ||
200 | #ifdef __powerpc64__ | ||
201 | |||
202 | typedef struct { volatile long counter; } atomic64_t; | ||
203 | |||
204 | #define ATOMIC64_INIT(i) { (i) } | ||
205 | |||
206 | #define atomic64_read(v) ((v)->counter) | ||
207 | #define atomic64_set(v,i) (((v)->counter) = (i)) | ||
208 | |||
209 | static __inline__ void atomic64_add(long a, atomic64_t *v) | ||
210 | { | ||
211 | long t; | ||
212 | |||
213 | __asm__ __volatile__( | ||
214 | "1: ldarx %0,0,%3 # atomic64_add\n\ | ||
215 | add %0,%2,%0\n\ | ||
216 | stdcx. %0,0,%3 \n\ | ||
217 | bne- 1b" | ||
218 | : "=&r" (t), "=m" (v->counter) | ||
219 | : "r" (a), "r" (&v->counter), "m" (v->counter) | ||
220 | : "cc"); | ||
221 | } | ||
222 | |||
223 | static __inline__ long atomic64_add_return(long a, atomic64_t *v) | ||
224 | { | ||
225 | long t; | ||
226 | |||
227 | __asm__ __volatile__( | ||
228 | EIEIO_ON_SMP | ||
229 | "1: ldarx %0,0,%2 # atomic64_add_return\n\ | ||
230 | add %0,%1,%0\n\ | ||
231 | stdcx. %0,0,%2 \n\ | ||
232 | bne- 1b" | ||
233 | ISYNC_ON_SMP | ||
234 | : "=&r" (t) | ||
235 | : "r" (a), "r" (&v->counter) | ||
236 | : "cc", "memory"); | ||
237 | |||
238 | return t; | ||
239 | } | ||
240 | |||
241 | #define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0) | ||
242 | |||
243 | static __inline__ void atomic64_sub(long a, atomic64_t *v) | ||
244 | { | ||
245 | long t; | ||
246 | |||
247 | __asm__ __volatile__( | ||
248 | "1: ldarx %0,0,%3 # atomic64_sub\n\ | ||
249 | subf %0,%2,%0\n\ | ||
250 | stdcx. %0,0,%3 \n\ | ||
251 | bne- 1b" | ||
252 | : "=&r" (t), "=m" (v->counter) | ||
253 | : "r" (a), "r" (&v->counter), "m" (v->counter) | ||
254 | : "cc"); | ||
255 | } | ||
256 | |||
257 | static __inline__ long atomic64_sub_return(long a, atomic64_t *v) | ||
258 | { | ||
259 | long t; | ||
260 | |||
261 | __asm__ __volatile__( | ||
262 | EIEIO_ON_SMP | ||
263 | "1: ldarx %0,0,%2 # atomic64_sub_return\n\ | ||
264 | subf %0,%1,%0\n\ | ||
265 | stdcx. %0,0,%2 \n\ | ||
266 | bne- 1b" | ||
267 | ISYNC_ON_SMP | ||
268 | : "=&r" (t) | ||
269 | : "r" (a), "r" (&v->counter) | ||
270 | : "cc", "memory"); | ||
271 | |||
272 | return t; | ||
273 | } | ||
274 | |||
275 | static __inline__ void atomic64_inc(atomic64_t *v) | ||
276 | { | ||
277 | long t; | ||
278 | |||
279 | __asm__ __volatile__( | ||
280 | "1: ldarx %0,0,%2 # atomic64_inc\n\ | ||
281 | addic %0,%0,1\n\ | ||
282 | stdcx. %0,0,%2 \n\ | ||
283 | bne- 1b" | ||
284 | : "=&r" (t), "=m" (v->counter) | ||
285 | : "r" (&v->counter), "m" (v->counter) | ||
286 | : "cc"); | ||
287 | } | ||
288 | |||
289 | static __inline__ long atomic64_inc_return(atomic64_t *v) | ||
290 | { | ||
291 | long t; | ||
292 | |||
293 | __asm__ __volatile__( | ||
294 | EIEIO_ON_SMP | ||
295 | "1: ldarx %0,0,%1 # atomic64_inc_return\n\ | ||
296 | addic %0,%0,1\n\ | ||
297 | stdcx. %0,0,%1 \n\ | ||
298 | bne- 1b" | ||
299 | ISYNC_ON_SMP | ||
300 | : "=&r" (t) | ||
301 | : "r" (&v->counter) | ||
302 | : "cc", "memory"); | ||
303 | |||
304 | return t; | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * atomic64_inc_and_test - increment and test | ||
309 | * @v: pointer of type atomic64_t | ||
310 | * | ||
311 | * Atomically increments @v by 1 | ||
312 | * and returns true if the result is zero, or false for all | ||
313 | * other cases. | ||
314 | */ | ||
315 | #define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0) | ||
316 | |||
317 | static __inline__ void atomic64_dec(atomic64_t *v) | ||
318 | { | ||
319 | long t; | ||
320 | |||
321 | __asm__ __volatile__( | ||
322 | "1: ldarx %0,0,%2 # atomic64_dec\n\ | ||
323 | addic %0,%0,-1\n\ | ||
324 | stdcx. %0,0,%2\n\ | ||
325 | bne- 1b" | ||
326 | : "=&r" (t), "=m" (v->counter) | ||
327 | : "r" (&v->counter), "m" (v->counter) | ||
328 | : "cc"); | ||
329 | } | ||
330 | |||
331 | static __inline__ long atomic64_dec_return(atomic64_t *v) | ||
332 | { | ||
333 | long t; | ||
334 | |||
335 | __asm__ __volatile__( | ||
336 | EIEIO_ON_SMP | ||
337 | "1: ldarx %0,0,%1 # atomic64_dec_return\n\ | ||
338 | addic %0,%0,-1\n\ | ||
339 | stdcx. %0,0,%1\n\ | ||
340 | bne- 1b" | ||
341 | ISYNC_ON_SMP | ||
342 | : "=&r" (t) | ||
343 | : "r" (&v->counter) | ||
344 | : "cc", "memory"); | ||
345 | |||
346 | return t; | ||
347 | } | ||
348 | |||
349 | #define atomic64_sub_and_test(a, v) (atomic64_sub_return((a), (v)) == 0) | ||
350 | #define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) | ||
351 | |||
352 | /* | ||
353 | * Atomically test *v and decrement if it is greater than 0. | ||
354 | * The function returns the old value of *v minus 1. | ||
355 | */ | ||
356 | static __inline__ long atomic64_dec_if_positive(atomic64_t *v) | ||
357 | { | ||
358 | long t; | ||
359 | |||
360 | __asm__ __volatile__( | ||
361 | EIEIO_ON_SMP | ||
362 | "1: ldarx %0,0,%1 # atomic64_dec_if_positive\n\ | ||
363 | addic. %0,%0,-1\n\ | ||
364 | blt- 2f\n\ | ||
365 | stdcx. %0,0,%1\n\ | ||
366 | bne- 1b" | ||
367 | ISYNC_ON_SMP | ||
368 | "\n\ | ||
369 | 2:" : "=&r" (t) | ||
370 | : "r" (&v->counter) | ||
371 | : "cc", "memory"); | ||
372 | |||
373 | return t; | ||
374 | } | ||
375 | |||
376 | #endif /* __powerpc64__ */ | ||
377 | |||
208 | #endif /* __KERNEL__ */ | 378 | #endif /* __KERNEL__ */ |
209 | #endif /* _ASM_POWERPC_ATOMIC_H_ */ | 379 | #endif /* _ASM_POWERPC_ATOMIC_H_ */ |
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h index dc25c53704d5..5727229b0444 100644 --- a/include/asm-powerpc/bitops.h +++ b/include/asm-powerpc/bitops.h | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #include <linux/compiler.h> | 41 | #include <linux/compiler.h> |
42 | #include <asm/atomic.h> | 42 | #include <asm/atomic.h> |
43 | #include <asm/asm-compat.h> | ||
43 | #include <asm/synch.h> | 44 | #include <asm/synch.h> |
44 | 45 | ||
45 | /* | 46 | /* |
@@ -52,16 +53,6 @@ | |||
52 | #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) | 53 | #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) |
53 | #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) | 54 | #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) |
54 | 55 | ||
55 | #ifdef CONFIG_PPC64 | ||
56 | #define LARXL "ldarx" | ||
57 | #define STCXL "stdcx." | ||
58 | #define CNTLZL "cntlzd" | ||
59 | #else | ||
60 | #define LARXL "lwarx" | ||
61 | #define STCXL "stwcx." | ||
62 | #define CNTLZL "cntlzw" | ||
63 | #endif | ||
64 | |||
65 | static __inline__ void set_bit(int nr, volatile unsigned long *addr) | 56 | static __inline__ void set_bit(int nr, volatile unsigned long *addr) |
66 | { | 57 | { |
67 | unsigned long old; | 58 | unsigned long old; |
@@ -69,10 +60,10 @@ static __inline__ void set_bit(int nr, volatile unsigned long *addr) | |||
69 | unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); | 60 | unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); |
70 | 61 | ||
71 | __asm__ __volatile__( | 62 | __asm__ __volatile__( |
72 | "1:" LARXL " %0,0,%3 # set_bit\n" | 63 | "1:" PPC_LLARX "%0,0,%3 # set_bit\n" |
73 | "or %0,%0,%2\n" | 64 | "or %0,%0,%2\n" |
74 | PPC405_ERR77(0,%3) | 65 | PPC405_ERR77(0,%3) |
75 | STCXL " %0,0,%3\n" | 66 | PPC_STLCX "%0,0,%3\n" |
76 | "bne- 1b" | 67 | "bne- 1b" |
77 | : "=&r"(old), "=m"(*p) | 68 | : "=&r"(old), "=m"(*p) |
78 | : "r"(mask), "r"(p), "m"(*p) | 69 | : "r"(mask), "r"(p), "m"(*p) |
@@ -86,10 +77,10 @@ static __inline__ void clear_bit(int nr, volatile unsigned long *addr) | |||
86 | unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); | 77 | unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); |
87 | 78 | ||
88 | __asm__ __volatile__( | 79 | __asm__ __volatile__( |
89 | "1:" LARXL " %0,0,%3 # set_bit\n" | 80 | "1:" PPC_LLARX "%0,0,%3 # clear_bit\n" |
90 | "andc %0,%0,%2\n" | 81 | "andc %0,%0,%2\n" |
91 | PPC405_ERR77(0,%3) | 82 | PPC405_ERR77(0,%3) |
92 | STCXL " %0,0,%3\n" | 83 | PPC_STLCX "%0,0,%3\n" |
93 | "bne- 1b" | 84 | "bne- 1b" |
94 | : "=&r"(old), "=m"(*p) | 85 | : "=&r"(old), "=m"(*p) |
95 | : "r"(mask), "r"(p), "m"(*p) | 86 | : "r"(mask), "r"(p), "m"(*p) |
@@ -103,10 +94,10 @@ static __inline__ void change_bit(int nr, volatile unsigned long *addr) | |||
103 | unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); | 94 | unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); |
104 | 95 | ||
105 | __asm__ __volatile__( | 96 | __asm__ __volatile__( |
106 | "1:" LARXL " %0,0,%3 # set_bit\n" | 97 | "1:" PPC_LLARX "%0,0,%3 # change_bit\n" |
107 | "xor %0,%0,%2\n" | 98 | "xor %0,%0,%2\n" |
108 | PPC405_ERR77(0,%3) | 99 | PPC405_ERR77(0,%3) |
109 | STCXL " %0,0,%3\n" | 100 | PPC_STLCX "%0,0,%3\n" |
110 | "bne- 1b" | 101 | "bne- 1b" |
111 | : "=&r"(old), "=m"(*p) | 102 | : "=&r"(old), "=m"(*p) |
112 | : "r"(mask), "r"(p), "m"(*p) | 103 | : "r"(mask), "r"(p), "m"(*p) |
@@ -122,10 +113,10 @@ static __inline__ int test_and_set_bit(unsigned long nr, | |||
122 | 113 | ||
123 | __asm__ __volatile__( | 114 | __asm__ __volatile__( |
124 | EIEIO_ON_SMP | 115 | EIEIO_ON_SMP |
125 | "1:" LARXL " %0,0,%3 # test_and_set_bit\n" | 116 | "1:" PPC_LLARX "%0,0,%3 # test_and_set_bit\n" |
126 | "or %1,%0,%2 \n" | 117 | "or %1,%0,%2 \n" |
127 | PPC405_ERR77(0,%3) | 118 | PPC405_ERR77(0,%3) |
128 | STCXL " %1,0,%3 \n" | 119 | PPC_STLCX "%1,0,%3 \n" |
129 | "bne- 1b" | 120 | "bne- 1b" |
130 | ISYNC_ON_SMP | 121 | ISYNC_ON_SMP |
131 | : "=&r" (old), "=&r" (t) | 122 | : "=&r" (old), "=&r" (t) |
@@ -144,10 +135,10 @@ static __inline__ int test_and_clear_bit(unsigned long nr, | |||
144 | 135 | ||
145 | __asm__ __volatile__( | 136 | __asm__ __volatile__( |
146 | EIEIO_ON_SMP | 137 | EIEIO_ON_SMP |
147 | "1:" LARXL " %0,0,%3 # test_and_clear_bit\n" | 138 | "1:" PPC_LLARX "%0,0,%3 # test_and_clear_bit\n" |
148 | "andc %1,%0,%2 \n" | 139 | "andc %1,%0,%2 \n" |
149 | PPC405_ERR77(0,%3) | 140 | PPC405_ERR77(0,%3) |
150 | STCXL " %1,0,%3 \n" | 141 | PPC_STLCX "%1,0,%3 \n" |
151 | "bne- 1b" | 142 | "bne- 1b" |
152 | ISYNC_ON_SMP | 143 | ISYNC_ON_SMP |
153 | : "=&r" (old), "=&r" (t) | 144 | : "=&r" (old), "=&r" (t) |
@@ -166,10 +157,10 @@ static __inline__ int test_and_change_bit(unsigned long nr, | |||
166 | 157 | ||
167 | __asm__ __volatile__( | 158 | __asm__ __volatile__( |
168 | EIEIO_ON_SMP | 159 | EIEIO_ON_SMP |
169 | "1:" LARXL " %0,0,%3 # test_and_change_bit\n" | 160 | "1:" PPC_LLARX "%0,0,%3 # test_and_change_bit\n" |
170 | "xor %1,%0,%2 \n" | 161 | "xor %1,%0,%2 \n" |
171 | PPC405_ERR77(0,%3) | 162 | PPC405_ERR77(0,%3) |
172 | STCXL " %1,0,%3 \n" | 163 | PPC_STLCX "%1,0,%3 \n" |
173 | "bne- 1b" | 164 | "bne- 1b" |
174 | ISYNC_ON_SMP | 165 | ISYNC_ON_SMP |
175 | : "=&r" (old), "=&r" (t) | 166 | : "=&r" (old), "=&r" (t) |
@@ -184,9 +175,9 @@ static __inline__ void set_bits(unsigned long mask, unsigned long *addr) | |||
184 | unsigned long old; | 175 | unsigned long old; |
185 | 176 | ||
186 | __asm__ __volatile__( | 177 | __asm__ __volatile__( |
187 | "1:" LARXL " %0,0,%3 # set_bit\n" | 178 | "1:" PPC_LLARX "%0,0,%3 # set_bits\n" |
188 | "or %0,%0,%2\n" | 179 | "or %0,%0,%2\n" |
189 | STCXL " %0,0,%3\n" | 180 | PPC_STLCX "%0,0,%3\n" |
190 | "bne- 1b" | 181 | "bne- 1b" |
191 | : "=&r" (old), "=m" (*addr) | 182 | : "=&r" (old), "=m" (*addr) |
192 | : "r" (mask), "r" (addr), "m" (*addr) | 183 | : "r" (mask), "r" (addr), "m" (*addr) |
@@ -268,7 +259,7 @@ static __inline__ int __ilog2(unsigned long x) | |||
268 | { | 259 | { |
269 | int lz; | 260 | int lz; |
270 | 261 | ||
271 | asm (CNTLZL " %0,%1" : "=r" (lz) : "r" (x)); | 262 | asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x)); |
272 | return BITS_PER_LONG - 1 - lz; | 263 | return BITS_PER_LONG - 1 - lz; |
273 | } | 264 | } |
274 | 265 | ||
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h index d625ee55f957..b001ecb3cd99 100644 --- a/include/asm-powerpc/bug.h +++ b/include/asm-powerpc/bug.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _ASM_POWERPC_BUG_H | 1 | #ifndef _ASM_POWERPC_BUG_H |
2 | #define _ASM_POWERPC_BUG_H | 2 | #define _ASM_POWERPC_BUG_H |
3 | 3 | ||
4 | #include <asm/asm-compat.h> | ||
4 | /* | 5 | /* |
5 | * Define an illegal instr to trap on the bug. | 6 | * Define an illegal instr to trap on the bug. |
6 | * We don't use 0 because that marks the end of a function | 7 | * We don't use 0 because that marks the end of a function |
@@ -11,14 +12,6 @@ | |||
11 | 12 | ||
12 | #ifndef __ASSEMBLY__ | 13 | #ifndef __ASSEMBLY__ |
13 | 14 | ||
14 | #ifdef __powerpc64__ | ||
15 | #define BUG_TABLE_ENTRY ".llong" | ||
16 | #define BUG_TRAP_OP "tdnei" | ||
17 | #else | ||
18 | #define BUG_TABLE_ENTRY ".long" | ||
19 | #define BUG_TRAP_OP "twnei" | ||
20 | #endif /* __powerpc64__ */ | ||
21 | |||
22 | struct bug_entry { | 15 | struct bug_entry { |
23 | unsigned long bug_addr; | 16 | unsigned long bug_addr; |
24 | long line; | 17 | long line; |
@@ -40,16 +33,16 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
40 | __asm__ __volatile__( \ | 33 | __asm__ __volatile__( \ |
41 | "1: twi 31,0,0\n" \ | 34 | "1: twi 31,0,0\n" \ |
42 | ".section __bug_table,\"a\"\n" \ | 35 | ".section __bug_table,\"a\"\n" \ |
43 | "\t"BUG_TABLE_ENTRY" 1b,%0,%1,%2\n" \ | 36 | "\t"PPC_LONG" 1b,%0,%1,%2\n" \ |
44 | ".previous" \ | 37 | ".previous" \ |
45 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | 38 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ |
46 | } while (0) | 39 | } while (0) |
47 | 40 | ||
48 | #define BUG_ON(x) do { \ | 41 | #define BUG_ON(x) do { \ |
49 | __asm__ __volatile__( \ | 42 | __asm__ __volatile__( \ |
50 | "1: "BUG_TRAP_OP" %0,0\n" \ | 43 | "1: "PPC_TLNEI" %0,0\n" \ |
51 | ".section __bug_table,\"a\"\n" \ | 44 | ".section __bug_table,\"a\"\n" \ |
52 | "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \ | 45 | "\t"PPC_LONG" 1b,%1,%2,%3\n" \ |
53 | ".previous" \ | 46 | ".previous" \ |
54 | : : "r" ((long)(x)), "i" (__LINE__), \ | 47 | : : "r" ((long)(x)), "i" (__LINE__), \ |
55 | "i" (__FILE__), "i" (__FUNCTION__)); \ | 48 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
@@ -57,9 +50,9 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
57 | 50 | ||
58 | #define WARN_ON(x) do { \ | 51 | #define WARN_ON(x) do { \ |
59 | __asm__ __volatile__( \ | 52 | __asm__ __volatile__( \ |
60 | "1: "BUG_TRAP_OP" %0,0\n" \ | 53 | "1: "PPC_TLNEI" %0,0\n" \ |
61 | ".section __bug_table,\"a\"\n" \ | 54 | ".section __bug_table,\"a\"\n" \ |
62 | "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \ | 55 | "\t"PPC_LONG" 1b,%1,%2,%3\n" \ |
63 | ".previous" \ | 56 | ".previous" \ |
64 | : : "r" ((long)(x)), \ | 57 | : : "r" ((long)(x)), \ |
65 | "i" (__LINE__ + BUG_WARNING_TRAP), \ | 58 | "i" (__LINE__ + BUG_WARNING_TRAP), \ |
diff --git a/include/asm-powerpc/cache.h b/include/asm-powerpc/cache.h new file mode 100644 index 000000000000..26ce502e76e8 --- /dev/null +++ b/include/asm-powerpc/cache.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _ASM_POWERPC_CACHE_H | ||
2 | #define _ASM_POWERPC_CACHE_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/config.h> | ||
7 | |||
8 | /* bytes per L1 cache line */ | ||
9 | #if defined(CONFIG_8xx) || defined(CONFIG_403GCX) | ||
10 | #define L1_CACHE_SHIFT 4 | ||
11 | #define MAX_COPY_PREFETCH 1 | ||
12 | #elif defined(CONFIG_PPC32) | ||
13 | #define L1_CACHE_SHIFT 5 | ||
14 | #define MAX_COPY_PREFETCH 4 | ||
15 | #else /* CONFIG_PPC64 */ | ||
16 | #define L1_CACHE_SHIFT 7 | ||
17 | #endif | ||
18 | |||
19 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
20 | |||
21 | #define SMP_CACHE_BYTES L1_CACHE_BYTES | ||
22 | #define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ | ||
23 | |||
24 | #if defined(__powerpc64__) && !defined(__ASSEMBLY__) | ||
25 | struct ppc64_caches { | ||
26 | u32 dsize; /* L1 d-cache size */ | ||
27 | u32 dline_size; /* L1 d-cache line size */ | ||
28 | u32 log_dline_size; | ||
29 | u32 dlines_per_page; | ||
30 | u32 isize; /* L1 i-cache size */ | ||
31 | u32 iline_size; /* L1 i-cache line size */ | ||
32 | u32 log_iline_size; | ||
33 | u32 ilines_per_page; | ||
34 | }; | ||
35 | |||
36 | extern struct ppc64_caches ppc64_caches; | ||
37 | #endif /* __powerpc64__ && ! __ASSEMBLY__ */ | ||
38 | |||
39 | #endif /* __KERNEL__ */ | ||
40 | #endif /* _ASM_POWERPC_CACHE_H */ | ||
diff --git a/include/asm-ppc64/cacheflush.h b/include/asm-powerpc/cacheflush.h index ffbc08be8e52..8a740c88d93d 100644 --- a/include/asm-ppc64/cacheflush.h +++ b/include/asm-powerpc/cacheflush.h | |||
@@ -1,13 +1,20 @@ | |||
1 | #ifndef _PPC64_CACHEFLUSH_H | 1 | /* |
2 | #define _PPC64_CACHEFLUSH_H | 2 | * This program is free software; you can redistribute it and/or |
3 | * modify it under the terms of the GNU General Public License | ||
4 | * as published by the Free Software Foundation; either version | ||
5 | * 2 of the License, or (at your option) any later version. | ||
6 | */ | ||
7 | #ifndef _ASM_POWERPC_CACHEFLUSH_H | ||
8 | #define _ASM_POWERPC_CACHEFLUSH_H | ||
9 | |||
10 | #ifdef __KERNEL__ | ||
3 | 11 | ||
4 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
5 | #include <asm/cputable.h> | 13 | #include <asm/cputable.h> |
6 | 14 | ||
7 | /* | 15 | /* |
8 | * No cache flushing is required when address mappings are | 16 | * No cache flushing is required when address mappings are changed, |
9 | * changed, because the caches on PowerPCs are physically | 17 | * because the caches on PowerPCs are physically addressed. |
10 | * addressed. | ||
11 | */ | 18 | */ |
12 | #define flush_cache_all() do { } while (0) | 19 | #define flush_cache_all() do { } while (0) |
13 | #define flush_cache_mm(mm) do { } while (0) | 20 | #define flush_cache_mm(mm) do { } while (0) |
@@ -22,27 +29,40 @@ extern void flush_dcache_page(struct page *page); | |||
22 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 29 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
23 | 30 | ||
24 | extern void __flush_icache_range(unsigned long, unsigned long); | 31 | extern void __flush_icache_range(unsigned long, unsigned long); |
32 | static inline void flush_icache_range(unsigned long start, unsigned long stop) | ||
33 | { | ||
34 | if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) | ||
35 | __flush_icache_range(start, stop); | ||
36 | } | ||
37 | |||
25 | extern void flush_icache_user_range(struct vm_area_struct *vma, | 38 | extern void flush_icache_user_range(struct vm_area_struct *vma, |
26 | struct page *page, unsigned long addr, | 39 | struct page *page, unsigned long addr, |
27 | int len); | 40 | int len); |
41 | extern void __flush_dcache_icache(void *page_va); | ||
42 | extern void flush_dcache_icache_page(struct page *page); | ||
43 | #if defined(CONFIG_PPC32) && !defined(CONFIG_BOOKE) | ||
44 | extern void __flush_dcache_icache_phys(unsigned long physaddr); | ||
45 | #endif /* CONFIG_PPC32 && !CONFIG_BOOKE */ | ||
28 | 46 | ||
29 | extern void flush_dcache_range(unsigned long start, unsigned long stop); | 47 | extern void flush_dcache_range(unsigned long start, unsigned long stop); |
30 | extern void flush_dcache_phys_range(unsigned long start, unsigned long stop); | 48 | #ifdef CONFIG_PPC32 |
49 | extern void clean_dcache_range(unsigned long start, unsigned long stop); | ||
50 | extern void invalidate_dcache_range(unsigned long start, unsigned long stop); | ||
51 | #endif /* CONFIG_PPC32 */ | ||
52 | #ifdef CONFIG_PPC64 | ||
31 | extern void flush_inval_dcache_range(unsigned long start, unsigned long stop); | 53 | extern void flush_inval_dcache_range(unsigned long start, unsigned long stop); |
54 | extern void flush_dcache_phys_range(unsigned long start, unsigned long stop); | ||
55 | #endif | ||
32 | 56 | ||
33 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | 57 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ |
34 | do { memcpy(dst, src, len); \ | 58 | do { \ |
35 | flush_icache_user_range(vma, page, vaddr, len); \ | 59 | memcpy(dst, src, len); \ |
36 | } while (0) | 60 | flush_icache_user_range(vma, page, vaddr, len); \ |
61 | } while (0) | ||
37 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | 62 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
38 | memcpy(dst, src, len) | 63 | memcpy(dst, src, len) |
39 | 64 | ||
40 | extern void __flush_dcache_icache(void *page_va); | ||
41 | 65 | ||
42 | static inline void flush_icache_range(unsigned long start, unsigned long stop) | 66 | #endif /* __KERNEL__ */ |
43 | { | ||
44 | if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) | ||
45 | __flush_icache_range(start, stop); | ||
46 | } | ||
47 | 67 | ||
48 | #endif /* _PPC64_CACHEFLUSH_H */ | 68 | #endif /* _ASM_POWERPC_CACHEFLUSH_H */ |
diff --git a/include/asm-ppc64/compat.h b/include/asm-powerpc/compat.h index 6ec62cd2d1d1..4db4360c4d4a 100644 --- a/include/asm-ppc64/compat.h +++ b/include/asm-powerpc/compat.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _ASM_PPC64_COMPAT_H | 1 | #ifndef _ASM_POWERPC_COMPAT_H |
2 | #define _ASM_PPC64_COMPAT_H | 2 | #define _ASM_POWERPC_COMPAT_H |
3 | /* | 3 | /* |
4 | * Architecture specific compatibility types | 4 | * Architecture specific compatibility types |
5 | */ | 5 | */ |
@@ -49,7 +49,7 @@ struct compat_stat { | |||
49 | compat_dev_t st_dev; | 49 | compat_dev_t st_dev; |
50 | compat_ino_t st_ino; | 50 | compat_ino_t st_ino; |
51 | compat_mode_t st_mode; | 51 | compat_mode_t st_mode; |
52 | compat_nlink_t st_nlink; | 52 | compat_nlink_t st_nlink; |
53 | __compat_uid32_t st_uid; | 53 | __compat_uid32_t st_uid; |
54 | __compat_gid32_t st_gid; | 54 | __compat_gid32_t st_gid; |
55 | compat_dev_t st_rdev; | 55 | compat_dev_t st_rdev; |
@@ -202,4 +202,4 @@ struct compat_shmid64_ds { | |||
202 | compat_ulong_t __unused6; | 202 | compat_ulong_t __unused6; |
203 | }; | 203 | }; |
204 | 204 | ||
205 | #endif /* _ASM_PPC64_COMPAT_H */ | 205 | #endif /* _ASM_POWERPC_COMPAT_H */ |
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index 79a0556a0ab8..04e2726002cf 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __ASM_POWERPC_CPUTABLE_H | 2 | #define __ASM_POWERPC_CPUTABLE_H |
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | #include <asm/ppc_asm.h> /* for ASM_CONST */ | 5 | #include <asm/asm-compat.h> |
6 | 6 | ||
7 | #define PPC_FEATURE_32 0x80000000 | 7 | #define PPC_FEATURE_32 0x80000000 |
8 | #define PPC_FEATURE_64 0x40000000 | 8 | #define PPC_FEATURE_64 0x40000000 |
@@ -16,6 +16,10 @@ | |||
16 | #define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 | 16 | #define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 |
17 | #define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 | 17 | #define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 |
18 | #define PPC_FEATURE_NO_TB 0x00100000 | 18 | #define PPC_FEATURE_NO_TB 0x00100000 |
19 | #define PPC_FEATURE_POWER4 0x00080000 | ||
20 | #define PPC_FEATURE_POWER5 0x00040000 | ||
21 | #define PPC_FEATURE_POWER5_PLUS 0x00020000 | ||
22 | #define PPC_FEATURE_CELL 0x00010000 | ||
19 | 23 | ||
20 | #ifdef __KERNEL__ | 24 | #ifdef __KERNEL__ |
21 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
diff --git a/include/asm-powerpc/current.h b/include/asm-powerpc/current.h new file mode 100644 index 000000000000..82cd4a9ca99a --- /dev/null +++ b/include/asm-powerpc/current.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _ASM_POWERPC_CURRENT_H | ||
2 | #define _ASM_POWERPC_CURRENT_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | struct task_struct; | ||
12 | |||
13 | #ifdef __powerpc64__ | ||
14 | #include <asm/paca.h> | ||
15 | |||
16 | #define current (get_paca()->__current) | ||
17 | |||
18 | #else | ||
19 | |||
20 | /* | ||
21 | * We keep `current' in r2 for speed. | ||
22 | */ | ||
23 | register struct task_struct *current asm ("r2"); | ||
24 | |||
25 | #endif | ||
26 | |||
27 | #endif /* _ASM_POWERPC_CURRENT_H */ | ||
diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h new file mode 100644 index 000000000000..d168a30b3866 --- /dev/null +++ b/include/asm-powerpc/eeh_event.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * eeh_event.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | * Copyright (c) 2005 Linas Vepstas <linas@linas.org> | ||
19 | */ | ||
20 | |||
21 | #ifndef ASM_PPC64_EEH_EVENT_H | ||
22 | #define ASM_PPC64_EEH_EVENT_H | ||
23 | |||
24 | /** EEH event -- structure holding pci controller data that describes | ||
25 | * a change in the isolation status of a PCI slot. A pointer | ||
26 | * to this struct is passed as the data pointer in a notify callback. | ||
27 | */ | ||
28 | struct eeh_event { | ||
29 | struct list_head list; | ||
30 | struct device_node *dn; /* struct device node */ | ||
31 | struct pci_dev *dev; /* affected device */ | ||
32 | int state; | ||
33 | int time_unavail; /* milliseconds until device might be available */ | ||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * eeh_send_failure_event - generate a PCI error event | ||
38 | * @dev pci device | ||
39 | * | ||
40 | * This routine builds a PCI error event which will be delivered | ||
41 | * to all listeners on the peh_notifier_chain. | ||
42 | * | ||
43 | * This routine can be called within an interrupt context; | ||
44 | * the actual event will be delivered in a normal context | ||
45 | * (from a workqueue). | ||
46 | */ | ||
47 | int eeh_send_failure_event (struct device_node *dn, | ||
48 | struct pci_dev *dev, | ||
49 | int reset_state, | ||
50 | int time_unavail); | ||
51 | |||
52 | #endif /* ASM_PPC64_EEH_EVENT_H */ | ||
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h index 806c142ae9ea..12fabbcb04f0 100644 --- a/include/asm-powerpc/firmware.h +++ b/include/asm-powerpc/firmware.h | |||
@@ -43,6 +43,7 @@ | |||
43 | #define FW_FEATURE_ISERIES (1UL<<21) | 43 | #define FW_FEATURE_ISERIES (1UL<<21) |
44 | 44 | ||
45 | enum { | 45 | enum { |
46 | #ifdef CONFIG_PPC64 | ||
46 | FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE | | 47 | FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE | |
47 | FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY | | 48 | FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY | |
48 | FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM | | 49 | FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM | |
@@ -70,6 +71,11 @@ enum { | |||
70 | FW_FEATURE_ISERIES_ALWAYS & | 71 | FW_FEATURE_ISERIES_ALWAYS & |
71 | #endif | 72 | #endif |
72 | FW_FEATURE_POSSIBLE, | 73 | FW_FEATURE_POSSIBLE, |
74 | |||
75 | #else /* CONFIG_PPC64 */ | ||
76 | FW_FEATURE_POSSIBLE = 0, | ||
77 | FW_FEATURE_ALWAYS = 0, | ||
78 | #endif | ||
73 | }; | 79 | }; |
74 | 80 | ||
75 | /* This is used to identify firmware features which are available | 81 | /* This is used to identify firmware features which are available |
diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h index 37c94e52ab6d..f0319d50b129 100644 --- a/include/asm-powerpc/futex.h +++ b/include/asm-powerpc/futex.h | |||
@@ -7,13 +7,14 @@ | |||
7 | #include <asm/errno.h> | 7 | #include <asm/errno.h> |
8 | #include <asm/synch.h> | 8 | #include <asm/synch.h> |
9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
10 | #include <asm/ppc_asm.h> | 10 | #include <asm/asm-compat.h> |
11 | 11 | ||
12 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ | 12 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ |
13 | __asm__ __volatile ( \ | 13 | __asm__ __volatile ( \ |
14 | SYNC_ON_SMP \ | 14 | SYNC_ON_SMP \ |
15 | "1: lwarx %0,0,%2\n" \ | 15 | "1: lwarx %0,0,%2\n" \ |
16 | insn \ | 16 | insn \ |
17 | PPC405_ERR77(0, %2) \ | ||
17 | "2: stwcx. %1,0,%2\n" \ | 18 | "2: stwcx. %1,0,%2\n" \ |
18 | "bne- 1b\n" \ | 19 | "bne- 1b\n" \ |
19 | "li %1,0\n" \ | 20 | "li %1,0\n" \ |
@@ -23,7 +24,7 @@ | |||
23 | ".previous\n" \ | 24 | ".previous\n" \ |
24 | ".section __ex_table,\"a\"\n" \ | 25 | ".section __ex_table,\"a\"\n" \ |
25 | ".align 3\n" \ | 26 | ".align 3\n" \ |
26 | DATAL " 1b,4b,2b,4b\n" \ | 27 | PPC_LONG "1b,4b,2b,4b\n" \ |
27 | ".previous" \ | 28 | ".previous" \ |
28 | : "=&r" (oldval), "=&r" (ret) \ | 29 | : "=&r" (oldval), "=&r" (ret) \ |
29 | : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \ | 30 | : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \ |
diff --git a/include/asm-ppc64/hvcall.h b/include/asm-powerpc/hvcall.h index ab7c3cf24888..d36da61dbc53 100644 --- a/include/asm-ppc64/hvcall.h +++ b/include/asm-powerpc/hvcall.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _PPC64_HVCALL_H | 1 | #ifndef _ASM_POWERPC_HVCALL_H |
2 | #define _PPC64_HVCALL_H | 2 | #define _ASM_POWERPC_HVCALL_H |
3 | 3 | ||
4 | #define HVSC .long 0x44000022 | 4 | #define HVSC .long 0x44000022 |
5 | 5 | ||
@@ -138,7 +138,7 @@ long plpar_hcall(unsigned long opcode, | |||
138 | */ | 138 | */ |
139 | long plpar_hcall_norets(unsigned long opcode, ...); | 139 | long plpar_hcall_norets(unsigned long opcode, ...); |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * Special hcall interface for ibmveth support. | 142 | * Special hcall interface for ibmveth support. |
143 | * Takes 8 input parms. Returns a rc and stores the | 143 | * Takes 8 input parms. Returns a rc and stores the |
144 | * R4 return value in *out1. | 144 | * R4 return value in *out1. |
@@ -153,11 +153,11 @@ long plpar_hcall_8arg_2ret(unsigned long opcode, | |||
153 | unsigned long arg7, | 153 | unsigned long arg7, |
154 | unsigned long arg8, | 154 | unsigned long arg8, |
155 | unsigned long *out1); | 155 | unsigned long *out1); |
156 | 156 | ||
157 | /* plpar_hcall_4out() | 157 | /* plpar_hcall_4out() |
158 | * | 158 | * |
159 | * same as plpar_hcall except with 4 output arguments. | 159 | * same as plpar_hcall except with 4 output arguments. |
160 | * | 160 | * |
161 | */ | 161 | */ |
162 | long plpar_hcall_4out(unsigned long opcode, | 162 | long plpar_hcall_4out(unsigned long opcode, |
163 | unsigned long arg1, | 163 | unsigned long arg1, |
@@ -170,4 +170,4 @@ long plpar_hcall_4out(unsigned long opcode, | |||
170 | unsigned long *out4); | 170 | unsigned long *out4); |
171 | 171 | ||
172 | #endif /* __ASSEMBLY__ */ | 172 | #endif /* __ASSEMBLY__ */ |
173 | #endif /* _PPC64_HVCALL_H */ | 173 | #endif /* _ASM_POWERPC_HVCALL_H */ |
diff --git a/include/asm-powerpc/hw_irq.h b/include/asm-powerpc/hw_irq.h index c37b31b96337..26b89d859c56 100644 --- a/include/asm-powerpc/hw_irq.h +++ b/include/asm-powerpc/hw_irq.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <asm/processor.h> | 12 | #include <asm/processor.h> |
13 | 13 | ||
14 | extern void timer_interrupt(struct pt_regs *); | 14 | extern void timer_interrupt(struct pt_regs *); |
15 | extern void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq); | ||
16 | 15 | ||
17 | #ifdef CONFIG_PPC_ISERIES | 16 | #ifdef CONFIG_PPC_ISERIES |
18 | 17 | ||
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h index b3935ea28fff..c9fbcede0ef9 100644 --- a/include/asm-powerpc/irq.h +++ b/include/asm-powerpc/irq.h | |||
@@ -429,7 +429,6 @@ extern u64 ppc64_interrupt_controller; | |||
429 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 429 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) |
430 | /* pedantic: these are long because they are used with set_bit --RR */ | 430 | /* pedantic: these are long because they are used with set_bit --RR */ |
431 | extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | 431 | extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; |
432 | extern unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; | ||
433 | extern atomic_t ppc_n_lost_interrupts; | 432 | extern atomic_t ppc_n_lost_interrupts; |
434 | 433 | ||
435 | #define virt_irq_create_mapping(x) (x) | 434 | #define virt_irq_create_mapping(x) (x) |
@@ -488,8 +487,8 @@ extern struct thread_info *softirq_ctx[NR_CPUS]; | |||
488 | 487 | ||
489 | extern void irq_ctx_init(void); | 488 | extern void irq_ctx_init(void); |
490 | extern void call_do_softirq(struct thread_info *tp); | 489 | extern void call_do_softirq(struct thread_info *tp); |
491 | extern int call_handle_IRQ_event(int irq, struct pt_regs *regs, | 490 | extern int call___do_IRQ(int irq, struct pt_regs *regs, |
492 | struct irqaction *action, struct thread_info *tp); | 491 | struct thread_info *tp); |
493 | 492 | ||
494 | #define __ARCH_HAS_DO_SOFTIRQ | 493 | #define __ARCH_HAS_DO_SOFTIRQ |
495 | 494 | ||
diff --git a/include/asm-ppc64/lppaca.h b/include/asm-powerpc/lppaca.h index 9e2a6c0649a0..c1bedab1515b 100644 --- a/include/asm-ppc64/lppaca.h +++ b/include/asm-powerpc/lppaca.h | |||
@@ -16,8 +16,8 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | #ifndef _ASM_LPPACA_H | 19 | #ifndef _ASM_POWERPC_LPPACA_H |
20 | #define _ASM_LPPACA_H | 20 | #define _ASM_POWERPC_LPPACA_H |
21 | 21 | ||
22 | //============================================================================= | 22 | //============================================================================= |
23 | // | 23 | // |
@@ -28,8 +28,7 @@ | |||
28 | //---------------------------------------------------------------------------- | 28 | //---------------------------------------------------------------------------- |
29 | #include <asm/types.h> | 29 | #include <asm/types.h> |
30 | 30 | ||
31 | struct lppaca | 31 | struct lppaca { |
32 | { | ||
33 | //============================================================================= | 32 | //============================================================================= |
34 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data | 33 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data |
35 | // NOTE: The xDynXyz fields are fields that will be dynamically changed by | 34 | // NOTE: The xDynXyz fields are fields that will be dynamically changed by |
@@ -129,4 +128,4 @@ struct lppaca | |||
129 | u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF | 128 | u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF |
130 | }; | 129 | }; |
131 | 130 | ||
132 | #endif /* _ASM_LPPACA_H */ | 131 | #endif /* _ASM_POWERPC_LPPACA_H */ |
diff --git a/include/asm-ppc64/paca.h b/include/asm-powerpc/paca.h index bccacd6aa93a..92c765c35bd0 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-powerpc/paca.h | |||
@@ -1,11 +1,8 @@ | |||
1 | #ifndef _PPC64_PACA_H | ||
2 | #define _PPC64_PACA_H | ||
3 | |||
4 | /* | 1 | /* |
5 | * include/asm-ppc64/paca.h | 2 | * include/asm-powerpc/paca.h |
6 | * | 3 | * |
7 | * This control block defines the PACA which defines the processor | 4 | * This control block defines the PACA which defines the processor |
8 | * specific data for each logical processor on the system. | 5 | * specific data for each logical processor on the system. |
9 | * There are some pointers defined that are utilized by PLIC. | 6 | * There are some pointers defined that are utilized by PLIC. |
10 | * | 7 | * |
11 | * C 2001 PPC 64 Team, IBM Corp | 8 | * C 2001 PPC 64 Team, IBM Corp |
@@ -14,7 +11,9 @@ | |||
14 | * modify it under the terms of the GNU General Public License | 11 | * modify it under the terms of the GNU General Public License |
15 | * as published by the Free Software Foundation; either version | 12 | * as published by the Free Software Foundation; either version |
16 | * 2 of the License, or (at your option) any later version. | 13 | * 2 of the License, or (at your option) any later version. |
17 | */ | 14 | */ |
15 | #ifndef _ASM_POWERPC_PACA_H | ||
16 | #define _ASM_POWERPC_PACA_H | ||
18 | 17 | ||
19 | #include <linux/config.h> | 18 | #include <linux/config.h> |
20 | #include <asm/types.h> | 19 | #include <asm/types.h> |
@@ -118,4 +117,4 @@ struct paca_struct { | |||
118 | 117 | ||
119 | extern struct paca_struct paca[]; | 118 | extern struct paca_struct paca[]; |
120 | 119 | ||
121 | #endif /* _PPC64_PACA_H */ | 120 | #endif /* _ASM_POWERPC_PACA_H */ |
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index 13aacff755f3..9896fade98a7 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h | |||
@@ -26,6 +26,10 @@ extern unsigned long find_and_init_phbs(void); | |||
26 | 26 | ||
27 | extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */ | 27 | extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */ |
28 | 28 | ||
29 | /** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */ | ||
30 | #define BUID_HI(buid) ((buid) >> 32) | ||
31 | #define BUID_LO(buid) ((buid) & 0xffffffff) | ||
32 | |||
29 | /* PCI device_node operations */ | 33 | /* PCI device_node operations */ |
30 | struct device_node; | 34 | struct device_node; |
31 | typedef void *(*traverse_func)(struct device_node *me, void *data); | 35 | typedef void *(*traverse_func)(struct device_node *me, void *data); |
@@ -36,10 +40,6 @@ void pci_devs_phb_init(void); | |||
36 | void pci_devs_phb_init_dynamic(struct pci_controller *phb); | 40 | void pci_devs_phb_init_dynamic(struct pci_controller *phb); |
37 | void __devinit scan_phb(struct pci_controller *hose); | 41 | void __devinit scan_phb(struct pci_controller *hose); |
38 | 42 | ||
39 | /* PCI address cache management routines */ | ||
40 | void pci_addr_cache_insert_device(struct pci_dev *dev); | ||
41 | void pci_addr_cache_remove_device(struct pci_dev *dev); | ||
42 | |||
43 | /* From rtas_pci.h */ | 43 | /* From rtas_pci.h */ |
44 | void init_pci_config_tokens (void); | 44 | void init_pci_config_tokens (void); |
45 | unsigned long get_phb_buid (struct device_node *); | 45 | unsigned long get_phb_buid (struct device_node *); |
@@ -52,4 +52,48 @@ extern unsigned long pci_probe_only; | |||
52 | extern unsigned long pci_assign_all_buses; | 52 | extern unsigned long pci_assign_all_buses; |
53 | extern int pci_read_irq_line(struct pci_dev *pci_dev); | 53 | extern int pci_read_irq_line(struct pci_dev *pci_dev); |
54 | 54 | ||
55 | /* ---- EEH internal-use-only related routines ---- */ | ||
56 | #ifdef CONFIG_EEH | ||
57 | /** | ||
58 | * rtas_set_slot_reset -- unfreeze a frozen slot | ||
59 | * | ||
60 | * Clear the EEH-frozen condition on a slot. This routine | ||
61 | * does this by asserting the PCI #RST line for 1/8th of | ||
62 | * a second; this routine will sleep while the adapter is | ||
63 | * being reset. | ||
64 | */ | ||
65 | void rtas_set_slot_reset (struct pci_dn *); | ||
66 | |||
67 | /** | ||
68 | * eeh_restore_bars - Restore device configuration info. | ||
69 | * | ||
70 | * A reset of a PCI device will clear out its config space. | ||
71 | * This routines will restore the config space for this | ||
72 | * device, and is children, to values previously obtained | ||
73 | * from the firmware. | ||
74 | */ | ||
75 | void eeh_restore_bars(struct pci_dn *); | ||
76 | |||
77 | /** | ||
78 | * rtas_configure_bridge -- firmware initialization of pci bridge | ||
79 | * | ||
80 | * Ask the firmware to configure all PCI bridges devices | ||
81 | * located behind the indicated node. Required after a | ||
82 | * pci device reset. Does essentially the same hing as | ||
83 | * eeh_restore_bars, but for brdges, and lets firmware | ||
84 | * do the work. | ||
85 | */ | ||
86 | void rtas_configure_bridge(struct pci_dn *); | ||
87 | |||
88 | int rtas_write_config(struct pci_dn *, int where, int size, u32 val); | ||
89 | |||
90 | /** | ||
91 | * mark and clear slots: find "partition endpoint" PE and set or | ||
92 | * clear the flags for each subnode of the PE. | ||
93 | */ | ||
94 | void eeh_mark_slot (struct device_node *dn, int mode_flag); | ||
95 | void eeh_clear_slot (struct device_node *dn, int mode_flag); | ||
96 | |||
97 | #endif | ||
98 | |||
55 | #endif /* _ASM_POWERPC_PPC_PCI_H */ | 99 | #endif /* _ASM_POWERPC_PPC_PCI_H */ |
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h index c534ca41224b..c27baa0563fe 100644 --- a/include/asm-powerpc/ppc_asm.h +++ b/include/asm-powerpc/ppc_asm.h | |||
@@ -6,8 +6,13 @@ | |||
6 | 6 | ||
7 | #include <linux/stringify.h> | 7 | #include <linux/stringify.h> |
8 | #include <linux/config.h> | 8 | #include <linux/config.h> |
9 | #include <asm/asm-compat.h> | ||
9 | 10 | ||
10 | #ifdef __ASSEMBLY__ | 11 | #ifndef __ASSEMBLY__ |
12 | #error __FILE__ should only be used in assembler files | ||
13 | #else | ||
14 | |||
15 | #define SZL (BITS_PER_LONG/8) | ||
11 | 16 | ||
12 | /* | 17 | /* |
13 | * Macros for storing registers into and loading registers from | 18 | * Macros for storing registers into and loading registers from |
@@ -184,12 +189,6 @@ n: | |||
184 | oris reg,reg,(label)@h; \ | 189 | oris reg,reg,(label)@h; \ |
185 | ori reg,reg,(label)@l; | 190 | ori reg,reg,(label)@l; |
186 | 191 | ||
187 | /* operations for longs and pointers */ | ||
188 | #define LDL ld | ||
189 | #define STL std | ||
190 | #define CMPI cmpdi | ||
191 | #define SZL 8 | ||
192 | |||
193 | /* offsets for stack frame layout */ | 192 | /* offsets for stack frame layout */ |
194 | #define LRSAVE 16 | 193 | #define LRSAVE 16 |
195 | 194 | ||
@@ -203,12 +202,6 @@ n: | |||
203 | 202 | ||
204 | #define OFF(name) name@l | 203 | #define OFF(name) name@l |
205 | 204 | ||
206 | /* operations for longs and pointers */ | ||
207 | #define LDL lwz | ||
208 | #define STL stw | ||
209 | #define CMPI cmpwi | ||
210 | #define SZL 4 | ||
211 | |||
212 | /* offsets for stack frame layout */ | 205 | /* offsets for stack frame layout */ |
213 | #define LRSAVE 4 | 206 | #define LRSAVE 4 |
214 | 207 | ||
@@ -266,15 +259,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
266 | #endif | 259 | #endif |
267 | 260 | ||
268 | 261 | ||
269 | #ifdef CONFIG_IBM405_ERR77 | ||
270 | #define PPC405_ERR77(ra,rb) dcbt ra, rb; | ||
271 | #define PPC405_ERR77_SYNC sync; | ||
272 | #else | ||
273 | #define PPC405_ERR77(ra,rb) | ||
274 | #define PPC405_ERR77_SYNC | ||
275 | #endif | ||
276 | |||
277 | |||
278 | #ifdef CONFIG_IBM440EP_ERR42 | 262 | #ifdef CONFIG_IBM440EP_ERR42 |
279 | #define PPC440EP_ERR42 isync | 263 | #define PPC440EP_ERR42 isync |
280 | #else | 264 | #else |
@@ -502,17 +486,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
502 | #define N_SLINE 68 | 486 | #define N_SLINE 68 |
503 | #define N_SO 100 | 487 | #define N_SO 100 |
504 | 488 | ||
505 | #define ASM_CONST(x) x | ||
506 | #else | ||
507 | #define __ASM_CONST(x) x##UL | ||
508 | #define ASM_CONST(x) __ASM_CONST(x) | ||
509 | |||
510 | #ifdef CONFIG_PPC64 | ||
511 | #define DATAL ".llong" | ||
512 | #else | ||
513 | #define DATAL ".long" | ||
514 | #endif | ||
515 | |||
516 | #endif /* __ASSEMBLY__ */ | 489 | #endif /* __ASSEMBLY__ */ |
517 | 490 | ||
518 | #endif /* _ASM_POWERPC_PPC_ASM_H */ | 491 | #endif /* _ASM_POWERPC_PPC_ASM_H */ |
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h index 1dc4bf7b52b3..f6f186b56b0f 100644 --- a/include/asm-powerpc/processor.h +++ b/include/asm-powerpc/processor.h | |||
@@ -17,65 +17,71 @@ | |||
17 | #include <linux/compiler.h> | 17 | #include <linux/compiler.h> |
18 | #include <asm/ptrace.h> | 18 | #include <asm/ptrace.h> |
19 | #include <asm/types.h> | 19 | #include <asm/types.h> |
20 | #ifdef CONFIG_PPC64 | ||
21 | #include <asm/systemcfg.h> | ||
22 | #endif | ||
23 | 20 | ||
24 | #ifdef CONFIG_PPC32 | 21 | /* We do _not_ want to define new machine types at all, those must die |
25 | /* 32-bit platform types */ | 22 | * in favor of using the device-tree |
26 | /* We only need to define a new _MACH_xxx for machines which are part of | 23 | * -- BenH. |
27 | * a configuration which supports more than one type of different machine. | ||
28 | * This is currently limited to CONFIG_PPC_MULTIPLATFORM and CHRP/PReP/PMac. | ||
29 | * -- Tom | ||
30 | */ | 24 | */ |
31 | #define _MACH_prep 0x00000001 | ||
32 | #define _MACH_Pmac 0x00000002 /* pmac or pmac clone (non-chrp) */ | ||
33 | #define _MACH_chrp 0x00000004 /* chrp machine */ | ||
34 | 25 | ||
35 | /* see residual.h for these */ | 26 | /* Platforms codes (to be obsoleted) */ |
27 | #define PLATFORM_PSERIES 0x0100 | ||
28 | #define PLATFORM_PSERIES_LPAR 0x0101 | ||
29 | #define PLATFORM_ISERIES_LPAR 0x0201 | ||
30 | #define PLATFORM_LPAR 0x0001 | ||
31 | #define PLATFORM_POWERMAC 0x0400 | ||
32 | #define PLATFORM_MAPLE 0x0500 | ||
33 | #define PLATFORM_PREP 0x0600 | ||
34 | #define PLATFORM_CHRP 0x0700 | ||
35 | #define PLATFORM_CELL 0x1000 | ||
36 | |||
37 | /* Compat platform codes for 32 bits */ | ||
38 | #define _MACH_prep PLATFORM_PREP | ||
39 | #define _MACH_Pmac PLATFORM_POWERMAC | ||
40 | #define _MACH_chrp PLATFORM_CHRP | ||
41 | |||
42 | /* PREP sub-platform types see residual.h for these */ | ||
36 | #define _PREP_Motorola 0x01 /* motorola prep */ | 43 | #define _PREP_Motorola 0x01 /* motorola prep */ |
37 | #define _PREP_Firm 0x02 /* firmworks prep */ | 44 | #define _PREP_Firm 0x02 /* firmworks prep */ |
38 | #define _PREP_IBM 0x00 /* ibm prep */ | 45 | #define _PREP_IBM 0x00 /* ibm prep */ |
39 | #define _PREP_Bull 0x03 /* bull prep */ | 46 | #define _PREP_Bull 0x03 /* bull prep */ |
40 | 47 | ||
41 | /* these are arbitrary */ | 48 | /* CHRP sub-platform types. These are arbitrary */ |
42 | #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ | 49 | #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ |
43 | #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ | 50 | #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ |
44 | #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ | 51 | #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ |
45 | 52 | ||
46 | #ifdef CONFIG_PPC_MULTIPLATFORM | 53 | #define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ |
54 | _machine == PLATFORM_PSERIES_LPAR) | ||
55 | #define platform_is_lpar() (!!(_machine & PLATFORM_LPAR)) | ||
56 | |||
57 | #if defined(CONFIG_PPC_MULTIPLATFORM) | ||
47 | extern int _machine; | 58 | extern int _machine; |
48 | 59 | ||
60 | #ifdef CONFIG_PPC32 | ||
61 | |||
49 | /* what kind of prep workstation we are */ | 62 | /* what kind of prep workstation we are */ |
50 | extern int _prep_type; | 63 | extern int _prep_type; |
51 | extern int _chrp_type; | 64 | extern int _chrp_type; |
52 | 65 | ||
53 | /* | 66 | /* |
54 | * This is used to identify the board type from a given PReP board | 67 | * This is used to identify the board type from a given PReP board |
55 | * vendor. Board revision is also made available. | 68 | * vendor. Board revision is also made available. This will be moved |
69 | * elsewhere soon | ||
56 | */ | 70 | */ |
57 | extern unsigned char ucSystemType; | 71 | extern unsigned char ucSystemType; |
58 | extern unsigned char ucBoardRev; | 72 | extern unsigned char ucBoardRev; |
59 | extern unsigned char ucBoardRevMaj, ucBoardRevMin; | 73 | extern unsigned char ucBoardRevMaj, ucBoardRevMin; |
74 | |||
75 | #endif /* CONFIG_PPC32 */ | ||
76 | |||
77 | #elif defined(CONFIG_PPC_ISERIES) | ||
78 | /* | ||
79 | * iSeries is soon to become MULTIPLATFORM hopefully ... | ||
80 | */ | ||
81 | #define _machine PLATFORM_ISERIES_LPAR | ||
60 | #else | 82 | #else |
61 | #define _machine 0 | 83 | #define _machine 0 |
62 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | 84 | #endif /* CONFIG_PPC_MULTIPLATFORM */ |
63 | #endif /* CONFIG_PPC32 */ | ||
64 | |||
65 | #ifdef CONFIG_PPC64 | ||
66 | /* Platforms supported by PPC64 */ | ||
67 | #define PLATFORM_PSERIES 0x0100 | ||
68 | #define PLATFORM_PSERIES_LPAR 0x0101 | ||
69 | #define PLATFORM_ISERIES_LPAR 0x0201 | ||
70 | #define PLATFORM_LPAR 0x0001 | ||
71 | #define PLATFORM_POWERMAC 0x0400 | ||
72 | #define PLATFORM_MAPLE 0x0500 | ||
73 | #define PLATFORM_CELL 0x1000 | ||
74 | |||
75 | /* Compatibility with drivers coming from PPC32 world */ | ||
76 | #define _machine (systemcfg->platform) | ||
77 | #define _MACH_Pmac PLATFORM_POWERMAC | ||
78 | #endif | ||
79 | 85 | ||
80 | /* | 86 | /* |
81 | * Default implementation of macro that returns current | 87 | * Default implementation of macro that returns current |
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h index 489cf4c99c21..eb392d038ed7 100644 --- a/include/asm-powerpc/reg.h +++ b/include/asm-powerpc/reg.h | |||
@@ -16,7 +16,11 @@ | |||
16 | /* Pickup Book E specific registers. */ | 16 | /* Pickup Book E specific registers. */ |
17 | #if defined(CONFIG_BOOKE) || defined(CONFIG_40x) | 17 | #if defined(CONFIG_BOOKE) || defined(CONFIG_40x) |
18 | #include <asm/reg_booke.h> | 18 | #include <asm/reg_booke.h> |
19 | #endif | 19 | #endif /* CONFIG_BOOKE || CONFIG_40x */ |
20 | |||
21 | #ifdef CONFIG_8xx | ||
22 | #include <asm/reg_8xx.h> | ||
23 | #endif /* CONFIG_8xx */ | ||
20 | 24 | ||
21 | #define MSR_SF_LG 63 /* Enable 64 bit mode */ | 25 | #define MSR_SF_LG 63 /* Enable 64 bit mode */ |
22 | #define MSR_ISF_LG 61 /* Interrupt 64b mode valid on 630 */ | 26 | #define MSR_ISF_LG 61 /* Interrupt 64b mode valid on 630 */ |
@@ -359,6 +363,7 @@ | |||
359 | #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ | 363 | #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ |
360 | #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ | 364 | #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ |
361 | #define SPRN_SDR1 0x019 /* MMU Hash Base Register */ | 365 | #define SPRN_SDR1 0x019 /* MMU Hash Base Register */ |
366 | #define SPRN_ASR 0x118 /* Address Space Register */ | ||
362 | #define SPRN_SIA 0x3BB /* Sampled Instruction Address Register */ | 367 | #define SPRN_SIA 0x3BB /* Sampled Instruction Address Register */ |
363 | #define SPRN_SPRG0 0x110 /* Special Purpose Register General 0 */ | 368 | #define SPRN_SPRG0 0x110 /* Special Purpose Register General 0 */ |
364 | #define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */ | 369 | #define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */ |
diff --git a/include/asm-ppc/cache.h b/include/asm-powerpc/reg_8xx.h index 7a157d0f4b5f..e8ea346b21d3 100644 --- a/include/asm-ppc/cache.h +++ b/include/asm-powerpc/reg_8xx.h | |||
@@ -1,49 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * include/asm-ppc/cache.h | 2 | * Contains register definitions common to PowerPC 8xx CPUs. Notice |
3 | */ | 3 | */ |
4 | #ifdef __KERNEL__ | 4 | #ifndef _ASM_POWERPC_REG_8xx_H |
5 | #ifndef __ARCH_PPC_CACHE_H | 5 | #define _ASM_POWERPC_REG_8xx_H |
6 | #define __ARCH_PPC_CACHE_H | ||
7 | 6 | ||
8 | #include <linux/config.h> | ||
9 | |||
10 | /* bytes per L1 cache line */ | ||
11 | #if defined(CONFIG_8xx) || defined(CONFIG_403GCX) | ||
12 | #define L1_CACHE_SHIFT 4 | ||
13 | #define MAX_COPY_PREFETCH 1 | ||
14 | #elif defined(CONFIG_PPC64BRIDGE) | ||
15 | #define L1_CACHE_SHIFT 7 | ||
16 | #define MAX_COPY_PREFETCH 1 | ||
17 | #else | ||
18 | #define L1_CACHE_SHIFT 5 | ||
19 | #define MAX_COPY_PREFETCH 4 | ||
20 | #endif | ||
21 | |||
22 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
23 | |||
24 | #define SMP_CACHE_BYTES L1_CACHE_BYTES | ||
25 | #define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ | ||
26 | |||
27 | #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) | ||
28 | #define L1_CACHE_PAGES 8 | ||
29 | |||
30 | #ifndef __ASSEMBLY__ | ||
31 | extern void clean_dcache_range(unsigned long start, unsigned long stop); | ||
32 | extern void flush_dcache_range(unsigned long start, unsigned long stop); | ||
33 | extern void invalidate_dcache_range(unsigned long start, unsigned long stop); | ||
34 | extern void flush_dcache_all(void); | ||
35 | #endif /* __ASSEMBLY__ */ | ||
36 | |||
37 | /* prep registers for L2 */ | ||
38 | #define CACHECRBA 0x80000823 /* Cache configuration register address */ | ||
39 | #define L2CACHE_MASK 0x03 /* Mask for 2 L2 Cache bits */ | ||
40 | #define L2CACHE_512KB 0x00 /* 512KB */ | ||
41 | #define L2CACHE_256KB 0x01 /* 256KB */ | ||
42 | #define L2CACHE_1MB 0x02 /* 1MB */ | ||
43 | #define L2CACHE_NONE 0x03 /* NONE */ | ||
44 | #define L2CACHE_PARITY 0x08 /* Mask for L2 Cache Parity Protected bit */ | ||
45 | |||
46 | #ifdef CONFIG_8xx | ||
47 | /* Cache control on the MPC8xx is provided through some additional | 7 | /* Cache control on the MPC8xx is provided through some additional |
48 | * special purpose registers. | 8 | * special purpose registers. |
49 | */ | 9 | */ |
@@ -78,7 +38,5 @@ extern void flush_dcache_all(void); | |||
78 | 38 | ||
79 | #define DC_DFWT 0x40000000 /* Data cache is forced write through */ | 39 | #define DC_DFWT 0x40000000 /* Data cache is forced write through */ |
80 | #define DC_LES 0x20000000 /* Caches are little endian mode */ | 40 | #define DC_LES 0x20000000 /* Caches are little endian mode */ |
81 | #endif /* CONFIG_8xx */ | ||
82 | 41 | ||
83 | #endif | 42 | #endif /* _ASM_POWERPC_REG_8xx_H */ |
84 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc/signal.h b/include/asm-powerpc/signal.h index caf6ede3710f..694c8d2dab87 100644 --- a/include/asm-ppc/signal.h +++ b/include/asm-powerpc/signal.h | |||
@@ -1,18 +1,11 @@ | |||
1 | #ifndef _ASMPPC_SIGNAL_H | 1 | #ifndef _ASM_POWERPC_SIGNAL_H |
2 | #define _ASMPPC_SIGNAL_H | 2 | #define _ASM_POWERPC_SIGNAL_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | #include <linux/types.h> | 4 | #include <linux/types.h> |
6 | #endif /* __KERNEL__ */ | 5 | #include <linux/config.h> |
7 | |||
8 | /* Avoid too many header ordering problems. */ | ||
9 | struct siginfo; | ||
10 | |||
11 | /* Most things should be clean enough to redefine this at will, if care | ||
12 | is taken to make libc match. */ | ||
13 | 6 | ||
14 | #define _NSIG 64 | 7 | #define _NSIG 64 |
15 | #define _NSIG_BPW 32 | 8 | #define _NSIG_BPW BITS_PER_LONG |
16 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | 9 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) |
17 | 10 | ||
18 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | 11 | typedef unsigned long old_sigset_t; /* at least 32 bits */ |
@@ -77,19 +70,19 @@ typedef struct { | |||
77 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | 70 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single |
78 | * Unix names RESETHAND and NODEFER respectively. | 71 | * Unix names RESETHAND and NODEFER respectively. |
79 | */ | 72 | */ |
80 | #define SA_NOCLDSTOP 0x00000001 | 73 | #define SA_NOCLDSTOP 0x00000001U |
81 | #define SA_NOCLDWAIT 0x00000002 | 74 | #define SA_NOCLDWAIT 0x00000002U |
82 | #define SA_SIGINFO 0x00000004 | 75 | #define SA_SIGINFO 0x00000004U |
83 | #define SA_ONSTACK 0x08000000 | 76 | #define SA_ONSTACK 0x08000000U |
84 | #define SA_RESTART 0x10000000 | 77 | #define SA_RESTART 0x10000000U |
85 | #define SA_NODEFER 0x40000000 | 78 | #define SA_NODEFER 0x40000000U |
86 | #define SA_RESETHAND 0x80000000 | 79 | #define SA_RESETHAND 0x80000000U |
87 | 80 | ||
88 | #define SA_NOMASK SA_NODEFER | 81 | #define SA_NOMASK SA_NODEFER |
89 | #define SA_ONESHOT SA_RESETHAND | 82 | #define SA_ONESHOT SA_RESETHAND |
90 | #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ | 83 | #define SA_INTERRUPT 0x20000000u /* dummy -- ignored */ |
91 | 84 | ||
92 | #define SA_RESTORER 0x04000000 | 85 | #define SA_RESTORER 0x04000000U |
93 | 86 | ||
94 | /* | 87 | /* |
95 | * sigaltstack controls | 88 | * sigaltstack controls |
@@ -127,10 +120,13 @@ typedef struct sigaltstack { | |||
127 | } stack_t; | 120 | } stack_t; |
128 | 121 | ||
129 | #ifdef __KERNEL__ | 122 | #ifdef __KERNEL__ |
130 | #include <asm/sigcontext.h> | 123 | struct pt_regs; |
124 | extern int do_signal(sigset_t *oldset, struct pt_regs *regs); | ||
125 | extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); | ||
131 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | 126 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) |
132 | #endif /* __KERNEL__ */ | 127 | #endif /* __KERNEL__ */ |
133 | 128 | ||
129 | #ifndef __powerpc64__ | ||
134 | /* | 130 | /* |
135 | * These are parameters to dbg_sigreturn syscall. They enable or | 131 | * These are parameters to dbg_sigreturn syscall. They enable or |
136 | * disable certain debugging things that can be done from signal | 132 | * disable certain debugging things that can be done from signal |
@@ -149,5 +145,6 @@ struct sig_dbg_op { | |||
149 | 145 | ||
150 | /* Enable or disable branch tracing. The value sets the state. */ | 146 | /* Enable or disable branch tracing. The value sets the state. */ |
151 | #define SIG_DBG_BRANCH_TRACING 2 | 147 | #define SIG_DBG_BRANCH_TRACING 2 |
148 | #endif /* ! __powerpc64__ */ | ||
152 | 149 | ||
153 | #endif | 150 | #endif /* _ASM_POWERPC_SIGNAL_H */ |
diff --git a/include/asm-powerpc/sparsemem.h b/include/asm-powerpc/sparsemem.h index 1c95ab99deb3..58d2aab416f8 100644 --- a/include/asm-powerpc/sparsemem.h +++ b/include/asm-powerpc/sparsemem.h | |||
@@ -11,6 +11,10 @@ | |||
11 | #define MAX_PHYSADDR_BITS 38 | 11 | #define MAX_PHYSADDR_BITS 38 |
12 | #define MAX_PHYSMEM_BITS 36 | 12 | #define MAX_PHYSMEM_BITS 36 |
13 | 13 | ||
14 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
15 | extern void create_section_mapping(unsigned long start, unsigned long end); | ||
16 | #endif /* CONFIG_MEMORY_HOTPLUG */ | ||
17 | |||
14 | #endif /* CONFIG_SPARSEMEM */ | 18 | #endif /* CONFIG_SPARSEMEM */ |
15 | 19 | ||
16 | #endif /* _ASM_POWERPC_SPARSEMEM_H */ | 20 | #endif /* _ASM_POWERPC_SPARSEMEM_H */ |
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index 3536a5cd7a2d..5341b75c75cb 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | 9 | ||
10 | #include <asm/hw_irq.h> | 10 | #include <asm/hw_irq.h> |
11 | #include <asm/ppc_asm.h> | ||
12 | #include <asm/atomic.h> | 11 | #include <asm/atomic.h> |
13 | 12 | ||
14 | /* | 13 | /* |
@@ -180,6 +179,7 @@ extern struct task_struct *_switch(struct thread_struct *prev, | |||
180 | extern unsigned int rtas_data; | 179 | extern unsigned int rtas_data; |
181 | extern int mem_init_done; /* set on boot once kmalloc can be called */ | 180 | extern int mem_init_done; /* set on boot once kmalloc can be called */ |
182 | extern unsigned long memory_limit; | 181 | extern unsigned long memory_limit; |
182 | extern unsigned long klimit; | ||
183 | 183 | ||
184 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ | 184 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ |
185 | 185 | ||
diff --git a/include/asm-ppc64/systemcfg.h b/include/asm-powerpc/systemcfg.h index 9b86b53129aa..36b5cbe466f1 100644 --- a/include/asm-ppc64/systemcfg.h +++ b/include/asm-powerpc/systemcfg.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _SYSTEMCFG_H | 1 | #ifndef _SYSTEMCFG_H |
2 | #define _SYSTEMCFG_H | 2 | #define _SYSTEMCFG_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM | 5 | * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | /* Change Activity: | 13 | /* Change Activity: |
14 | * 2002/09/30 : bergner : Created | 14 | * 2002/09/30 : bergner : Created |
15 | * End Change Activity | 15 | * End Change Activity |
16 | */ | 16 | */ |
17 | 17 | ||
18 | /* | 18 | /* |
@@ -56,7 +56,7 @@ struct systemcfg { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | #ifdef __KERNEL__ | 58 | #ifdef __KERNEL__ |
59 | extern struct systemcfg *systemcfg; | 59 | extern struct systemcfg *_systemcfg; /* to be renamed */ |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | #endif /* __ASSEMBLY__ */ | 62 | #endif /* __ASSEMBLY__ */ |
diff --git a/include/asm-ppc64/tce.h b/include/asm-powerpc/tce.h index d40b6b42ab35..d099d5200f9b 100644 --- a/include/asm-ppc64/tce.h +++ b/include/asm-powerpc/tce.h | |||
@@ -18,8 +18,8 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _ASM_TCE_H | 21 | #ifndef _ASM_POWERPC_TCE_H |
22 | #define _ASM_TCE_H | 22 | #define _ASM_POWERPC_TCE_H |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Tces come in two formats, one for the virtual bus and a different | 25 | * Tces come in two formats, one for the virtual bus and a different |
@@ -61,4 +61,4 @@ union tce_entry { | |||
61 | }; | 61 | }; |
62 | 62 | ||
63 | 63 | ||
64 | #endif | 64 | #endif /* _ASM_POWERPC_TCE_H */ |
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h index 33af730f0d19..3872e924cdd6 100644 --- a/include/asm-powerpc/uaccess.h +++ b/include/asm-powerpc/uaccess.h | |||
@@ -120,14 +120,6 @@ struct exception_table_entry { | |||
120 | 120 | ||
121 | extern long __put_user_bad(void); | 121 | extern long __put_user_bad(void); |
122 | 122 | ||
123 | #ifdef __powerpc64__ | ||
124 | #define __EX_TABLE_ALIGN "3" | ||
125 | #define __EX_TABLE_TYPE "llong" | ||
126 | #else | ||
127 | #define __EX_TABLE_ALIGN "2" | ||
128 | #define __EX_TABLE_TYPE "long" | ||
129 | #endif | ||
130 | |||
131 | /* | 123 | /* |
132 | * We don't tell gcc that we are accessing memory, but this is OK | 124 | * We don't tell gcc that we are accessing memory, but this is OK |
133 | * because we do not write to any memory gcc knows about, so there | 125 | * because we do not write to any memory gcc knows about, so there |
@@ -142,11 +134,12 @@ extern long __put_user_bad(void); | |||
142 | " b 2b\n" \ | 134 | " b 2b\n" \ |
143 | ".previous\n" \ | 135 | ".previous\n" \ |
144 | ".section __ex_table,\"a\"\n" \ | 136 | ".section __ex_table,\"a\"\n" \ |
145 | " .align " __EX_TABLE_ALIGN "\n" \ | 137 | " .balign %5\n" \ |
146 | " ."__EX_TABLE_TYPE" 1b,3b\n" \ | 138 | PPC_LONG "1b,3b\n" \ |
147 | ".previous" \ | 139 | ".previous" \ |
148 | : "=r" (err) \ | 140 | : "=r" (err) \ |
149 | : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err)) | 141 | : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err),\ |
142 | "i"(sizeof(unsigned long))) | ||
150 | 143 | ||
151 | #ifdef __powerpc64__ | 144 | #ifdef __powerpc64__ |
152 | #define __put_user_asm2(x, ptr, retval) \ | 145 | #define __put_user_asm2(x, ptr, retval) \ |
@@ -162,12 +155,13 @@ extern long __put_user_bad(void); | |||
162 | " b 3b\n" \ | 155 | " b 3b\n" \ |
163 | ".previous\n" \ | 156 | ".previous\n" \ |
164 | ".section __ex_table,\"a\"\n" \ | 157 | ".section __ex_table,\"a\"\n" \ |
165 | " .align " __EX_TABLE_ALIGN "\n" \ | 158 | " .balign %5\n" \ |
166 | " ." __EX_TABLE_TYPE " 1b,4b\n" \ | 159 | PPC_LONG "1b,4b\n" \ |
167 | " ." __EX_TABLE_TYPE " 2b,4b\n" \ | 160 | PPC_LONG "2b,4b\n" \ |
168 | ".previous" \ | 161 | ".previous" \ |
169 | : "=r" (err) \ | 162 | : "=r" (err) \ |
170 | : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err)) | 163 | : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err),\ |
164 | "i"(sizeof(unsigned long))) | ||
171 | #endif /* __powerpc64__ */ | 165 | #endif /* __powerpc64__ */ |
172 | 166 | ||
173 | #define __put_user_size(x, ptr, size, retval) \ | 167 | #define __put_user_size(x, ptr, size, retval) \ |
@@ -213,11 +207,12 @@ extern long __get_user_bad(void); | |||
213 | " b 2b\n" \ | 207 | " b 2b\n" \ |
214 | ".previous\n" \ | 208 | ".previous\n" \ |
215 | ".section __ex_table,\"a\"\n" \ | 209 | ".section __ex_table,\"a\"\n" \ |
216 | " .align "__EX_TABLE_ALIGN "\n" \ | 210 | " .balign %5\n" \ |
217 | " ." __EX_TABLE_TYPE " 1b,3b\n" \ | 211 | PPC_LONG "1b,3b\n" \ |
218 | ".previous" \ | 212 | ".previous" \ |
219 | : "=r" (err), "=r" (x) \ | 213 | : "=r" (err), "=r" (x) \ |
220 | : "b" (addr), "i" (-EFAULT), "0" (err)) | 214 | : "b" (addr), "i" (-EFAULT), "0" (err), \ |
215 | "i"(sizeof(unsigned long))) | ||
221 | 216 | ||
222 | #ifdef __powerpc64__ | 217 | #ifdef __powerpc64__ |
223 | #define __get_user_asm2(x, addr, err) \ | 218 | #define __get_user_asm2(x, addr, err) \ |
@@ -235,12 +230,13 @@ extern long __get_user_bad(void); | |||
235 | " b 3b\n" \ | 230 | " b 3b\n" \ |
236 | ".previous\n" \ | 231 | ".previous\n" \ |
237 | ".section __ex_table,\"a\"\n" \ | 232 | ".section __ex_table,\"a\"\n" \ |
238 | " .align " __EX_TABLE_ALIGN "\n" \ | 233 | " .balign %5\n" \ |
239 | " ." __EX_TABLE_TYPE " 1b,4b\n" \ | 234 | PPC_LONG "1b,4b\n" \ |
240 | " ." __EX_TABLE_TYPE " 2b,4b\n" \ | 235 | PPC_LONG "2b,4b\n" \ |
241 | ".previous" \ | 236 | ".previous" \ |
242 | : "=r" (err), "=&r" (x) \ | 237 | : "=r" (err), "=&r" (x) \ |
243 | : "b" (addr), "i" (-EFAULT), "0" (err)) | 238 | : "b" (addr), "i" (-EFAULT), "0" (err), \ |
239 | "i"(sizeof(unsigned long))) | ||
244 | #endif /* __powerpc64__ */ | 240 | #endif /* __powerpc64__ */ |
245 | 241 | ||
246 | #define __get_user_size(x, ptr, size, retval) \ | 242 | #define __get_user_size(x, ptr, size, retval) \ |
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h index ace2072d4a83..43f7129984c7 100644 --- a/include/asm-powerpc/xmon.h +++ b/include/asm-powerpc/xmon.h | |||
@@ -7,7 +7,6 @@ struct pt_regs; | |||
7 | extern int xmon(struct pt_regs *excp); | 7 | extern int xmon(struct pt_regs *excp); |
8 | extern void xmon_printf(const char *fmt, ...); | 8 | extern void xmon_printf(const char *fmt, ...); |
9 | extern void xmon_init(int); | 9 | extern void xmon_init(int); |
10 | extern void xmon_map_scc(void); | ||
11 | 10 | ||
12 | #endif | 11 | #endif |
13 | #endif | 12 | #endif |
diff --git a/include/asm-ppc/cacheflush.h b/include/asm-ppc/cacheflush.h deleted file mode 100644 index 6a243efb3317..000000000000 --- a/include/asm-ppc/cacheflush.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-ppc/cacheflush.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | #ifdef __KERNEL__ | ||
10 | #ifndef _PPC_CACHEFLUSH_H | ||
11 | #define _PPC_CACHEFLUSH_H | ||
12 | |||
13 | #include <linux/mm.h> | ||
14 | |||
15 | /* | ||
16 | * No cache flushing is required when address mappings are | ||
17 | * changed, because the caches on PowerPCs are physically | ||
18 | * addressed. -- paulus | ||
19 | * Also, when SMP we use the coherency (M) bit of the | ||
20 | * BATs and PTEs. -- Cort | ||
21 | */ | ||
22 | #define flush_cache_all() do { } while (0) | ||
23 | #define flush_cache_mm(mm) do { } while (0) | ||
24 | #define flush_cache_range(vma, a, b) do { } while (0) | ||
25 | #define flush_cache_page(vma, p, pfn) do { } while (0) | ||
26 | #define flush_icache_page(vma, page) do { } while (0) | ||
27 | #define flush_cache_vmap(start, end) do { } while (0) | ||
28 | #define flush_cache_vunmap(start, end) do { } while (0) | ||
29 | |||
30 | extern void flush_dcache_page(struct page *page); | ||
31 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
32 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
33 | |||
34 | extern void flush_icache_range(unsigned long, unsigned long); | ||
35 | extern void flush_icache_user_range(struct vm_area_struct *vma, | ||
36 | struct page *page, unsigned long addr, int len); | ||
37 | |||
38 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
39 | do { memcpy(dst, src, len); \ | ||
40 | flush_icache_user_range(vma, page, vaddr, len); \ | ||
41 | } while (0) | ||
42 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
43 | memcpy(dst, src, len) | ||
44 | |||
45 | extern void __flush_dcache_icache(void *page_va); | ||
46 | extern void __flush_dcache_icache_phys(unsigned long physaddr); | ||
47 | extern void flush_dcache_icache_page(struct page *page); | ||
48 | #endif /* _PPC_CACHEFLUSH_H */ | ||
49 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc/current.h b/include/asm-ppc/current.h deleted file mode 100644 index 8d41501ba10d..000000000000 --- a/include/asm-ppc/current.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #ifdef __KERNEL__ | ||
2 | #ifndef _PPC_CURRENT_H | ||
3 | #define _PPC_CURRENT_H | ||
4 | |||
5 | /* | ||
6 | * We keep `current' in r2 for speed. | ||
7 | */ | ||
8 | register struct task_struct *current asm ("r2"); | ||
9 | |||
10 | #endif /* !(_PPC_CURRENT_H) */ | ||
11 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc64/cache.h b/include/asm-ppc64/cache.h deleted file mode 100644 index 92140a7efbd1..000000000000 --- a/include/asm-ppc64/cache.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or | ||
3 | * modify it under the terms of the GNU General Public License | ||
4 | * as published by the Free Software Foundation; either version | ||
5 | * 2 of the License, or (at your option) any later version. | ||
6 | */ | ||
7 | #ifndef __ARCH_PPC64_CACHE_H | ||
8 | #define __ARCH_PPC64_CACHE_H | ||
9 | |||
10 | #include <asm/types.h> | ||
11 | |||
12 | /* bytes per L1 cache line */ | ||
13 | #define L1_CACHE_SHIFT 7 | ||
14 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
15 | |||
16 | #define SMP_CACHE_BYTES L1_CACHE_BYTES | ||
17 | #define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | struct ppc64_caches { | ||
22 | u32 dsize; /* L1 d-cache size */ | ||
23 | u32 dline_size; /* L1 d-cache line size */ | ||
24 | u32 log_dline_size; | ||
25 | u32 dlines_per_page; | ||
26 | u32 isize; /* L1 i-cache size */ | ||
27 | u32 iline_size; /* L1 i-cache line size */ | ||
28 | u32 log_iline_size; | ||
29 | u32 ilines_per_page; | ||
30 | }; | ||
31 | |||
32 | extern struct ppc64_caches ppc64_caches; | ||
33 | |||
34 | #endif | ||
35 | |||
36 | #endif | ||
diff --git a/include/asm-ppc64/current.h b/include/asm-ppc64/current.h deleted file mode 100644 index 52ddc60c8b65..000000000000 --- a/include/asm-ppc64/current.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #ifndef _PPC64_CURRENT_H | ||
2 | #define _PPC64_CURRENT_H | ||
3 | |||
4 | #include <asm/paca.h> | ||
5 | |||
6 | /* | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #define get_current() (get_paca()->__current) | ||
14 | #define current get_current() | ||
15 | |||
16 | #endif /* !(_PPC64_CURRENT_H) */ | ||
diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h index 40c8eb57493e..89f26ab31908 100644 --- a/include/asm-ppc64/eeh.h +++ b/include/asm-ppc64/eeh.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * eeh.h | 2 | * eeh.h |
3 | * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation. | 3 | * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation. |
4 | * | 4 | * |
@@ -6,12 +6,12 @@ | |||
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | struct pci_dev; | 28 | struct pci_dev; |
29 | struct device_node; | 29 | struct device_node; |
30 | struct device_node; | ||
31 | struct notifier_block; | ||
32 | 30 | ||
33 | #ifdef CONFIG_EEH | 31 | #ifdef CONFIG_EEH |
34 | 32 | ||
@@ -37,6 +35,10 @@ struct notifier_block; | |||
37 | #define EEH_MODE_NOCHECK (1<<1) | 35 | #define EEH_MODE_NOCHECK (1<<1) |
38 | #define EEH_MODE_ISOLATED (1<<2) | 36 | #define EEH_MODE_ISOLATED (1<<2) |
39 | 37 | ||
38 | /* Max number of EEH freezes allowed before we consider the device | ||
39 | * to be permanently disabled. */ | ||
40 | #define EEH_MAX_ALLOWED_FREEZES 5 | ||
41 | |||
40 | void __init eeh_init(void); | 42 | void __init eeh_init(void); |
41 | unsigned long eeh_check_failure(const volatile void __iomem *token, | 43 | unsigned long eeh_check_failure(const volatile void __iomem *token, |
42 | unsigned long val); | 44 | unsigned long val); |
@@ -59,36 +61,14 @@ void eeh_add_device_late(struct pci_dev *); | |||
59 | * eeh_remove_device - undo EEH setup for the indicated pci device | 61 | * eeh_remove_device - undo EEH setup for the indicated pci device |
60 | * @dev: pci device to be removed | 62 | * @dev: pci device to be removed |
61 | * | 63 | * |
62 | * This routine should be when a device is removed from a running | 64 | * This routine should be called when a device is removed from |
63 | * system (e.g. by hotplug or dlpar). | 65 | * a running system (e.g. by hotplug or dlpar). It unregisters |
66 | * the PCI device from the EEH subsystem. I/O errors affecting | ||
67 | * this device will no longer be detected after this call; thus, | ||
68 | * i/o errors affecting this slot may leave this device unusable. | ||
64 | */ | 69 | */ |
65 | void eeh_remove_device(struct pci_dev *); | 70 | void eeh_remove_device(struct pci_dev *); |
66 | 71 | ||
67 | #define EEH_DISABLE 0 | ||
68 | #define EEH_ENABLE 1 | ||
69 | #define EEH_RELEASE_LOADSTORE 2 | ||
70 | #define EEH_RELEASE_DMA 3 | ||
71 | |||
72 | /** | ||
73 | * Notifier event flags. | ||
74 | */ | ||
75 | #define EEH_NOTIFY_FREEZE 1 | ||
76 | |||
77 | /** EEH event -- structure holding pci slot data that describes | ||
78 | * a change in the isolation status of a PCI slot. A pointer | ||
79 | * to this struct is passed as the data pointer in a notify callback. | ||
80 | */ | ||
81 | struct eeh_event { | ||
82 | struct list_head list; | ||
83 | struct pci_dev *dev; | ||
84 | struct device_node *dn; | ||
85 | int reset_state; | ||
86 | }; | ||
87 | |||
88 | /** Register to find out about EEH events. */ | ||
89 | int eeh_register_notifier(struct notifier_block *nb); | ||
90 | int eeh_unregister_notifier(struct notifier_block *nb); | ||
91 | |||
92 | /** | 72 | /** |
93 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. | 73 | * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. |
94 | * | 74 | * |
@@ -129,7 +109,7 @@ static inline void eeh_remove_device(struct pci_dev *dev) { } | |||
129 | #define EEH_IO_ERROR_VALUE(size) (-1UL) | 109 | #define EEH_IO_ERROR_VALUE(size) (-1UL) |
130 | #endif /* CONFIG_EEH */ | 110 | #endif /* CONFIG_EEH */ |
131 | 111 | ||
132 | /* | 112 | /* |
133 | * MMIO read/write operations with EEH support. | 113 | * MMIO read/write operations with EEH support. |
134 | */ | 114 | */ |
135 | static inline u8 eeh_readb(const volatile void __iomem *addr) | 115 | static inline u8 eeh_readb(const volatile void __iomem *addr) |
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index 4c18a5cb69f5..1a7e0afa2dc6 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #define _PPC64_MMU_H_ | 14 | #define _PPC64_MMU_H_ |
15 | 15 | ||
16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
17 | #include <asm/ppc_asm.h> /* for ASM_CONST */ | 17 | #include <asm/asm-compat.h> |
18 | #include <asm/page.h> | 18 | #include <asm/page.h> |
19 | 19 | ||
20 | /* | 20 | /* |
@@ -224,9 +224,12 @@ extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | |||
224 | unsigned long pstart, unsigned long mode, | 224 | unsigned long pstart, unsigned long mode, |
225 | int psize); | 225 | int psize); |
226 | 226 | ||
227 | extern void htab_initialize(void); | ||
228 | extern void htab_initialize_secondary(void); | ||
227 | extern void hpte_init_native(void); | 229 | extern void hpte_init_native(void); |
228 | extern void hpte_init_lpar(void); | 230 | extern void hpte_init_lpar(void); |
229 | extern void hpte_init_iSeries(void); | 231 | extern void hpte_init_iSeries(void); |
232 | extern void mm_init_ppc64(void); | ||
230 | 233 | ||
231 | extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, | 234 | extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, |
232 | unsigned long va, unsigned long prpn, | 235 | unsigned long va, unsigned long prpn, |
@@ -245,6 +248,7 @@ extern long iSeries_hpte_insert(unsigned long hpte_group, | |||
245 | 248 | ||
246 | extern void stabs_alloc(void); | 249 | extern void stabs_alloc(void); |
247 | extern void slb_initialize(void); | 250 | extern void slb_initialize(void); |
251 | extern void stab_initialize(unsigned long stab); | ||
248 | 252 | ||
249 | #endif /* __ASSEMBLY__ */ | 253 | #endif /* __ASSEMBLY__ */ |
250 | 254 | ||
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h index 80a708e7093a..15e777ce0f4a 100644 --- a/include/asm-ppc64/mmzone.h +++ b/include/asm-ppc64/mmzone.h | |||
@@ -33,6 +33,9 @@ extern int numa_cpu_lookup_table[]; | |||
33 | extern char *numa_memory_lookup_table; | 33 | extern char *numa_memory_lookup_table; |
34 | extern cpumask_t numa_cpumask_lookup_table[]; | 34 | extern cpumask_t numa_cpumask_lookup_table[]; |
35 | extern int nr_cpus_in_node[]; | 35 | extern int nr_cpus_in_node[]; |
36 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
37 | extern unsigned long max_pfn; | ||
38 | #endif | ||
36 | 39 | ||
37 | /* 16MB regions */ | 40 | /* 16MB regions */ |
38 | #define MEMORY_INCREMENT_SHIFT 24 | 41 | #define MEMORY_INCREMENT_SHIFT 24 |
@@ -45,6 +48,11 @@ static inline int pa_to_nid(unsigned long pa) | |||
45 | { | 48 | { |
46 | int nid; | 49 | int nid; |
47 | 50 | ||
51 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
52 | /* kludge hot added sections default to node 0 */ | ||
53 | if (pa >= (max_pfn << PAGE_SHIFT)) | ||
54 | return 0; | ||
55 | #endif | ||
48 | nid = numa_memory_lookup_table[pa >> MEMORY_INCREMENT_SHIFT]; | 56 | nid = numa_memory_lookup_table[pa >> MEMORY_INCREMENT_SHIFT]; |
49 | 57 | ||
50 | #ifdef DEBUG_NUMA | 58 | #ifdef DEBUG_NUMA |
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index 82ce187e5be8..e32f1187aa29 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h | |||
@@ -11,7 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | 13 | #include <linux/config.h> |
14 | #include <asm/ppc_asm.h> /* for ASM_CONST */ | 14 | #include <asm/asm-compat.h> |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * We support either 4k or 64k software page size. When using 64k pages | 17 | * We support either 4k or 64k software page size. When using 64k pages |
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h index 60cf8c838af0..efbdaece0cf0 100644 --- a/include/asm-ppc64/pci-bridge.h +++ b/include/asm-ppc64/pci-bridge.h | |||
@@ -63,7 +63,6 @@ struct pci_dn { | |||
63 | int devfn; /* for pci devices */ | 63 | int devfn; /* for pci devices */ |
64 | int eeh_mode; /* See eeh.h for possible EEH_MODEs */ | 64 | int eeh_mode; /* See eeh.h for possible EEH_MODEs */ |
65 | int eeh_config_addr; | 65 | int eeh_config_addr; |
66 | int eeh_capable; /* from firmware */ | ||
67 | int eeh_check_count; /* # times driver ignored error */ | 66 | int eeh_check_count; /* # times driver ignored error */ |
68 | int eeh_freeze_count; /* # times this device froze up. */ | 67 | int eeh_freeze_count; /* # times this device froze up. */ |
69 | int eeh_is_bridge; /* device is pci-to-pci bridge */ | 68 | int eeh_is_bridge; /* device is pci-to-pci bridge */ |
diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h index 98da0e4262bd..dcf3622d1946 100644 --- a/include/asm-ppc64/pgalloc.h +++ b/include/asm-ppc64/pgalloc.h | |||
@@ -10,8 +10,8 @@ extern kmem_cache_t *pgtable_cache[]; | |||
10 | 10 | ||
11 | #ifdef CONFIG_PPC_64K_PAGES | 11 | #ifdef CONFIG_PPC_64K_PAGES |
12 | #define PTE_CACHE_NUM 0 | 12 | #define PTE_CACHE_NUM 0 |
13 | #define PMD_CACHE_NUM 0 | 13 | #define PMD_CACHE_NUM 1 |
14 | #define PGD_CACHE_NUM 1 | 14 | #define PGD_CACHE_NUM 2 |
15 | #else | 15 | #else |
16 | #define PTE_CACHE_NUM 0 | 16 | #define PTE_CACHE_NUM 0 |
17 | #define PMD_CACHE_NUM 1 | 17 | #define PMD_CACHE_NUM 1 |
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h index 76bb0266d67c..ddfe186589fa 100644 --- a/include/asm-ppc64/prom.h +++ b/include/asm-ppc64/prom.h | |||
@@ -204,6 +204,8 @@ extern void of_detach_node(const struct device_node *); | |||
204 | extern unsigned long prom_init(unsigned long, unsigned long, unsigned long, | 204 | extern unsigned long prom_init(unsigned long, unsigned long, unsigned long, |
205 | unsigned long, unsigned long); | 205 | unsigned long, unsigned long); |
206 | extern void finish_device_tree(void); | 206 | extern void finish_device_tree(void); |
207 | extern void unflatten_device_tree(void); | ||
208 | extern void early_init_devtree(void *); | ||
207 | extern int device_is_compatible(struct device_node *device, const char *); | 209 | extern int device_is_compatible(struct device_node *device, const char *); |
208 | extern int machine_is_compatible(const char *compat); | 210 | extern int machine_is_compatible(const char *compat); |
209 | extern unsigned char *get_property(struct device_node *node, const char *name, | 211 | extern unsigned char *get_property(struct device_node *node, const char *name, |
diff --git a/include/asm-ppc64/signal.h b/include/asm-ppc64/signal.h deleted file mode 100644 index 432df7dd355d..000000000000 --- a/include/asm-ppc64/signal.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | #ifndef _ASMPPC64_SIGNAL_H | ||
2 | #define _ASMPPC64_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/compiler.h> | ||
6 | #include <asm/siginfo.h> | ||
7 | |||
8 | /* Avoid too many header ordering problems. */ | ||
9 | struct siginfo; | ||
10 | |||
11 | #define _NSIG 64 | ||
12 | #define _NSIG_BPW 64 | ||
13 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
14 | |||
15 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
16 | |||
17 | typedef struct { | ||
18 | unsigned long sig[_NSIG_WORDS]; | ||
19 | } sigset_t; | ||
20 | |||
21 | #define SIGHUP 1 | ||
22 | #define SIGINT 2 | ||
23 | #define SIGQUIT 3 | ||
24 | #define SIGILL 4 | ||
25 | #define SIGTRAP 5 | ||
26 | #define SIGABRT 6 | ||
27 | #define SIGIOT 6 | ||
28 | #define SIGBUS 7 | ||
29 | #define SIGFPE 8 | ||
30 | #define SIGKILL 9 | ||
31 | #define SIGUSR1 10 | ||
32 | #define SIGSEGV 11 | ||
33 | #define SIGUSR2 12 | ||
34 | #define SIGPIPE 13 | ||
35 | #define SIGALRM 14 | ||
36 | #define SIGTERM 15 | ||
37 | #define SIGSTKFLT 16 | ||
38 | #define SIGCHLD 17 | ||
39 | #define SIGCONT 18 | ||
40 | #define SIGSTOP 19 | ||
41 | #define SIGTSTP 20 | ||
42 | #define SIGTTIN 21 | ||
43 | #define SIGTTOU 22 | ||
44 | #define SIGURG 23 | ||
45 | #define SIGXCPU 24 | ||
46 | #define SIGXFSZ 25 | ||
47 | #define SIGVTALRM 26 | ||
48 | #define SIGPROF 27 | ||
49 | #define SIGWINCH 28 | ||
50 | #define SIGIO 29 | ||
51 | #define SIGPOLL SIGIO | ||
52 | /* | ||
53 | #define SIGLOST 29 | ||
54 | */ | ||
55 | #define SIGPWR 30 | ||
56 | #define SIGSYS 31 | ||
57 | #define SIGUNUSED 31 | ||
58 | |||
59 | /* These should not be considered constants from userland. */ | ||
60 | #define SIGRTMIN 32 | ||
61 | #define SIGRTMAX _NSIG | ||
62 | |||
63 | /* | ||
64 | * SA_FLAGS values: | ||
65 | * | ||
66 | * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). | ||
67 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
68 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
69 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
70 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
71 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
72 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
73 | * | ||
74 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
75 | * Unix names RESETHAND and NODEFER respectively. | ||
76 | */ | ||
77 | #define SA_NOCLDSTOP 0x00000001u | ||
78 | #define SA_NOCLDWAIT 0x00000002u | ||
79 | #define SA_SIGINFO 0x00000004u | ||
80 | #define SA_ONSTACK 0x08000000u | ||
81 | #define SA_RESTART 0x10000000u | ||
82 | #define SA_NODEFER 0x40000000u | ||
83 | #define SA_RESETHAND 0x80000000u | ||
84 | |||
85 | #define SA_NOMASK SA_NODEFER | ||
86 | #define SA_ONESHOT SA_RESETHAND | ||
87 | #define SA_INTERRUPT 0x20000000u /* dummy -- ignored */ | ||
88 | |||
89 | #define SA_RESTORER 0x04000000u | ||
90 | |||
91 | /* | ||
92 | * sigaltstack controls | ||
93 | */ | ||
94 | #define SS_ONSTACK 1 | ||
95 | #define SS_DISABLE 2 | ||
96 | |||
97 | #define MINSIGSTKSZ 2048 | ||
98 | #define SIGSTKSZ 8192 | ||
99 | |||
100 | #include <asm-generic/signal.h> | ||
101 | |||
102 | struct old_sigaction { | ||
103 | __sighandler_t sa_handler; | ||
104 | old_sigset_t sa_mask; | ||
105 | unsigned long sa_flags; | ||
106 | __sigrestore_t sa_restorer; | ||
107 | }; | ||
108 | |||
109 | struct sigaction { | ||
110 | __sighandler_t sa_handler; | ||
111 | unsigned long sa_flags; | ||
112 | __sigrestore_t sa_restorer; | ||
113 | sigset_t sa_mask; /* mask last for extensibility */ | ||
114 | }; | ||
115 | |||
116 | struct k_sigaction { | ||
117 | struct sigaction sa; | ||
118 | }; | ||
119 | |||
120 | typedef struct sigaltstack { | ||
121 | void __user *ss_sp; | ||
122 | int ss_flags; | ||
123 | size_t ss_size; | ||
124 | } stack_t; | ||
125 | |||
126 | struct pt_regs; | ||
127 | struct timespec; | ||
128 | extern int do_signal(sigset_t *oldset, struct pt_regs *regs); | ||
129 | extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); | ||
130 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
131 | |||
132 | #endif /* _ASMPPC64_SIGNAL_H */ | ||
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h index 0cdd66c9f4b7..bf9a6aba19c9 100644 --- a/include/asm-ppc64/system.h +++ b/include/asm-ppc64/system.h | |||
@@ -149,6 +149,8 @@ struct thread_struct; | |||
149 | extern struct task_struct * _switch(struct thread_struct *prev, | 149 | extern struct task_struct * _switch(struct thread_struct *prev, |
150 | struct thread_struct *next); | 150 | struct thread_struct *next); |
151 | 151 | ||
152 | extern unsigned long klimit; | ||
153 | |||
152 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ | 154 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ |
153 | 155 | ||
154 | /* | 156 | /* |
diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h index f42cf3977a57..711dad4cb48b 100644 --- a/include/asm-sh/ide.h +++ b/include/asm-sh/ide.h | |||
@@ -16,10 +16,6 @@ | |||
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | 18 | ||
19 | #ifndef MAX_HWIFS | ||
20 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | ||
21 | #endif | ||
22 | |||
23 | #define ide_default_io_ctl(base) (0) | 19 | #define ide_default_io_ctl(base) (0) |
24 | 20 | ||
25 | #include <asm-generic/ide_iops.h> | 21 | #include <asm-generic/ide_iops.h> |
diff --git a/include/asm-sh64/ide.h b/include/asm-sh64/ide.h index 6fd514daa1ba..852f50afe39c 100644 --- a/include/asm-sh64/ide.h +++ b/include/asm-sh64/ide.h | |||
@@ -17,10 +17,6 @@ | |||
17 | 17 | ||
18 | #include <linux/config.h> | 18 | #include <linux/config.h> |
19 | 19 | ||
20 | #ifndef MAX_HWIFS | ||
21 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | ||
22 | #endif | ||
23 | |||
24 | /* Without this, the initialisation of PCI IDE cards end up calling | 20 | /* Without this, the initialisation of PCI IDE cards end up calling |
25 | * ide_init_hwif_ports, which won't work. */ | 21 | * ide_init_hwif_ports, which won't work. */ |
26 | #ifdef CONFIG_BLK_DEV_IDEPCI | 22 | #ifdef CONFIG_BLK_DEV_IDEPCI |
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h new file mode 100644 index 000000000000..84f12a41dc01 --- /dev/null +++ b/include/linux/genetlink.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef __LINUX_GENERIC_NETLINK_H | ||
2 | #define __LINUX_GENERIC_NETLINK_H | ||
3 | |||
4 | #include <linux/netlink.h> | ||
5 | |||
6 | #define GENL_NAMSIZ 16 /* length of family name */ | ||
7 | |||
8 | #define GENL_MIN_ID NLMSG_MIN_TYPE | ||
9 | #define GENL_MAX_ID 1023 | ||
10 | |||
11 | struct genlmsghdr { | ||
12 | __u8 cmd; | ||
13 | __u8 version; | ||
14 | __u16 reserved; | ||
15 | }; | ||
16 | |||
17 | #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) | ||
18 | |||
19 | /* | ||
20 | * List of reserved static generic netlink identifiers: | ||
21 | */ | ||
22 | #define GENL_ID_GENERATE 0 | ||
23 | #define GENL_ID_CTRL NLMSG_MIN_TYPE | ||
24 | |||
25 | /************************************************************************** | ||
26 | * Controller | ||
27 | **************************************************************************/ | ||
28 | |||
29 | enum { | ||
30 | CTRL_CMD_UNSPEC, | ||
31 | CTRL_CMD_NEWFAMILY, | ||
32 | CTRL_CMD_DELFAMILY, | ||
33 | CTRL_CMD_GETFAMILY, | ||
34 | CTRL_CMD_NEWOPS, | ||
35 | CTRL_CMD_DELOPS, | ||
36 | CTRL_CMD_GETOPS, | ||
37 | __CTRL_CMD_MAX, | ||
38 | }; | ||
39 | |||
40 | #define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) | ||
41 | |||
42 | enum { | ||
43 | CTRL_ATTR_UNSPEC, | ||
44 | CTRL_ATTR_FAMILY_ID, | ||
45 | CTRL_ATTR_FAMILY_NAME, | ||
46 | __CTRL_ATTR_MAX, | ||
47 | }; | ||
48 | |||
49 | #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) | ||
50 | |||
51 | #endif /* __LINUX_GENERIC_NETLINK_H */ | ||
diff --git a/include/linux/ide.h b/include/linux/ide.h index 3461abc1e854..77ae55d4c13c 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -230,6 +230,7 @@ typedef struct hw_regs_s { | |||
230 | int dma; /* our dma entry */ | 230 | int dma; /* our dma entry */ |
231 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ | 231 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ |
232 | hwif_chipset_t chipset; | 232 | hwif_chipset_t chipset; |
233 | struct device *dev; | ||
233 | } hw_regs_t; | 234 | } hw_regs_t; |
234 | 235 | ||
235 | /* | 236 | /* |
@@ -266,6 +267,10 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
266 | 267 | ||
267 | #include <asm/ide.h> | 268 | #include <asm/ide.h> |
268 | 269 | ||
270 | #ifndef MAX_HWIFS | ||
271 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | ||
272 | #endif | ||
273 | |||
269 | /* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ | 274 | /* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ |
270 | #ifndef IDE_ARCH_OBSOLETE_DEFAULTS | 275 | #ifndef IDE_ARCH_OBSOLETE_DEFAULTS |
271 | # define ide_default_io_base(index) (0) | 276 | # define ide_default_io_base(index) (0) |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index d21c305c6c64..fe26d431de87 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #ifndef _LINUX_IF_ETHER_H | 21 | #ifndef _LINUX_IF_ETHER_H |
22 | #define _LINUX_IF_ETHER_H | 22 | #define _LINUX_IF_ETHER_H |
23 | 23 | ||
24 | #include <linux/types.h> | ||
25 | |||
24 | /* | 26 | /* |
25 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble | 27 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble |
26 | * and FCS/CRC (frame check sequence). | 28 | * and FCS/CRC (frame check sequence). |
@@ -100,7 +102,7 @@ | |||
100 | struct ethhdr { | 102 | struct ethhdr { |
101 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 103 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
102 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ | 104 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ |
103 | unsigned short h_proto; /* packet type ID field */ | 105 | __be16 h_proto; /* packet type ID field */ |
104 | } __attribute__((packed)); | 106 | } __attribute__((packed)); |
105 | 107 | ||
106 | #ifdef __KERNEL__ | 108 | #ifdef __KERNEL__ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c6efce4a04a4..936f8b76114e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -927,6 +927,13 @@ extern int netdev_max_backlog; | |||
927 | extern int weight_p; | 927 | extern int weight_p; |
928 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); | 928 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); |
929 | extern int skb_checksum_help(struct sk_buff *skb, int inward); | 929 | extern int skb_checksum_help(struct sk_buff *skb, int inward); |
930 | #ifdef CONFIG_BUG | ||
931 | extern void netdev_rx_csum_fault(struct net_device *dev); | ||
932 | #else | ||
933 | static inline void netdev_rx_csum_fault(struct net_device *dev) | ||
934 | { | ||
935 | } | ||
936 | #endif | ||
930 | /* rx skb timestamps */ | 937 | /* rx skb timestamps */ |
931 | extern void net_enable_timestamp(void); | 938 | extern void net_enable_timestamp(void); |
932 | extern void net_disable_timestamp(void); | 939 | extern void net_disable_timestamp(void); |
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h new file mode 100644 index 000000000000..6d39b518486b --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
@@ -0,0 +1,159 @@ | |||
1 | #ifndef _NF_CONNTRACK_COMMON_H | ||
2 | #define _NF_CONNTRACK_COMMON_H | ||
3 | /* Connection state tracking for netfilter. This is separated from, | ||
4 | but required by, the NAT layer; it can also be used by an iptables | ||
5 | extension. */ | ||
6 | enum ip_conntrack_info | ||
7 | { | ||
8 | /* Part of an established connection (either direction). */ | ||
9 | IP_CT_ESTABLISHED, | ||
10 | |||
11 | /* Like NEW, but related to an existing connection, or ICMP error | ||
12 | (in either direction). */ | ||
13 | IP_CT_RELATED, | ||
14 | |||
15 | /* Started a new connection to track (only | ||
16 | IP_CT_DIR_ORIGINAL); may be a retransmission. */ | ||
17 | IP_CT_NEW, | ||
18 | |||
19 | /* >= this indicates reply direction */ | ||
20 | IP_CT_IS_REPLY, | ||
21 | |||
22 | /* Number of distinct IP_CT types (no NEW in reply dirn). */ | ||
23 | IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 | ||
24 | }; | ||
25 | |||
26 | /* Bitset representing status of connection. */ | ||
27 | enum ip_conntrack_status { | ||
28 | /* It's an expected connection: bit 0 set. This bit never changed */ | ||
29 | IPS_EXPECTED_BIT = 0, | ||
30 | IPS_EXPECTED = (1 << IPS_EXPECTED_BIT), | ||
31 | |||
32 | /* We've seen packets both ways: bit 1 set. Can be set, not unset. */ | ||
33 | IPS_SEEN_REPLY_BIT = 1, | ||
34 | IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT), | ||
35 | |||
36 | /* Conntrack should never be early-expired. */ | ||
37 | IPS_ASSURED_BIT = 2, | ||
38 | IPS_ASSURED = (1 << IPS_ASSURED_BIT), | ||
39 | |||
40 | /* Connection is confirmed: originating packet has left box */ | ||
41 | IPS_CONFIRMED_BIT = 3, | ||
42 | IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), | ||
43 | |||
44 | /* Connection needs src nat in orig dir. This bit never changed. */ | ||
45 | IPS_SRC_NAT_BIT = 4, | ||
46 | IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT), | ||
47 | |||
48 | /* Connection needs dst nat in orig dir. This bit never changed. */ | ||
49 | IPS_DST_NAT_BIT = 5, | ||
50 | IPS_DST_NAT = (1 << IPS_DST_NAT_BIT), | ||
51 | |||
52 | /* Both together. */ | ||
53 | IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT), | ||
54 | |||
55 | /* Connection needs TCP sequence adjusted. */ | ||
56 | IPS_SEQ_ADJUST_BIT = 6, | ||
57 | IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT), | ||
58 | |||
59 | /* NAT initialization bits. */ | ||
60 | IPS_SRC_NAT_DONE_BIT = 7, | ||
61 | IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT), | ||
62 | |||
63 | IPS_DST_NAT_DONE_BIT = 8, | ||
64 | IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT), | ||
65 | |||
66 | /* Both together */ | ||
67 | IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), | ||
68 | |||
69 | /* Connection is dying (removed from lists), can not be unset. */ | ||
70 | IPS_DYING_BIT = 9, | ||
71 | IPS_DYING = (1 << IPS_DYING_BIT), | ||
72 | }; | ||
73 | |||
74 | /* Connection tracking event bits */ | ||
75 | enum ip_conntrack_events | ||
76 | { | ||
77 | /* New conntrack */ | ||
78 | IPCT_NEW_BIT = 0, | ||
79 | IPCT_NEW = (1 << IPCT_NEW_BIT), | ||
80 | |||
81 | /* Expected connection */ | ||
82 | IPCT_RELATED_BIT = 1, | ||
83 | IPCT_RELATED = (1 << IPCT_RELATED_BIT), | ||
84 | |||
85 | /* Destroyed conntrack */ | ||
86 | IPCT_DESTROY_BIT = 2, | ||
87 | IPCT_DESTROY = (1 << IPCT_DESTROY_BIT), | ||
88 | |||
89 | /* Timer has been refreshed */ | ||
90 | IPCT_REFRESH_BIT = 3, | ||
91 | IPCT_REFRESH = (1 << IPCT_REFRESH_BIT), | ||
92 | |||
93 | /* Status has changed */ | ||
94 | IPCT_STATUS_BIT = 4, | ||
95 | IPCT_STATUS = (1 << IPCT_STATUS_BIT), | ||
96 | |||
97 | /* Update of protocol info */ | ||
98 | IPCT_PROTOINFO_BIT = 5, | ||
99 | IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT), | ||
100 | |||
101 | /* Volatile protocol info */ | ||
102 | IPCT_PROTOINFO_VOLATILE_BIT = 6, | ||
103 | IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT), | ||
104 | |||
105 | /* New helper for conntrack */ | ||
106 | IPCT_HELPER_BIT = 7, | ||
107 | IPCT_HELPER = (1 << IPCT_HELPER_BIT), | ||
108 | |||
109 | /* Update of helper info */ | ||
110 | IPCT_HELPINFO_BIT = 8, | ||
111 | IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT), | ||
112 | |||
113 | /* Volatile helper info */ | ||
114 | IPCT_HELPINFO_VOLATILE_BIT = 9, | ||
115 | IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT), | ||
116 | |||
117 | /* NAT info */ | ||
118 | IPCT_NATINFO_BIT = 10, | ||
119 | IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), | ||
120 | |||
121 | /* Counter highest bit has been set */ | ||
122 | IPCT_COUNTER_FILLING_BIT = 11, | ||
123 | IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), | ||
124 | }; | ||
125 | |||
126 | enum ip_conntrack_expect_events { | ||
127 | IPEXP_NEW_BIT = 0, | ||
128 | IPEXP_NEW = (1 << IPEXP_NEW_BIT), | ||
129 | }; | ||
130 | |||
131 | #ifdef __KERNEL__ | ||
132 | struct ip_conntrack_counter | ||
133 | { | ||
134 | u_int32_t packets; | ||
135 | u_int32_t bytes; | ||
136 | }; | ||
137 | |||
138 | struct ip_conntrack_stat | ||
139 | { | ||
140 | unsigned int searched; | ||
141 | unsigned int found; | ||
142 | unsigned int new; | ||
143 | unsigned int invalid; | ||
144 | unsigned int ignore; | ||
145 | unsigned int delete; | ||
146 | unsigned int delete_list; | ||
147 | unsigned int insert; | ||
148 | unsigned int insert_failed; | ||
149 | unsigned int drop; | ||
150 | unsigned int early_drop; | ||
151 | unsigned int error; | ||
152 | unsigned int expect_new; | ||
153 | unsigned int expect_create; | ||
154 | unsigned int expect_delete; | ||
155 | }; | ||
156 | |||
157 | #endif /* __KERNEL__ */ | ||
158 | |||
159 | #endif /* _NF_CONNTRACK_COMMON_H */ | ||
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h new file mode 100644 index 000000000000..ad4a41c9ce93 --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_ftp.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _NF_CONNTRACK_FTP_H | ||
2 | #define _NF_CONNTRACK_FTP_H | ||
3 | /* FTP tracking. */ | ||
4 | |||
5 | /* This enum is exposed to userspace */ | ||
6 | enum ip_ct_ftp_type | ||
7 | { | ||
8 | /* PORT command from client */ | ||
9 | IP_CT_FTP_PORT, | ||
10 | /* PASV response from server */ | ||
11 | IP_CT_FTP_PASV, | ||
12 | /* EPRT command from client */ | ||
13 | IP_CT_FTP_EPRT, | ||
14 | /* EPSV response from server */ | ||
15 | IP_CT_FTP_EPSV, | ||
16 | }; | ||
17 | |||
18 | #ifdef __KERNEL__ | ||
19 | |||
20 | #define FTP_PORT 21 | ||
21 | |||
22 | #define NUM_SEQ_TO_REMEMBER 2 | ||
23 | /* This structure exists only once per master */ | ||
24 | struct ip_ct_ftp_master { | ||
25 | /* Valid seq positions for cmd matching after newline */ | ||
26 | u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; | ||
27 | /* 0 means seq_match_aft_nl not set */ | ||
28 | int seq_aft_nl_num[IP_CT_DIR_MAX]; | ||
29 | }; | ||
30 | |||
31 | struct ip_conntrack_expect; | ||
32 | |||
33 | /* For NAT to hook in when we find a packet which describes what other | ||
34 | * connection we should expect. */ | ||
35 | extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb, | ||
36 | enum ip_conntrack_info ctinfo, | ||
37 | enum ip_ct_ftp_type type, | ||
38 | unsigned int matchoff, | ||
39 | unsigned int matchlen, | ||
40 | struct ip_conntrack_expect *exp, | ||
41 | u32 *seq); | ||
42 | #endif /* __KERNEL__ */ | ||
43 | |||
44 | #endif /* _NF_CONNTRACK_FTP_H */ | ||
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h new file mode 100644 index 000000000000..b8994d9fd1a9 --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_sctp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _NF_CONNTRACK_SCTP_H | ||
2 | #define _NF_CONNTRACK_SCTP_H | ||
3 | /* SCTP tracking. */ | ||
4 | |||
5 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
6 | |||
7 | enum sctp_conntrack { | ||
8 | SCTP_CONNTRACK_NONE, | ||
9 | SCTP_CONNTRACK_CLOSED, | ||
10 | SCTP_CONNTRACK_COOKIE_WAIT, | ||
11 | SCTP_CONNTRACK_COOKIE_ECHOED, | ||
12 | SCTP_CONNTRACK_ESTABLISHED, | ||
13 | SCTP_CONNTRACK_SHUTDOWN_SENT, | ||
14 | SCTP_CONNTRACK_SHUTDOWN_RECD, | ||
15 | SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, | ||
16 | SCTP_CONNTRACK_MAX | ||
17 | }; | ||
18 | |||
19 | struct ip_ct_sctp | ||
20 | { | ||
21 | enum sctp_conntrack state; | ||
22 | |||
23 | u_int32_t vtag[IP_CT_DIR_MAX]; | ||
24 | u_int32_t ttag[IP_CT_DIR_MAX]; | ||
25 | }; | ||
26 | |||
27 | #endif /* _NF_CONNTRACK_SCTP_H */ | ||
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h new file mode 100644 index 000000000000..b2feeffde384 --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_tcp.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef _NF_CONNTRACK_TCP_H | ||
2 | #define _NF_CONNTRACK_TCP_H | ||
3 | /* TCP tracking. */ | ||
4 | |||
5 | /* This is exposed to userspace (ctnetlink) */ | ||
6 | enum tcp_conntrack { | ||
7 | TCP_CONNTRACK_NONE, | ||
8 | TCP_CONNTRACK_SYN_SENT, | ||
9 | TCP_CONNTRACK_SYN_RECV, | ||
10 | TCP_CONNTRACK_ESTABLISHED, | ||
11 | TCP_CONNTRACK_FIN_WAIT, | ||
12 | TCP_CONNTRACK_CLOSE_WAIT, | ||
13 | TCP_CONNTRACK_LAST_ACK, | ||
14 | TCP_CONNTRACK_TIME_WAIT, | ||
15 | TCP_CONNTRACK_CLOSE, | ||
16 | TCP_CONNTRACK_LISTEN, | ||
17 | TCP_CONNTRACK_MAX, | ||
18 | TCP_CONNTRACK_IGNORE | ||
19 | }; | ||
20 | |||
21 | /* Window scaling is advertised by the sender */ | ||
22 | #define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01 | ||
23 | |||
24 | /* SACK is permitted by the sender */ | ||
25 | #define IP_CT_TCP_FLAG_SACK_PERM 0x02 | ||
26 | |||
27 | /* This sender sent FIN first */ | ||
28 | #define IP_CT_TCP_FLAG_CLOSE_INIT 0x03 | ||
29 | |||
30 | #ifdef __KERNEL__ | ||
31 | |||
32 | struct ip_ct_tcp_state { | ||
33 | u_int32_t td_end; /* max of seq + len */ | ||
34 | u_int32_t td_maxend; /* max of ack + max(win, 1) */ | ||
35 | u_int32_t td_maxwin; /* max(win) */ | ||
36 | u_int8_t td_scale; /* window scale factor */ | ||
37 | u_int8_t loose; /* used when connection picked up from the middle */ | ||
38 | u_int8_t flags; /* per direction options */ | ||
39 | }; | ||
40 | |||
41 | struct ip_ct_tcp | ||
42 | { | ||
43 | struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */ | ||
44 | u_int8_t state; /* state of the connection (enum tcp_conntrack) */ | ||
45 | /* For detecting stale connections */ | ||
46 | u_int8_t last_dir; /* Direction of the last packet (enum ip_conntrack_dir) */ | ||
47 | u_int8_t retrans; /* Number of retransmitted packets */ | ||
48 | u_int8_t last_index; /* Index of the last packet */ | ||
49 | u_int32_t last_seq; /* Last sequence number seen in dir */ | ||
50 | u_int32_t last_ack; /* Last sequence number seen in opposite dir */ | ||
51 | u_int32_t last_end; /* Last seq + len */ | ||
52 | }; | ||
53 | |||
54 | #endif /* __KERNEL__ */ | ||
55 | |||
56 | #endif /* _NF_CONNTRACK_TCP_H */ | ||
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h new file mode 100644 index 000000000000..8e145f0d61cb --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_tuple_common.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _NF_CONNTRACK_TUPLE_COMMON_H | ||
2 | #define _NF_CONNTRACK_TUPLE_COMMON_H | ||
3 | |||
4 | enum ip_conntrack_dir | ||
5 | { | ||
6 | IP_CT_DIR_ORIGINAL, | ||
7 | IP_CT_DIR_REPLY, | ||
8 | IP_CT_DIR_MAX | ||
9 | }; | ||
10 | |||
11 | #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) | ||
12 | |||
13 | #endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index d078bb91d9e5..b3432ab59a17 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h | |||
@@ -1,132 +1,7 @@ | |||
1 | #ifndef _IP_CONNTRACK_H | 1 | #ifndef _IP_CONNTRACK_H |
2 | #define _IP_CONNTRACK_H | 2 | #define _IP_CONNTRACK_H |
3 | /* Connection state tracking for netfilter. This is separated from, | ||
4 | but required by, the NAT layer; it can also be used by an iptables | ||
5 | extension. */ | ||
6 | enum ip_conntrack_info | ||
7 | { | ||
8 | /* Part of an established connection (either direction). */ | ||
9 | IP_CT_ESTABLISHED, | ||
10 | |||
11 | /* Like NEW, but related to an existing connection, or ICMP error | ||
12 | (in either direction). */ | ||
13 | IP_CT_RELATED, | ||
14 | |||
15 | /* Started a new connection to track (only | ||
16 | IP_CT_DIR_ORIGINAL); may be a retransmission. */ | ||
17 | IP_CT_NEW, | ||
18 | |||
19 | /* >= this indicates reply direction */ | ||
20 | IP_CT_IS_REPLY, | ||
21 | |||
22 | /* Number of distinct IP_CT types (no NEW in reply dirn). */ | ||
23 | IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 | ||
24 | }; | ||
25 | |||
26 | /* Bitset representing status of connection. */ | ||
27 | enum ip_conntrack_status { | ||
28 | /* It's an expected connection: bit 0 set. This bit never changed */ | ||
29 | IPS_EXPECTED_BIT = 0, | ||
30 | IPS_EXPECTED = (1 << IPS_EXPECTED_BIT), | ||
31 | |||
32 | /* We've seen packets both ways: bit 1 set. Can be set, not unset. */ | ||
33 | IPS_SEEN_REPLY_BIT = 1, | ||
34 | IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT), | ||
35 | |||
36 | /* Conntrack should never be early-expired. */ | ||
37 | IPS_ASSURED_BIT = 2, | ||
38 | IPS_ASSURED = (1 << IPS_ASSURED_BIT), | ||
39 | |||
40 | /* Connection is confirmed: originating packet has left box */ | ||
41 | IPS_CONFIRMED_BIT = 3, | ||
42 | IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), | ||
43 | |||
44 | /* Connection needs src nat in orig dir. This bit never changed. */ | ||
45 | IPS_SRC_NAT_BIT = 4, | ||
46 | IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT), | ||
47 | |||
48 | /* Connection needs dst nat in orig dir. This bit never changed. */ | ||
49 | IPS_DST_NAT_BIT = 5, | ||
50 | IPS_DST_NAT = (1 << IPS_DST_NAT_BIT), | ||
51 | |||
52 | /* Both together. */ | ||
53 | IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT), | ||
54 | |||
55 | /* Connection needs TCP sequence adjusted. */ | ||
56 | IPS_SEQ_ADJUST_BIT = 6, | ||
57 | IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT), | ||
58 | |||
59 | /* NAT initialization bits. */ | ||
60 | IPS_SRC_NAT_DONE_BIT = 7, | ||
61 | IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT), | ||
62 | |||
63 | IPS_DST_NAT_DONE_BIT = 8, | ||
64 | IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT), | ||
65 | |||
66 | /* Both together */ | ||
67 | IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), | ||
68 | |||
69 | /* Connection is dying (removed from lists), can not be unset. */ | ||
70 | IPS_DYING_BIT = 9, | ||
71 | IPS_DYING = (1 << IPS_DYING_BIT), | ||
72 | }; | ||
73 | |||
74 | /* Connection tracking event bits */ | ||
75 | enum ip_conntrack_events | ||
76 | { | ||
77 | /* New conntrack */ | ||
78 | IPCT_NEW_BIT = 0, | ||
79 | IPCT_NEW = (1 << IPCT_NEW_BIT), | ||
80 | |||
81 | /* Expected connection */ | ||
82 | IPCT_RELATED_BIT = 1, | ||
83 | IPCT_RELATED = (1 << IPCT_RELATED_BIT), | ||
84 | |||
85 | /* Destroyed conntrack */ | ||
86 | IPCT_DESTROY_BIT = 2, | ||
87 | IPCT_DESTROY = (1 << IPCT_DESTROY_BIT), | ||
88 | |||
89 | /* Timer has been refreshed */ | ||
90 | IPCT_REFRESH_BIT = 3, | ||
91 | IPCT_REFRESH = (1 << IPCT_REFRESH_BIT), | ||
92 | |||
93 | /* Status has changed */ | ||
94 | IPCT_STATUS_BIT = 4, | ||
95 | IPCT_STATUS = (1 << IPCT_STATUS_BIT), | ||
96 | |||
97 | /* Update of protocol info */ | ||
98 | IPCT_PROTOINFO_BIT = 5, | ||
99 | IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT), | ||
100 | |||
101 | /* Volatile protocol info */ | ||
102 | IPCT_PROTOINFO_VOLATILE_BIT = 6, | ||
103 | IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT), | ||
104 | |||
105 | /* New helper for conntrack */ | ||
106 | IPCT_HELPER_BIT = 7, | ||
107 | IPCT_HELPER = (1 << IPCT_HELPER_BIT), | ||
108 | |||
109 | /* Update of helper info */ | ||
110 | IPCT_HELPINFO_BIT = 8, | ||
111 | IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT), | ||
112 | |||
113 | /* Volatile helper info */ | ||
114 | IPCT_HELPINFO_VOLATILE_BIT = 9, | ||
115 | IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT), | ||
116 | 3 | ||
117 | /* NAT info */ | 4 | #include <linux/netfilter/nf_conntrack_common.h> |
118 | IPCT_NATINFO_BIT = 10, | ||
119 | IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), | ||
120 | |||
121 | /* Counter highest bit has been set */ | ||
122 | IPCT_COUNTER_FILLING_BIT = 11, | ||
123 | IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), | ||
124 | }; | ||
125 | |||
126 | enum ip_conntrack_expect_events { | ||
127 | IPEXP_NEW_BIT = 0, | ||
128 | IPEXP_NEW = (1 << IPEXP_NEW_BIT), | ||
129 | }; | ||
130 | 5 | ||
131 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
132 | #include <linux/config.h> | 7 | #include <linux/config.h> |
@@ -194,12 +69,6 @@ do { \ | |||
194 | #define IP_NF_ASSERT(x) | 69 | #define IP_NF_ASSERT(x) |
195 | #endif | 70 | #endif |
196 | 71 | ||
197 | struct ip_conntrack_counter | ||
198 | { | ||
199 | u_int32_t packets; | ||
200 | u_int32_t bytes; | ||
201 | }; | ||
202 | |||
203 | struct ip_conntrack_helper; | 72 | struct ip_conntrack_helper; |
204 | 73 | ||
205 | struct ip_conntrack | 74 | struct ip_conntrack |
@@ -426,25 +295,6 @@ static inline int is_dying(struct ip_conntrack *ct) | |||
426 | 295 | ||
427 | extern unsigned int ip_conntrack_htable_size; | 296 | extern unsigned int ip_conntrack_htable_size; |
428 | 297 | ||
429 | struct ip_conntrack_stat | ||
430 | { | ||
431 | unsigned int searched; | ||
432 | unsigned int found; | ||
433 | unsigned int new; | ||
434 | unsigned int invalid; | ||
435 | unsigned int ignore; | ||
436 | unsigned int delete; | ||
437 | unsigned int delete_list; | ||
438 | unsigned int insert; | ||
439 | unsigned int insert_failed; | ||
440 | unsigned int drop; | ||
441 | unsigned int early_drop; | ||
442 | unsigned int error; | ||
443 | unsigned int expect_new; | ||
444 | unsigned int expect_create; | ||
445 | unsigned int expect_delete; | ||
446 | }; | ||
447 | |||
448 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) | 298 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) |
449 | 299 | ||
450 | #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS | 300 | #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h index 5f06429b9047..63811934de4d 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h | |||
@@ -1,43 +1,6 @@ | |||
1 | #ifndef _IP_CONNTRACK_FTP_H | 1 | #ifndef _IP_CONNTRACK_FTP_H |
2 | #define _IP_CONNTRACK_FTP_H | 2 | #define _IP_CONNTRACK_FTP_H |
3 | /* FTP tracking. */ | ||
4 | 3 | ||
5 | #ifdef __KERNEL__ | 4 | #include <linux/netfilter/nf_conntrack_ftp.h> |
6 | 5 | ||
7 | #define FTP_PORT 21 | ||
8 | |||
9 | #endif /* __KERNEL__ */ | ||
10 | |||
11 | enum ip_ct_ftp_type | ||
12 | { | ||
13 | /* PORT command from client */ | ||
14 | IP_CT_FTP_PORT, | ||
15 | /* PASV response from server */ | ||
16 | IP_CT_FTP_PASV, | ||
17 | /* EPRT command from client */ | ||
18 | IP_CT_FTP_EPRT, | ||
19 | /* EPSV response from server */ | ||
20 | IP_CT_FTP_EPSV, | ||
21 | }; | ||
22 | |||
23 | #define NUM_SEQ_TO_REMEMBER 2 | ||
24 | /* This structure exists only once per master */ | ||
25 | struct ip_ct_ftp_master { | ||
26 | /* Valid seq positions for cmd matching after newline */ | ||
27 | u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; | ||
28 | /* 0 means seq_match_aft_nl not set */ | ||
29 | int seq_aft_nl_num[IP_CT_DIR_MAX]; | ||
30 | }; | ||
31 | |||
32 | struct ip_conntrack_expect; | ||
33 | |||
34 | /* For NAT to hook in when we find a packet which describes what other | ||
35 | * connection we should expect. */ | ||
36 | extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb, | ||
37 | enum ip_conntrack_info ctinfo, | ||
38 | enum ip_ct_ftp_type type, | ||
39 | unsigned int matchoff, | ||
40 | unsigned int matchlen, | ||
41 | struct ip_conntrack_expect *exp, | ||
42 | u32 *seq); | ||
43 | #endif /* _IP_CONNTRACK_FTP_H */ | 6 | #endif /* _IP_CONNTRACK_FTP_H */ |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h index f1664abbe392..eed5ee3e4744 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h | |||
@@ -1,11 +1,6 @@ | |||
1 | #ifndef _IP_CONNTRACK_ICMP_H | 1 | #ifndef _IP_CONNTRACK_ICMP_H |
2 | #define _IP_CONNTRACK_ICMP_H | 2 | #define _IP_CONNTRACK_ICMP_H |
3 | /* ICMP tracking. */ | ||
4 | #include <asm/atomic.h> | ||
5 | 3 | ||
6 | struct ip_ct_icmp | 4 | #include <net/netfilter/ipv4/nf_conntrack_icmp.h> |
7 | { | 5 | |
8 | /* Optimization: when number in == number out, forget immediately. */ | ||
9 | atomic_t count; | ||
10 | }; | ||
11 | #endif /* _IP_CONNTRACK_ICMP_H */ | 6 | #endif /* _IP_CONNTRACK_ICMP_H */ |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h index 7a8d869321f7..4099a041a32a 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h | |||
@@ -1,25 +1,6 @@ | |||
1 | #ifndef _IP_CONNTRACK_SCTP_H | 1 | #ifndef _IP_CONNTRACK_SCTP_H |
2 | #define _IP_CONNTRACK_SCTP_H | 2 | #define _IP_CONNTRACK_SCTP_H |
3 | /* SCTP tracking. */ | ||
4 | 3 | ||
5 | enum sctp_conntrack { | 4 | #include <linux/netfilter/nf_conntrack_sctp.h> |
6 | SCTP_CONNTRACK_NONE, | ||
7 | SCTP_CONNTRACK_CLOSED, | ||
8 | SCTP_CONNTRACK_COOKIE_WAIT, | ||
9 | SCTP_CONNTRACK_COOKIE_ECHOED, | ||
10 | SCTP_CONNTRACK_ESTABLISHED, | ||
11 | SCTP_CONNTRACK_SHUTDOWN_SENT, | ||
12 | SCTP_CONNTRACK_SHUTDOWN_RECD, | ||
13 | SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, | ||
14 | SCTP_CONNTRACK_MAX | ||
15 | }; | ||
16 | |||
17 | struct ip_ct_sctp | ||
18 | { | ||
19 | enum sctp_conntrack state; | ||
20 | |||
21 | u_int32_t vtag[IP_CT_DIR_MAX]; | ||
22 | u_int32_t ttag[IP_CT_DIR_MAX]; | ||
23 | }; | ||
24 | 5 | ||
25 | #endif /* _IP_CONNTRACK_SCTP_H */ | 6 | #endif /* _IP_CONNTRACK_SCTP_H */ |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h index 16da044d97a7..876b8fb17e68 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h | |||
@@ -1,51 +1,6 @@ | |||
1 | #ifndef _IP_CONNTRACK_TCP_H | 1 | #ifndef _IP_CONNTRACK_TCP_H |
2 | #define _IP_CONNTRACK_TCP_H | 2 | #define _IP_CONNTRACK_TCP_H |
3 | /* TCP tracking. */ | ||
4 | 3 | ||
5 | enum tcp_conntrack { | 4 | #include <linux/netfilter/nf_conntrack_tcp.h> |
6 | TCP_CONNTRACK_NONE, | ||
7 | TCP_CONNTRACK_SYN_SENT, | ||
8 | TCP_CONNTRACK_SYN_RECV, | ||
9 | TCP_CONNTRACK_ESTABLISHED, | ||
10 | TCP_CONNTRACK_FIN_WAIT, | ||
11 | TCP_CONNTRACK_CLOSE_WAIT, | ||
12 | TCP_CONNTRACK_LAST_ACK, | ||
13 | TCP_CONNTRACK_TIME_WAIT, | ||
14 | TCP_CONNTRACK_CLOSE, | ||
15 | TCP_CONNTRACK_LISTEN, | ||
16 | TCP_CONNTRACK_MAX, | ||
17 | TCP_CONNTRACK_IGNORE | ||
18 | }; | ||
19 | |||
20 | /* Window scaling is advertised by the sender */ | ||
21 | #define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01 | ||
22 | |||
23 | /* SACK is permitted by the sender */ | ||
24 | #define IP_CT_TCP_FLAG_SACK_PERM 0x02 | ||
25 | |||
26 | /* This sender sent FIN first */ | ||
27 | #define IP_CT_TCP_FLAG_CLOSE_INIT 0x03 | ||
28 | |||
29 | struct ip_ct_tcp_state { | ||
30 | u_int32_t td_end; /* max of seq + len */ | ||
31 | u_int32_t td_maxend; /* max of ack + max(win, 1) */ | ||
32 | u_int32_t td_maxwin; /* max(win) */ | ||
33 | u_int8_t td_scale; /* window scale factor */ | ||
34 | u_int8_t loose; /* used when connection picked up from the middle */ | ||
35 | u_int8_t flags; /* per direction options */ | ||
36 | }; | ||
37 | |||
38 | struct ip_ct_tcp | ||
39 | { | ||
40 | struct ip_ct_tcp_state seen[2]; /* connection parameters per direction */ | ||
41 | u_int8_t state; /* state of the connection (enum tcp_conntrack) */ | ||
42 | /* For detecting stale connections */ | ||
43 | u_int8_t last_dir; /* Direction of the last packet (enum ip_conntrack_dir) */ | ||
44 | u_int8_t retrans; /* Number of retransmitted packets */ | ||
45 | u_int8_t last_index; /* Index of the last packet */ | ||
46 | u_int32_t last_seq; /* Last sequence number seen in dir */ | ||
47 | u_int32_t last_ack; /* Last sequence number seen in opposite dir */ | ||
48 | u_int32_t last_end; /* Last seq + len */ | ||
49 | }; | ||
50 | 5 | ||
51 | #endif /* _IP_CONNTRACK_TCP_H */ | 6 | #endif /* _IP_CONNTRACK_TCP_H */ |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h index 3232db11a4e5..2fdabdb4c0ef 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _IP_CONNTRACK_TUPLE_H | 2 | #define _IP_CONNTRACK_TUPLE_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
5 | 6 | ||
6 | /* A `tuple' is a structure containing the information to uniquely | 7 | /* A `tuple' is a structure containing the information to uniquely |
7 | identify a connection. ie. if two packets have the same tuple, they | 8 | identify a connection. ie. if two packets have the same tuple, they |
@@ -88,13 +89,6 @@ struct ip_conntrack_tuple | |||
88 | (tuple)->dst.u.all = 0; \ | 89 | (tuple)->dst.u.all = 0; \ |
89 | } while (0) | 90 | } while (0) |
90 | 91 | ||
91 | enum ip_conntrack_dir | ||
92 | { | ||
93 | IP_CT_DIR_ORIGINAL, | ||
94 | IP_CT_DIR_REPLY, | ||
95 | IP_CT_DIR_MAX | ||
96 | }; | ||
97 | |||
98 | #ifdef __KERNEL__ | 92 | #ifdef __KERNEL__ |
99 | 93 | ||
100 | #define DUMP_TUPLE(tp) \ | 94 | #define DUMP_TUPLE(tp) \ |
@@ -103,8 +97,6 @@ DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \ | |||
103 | NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \ | 97 | NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \ |
104 | NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all)) | 98 | NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all)) |
105 | 99 | ||
106 | #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) | ||
107 | |||
108 | /* If we're the first tuple, it's the original dir. */ | 100 | /* If we're the first tuple, it's the original dir. */ |
109 | #define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir) | 101 | #define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir) |
110 | 102 | ||
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index edcc2c6eb5c7..53b2983f6278 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
@@ -59,6 +59,7 @@ | |||
59 | 59 | ||
60 | enum nf_ip6_hook_priorities { | 60 | enum nf_ip6_hook_priorities { |
61 | NF_IP6_PRI_FIRST = INT_MIN, | 61 | NF_IP6_PRI_FIRST = INT_MIN, |
62 | NF_IP6_PRI_CONNTRACK_DEFRAG = -400, | ||
62 | NF_IP6_PRI_SELINUX_FIRST = -225, | 63 | NF_IP6_PRI_SELINUX_FIRST = -225, |
63 | NF_IP6_PRI_CONNTRACK = -200, | 64 | NF_IP6_PRI_CONNTRACK = -200, |
64 | NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD = -175, | 65 | NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD = -175, |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index ba25ca874c20..6a2ccf78a356 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -71,7 +71,8 @@ struct nlmsghdr | |||
71 | 71 | ||
72 | #define NLMSG_ALIGNTO 4 | 72 | #define NLMSG_ALIGNTO 4 |
73 | #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) | 73 | #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) |
74 | #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr))) | 74 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) |
75 | #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) | ||
75 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) | 76 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) |
76 | #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) | 77 | #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) |
77 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ | 78 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ |
@@ -86,6 +87,8 @@ struct nlmsghdr | |||
86 | #define NLMSG_DONE 0x3 /* End of a dump */ | 87 | #define NLMSG_DONE 0x3 /* End of a dump */ |
87 | #define NLMSG_OVERRUN 0x4 /* Data lost */ | 88 | #define NLMSG_OVERRUN 0x4 /* Data lost */ |
88 | 89 | ||
90 | #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ | ||
91 | |||
89 | struct nlmsgerr | 92 | struct nlmsgerr |
90 | { | 93 | { |
91 | int error; | 94 | int error; |
@@ -108,6 +111,25 @@ enum { | |||
108 | NETLINK_CONNECTED, | 111 | NETLINK_CONNECTED, |
109 | }; | 112 | }; |
110 | 113 | ||
114 | /* | ||
115 | * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> | ||
116 | * +---------------------+- - -+- - - - - - - - - -+- - -+ | ||
117 | * | Header | Pad | Payload | Pad | | ||
118 | * | (struct nlattr) | ing | | ing | | ||
119 | * +---------------------+- - -+- - - - - - - - - -+- - -+ | ||
120 | * <-------------- nlattr->nla_len --------------> | ||
121 | */ | ||
122 | |||
123 | struct nlattr | ||
124 | { | ||
125 | __u16 nla_len; | ||
126 | __u16 nla_type; | ||
127 | }; | ||
128 | |||
129 | #define NLA_ALIGNTO 4 | ||
130 | #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) | ||
131 | #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) | ||
132 | |||
111 | #ifdef __KERNEL__ | 133 | #ifdef __KERNEL__ |
112 | 134 | ||
113 | #include <linux/capability.h> | 135 | #include <linux/capability.h> |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 9a96f0588393..4e06eb0f4451 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -387,6 +387,7 @@ | |||
387 | #define PCI_DEVICE_ID_NS_SC1100_SMI 0x0511 | 387 | #define PCI_DEVICE_ID_NS_SC1100_SMI 0x0511 |
388 | #define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515 | 388 | #define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515 |
389 | #define PCI_DEVICE_ID_NS_87410 0xd001 | 389 | #define PCI_DEVICE_ID_NS_87410 0xd001 |
390 | #define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d | ||
390 | 391 | ||
391 | #define PCI_VENDOR_ID_TSENG 0x100c | 392 | #define PCI_VENDOR_ID_TSENG 0x100c |
392 | #define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 | 393 | #define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 |
@@ -487,6 +488,8 @@ | |||
487 | #define PCI_DEVICE_ID_AMD_8151_0 0x7454 | 488 | #define PCI_DEVICE_ID_AMD_8151_0 0x7454 |
488 | #define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 | 489 | #define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 |
489 | 490 | ||
491 | #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A | ||
492 | |||
490 | #define PCI_VENDOR_ID_TRIDENT 0x1023 | 493 | #define PCI_VENDOR_ID_TRIDENT 0x1023 |
491 | #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 | 494 | #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 |
492 | #define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 | 495 | #define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index fdfb8fe8c38c..0a8ea8b35816 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -274,6 +274,9 @@ struct sk_buff { | |||
274 | #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) | 274 | #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) |
275 | __u8 ipvs_property:1; | 275 | __u8 ipvs_property:1; |
276 | #endif | 276 | #endif |
277 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
278 | struct sk_buff *nfct_reasm; | ||
279 | #endif | ||
277 | #ifdef CONFIG_BRIDGE_NETFILTER | 280 | #ifdef CONFIG_BRIDGE_NETFILTER |
278 | struct nf_bridge_info *nf_bridge; | 281 | struct nf_bridge_info *nf_bridge; |
279 | #endif | 282 | #endif |
@@ -1233,8 +1236,7 @@ extern unsigned int datagram_poll(struct file *file, struct socket *sock, | |||
1233 | extern int skb_copy_datagram_iovec(const struct sk_buff *from, | 1236 | extern int skb_copy_datagram_iovec(const struct sk_buff *from, |
1234 | int offset, struct iovec *to, | 1237 | int offset, struct iovec *to, |
1235 | int size); | 1238 | int size); |
1236 | extern int skb_copy_and_csum_datagram_iovec(const | 1239 | extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, |
1237 | struct sk_buff *skb, | ||
1238 | int hlen, | 1240 | int hlen, |
1239 | struct iovec *iov); | 1241 | struct iovec *iov); |
1240 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); | 1242 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); |
@@ -1302,6 +1304,30 @@ static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval * | |||
1302 | 1304 | ||
1303 | extern void __net_timestamp(struct sk_buff *skb); | 1305 | extern void __net_timestamp(struct sk_buff *skb); |
1304 | 1306 | ||
1307 | extern unsigned int __skb_checksum_complete(struct sk_buff *skb); | ||
1308 | |||
1309 | /** | ||
1310 | * skb_checksum_complete - Calculate checksum of an entire packet | ||
1311 | * @skb: packet to process | ||
1312 | * | ||
1313 | * This function calculates the checksum over the entire packet plus | ||
1314 | * the value of skb->csum. The latter can be used to supply the | ||
1315 | * checksum of a pseudo header as used by TCP/UDP. It returns the | ||
1316 | * checksum. | ||
1317 | * | ||
1318 | * For protocols that contain complete checksums such as ICMP/TCP/UDP, | ||
1319 | * this function can be used to verify that checksum on received | ||
1320 | * packets. In that case the function should return zero if the | ||
1321 | * checksum is correct. In particular, this function will return zero | ||
1322 | * if skb->ip_summed is CHECKSUM_UNNECESSARY which indicates that the | ||
1323 | * hardware has already verified the correctness of the checksum. | ||
1324 | */ | ||
1325 | static inline unsigned int skb_checksum_complete(struct sk_buff *skb) | ||
1326 | { | ||
1327 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | ||
1328 | __skb_checksum_complete(skb); | ||
1329 | } | ||
1330 | |||
1305 | #ifdef CONFIG_NETFILTER | 1331 | #ifdef CONFIG_NETFILTER |
1306 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) | 1332 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) |
1307 | { | 1333 | { |
@@ -1313,10 +1339,26 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct) | |||
1313 | if (nfct) | 1339 | if (nfct) |
1314 | atomic_inc(&nfct->use); | 1340 | atomic_inc(&nfct->use); |
1315 | } | 1341 | } |
1342 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
1343 | static inline void nf_conntrack_get_reasm(struct sk_buff *skb) | ||
1344 | { | ||
1345 | if (skb) | ||
1346 | atomic_inc(&skb->users); | ||
1347 | } | ||
1348 | static inline void nf_conntrack_put_reasm(struct sk_buff *skb) | ||
1349 | { | ||
1350 | if (skb) | ||
1351 | kfree_skb(skb); | ||
1352 | } | ||
1353 | #endif | ||
1316 | static inline void nf_reset(struct sk_buff *skb) | 1354 | static inline void nf_reset(struct sk_buff *skb) |
1317 | { | 1355 | { |
1318 | nf_conntrack_put(skb->nfct); | 1356 | nf_conntrack_put(skb->nfct); |
1319 | skb->nfct = NULL; | 1357 | skb->nfct = NULL; |
1358 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
1359 | nf_conntrack_put_reasm(skb->nfct_reasm); | ||
1360 | skb->nfct_reasm = NULL; | ||
1361 | #endif | ||
1320 | } | 1362 | } |
1321 | 1363 | ||
1322 | #ifdef CONFIG_BRIDGE_NETFILTER | 1364 | #ifdef CONFIG_BRIDGE_NETFILTER |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index fc131d6602b9..22cf5e1ac987 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -205,6 +205,7 @@ enum | |||
205 | NET_ECONET=16, | 205 | NET_ECONET=16, |
206 | NET_SCTP=17, | 206 | NET_SCTP=17, |
207 | NET_LLC=18, | 207 | NET_LLC=18, |
208 | NET_NETFILTER=19, | ||
208 | }; | 209 | }; |
209 | 210 | ||
210 | /* /proc/sys/kernel/random */ | 211 | /* /proc/sys/kernel/random */ |
@@ -270,6 +271,42 @@ enum | |||
270 | NET_UNIX_MAX_DGRAM_QLEN=3, | 271 | NET_UNIX_MAX_DGRAM_QLEN=3, |
271 | }; | 272 | }; |
272 | 273 | ||
274 | /* /proc/sys/net/netfilter */ | ||
275 | enum | ||
276 | { | ||
277 | NET_NF_CONNTRACK_MAX=1, | ||
278 | NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, | ||
279 | NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, | ||
280 | NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, | ||
281 | NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, | ||
282 | NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, | ||
283 | NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, | ||
284 | NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, | ||
285 | NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, | ||
286 | NET_NF_CONNTRACK_UDP_TIMEOUT=10, | ||
287 | NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, | ||
288 | NET_NF_CONNTRACK_ICMP_TIMEOUT=12, | ||
289 | NET_NF_CONNTRACK_GENERIC_TIMEOUT=13, | ||
290 | NET_NF_CONNTRACK_BUCKETS=14, | ||
291 | NET_NF_CONNTRACK_LOG_INVALID=15, | ||
292 | NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, | ||
293 | NET_NF_CONNTRACK_TCP_LOOSE=17, | ||
294 | NET_NF_CONNTRACK_TCP_BE_LIBERAL=18, | ||
295 | NET_NF_CONNTRACK_TCP_MAX_RETRANS=19, | ||
296 | NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, | ||
297 | NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, | ||
298 | NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, | ||
299 | NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, | ||
300 | NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, | ||
301 | NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, | ||
302 | NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, | ||
303 | NET_NF_CONNTRACK_COUNT=27, | ||
304 | NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28, | ||
305 | NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, | ||
306 | NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, | ||
307 | NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, | ||
308 | }; | ||
309 | |||
273 | /* /proc/sys/net/ipv4 */ | 310 | /* /proc/sys/net/ipv4 */ |
274 | enum | 311 | enum |
275 | { | 312 | { |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h new file mode 100644 index 000000000000..52d8b1a73d52 --- /dev/null +++ b/include/net/genetlink.h | |||
@@ -0,0 +1,154 @@ | |||
1 | #ifndef __NET_GENERIC_NETLINK_H | ||
2 | #define __NET_GENERIC_NETLINK_H | ||
3 | |||
4 | #include <linux/genetlink.h> | ||
5 | #include <net/netlink.h> | ||
6 | |||
7 | /** | ||
8 | * struct genl_family - generic netlink family | ||
9 | * @id: protocol family idenfitier | ||
10 | * @hdrsize: length of user specific header in bytes | ||
11 | * @name: name of family | ||
12 | * @version: protocol version | ||
13 | * @maxattr: maximum number of attributes supported | ||
14 | * @attrbuf: buffer to store parsed attributes | ||
15 | * @ops_list: list of all assigned operations | ||
16 | * @family_list: family list | ||
17 | */ | ||
18 | struct genl_family | ||
19 | { | ||
20 | unsigned int id; | ||
21 | unsigned int hdrsize; | ||
22 | char name[GENL_NAMSIZ]; | ||
23 | unsigned int version; | ||
24 | unsigned int maxattr; | ||
25 | struct module * owner; | ||
26 | struct nlattr ** attrbuf; /* private */ | ||
27 | struct list_head ops_list; /* private */ | ||
28 | struct list_head family_list; /* private */ | ||
29 | }; | ||
30 | |||
31 | #define GENL_ADMIN_PERM 0x01 | ||
32 | |||
33 | /** | ||
34 | * struct genl_info - receiving information | ||
35 | * @snd_seq: sending sequence number | ||
36 | * @snd_pid: netlink pid of sender | ||
37 | * @nlhdr: netlink message header | ||
38 | * @genlhdr: generic netlink message header | ||
39 | * @userhdr: user specific header | ||
40 | * @attrs: netlink attributes | ||
41 | */ | ||
42 | struct genl_info | ||
43 | { | ||
44 | u32 snd_seq; | ||
45 | u32 snd_pid; | ||
46 | struct nlmsghdr * nlhdr; | ||
47 | struct genlmsghdr * genlhdr; | ||
48 | void * userhdr; | ||
49 | struct nlattr ** attrs; | ||
50 | }; | ||
51 | |||
52 | /** | ||
53 | * struct genl_ops - generic netlink operations | ||
54 | * @cmd: command identifier | ||
55 | * @flags: flags | ||
56 | * @policy: attribute validation policy | ||
57 | * @doit: standard command callback | ||
58 | * @dumpit: callback for dumpers | ||
59 | * @ops_list: operations list | ||
60 | */ | ||
61 | struct genl_ops | ||
62 | { | ||
63 | unsigned int cmd; | ||
64 | unsigned int flags; | ||
65 | struct nla_policy *policy; | ||
66 | int (*doit)(struct sk_buff *skb, | ||
67 | struct genl_info *info); | ||
68 | int (*dumpit)(struct sk_buff *skb, | ||
69 | struct netlink_callback *cb); | ||
70 | struct list_head ops_list; | ||
71 | }; | ||
72 | |||
73 | extern int genl_register_family(struct genl_family *family); | ||
74 | extern int genl_unregister_family(struct genl_family *family); | ||
75 | extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); | ||
76 | extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); | ||
77 | |||
78 | extern struct sock *genl_sock; | ||
79 | |||
80 | /** | ||
81 | * genlmsg_put - Add generic netlink header to netlink message | ||
82 | * @skb: socket buffer holding the message | ||
83 | * @pid: netlink pid the message is addressed to | ||
84 | * @seq: sequence number (usually the one of the sender) | ||
85 | * @type: netlink message type | ||
86 | * @hdrlen: length of the user specific header | ||
87 | * @flags netlink message flags | ||
88 | * @cmd: generic netlink command | ||
89 | * @version: version | ||
90 | * | ||
91 | * Returns pointer to user specific header | ||
92 | */ | ||
93 | static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, | ||
94 | int type, int hdrlen, int flags, | ||
95 | u8 cmd, u8 version) | ||
96 | { | ||
97 | struct nlmsghdr *nlh; | ||
98 | struct genlmsghdr *hdr; | ||
99 | |||
100 | nlh = nlmsg_put(skb, pid, seq, type, GENL_HDRLEN + hdrlen, flags); | ||
101 | if (nlh == NULL) | ||
102 | return NULL; | ||
103 | |||
104 | hdr = nlmsg_data(nlh); | ||
105 | hdr->cmd = cmd; | ||
106 | hdr->version = version; | ||
107 | hdr->reserved = 0; | ||
108 | |||
109 | return (char *) hdr + GENL_HDRLEN; | ||
110 | } | ||
111 | |||
112 | /** | ||
113 | * genlmsg_end - Finalize a generic netlink message | ||
114 | * @skb: socket buffer the message is stored in | ||
115 | * @hdr: user specific header | ||
116 | */ | ||
117 | static inline int genlmsg_end(struct sk_buff *skb, void *hdr) | ||
118 | { | ||
119 | return nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * genlmsg_cancel - Cancel construction of a generic netlink message | ||
124 | * @skb: socket buffer the message is stored in | ||
125 | * @hdr: generic netlink message header | ||
126 | */ | ||
127 | static inline int genlmsg_cancel(struct sk_buff *skb, void *hdr) | ||
128 | { | ||
129 | return nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN); | ||
130 | } | ||
131 | |||
132 | /** | ||
133 | * genlmsg_multicast - multicast a netlink message | ||
134 | * @skb: netlink message as socket buffer | ||
135 | * @pid: own netlink pid to avoid sending to yourself | ||
136 | * @group: multicast group id | ||
137 | */ | ||
138 | static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, | ||
139 | unsigned int group) | ||
140 | { | ||
141 | return nlmsg_multicast(genl_sock, skb, pid, group); | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * genlmsg_unicast - unicast a netlink message | ||
146 | * @skb: netlink message as socket buffer | ||
147 | * @pid: netlink pid of the destination socket | ||
148 | */ | ||
149 | static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid) | ||
150 | { | ||
151 | return nlmsg_unicast(genl_sock, skb, pid); | ||
152 | } | ||
153 | |||
154 | #endif /* __NET_GENERIC_NETLINK_H */ | ||
diff --git a/include/net/netfilter/ipv4/nf_conntrack_icmp.h b/include/net/netfilter/ipv4/nf_conntrack_icmp.h new file mode 100644 index 000000000000..3dd22cff23ec --- /dev/null +++ b/include/net/netfilter/ipv4/nf_conntrack_icmp.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _NF_CONNTRACK_ICMP_H | ||
2 | #define _NF_CONNTRACK_ICMP_H | ||
3 | /* ICMP tracking. */ | ||
4 | #include <asm/atomic.h> | ||
5 | |||
6 | struct ip_ct_icmp | ||
7 | { | ||
8 | /* Optimization: when number in == number out, forget immediately. */ | ||
9 | atomic_t count; | ||
10 | }; | ||
11 | #endif /* _NF_CONNTRACK_ICMP_H */ | ||
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h new file mode 100644 index 000000000000..25b081a730e6 --- /dev/null +++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * IPv4 support for nf_conntrack. | ||
3 | * | ||
4 | * 23 Mar 2004: Yasuyuki Kozakai @ USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
5 | * - move L3 protocol dependent part from include/linux/netfilter_ipv4/ | ||
6 | * ip_conntarck.h | ||
7 | */ | ||
8 | |||
9 | #ifndef _NF_CONNTRACK_IPV4_H | ||
10 | #define _NF_CONNTRACK_IPV4_H | ||
11 | |||
12 | #ifdef CONFIG_IP_NF_NAT_NEEDED | ||
13 | #include <linux/netfilter_ipv4/ip_nat.h> | ||
14 | |||
15 | /* per conntrack: nat application helper private data */ | ||
16 | union ip_conntrack_nat_help { | ||
17 | /* insert nat helper private data here */ | ||
18 | }; | ||
19 | |||
20 | struct nf_conntrack_ipv4_nat { | ||
21 | struct ip_nat_info info; | ||
22 | union ip_conntrack_nat_help help; | ||
23 | #if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ | ||
24 | defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) | ||
25 | int masq_index; | ||
26 | #endif | ||
27 | }; | ||
28 | #endif /* CONFIG_IP_NF_NAT_NEEDED */ | ||
29 | |||
30 | struct nf_conntrack_ipv4 { | ||
31 | #ifdef CONFIG_IP_NF_NAT_NEEDED | ||
32 | struct nf_conntrack_ipv4_nat *nat; | ||
33 | #endif | ||
34 | }; | ||
35 | |||
36 | /* Returns new sk_buff, or NULL */ | ||
37 | struct sk_buff * | ||
38 | nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb); | ||
39 | |||
40 | /* call to create an explicit dependency on nf_conntrack_l3proto_ipv4. */ | ||
41 | extern void need_ip_conntrack(void); | ||
42 | |||
43 | #endif /*_NF_CONNTRACK_IPV4_H*/ | ||
diff --git a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h new file mode 100644 index 000000000000..86591afda29c --- /dev/null +++ b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * ICMPv6 tracking. | ||
3 | * | ||
4 | * 21 Apl 2004: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
5 | * - separated from nf_conntrack_icmp.h | ||
6 | * | ||
7 | * Derived from include/linux/netfiter_ipv4/ip_conntrack_icmp.h | ||
8 | */ | ||
9 | |||
10 | #ifndef _NF_CONNTRACK_ICMPV6_H | ||
11 | #define _NF_CONNTRACK_ICMPV6_H | ||
12 | #include <asm/atomic.h> | ||
13 | |||
14 | #ifndef ICMPV6_NI_QUERY | ||
15 | #define ICMPV6_NI_QUERY 139 | ||
16 | #endif | ||
17 | #ifndef ICMPV6_NI_REPLY | ||
18 | #define ICMPV6_NI_REPLY 140 | ||
19 | #endif | ||
20 | |||
21 | struct nf_ct_icmpv6 | ||
22 | { | ||
23 | /* Optimization: when number in == number out, forget immediately. */ | ||
24 | atomic_t count; | ||
25 | }; | ||
26 | |||
27 | #endif /* _NF_CONNTRACK_ICMPV6_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h new file mode 100644 index 000000000000..cc4825610795 --- /dev/null +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -0,0 +1,354 @@ | |||
1 | /* | ||
2 | * Connection state tracking for netfilter. This is separated from, | ||
3 | * but required by, the (future) NAT layer; it can also be used by an iptables | ||
4 | * extension. | ||
5 | * | ||
6 | * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
7 | * - generalize L3 protocol dependent part. | ||
8 | * | ||
9 | * Derived from include/linux/netfiter_ipv4/ip_conntrack.h | ||
10 | */ | ||
11 | |||
12 | #ifndef _NF_CONNTRACK_H | ||
13 | #define _NF_CONNTRACK_H | ||
14 | |||
15 | #include <linux/netfilter/nf_conntrack_common.h> | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/bitops.h> | ||
20 | #include <linux/compiler.h> | ||
21 | #include <asm/atomic.h> | ||
22 | |||
23 | #include <linux/netfilter/nf_conntrack_tcp.h> | ||
24 | #include <linux/netfilter/nf_conntrack_sctp.h> | ||
25 | #include <net/netfilter/ipv4/nf_conntrack_icmp.h> | ||
26 | #include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> | ||
27 | |||
28 | #include <net/netfilter/nf_conntrack_tuple.h> | ||
29 | |||
30 | /* per conntrack: protocol private data */ | ||
31 | union nf_conntrack_proto { | ||
32 | /* insert conntrack proto private data here */ | ||
33 | struct ip_ct_sctp sctp; | ||
34 | struct ip_ct_tcp tcp; | ||
35 | struct ip_ct_icmp icmp; | ||
36 | struct nf_ct_icmpv6 icmpv6; | ||
37 | }; | ||
38 | |||
39 | union nf_conntrack_expect_proto { | ||
40 | /* insert expect proto private data here */ | ||
41 | }; | ||
42 | |||
43 | /* Add protocol helper include file here */ | ||
44 | #include <linux/netfilter/nf_conntrack_ftp.h> | ||
45 | |||
46 | /* per conntrack: application helper private data */ | ||
47 | union nf_conntrack_help { | ||
48 | /* insert conntrack helper private data (master) here */ | ||
49 | struct ip_ct_ftp_master ct_ftp_info; | ||
50 | }; | ||
51 | |||
52 | #include <linux/types.h> | ||
53 | #include <linux/skbuff.h> | ||
54 | |||
55 | #ifdef CONFIG_NETFILTER_DEBUG | ||
56 | #define NF_CT_ASSERT(x) \ | ||
57 | do { \ | ||
58 | if (!(x)) \ | ||
59 | /* Wooah! I'm tripping my conntrack in a frenzy of \ | ||
60 | netplay... */ \ | ||
61 | printk("NF_CT_ASSERT: %s:%i(%s)\n", \ | ||
62 | __FILE__, __LINE__, __FUNCTION__); \ | ||
63 | } while(0) | ||
64 | #else | ||
65 | #define NF_CT_ASSERT(x) | ||
66 | #endif | ||
67 | |||
68 | struct nf_conntrack_helper; | ||
69 | |||
70 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> | ||
71 | struct nf_conn | ||
72 | { | ||
73 | /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, | ||
74 | plus 1 for any connection(s) we are `master' for */ | ||
75 | struct nf_conntrack ct_general; | ||
76 | |||
77 | /* XXX should I move this to the tail ? - Y.K */ | ||
78 | /* These are my tuples; original and reply */ | ||
79 | struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; | ||
80 | |||
81 | /* Have we seen traffic both ways yet? (bitset) */ | ||
82 | unsigned long status; | ||
83 | |||
84 | /* Timer function; drops refcnt when it goes off. */ | ||
85 | struct timer_list timeout; | ||
86 | |||
87 | #ifdef CONFIG_NF_CT_ACCT | ||
88 | /* Accounting Information (same cache line as other written members) */ | ||
89 | struct ip_conntrack_counter counters[IP_CT_DIR_MAX]; | ||
90 | #endif | ||
91 | /* If we were expected by an expectation, this will be it */ | ||
92 | struct nf_conn *master; | ||
93 | |||
94 | /* Current number of expected connections */ | ||
95 | unsigned int expecting; | ||
96 | |||
97 | /* Helper. if any */ | ||
98 | struct nf_conntrack_helper *helper; | ||
99 | |||
100 | /* features - nat, helper, ... used by allocating system */ | ||
101 | u_int32_t features; | ||
102 | |||
103 | /* Storage reserved for other modules: */ | ||
104 | |||
105 | union nf_conntrack_proto proto; | ||
106 | |||
107 | #if defined(CONFIG_NF_CONNTRACK_MARK) | ||
108 | u_int32_t mark; | ||
109 | #endif | ||
110 | |||
111 | /* These members are dynamically allocated. */ | ||
112 | |||
113 | union nf_conntrack_help *help; | ||
114 | |||
115 | /* Layer 3 dependent members. (ex: NAT) */ | ||
116 | union { | ||
117 | struct nf_conntrack_ipv4 *ipv4; | ||
118 | } l3proto; | ||
119 | void *data[0]; | ||
120 | }; | ||
121 | |||
122 | struct nf_conntrack_expect | ||
123 | { | ||
124 | /* Internal linked list (global expectation list) */ | ||
125 | struct list_head list; | ||
126 | |||
127 | /* We expect this tuple, with the following mask */ | ||
128 | struct nf_conntrack_tuple tuple, mask; | ||
129 | |||
130 | /* Function to call after setup and insertion */ | ||
131 | void (*expectfn)(struct nf_conn *new, | ||
132 | struct nf_conntrack_expect *this); | ||
133 | |||
134 | /* The conntrack of the master connection */ | ||
135 | struct nf_conn *master; | ||
136 | |||
137 | /* Timer function; deletes the expectation. */ | ||
138 | struct timer_list timeout; | ||
139 | |||
140 | /* Usage count. */ | ||
141 | atomic_t use; | ||
142 | |||
143 | /* Flags */ | ||
144 | unsigned int flags; | ||
145 | |||
146 | #ifdef CONFIG_NF_NAT_NEEDED | ||
147 | /* This is the original per-proto part, used to map the | ||
148 | * expected connection the way the recipient expects. */ | ||
149 | union nf_conntrack_manip_proto saved_proto; | ||
150 | /* Direction relative to the master connection. */ | ||
151 | enum ip_conntrack_dir dir; | ||
152 | #endif | ||
153 | }; | ||
154 | |||
155 | #define NF_CT_EXPECT_PERMANENT 0x1 | ||
156 | |||
157 | static inline struct nf_conn * | ||
158 | nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash) | ||
159 | { | ||
160 | return container_of(hash, struct nf_conn, | ||
161 | tuplehash[hash->tuple.dst.dir]); | ||
162 | } | ||
163 | |||
164 | /* get master conntrack via master expectation */ | ||
165 | #define master_ct(conntr) (conntr->master) | ||
166 | |||
167 | /* Alter reply tuple (maybe alter helper). */ | ||
168 | extern void | ||
169 | nf_conntrack_alter_reply(struct nf_conn *conntrack, | ||
170 | const struct nf_conntrack_tuple *newreply); | ||
171 | |||
172 | /* Is this tuple taken? (ignoring any belonging to the given | ||
173 | conntrack). */ | ||
174 | extern int | ||
175 | nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple, | ||
176 | const struct nf_conn *ignored_conntrack); | ||
177 | |||
178 | /* Return conntrack_info and tuple hash for given skb. */ | ||
179 | static inline struct nf_conn * | ||
180 | nf_ct_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo) | ||
181 | { | ||
182 | *ctinfo = skb->nfctinfo; | ||
183 | return (struct nf_conn *)skb->nfct; | ||
184 | } | ||
185 | |||
186 | /* decrement reference count on a conntrack */ | ||
187 | static inline void nf_ct_put(struct nf_conn *ct) | ||
188 | { | ||
189 | NF_CT_ASSERT(ct); | ||
190 | nf_conntrack_put(&ct->ct_general); | ||
191 | } | ||
192 | |||
193 | /* call to create an explicit dependency on nf_conntrack. */ | ||
194 | extern void need_nf_conntrack(void); | ||
195 | |||
196 | extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, | ||
197 | const struct nf_conntrack_tuple *orig); | ||
198 | |||
199 | extern void __nf_ct_refresh_acct(struct nf_conn *ct, | ||
200 | enum ip_conntrack_info ctinfo, | ||
201 | const struct sk_buff *skb, | ||
202 | unsigned long extra_jiffies, | ||
203 | int do_acct); | ||
204 | |||
205 | /* Refresh conntrack for this many jiffies and do accounting */ | ||
206 | static inline void nf_ct_refresh_acct(struct nf_conn *ct, | ||
207 | enum ip_conntrack_info ctinfo, | ||
208 | const struct sk_buff *skb, | ||
209 | unsigned long extra_jiffies) | ||
210 | { | ||
211 | __nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1); | ||
212 | } | ||
213 | |||
214 | /* Refresh conntrack for this many jiffies */ | ||
215 | static inline void nf_ct_refresh(struct nf_conn *ct, | ||
216 | const struct sk_buff *skb, | ||
217 | unsigned long extra_jiffies) | ||
218 | { | ||
219 | __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0); | ||
220 | } | ||
221 | |||
222 | /* These are for NAT. Icky. */ | ||
223 | /* Update TCP window tracking data when NAT mangles the packet */ | ||
224 | extern void nf_conntrack_tcp_update(struct sk_buff *skb, | ||
225 | unsigned int dataoff, | ||
226 | struct nf_conn *conntrack, | ||
227 | int dir); | ||
228 | |||
229 | /* Call me when a conntrack is destroyed. */ | ||
230 | extern void (*nf_conntrack_destroyed)(struct nf_conn *conntrack); | ||
231 | |||
232 | /* Fake conntrack entry for untracked connections */ | ||
233 | extern struct nf_conn nf_conntrack_untracked; | ||
234 | |||
235 | extern int nf_ct_no_defrag; | ||
236 | |||
237 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ | ||
238 | extern void | ||
239 | nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data); | ||
240 | extern void nf_conntrack_free(struct nf_conn *ct); | ||
241 | extern struct nf_conn * | ||
242 | nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, | ||
243 | const struct nf_conntrack_tuple *repl); | ||
244 | |||
245 | /* It's confirmed if it is, or has been in the hash table. */ | ||
246 | static inline int nf_ct_is_confirmed(struct nf_conn *ct) | ||
247 | { | ||
248 | return test_bit(IPS_CONFIRMED_BIT, &ct->status); | ||
249 | } | ||
250 | |||
251 | static inline int nf_ct_is_dying(struct nf_conn *ct) | ||
252 | { | ||
253 | return test_bit(IPS_DYING_BIT, &ct->status); | ||
254 | } | ||
255 | |||
256 | extern unsigned int nf_conntrack_htable_size; | ||
257 | |||
258 | #define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) | ||
259 | |||
260 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
261 | #include <linux/notifier.h> | ||
262 | #include <linux/interrupt.h> | ||
263 | |||
264 | struct nf_conntrack_ecache { | ||
265 | struct nf_conn *ct; | ||
266 | unsigned int events; | ||
267 | }; | ||
268 | DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache); | ||
269 | |||
270 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) | ||
271 | |||
272 | extern struct notifier_block *nf_conntrack_chain; | ||
273 | extern struct notifier_block *nf_conntrack_expect_chain; | ||
274 | |||
275 | static inline int nf_conntrack_register_notifier(struct notifier_block *nb) | ||
276 | { | ||
277 | return notifier_chain_register(&nf_conntrack_chain, nb); | ||
278 | } | ||
279 | |||
280 | static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb) | ||
281 | { | ||
282 | return notifier_chain_unregister(&nf_conntrack_chain, nb); | ||
283 | } | ||
284 | |||
285 | static inline int | ||
286 | nf_conntrack_expect_register_notifier(struct notifier_block *nb) | ||
287 | { | ||
288 | return notifier_chain_register(&nf_conntrack_expect_chain, nb); | ||
289 | } | ||
290 | |||
291 | static inline int | ||
292 | nf_conntrack_expect_unregister_notifier(struct notifier_block *nb) | ||
293 | { | ||
294 | return notifier_chain_unregister(&nf_conntrack_expect_chain, nb); | ||
295 | } | ||
296 | |||
297 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); | ||
298 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); | ||
299 | |||
300 | static inline void | ||
301 | nf_conntrack_event_cache(enum ip_conntrack_events event, | ||
302 | const struct sk_buff *skb) | ||
303 | { | ||
304 | struct nf_conn *ct = (struct nf_conn *)skb->nfct; | ||
305 | struct nf_conntrack_ecache *ecache; | ||
306 | |||
307 | local_bh_disable(); | ||
308 | ecache = &__get_cpu_var(nf_conntrack_ecache); | ||
309 | if (ct != ecache->ct) | ||
310 | __nf_ct_event_cache_init(ct); | ||
311 | ecache->events |= event; | ||
312 | local_bh_enable(); | ||
313 | } | ||
314 | |||
315 | static inline void nf_conntrack_event(enum ip_conntrack_events event, | ||
316 | struct nf_conn *ct) | ||
317 | { | ||
318 | if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) | ||
319 | notifier_call_chain(&nf_conntrack_chain, event, ct); | ||
320 | } | ||
321 | |||
322 | static inline void | ||
323 | nf_conntrack_expect_event(enum ip_conntrack_expect_events event, | ||
324 | struct nf_conntrack_expect *exp) | ||
325 | { | ||
326 | notifier_call_chain(&nf_conntrack_expect_chain, event, exp); | ||
327 | } | ||
328 | #else /* CONFIG_NF_CONNTRACK_EVENTS */ | ||
329 | static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, | ||
330 | const struct sk_buff *skb) {} | ||
331 | static inline void nf_conntrack_event(enum ip_conntrack_events event, | ||
332 | struct nf_conn *ct) {} | ||
333 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} | ||
334 | static inline void | ||
335 | nf_conntrack_expect_event(enum ip_conntrack_expect_events event, | ||
336 | struct nf_conntrack_expect *exp) {} | ||
337 | #endif /* CONFIG_NF_CONNTRACK_EVENTS */ | ||
338 | |||
339 | /* no helper, no nat */ | ||
340 | #define NF_CT_F_BASIC 0 | ||
341 | /* for helper */ | ||
342 | #define NF_CT_F_HELP 1 | ||
343 | /* for nat. */ | ||
344 | #define NF_CT_F_NAT 2 | ||
345 | #define NF_CT_F_NUM 4 | ||
346 | |||
347 | extern int | ||
348 | nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size, | ||
349 | int (*init_conntrack)(struct nf_conn *, u_int32_t)); | ||
350 | extern void | ||
351 | nf_conntrack_unregister_cache(u_int32_t features); | ||
352 | |||
353 | #endif /* __KERNEL__ */ | ||
354 | #endif /* _NF_CONNTRACK_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h new file mode 100644 index 000000000000..3cac19fb3648 --- /dev/null +++ b/include/net/netfilter/nf_conntrack_compat.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #ifndef _NF_CONNTRACK_COMPAT_H | ||
2 | #define _NF_CONNTRACK_COMPAT_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE) | ||
7 | |||
8 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
9 | |||
10 | #ifdef CONFIG_IP_NF_CONNTRACK_MARK | ||
11 | static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | ||
12 | u_int32_t *ctinfo) | ||
13 | { | ||
14 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
15 | |||
16 | if (ct) | ||
17 | return &ct->mark; | ||
18 | else | ||
19 | return NULL; | ||
20 | } | ||
21 | #endif /* CONFIG_IP_NF_CONNTRACK_MARK */ | ||
22 | |||
23 | #ifdef CONFIG_IP_NF_CT_ACCT | ||
24 | static inline struct ip_conntrack_counter * | ||
25 | nf_ct_get_counters(const struct sk_buff *skb) | ||
26 | { | ||
27 | enum ip_conntrack_info ctinfo; | ||
28 | struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo); | ||
29 | |||
30 | if (ct) | ||
31 | return ct->counters; | ||
32 | else | ||
33 | return NULL; | ||
34 | } | ||
35 | #endif /* CONFIG_IP_NF_CT_ACCT */ | ||
36 | |||
37 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
38 | { | ||
39 | return (skb->nfct == &ip_conntrack_untracked.ct_general); | ||
40 | } | ||
41 | |||
42 | static inline void nf_ct_untrack(struct sk_buff *skb) | ||
43 | { | ||
44 | skb->nfct = &ip_conntrack_untracked.ct_general; | ||
45 | } | ||
46 | |||
47 | static inline int nf_ct_get_ctinfo(const struct sk_buff *skb, | ||
48 | enum ip_conntrack_info *ctinfo) | ||
49 | { | ||
50 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
51 | return (ct != NULL); | ||
52 | } | ||
53 | |||
54 | #else /* CONFIG_IP_NF_CONNTRACK */ | ||
55 | |||
56 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> | ||
57 | #include <net/netfilter/nf_conntrack.h> | ||
58 | |||
59 | #ifdef CONFIG_NF_CONNTRACK_MARK | ||
60 | |||
61 | static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | ||
62 | u_int32_t *ctinfo) | ||
63 | { | ||
64 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
65 | |||
66 | if (ct) | ||
67 | return &ct->mark; | ||
68 | else | ||
69 | return NULL; | ||
70 | } | ||
71 | #endif /* CONFIG_NF_CONNTRACK_MARK */ | ||
72 | |||
73 | #ifdef CONFIG_NF_CT_ACCT | ||
74 | static inline struct ip_conntrack_counter * | ||
75 | nf_ct_get_counters(const struct sk_buff *skb) | ||
76 | { | ||
77 | enum ip_conntrack_info ctinfo; | ||
78 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); | ||
79 | |||
80 | if (ct) | ||
81 | return ct->counters; | ||
82 | else | ||
83 | return NULL; | ||
84 | } | ||
85 | #endif /* CONFIG_NF_CT_ACCT */ | ||
86 | |||
87 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
88 | { | ||
89 | return (skb->nfct == &nf_conntrack_untracked.ct_general); | ||
90 | } | ||
91 | |||
92 | static inline void nf_ct_untrack(struct sk_buff *skb) | ||
93 | { | ||
94 | skb->nfct = &nf_conntrack_untracked.ct_general; | ||
95 | } | ||
96 | |||
97 | static inline int nf_ct_get_ctinfo(const struct sk_buff *skb, | ||
98 | enum ip_conntrack_info *ctinfo) | ||
99 | { | ||
100 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
101 | return (ct != NULL); | ||
102 | } | ||
103 | |||
104 | #endif /* CONFIG_IP_NF_CONNTRACK */ | ||
105 | |||
106 | #endif /* __KERNEL__ */ | ||
107 | |||
108 | #endif /* _NF_CONNTRACK_COMPAT_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h new file mode 100644 index 000000000000..da254525a4ce --- /dev/null +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * This header is used to share core functionality between the | ||
3 | * standalone connection tracking module, and the compatibility layer's use | ||
4 | * of connection tracking. | ||
5 | * | ||
6 | * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
7 | * - generalize L3 protocol dependent part. | ||
8 | * | ||
9 | * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h | ||
10 | */ | ||
11 | |||
12 | #ifndef _NF_CONNTRACK_CORE_H | ||
13 | #define _NF_CONNTRACK_CORE_H | ||
14 | |||
15 | #include <linux/netfilter.h> | ||
16 | |||
17 | /* This header is used to share core functionality between the | ||
18 | standalone connection tracking module, and the compatibility layer's use | ||
19 | of connection tracking. */ | ||
20 | extern unsigned int nf_conntrack_in(int pf, | ||
21 | unsigned int hooknum, | ||
22 | struct sk_buff **pskb); | ||
23 | |||
24 | extern int nf_conntrack_init(void); | ||
25 | extern void nf_conntrack_cleanup(void); | ||
26 | |||
27 | struct nf_conntrack_l3proto; | ||
28 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); | ||
29 | /* Like above, but you already have conntrack read lock. */ | ||
30 | extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto); | ||
31 | |||
32 | struct nf_conntrack_protocol; | ||
33 | |||
34 | extern int | ||
35 | nf_ct_get_tuple(const struct sk_buff *skb, | ||
36 | unsigned int nhoff, | ||
37 | unsigned int dataoff, | ||
38 | u_int16_t l3num, | ||
39 | u_int8_t protonum, | ||
40 | struct nf_conntrack_tuple *tuple, | ||
41 | const struct nf_conntrack_l3proto *l3proto, | ||
42 | const struct nf_conntrack_protocol *protocol); | ||
43 | |||
44 | extern int | ||
45 | nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, | ||
46 | const struct nf_conntrack_tuple *orig, | ||
47 | const struct nf_conntrack_l3proto *l3proto, | ||
48 | const struct nf_conntrack_protocol *protocol); | ||
49 | |||
50 | /* Find a connection corresponding to a tuple. */ | ||
51 | extern struct nf_conntrack_tuple_hash * | ||
52 | nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple, | ||
53 | const struct nf_conn *ignored_conntrack); | ||
54 | |||
55 | extern int __nf_conntrack_confirm(struct sk_buff **pskb); | ||
56 | |||
57 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ | ||
58 | static inline int nf_conntrack_confirm(struct sk_buff **pskb) | ||
59 | { | ||
60 | struct nf_conn *ct = (struct nf_conn *)(*pskb)->nfct; | ||
61 | int ret = NF_ACCEPT; | ||
62 | |||
63 | if (ct) { | ||
64 | if (!nf_ct_is_confirmed(ct)) | ||
65 | ret = __nf_conntrack_confirm(pskb); | ||
66 | nf_ct_deliver_cached_events(ct); | ||
67 | } | ||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb); | ||
72 | |||
73 | extern struct list_head *nf_conntrack_hash; | ||
74 | extern struct list_head nf_conntrack_expect_list; | ||
75 | extern rwlock_t nf_conntrack_lock ; | ||
76 | #endif /* _NF_CONNTRACK_CORE_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h new file mode 100644 index 000000000000..5a66b2a3a623 --- /dev/null +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * connection tracking helpers. | ||
3 | * | ||
4 | * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
5 | * - generalize L3 protocol dependent part. | ||
6 | * | ||
7 | * Derived from include/linux/netfiter_ipv4/ip_conntrack_helper.h | ||
8 | */ | ||
9 | |||
10 | #ifndef _NF_CONNTRACK_HELPER_H | ||
11 | #define _NF_CONNTRACK_HELPER_H | ||
12 | #include <net/netfilter/nf_conntrack.h> | ||
13 | |||
14 | struct module; | ||
15 | |||
16 | struct nf_conntrack_helper | ||
17 | { | ||
18 | struct list_head list; /* Internal use. */ | ||
19 | |||
20 | const char *name; /* name of the module */ | ||
21 | struct module *me; /* pointer to self */ | ||
22 | unsigned int max_expected; /* Maximum number of concurrent | ||
23 | * expected connections */ | ||
24 | unsigned int timeout; /* timeout for expecteds */ | ||
25 | |||
26 | /* Mask of things we will help (compared against server response) */ | ||
27 | struct nf_conntrack_tuple tuple; | ||
28 | struct nf_conntrack_tuple mask; | ||
29 | |||
30 | /* Function to call when data passes; return verdict, or -1 to | ||
31 | invalidate. */ | ||
32 | int (*help)(struct sk_buff **pskb, | ||
33 | unsigned int protoff, | ||
34 | struct nf_conn *ct, | ||
35 | enum ip_conntrack_info conntrackinfo); | ||
36 | }; | ||
37 | |||
38 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); | ||
39 | extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); | ||
40 | |||
41 | /* Allocate space for an expectation: this is mandatory before calling | ||
42 | nf_conntrack_expect_related. You will have to call put afterwards. */ | ||
43 | extern struct nf_conntrack_expect * | ||
44 | nf_conntrack_expect_alloc(struct nf_conn *master); | ||
45 | extern void nf_conntrack_expect_put(struct nf_conntrack_expect *exp); | ||
46 | |||
47 | /* Add an expected connection: can have more than one per connection */ | ||
48 | extern int nf_conntrack_expect_related(struct nf_conntrack_expect *exp); | ||
49 | extern void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp); | ||
50 | |||
51 | #endif /*_NF_CONNTRACK_HELPER_H*/ | ||
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h new file mode 100644 index 000000000000..01663e5b33df --- /dev/null +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (C)2003,2004 USAGI/WIDE Project | ||
3 | * | ||
4 | * Header for use in defining a given L3 protocol for connection tracking. | ||
5 | * | ||
6 | * Author: | ||
7 | * Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
8 | * | ||
9 | * Derived from include/netfilter_ipv4/ip_conntrack_protocol.h | ||
10 | */ | ||
11 | |||
12 | #ifndef _NF_CONNTRACK_L3PROTO_H | ||
13 | #define _NF_CONNTRACK_L3PROTO_H | ||
14 | #include <linux/seq_file.h> | ||
15 | #include <net/netfilter/nf_conntrack.h> | ||
16 | |||
17 | struct nf_conntrack_l3proto | ||
18 | { | ||
19 | /* Next pointer. */ | ||
20 | struct list_head list; | ||
21 | |||
22 | /* L3 Protocol Family number. ex) PF_INET */ | ||
23 | u_int16_t l3proto; | ||
24 | |||
25 | /* Protocol name */ | ||
26 | const char *name; | ||
27 | |||
28 | /* | ||
29 | * Try to fill in the third arg: nhoff is offset of l3 proto | ||
30 | * hdr. Return true if possible. | ||
31 | */ | ||
32 | int (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, | ||
33 | struct nf_conntrack_tuple *tuple); | ||
34 | |||
35 | /* | ||
36 | * Invert the per-proto part of the tuple: ie. turn xmit into reply. | ||
37 | * Some packets can't be inverted: return 0 in that case. | ||
38 | */ | ||
39 | int (*invert_tuple)(struct nf_conntrack_tuple *inverse, | ||
40 | const struct nf_conntrack_tuple *orig); | ||
41 | |||
42 | /* Print out the per-protocol part of the tuple. */ | ||
43 | int (*print_tuple)(struct seq_file *s, | ||
44 | const struct nf_conntrack_tuple *); | ||
45 | |||
46 | /* Print out the private part of the conntrack. */ | ||
47 | int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); | ||
48 | |||
49 | /* Returns verdict for packet, or -1 for invalid. */ | ||
50 | int (*packet)(struct nf_conn *conntrack, | ||
51 | const struct sk_buff *skb, | ||
52 | enum ip_conntrack_info ctinfo); | ||
53 | |||
54 | /* | ||
55 | * Called when a new connection for this protocol found; | ||
56 | * returns TRUE if it's OK. If so, packet() called next. | ||
57 | */ | ||
58 | int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb); | ||
59 | |||
60 | /* Called when a conntrack entry is destroyed */ | ||
61 | void (*destroy)(struct nf_conn *conntrack); | ||
62 | |||
63 | /* | ||
64 | * Called before tracking. | ||
65 | * *dataoff: offset of protocol header (TCP, UDP,...) in *pskb | ||
66 | * *protonum: protocol number | ||
67 | */ | ||
68 | int (*prepare)(struct sk_buff **pskb, unsigned int hooknum, | ||
69 | unsigned int *dataoff, u_int8_t *protonum); | ||
70 | |||
71 | u_int32_t (*get_features)(const struct nf_conntrack_tuple *tuple); | ||
72 | |||
73 | /* Module (if any) which this is connected to. */ | ||
74 | struct module *me; | ||
75 | }; | ||
76 | |||
77 | extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; | ||
78 | |||
79 | /* Protocol registration. */ | ||
80 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); | ||
81 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); | ||
82 | |||
83 | static inline struct nf_conntrack_l3proto * | ||
84 | nf_ct_find_l3proto(u_int16_t l3proto) | ||
85 | { | ||
86 | return nf_ct_l3protos[l3proto]; | ||
87 | } | ||
88 | |||
89 | /* Existing built-in protocols */ | ||
90 | extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; | ||
91 | extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; | ||
92 | extern struct nf_conntrack_l3proto nf_conntrack_generic_l3proto; | ||
93 | #endif /*_NF_CONNTRACK_L3PROTO_H*/ | ||
diff --git a/include/net/netfilter/nf_conntrack_protocol.h b/include/net/netfilter/nf_conntrack_protocol.h new file mode 100644 index 000000000000..b3afda35397a --- /dev/null +++ b/include/net/netfilter/nf_conntrack_protocol.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * Header for use in defining a given protocol for connection tracking. | ||
3 | * | ||
4 | * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
5 | * - generalized L3 protocol dependent part. | ||
6 | * | ||
7 | * Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h | ||
8 | */ | ||
9 | |||
10 | #ifndef _NF_CONNTRACK_PROTOCOL_H | ||
11 | #define _NF_CONNTRACK_PROTOCOL_H | ||
12 | #include <net/netfilter/nf_conntrack.h> | ||
13 | |||
14 | struct seq_file; | ||
15 | |||
16 | struct nf_conntrack_protocol | ||
17 | { | ||
18 | /* Next pointer. */ | ||
19 | struct list_head list; | ||
20 | |||
21 | /* L3 Protocol number. */ | ||
22 | u_int16_t l3proto; | ||
23 | |||
24 | /* Protocol number. */ | ||
25 | u_int8_t proto; | ||
26 | |||
27 | /* Protocol name */ | ||
28 | const char *name; | ||
29 | |||
30 | /* Try to fill in the third arg: dataoff is offset past network protocol | ||
31 | hdr. Return true if possible. */ | ||
32 | int (*pkt_to_tuple)(const struct sk_buff *skb, | ||
33 | unsigned int dataoff, | ||
34 | struct nf_conntrack_tuple *tuple); | ||
35 | |||
36 | /* Invert the per-proto part of the tuple: ie. turn xmit into reply. | ||
37 | * Some packets can't be inverted: return 0 in that case. | ||
38 | */ | ||
39 | int (*invert_tuple)(struct nf_conntrack_tuple *inverse, | ||
40 | const struct nf_conntrack_tuple *orig); | ||
41 | |||
42 | /* Print out the per-protocol part of the tuple. Return like seq_* */ | ||
43 | int (*print_tuple)(struct seq_file *s, | ||
44 | const struct nf_conntrack_tuple *); | ||
45 | |||
46 | /* Print out the private part of the conntrack. */ | ||
47 | int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); | ||
48 | |||
49 | /* Returns verdict for packet, or -1 for invalid. */ | ||
50 | int (*packet)(struct nf_conn *conntrack, | ||
51 | const struct sk_buff *skb, | ||
52 | unsigned int dataoff, | ||
53 | enum ip_conntrack_info ctinfo, | ||
54 | int pf, | ||
55 | unsigned int hooknum); | ||
56 | |||
57 | /* Called when a new connection for this protocol found; | ||
58 | * returns TRUE if it's OK. If so, packet() called next. */ | ||
59 | int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb, | ||
60 | unsigned int dataoff); | ||
61 | |||
62 | /* Called when a conntrack entry is destroyed */ | ||
63 | void (*destroy)(struct nf_conn *conntrack); | ||
64 | |||
65 | int (*error)(struct sk_buff *skb, unsigned int dataoff, | ||
66 | enum ip_conntrack_info *ctinfo, | ||
67 | int pf, unsigned int hooknum); | ||
68 | |||
69 | /* Module (if any) which this is connected to. */ | ||
70 | struct module *me; | ||
71 | }; | ||
72 | |||
73 | /* Existing built-in protocols */ | ||
74 | extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp6; | ||
75 | extern struct nf_conntrack_protocol nf_conntrack_protocol_udp4; | ||
76 | extern struct nf_conntrack_protocol nf_conntrack_protocol_udp6; | ||
77 | extern struct nf_conntrack_protocol nf_conntrack_generic_protocol; | ||
78 | |||
79 | #define MAX_NF_CT_PROTO 256 | ||
80 | extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX]; | ||
81 | |||
82 | extern struct nf_conntrack_protocol * | ||
83 | nf_ct_find_proto(u_int16_t l3proto, u_int8_t protocol); | ||
84 | |||
85 | /* Protocol registration. */ | ||
86 | extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto); | ||
87 | extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto); | ||
88 | |||
89 | /* Log invalid packets */ | ||
90 | extern unsigned int nf_ct_log_invalid; | ||
91 | |||
92 | #ifdef CONFIG_SYSCTL | ||
93 | #ifdef DEBUG_INVALID_PACKETS | ||
94 | #define LOG_INVALID(proto) \ | ||
95 | (nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) | ||
96 | #else | ||
97 | #define LOG_INVALID(proto) \ | ||
98 | ((nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) \ | ||
99 | && net_ratelimit()) | ||
100 | #endif | ||
101 | #else | ||
102 | #define LOG_INVALID(proto) 0 | ||
103 | #endif /* CONFIG_SYSCTL */ | ||
104 | |||
105 | #endif /*_NF_CONNTRACK_PROTOCOL_H*/ | ||
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h new file mode 100644 index 000000000000..14ce790e5c65 --- /dev/null +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | * Definitions and Declarations for tuple. | ||
3 | * | ||
4 | * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | ||
5 | * - generalize L3 protocol dependent part. | ||
6 | * | ||
7 | * Derived from include/linux/netfiter_ipv4/ip_conntrack_tuple.h | ||
8 | */ | ||
9 | |||
10 | #ifndef _NF_CONNTRACK_TUPLE_H | ||
11 | #define _NF_CONNTRACK_TUPLE_H | ||
12 | |||
13 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
14 | |||
15 | /* A `tuple' is a structure containing the information to uniquely | ||
16 | identify a connection. ie. if two packets have the same tuple, they | ||
17 | are in the same connection; if not, they are not. | ||
18 | |||
19 | We divide the structure along "manipulatable" and | ||
20 | "non-manipulatable" lines, for the benefit of the NAT code. | ||
21 | */ | ||
22 | |||
23 | #define NF_CT_TUPLE_L3SIZE 4 | ||
24 | |||
25 | /* The l3 protocol-specific manipulable parts of the tuple: always in | ||
26 | network order! */ | ||
27 | union nf_conntrack_man_l3proto { | ||
28 | u_int32_t all[NF_CT_TUPLE_L3SIZE]; | ||
29 | u_int32_t ip; | ||
30 | u_int32_t ip6[4]; | ||
31 | }; | ||
32 | |||
33 | /* The protocol-specific manipulable parts of the tuple: always in | ||
34 | network order! */ | ||
35 | union nf_conntrack_man_proto | ||
36 | { | ||
37 | /* Add other protocols here. */ | ||
38 | u_int16_t all; | ||
39 | |||
40 | struct { | ||
41 | u_int16_t port; | ||
42 | } tcp; | ||
43 | struct { | ||
44 | u_int16_t port; | ||
45 | } udp; | ||
46 | struct { | ||
47 | u_int16_t id; | ||
48 | } icmp; | ||
49 | struct { | ||
50 | u_int16_t port; | ||
51 | } sctp; | ||
52 | }; | ||
53 | |||
54 | /* The manipulable part of the tuple. */ | ||
55 | struct nf_conntrack_man | ||
56 | { | ||
57 | union nf_conntrack_man_l3proto u3; | ||
58 | union nf_conntrack_man_proto u; | ||
59 | /* Layer 3 protocol */ | ||
60 | u_int16_t l3num; | ||
61 | }; | ||
62 | |||
63 | /* This contains the information to distinguish a connection. */ | ||
64 | struct nf_conntrack_tuple | ||
65 | { | ||
66 | struct nf_conntrack_man src; | ||
67 | |||
68 | /* These are the parts of the tuple which are fixed. */ | ||
69 | struct { | ||
70 | union { | ||
71 | u_int32_t all[NF_CT_TUPLE_L3SIZE]; | ||
72 | u_int32_t ip; | ||
73 | u_int32_t ip6[4]; | ||
74 | } u3; | ||
75 | union { | ||
76 | /* Add other protocols here. */ | ||
77 | u_int16_t all; | ||
78 | |||
79 | struct { | ||
80 | u_int16_t port; | ||
81 | } tcp; | ||
82 | struct { | ||
83 | u_int16_t port; | ||
84 | } udp; | ||
85 | struct { | ||
86 | u_int8_t type, code; | ||
87 | } icmp; | ||
88 | struct { | ||
89 | u_int16_t port; | ||
90 | } sctp; | ||
91 | } u; | ||
92 | |||
93 | /* The protocol. */ | ||
94 | u_int8_t protonum; | ||
95 | |||
96 | /* The direction (for tuplehash) */ | ||
97 | u_int8_t dir; | ||
98 | } dst; | ||
99 | }; | ||
100 | |||
101 | /* This is optimized opposed to a memset of the whole structure. Everything we | ||
102 | * really care about is the source/destination unions */ | ||
103 | #define NF_CT_TUPLE_U_BLANK(tuple) \ | ||
104 | do { \ | ||
105 | (tuple)->src.u.all = 0; \ | ||
106 | (tuple)->dst.u.all = 0; \ | ||
107 | memset(&(tuple)->src.u3, 0, sizeof((tuple)->src.u3)); \ | ||
108 | memset(&(tuple)->dst.u3, 0, sizeof((tuple)->dst.u3)); \ | ||
109 | } while (0) | ||
110 | |||
111 | #ifdef __KERNEL__ | ||
112 | |||
113 | #define NF_CT_DUMP_TUPLE(tp) \ | ||
114 | DEBUGP("tuple %p: %u %u %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu -> %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu\n", \ | ||
115 | (tp), (tp)->src.l3num, (tp)->dst.protonum, \ | ||
116 | NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ | ||
117 | NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) | ||
118 | |||
119 | /* If we're the first tuple, it's the original dir. */ | ||
120 | #define NF_CT_DIRECTION(h) \ | ||
121 | ((enum ip_conntrack_dir)(h)->tuple.dst.dir) | ||
122 | |||
123 | /* Connections have two entries in the hash table: one for each way */ | ||
124 | struct nf_conntrack_tuple_hash | ||
125 | { | ||
126 | struct list_head list; | ||
127 | |||
128 | struct nf_conntrack_tuple tuple; | ||
129 | }; | ||
130 | |||
131 | #endif /* __KERNEL__ */ | ||
132 | |||
133 | static inline int nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, | ||
134 | const struct nf_conntrack_tuple *t2) | ||
135 | { | ||
136 | return (t1->src.u3.all[0] == t2->src.u3.all[0] && | ||
137 | t1->src.u3.all[1] == t2->src.u3.all[1] && | ||
138 | t1->src.u3.all[2] == t2->src.u3.all[2] && | ||
139 | t1->src.u3.all[3] == t2->src.u3.all[3] && | ||
140 | t1->src.u.all == t2->src.u.all && | ||
141 | t1->src.l3num == t2->src.l3num && | ||
142 | t1->dst.protonum == t2->dst.protonum); | ||
143 | } | ||
144 | |||
145 | static inline int nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, | ||
146 | const struct nf_conntrack_tuple *t2) | ||
147 | { | ||
148 | return (t1->dst.u3.all[0] == t2->dst.u3.all[0] && | ||
149 | t1->dst.u3.all[1] == t2->dst.u3.all[1] && | ||
150 | t1->dst.u3.all[2] == t2->dst.u3.all[2] && | ||
151 | t1->dst.u3.all[3] == t2->dst.u3.all[3] && | ||
152 | t1->dst.u.all == t2->dst.u.all && | ||
153 | t1->src.l3num == t2->src.l3num && | ||
154 | t1->dst.protonum == t2->dst.protonum); | ||
155 | } | ||
156 | |||
157 | static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, | ||
158 | const struct nf_conntrack_tuple *t2) | ||
159 | { | ||
160 | return nf_ct_tuple_src_equal(t1, t2) && nf_ct_tuple_dst_equal(t1, t2); | ||
161 | } | ||
162 | |||
163 | static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, | ||
164 | const struct nf_conntrack_tuple *tuple, | ||
165 | const struct nf_conntrack_tuple *mask) | ||
166 | { | ||
167 | int count = 0; | ||
168 | |||
169 | for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++){ | ||
170 | if ((t->src.u3.all[count] ^ tuple->src.u3.all[count]) & | ||
171 | mask->src.u3.all[count]) | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++){ | ||
176 | if ((t->dst.u3.all[count] ^ tuple->dst.u3.all[count]) & | ||
177 | mask->dst.u3.all[count]) | ||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | if ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all || | ||
182 | (t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all || | ||
183 | (t->src.l3num ^ tuple->src.l3num) & mask->src.l3num || | ||
184 | (t->dst.protonum ^ tuple->dst.protonum) & mask->dst.protonum) | ||
185 | return 0; | ||
186 | |||
187 | return 1; | ||
188 | } | ||
189 | |||
190 | #endif /* _NF_CONNTRACK_TUPLE_H */ | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h new file mode 100644 index 000000000000..640c26a90cf1 --- /dev/null +++ b/include/net/netlink.h | |||
@@ -0,0 +1,883 @@ | |||
1 | #ifndef __NET_NETLINK_H | ||
2 | #define __NET_NETLINK_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netlink.h> | ||
6 | |||
7 | /* ======================================================================== | ||
8 | * Netlink Messages and Attributes Interface (As Seen On TV) | ||
9 | * ------------------------------------------------------------------------ | ||
10 | * Messages Interface | ||
11 | * ------------------------------------------------------------------------ | ||
12 | * | ||
13 | * Message Format: | ||
14 | * <--- nlmsg_total_size(payload) ---> | ||
15 | * <-- nlmsg_msg_size(payload) -> | ||
16 | * +----------+- - -+-------------+- - -+-------- - - | ||
17 | * | nlmsghdr | Pad | Payload | Pad | nlmsghdr | ||
18 | * +----------+- - -+-------------+- - -+-------- - - | ||
19 | * nlmsg_data(nlh)---^ ^ | ||
20 | * nlmsg_next(nlh)-----------------------+ | ||
21 | * | ||
22 | * Payload Format: | ||
23 | * <---------------------- nlmsg_len(nlh) ---------------------> | ||
24 | * <------ hdrlen ------> <- nlmsg_attrlen(nlh, hdrlen) -> | ||
25 | * +----------------------+- - -+--------------------------------+ | ||
26 | * | Family Header | Pad | Attributes | | ||
27 | * +----------------------+- - -+--------------------------------+ | ||
28 | * nlmsg_attrdata(nlh, hdrlen)---^ | ||
29 | * | ||
30 | * Data Structures: | ||
31 | * struct nlmsghdr netlink message header | ||
32 | * | ||
33 | * Message Construction: | ||
34 | * nlmsg_new() create a new netlink message | ||
35 | * nlmsg_put() add a netlink message to an skb | ||
36 | * nlmsg_put_answer() callback based nlmsg_put() | ||
37 | * nlmsg_end() finanlize netlink message | ||
38 | * nlmsg_cancel() cancel message construction | ||
39 | * nlmsg_free() free a netlink message | ||
40 | * | ||
41 | * Message Sending: | ||
42 | * nlmsg_multicast() multicast message to several groups | ||
43 | * nlmsg_unicast() unicast a message to a single socket | ||
44 | * | ||
45 | * Message Length Calculations: | ||
46 | * nlmsg_msg_size(payload) length of message w/o padding | ||
47 | * nlmsg_total_size(payload) length of message w/ padding | ||
48 | * nlmsg_padlen(payload) length of padding at tail | ||
49 | * | ||
50 | * Message Payload Access: | ||
51 | * nlmsg_data(nlh) head of message payload | ||
52 | * nlmsg_len(nlh) length of message payload | ||
53 | * nlmsg_attrdata(nlh, hdrlen) head of attributes data | ||
54 | * nlmsg_attrlen(nlh, hdrlen) length of attributes data | ||
55 | * | ||
56 | * Message Parsing: | ||
57 | * nlmsg_ok(nlh, remaining) does nlh fit into remaining bytes? | ||
58 | * nlmsg_next(nlh, remaining) get next netlink message | ||
59 | * nlmsg_parse() parse attributes of a message | ||
60 | * nlmsg_find_attr() find an attribute in a message | ||
61 | * nlmsg_for_each_msg() loop over all messages | ||
62 | * nlmsg_validate() validate netlink message incl. attrs | ||
63 | * nlmsg_for_each_attr() loop over all attributes | ||
64 | * | ||
65 | * ------------------------------------------------------------------------ | ||
66 | * Attributes Interface | ||
67 | * ------------------------------------------------------------------------ | ||
68 | * | ||
69 | * Attribute Format: | ||
70 | * <------- nla_total_size(payload) -------> | ||
71 | * <---- nla_attr_size(payload) -----> | ||
72 | * +----------+- - -+- - - - - - - - - +- - -+-------- - - | ||
73 | * | Header | Pad | Payload | Pad | Header | ||
74 | * +----------+- - -+- - - - - - - - - +- - -+-------- - - | ||
75 | * <- nla_len(nla) -> ^ | ||
76 | * nla_data(nla)----^ | | ||
77 | * nla_next(nla)-----------------------------' | ||
78 | * | ||
79 | * Data Structures: | ||
80 | * struct nlattr netlink attribtue header | ||
81 | * | ||
82 | * Attribute Construction: | ||
83 | * nla_reserve(skb, type, len) reserve skb tailroom for an attribute | ||
84 | * nla_put(skb, type, len, data) add attribute to skb | ||
85 | * | ||
86 | * Attribute Construction for Basic Types: | ||
87 | * nla_put_u8(skb, type, value) add u8 attribute to skb | ||
88 | * nla_put_u16(skb, type, value) add u16 attribute to skb | ||
89 | * nla_put_u32(skb, type, value) add u32 attribute to skb | ||
90 | * nla_put_u64(skb, type, value) add u64 attribute to skb | ||
91 | * nla_put_string(skb, type, str) add string attribute to skb | ||
92 | * nla_put_flag(skb, type) add flag attribute to skb | ||
93 | * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb | ||
94 | * | ||
95 | * Exceptions Based Attribute Construction: | ||
96 | * NLA_PUT(skb, type, len, data) add attribute to skb | ||
97 | * NLA_PUT_U8(skb, type, value) add u8 attribute to skb | ||
98 | * NLA_PUT_U16(skb, type, value) add u16 attribute to skb | ||
99 | * NLA_PUT_U32(skb, type, value) add u32 attribute to skb | ||
100 | * NLA_PUT_U64(skb, type, value) add u64 attribute to skb | ||
101 | * NLA_PUT_STRING(skb, type, str) add string attribute to skb | ||
102 | * NLA_PUT_FLAG(skb, type) add flag attribute to skb | ||
103 | * NLA_PUT_MSECS(skb, type, jiffies) add msecs attribute to skb | ||
104 | * | ||
105 | * The meaning of these functions is equal to their lower case | ||
106 | * variants but they jump to the label nla_put_failure in case | ||
107 | * of a failure. | ||
108 | * | ||
109 | * Nested Attributes Construction: | ||
110 | * nla_nest_start(skb, type) start a nested attribute | ||
111 | * nla_nest_end(skb, nla) finalize a nested attribute | ||
112 | * nla_nest_cancel(skb, nla) cancel nested attribute construction | ||
113 | * | ||
114 | * Attribute Length Calculations: | ||
115 | * nla_attr_size(payload) length of attribute w/o padding | ||
116 | * nla_total_size(payload) length of attribute w/ padding | ||
117 | * nla_padlen(payload) length of padding | ||
118 | * | ||
119 | * Attribute Payload Access: | ||
120 | * nla_data(nla) head of attribute payload | ||
121 | * nla_len(nla) length of attribute payload | ||
122 | * | ||
123 | * Attribute Payload Access for Basic Types: | ||
124 | * nla_get_u8(nla) get payload for a u8 attribute | ||
125 | * nla_get_u16(nla) get payload for a u16 attribute | ||
126 | * nla_get_u32(nla) get payload for a u32 attribute | ||
127 | * nla_get_u64(nla) get payload for a u64 attribute | ||
128 | * nla_get_flag(nla) return 1 if flag is true | ||
129 | * nla_get_msecs(nla) get payload for a msecs attribute | ||
130 | * | ||
131 | * Attribute Misc: | ||
132 | * nla_memcpy(dest, nla, count) copy attribute into memory | ||
133 | * nla_memcmp(nla, data, size) compare attribute with memory area | ||
134 | * nla_strlcpy(dst, nla, size) copy attribute to a sized string | ||
135 | * nla_strcmp(nla, str) compare attribute with string | ||
136 | * | ||
137 | * Attribute Parsing: | ||
138 | * nla_ok(nla, remaining) does nla fit into remaining bytes? | ||
139 | * nla_next(nla, remaining) get next netlink attribute | ||
140 | * nla_validate() validate a stream of attributes | ||
141 | * nla_find() find attribute in stream of attributes | ||
142 | * nla_parse() parse and validate stream of attrs | ||
143 | * nla_parse_nested() parse nested attribuets | ||
144 | * nla_for_each_attr() loop over all attributes | ||
145 | *========================================================================= | ||
146 | */ | ||
147 | |||
148 | /** | ||
149 | * Standard attribute types to specify validation policy | ||
150 | */ | ||
151 | enum { | ||
152 | NLA_UNSPEC, | ||
153 | NLA_U8, | ||
154 | NLA_U16, | ||
155 | NLA_U32, | ||
156 | NLA_U64, | ||
157 | NLA_STRING, | ||
158 | NLA_FLAG, | ||
159 | NLA_MSECS, | ||
160 | NLA_NESTED, | ||
161 | __NLA_TYPE_MAX, | ||
162 | }; | ||
163 | |||
164 | #define NLA_TYPE_MAX (__NLA_TYPE_MAX - 1) | ||
165 | |||
166 | /** | ||
167 | * struct nla_policy - attribute validation policy | ||
168 | * @type: Type of attribute or NLA_UNSPEC | ||
169 | * @minlen: Minimal length of payload required to be available | ||
170 | * | ||
171 | * Policies are defined as arrays of this struct, the array must be | ||
172 | * accessible by attribute type up to the highest identifier to be expected. | ||
173 | * | ||
174 | * Example: | ||
175 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { | ||
176 | * [ATTR_FOO] = { .type = NLA_U16 }, | ||
177 | * [ATTR_BAR] = { .type = NLA_STRING }, | ||
178 | * [ATTR_BAZ] = { .minlen = sizeof(struct mystruct) }, | ||
179 | * }; | ||
180 | */ | ||
181 | struct nla_policy { | ||
182 | u16 type; | ||
183 | u16 minlen; | ||
184 | }; | ||
185 | |||
186 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | ||
187 | int (*cb)(struct sk_buff *, | ||
188 | struct nlmsghdr *, int *)); | ||
189 | extern void netlink_queue_skip(struct nlmsghdr *nlh, | ||
190 | struct sk_buff *skb); | ||
191 | |||
192 | extern int nla_validate(struct nlattr *head, int len, int maxtype, | ||
193 | struct nla_policy *policy); | ||
194 | extern int nla_parse(struct nlattr *tb[], int maxtype, | ||
195 | struct nlattr *head, int len, | ||
196 | struct nla_policy *policy); | ||
197 | extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); | ||
198 | extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, | ||
199 | size_t dstsize); | ||
200 | extern int nla_memcpy(void *dest, struct nlattr *src, int count); | ||
201 | extern int nla_memcmp(const struct nlattr *nla, const void *data, | ||
202 | size_t size); | ||
203 | extern int nla_strcmp(const struct nlattr *nla, const char *str); | ||
204 | extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, | ||
205 | int attrlen); | ||
206 | extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype, | ||
207 | int attrlen); | ||
208 | extern void __nla_put(struct sk_buff *skb, int attrtype, | ||
209 | int attrlen, const void *data); | ||
210 | extern int nla_put(struct sk_buff *skb, int attrtype, | ||
211 | int attrlen, const void *data); | ||
212 | |||
213 | /************************************************************************** | ||
214 | * Netlink Messages | ||
215 | **************************************************************************/ | ||
216 | |||
217 | /** | ||
218 | * nlmsg_msg_size - length of netlink message not including padding | ||
219 | * @payload: length of message payload | ||
220 | */ | ||
221 | static inline int nlmsg_msg_size(int payload) | ||
222 | { | ||
223 | return NLMSG_HDRLEN + payload; | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * nlmsg_total_size - length of netlink message including padding | ||
228 | * @payload: length of message payload | ||
229 | */ | ||
230 | static inline int nlmsg_total_size(int payload) | ||
231 | { | ||
232 | return NLMSG_ALIGN(nlmsg_msg_size(payload)); | ||
233 | } | ||
234 | |||
235 | /** | ||
236 | * nlmsg_padlen - length of padding at the message's tail | ||
237 | * @payload: length of message payload | ||
238 | */ | ||
239 | static inline int nlmsg_padlen(int payload) | ||
240 | { | ||
241 | return nlmsg_total_size(payload) - nlmsg_msg_size(payload); | ||
242 | } | ||
243 | |||
244 | /** | ||
245 | * nlmsg_data - head of message payload | ||
246 | * @nlh: netlink messsage header | ||
247 | */ | ||
248 | static inline void *nlmsg_data(const struct nlmsghdr *nlh) | ||
249 | { | ||
250 | return (unsigned char *) nlh + NLMSG_HDRLEN; | ||
251 | } | ||
252 | |||
253 | /** | ||
254 | * nlmsg_len - length of message payload | ||
255 | * @nlh: netlink message header | ||
256 | */ | ||
257 | static inline int nlmsg_len(const struct nlmsghdr *nlh) | ||
258 | { | ||
259 | return nlh->nlmsg_len - NLMSG_HDRLEN; | ||
260 | } | ||
261 | |||
262 | /** | ||
263 | * nlmsg_attrdata - head of attributes data | ||
264 | * @nlh: netlink message header | ||
265 | * @hdrlen: length of family specific header | ||
266 | */ | ||
267 | static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh, | ||
268 | int hdrlen) | ||
269 | { | ||
270 | unsigned char *data = nlmsg_data(nlh); | ||
271 | return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen)); | ||
272 | } | ||
273 | |||
274 | /** | ||
275 | * nlmsg_attrlen - length of attributes data | ||
276 | * @nlh: netlink message header | ||
277 | * @hdrlen: length of family specific header | ||
278 | */ | ||
279 | static inline int nlmsg_attrlen(const struct nlmsghdr *nlh, int hdrlen) | ||
280 | { | ||
281 | return nlmsg_len(nlh) - NLMSG_ALIGN(hdrlen); | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * nlmsg_ok - check if the netlink message fits into the remaining bytes | ||
286 | * @nlh: netlink message header | ||
287 | * @remaining: number of bytes remaining in message stream | ||
288 | */ | ||
289 | static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining) | ||
290 | { | ||
291 | return (remaining >= sizeof(struct nlmsghdr) && | ||
292 | nlh->nlmsg_len >= sizeof(struct nlmsghdr) && | ||
293 | nlh->nlmsg_len <= remaining); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * nlmsg_next - next netlink message in message stream | ||
298 | * @nlh: netlink message header | ||
299 | * @remaining: number of bytes remaining in message stream | ||
300 | * | ||
301 | * Returns the next netlink message in the message stream and | ||
302 | * decrements remaining by the size of the current message. | ||
303 | */ | ||
304 | static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining) | ||
305 | { | ||
306 | int totlen = NLMSG_ALIGN(nlh->nlmsg_len); | ||
307 | |||
308 | *remaining -= totlen; | ||
309 | |||
310 | return (struct nlmsghdr *) ((unsigned char *) nlh + totlen); | ||
311 | } | ||
312 | |||
313 | /** | ||
314 | * nlmsg_parse - parse attributes of a netlink message | ||
315 | * @nlh: netlink message header | ||
316 | * @hdrlen: length of family specific header | ||
317 | * @tb: destination array with maxtype+1 elements | ||
318 | * @maxtype: maximum attribute type to be expected | ||
319 | * @policy: validation policy | ||
320 | * | ||
321 | * See nla_parse() | ||
322 | */ | ||
323 | static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, | ||
324 | struct nlattr *tb[], int maxtype, | ||
325 | struct nla_policy *policy) | ||
326 | { | ||
327 | if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) | ||
328 | return -EINVAL; | ||
329 | |||
330 | return nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen), | ||
331 | nlmsg_attrlen(nlh, hdrlen), policy); | ||
332 | } | ||
333 | |||
334 | /** | ||
335 | * nlmsg_find_attr - find a specific attribute in a netlink message | ||
336 | * @nlh: netlink message header | ||
337 | * @hdrlen: length of familiy specific header | ||
338 | * @attrtype: type of attribute to look for | ||
339 | * | ||
340 | * Returns the first attribute which matches the specified type. | ||
341 | */ | ||
342 | static inline struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh, | ||
343 | int hdrlen, int attrtype) | ||
344 | { | ||
345 | return nla_find(nlmsg_attrdata(nlh, hdrlen), | ||
346 | nlmsg_attrlen(nlh, hdrlen), attrtype); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * nlmsg_validate - validate a netlink message including attributes | ||
351 | * @nlh: netlinket message header | ||
352 | * @hdrlen: length of familiy specific header | ||
353 | * @maxtype: maximum attribute type to be expected | ||
354 | * @policy: validation policy | ||
355 | */ | ||
356 | static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, | ||
357 | struct nla_policy *policy) | ||
358 | { | ||
359 | if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) | ||
360 | return -EINVAL; | ||
361 | |||
362 | return nla_validate(nlmsg_attrdata(nlh, hdrlen), | ||
363 | nlmsg_attrlen(nlh, hdrlen), maxtype, policy); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * nlmsg_for_each_attr - iterate over a stream of attributes | ||
368 | * @pos: loop counter, set to current attribute | ||
369 | * @nlh: netlink message header | ||
370 | * @hdrlen: length of familiy specific header | ||
371 | * @rem: initialized to len, holds bytes currently remaining in stream | ||
372 | */ | ||
373 | #define nlmsg_for_each_attr(pos, nlh, hdrlen, rem) \ | ||
374 | nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ | ||
375 | nlmsg_attrlen(nlh, hdrlen), rem) | ||
376 | |||
377 | #if 0 | ||
378 | /* FIXME: Enable once all users have been converted */ | ||
379 | |||
380 | /** | ||
381 | * __nlmsg_put - Add a new netlink message to an skb | ||
382 | * @skb: socket buffer to store message in | ||
383 | * @pid: netlink process id | ||
384 | * @seq: sequence number of message | ||
385 | * @type: message type | ||
386 | * @payload: length of message payload | ||
387 | * @flags: message flags | ||
388 | * | ||
389 | * The caller is responsible to ensure that the skb provides enough | ||
390 | * tailroom for both the netlink header and payload. | ||
391 | */ | ||
392 | static inline struct nlmsghdr *__nlmsg_put(struct sk_buff *skb, u32 pid, | ||
393 | u32 seq, int type, int payload, | ||
394 | int flags) | ||
395 | { | ||
396 | struct nlmsghdr *nlh; | ||
397 | |||
398 | nlh = (struct nlmsghdr *) skb_put(skb, nlmsg_total_size(payload)); | ||
399 | nlh->nlmsg_type = type; | ||
400 | nlh->nlmsg_len = nlmsg_msg_size(payload); | ||
401 | nlh->nlmsg_flags = flags; | ||
402 | nlh->nlmsg_pid = pid; | ||
403 | nlh->nlmsg_seq = seq; | ||
404 | |||
405 | memset((unsigned char *) nlmsg_data(nlh) + payload, 0, | ||
406 | nlmsg_padlen(payload)); | ||
407 | |||
408 | return nlh; | ||
409 | } | ||
410 | #endif | ||
411 | |||
412 | /** | ||
413 | * nlmsg_put - Add a new netlink message to an skb | ||
414 | * @skb: socket buffer to store message in | ||
415 | * @pid: netlink process id | ||
416 | * @seq: sequence number of message | ||
417 | * @type: message type | ||
418 | * @payload: length of message payload | ||
419 | * @flags: message flags | ||
420 | * | ||
421 | * Returns NULL if the tailroom of the skb is insufficient to store | ||
422 | * the message header and payload. | ||
423 | */ | ||
424 | static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, | ||
425 | int type, int payload, int flags) | ||
426 | { | ||
427 | if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload))) | ||
428 | return NULL; | ||
429 | |||
430 | return __nlmsg_put(skb, pid, seq, type, payload, flags); | ||
431 | } | ||
432 | |||
433 | /** | ||
434 | * nlmsg_put_answer - Add a new callback based netlink message to an skb | ||
435 | * @skb: socket buffer to store message in | ||
436 | * @cb: netlink callback | ||
437 | * @type: message type | ||
438 | * @payload: length of message payload | ||
439 | * @flags: message flags | ||
440 | * | ||
441 | * Returns NULL if the tailroom of the skb is insufficient to store | ||
442 | * the message header and payload. | ||
443 | */ | ||
444 | static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb, | ||
445 | struct netlink_callback *cb, | ||
446 | int type, int payload, | ||
447 | int flags) | ||
448 | { | ||
449 | return nlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, | ||
450 | type, payload, flags); | ||
451 | } | ||
452 | |||
453 | /** | ||
454 | * nlmsg_new - Allocate a new netlink message | ||
455 | * @size: maximum size of message | ||
456 | * | ||
457 | * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. | ||
458 | */ | ||
459 | static inline struct sk_buff *nlmsg_new(int size) | ||
460 | { | ||
461 | return alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | ||
462 | } | ||
463 | |||
464 | /** | ||
465 | * nlmsg_end - Finalize a netlink message | ||
466 | * @skb: socket buffer the message is stored in | ||
467 | * @nlh: netlink message header | ||
468 | * | ||
469 | * Corrects the netlink message header to include the appeneded | ||
470 | * attributes. Only necessary if attributes have been added to | ||
471 | * the message. | ||
472 | * | ||
473 | * Returns the total data length of the skb. | ||
474 | */ | ||
475 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | ||
476 | { | ||
477 | nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; | ||
478 | |||
479 | return skb->len; | ||
480 | } | ||
481 | |||
482 | /** | ||
483 | * nlmsg_cancel - Cancel construction of a netlink message | ||
484 | * @skb: socket buffer the message is stored in | ||
485 | * @nlh: netlink message header | ||
486 | * | ||
487 | * Removes the complete netlink message including all | ||
488 | * attributes from the socket buffer again. Returns -1. | ||
489 | */ | ||
490 | static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) | ||
491 | { | ||
492 | skb_trim(skb, (unsigned char *) nlh - skb->data); | ||
493 | |||
494 | return -1; | ||
495 | } | ||
496 | |||
497 | /** | ||
498 | * nlmsg_free - free a netlink message | ||
499 | * @skb: socket buffer of netlink message | ||
500 | */ | ||
501 | static inline void nlmsg_free(struct sk_buff *skb) | ||
502 | { | ||
503 | kfree_skb(skb); | ||
504 | } | ||
505 | |||
506 | /** | ||
507 | * nlmsg_multicast - multicast a netlink message | ||
508 | * @sk: netlink socket to spread messages to | ||
509 | * @skb: netlink message as socket buffer | ||
510 | * @pid: own netlink pid to avoid sending to yourself | ||
511 | * @group: multicast group id | ||
512 | */ | ||
513 | static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, | ||
514 | u32 pid, unsigned int group) | ||
515 | { | ||
516 | int err; | ||
517 | |||
518 | NETLINK_CB(skb).dst_group = group; | ||
519 | |||
520 | err = netlink_broadcast(sk, skb, pid, group, GFP_KERNEL); | ||
521 | if (err > 0) | ||
522 | err = 0; | ||
523 | |||
524 | return err; | ||
525 | } | ||
526 | |||
527 | /** | ||
528 | * nlmsg_unicast - unicast a netlink message | ||
529 | * @sk: netlink socket to spread message to | ||
530 | * @skb: netlink message as socket buffer | ||
531 | * @pid: netlink pid of the destination socket | ||
532 | */ | ||
533 | static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 pid) | ||
534 | { | ||
535 | int err; | ||
536 | |||
537 | err = netlink_unicast(sk, skb, pid, MSG_DONTWAIT); | ||
538 | if (err > 0) | ||
539 | err = 0; | ||
540 | |||
541 | return err; | ||
542 | } | ||
543 | |||
544 | /** | ||
545 | * nlmsg_for_each_msg - iterate over a stream of messages | ||
546 | * @pos: loop counter, set to current message | ||
547 | * @head: head of message stream | ||
548 | * @len: length of message stream | ||
549 | * @rem: initialized to len, holds bytes currently remaining in stream | ||
550 | */ | ||
551 | #define nlmsg_for_each_msg(pos, head, len, rem) \ | ||
552 | for (pos = head, rem = len; \ | ||
553 | nlmsg_ok(pos, rem); \ | ||
554 | pos = nlmsg_next(pos, &(rem))) | ||
555 | |||
556 | /************************************************************************** | ||
557 | * Netlink Attributes | ||
558 | **************************************************************************/ | ||
559 | |||
560 | /** | ||
561 | * nla_attr_size - length of attribute not including padding | ||
562 | * @payload: length of payload | ||
563 | */ | ||
564 | static inline int nla_attr_size(int payload) | ||
565 | { | ||
566 | return NLA_HDRLEN + payload; | ||
567 | } | ||
568 | |||
569 | /** | ||
570 | * nla_total_size - total length of attribute including padding | ||
571 | * @payload: length of payload | ||
572 | */ | ||
573 | static inline int nla_total_size(int payload) | ||
574 | { | ||
575 | return NLA_ALIGN(nla_attr_size(payload)); | ||
576 | } | ||
577 | |||
578 | /** | ||
579 | * nla_padlen - length of padding at the tail of attribute | ||
580 | * @payload: length of payload | ||
581 | */ | ||
582 | static inline int nla_padlen(int payload) | ||
583 | { | ||
584 | return nla_total_size(payload) - nla_attr_size(payload); | ||
585 | } | ||
586 | |||
587 | /** | ||
588 | * nla_data - head of payload | ||
589 | * @nla: netlink attribute | ||
590 | */ | ||
591 | static inline void *nla_data(const struct nlattr *nla) | ||
592 | { | ||
593 | return (char *) nla + NLA_HDRLEN; | ||
594 | } | ||
595 | |||
596 | /** | ||
597 | * nla_len - length of payload | ||
598 | * @nla: netlink attribute | ||
599 | */ | ||
600 | static inline int nla_len(const struct nlattr *nla) | ||
601 | { | ||
602 | return nla->nla_len - NLA_HDRLEN; | ||
603 | } | ||
604 | |||
605 | /** | ||
606 | * nla_ok - check if the netlink attribute fits into the remaining bytes | ||
607 | * @nla: netlink attribute | ||
608 | * @remaining: number of bytes remaining in attribute stream | ||
609 | */ | ||
610 | static inline int nla_ok(const struct nlattr *nla, int remaining) | ||
611 | { | ||
612 | return remaining >= sizeof(*nla) && | ||
613 | nla->nla_len >= sizeof(*nla) && | ||
614 | nla->nla_len <= remaining; | ||
615 | } | ||
616 | |||
617 | /** | ||
618 | * nla_next - next netlink attribte in attribute stream | ||
619 | * @nla: netlink attribute | ||
620 | * @remaining: number of bytes remaining in attribute stream | ||
621 | * | ||
622 | * Returns the next netlink attribute in the attribute stream and | ||
623 | * decrements remaining by the size of the current attribute. | ||
624 | */ | ||
625 | static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining) | ||
626 | { | ||
627 | int totlen = NLA_ALIGN(nla->nla_len); | ||
628 | |||
629 | *remaining -= totlen; | ||
630 | return (struct nlattr *) ((char *) nla + totlen); | ||
631 | } | ||
632 | |||
633 | /** | ||
634 | * nla_parse_nested - parse nested attributes | ||
635 | * @tb: destination array with maxtype+1 elements | ||
636 | * @maxtype: maximum attribute type to be expected | ||
637 | * @nla: attribute containing the nested attributes | ||
638 | * @policy: validation policy | ||
639 | * | ||
640 | * See nla_parse() | ||
641 | */ | ||
642 | static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, | ||
643 | struct nlattr *nla, | ||
644 | struct nla_policy *policy) | ||
645 | { | ||
646 | return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); | ||
647 | } | ||
648 | /** | ||
649 | * nla_put_u8 - Add a u16 netlink attribute to a socket buffer | ||
650 | * @skb: socket buffer to add attribute to | ||
651 | * @attrtype: attribute type | ||
652 | * @value: numeric value | ||
653 | */ | ||
654 | static inline int nla_put_u8(struct sk_buff *skb, int attrtype, u8 value) | ||
655 | { | ||
656 | return nla_put(skb, attrtype, sizeof(u8), &value); | ||
657 | } | ||
658 | |||
659 | /** | ||
660 | * nla_put_u16 - Add a u16 netlink attribute to a socket buffer | ||
661 | * @skb: socket buffer to add attribute to | ||
662 | * @attrtype: attribute type | ||
663 | * @value: numeric value | ||
664 | */ | ||
665 | static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value) | ||
666 | { | ||
667 | return nla_put(skb, attrtype, sizeof(u16), &value); | ||
668 | } | ||
669 | |||
670 | /** | ||
671 | * nla_put_u32 - Add a u32 netlink attribute to a socket buffer | ||
672 | * @skb: socket buffer to add attribute to | ||
673 | * @attrtype: attribute type | ||
674 | * @value: numeric value | ||
675 | */ | ||
676 | static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value) | ||
677 | { | ||
678 | return nla_put(skb, attrtype, sizeof(u32), &value); | ||
679 | } | ||
680 | |||
681 | /** | ||
682 | * nla_put_64 - Add a u64 netlink attribute to a socket buffer | ||
683 | * @skb: socket buffer to add attribute to | ||
684 | * @attrtype: attribute type | ||
685 | * @value: numeric value | ||
686 | */ | ||
687 | static inline int nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) | ||
688 | { | ||
689 | return nla_put(skb, attrtype, sizeof(u64), &value); | ||
690 | } | ||
691 | |||
692 | /** | ||
693 | * nla_put_string - Add a string netlink attribute to a socket buffer | ||
694 | * @skb: socket buffer to add attribute to | ||
695 | * @attrtype: attribute type | ||
696 | * @str: NUL terminated string | ||
697 | */ | ||
698 | static inline int nla_put_string(struct sk_buff *skb, int attrtype, | ||
699 | const char *str) | ||
700 | { | ||
701 | return nla_put(skb, attrtype, strlen(str) + 1, str); | ||
702 | } | ||
703 | |||
704 | /** | ||
705 | * nla_put_flag - Add a flag netlink attribute to a socket buffer | ||
706 | * @skb: socket buffer to add attribute to | ||
707 | * @attrtype: attribute type | ||
708 | */ | ||
709 | static inline int nla_put_flag(struct sk_buff *skb, int attrtype) | ||
710 | { | ||
711 | return nla_put(skb, attrtype, 0, NULL); | ||
712 | } | ||
713 | |||
714 | /** | ||
715 | * nla_put_msecs - Add a msecs netlink attribute to a socket buffer | ||
716 | * @skb: socket buffer to add attribute to | ||
717 | * @attrtype: attribute type | ||
718 | * @jiffies: number of msecs in jiffies | ||
719 | */ | ||
720 | static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | ||
721 | unsigned long jiffies) | ||
722 | { | ||
723 | u64 tmp = jiffies_to_msecs(jiffies); | ||
724 | return nla_put(skb, attrtype, sizeof(u64), &tmp); | ||
725 | } | ||
726 | |||
727 | #define NLA_PUT(skb, attrtype, attrlen, data) \ | ||
728 | do { \ | ||
729 | if (nla_put(skb, attrtype, attrlen, data) < 0) \ | ||
730 | goto nla_put_failure; \ | ||
731 | } while(0) | ||
732 | |||
733 | #define NLA_PUT_TYPE(skb, type, attrtype, value) \ | ||
734 | do { \ | ||
735 | type __tmp = value; \ | ||
736 | NLA_PUT(skb, attrtype, sizeof(type), &__tmp); \ | ||
737 | } while(0) | ||
738 | |||
739 | #define NLA_PUT_U8(skb, attrtype, value) \ | ||
740 | NLA_PUT_TYPE(skb, u8, attrtype, value) | ||
741 | |||
742 | #define NLA_PUT_U16(skb, attrtype, value) \ | ||
743 | NLA_PUT_TYPE(skb, u16, attrtype, value) | ||
744 | |||
745 | #define NLA_PUT_U32(skb, attrtype, value) \ | ||
746 | NLA_PUT_TYPE(skb, u32, attrtype, value) | ||
747 | |||
748 | #define NLA_PUT_U64(skb, attrtype, value) \ | ||
749 | NLA_PUT_TYPE(skb, u64, attrtype, value) | ||
750 | |||
751 | #define NLA_PUT_STRING(skb, attrtype, value) \ | ||
752 | NLA_PUT(skb, attrtype, strlen(value) + 1, value) | ||
753 | |||
754 | #define NLA_PUT_FLAG(skb, attrtype, value) \ | ||
755 | NLA_PUT(skb, attrtype, 0, NULL) | ||
756 | |||
757 | #define NLA_PUT_MSECS(skb, attrtype, jiffies) \ | ||
758 | NLA_PUT_U64(skb, attrtype, jiffies_to_msecs(jiffies)) | ||
759 | |||
760 | /** | ||
761 | * nla_get_u32 - return payload of u32 attribute | ||
762 | * @nla: u32 netlink attribute | ||
763 | */ | ||
764 | static inline u32 nla_get_u32(struct nlattr *nla) | ||
765 | { | ||
766 | return *(u32 *) nla_data(nla); | ||
767 | } | ||
768 | |||
769 | /** | ||
770 | * nla_get_u16 - return payload of u16 attribute | ||
771 | * @nla: u16 netlink attribute | ||
772 | */ | ||
773 | static inline u16 nla_get_u16(struct nlattr *nla) | ||
774 | { | ||
775 | return *(u16 *) nla_data(nla); | ||
776 | } | ||
777 | |||
778 | /** | ||
779 | * nla_get_u8 - return payload of u8 attribute | ||
780 | * @nla: u8 netlink attribute | ||
781 | */ | ||
782 | static inline u8 nla_get_u8(struct nlattr *nla) | ||
783 | { | ||
784 | return *(u8 *) nla_data(nla); | ||
785 | } | ||
786 | |||
787 | /** | ||
788 | * nla_get_u64 - return payload of u64 attribute | ||
789 | * @nla: u64 netlink attribute | ||
790 | */ | ||
791 | static inline u64 nla_get_u64(struct nlattr *nla) | ||
792 | { | ||
793 | u64 tmp; | ||
794 | |||
795 | nla_memcpy(&tmp, nla, sizeof(tmp)); | ||
796 | |||
797 | return tmp; | ||
798 | } | ||
799 | |||
800 | /** | ||
801 | * nla_get_flag - return payload of flag attribute | ||
802 | * @nla: flag netlink attribute | ||
803 | */ | ||
804 | static inline int nla_get_flag(struct nlattr *nla) | ||
805 | { | ||
806 | return !!nla; | ||
807 | } | ||
808 | |||
809 | /** | ||
810 | * nla_get_msecs - return payload of msecs attribute | ||
811 | * @nla: msecs netlink attribute | ||
812 | * | ||
813 | * Returns the number of milliseconds in jiffies. | ||
814 | */ | ||
815 | static inline unsigned long nla_get_msecs(struct nlattr *nla) | ||
816 | { | ||
817 | u64 msecs = nla_get_u64(nla); | ||
818 | |||
819 | return msecs_to_jiffies((unsigned long) msecs); | ||
820 | } | ||
821 | |||
822 | /** | ||
823 | * nla_nest_start - Start a new level of nested attributes | ||
824 | * @skb: socket buffer to add attributes to | ||
825 | * @attrtype: attribute type of container | ||
826 | * | ||
827 | * Returns the container attribute | ||
828 | */ | ||
829 | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | ||
830 | { | ||
831 | struct nlattr *start = (struct nlattr *) skb->tail; | ||
832 | |||
833 | if (nla_put(skb, attrtype, 0, NULL) < 0) | ||
834 | return NULL; | ||
835 | |||
836 | return start; | ||
837 | } | ||
838 | |||
839 | /** | ||
840 | * nla_nest_end - Finalize nesting of attributes | ||
841 | * @skb: socket buffer the attribtues are stored in | ||
842 | * @start: container attribute | ||
843 | * | ||
844 | * Corrects the container attribute header to include the all | ||
845 | * appeneded attributes. | ||
846 | * | ||
847 | * Returns the total data length of the skb. | ||
848 | */ | ||
849 | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | ||
850 | { | ||
851 | start->nla_len = skb->tail - (unsigned char *) start; | ||
852 | return skb->len; | ||
853 | } | ||
854 | |||
855 | /** | ||
856 | * nla_nest_cancel - Cancel nesting of attributes | ||
857 | * @skb: socket buffer the message is stored in | ||
858 | * @start: container attribute | ||
859 | * | ||
860 | * Removes the container attribute and including all nested | ||
861 | * attributes. Returns -1. | ||
862 | */ | ||
863 | static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | ||
864 | { | ||
865 | if (start) | ||
866 | skb_trim(skb, (unsigned char *) start - skb->data); | ||
867 | |||
868 | return -1; | ||
869 | } | ||
870 | |||
871 | /** | ||
872 | * nla_for_each_attr - iterate over a stream of attributes | ||
873 | * @pos: loop counter, set to current attribute | ||
874 | * @head: head of attribute stream | ||
875 | * @len: length of attribute stream | ||
876 | * @rem: initialized to len, holds bytes currently remaining in stream | ||
877 | */ | ||
878 | #define nla_for_each_attr(pos, head, len, rem) \ | ||
879 | for (pos = head, rem = len; \ | ||
880 | nla_ok(pos, rem); \ | ||
881 | pos = nla_next(pos, &(rem))) | ||
882 | |||
883 | #endif | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index c24339c4e310..96cc3b434e40 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/cache.h> | 28 | #include <linux/cache.h> |
29 | #include <linux/percpu.h> | 29 | #include <linux/percpu.h> |
30 | #include <linux/skbuff.h> | ||
30 | 31 | ||
31 | #include <net/inet_connection_sock.h> | 32 | #include <net/inet_connection_sock.h> |
32 | #include <net/inet_timewait_sock.h> | 33 | #include <net/inet_timewait_sock.h> |
@@ -852,7 +853,7 @@ static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len, | |||
852 | 853 | ||
853 | static __inline__ int __tcp_checksum_complete(struct sk_buff *skb) | 854 | static __inline__ int __tcp_checksum_complete(struct sk_buff *skb) |
854 | { | 855 | { |
855 | return (unsigned short)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum)); | 856 | return __skb_checksum_complete(skb); |
856 | } | 857 | } |
857 | 858 | ||
858 | static __inline__ int tcp_checksum_complete(struct sk_buff *skb) | 859 | static __inline__ int tcp_checksum_complete(struct sk_buff *skb) |
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h index 072f3a2edace..5ff1490c08db 100644 --- a/include/rdma/ib_user_verbs.h +++ b/include/rdma/ib_user_verbs.h | |||
@@ -43,7 +43,7 @@ | |||
43 | * Increment this value if any changes that break userspace ABI | 43 | * Increment this value if any changes that break userspace ABI |
44 | * compatibility are made. | 44 | * compatibility are made. |
45 | */ | 45 | */ |
46 | #define IB_USER_VERBS_ABI_VERSION 3 | 46 | #define IB_USER_VERBS_ABI_VERSION 4 |
47 | 47 | ||
48 | enum { | 48 | enum { |
49 | IB_USER_VERBS_CMD_GET_CONTEXT, | 49 | IB_USER_VERBS_CMD_GET_CONTEXT, |
@@ -333,6 +333,11 @@ struct ib_uverbs_create_qp { | |||
333 | struct ib_uverbs_create_qp_resp { | 333 | struct ib_uverbs_create_qp_resp { |
334 | __u32 qp_handle; | 334 | __u32 qp_handle; |
335 | __u32 qpn; | 335 | __u32 qpn; |
336 | __u32 max_send_wr; | ||
337 | __u32 max_recv_wr; | ||
338 | __u32 max_send_sge; | ||
339 | __u32 max_recv_sge; | ||
340 | __u32 max_inline_data; | ||
336 | }; | 341 | }; |
337 | 342 | ||
338 | /* | 343 | /* |
@@ -552,9 +557,7 @@ struct ib_uverbs_modify_srq { | |||
552 | __u32 srq_handle; | 557 | __u32 srq_handle; |
553 | __u32 attr_mask; | 558 | __u32 attr_mask; |
554 | __u32 max_wr; | 559 | __u32 max_wr; |
555 | __u32 max_sge; | ||
556 | __u32 srq_limit; | 560 | __u32 srq_limit; |
557 | __u32 reserved; | ||
558 | __u64 driver_data[0]; | 561 | __u64 driver_data[0]; |
559 | }; | 562 | }; |
560 | 563 | ||
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index f72d46d54e0a..a7f4c355a91f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -881,7 +881,7 @@ struct ib_device { | |||
881 | struct ib_ucontext *context, | 881 | struct ib_ucontext *context, |
882 | struct ib_udata *udata); | 882 | struct ib_udata *udata); |
883 | int (*destroy_cq)(struct ib_cq *cq); | 883 | int (*destroy_cq)(struct ib_cq *cq); |
884 | int (*resize_cq)(struct ib_cq *cq, int *cqe); | 884 | int (*resize_cq)(struct ib_cq *cq, int cqe); |
885 | int (*poll_cq)(struct ib_cq *cq, int num_entries, | 885 | int (*poll_cq)(struct ib_cq *cq, int num_entries, |
886 | struct ib_wc *wc); | 886 | struct ib_wc *wc); |
887 | int (*peek_cq)(struct ib_cq *cq, int wc_cnt); | 887 | int (*peek_cq)(struct ib_cq *cq, int wc_cnt); |