diff options
Diffstat (limited to 'include')
331 files changed, 7697 insertions, 3045 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-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 8393bf374b2b..a985cd29b6db 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h | |||
| @@ -17,6 +17,9 @@ | |||
| 17 | #include <asm/processor.h> /* For TASK_SIZE */ | 17 | #include <asm/processor.h> /* For TASK_SIZE */ |
| 18 | #include <asm/machvec.h> | 18 | #include <asm/machvec.h> |
| 19 | 19 | ||
| 20 | struct mm_struct; | ||
| 21 | struct vm_area_struct; | ||
| 22 | |||
| 20 | /* Certain architectures need to do special things when PTEs | 23 | /* Certain architectures need to do special things when PTEs |
| 21 | * within a page table are directly modified. Thus, the following | 24 | * within a page table are directly modified. Thus, the following |
| 22 | * hook is made available. | 25 | * hook is made available. |
diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h index d462c5e14c13..072375c135b4 100644 --- a/include/asm-alpha/ptrace.h +++ b/include/asm-alpha/ptrace.h | |||
| @@ -67,6 +67,9 @@ struct switch_stack { | |||
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | #ifdef __KERNEL__ | 69 | #ifdef __KERNEL__ |
| 70 | |||
| 71 | #define __ARCH_SYS_PTRACE 1 | ||
| 72 | |||
| 70 | #define user_mode(regs) (((regs)->ps & 8) != 0) | 73 | #define user_mode(regs) (((regs)->ps & 8) != 0) |
| 71 | #define instruction_pointer(regs) ((regs)->pc) | 74 | #define instruction_pointer(regs) ((regs)->pc) |
| 72 | #define profile_pc(regs) instruction_pointer(regs) | 75 | #define profile_pc(regs) instruction_pointer(regs) |
diff --git a/include/asm-arm/arch-iop3xx/iop331.h b/include/asm-arm/arch-iop3xx/iop331.h index 96adffd8bad2..fbf0cc11bdd9 100644 --- a/include/asm-arm/arch-iop3xx/iop331.h +++ b/include/asm-arm/arch-iop3xx/iop331.h | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | 42 | ||
| 43 | /* this can be 128M if OMWTVR1 is set */ | 43 | /* this can be 128M if OMWTVR1 is set */ |
| 44 | #define IOP331_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */ | 44 | #define IOP331_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */ |
| 45 | //#define IOP331_PCI_MEM_WINDOW_SIZE (~*IOP331_IALR1 + 1) | 45 | /* #define IOP331_PCI_MEM_WINDOW_SIZE (~*IOP331_IALR1 + 1) */ |
| 46 | #define IOP331_PCI_LOWER_MEM_PA 0x80000000 | 46 | #define IOP331_PCI_LOWER_MEM_PA 0x80000000 |
| 47 | #define IOP331_PCI_LOWER_MEM_BA (*IOP331_OMWTVR0) | 47 | #define IOP331_PCI_LOWER_MEM_BA (*IOP331_OMWTVR0) |
| 48 | #define IOP331_PCI_UPPER_MEM_PA (IOP331_PCI_LOWER_MEM_PA + IOP331_PCI_MEM_WINDOW_SIZE - 1) | 48 | #define IOP331_PCI_UPPER_MEM_PA (IOP331_PCI_LOWER_MEM_PA + IOP331_PCI_MEM_WINDOW_SIZE - 1) |
diff --git a/include/asm-arm/arch-pxa/pm.h b/include/asm-arm/arch-pxa/pm.h new file mode 100644 index 000000000000..7a8a1cdf430d --- /dev/null +++ b/include/asm-arm/arch-pxa/pm.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2005 Richard Purdie | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License version 2 as | ||
| 6 | * published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | */ | ||
| 9 | |||
| 10 | extern int pxa_pm_prepare(suspend_state_t state); | ||
| 11 | extern int pxa_pm_enter(suspend_state_t state); | ||
| 12 | extern int pxa_pm_finish(suspend_state_t state); | ||
diff --git a/include/asm-arm/arch-pxa/tosa.h b/include/asm-arm/arch-pxa/tosa.h new file mode 100644 index 000000000000..c3364a2c4758 --- /dev/null +++ b/include/asm-arm/arch-pxa/tosa.h | |||
| @@ -0,0 +1,166 @@ | |||
| 1 | /* | ||
| 2 | * Hardware specific definitions for Sharp SL-C6000x series of PDAs | ||
| 3 | * | ||
| 4 | * Copyright (c) 2005 Dirk Opfer | ||
| 5 | * | ||
| 6 | * Based on Sharp's 2.4 kernel patches | ||
| 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 _ASM_ARCH_TOSA_H_ | ||
| 14 | #define _ASM_ARCH_TOSA_H_ 1 | ||
| 15 | |||
| 16 | /* TOSA Chip selects */ | ||
| 17 | #define TOSA_LCDC_PHYS PXA_CS4_PHYS | ||
| 18 | /* Internel Scoop */ | ||
| 19 | #define TOSA_CF_PHYS (PXA_CS2_PHYS + 0x00800000) | ||
| 20 | /* Jacket Scoop */ | ||
| 21 | #define TOSA_SCOOP_PHYS (PXA_CS5_PHYS + 0x00800000) | ||
| 22 | |||
| 23 | /* | ||
| 24 | * SCOOP2 internal GPIOs | ||
| 25 | */ | ||
| 26 | #define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11 | ||
| 27 | #define TOSA_SCOOP_TC6393_REST_IN SCOOP_GPCR_PA12 | ||
| 28 | #define TOSA_SCOOP_IR_POWERDWN SCOOP_GPCR_PA13 | ||
| 29 | #define TOSA_SCOOP_SD_WP SCOOP_GPCR_PA14 | ||
| 30 | #define TOSA_SCOOP_PWR_ON SCOOP_GPCR_PA15 | ||
| 31 | #define TOSA_SCOOP_AUD_PWR_ON SCOOP_GPCR_PA16 | ||
| 32 | #define TOSA_SCOOP_BT_RESET SCOOP_GPCR_PA17 | ||
| 33 | #define TOSA_SCOOP_BT_PWR_EN SCOOP_GPCR_PA18 | ||
| 34 | #define TOSA_SCOOP_AC_IN_OL SCOOP_GPCR_PA19 | ||
| 35 | |||
| 36 | /* GPIO Direction 1 : output mode / 0:input mode */ | ||
| 37 | #define TOSA_SCOOP_IO_DIR ( TOSA_SCOOP_PXA_VCORE1 | TOSA_SCOOP_TC6393_REST_IN | \ | ||
| 38 | TOSA_SCOOP_IR_POWERDWN | TOSA_SCOOP_PWR_ON | TOSA_SCOOP_AUD_PWR_ON |\ | ||
| 39 | TOSA_SCOOP_BT_RESET | TOSA_SCOOP_BT_PWR_EN ) | ||
| 40 | /* GPIO out put level when init 1: Hi */ | ||
| 41 | #define TOSA_SCOOP_IO_OUT ( TOSA_SCOOP_TC6393_REST_IN ) | ||
| 42 | |||
| 43 | /* | ||
| 44 | * SCOOP2 jacket GPIOs | ||
| 45 | */ | ||
| 46 | #define TOSA_SCOOP_JC_BT_LED SCOOP_GPCR_PA11 | ||
| 47 | #define TOSA_SCOOP_JC_NOTE_LED SCOOP_GPCR_PA12 | ||
| 48 | #define TOSA_SCOOP_JC_CHRG_ERR_LED SCOOP_GPCR_PA13 | ||
| 49 | #define TOSA_SCOOP_JC_USB_PULLUP SCOOP_GPCR_PA14 | ||
| 50 | #define TOSA_SCOOP_JC_TC6393_SUSPEND SCOOP_GPCR_PA15 | ||
| 51 | #define TOSA_SCOOP_JC_TC3693_L3V_ON SCOOP_GPCR_PA16 | ||
| 52 | #define TOSA_SCOOP_JC_WLAN_DETECT SCOOP_GPCR_PA17 | ||
| 53 | #define TOSA_SCOOP_JC_WLAN_LED SCOOP_GPCR_PA18 | ||
| 54 | #define TOSA_SCOOP_JC_CARD_LIMIT_SEL SCOOP_GPCR_PA19 | ||
| 55 | |||
| 56 | /* GPIO Direction 1 : output mode / 0:input mode */ | ||
| 57 | #define TOSA_SCOOP_JC_IO_DIR ( TOSA_SCOOP_JC_BT_LED | TOSA_SCOOP_JC_NOTE_LED | \ | ||
| 58 | TOSA_SCOOP_JC_CHRG_ERR_LED | TOSA_SCOOP_JC_USB_PULLUP | \ | ||
| 59 | TOSA_SCOOP_JC_TC6393_SUSPEND | TOSA_SCOOP_JC_TC3693_L3V_ON | \ | ||
| 60 | TOSA_SCOOP_JC_WLAN_LED | TOSA_SCOOP_JC_CARD_LIMIT_SEL ) | ||
| 61 | /* GPIO out put level when init 1: Hi */ | ||
| 62 | #define TOSA_SCOOP_JC_IO_OUT ( 0 ) | ||
| 63 | |||
| 64 | /* | ||
| 65 | * Timing Generator | ||
| 66 | */ | ||
| 67 | #define TG_PNLCTL 0x00 | ||
| 68 | #define TG_TPOSCTL 0x01 | ||
| 69 | #define TG_DUTYCTL 0x02 | ||
| 70 | #define TG_GPOSR 0x03 | ||
| 71 | #define TG_GPODR1 0x04 | ||
| 72 | #define TG_GPODR2 0x05 | ||
| 73 | #define TG_PINICTL 0x06 | ||
| 74 | #define TG_HPOSCTL 0x07 | ||
| 75 | |||
| 76 | /* | ||
| 77 | * LED | ||
| 78 | */ | ||
| 79 | #define TOSA_SCOOP_LED_BLUE TOSA_SCOOP_GPCR_PA11 | ||
| 80 | #define TOSA_SCOOP_LED_GREEN TOSA_SCOOP_GPCR_PA12 | ||
| 81 | #define TOSA_SCOOP_LED_ORANGE TOSA_SCOOP_GPCR_PA13 | ||
| 82 | #define TOSA_SCOOP_LED_WLAN TOSA_SCOOP_GPCR_PA18 | ||
| 83 | |||
| 84 | |||
| 85 | /* | ||
| 86 | * PXA GPIOs | ||
| 87 | */ | ||
| 88 | #define TOSA_GPIO_POWERON (0) | ||
| 89 | #define TOSA_GPIO_RESET (1) | ||
| 90 | #define TOSA_GPIO_AC_IN (2) | ||
| 91 | #define TOSA_GPIO_RECORD_BTN (3) | ||
| 92 | #define TOSA_GPIO_SYNC (4) /* Cradle SYNC Button */ | ||
| 93 | #define TOSA_GPIO_USB_IN (5) | ||
| 94 | #define TOSA_GPIO_JACKET_DETECT (7) | ||
| 95 | #define TOSA_GPIO_nSD_DETECT (9) | ||
| 96 | #define TOSA_GPIO_nSD_INT (10) | ||
| 97 | #define TOSA_GPIO_TC6393_CLK (11) | ||
| 98 | #define TOSA_GPIO_BAT1_CRG (12) | ||
| 99 | #define TOSA_GPIO_CF_CD (13) | ||
| 100 | #define TOSA_GPIO_BAT0_CRG (14) | ||
| 101 | #define TOSA_GPIO_TC6393_INT (15) | ||
| 102 | #define TOSA_GPIO_BAT0_LOW (17) | ||
| 103 | #define TOSA_GPIO_TC6393_RDY (18) | ||
| 104 | #define TOSA_GPIO_ON_RESET (19) | ||
| 105 | #define TOSA_GPIO_EAR_IN (20) | ||
| 106 | #define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */ | ||
| 107 | #define TOSA_GPIO_ON_KEY (22) | ||
| 108 | #define TOSA_GPIO_VGA_LINE (27) | ||
| 109 | #define TOSA_GPIO_TP_INT (32) /* Touch Panel pen down interrupt */ | ||
| 110 | #define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */ | ||
| 111 | #define TOSA_GPIO_BAT_LOCKED (38) /* Battery locked */ | ||
| 112 | #define TOSA_GPIO_TG_SPI_SCLK (81) | ||
| 113 | #define TOSA_GPIO_TG_SPI_CS (82) | ||
| 114 | #define TOSA_GPIO_TG_SPI_MOSI (83) | ||
| 115 | #define TOSA_GPIO_BAT1_LOW (84) | ||
| 116 | |||
| 117 | #define TOSA_GPIO_HP_IN GPIO_EAR_IN | ||
| 118 | |||
| 119 | #define TOSA_GPIO_MAIN_BAT_LOW GPIO_BAT0_LOW | ||
| 120 | |||
| 121 | #define TOSA_KEY_STROBE_NUM (11) | ||
| 122 | #define TOSA_KEY_SENSE_NUM (7) | ||
| 123 | |||
| 124 | #define TOSA_GPIO_HIGH_STROBE_BIT (0xfc000000) | ||
| 125 | #define TOSA_GPIO_LOW_STROBE_BIT (0x0000001f) | ||
| 126 | #define TOSA_GPIO_ALL_SENSE_BIT (0x00000fe0) | ||
| 127 | #define TOSA_GPIO_ALL_SENSE_RSHIFT (5) | ||
| 128 | #define TOSA_GPIO_STROBE_BIT(a) GPIO_bit(58+(a)) | ||
| 129 | #define TOSA_GPIO_SENSE_BIT(a) GPIO_bit(69+(a)) | ||
| 130 | #define TOSA_GAFR_HIGH_STROBE_BIT (0xfff00000) | ||
| 131 | #define TOSA_GAFR_LOW_STROBE_BIT (0x000003ff) | ||
| 132 | #define TOSA_GAFR_ALL_SENSE_BIT (0x00fffc00) | ||
| 133 | #define TOSA_GPIO_KEY_SENSE(a) (69+(a)) | ||
| 134 | #define TOSA_GPIO_KEY_STROBE(a) (58+(a)) | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Interrupts | ||
| 138 | */ | ||
| 139 | #define TOSA_IRQ_GPIO_WAKEUP IRQ_GPIO(TOSA_GPIO_WAKEUP) | ||
| 140 | #define TOSA_IRQ_GPIO_AC_IN IRQ_GPIO(TOSA_GPIO_AC_IN) | ||
| 141 | #define TOSA_IRQ_GPIO_RECORD_BTN IRQ_GPIO(TOSA_GPIO_RECORD_BTN) | ||
| 142 | #define TOSA_IRQ_GPIO_SYNC IRQ_GPIO(TOSA_GPIO_SYNC) | ||
| 143 | #define TOSA_IRQ_GPIO_USB_IN IRQ_GPIO(TOSA_GPIO_USB_IN) | ||
| 144 | #define TOSA_IRQ_GPIO_JACKET_DETECT IRQ_GPIO(TOSA_GPIO_JACKET_DETECT) | ||
| 145 | #define TOSA_IRQ_GPIO_nSD_INT IRQ_GPIO(TOSA_GPIO_nSD_INT) | ||
| 146 | #define TOSA_IRQ_GPIO_nSD_DETECT IRQ_GPIO(TOSA_GPIO_nSD_DETECT) | ||
| 147 | #define TOSA_IRQ_GPIO_BAT1_CRG IRQ_GPIO(TOSA_GPIO_BAT1_CRG) | ||
| 148 | #define TOSA_IRQ_GPIO_CF_CD IRQ_GPIO(TOSA_GPIO_CF_CD) | ||
| 149 | #define TOSA_IRQ_GPIO_BAT0_CRG IRQ_GPIO(TOSA_GPIO_BAT0_CRG) | ||
| 150 | #define TOSA_IRQ_GPIO_TC6393_INT IRQ_GPIO(TOSA_GPIO_TC6393_INT) | ||
| 151 | #define TOSA_IRQ_GPIO_BAT0_LOW IRQ_GPIO(TOSA_GPIO_BAT0_LOW) | ||
| 152 | #define TOSA_IRQ_GPIO_EAR_IN IRQ_GPIO(TOSA_GPIO_EAR_IN) | ||
| 153 | #define TOSA_IRQ_GPIO_CF_IRQ IRQ_GPIO(TOSA_GPIO_CF_IRQ) | ||
| 154 | #define TOSA_IRQ_GPIO_ON_KEY IRQ_GPIO(TOSA_GPIO_ON_KEY) | ||
| 155 | #define TOSA_IRQ_GPIO_VGA_LINE IRQ_GPIO(TOSA_GPIO_VGA_LINE) | ||
| 156 | #define TOSA_IRQ_GPIO_TP_INT IRQ_GPIO(TOSA_GPIO_TP_INT) | ||
| 157 | #define TOSA_IRQ_GPIO_JC_CF_IRQ IRQ_GPIO(TOSA_GPIO_JC_CF_IRQ) | ||
| 158 | #define TOSA_IRQ_GPIO_BAT_LOCKED IRQ_GPIO(TOSA_GPIO_BAT_LOCKED) | ||
| 159 | #define TOSA_IRQ_GPIO_BAT1_LOW IRQ_GPIO(TOSA_GPIO_BAT1_LOW) | ||
| 160 | #define TOSA_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(69+(a)) | ||
| 161 | |||
| 162 | #define TOSA_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(TOSA_GPIO_MAIN_BAT_LOW) | ||
| 163 | |||
| 164 | extern struct platform_device tosascoop_jc_device; | ||
| 165 | extern struct platform_device tosascoop_device; | ||
| 166 | #endif /* _ASM_ARCH_TOSA_H_ */ | ||
diff --git a/include/asm-arm/arch-realview/entry-macro.S b/include/asm-arm/arch-realview/entry-macro.S index 2712ba77bb3a..6288fad0dc41 100644 --- a/include/asm-arm/arch-realview/entry-macro.S +++ b/include/asm-arm/arch-realview/entry-macro.S | |||
| @@ -47,3 +47,28 @@ | |||
| 47 | cmpcs \irqnr, \irqnr | 47 | cmpcs \irqnr, \irqnr |
| 48 | 48 | ||
| 49 | .endm | 49 | .endm |
| 50 | |||
| 51 | /* We assume that irqstat (the raw value of the IRQ acknowledge | ||
| 52 | * register) is preserved from the macro above. | ||
| 53 | * If there is an IPI, we immediately signal end of interrupt on the | ||
| 54 | * controller, since this requires the original irqstat value which | ||
| 55 | * we won't easily be able to recreate later. | ||
| 56 | */ | ||
| 57 | |||
| 58 | .macro test_for_ipi, irqnr, irqstat, base, tmp | ||
| 59 | bic \irqnr, \irqstat, #0x1c00 | ||
| 60 | cmp \irqnr, #16 | ||
| 61 | strcc \irqstat, [\base, #GIC_CPU_EOI] | ||
| 62 | cmpcs \irqnr, \irqnr | ||
| 63 | .endm | ||
| 64 | |||
| 65 | /* As above, this assumes that irqstat and base are preserved.. */ | ||
| 66 | |||
| 67 | .macro test_for_ltirq, irqnr, irqstat, base, tmp | ||
| 68 | bic \irqnr, \irqstat, #0x1c00 | ||
| 69 | mov \tmp, #0 | ||
| 70 | cmp \irqnr, #29 | ||
| 71 | moveq \tmp, #1 | ||
| 72 | streq \irqstat, [\base, #GIC_CPU_EOI] | ||
| 73 | cmp \tmp, #0 | ||
| 74 | .endm | ||
diff --git a/include/asm-arm/arch-realview/irqs.h b/include/asm-arm/arch-realview/irqs.h index ff376494e5b1..c16223c9588d 100644 --- a/include/asm-arm/arch-realview/irqs.h +++ b/include/asm-arm/arch-realview/irqs.h | |||
| @@ -21,6 +21,9 @@ | |||
| 21 | 21 | ||
| 22 | #include <asm/arch/platform.h> | 22 | #include <asm/arch/platform.h> |
| 23 | 23 | ||
| 24 | #define IRQ_LOCALTIMER 29 | ||
| 25 | #define IRQ_LOCALWDOG 30 | ||
| 26 | |||
| 24 | /* | 27 | /* |
| 25 | * IRQ interrupts definitions are the same the INT definitions | 28 | * IRQ interrupts definitions are the same the INT definitions |
| 26 | * held within platform.h | 29 | * held within platform.h |
diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h index 4b6de13a6b9a..18d7c18b738c 100644 --- a/include/asm-arm/arch-realview/platform.h +++ b/include/asm-arm/arch-realview/platform.h | |||
| @@ -203,8 +203,16 @@ | |||
| 203 | /* Reserved 0x1001A000 - 0x1001FFFF */ | 203 | /* Reserved 0x1001A000 - 0x1001FFFF */ |
| 204 | #define REALVIEW_CLCD_BASE 0x10020000 /* CLCD */ | 204 | #define REALVIEW_CLCD_BASE 0x10020000 /* CLCD */ |
| 205 | #define REALVIEW_DMAC_BASE 0x10030000 /* DMA controller */ | 205 | #define REALVIEW_DMAC_BASE 0x10030000 /* DMA controller */ |
| 206 | #ifndef CONFIG_REALVIEW_MPCORE | ||
| 206 | #define REALVIEW_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ | 207 | #define REALVIEW_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ |
| 207 | #define REALVIEW_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ | 208 | #define REALVIEW_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ |
| 209 | #else | ||
| 210 | #define REALVIEW_MPCORE_SCU_BASE 0x10100000 /* SCU registers */ | ||
| 211 | #define REALVIEW_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */ | ||
| 212 | #define REALVIEW_TWD_BASE 0x10100700 | ||
| 213 | #define REALVIEW_TWD_SIZE 0x00000100 | ||
| 214 | #define REALVIEW_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */ | ||
| 215 | #endif | ||
| 208 | #define REALVIEW_SMC_BASE 0x10080000 /* SMC */ | 216 | #define REALVIEW_SMC_BASE 0x10080000 /* SMC */ |
| 209 | /* Reserved 0x10090000 - 0x100EFFFF */ | 217 | /* Reserved 0x10090000 - 0x100EFFFF */ |
| 210 | 218 | ||
| @@ -265,6 +273,7 @@ | |||
| 265 | * Interrupts - bit assignment (primary) | 273 | * Interrupts - bit assignment (primary) |
| 266 | * ------------------------------------------------------------------------ | 274 | * ------------------------------------------------------------------------ |
| 267 | */ | 275 | */ |
| 276 | #ifndef CONFIG_REALVIEW_MPCORE | ||
| 268 | #define INT_WDOGINT 0 /* Watchdog timer */ | 277 | #define INT_WDOGINT 0 /* Watchdog timer */ |
| 269 | #define INT_SOFTINT 1 /* Software interrupt */ | 278 | #define INT_SOFTINT 1 /* Software interrupt */ |
| 270 | #define INT_COMMRx 2 /* Debug Comm Rx interrupt */ | 279 | #define INT_COMMRx 2 /* Debug Comm Rx interrupt */ |
| @@ -297,6 +306,52 @@ | |||
| 297 | #define INT_USB 29 /* USB controller */ | 306 | #define INT_USB 29 /* USB controller */ |
| 298 | #define INT_TSPENINT 30 /* Touchscreen pen */ | 307 | #define INT_TSPENINT 30 /* Touchscreen pen */ |
| 299 | #define INT_TSKPADINT 31 /* Touchscreen keypad */ | 308 | #define INT_TSKPADINT 31 /* Touchscreen keypad */ |
| 309 | #else | ||
| 310 | #define INT_AACI 0 | ||
| 311 | #define INT_TIMERINT0_1 1 | ||
| 312 | #define INT_TIMERINT2_3 2 | ||
| 313 | #define INT_USB 3 | ||
| 314 | #define INT_UARTINT0 4 | ||
| 315 | #define INT_UARTINT1 5 | ||
| 316 | #define INT_RTCINT 6 | ||
| 317 | #define INT_KMI0 7 | ||
| 318 | #define INT_KMI1 8 | ||
| 319 | #define INT_ETH 9 | ||
| 320 | #define INT_EB_IRQ1 10 /* main GIC */ | ||
| 321 | #define INT_EB_IRQ2 11 /* tile GIC */ | ||
| 322 | #define INT_EB_FIQ1 12 /* main GIC */ | ||
| 323 | #define INT_EB_FIQ2 13 /* tile GIC */ | ||
| 324 | #define INT_MMCI0A 14 | ||
| 325 | #define INT_MMCI0B 15 | ||
| 326 | |||
| 327 | #define INT_PMU_CPU0 17 | ||
| 328 | #define INT_PMU_CPU1 18 | ||
| 329 | #define INT_PMU_CPU2 19 | ||
| 330 | #define INT_PMU_CPU3 20 | ||
| 331 | #define INT_PMU_SCU0 21 | ||
| 332 | #define INT_PMU_SCU1 22 | ||
| 333 | #define INT_PMU_SCU2 23 | ||
| 334 | #define INT_PMU_SCU3 24 | ||
| 335 | #define INT_PMU_SCU4 25 | ||
| 336 | #define INT_PMU_SCU5 26 | ||
| 337 | #define INT_PMU_SCU6 27 | ||
| 338 | #define INT_PMU_SCU7 28 | ||
| 339 | |||
| 340 | #define INT_L220_EVENT 29 | ||
| 341 | #define INT_L220_SLAVE 30 | ||
| 342 | #define INT_L220_DECODE 31 | ||
| 343 | |||
| 344 | #define INT_UARTINT2 -1 | ||
| 345 | #define INT_UARTINT3 -1 | ||
| 346 | #define INT_CLCDINT -1 | ||
| 347 | #define INT_DMAINT -1 | ||
| 348 | #define INT_WDOGINT -1 | ||
| 349 | #define INT_GPIOINT0 -1 | ||
| 350 | #define INT_GPIOINT1 -1 | ||
| 351 | #define INT_GPIOINT2 -1 | ||
| 352 | #define INT_SCIINT -1 | ||
| 353 | #define INT_SSPINT -1 | ||
| 354 | #endif | ||
| 300 | 355 | ||
| 301 | /* | 356 | /* |
| 302 | * Interrupt bit positions | 357 | * Interrupt bit positions |
diff --git a/include/asm-arm/arch-realview/smp.h b/include/asm-arm/arch-realview/smp.h new file mode 100644 index 000000000000..fc87783e8e8b --- /dev/null +++ b/include/asm-arm/arch-realview/smp.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #ifndef ASMARM_ARCH_SMP_H | ||
| 2 | #define ASMARM_ARCH_SMP_H | ||
| 3 | |||
| 4 | #include <linux/config.h> | ||
| 5 | |||
| 6 | #include <asm/hardware/gic.h> | ||
| 7 | |||
| 8 | #define hard_smp_processor_id() \ | ||
| 9 | ({ \ | ||
| 10 | unsigned int cpunum; \ | ||
| 11 | __asm__("mrc p15, 0, %0, c0, c0, 5" \ | ||
| 12 | : "=r" (cpunum)); \ | ||
| 13 | cpunum &= 0x0F; \ | ||
| 14 | }) | ||
| 15 | |||
| 16 | /* | ||
| 17 | * We use IRQ1 as the IPI | ||
| 18 | */ | ||
| 19 | static inline void smp_cross_call(cpumask_t callmap) | ||
| 20 | { | ||
| 21 | gic_raise_softirq(callmap, 1); | ||
| 22 | } | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Do nothing on MPcore. | ||
| 26 | */ | ||
| 27 | static inline void smp_cross_call_done(cpumask_t callmap) | ||
| 28 | { | ||
| 29 | } | ||
| 30 | |||
| 31 | #endif | ||
diff --git a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h index d7a4a8354fa9..ddd1578a7ee0 100644 --- a/include/asm-arm/arch-s3c2410/uncompress.h +++ b/include/asm-arm/arch-s3c2410/uncompress.h | |||
| @@ -116,6 +116,8 @@ putstr(const char *ptr) | |||
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | #define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0) | ||
| 120 | |||
| 119 | /* CONFIG_S3C2410_BOOT_WATCHDOG | 121 | /* CONFIG_S3C2410_BOOT_WATCHDOG |
| 120 | * | 122 | * |
| 121 | * Simple boot-time watchdog setup, to reboot the system if there is | 123 | * Simple boot-time watchdog setup, to reboot the system if there is |
| @@ -126,8 +128,6 @@ putstr(const char *ptr) | |||
| 126 | 128 | ||
| 127 | #define WDOG_COUNT (0xff00) | 129 | #define WDOG_COUNT (0xff00) |
| 128 | 130 | ||
| 129 | #define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0) | ||
| 130 | |||
| 131 | static inline void arch_decomp_wdog(void) | 131 | static inline void arch_decomp_wdog(void) |
| 132 | { | 132 | { |
| 133 | __raw_writel(WDOG_COUNT, S3C2410_WTCNT); | 133 | __raw_writel(WDOG_COUNT, S3C2410_WTCNT); |
| @@ -145,6 +145,24 @@ static void arch_decomp_wdog_start(void) | |||
| 145 | #define arch_decomp_wdog() | 145 | #define arch_decomp_wdog() |
| 146 | #endif | 146 | #endif |
| 147 | 147 | ||
| 148 | #ifdef CONFIG_S3C2410_BOOT_ERROR_RESET | ||
| 149 | |||
| 150 | static void arch_decomp_error(const char *x) | ||
| 151 | { | ||
| 152 | putstr("\n\n"); | ||
| 153 | putstr(x); | ||
| 154 | putstr("\n\n -- System resetting\n"); | ||
| 155 | |||
| 156 | __raw_writel(0x4000, S3C2410_WTDAT); | ||
| 157 | __raw_writel(0x4000, S3C2410_WTCNT); | ||
| 158 | __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON); | ||
| 159 | |||
| 160 | while(1); | ||
| 161 | } | ||
| 162 | |||
| 163 | #define arch_error arch_decomp_error | ||
| 164 | #endif | ||
| 165 | |||
| 148 | static void error(char *err); | 166 | static void error(char *err); |
| 149 | 167 | ||
| 150 | static void | 168 | static void |
diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h index 69a28f96bee2..f31ac92b6c7f 100644 --- a/include/asm-arm/assembler.h +++ b/include/asm-arm/assembler.h | |||
| @@ -83,10 +83,13 @@ | |||
| 83 | * Save the current IRQ state and disable IRQs. Note that this macro | 83 | * Save the current IRQ state and disable IRQs. Note that this macro |
| 84 | * assumes FIQs are enabled, and that the processor is in SVC mode. | 84 | * assumes FIQs are enabled, and that the processor is in SVC mode. |
| 85 | */ | 85 | */ |
| 86 | .macro save_and_disable_irqs, oldcpsr, temp | 86 | .macro save_and_disable_irqs, oldcpsr |
| 87 | mrs \oldcpsr, cpsr | 87 | mrs \oldcpsr, cpsr |
| 88 | mov \temp, #PSR_I_BIT | MODE_SVC | 88 | #if __LINUX_ARM_ARCH__ >= 6 |
| 89 | msr cpsr_c, \temp | 89 | cpsid i |
| 90 | #else | ||
| 91 | msr cpsr_c, #PSR_I_BIT | MODE_SVC | ||
| 92 | #endif | ||
| 90 | .endm | 93 | .endm |
| 91 | 94 | ||
| 92 | /* | 95 | /* |
diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h index e5ccb6b8ff83..1cbb173bf5b1 100644 --- a/include/asm-arm/hardirq.h +++ b/include/asm-arm/hardirq.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | typedef struct { | 9 | typedef struct { |
| 10 | unsigned int __softirq_pending; | 10 | unsigned int __softirq_pending; |
| 11 | unsigned int local_timer_irqs; | ||
| 11 | } ____cacheline_aligned irq_cpustat_t; | 12 | } ____cacheline_aligned irq_cpustat_t; |
| 12 | 13 | ||
| 13 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | 14 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ |
diff --git a/include/asm-arm/hardware/arm_scu.h b/include/asm-arm/hardware/arm_scu.h new file mode 100644 index 000000000000..9903f60c84b7 --- /dev/null +++ b/include/asm-arm/hardware/arm_scu.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #ifndef ASMARM_HARDWARE_ARM_SCU_H | ||
| 2 | #define ASMARM_HARDWARE_ARM_SCU_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * SCU registers | ||
| 6 | */ | ||
| 7 | #define SCU_CTRL 0x00 | ||
| 8 | #define SCU_CONFIG 0x04 | ||
| 9 | #define SCU_CPU_STATUS 0x08 | ||
| 10 | #define SCU_INVALIDATE 0x0c | ||
| 11 | #define SCU_FPGA_REVISION 0x10 | ||
| 12 | |||
| 13 | #endif | ||
diff --git a/include/asm-arm/hardware/scoop.h b/include/asm-arm/hardware/scoop.h index a8f1013930e3..d37bf7443264 100644 --- a/include/asm-arm/hardware/scoop.h +++ b/include/asm-arm/hardware/scoop.h | |||
| @@ -52,8 +52,14 @@ struct scoop_pcmcia_dev { | |||
| 52 | unsigned char keep_rd; | 52 | unsigned char keep_rd; |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | extern int scoop_num; | 55 | struct scoop_pcmcia_config { |
| 56 | extern struct scoop_pcmcia_dev *scoop_devs; | 56 | struct scoop_pcmcia_dev *devs; |
| 57 | int num_devs; | ||
| 58 | void (*pcmcia_init)(void); | ||
| 59 | void (*power_ctrl)(struct device *scoop, unsigned short cpr, int nr); | ||
| 60 | }; | ||
| 61 | |||
| 62 | extern struct scoop_pcmcia_config *platform_scoop_config; | ||
| 57 | 63 | ||
| 58 | void reset_scoop(struct device *dev); | 64 | void reset_scoop(struct device *dev); |
| 59 | unsigned short set_scoop_gpio(struct device *dev, unsigned short bit); | 65 | unsigned short set_scoop_gpio(struct device *dev, unsigned short bit); |
diff --git a/include/asm-arm/mach/flash.h b/include/asm-arm/mach/flash.h index cd57436d9874..05b029ef6371 100644 --- a/include/asm-arm/mach/flash.h +++ b/include/asm-arm/mach/flash.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #define ASMARM_MACH_FLASH_H | 11 | #define ASMARM_MACH_FLASH_H |
| 12 | 12 | ||
| 13 | struct mtd_partition; | 13 | struct mtd_partition; |
| 14 | struct mtd_info; | ||
| 14 | 15 | ||
| 15 | /* | 16 | /* |
| 16 | * map_name: the map probe function name | 17 | * map_name: the map probe function name |
| @@ -19,6 +20,7 @@ struct mtd_partition; | |||
| 19 | * init: method called at driver/device initialisation | 20 | * init: method called at driver/device initialisation |
| 20 | * exit: method called at driver/device removal | 21 | * exit: method called at driver/device removal |
| 21 | * set_vpp: method called to enable or disable VPP | 22 | * set_vpp: method called to enable or disable VPP |
| 23 | * mmcontrol: method called to enable or disable Sync. Burst Read in OneNAND | ||
| 22 | * parts: optional array of mtd_partitions for static partitioning | 24 | * parts: optional array of mtd_partitions for static partitioning |
| 23 | * nr_parts: number of mtd_partitions for static partitoning | 25 | * nr_parts: number of mtd_partitions for static partitoning |
| 24 | */ | 26 | */ |
| @@ -29,6 +31,7 @@ struct flash_platform_data { | |||
| 29 | int (*init)(void); | 31 | int (*init)(void); |
| 30 | void (*exit)(void); | 32 | void (*exit)(void); |
| 31 | void (*set_vpp)(int on); | 33 | void (*set_vpp)(int on); |
| 34 | void (*mmcontrol)(struct mtd_info *mtd, int sync_read); | ||
| 32 | struct mtd_partition *parts; | 35 | struct mtd_partition *parts; |
| 33 | unsigned int nr_parts; | 36 | unsigned int nr_parts; |
| 34 | }; | 37 | }; |
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h index 57b8def83d41..3d4b810d8c38 100644 --- a/include/asm-arm/mmu_context.h +++ b/include/asm-arm/mmu_context.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #ifndef __ASM_ARM_MMU_CONTEXT_H | 13 | #ifndef __ASM_ARM_MMU_CONTEXT_H |
| 14 | #define __ASM_ARM_MMU_CONTEXT_H | 14 | #define __ASM_ARM_MMU_CONTEXT_H |
| 15 | 15 | ||
| 16 | #include <asm/cacheflush.h> | ||
| 16 | #include <asm/proc-fns.h> | 17 | #include <asm/proc-fns.h> |
| 17 | 18 | ||
| 18 | #if __LINUX_ARM_ARCH__ >= 6 | 19 | #if __LINUX_ARM_ARCH__ >= 6 |
diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index 551cd3c3093c..5a72e50ca9fc 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h | |||
| @@ -37,6 +37,11 @@ struct seq_file; | |||
| 37 | extern void show_ipi_list(struct seq_file *p); | 37 | extern void show_ipi_list(struct seq_file *p); |
| 38 | 38 | ||
| 39 | /* | 39 | /* |
| 40 | * Called from assembly code, this handles an IPI. | ||
| 41 | */ | ||
| 42 | asmlinkage void do_IPI(struct pt_regs *regs); | ||
| 43 | |||
| 44 | /* | ||
| 40 | * Move global data into per-processor storage. | 45 | * Move global data into per-processor storage. |
| 41 | */ | 46 | */ |
| 42 | extern void smp_store_cpu_info(unsigned int cpuid); | 47 | extern void smp_store_cpu_info(unsigned int cpuid); |
| @@ -47,12 +52,23 @@ extern void smp_store_cpu_info(unsigned int cpuid); | |||
| 47 | extern void smp_cross_call(cpumask_t callmap); | 52 | extern void smp_cross_call(cpumask_t callmap); |
| 48 | 53 | ||
| 49 | /* | 54 | /* |
| 55 | * Broadcast a timer interrupt to the other CPUs. | ||
| 56 | */ | ||
| 57 | extern void smp_send_timer(void); | ||
| 58 | |||
| 59 | /* | ||
| 50 | * Boot a secondary CPU, and assign it the specified idle task. | 60 | * Boot a secondary CPU, and assign it the specified idle task. |
| 51 | * This also gives us the initial stack to use for this CPU. | 61 | * This also gives us the initial stack to use for this CPU. |
| 52 | */ | 62 | */ |
| 53 | extern int boot_secondary(unsigned int cpu, struct task_struct *); | 63 | extern int boot_secondary(unsigned int cpu, struct task_struct *); |
| 54 | 64 | ||
| 55 | /* | 65 | /* |
| 66 | * Called from platform specific assembly code, this is the | ||
| 67 | * secondary CPU entry point. | ||
| 68 | */ | ||
| 69 | asmlinkage void secondary_start_kernel(void); | ||
| 70 | |||
| 71 | /* | ||
| 56 | * Perform platform specific initialisation of the specified CPU. | 72 | * Perform platform specific initialisation of the specified CPU. |
| 57 | */ | 73 | */ |
| 58 | extern void platform_secondary_init(unsigned int cpu); | 74 | extern void platform_secondary_init(unsigned int cpu); |
| @@ -76,4 +92,42 @@ extern void platform_cpu_die(unsigned int cpu); | |||
| 76 | extern int platform_cpu_kill(unsigned int cpu); | 92 | extern int platform_cpu_kill(unsigned int cpu); |
| 77 | extern void platform_cpu_enable(unsigned int cpu); | 93 | extern void platform_cpu_enable(unsigned int cpu); |
| 78 | 94 | ||
| 95 | #ifdef CONFIG_LOCAL_TIMERS | ||
| 96 | /* | ||
| 97 | * Setup a local timer interrupt for a CPU. | ||
| 98 | */ | ||
| 99 | extern void local_timer_setup(unsigned int cpu); | ||
| 100 | |||
| 101 | /* | ||
| 102 | * Stop a local timer interrupt. | ||
| 103 | */ | ||
| 104 | extern void local_timer_stop(unsigned int cpu); | ||
| 105 | |||
| 106 | /* | ||
| 107 | * Platform provides this to acknowledge a local timer IRQ | ||
| 108 | */ | ||
| 109 | extern int local_timer_ack(void); | ||
| 110 | |||
| 111 | #else | ||
| 112 | |||
| 113 | static inline void local_timer_setup(unsigned int cpu) | ||
| 114 | { | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline void local_timer_stop(unsigned int cpu) | ||
| 118 | { | ||
| 119 | } | ||
| 120 | |||
| 121 | #endif | ||
| 122 | |||
| 123 | /* | ||
| 124 | * show local interrupt info | ||
| 125 | */ | ||
| 126 | extern void show_local_irqs(struct seq_file *); | ||
| 127 | |||
| 128 | /* | ||
| 129 | * Called from assembly, this is the local timer IRQ handler | ||
| 130 | */ | ||
| 131 | asmlinkage void do_local_timer(struct pt_regs *); | ||
| 132 | |||
| 79 | #endif /* ifndef __ASM_ARM_SMP_H */ | 133 | #endif /* ifndef __ASM_ARM_SMP_H */ |
diff --git a/include/asm-cris/arch-v10/byteorder.h b/include/asm-cris/arch-v10/byteorder.h index e24465d1f40d..255b646b7fa8 100644 --- a/include/asm-cris/arch-v10/byteorder.h +++ b/include/asm-cris/arch-v10/byteorder.h | |||
| @@ -9,14 +9,14 @@ | |||
| 9 | * them together into ntohl etc. | 9 | * them together into ntohl etc. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | extern __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) | 12 | static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) |
| 13 | { | 13 | { |
| 14 | __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); | 14 | __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); |
| 15 | 15 | ||
| 16 | return(x); | 16 | return(x); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | extern __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) | 19 | static inline __attribute_const__ __u16 ___arch__swab16(__u16 x) |
| 20 | { | 20 | { |
| 21 | __asm__ ("swapb %0" : "=r" (x) : "0" (x)); | 21 | __asm__ ("swapb %0" : "=r" (x) : "0" (x)); |
| 22 | 22 | ||
diff --git a/include/asm-cris/arch-v10/checksum.h b/include/asm-cris/arch-v10/checksum.h index fde1d00aaa90..633f234f336b 100644 --- a/include/asm-cris/arch-v10/checksum.h +++ b/include/asm-cris/arch-v10/checksum.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * to split all of those into 16-bit components, then add. | 8 | * to split all of those into 16-bit components, then add. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | extern inline unsigned int | 11 | static inline unsigned int |
| 12 | csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, | 12 | csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, |
| 13 | unsigned short proto, unsigned int sum) | 13 | unsigned short proto, unsigned int sum) |
| 14 | { | 14 | { |
diff --git a/include/asm-cris/arch-v10/delay.h b/include/asm-cris/arch-v10/delay.h index cfedae0d2f53..39481f6e0c30 100644 --- a/include/asm-cris/arch-v10/delay.h +++ b/include/asm-cris/arch-v10/delay.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _CRIS_ARCH_DELAY_H | 1 | #ifndef _CRIS_ARCH_DELAY_H |
| 2 | #define _CRIS_ARCH_DELAY_H | 2 | #define _CRIS_ARCH_DELAY_H |
| 3 | 3 | ||
| 4 | extern __inline__ void __delay(int loops) | 4 | static inline void __delay(int loops) |
| 5 | { | 5 | { |
| 6 | __asm__ __volatile__ ( | 6 | __asm__ __volatile__ ( |
| 7 | "move.d %0,$r9\n\t" | 7 | "move.d %0,$r9\n\t" |
diff --git a/include/asm-cris/arch-v10/ide.h b/include/asm-cris/arch-v10/ide.h index 8cf2d7cb22ac..78b301ed7b12 100644 --- a/include/asm-cris/arch-v10/ide.h +++ b/include/asm-cris/arch-v10/ide.h | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | #define MAX_HWIFS 4 | 26 | #define MAX_HWIFS 4 |
| 27 | 27 | ||
| 28 | extern __inline__ int ide_default_irq(unsigned long base) | 28 | static inline int ide_default_irq(unsigned long base) |
| 29 | { | 29 | { |
| 30 | /* all IDE busses share the same IRQ, number 4. | 30 | /* all IDE busses share the same IRQ, number 4. |
| 31 | * this has the side-effect that ide-probe.c will cluster our 4 interfaces | 31 | * this has the side-effect that ide-probe.c will cluster our 4 interfaces |
| @@ -35,7 +35,7 @@ extern __inline__ int ide_default_irq(unsigned long base) | |||
| 35 | return 4; | 35 | return 4; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | extern __inline__ unsigned long ide_default_io_base(int index) | 38 | static inline unsigned long ide_default_io_base(int index) |
| 39 | { | 39 | { |
| 40 | /* we have no real I/O base address per interface, since all go through the | 40 | /* we have no real I/O base address per interface, since all go through the |
| 41 | * same register. but in a bitfield in that register, we have the i/f number. | 41 | * same register. but in a bitfield in that register, we have the i/f number. |
| @@ -54,7 +54,7 @@ extern __inline__ unsigned long ide_default_io_base(int index) | |||
| 54 | * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us. | 54 | * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us. |
| 55 | */ | 55 | */ |
| 56 | 56 | ||
| 57 | extern __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) | 57 | static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) |
| 58 | { | 58 | { |
| 59 | int i; | 59 | int i; |
| 60 | 60 | ||
| @@ -77,7 +77,7 @@ extern __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_por | |||
| 77 | hw->io_ports[IDE_IRQ_OFFSET] = 0; | 77 | hw->io_ports[IDE_IRQ_OFFSET] = 0; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | extern __inline__ void ide_init_default_hwifs(void) | 80 | static inline void ide_init_default_hwifs(void) |
| 81 | { | 81 | { |
| 82 | hw_regs_t hw; | 82 | hw_regs_t hw; |
| 83 | int index; | 83 | int index; |
diff --git a/include/asm-cris/arch-v10/system.h b/include/asm-cris/arch-v10/system.h index 6cc35642b8ab..1ac7b639b1b0 100644 --- a/include/asm-cris/arch-v10/system.h +++ b/include/asm-cris/arch-v10/system.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | /* read the CPU version register */ | 6 | /* read the CPU version register */ |
| 7 | 7 | ||
| 8 | extern inline unsigned long rdvr(void) { | 8 | static inline unsigned long rdvr(void) { |
| 9 | unsigned char vr; | 9 | unsigned char vr; |
| 10 | __asm__ volatile ("move $vr,%0" : "=rm" (vr)); | 10 | __asm__ volatile ("move $vr,%0" : "=rm" (vr)); |
| 11 | return vr; | 11 | return vr; |
| @@ -15,7 +15,7 @@ extern inline unsigned long rdvr(void) { | |||
| 15 | 15 | ||
| 16 | /* read/write the user-mode stackpointer */ | 16 | /* read/write the user-mode stackpointer */ |
| 17 | 17 | ||
| 18 | extern inline unsigned long rdusp(void) { | 18 | static inline unsigned long rdusp(void) { |
| 19 | unsigned long usp; | 19 | unsigned long usp; |
| 20 | __asm__ __volatile__("move $usp,%0" : "=rm" (usp)); | 20 | __asm__ __volatile__("move $usp,%0" : "=rm" (usp)); |
| 21 | return usp; | 21 | return usp; |
| @@ -26,13 +26,13 @@ extern inline unsigned long rdusp(void) { | |||
| 26 | 26 | ||
| 27 | /* read the current stackpointer */ | 27 | /* read the current stackpointer */ |
| 28 | 28 | ||
| 29 | extern inline unsigned long rdsp(void) { | 29 | static inline unsigned long rdsp(void) { |
| 30 | unsigned long sp; | 30 | unsigned long sp; |
| 31 | __asm__ __volatile__("move.d $sp,%0" : "=rm" (sp)); | 31 | __asm__ __volatile__("move.d $sp,%0" : "=rm" (sp)); |
| 32 | return sp; | 32 | return sp; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | extern inline unsigned long _get_base(char * addr) | 35 | static inline unsigned long _get_base(char * addr) |
| 36 | { | 36 | { |
| 37 | return 0; | 37 | return 0; |
| 38 | } | 38 | } |
diff --git a/include/asm-cris/arch-v10/thread_info.h b/include/asm-cris/arch-v10/thread_info.h index 357f5df0c907..218f4152d3e5 100644 --- a/include/asm-cris/arch-v10/thread_info.h +++ b/include/asm-cris/arch-v10/thread_info.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define _ASM_ARCH_THREAD_INFO_H | 2 | #define _ASM_ARCH_THREAD_INFO_H |
| 3 | 3 | ||
| 4 | /* how to get the thread information struct from C */ | 4 | /* how to get the thread information struct from C */ |
| 5 | extern inline struct thread_info *current_thread_info(void) | 5 | static inline struct thread_info *current_thread_info(void) |
| 6 | { | 6 | { |
| 7 | struct thread_info *ti; | 7 | struct thread_info *ti; |
| 8 | __asm__("and.d $sp,%0; ":"=r" (ti) : "0" (~8191UL)); | 8 | __asm__("and.d $sp,%0; ":"=r" (ti) : "0" (~8191UL)); |
diff --git a/include/asm-cris/arch-v10/timex.h b/include/asm-cris/arch-v10/timex.h index ecfc553c06a5..e48447d94faf 100644 --- a/include/asm-cris/arch-v10/timex.h +++ b/include/asm-cris/arch-v10/timex.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | unsigned long get_ns_in_jiffie(void); | 23 | unsigned long get_ns_in_jiffie(void); |
| 24 | 24 | ||
| 25 | extern inline unsigned long get_us_in_jiffie_highres(void) | 25 | static inline unsigned long get_us_in_jiffie_highres(void) |
| 26 | { | 26 | { |
| 27 | return get_ns_in_jiffie()/1000; | 27 | return get_ns_in_jiffie()/1000; |
| 28 | } | 28 | } |
diff --git a/include/asm-cris/arch-v10/uaccess.h b/include/asm-cris/arch-v10/uaccess.h index 787d2e60c83c..65b02d9b605a 100644 --- a/include/asm-cris/arch-v10/uaccess.h +++ b/include/asm-cris/arch-v10/uaccess.h | |||
| @@ -87,7 +87,7 @@ | |||
| 87 | * bytes copied if we hit a null byte | 87 | * bytes copied if we hit a null byte |
| 88 | * (without the null byte) | 88 | * (without the null byte) |
| 89 | */ | 89 | */ |
| 90 | extern inline long | 90 | static inline long |
| 91 | __do_strncpy_from_user(char *dst, const char *src, long count) | 91 | __do_strncpy_from_user(char *dst, const char *src, long count) |
| 92 | { | 92 | { |
| 93 | long res; | 93 | long res; |
| @@ -602,7 +602,7 @@ __do_strncpy_from_user(char *dst, const char *src, long count) | |||
| 602 | * or 0 for error. Return a value greater than N if too long. | 602 | * or 0 for error. Return a value greater than N if too long. |
| 603 | */ | 603 | */ |
| 604 | 604 | ||
| 605 | extern inline long | 605 | static inline long |
| 606 | strnlen_user(const char *s, long n) | 606 | strnlen_user(const char *s, long n) |
| 607 | { | 607 | { |
| 608 | long res, tmp1; | 608 | long res, tmp1; |
diff --git a/include/asm-cris/arch-v32/bitops.h b/include/asm-cris/arch-v32/bitops.h index e40a58d3b862..147689d6b624 100644 --- a/include/asm-cris/arch-v32/bitops.h +++ b/include/asm-cris/arch-v32/bitops.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * inverts all bits in the input. | 8 | * inverts all bits in the input. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | extern inline unsigned long | 11 | static inline unsigned long |
| 12 | cris_swapnwbrlz(unsigned long w) | 12 | cris_swapnwbrlz(unsigned long w) |
| 13 | { | 13 | { |
| 14 | unsigned long res; | 14 | unsigned long res; |
| @@ -20,7 +20,7 @@ cris_swapnwbrlz(unsigned long w) | |||
| 20 | return res; | 20 | return res; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | extern inline unsigned long | 23 | static inline unsigned long |
| 24 | cris_swapwbrlz(unsigned long w) | 24 | cris_swapwbrlz(unsigned long w) |
| 25 | { | 25 | { |
| 26 | unsigned long res; | 26 | unsigned long res; |
| @@ -36,7 +36,7 @@ cris_swapwbrlz(unsigned long w) | |||
| 36 | * Find First Zero in word. Undefined if no zero exist, so the caller should | 36 | * Find First Zero in word. Undefined if no zero exist, so the caller should |
| 37 | * check against ~0 first. | 37 | * check against ~0 first. |
| 38 | */ | 38 | */ |
| 39 | extern inline unsigned long | 39 | static inline unsigned long |
| 40 | ffz(unsigned long w) | 40 | ffz(unsigned long w) |
| 41 | { | 41 | { |
| 42 | return cris_swapnwbrlz(w); | 42 | return cris_swapnwbrlz(w); |
| @@ -46,7 +46,7 @@ ffz(unsigned long w) | |||
| 46 | * Find First Set bit in word. Undefined if no 1 exist, so the caller | 46 | * Find First Set bit in word. Undefined if no 1 exist, so the caller |
| 47 | * should check against 0 first. | 47 | * should check against 0 first. |
| 48 | */ | 48 | */ |
| 49 | extern inline unsigned long | 49 | static inline unsigned long |
| 50 | __ffs(unsigned long w) | 50 | __ffs(unsigned long w) |
| 51 | { | 51 | { |
| 52 | return cris_swapnwbrlz(~w); | 52 | return cris_swapnwbrlz(~w); |
| @@ -55,7 +55,7 @@ __ffs(unsigned long w) | |||
| 55 | /* | 55 | /* |
| 56 | * Find First Bit that is set. | 56 | * Find First Bit that is set. |
| 57 | */ | 57 | */ |
| 58 | extern inline unsigned long | 58 | static inline unsigned long |
| 59 | kernel_ffs(unsigned long w) | 59 | kernel_ffs(unsigned long w) |
| 60 | { | 60 | { |
| 61 | return w ? cris_swapwbrlz (w) + 1 : 0; | 61 | return w ? cris_swapwbrlz (w) + 1 : 0; |
diff --git a/include/asm-cris/arch-v32/byteorder.h b/include/asm-cris/arch-v32/byteorder.h index 74846ee6cf99..6ef8fb4a35f2 100644 --- a/include/asm-cris/arch-v32/byteorder.h +++ b/include/asm-cris/arch-v32/byteorder.h | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
| 5 | 5 | ||
| 6 | extern __inline__ __const__ __u32 | 6 | static inline __const__ __u32 |
| 7 | ___arch__swab32(__u32 x) | 7 | ___arch__swab32(__u32 x) |
| 8 | { | 8 | { |
| 9 | __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x)); | 9 | __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x)); |
| 10 | return (x); | 10 | return (x); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | extern __inline__ __const__ __u16 | 13 | static inline __const__ __u16 |
| 14 | ___arch__swab16(__u16 x) | 14 | ___arch__swab16(__u16 x) |
| 15 | { | 15 | { |
| 16 | __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x)); | 16 | __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x)); |
diff --git a/include/asm-cris/arch-v32/checksum.h b/include/asm-cris/arch-v32/checksum.h index a1d6b2a6cc44..97ef89efea62 100644 --- a/include/asm-cris/arch-v32/checksum.h +++ b/include/asm-cris/arch-v32/checksum.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | * checksum. Which means it would be necessary to split all those into | 9 | * checksum. Which means it would be necessary to split all those into |
| 10 | * 16-bit components and then add. | 10 | * 16-bit components and then add. |
| 11 | */ | 11 | */ |
| 12 | extern inline unsigned int | 12 | static inline unsigned int |
| 13 | csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, | 13 | csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, |
| 14 | unsigned short len, unsigned short proto, unsigned int sum) | 14 | unsigned short len, unsigned short proto, unsigned int sum) |
| 15 | { | 15 | { |
diff --git a/include/asm-cris/arch-v32/delay.h b/include/asm-cris/arch-v32/delay.h index f36f7f760e89..b6e941e637de 100644 --- a/include/asm-cris/arch-v32/delay.h +++ b/include/asm-cris/arch-v32/delay.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _ASM_CRIS_ARCH_DELAY_H | 1 | #ifndef _ASM_CRIS_ARCH_DELAY_H |
| 2 | #define _ASM_CRIS_ARCH_DELAY_H | 2 | #define _ASM_CRIS_ARCH_DELAY_H |
| 3 | 3 | ||
| 4 | extern __inline__ void | 4 | static inline void |
| 5 | __delay(int loops) | 5 | __delay(int loops) |
| 6 | { | 6 | { |
| 7 | __asm__ __volatile__ ( | 7 | __asm__ __volatile__ ( |
diff --git a/include/asm-cris/arch-v32/ide.h b/include/asm-cris/arch-v32/ide.h index 24f5604f566a..6590f657500d 100644 --- a/include/asm-cris/arch-v32/ide.h +++ b/include/asm-cris/arch-v32/ide.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #define MAX_HWIFS 4 | 27 | #define MAX_HWIFS 4 |
| 28 | 28 | ||
| 29 | extern __inline__ int ide_default_irq(unsigned long base) | 29 | static inline int ide_default_irq(unsigned long base) |
| 30 | { | 30 | { |
| 31 | /* all IDE busses share the same IRQ, | 31 | /* all IDE busses share the same IRQ, |
| 32 | * this has the side-effect that ide-probe.c will cluster our 4 interfaces | 32 | * this has the side-effect that ide-probe.c will cluster our 4 interfaces |
| @@ -36,7 +36,7 @@ extern __inline__ int ide_default_irq(unsigned long base) | |||
| 36 | return ATA_INTR_VECT; | 36 | return ATA_INTR_VECT; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | extern __inline__ unsigned long ide_default_io_base(int index) | 39 | static inline unsigned long ide_default_io_base(int index) |
| 40 | { | 40 | { |
| 41 | reg_ata_rw_ctrl2 ctrl2 = {.sel = index}; | 41 | reg_ata_rw_ctrl2 ctrl2 = {.sel = index}; |
| 42 | /* we have no real I/O base address per interface, since all go through the | 42 | /* we have no real I/O base address per interface, since all go through the |
diff --git a/include/asm-cris/arch-v32/io.h b/include/asm-cris/arch-v32/io.h index 4c80263ec634..043c9ce5294e 100644 --- a/include/asm-cris/arch-v32/io.h +++ b/include/asm-cris/arch-v32/io.h | |||
| @@ -35,7 +35,7 @@ extern struct crisv32_iopin crisv32_led2_red; | |||
| 35 | extern struct crisv32_iopin crisv32_led3_green; | 35 | extern struct crisv32_iopin crisv32_led3_green; |
| 36 | extern struct crisv32_iopin crisv32_led3_red; | 36 | extern struct crisv32_iopin crisv32_led3_red; |
| 37 | 37 | ||
| 38 | extern inline void crisv32_io_set(struct crisv32_iopin* iopin, | 38 | static inline void crisv32_io_set(struct crisv32_iopin* iopin, |
| 39 | int val) | 39 | int val) |
| 40 | { | 40 | { |
| 41 | if (val) | 41 | if (val) |
| @@ -44,7 +44,7 @@ extern inline void crisv32_io_set(struct crisv32_iopin* iopin, | |||
| 44 | *iopin->port->data &= ~iopin->bit; | 44 | *iopin->port->data &= ~iopin->bit; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | extern inline void crisv32_io_set_dir(struct crisv32_iopin* iopin, | 47 | static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin, |
| 48 | enum crisv32_io_dir dir) | 48 | enum crisv32_io_dir dir) |
| 49 | { | 49 | { |
| 50 | if (dir == crisv32_io_dir_in) | 50 | if (dir == crisv32_io_dir_in) |
| @@ -53,7 +53,7 @@ extern inline void crisv32_io_set_dir(struct crisv32_iopin* iopin, | |||
| 53 | *iopin->port->oe |= iopin->bit; | 53 | *iopin->port->oe |= iopin->bit; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | extern inline int crisv32_io_rd(struct crisv32_iopin* iopin) | 56 | static inline int crisv32_io_rd(struct crisv32_iopin* iopin) |
| 57 | { | 57 | { |
| 58 | return ((*iopin->port->data_in & iopin->bit) ? 1 : 0); | 58 | return ((*iopin->port->data_in & iopin->bit) ? 1 : 0); |
| 59 | } | 59 | } |
diff --git a/include/asm-cris/arch-v32/system.h b/include/asm-cris/arch-v32/system.h index b9afbb95e0bb..a3d75d581e2f 100644 --- a/include/asm-cris/arch-v32/system.h +++ b/include/asm-cris/arch-v32/system.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
| 5 | 5 | ||
| 6 | /* Read the CPU version register. */ | 6 | /* Read the CPU version register. */ |
| 7 | extern inline unsigned long rdvr(void) | 7 | static inline unsigned long rdvr(void) |
| 8 | { | 8 | { |
| 9 | unsigned char vr; | 9 | unsigned char vr; |
| 10 | 10 | ||
| @@ -15,7 +15,7 @@ extern inline unsigned long rdvr(void) | |||
| 15 | #define cris_machine_name "crisv32" | 15 | #define cris_machine_name "crisv32" |
| 16 | 16 | ||
| 17 | /* Read the user-mode stack pointer. */ | 17 | /* Read the user-mode stack pointer. */ |
| 18 | extern inline unsigned long rdusp(void) | 18 | static inline unsigned long rdusp(void) |
| 19 | { | 19 | { |
| 20 | unsigned long usp; | 20 | unsigned long usp; |
| 21 | 21 | ||
| @@ -24,7 +24,7 @@ extern inline unsigned long rdusp(void) | |||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | /* Read the current stack pointer. */ | 26 | /* Read the current stack pointer. */ |
| 27 | extern inline unsigned long rdsp(void) | 27 | static inline unsigned long rdsp(void) |
| 28 | { | 28 | { |
| 29 | unsigned long sp; | 29 | unsigned long sp; |
| 30 | 30 | ||
diff --git a/include/asm-cris/arch-v32/thread_info.h b/include/asm-cris/arch-v32/thread_info.h index a7a182307da0..d6936956a3c6 100644 --- a/include/asm-cris/arch-v32/thread_info.h +++ b/include/asm-cris/arch-v32/thread_info.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define _ASM_CRIS_ARCH_THREAD_INFO_H | 2 | #define _ASM_CRIS_ARCH_THREAD_INFO_H |
| 3 | 3 | ||
| 4 | /* Return a thread_info struct. */ | 4 | /* Return a thread_info struct. */ |
| 5 | extern inline struct thread_info *current_thread_info(void) | 5 | static inline struct thread_info *current_thread_info(void) |
| 6 | { | 6 | { |
| 7 | struct thread_info *ti; | 7 | struct thread_info *ti; |
| 8 | 8 | ||
diff --git a/include/asm-cris/arch-v32/timex.h b/include/asm-cris/arch-v32/timex.h index 4d0fd23b21e9..5a4aa285d5fd 100644 --- a/include/asm-cris/arch-v32/timex.h +++ b/include/asm-cris/arch-v32/timex.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | extern unsigned long get_ns_in_jiffie(void); | 23 | extern unsigned long get_ns_in_jiffie(void); |
| 24 | 24 | ||
| 25 | extern inline unsigned long get_us_in_jiffie_highres(void) | 25 | static inline unsigned long get_us_in_jiffie_highres(void) |
| 26 | { | 26 | { |
| 27 | return get_ns_in_jiffie() / 1000; | 27 | return get_ns_in_jiffie() / 1000; |
| 28 | } | 28 | } |
diff --git a/include/asm-cris/arch-v32/uaccess.h b/include/asm-cris/arch-v32/uaccess.h index 055a0bdbe835..6b207f1b6622 100644 --- a/include/asm-cris/arch-v32/uaccess.h +++ b/include/asm-cris/arch-v32/uaccess.h | |||
| @@ -93,7 +93,7 @@ | |||
| 93 | * bytes copied if we hit a null byte | 93 | * bytes copied if we hit a null byte |
| 94 | * (without the null byte) | 94 | * (without the null byte) |
| 95 | */ | 95 | */ |
| 96 | extern inline long | 96 | static inline long |
| 97 | __do_strncpy_from_user(char *dst, const char *src, long count) | 97 | __do_strncpy_from_user(char *dst, const char *src, long count) |
| 98 | { | 98 | { |
| 99 | long res; | 99 | long res; |
| @@ -695,7 +695,7 @@ __do_strncpy_from_user(char *dst, const char *src, long count) | |||
| 695 | * or 0 for error. Return a value greater than N if too long. | 695 | * or 0 for error. Return a value greater than N if too long. |
| 696 | */ | 696 | */ |
| 697 | 697 | ||
| 698 | extern inline long | 698 | static inline long |
| 699 | strnlen_user(const char *s, long n) | 699 | strnlen_user(const char *s, long n) |
| 700 | { | 700 | { |
| 701 | long res, tmp1; | 701 | long res, tmp1; |
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h index 70605b09e8b7..8c2e78304523 100644 --- a/include/asm-cris/atomic.h +++ b/include/asm-cris/atomic.h | |||
| @@ -20,7 +20,7 @@ typedef struct { volatile int counter; } atomic_t; | |||
| 20 | 20 | ||
| 21 | /* These should be written in asm but we do it in C for now. */ | 21 | /* These should be written in asm but we do it in C for now. */ |
| 22 | 22 | ||
| 23 | extern __inline__ void atomic_add(int i, volatile atomic_t *v) | 23 | static inline void atomic_add(int i, volatile atomic_t *v) |
| 24 | { | 24 | { |
| 25 | unsigned long flags; | 25 | unsigned long flags; |
| 26 | cris_atomic_save(v, flags); | 26 | cris_atomic_save(v, flags); |
| @@ -28,7 +28,7 @@ extern __inline__ void atomic_add(int i, volatile atomic_t *v) | |||
| 28 | cris_atomic_restore(v, flags); | 28 | cris_atomic_restore(v, flags); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | extern __inline__ void atomic_sub(int i, volatile atomic_t *v) | 31 | static inline void atomic_sub(int i, volatile atomic_t *v) |
| 32 | { | 32 | { |
| 33 | unsigned long flags; | 33 | unsigned long flags; |
| 34 | cris_atomic_save(v, flags); | 34 | cris_atomic_save(v, flags); |
| @@ -36,7 +36,7 @@ extern __inline__ void atomic_sub(int i, volatile atomic_t *v) | |||
| 36 | cris_atomic_restore(v, flags); | 36 | cris_atomic_restore(v, flags); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | extern __inline__ int atomic_add_return(int i, volatile atomic_t *v) | 39 | static inline int atomic_add_return(int i, volatile atomic_t *v) |
| 40 | { | 40 | { |
| 41 | unsigned long flags; | 41 | unsigned long flags; |
| 42 | int retval; | 42 | int retval; |
| @@ -48,7 +48,7 @@ extern __inline__ int atomic_add_return(int i, volatile atomic_t *v) | |||
| 48 | 48 | ||
| 49 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | 49 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) |
| 50 | 50 | ||
| 51 | extern __inline__ int atomic_sub_return(int i, volatile atomic_t *v) | 51 | static inline int atomic_sub_return(int i, volatile atomic_t *v) |
| 52 | { | 52 | { |
| 53 | unsigned long flags; | 53 | unsigned long flags; |
| 54 | int retval; | 54 | int retval; |
| @@ -58,7 +58,7 @@ extern __inline__ int atomic_sub_return(int i, volatile atomic_t *v) | |||
| 58 | return retval; | 58 | return retval; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | extern __inline__ int atomic_sub_and_test(int i, volatile atomic_t *v) | 61 | static inline int atomic_sub_and_test(int i, volatile atomic_t *v) |
| 62 | { | 62 | { |
| 63 | int retval; | 63 | int retval; |
| 64 | unsigned long flags; | 64 | unsigned long flags; |
| @@ -68,7 +68,7 @@ extern __inline__ int atomic_sub_and_test(int i, volatile atomic_t *v) | |||
| 68 | return retval; | 68 | return retval; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | extern __inline__ void atomic_inc(volatile atomic_t *v) | 71 | static inline void atomic_inc(volatile atomic_t *v) |
| 72 | { | 72 | { |
| 73 | unsigned long flags; | 73 | unsigned long flags; |
| 74 | cris_atomic_save(v, flags); | 74 | cris_atomic_save(v, flags); |
| @@ -76,7 +76,7 @@ extern __inline__ void atomic_inc(volatile atomic_t *v) | |||
| 76 | cris_atomic_restore(v, flags); | 76 | cris_atomic_restore(v, flags); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | extern __inline__ void atomic_dec(volatile atomic_t *v) | 79 | static inline void atomic_dec(volatile atomic_t *v) |
| 80 | { | 80 | { |
| 81 | unsigned long flags; | 81 | unsigned long flags; |
| 82 | cris_atomic_save(v, flags); | 82 | cris_atomic_save(v, flags); |
| @@ -84,7 +84,7 @@ extern __inline__ void atomic_dec(volatile atomic_t *v) | |||
| 84 | cris_atomic_restore(v, flags); | 84 | cris_atomic_restore(v, flags); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | extern __inline__ int atomic_inc_return(volatile atomic_t *v) | 87 | static inline int atomic_inc_return(volatile atomic_t *v) |
| 88 | { | 88 | { |
| 89 | unsigned long flags; | 89 | unsigned long flags; |
| 90 | int retval; | 90 | int retval; |
| @@ -94,7 +94,7 @@ extern __inline__ int atomic_inc_return(volatile atomic_t *v) | |||
| 94 | return retval; | 94 | return retval; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | extern __inline__ int atomic_dec_return(volatile atomic_t *v) | 97 | static inline int atomic_dec_return(volatile atomic_t *v) |
| 98 | { | 98 | { |
| 99 | unsigned long flags; | 99 | unsigned long flags; |
| 100 | int retval; | 100 | int retval; |
| @@ -103,7 +103,7 @@ extern __inline__ int atomic_dec_return(volatile atomic_t *v) | |||
| 103 | cris_atomic_restore(v, flags); | 103 | cris_atomic_restore(v, flags); |
| 104 | return retval; | 104 | return retval; |
| 105 | } | 105 | } |
| 106 | extern __inline__ int atomic_dec_and_test(volatile atomic_t *v) | 106 | static inline int atomic_dec_and_test(volatile atomic_t *v) |
| 107 | { | 107 | { |
| 108 | int retval; | 108 | int retval; |
| 109 | unsigned long flags; | 109 | unsigned long flags; |
| @@ -113,7 +113,7 @@ extern __inline__ int atomic_dec_and_test(volatile atomic_t *v) | |||
| 113 | return retval; | 113 | return retval; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | extern __inline__ int atomic_inc_and_test(volatile atomic_t *v) | 116 | static inline int atomic_inc_and_test(volatile atomic_t *v) |
| 117 | { | 117 | { |
| 118 | int retval; | 118 | int retval; |
| 119 | unsigned long flags; | 119 | unsigned long flags; |
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h index e3da57f97964..1bddb3f3a289 100644 --- a/include/asm-cris/bitops.h +++ b/include/asm-cris/bitops.h | |||
| @@ -89,7 +89,7 @@ struct __dummy { unsigned long a[100]; }; | |||
| 89 | * It also implies a memory barrier. | 89 | * It also implies a memory barrier. |
| 90 | */ | 90 | */ |
| 91 | 91 | ||
| 92 | extern inline int test_and_set_bit(int nr, volatile unsigned long *addr) | 92 | static inline int test_and_set_bit(int nr, volatile unsigned long *addr) |
| 93 | { | 93 | { |
| 94 | unsigned int mask, retval; | 94 | unsigned int mask, retval; |
| 95 | unsigned long flags; | 95 | unsigned long flags; |
| @@ -105,7 +105,7 @@ extern inline int test_and_set_bit(int nr, volatile unsigned long *addr) | |||
| 105 | return retval; | 105 | return retval; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr) | 108 | static inline int __test_and_set_bit(int nr, volatile unsigned long *addr) |
| 109 | { | 109 | { |
| 110 | unsigned int mask, retval; | 110 | unsigned int mask, retval; |
| 111 | unsigned int *adr = (unsigned int *)addr; | 111 | unsigned int *adr = (unsigned int *)addr; |
| @@ -132,7 +132,7 @@ extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr) | |||
| 132 | * It also implies a memory barrier. | 132 | * It also implies a memory barrier. |
| 133 | */ | 133 | */ |
| 134 | 134 | ||
| 135 | extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr) | 135 | static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) |
| 136 | { | 136 | { |
| 137 | unsigned int mask, retval; | 137 | unsigned int mask, retval; |
| 138 | unsigned long flags; | 138 | unsigned long flags; |
| @@ -157,7 +157,7 @@ extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr) | |||
| 157 | * but actually fail. You must protect multiple accesses with a lock. | 157 | * but actually fail. You must protect multiple accesses with a lock. |
| 158 | */ | 158 | */ |
| 159 | 159 | ||
| 160 | extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) | 160 | static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) |
| 161 | { | 161 | { |
| 162 | unsigned int mask, retval; | 162 | unsigned int mask, retval; |
| 163 | unsigned int *adr = (unsigned int *)addr; | 163 | unsigned int *adr = (unsigned int *)addr; |
| @@ -177,7 +177,7 @@ extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) | |||
| 177 | * It also implies a memory barrier. | 177 | * It also implies a memory barrier. |
| 178 | */ | 178 | */ |
| 179 | 179 | ||
| 180 | extern inline int test_and_change_bit(int nr, volatile unsigned long *addr) | 180 | static inline int test_and_change_bit(int nr, volatile unsigned long *addr) |
| 181 | { | 181 | { |
| 182 | unsigned int mask, retval; | 182 | unsigned int mask, retval; |
| 183 | unsigned long flags; | 183 | unsigned long flags; |
| @@ -193,7 +193,7 @@ extern inline int test_and_change_bit(int nr, volatile unsigned long *addr) | |||
| 193 | 193 | ||
| 194 | /* WARNING: non atomic and it can be reordered! */ | 194 | /* WARNING: non atomic and it can be reordered! */ |
| 195 | 195 | ||
| 196 | extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr) | 196 | static inline int __test_and_change_bit(int nr, volatile unsigned long *addr) |
| 197 | { | 197 | { |
| 198 | unsigned int mask, retval; | 198 | unsigned int mask, retval; |
| 199 | unsigned int *adr = (unsigned int *)addr; | 199 | unsigned int *adr = (unsigned int *)addr; |
| @@ -214,7 +214,7 @@ extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr) | |||
| 214 | * This routine doesn't need to be atomic. | 214 | * This routine doesn't need to be atomic. |
| 215 | */ | 215 | */ |
| 216 | 216 | ||
| 217 | extern inline int test_bit(int nr, const volatile unsigned long *addr) | 217 | static inline int test_bit(int nr, const volatile unsigned long *addr) |
| 218 | { | 218 | { |
| 219 | unsigned int mask; | 219 | unsigned int mask; |
| 220 | unsigned int *adr = (unsigned int *)addr; | 220 | unsigned int *adr = (unsigned int *)addr; |
| @@ -258,7 +258,7 @@ extern inline int test_bit(int nr, const volatile unsigned long *addr) | |||
| 258 | * @offset: The bitnumber to start searching at | 258 | * @offset: The bitnumber to start searching at |
| 259 | * @size: The maximum size to search | 259 | * @size: The maximum size to search |
| 260 | */ | 260 | */ |
| 261 | extern inline int find_next_zero_bit (const unsigned long * addr, int size, int offset) | 261 | static inline int find_next_zero_bit (const unsigned long * addr, int size, int offset) |
| 262 | { | 262 | { |
| 263 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); | 263 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); |
| 264 | unsigned long result = offset & ~31UL; | 264 | unsigned long result = offset & ~31UL; |
| @@ -366,7 +366,7 @@ found_middle: | |||
| 366 | #define minix_test_bit(nr,addr) test_bit(nr,addr) | 366 | #define minix_test_bit(nr,addr) test_bit(nr,addr) |
| 367 | #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) | 367 | #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) |
| 368 | 368 | ||
| 369 | extern inline int sched_find_first_bit(const unsigned long *b) | 369 | static inline int sched_find_first_bit(const unsigned long *b) |
| 370 | { | 370 | { |
| 371 | if (unlikely(b[0])) | 371 | if (unlikely(b[0])) |
| 372 | return __ffs(b[0]); | 372 | return __ffs(b[0]); |
diff --git a/include/asm-cris/checksum.h b/include/asm-cris/checksum.h index 15ca8aec5c63..26a7719bbb84 100644 --- a/include/asm-cris/checksum.h +++ b/include/asm-cris/checksum.h | |||
| @@ -34,7 +34,7 @@ unsigned int csum_partial_copy_nocheck(const char *src, char *dst, | |||
| 34 | * Fold a partial checksum into a word | 34 | * Fold a partial checksum into a word |
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | extern inline unsigned int csum_fold(unsigned int sum) | 37 | static inline unsigned int csum_fold(unsigned int sum) |
| 38 | { | 38 | { |
| 39 | /* the while loop is unnecessary really, it's always enough with two | 39 | /* the while loop is unnecessary really, it's always enough with two |
| 40 | iterations */ | 40 | iterations */ |
| @@ -55,7 +55,7 @@ extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, | |||
| 55 | * | 55 | * |
| 56 | */ | 56 | */ |
| 57 | 57 | ||
| 58 | extern inline unsigned short ip_fast_csum(unsigned char * iph, | 58 | static inline unsigned short ip_fast_csum(unsigned char * iph, |
| 59 | unsigned int ihl) | 59 | unsigned int ihl) |
| 60 | { | 60 | { |
| 61 | return csum_fold(csum_partial(iph, ihl * 4, 0)); | 61 | return csum_fold(csum_partial(iph, ihl * 4, 0)); |
| @@ -66,7 +66,7 @@ extern inline unsigned short ip_fast_csum(unsigned char * iph, | |||
| 66 | * returns a 16-bit checksum, already complemented | 66 | * returns a 16-bit checksum, already complemented |
| 67 | */ | 67 | */ |
| 68 | 68 | ||
| 69 | extern inline unsigned short int csum_tcpudp_magic(unsigned long saddr, | 69 | static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, |
| 70 | unsigned long daddr, | 70 | unsigned long daddr, |
| 71 | unsigned short len, | 71 | unsigned short len, |
| 72 | unsigned short proto, | 72 | unsigned short proto, |
| @@ -80,7 +80,7 @@ extern inline unsigned short int csum_tcpudp_magic(unsigned long saddr, | |||
| 80 | * in icmp.c | 80 | * in icmp.c |
| 81 | */ | 81 | */ |
| 82 | 82 | ||
| 83 | extern inline unsigned short ip_compute_csum(unsigned char * buff, int len) { | 83 | static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { |
| 84 | return csum_fold (csum_partial(buff, len, 0)); | 84 | return csum_fold (csum_partial(buff, len, 0)); |
| 85 | } | 85 | } |
| 86 | 86 | ||
diff --git a/include/asm-cris/current.h b/include/asm-cris/current.h index dce69c99da39..5f5c0efd00be 100644 --- a/include/asm-cris/current.h +++ b/include/asm-cris/current.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | struct task_struct; | 6 | struct task_struct; |
| 7 | 7 | ||
| 8 | extern inline struct task_struct * get_current(void) | 8 | static inline struct task_struct * get_current(void) |
| 9 | { | 9 | { |
| 10 | return current_thread_info()->task; | 10 | return current_thread_info()->task; |
| 11 | } | 11 | } |
diff --git a/include/asm-cris/delay.h b/include/asm-cris/delay.h index efc41aad4845..d3a397803719 100644 --- a/include/asm-cris/delay.h +++ b/include/asm-cris/delay.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */ | 14 | extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */ |
| 15 | 15 | ||
| 16 | extern __inline__ void udelay(unsigned long usecs) | 16 | static inline void udelay(unsigned long usecs) |
| 17 | { | 17 | { |
| 18 | __delay(usecs * loops_per_usec); | 18 | __delay(usecs * loops_per_usec); |
| 19 | } | 19 | } |
diff --git a/include/asm-cris/io.h b/include/asm-cris/io.h index 16e791b3c721..716c69bc58f8 100644 --- a/include/asm-cris/io.h +++ b/include/asm-cris/io.h | |||
| @@ -23,12 +23,12 @@ extern struct cris_io_operations *cris_iops; | |||
| 23 | * Change virtual addresses to physical addresses and vv. | 23 | * Change virtual addresses to physical addresses and vv. |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | extern inline unsigned long virt_to_phys(volatile void * address) | 26 | static inline unsigned long virt_to_phys(volatile void * address) |
| 27 | { | 27 | { |
| 28 | return __pa(address); | 28 | return __pa(address); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | extern inline void * phys_to_virt(unsigned long address) | 31 | static inline void * phys_to_virt(unsigned long address) |
| 32 | { | 32 | { |
| 33 | return __va(address); | 33 | return __va(address); |
| 34 | } | 34 | } |
| @@ -36,7 +36,7 @@ extern inline void * phys_to_virt(unsigned long address) | |||
| 36 | extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); | 36 | extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); |
| 37 | extern void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot); | 37 | extern void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot); |
| 38 | 38 | ||
| 39 | extern inline void __iomem * ioremap (unsigned long offset, unsigned long size) | 39 | static inline void __iomem * ioremap (unsigned long offset, unsigned long size) |
| 40 | { | 40 | { |
| 41 | return __ioremap(offset, size, 0); | 41 | return __ioremap(offset, size, 0); |
| 42 | } | 42 | } |
diff --git a/include/asm-cris/irq.h b/include/asm-cris/irq.h index 4fab5c3b2e15..4b338792218b 100644 --- a/include/asm-cris/irq.h +++ b/include/asm-cris/irq.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #include <asm/arch/irq.h> | 9 | #include <asm/arch/irq.h> |
| 10 | 10 | ||
| 11 | extern __inline__ int irq_canonicalize(int irq) | 11 | static inline int irq_canonicalize(int irq) |
| 12 | { | 12 | { |
| 13 | return irq; | 13 | return irq; |
| 14 | } | 14 | } |
diff --git a/include/asm-cris/pgalloc.h b/include/asm-cris/pgalloc.h index a131776edf41..deaddfe79bbc 100644 --- a/include/asm-cris/pgalloc.h +++ b/include/asm-cris/pgalloc.h | |||
| @@ -11,35 +11,35 @@ | |||
| 11 | * Allocate and free page tables. | 11 | * Allocate and free page tables. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | extern inline pgd_t *pgd_alloc (struct mm_struct *mm) | 14 | static inline pgd_t *pgd_alloc (struct mm_struct *mm) |
| 15 | { | 15 | { |
| 16 | return (pgd_t *)get_zeroed_page(GFP_KERNEL); | 16 | return (pgd_t *)get_zeroed_page(GFP_KERNEL); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | extern inline void pgd_free (pgd_t *pgd) | 19 | static inline void pgd_free (pgd_t *pgd) |
| 20 | { | 20 | { |
| 21 | free_page((unsigned long)pgd); | 21 | free_page((unsigned long)pgd); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | 24 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) |
| 25 | { | 25 | { |
| 26 | pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); | 26 | pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); |
| 27 | return pte; | 27 | return pte; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | extern inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 30 | static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) |
| 31 | { | 31 | { |
| 32 | struct page *pte; | 32 | struct page *pte; |
| 33 | pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); | 33 | pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); |
| 34 | return pte; | 34 | return pte; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | extern inline void pte_free_kernel(pte_t *pte) | 37 | static inline void pte_free_kernel(pte_t *pte) |
| 38 | { | 38 | { |
| 39 | free_page((unsigned long)pte); | 39 | free_page((unsigned long)pte); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | extern inline void pte_free(struct page *pte) | 42 | static inline void pte_free(struct page *pte) |
| 43 | { | 43 | { |
| 44 | __free_page(pte); | 44 | __free_page(pte); |
| 45 | } | 45 | } |
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h index a9143bed99db..70a832514f62 100644 --- a/include/asm-cris/pgtable.h +++ b/include/asm-cris/pgtable.h | |||
| @@ -112,44 +112,44 @@ extern unsigned long empty_zero_page; | |||
| 112 | * Undefined behaviour if not.. | 112 | * Undefined behaviour if not.. |
| 113 | */ | 113 | */ |
| 114 | 114 | ||
| 115 | extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } | 115 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } |
| 116 | extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } | 116 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } |
| 117 | extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; } | 117 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; } |
| 118 | extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } | 118 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } |
| 119 | extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 119 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
| 120 | extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 120 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
| 121 | 121 | ||
| 122 | extern inline pte_t pte_wrprotect(pte_t pte) | 122 | static inline pte_t pte_wrprotect(pte_t pte) |
| 123 | { | 123 | { |
| 124 | pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); | 124 | pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); |
| 125 | return pte; | 125 | return pte; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | extern inline pte_t pte_rdprotect(pte_t pte) | 128 | static inline pte_t pte_rdprotect(pte_t pte) |
| 129 | { | 129 | { |
| 130 | pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); | 130 | pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); |
| 131 | return pte; | 131 | return pte; |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | extern inline pte_t pte_exprotect(pte_t pte) | 134 | static inline pte_t pte_exprotect(pte_t pte) |
| 135 | { | 135 | { |
| 136 | pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); | 136 | pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); |
| 137 | return pte; | 137 | return pte; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | extern inline pte_t pte_mkclean(pte_t pte) | 140 | static inline pte_t pte_mkclean(pte_t pte) |
| 141 | { | 141 | { |
| 142 | pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); | 142 | pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); |
| 143 | return pte; | 143 | return pte; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | extern inline pte_t pte_mkold(pte_t pte) | 146 | static inline pte_t pte_mkold(pte_t pte) |
| 147 | { | 147 | { |
| 148 | pte_val(pte) &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ); | 148 | pte_val(pte) &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ); |
| 149 | return pte; | 149 | return pte; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | extern inline pte_t pte_mkwrite(pte_t pte) | 152 | static inline pte_t pte_mkwrite(pte_t pte) |
| 153 | { | 153 | { |
| 154 | pte_val(pte) |= _PAGE_WRITE; | 154 | pte_val(pte) |= _PAGE_WRITE; |
| 155 | if (pte_val(pte) & _PAGE_MODIFIED) | 155 | if (pte_val(pte) & _PAGE_MODIFIED) |
| @@ -157,7 +157,7 @@ extern inline pte_t pte_mkwrite(pte_t pte) | |||
| 157 | return pte; | 157 | return pte; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | extern inline pte_t pte_mkread(pte_t pte) | 160 | static inline pte_t pte_mkread(pte_t pte) |
| 161 | { | 161 | { |
| 162 | pte_val(pte) |= _PAGE_READ; | 162 | pte_val(pte) |= _PAGE_READ; |
| 163 | if (pte_val(pte) & _PAGE_ACCESSED) | 163 | if (pte_val(pte) & _PAGE_ACCESSED) |
| @@ -165,7 +165,7 @@ extern inline pte_t pte_mkread(pte_t pte) | |||
| 165 | return pte; | 165 | return pte; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | extern inline pte_t pte_mkexec(pte_t pte) | 168 | static inline pte_t pte_mkexec(pte_t pte) |
| 169 | { | 169 | { |
| 170 | pte_val(pte) |= _PAGE_READ; | 170 | pte_val(pte) |= _PAGE_READ; |
| 171 | if (pte_val(pte) & _PAGE_ACCESSED) | 171 | if (pte_val(pte) & _PAGE_ACCESSED) |
| @@ -173,7 +173,7 @@ extern inline pte_t pte_mkexec(pte_t pte) | |||
| 173 | return pte; | 173 | return pte; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | extern inline pte_t pte_mkdirty(pte_t pte) | 176 | static inline pte_t pte_mkdirty(pte_t pte) |
| 177 | { | 177 | { |
| 178 | pte_val(pte) |= _PAGE_MODIFIED; | 178 | pte_val(pte) |= _PAGE_MODIFIED; |
| 179 | if (pte_val(pte) & _PAGE_WRITE) | 179 | if (pte_val(pte) & _PAGE_WRITE) |
| @@ -181,7 +181,7 @@ extern inline pte_t pte_mkdirty(pte_t pte) | |||
| 181 | return pte; | 181 | return pte; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | extern inline pte_t pte_mkyoung(pte_t pte) | 184 | static inline pte_t pte_mkyoung(pte_t pte) |
| 185 | { | 185 | { |
| 186 | pte_val(pte) |= _PAGE_ACCESSED; | 186 | pte_val(pte) |= _PAGE_ACCESSED; |
| 187 | if (pte_val(pte) & _PAGE_READ) | 187 | if (pte_val(pte) & _PAGE_READ) |
| @@ -205,7 +205,7 @@ extern inline pte_t pte_mkyoung(pte_t pte) | |||
| 205 | * addresses (the 0xc0xxxxxx's) goes as void *'s. | 205 | * addresses (the 0xc0xxxxxx's) goes as void *'s. |
| 206 | */ | 206 | */ |
| 207 | 207 | ||
| 208 | extern inline pte_t __mk_pte(void * page, pgprot_t pgprot) | 208 | static inline pte_t __mk_pte(void * page, pgprot_t pgprot) |
| 209 | { | 209 | { |
| 210 | pte_t pte; | 210 | pte_t pte; |
| 211 | /* the PTE needs a physical address */ | 211 | /* the PTE needs a physical address */ |
| @@ -223,7 +223,7 @@ extern inline pte_t __mk_pte(void * page, pgprot_t pgprot) | |||
| 223 | __pte; \ | 223 | __pte; \ |
| 224 | }) | 224 | }) |
| 225 | 225 | ||
| 226 | extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 226 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
| 227 | { pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } | 227 | { pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } |
| 228 | 228 | ||
| 229 | 229 | ||
| @@ -232,7 +232,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
| 232 | * pte_pagenr refers to the page-number counted starting from the virtual DRAM start | 232 | * pte_pagenr refers to the page-number counted starting from the virtual DRAM start |
| 233 | */ | 233 | */ |
| 234 | 234 | ||
| 235 | extern inline unsigned long __pte_page(pte_t pte) | 235 | static inline unsigned long __pte_page(pte_t pte) |
| 236 | { | 236 | { |
| 237 | /* the PTE contains a physical address */ | 237 | /* the PTE contains a physical address */ |
| 238 | return (unsigned long)__va(pte_val(pte) & PAGE_MASK); | 238 | return (unsigned long)__va(pte_val(pte) & PAGE_MASK); |
| @@ -250,7 +250,7 @@ extern inline unsigned long __pte_page(pte_t pte) | |||
| 250 | * don't need the __pa and __va transformations. | 250 | * don't need the __pa and __va transformations. |
| 251 | */ | 251 | */ |
| 252 | 252 | ||
| 253 | extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | 253 | static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) |
| 254 | { pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } | 254 | { pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } |
| 255 | 255 | ||
| 256 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 256 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
| @@ -260,7 +260,7 @@ extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
| 260 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 260 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
| 261 | 261 | ||
| 262 | /* to find an entry in a page-table-directory */ | 262 | /* to find an entry in a page-table-directory */ |
| 263 | extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) | 263 | static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) |
| 264 | { | 264 | { |
| 265 | return mm->pgd + pgd_index(address); | 265 | return mm->pgd + pgd_index(address); |
| 266 | } | 266 | } |
| @@ -296,7 +296,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */ | |||
| 296 | * | 296 | * |
| 297 | * Actually I am not sure on what this could be used for. | 297 | * Actually I am not sure on what this could be used for. |
| 298 | */ | 298 | */ |
| 299 | extern inline void update_mmu_cache(struct vm_area_struct * vma, | 299 | static inline void update_mmu_cache(struct vm_area_struct * vma, |
| 300 | unsigned long address, pte_t pte) | 300 | unsigned long address, pte_t pte) |
| 301 | { | 301 | { |
| 302 | } | 302 | } |
diff --git a/include/asm-cris/processor.h b/include/asm-cris/processor.h index 0dc218117bd8..dce41009eeb0 100644 --- a/include/asm-cris/processor.h +++ b/include/asm-cris/processor.h | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
| 17 | #include <asm/arch/processor.h> | 17 | #include <asm/arch/processor.h> |
| 18 | 18 | ||
| 19 | struct task_struct; | ||
| 20 | |||
| 19 | /* This decides where the kernel will search for a free chunk of vm | 21 | /* This decides where the kernel will search for a free chunk of vm |
| 20 | * space during mmap's. | 22 | * space during mmap's. |
| 21 | */ | 23 | */ |
| @@ -45,7 +47,7 @@ | |||
| 45 | 47 | ||
| 46 | #define current_regs() user_regs(current->thread_info) | 48 | #define current_regs() user_regs(current->thread_info) |
| 47 | 49 | ||
| 48 | extern inline void prepare_to_copy(struct task_struct *tsk) | 50 | static inline void prepare_to_copy(struct task_struct *tsk) |
| 49 | { | 51 | { |
| 50 | } | 52 | } |
| 51 | 53 | ||
| @@ -58,7 +60,7 @@ unsigned long get_wchan(struct task_struct *p); | |||
| 58 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | 60 | extern unsigned long thread_saved_pc(struct task_struct *tsk); |
| 59 | 61 | ||
| 60 | /* Free all resources held by a thread. */ | 62 | /* Free all resources held by a thread. */ |
| 61 | extern inline void release_thread(struct task_struct *dead_task) | 63 | static inline void release_thread(struct task_struct *dead_task) |
| 62 | { | 64 | { |
| 63 | /* Nothing needs to be done. */ | 65 | /* Nothing needs to be done. */ |
| 64 | } | 66 | } |
diff --git a/include/asm-cris/semaphore.h b/include/asm-cris/semaphore.h index 39faf69bcf76..53f548b791c1 100644 --- a/include/asm-cris/semaphore.h +++ b/include/asm-cris/semaphore.h | |||
| @@ -18,8 +18,6 @@ | |||
| 18 | * CRIS semaphores, implemented in C-only so far. | 18 | * CRIS semaphores, implemented in C-only so far. |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | int printk(const char *fmt, ...); | ||
| 22 | |||
| 23 | struct semaphore { | 21 | struct semaphore { |
| 24 | atomic_t count; | 22 | atomic_t count; |
| 25 | atomic_t waking; | 23 | atomic_t waking; |
| @@ -39,17 +37,17 @@ struct semaphore { | |||
| 39 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) | 37 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) |
| 40 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) | 38 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) |
| 41 | 39 | ||
| 42 | extern inline void sema_init(struct semaphore *sem, int val) | 40 | static inline void sema_init(struct semaphore *sem, int val) |
| 43 | { | 41 | { |
| 44 | *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); | 42 | *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); |
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | extern inline void init_MUTEX (struct semaphore *sem) | 45 | static inline void init_MUTEX (struct semaphore *sem) |
| 48 | { | 46 | { |
| 49 | sema_init(sem, 1); | 47 | sema_init(sem, 1); |
| 50 | } | 48 | } |
| 51 | 49 | ||
| 52 | extern inline void init_MUTEX_LOCKED (struct semaphore *sem) | 50 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) |
| 53 | { | 51 | { |
| 54 | sema_init(sem, 0); | 52 | sema_init(sem, 0); |
| 55 | } | 53 | } |
| @@ -61,7 +59,7 @@ extern void __up(struct semaphore * sem); | |||
| 61 | 59 | ||
| 62 | /* notice - we probably can do cli/sti here instead of saving */ | 60 | /* notice - we probably can do cli/sti here instead of saving */ |
| 63 | 61 | ||
| 64 | extern inline void down(struct semaphore * sem) | 62 | static inline void down(struct semaphore * sem) |
| 65 | { | 63 | { |
| 66 | unsigned long flags; | 64 | unsigned long flags; |
| 67 | int failed; | 65 | int failed; |
| @@ -83,7 +81,7 @@ extern inline void down(struct semaphore * sem) | |||
| 83 | * returns negative for signalled and zero for semaphore acquired. | 81 | * returns negative for signalled and zero for semaphore acquired. |
| 84 | */ | 82 | */ |
| 85 | 83 | ||
| 86 | extern inline int down_interruptible(struct semaphore * sem) | 84 | static inline int down_interruptible(struct semaphore * sem) |
| 87 | { | 85 | { |
| 88 | unsigned long flags; | 86 | unsigned long flags; |
| 89 | int failed; | 87 | int failed; |
| @@ -99,7 +97,7 @@ extern inline int down_interruptible(struct semaphore * sem) | |||
| 99 | return(failed); | 97 | return(failed); |
| 100 | } | 98 | } |
| 101 | 99 | ||
| 102 | extern inline int down_trylock(struct semaphore * sem) | 100 | static inline int down_trylock(struct semaphore * sem) |
| 103 | { | 101 | { |
| 104 | unsigned long flags; | 102 | unsigned long flags; |
| 105 | int failed; | 103 | int failed; |
| @@ -119,7 +117,7 @@ extern inline int down_trylock(struct semaphore * sem) | |||
| 119 | * The default case (no contention) will result in NO | 117 | * The default case (no contention) will result in NO |
| 120 | * jumps for both down() and up(). | 118 | * jumps for both down() and up(). |
| 121 | */ | 119 | */ |
| 122 | extern inline void up(struct semaphore * sem) | 120 | static inline void up(struct semaphore * sem) |
| 123 | { | 121 | { |
| 124 | unsigned long flags; | 122 | unsigned long flags; |
| 125 | int wakeup; | 123 | int wakeup; |
diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h index e06739806d4e..d48670107a85 100644 --- a/include/asm-cris/system.h +++ b/include/asm-cris/system.h | |||
| @@ -41,7 +41,7 @@ extern struct task_struct *resume(struct task_struct *prev, struct task_struct * | |||
| 41 | void disable_hlt(void); | 41 | void disable_hlt(void); |
| 42 | void enable_hlt(void); | 42 | void enable_hlt(void); |
| 43 | 43 | ||
| 44 | extern inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | 44 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) |
| 45 | { | 45 | { |
| 46 | /* since Etrax doesn't have any atomic xchg instructions, we need to disable | 46 | /* since Etrax doesn't have any atomic xchg instructions, we need to disable |
| 47 | irq's (if enabled) and do it with move.d's */ | 47 | irq's (if enabled) and do it with move.d's */ |
diff --git a/include/asm-cris/timex.h b/include/asm-cris/timex.h index 3fb069a37717..b92e0e80fe86 100644 --- a/include/asm-cris/timex.h +++ b/include/asm-cris/timex.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | typedef unsigned long long cycles_t; | 17 | typedef unsigned long long cycles_t; |
| 18 | 18 | ||
| 19 | extern inline cycles_t get_cycles(void) | 19 | static inline cycles_t get_cycles(void) |
| 20 | { | 20 | { |
| 21 | return 0; | 21 | return 0; |
| 22 | } | 22 | } |
diff --git a/include/asm-cris/tlbflush.h b/include/asm-cris/tlbflush.h index 6ed7d9ae90db..c52238005b55 100644 --- a/include/asm-cris/tlbflush.h +++ b/include/asm-cris/tlbflush.h | |||
| @@ -39,14 +39,14 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st | |||
| 39 | flush_tlb_mm(vma->vm_mm); | 39 | flush_tlb_mm(vma->vm_mm); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | extern inline void flush_tlb_pgtables(struct mm_struct *mm, | 42 | static inline void flush_tlb_pgtables(struct mm_struct *mm, |
| 43 | unsigned long start, unsigned long end) | 43 | unsigned long start, unsigned long end) |
| 44 | { | 44 | { |
| 45 | /* CRIS does not keep any page table caches in TLB */ | 45 | /* CRIS does not keep any page table caches in TLB */ |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | extern inline void flush_tlb(void) | 49 | static inline void flush_tlb(void) |
| 50 | { | 50 | { |
| 51 | flush_tlb_mm(current->mm); | 51 | flush_tlb_mm(current->mm); |
| 52 | } | 52 | } |
diff --git a/include/asm-cris/uaccess.h b/include/asm-cris/uaccess.h index 7d50086eb5ea..69d48a2dc8e1 100644 --- a/include/asm-cris/uaccess.h +++ b/include/asm-cris/uaccess.h | |||
| @@ -213,7 +213,7 @@ extern unsigned long __copy_user(void *to, const void *from, unsigned long n); | |||
| 213 | extern unsigned long __copy_user_zeroing(void *to, const void *from, unsigned long n); | 213 | extern unsigned long __copy_user_zeroing(void *to, const void *from, unsigned long n); |
| 214 | extern unsigned long __do_clear_user(void *to, unsigned long n); | 214 | extern unsigned long __do_clear_user(void *to, unsigned long n); |
| 215 | 215 | ||
| 216 | extern inline unsigned long | 216 | static inline unsigned long |
| 217 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) | 217 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) |
| 218 | { | 218 | { |
| 219 | if (access_ok(VERIFY_WRITE, to, n)) | 219 | if (access_ok(VERIFY_WRITE, to, n)) |
| @@ -221,7 +221,7 @@ __generic_copy_to_user(void __user *to, const void *from, unsigned long n) | |||
| 221 | return n; | 221 | return n; |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | extern inline unsigned long | 224 | static inline unsigned long |
| 225 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) | 225 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) |
| 226 | { | 226 | { |
| 227 | if (access_ok(VERIFY_READ, from, n)) | 227 | if (access_ok(VERIFY_READ, from, n)) |
| @@ -229,7 +229,7 @@ __generic_copy_from_user(void *to, const void __user *from, unsigned long n) | |||
| 229 | return n; | 229 | return n; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | extern inline unsigned long | 232 | static inline unsigned long |
| 233 | __generic_clear_user(void __user *to, unsigned long n) | 233 | __generic_clear_user(void __user *to, unsigned long n) |
| 234 | { | 234 | { |
| 235 | if (access_ok(VERIFY_WRITE, to, n)) | 235 | if (access_ok(VERIFY_WRITE, to, n)) |
| @@ -237,13 +237,13 @@ __generic_clear_user(void __user *to, unsigned long n) | |||
| 237 | return n; | 237 | return n; |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | extern inline long | 240 | static inline long |
| 241 | __strncpy_from_user(char *dst, const char __user *src, long count) | 241 | __strncpy_from_user(char *dst, const char __user *src, long count) |
| 242 | { | 242 | { |
| 243 | return __do_strncpy_from_user(dst, src, count); | 243 | return __do_strncpy_from_user(dst, src, count); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | extern inline long | 246 | static inline long |
| 247 | strncpy_from_user(char *dst, const char __user *src, long count) | 247 | strncpy_from_user(char *dst, const char __user *src, long count) |
| 248 | { | 248 | { |
| 249 | long res = -EFAULT; | 249 | long res = -EFAULT; |
| @@ -256,7 +256,7 @@ strncpy_from_user(char *dst, const char __user *src, long count) | |||
| 256 | /* Note that if these expand awfully if made into switch constructs, so | 256 | /* Note that if these expand awfully if made into switch constructs, so |
| 257 | don't do that. */ | 257 | don't do that. */ |
| 258 | 258 | ||
| 259 | extern inline unsigned long | 259 | static inline unsigned long |
| 260 | __constant_copy_from_user(void *to, const void __user *from, unsigned long n) | 260 | __constant_copy_from_user(void *to, const void __user *from, unsigned long n) |
| 261 | { | 261 | { |
| 262 | unsigned long ret = 0; | 262 | unsigned long ret = 0; |
| @@ -306,7 +306,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n) | |||
| 306 | 306 | ||
| 307 | /* Ditto, don't make a switch out of this. */ | 307 | /* Ditto, don't make a switch out of this. */ |
| 308 | 308 | ||
| 309 | extern inline unsigned long | 309 | static inline unsigned long |
| 310 | __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | 310 | __constant_copy_to_user(void __user *to, const void *from, unsigned long n) |
| 311 | { | 311 | { |
| 312 | unsigned long ret = 0; | 312 | unsigned long ret = 0; |
| @@ -356,7 +356,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | |||
| 356 | 356 | ||
| 357 | /* No switch, please. */ | 357 | /* No switch, please. */ |
| 358 | 358 | ||
| 359 | extern inline unsigned long | 359 | static inline unsigned long |
| 360 | __constant_clear_user(void __user *to, unsigned long n) | 360 | __constant_clear_user(void __user *to, unsigned long n) |
| 361 | { | 361 | { |
| 362 | unsigned long ret = 0; | 362 | unsigned long ret = 0; |
| @@ -406,19 +406,19 @@ __constant_clear_user(void __user *to, unsigned long n) | |||
| 406 | * used in fast paths and have only a small space overhead. | 406 | * used in fast paths and have only a small space overhead. |
| 407 | */ | 407 | */ |
| 408 | 408 | ||
| 409 | extern inline unsigned long | 409 | static inline unsigned long |
| 410 | __generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n) | 410 | __generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n) |
| 411 | { | 411 | { |
| 412 | return __copy_user_zeroing(to,from,n); | 412 | return __copy_user_zeroing(to,from,n); |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | extern inline unsigned long | 415 | static inline unsigned long |
| 416 | __generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n) | 416 | __generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n) |
| 417 | { | 417 | { |
| 418 | return __copy_user(to,from,n); | 418 | return __copy_user(to,from,n); |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | extern inline unsigned long | 421 | static inline unsigned long |
| 422 | __generic_clear_user_nocheck(void *to, unsigned long n) | 422 | __generic_clear_user_nocheck(void *to, unsigned long n) |
| 423 | { | 423 | { |
| 424 | return __do_clear_user(to,n); | 424 | return __do_clear_user(to,n); |
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h index 156a34bfc583..2627bbdf8a11 100644 --- a/include/asm-cris/unistd.h +++ b/include/asm-cris/unistd.h | |||
| @@ -343,14 +343,14 @@ | |||
| 343 | * some others too. | 343 | * some others too. |
| 344 | */ | 344 | */ |
| 345 | #define __NR__exit __NR_exit | 345 | #define __NR__exit __NR_exit |
| 346 | extern inline _syscall0(pid_t,setsid) | 346 | static inline _syscall0(pid_t,setsid) |
| 347 | extern inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) | 347 | static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) |
| 348 | extern inline _syscall3(int,read,int,fd,char *,buf,off_t,count) | 348 | static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) |
| 349 | extern inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) | 349 | static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) |
| 350 | extern inline _syscall1(int,dup,int,fd) | 350 | static inline _syscall1(int,dup,int,fd) |
| 351 | extern inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) | 351 | static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) |
| 352 | extern inline _syscall3(int,open,const char *,file,int,flag,int,mode) | 352 | static inline _syscall3(int,open,const char *,file,int,flag,int,mode) |
| 353 | extern inline _syscall1(int,close,int,fd) | 353 | static inline _syscall1(int,close,int,fd) |
| 354 | 354 | ||
| 355 | struct pt_regs; | 355 | struct pt_regs; |
| 356 | asmlinkage long sys_mmap2( | 356 | asmlinkage long sys_mmap2( |
| @@ -382,8 +382,8 @@ asmlinkage long sys_rt_sigaction(int sig, | |||
| 382 | #ifdef __KERNEL__ | 382 | #ifdef __KERNEL__ |
| 383 | #define _exit kernel_syscall_exit | 383 | #define _exit kernel_syscall_exit |
| 384 | #endif | 384 | #endif |
| 385 | extern inline _syscall1(int,_exit,int,exitcode) | 385 | static inline _syscall1(int,_exit,int,exitcode) |
| 386 | extern inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) | 386 | static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) |
| 387 | #endif | 387 | #endif |
| 388 | 388 | ||
| 389 | 389 | ||
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index b247e99dff49..844666377dcb 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h | |||
| @@ -26,6 +26,8 @@ | |||
| 26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/list.h> | 27 | #include <linux/list.h> |
| 28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
| 29 | struct mm_struct; | ||
| 30 | struct vm_area_struct; | ||
| 29 | #endif | 31 | #endif |
| 30 | 32 | ||
| 31 | #ifndef __ASSEMBLY__ | 33 | #ifndef __ASSEMBLY__ |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 7dca30a26c53..358e4d309ceb 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
| @@ -128,6 +128,7 @@ do { \ | |||
| 128 | #endif | 128 | #endif |
| 129 | 129 | ||
| 130 | #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT | 130 | #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT |
| 131 | struct mm_struct; | ||
| 131 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep) | 132 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep) |
| 132 | { | 133 | { |
| 133 | pte_t old_pte = *ptep; | 134 | pte_t old_pte = *ptep; |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index a9c55490fb82..094d4917c1a9 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -35,6 +35,13 @@ | |||
| 35 | VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ | 35 | VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ |
| 36 | } \ | 36 | } \ |
| 37 | \ | 37 | \ |
| 38 | /* RapidIO route ops */ \ | ||
| 39 | .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \ | ||
| 40 | VMLINUX_SYMBOL(__start_rio_route_ops) = .; \ | ||
| 41 | *(.rio_route_ops) \ | ||
| 42 | VMLINUX_SYMBOL(__end_rio_route_ops) = .; \ | ||
| 43 | } \ | ||
| 44 | \ | ||
| 38 | /* Kernel symbol table: Normal symbols */ \ | 45 | /* Kernel symbol table: Normal symbols */ \ |
| 39 | __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ | 46 | __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ |
| 40 | VMLINUX_SYMBOL(__start___ksymtab) = .; \ | 47 | VMLINUX_SYMBOL(__start___ksymtab) = .; \ |
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index fa11117d3cfa..4153d80e4d2b 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h | |||
| @@ -119,6 +119,8 @@ typedef struct user_fxsr_struct elf_fpxregset_t; | |||
| 119 | */ | 119 | */ |
| 120 | #define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) | 120 | #define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) |
| 121 | 121 | ||
| 122 | struct task_struct; | ||
| 123 | |||
| 122 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); | 124 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); |
| 123 | extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); | 125 | extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); |
| 124 | extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *); | 126 | extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *); |
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-i386/kprobes.h b/include/asm-i386/kprobes.h index 8b6d3a90cd78..ca916a892877 100644 --- a/include/asm-i386/kprobes.h +++ b/include/asm-i386/kprobes.h | |||
| @@ -49,6 +49,23 @@ struct arch_specific_insn { | |||
| 49 | kprobe_opcode_t insn[MAX_INSN_SIZE]; | 49 | kprobe_opcode_t insn[MAX_INSN_SIZE]; |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | struct prev_kprobe { | ||
| 53 | struct kprobe *kp; | ||
| 54 | unsigned long status; | ||
| 55 | unsigned long old_eflags; | ||
| 56 | unsigned long saved_eflags; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* per-cpu kprobe control block */ | ||
| 60 | struct kprobe_ctlblk { | ||
| 61 | unsigned long kprobe_status; | ||
| 62 | unsigned long kprobe_old_eflags; | ||
| 63 | unsigned long kprobe_saved_eflags; | ||
| 64 | long *jprobe_saved_esp; | ||
| 65 | struct pt_regs jprobe_saved_regs; | ||
| 66 | kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; | ||
| 67 | struct prev_kprobe prev_kprobe; | ||
| 68 | }; | ||
| 52 | 69 | ||
| 53 | /* trap3/1 are intr gates for kprobes. So, restore the status of IF, | 70 | /* trap3/1 are intr gates for kprobes. So, restore the status of IF, |
| 54 | * if necessary, before executing the original int3/1 (trap) handler. | 71 | * if necessary, before executing the original int3/1 (trap) handler. |
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 03f3c8ac6383..088a945bf26b 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h | |||
| @@ -25,6 +25,9 @@ | |||
| 25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
| 26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
| 27 | 27 | ||
| 28 | struct mm_struct; | ||
| 29 | struct vm_area_struct; | ||
| 30 | |||
| 28 | /* | 31 | /* |
| 29 | * ZERO_PAGE is a global shared page that is always zero: used | 32 | * ZERO_PAGE is a global shared page that is always zero: used |
| 30 | * for zero-mapped memory areas etc.. | 33 | * for zero-mapped memory areas etc.. |
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 0a4ec764377c..8c02b0318703 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
| @@ -718,4 +718,10 @@ extern void mtrr_bp_init(void); | |||
| 718 | #define mtrr_bp_init() do {} while (0) | 718 | #define mtrr_bp_init() do {} while (0) |
| 719 | #endif | 719 | #endif |
| 720 | 720 | ||
| 721 | #ifdef CONFIG_X86_MCE | ||
| 722 | extern void mcheck_init(struct cpuinfo_x86 *c); | ||
| 723 | #else | ||
| 724 | #define mcheck_init(c) do {} while(0) | ||
| 725 | #endif | ||
| 726 | |||
| 721 | #endif /* __ASM_I386_PROCESSOR_H */ | 727 | #endif /* __ASM_I386_PROCESSOR_H */ |
diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h index 6347c9845642..df67d40801de 100644 --- a/include/asm-ia64/dma-mapping.h +++ b/include/asm-ia64/dma-mapping.h | |||
| @@ -48,12 +48,7 @@ dma_set_mask (struct device *dev, u64 mask) | |||
| 48 | return 0; | 48 | return 0; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | static inline int | 51 | extern int dma_get_cache_alignment(void); |
| 52 | dma_get_cache_alignment (void) | ||
| 53 | { | ||
| 54 | extern int ia64_max_cacheline_size; | ||
| 55 | return ia64_max_cacheline_size; | ||
| 56 | } | ||
| 57 | 52 | ||
| 58 | static inline void | 53 | static inline void |
| 59 | dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir) | 54 | dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir) |
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h index 573a3574a24f..592abb000e29 100644 --- a/include/asm-ia64/kprobes.h +++ b/include/asm-ia64/kprobes.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | */ | 26 | */ |
| 27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
| 28 | #include <linux/ptrace.h> | 28 | #include <linux/ptrace.h> |
| 29 | #include <linux/percpu.h> | ||
| 29 | #include <asm/break.h> | 30 | #include <asm/break.h> |
| 30 | 31 | ||
| 31 | #define MAX_INSN_SIZE 16 | 32 | #define MAX_INSN_SIZE 16 |
| @@ -62,6 +63,18 @@ typedef struct _bundle { | |||
| 62 | } quad1; | 63 | } quad1; |
| 63 | } __attribute__((__aligned__(16))) bundle_t; | 64 | } __attribute__((__aligned__(16))) bundle_t; |
| 64 | 65 | ||
| 66 | struct prev_kprobe { | ||
| 67 | struct kprobe *kp; | ||
| 68 | unsigned long status; | ||
| 69 | }; | ||
| 70 | |||
| 71 | /* per-cpu kprobe control block */ | ||
| 72 | struct kprobe_ctlblk { | ||
| 73 | unsigned long kprobe_status; | ||
| 74 | struct pt_regs jprobe_saved_regs; | ||
| 75 | struct prev_kprobe prev_kprobe; | ||
| 76 | }; | ||
| 77 | |||
| 65 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 78 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
| 66 | 79 | ||
| 67 | #define ARCH_SUPPORTS_KRETPROBES | 80 | #define ARCH_SUPPORTS_KRETPROBES |
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h index ef436b9d06ad..9d41548b7fef 100644 --- a/include/asm-ia64/page.h +++ b/include/asm-ia64/page.h | |||
| @@ -120,6 +120,7 @@ extern unsigned long max_low_pfn; | |||
| 120 | 120 | ||
| 121 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | 121 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
| 122 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 122 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
| 123 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
| 123 | 124 | ||
| 124 | typedef union ia64_va { | 125 | typedef union ia64_va { |
| 125 | struct { | 126 | struct { |
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index 21e32a06bc82..c34ba80c1c31 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h | |||
| @@ -127,6 +127,7 @@ | |||
| 127 | 127 | ||
| 128 | # ifndef __ASSEMBLY__ | 128 | # ifndef __ASSEMBLY__ |
| 129 | 129 | ||
| 130 | #include <linux/sched.h> /* for mm_struct */ | ||
| 130 | #include <asm/bitops.h> | 131 | #include <asm/bitops.h> |
| 131 | #include <asm/cacheflush.h> | 132 | #include <asm/cacheflush.h> |
| 132 | #include <asm/mmu_context.h> | 133 | #include <asm/mmu_context.h> |
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index a79d1a7ecc77..2c703d6e0c86 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h | |||
| @@ -229,6 +229,9 @@ struct switch_stack { | |||
| 229 | }; | 229 | }; |
| 230 | 230 | ||
| 231 | #ifdef __KERNEL__ | 231 | #ifdef __KERNEL__ |
| 232 | |||
| 233 | #define __ARCH_SYS_PTRACE 1 | ||
| 234 | |||
| 232 | /* | 235 | /* |
| 233 | * We use the ia64_psr(regs)->ri to determine which of the three | 236 | * We use the ia64_psr(regs)->ri to determine which of the three |
| 234 | * instructions in bundle (16 bytes) took the sample. Generate | 237 | * instructions in bundle (16 bytes) took the sample. Generate |
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h index 1cd5fd4a5b2c..75740debcd01 100644 --- a/include/asm-m32r/pgtable.h +++ b/include/asm-m32r/pgtable.h | |||
| @@ -27,6 +27,9 @@ | |||
| 27 | #include <asm/bitops.h> | 27 | #include <asm/bitops.h> |
| 28 | #include <asm/page.h> | 28 | #include <asm/page.h> |
| 29 | 29 | ||
| 30 | struct mm_struct; | ||
| 31 | struct vm_area_struct; | ||
| 32 | |||
| 30 | extern pgd_t swapper_pg_dir[1024]; | 33 | extern pgd_t swapper_pg_dir[1024]; |
| 31 | extern void paging_init(void); | 34 | extern void paging_init(void); |
| 32 | 35 | ||
diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h index 976417126b2d..55cd7ecfde43 100644 --- a/include/asm-m32r/ptrace.h +++ b/include/asm-m32r/ptrace.h | |||
| @@ -145,6 +145,9 @@ struct pt_regs { | |||
| 145 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | 145 | #define PTRACE_O_TRACESYSGOOD 0x00000001 |
| 146 | 146 | ||
| 147 | #ifdef __KERNEL__ | 147 | #ifdef __KERNEL__ |
| 148 | |||
| 149 | #define __ARCH_SYS_PTRACE 1 | ||
| 150 | |||
| 148 | #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) | 151 | #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) |
| 149 | #define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) | 152 | #define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) |
| 150 | #elif defined(CONFIG_ISA_M32R) | 153 | #elif defined(CONFIG_ISA_M32R) |
diff --git a/include/asm-m68k/kbio.h b/include/asm-m68k/kbio.h deleted file mode 100644 index e1fbf8fba3e8..000000000000 --- a/include/asm-m68k/kbio.h +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | #include <asm-sparc/kbio.h> | ||
diff --git a/include/asm-m68k/vuid_event.h b/include/asm-m68k/vuid_event.h deleted file mode 100644 index 52ecb521a395..000000000000 --- a/include/asm-m68k/vuid_event.h +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | #ifndef _M68K_VUID_EVENT_H | ||
| 2 | #define _M68K_VUID_EVENT_H | ||
| 3 | #include <asm-sparc/vuid_event.h> | ||
| 4 | #endif | ||
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h index 026bbc9565b4..49925e91e89c 100644 --- a/include/asm-m68knommu/cacheflush.h +++ b/include/asm-m68knommu/cacheflush.h | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | 25 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
| 26 | memcpy(dst, src, len) | 26 | memcpy(dst, src, len) |
| 27 | 27 | ||
| 28 | extern inline void __flush_cache_all(void) | 28 | static inline void __flush_cache_all(void) |
| 29 | { | 29 | { |
| 30 | #ifdef CONFIG_M5407 | 30 | #ifdef CONFIG_M5407 |
| 31 | /* | 31 | /* |
| @@ -64,7 +64,7 @@ extern inline void __flush_cache_all(void) | |||
| 64 | "nop\n\t" | 64 | "nop\n\t" |
| 65 | : : : "d0" ); | 65 | : : : "d0" ); |
| 66 | #endif /* CONFIG_M5272 */ | 66 | #endif /* CONFIG_M5272 */ |
| 67 | #if CONFIG_M5249 | 67 | #ifdef CONFIG_M5249 |
| 68 | __asm__ __volatile__ ( | 68 | __asm__ __volatile__ ( |
| 69 | "movel #0xa1000200, %%d0\n\t" | 69 | "movel #0xa1000200, %%d0\n\t" |
| 70 | "movec %%d0, %%CACR\n\t" | 70 | "movec %%d0, %%CACR\n\t" |
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h index 208ccd969e4b..a08fa9b958da 100644 --- a/include/asm-m68knommu/irq.h +++ b/include/asm-m68knommu/irq.h | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | #define _M68K_IRQ_H_ | 2 | #define _M68K_IRQ_H_ |
| 3 | 3 | ||
| 4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
| 5 | #include <linux/interrupt.h> | ||
| 6 | #include <asm/ptrace.h> | 5 | #include <asm/ptrace.h> |
| 7 | 6 | ||
| 8 | #ifdef CONFIG_COLDFIRE | 7 | #ifdef CONFIG_COLDFIRE |
| @@ -83,36 +82,6 @@ extern void (*mach_disable_irq)(unsigned int); | |||
| 83 | #endif /* CONFIG_M68360 */ | 82 | #endif /* CONFIG_M68360 */ |
| 84 | 83 | ||
| 85 | /* | 84 | /* |
| 86 | * This structure is used to chain together the ISRs for a particular | ||
| 87 | * interrupt source (if it supports chaining). | ||
| 88 | */ | ||
| 89 | typedef struct irq_node { | ||
| 90 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
| 91 | unsigned long flags; | ||
| 92 | void *dev_id; | ||
| 93 | const char *devname; | ||
| 94 | struct irq_node *next; | ||
| 95 | } irq_node_t; | ||
| 96 | |||
| 97 | /* | ||
| 98 | * This structure has only 4 elements for speed reasons | ||
| 99 | */ | ||
| 100 | typedef struct irq_handler { | ||
| 101 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
| 102 | unsigned long flags; | ||
| 103 | void *dev_id; | ||
| 104 | const char *devname; | ||
| 105 | } irq_handler_t; | ||
| 106 | |||
| 107 | /* count of spurious interrupts */ | ||
| 108 | extern volatile unsigned int num_spurious; | ||
| 109 | |||
| 110 | /* | ||
| 111 | * This function returns a new irq_node_t | ||
| 112 | */ | ||
| 113 | extern irq_node_t *new_irq_node(void); | ||
| 114 | |||
| 115 | /* | ||
| 116 | * Some drivers want these entry points | 85 | * Some drivers want these entry points |
| 117 | */ | 86 | */ |
| 118 | #define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0) | 87 | #define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0) |
diff --git a/include/asm-m68knommu/irqnode.h b/include/asm-m68knommu/irqnode.h new file mode 100644 index 000000000000..a2503dfc554c --- /dev/null +++ b/include/asm-m68knommu/irqnode.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #ifndef _M68K_IRQNODE_H_ | ||
| 2 | #define _M68K_IRQNODE_H_ | ||
| 3 | |||
| 4 | #include <linux/interrupt.h> | ||
| 5 | |||
| 6 | /* | ||
| 7 | * This structure is used to chain together the ISRs for a particular | ||
| 8 | * interrupt source (if it supports chaining). | ||
| 9 | */ | ||
| 10 | typedef struct irq_node { | ||
| 11 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
| 12 | unsigned long flags; | ||
| 13 | void *dev_id; | ||
| 14 | const char *devname; | ||
| 15 | struct irq_node *next; | ||
| 16 | } irq_node_t; | ||
| 17 | |||
| 18 | /* | ||
| 19 | * This structure has only 4 elements for speed reasons | ||
| 20 | */ | ||
| 21 | typedef struct irq_handler { | ||
| 22 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
| 23 | unsigned long flags; | ||
| 24 | void *dev_id; | ||
| 25 | const char *devname; | ||
| 26 | } irq_handler_t; | ||
| 27 | |||
| 28 | /* count of spurious interrupts */ | ||
| 29 | extern volatile unsigned int num_spurious; | ||
| 30 | |||
| 31 | /* | ||
| 32 | * This function returns a new irq_node_t | ||
| 33 | */ | ||
| 34 | extern irq_node_t *new_irq_node(void); | ||
| 35 | |||
| 36 | #endif /* _M68K_IRQNODE_H_ */ | ||
diff --git a/include/asm-mips/.gitignore b/include/asm-mips/.gitignore new file mode 100644 index 000000000000..4ec57ad5bc3c --- /dev/null +++ b/include/asm-mips/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| asm_offsets.h | |||
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h index 85435a8d4e52..48d00cccdafa 100644 --- a/include/asm-mips/delay.h +++ b/include/asm-mips/delay.h | |||
| @@ -84,4 +84,13 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj) | |||
| 84 | 84 | ||
| 85 | #define udelay(usecs) __udelay((usecs),__udelay_val) | 85 | #define udelay(usecs) __udelay((usecs),__udelay_val) |
| 86 | 86 | ||
| 87 | /* make sure "usecs *= ..." in udelay do not overflow. */ | ||
| 88 | #if HZ >= 1000 | ||
| 89 | #define MAX_UDELAY_MS 1 | ||
| 90 | #elif HZ <= 200 | ||
| 91 | #define MAX_UDELAY_MS 5 | ||
| 92 | #else | ||
| 93 | #define MAX_UDELAY_MS (1000 / HZ) | ||
| 94 | #endif | ||
| 95 | |||
| 87 | #endif /* _ASM_DELAY_H */ | 96 | #endif /* _ASM_DELAY_H */ |
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index 7420f12742bb..d2c9a25f8459 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h | |||
| @@ -275,6 +275,8 @@ do { \ | |||
| 275 | 275 | ||
| 276 | #endif /* CONFIG_64BIT */ | 276 | #endif /* CONFIG_64BIT */ |
| 277 | 277 | ||
| 278 | struct task_struct; | ||
| 279 | |||
| 278 | extern void dump_regs(elf_greg_t *, struct pt_regs *regs); | 280 | extern void dump_regs(elf_greg_t *, struct pt_regs *regs); |
| 279 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); | 281 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); |
| 280 | extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); | 282 | extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); |
diff --git a/include/asm-mips/errno.h b/include/asm-mips/errno.h index 9d3e6e7cdb92..3c0d840e4577 100644 --- a/include/asm-mips/errno.h +++ b/include/asm-mips/errno.h | |||
| @@ -119,10 +119,6 @@ | |||
| 119 | #define EOWNERDEAD 165 /* Owner died */ | 119 | #define EOWNERDEAD 165 /* Owner died */ |
| 120 | #define ENOTRECOVERABLE 166 /* State not recoverable */ | 120 | #define ENOTRECOVERABLE 166 /* State not recoverable */ |
| 121 | 121 | ||
| 122 | /* for robust mutexes */ | ||
| 123 | #define EOWNERDEAD 165 /* Owner died */ | ||
| 124 | #define ENOTRECOVERABLE 166 /* State not recoverable */ | ||
| 125 | |||
| 126 | #define EDQUOT 1133 /* Quota exceeded */ | 122 | #define EDQUOT 1133 /* Quota exceeded */ |
| 127 | 123 | ||
| 128 | #ifdef __KERNEL__ | 124 | #ifdef __KERNEL__ |
diff --git a/include/asm-mips/ip32/mace.h b/include/asm-mips/ip32/mace.h index 432011b16c26..5bdc51d85b6c 100644 --- a/include/asm-mips/ip32/mace.h +++ b/include/asm-mips/ip32/mace.h | |||
| @@ -147,6 +147,29 @@ struct mace_audio { | |||
| 147 | } chan[3]; | 147 | } chan[3]; |
| 148 | }; | 148 | }; |
| 149 | 149 | ||
| 150 | |||
| 151 | /* register definitions for parallel port DMA */ | ||
| 152 | struct mace_parport { | ||
| 153 | /* 0 - do nothing, 1 - pulse terminal count to the device after buffer is drained */ | ||
| 154 | #define MACEPAR_CONTEXT_LASTFLAG BIT(63) | ||
| 155 | /* Should not cross 4K page boundary */ | ||
| 156 | #define MACEPAR_CONTEXT_DATALEN_MASK 0xfff00000000 | ||
| 157 | /* Can be arbitrarily aligned on any byte boundary on output, 64 byte aligned on input */ | ||
| 158 | #define MACEPAR_CONTEXT_BASEADDR_MASK 0xffffffff | ||
| 159 | volatile u64 context_a; | ||
| 160 | volatile u64 context_b; | ||
| 161 | #define MACEPAR_CTLSTAT_DIRECTION BIT(0) /* 0 - mem->device, 1 - device->mem */ | ||
| 162 | #define MACEPAR_CTLSTAT_ENABLE BIT(1) /* 0 - channel frozen, 1 - channel enabled */ | ||
| 163 | #define MACEPAR_CTLSTAT_RESET BIT(2) /* 0 - channel active, 1 - complete channel reset */ | ||
| 164 | #define MACEPAR_CTLSTAT_CTXB_VALID BIT(3) | ||
| 165 | #define MACEPAR_CTLSTAT_CTXA_VALID BIT(4) | ||
| 166 | volatile u64 cntlstat; /* Control/Status register */ | ||
| 167 | #define MACEPAR_DIAG_CTXINUSE BIT(1) | ||
| 168 | #define MACEPAR_DIAG_DMACTIVE BIT(2) /* 1 - Dma engine is enabled and processing something */ | ||
| 169 | #define MACEPAR_DIAG_CTRMASK 0x3ffc /* Counter of bytes left */ | ||
| 170 | volatile u64 diagnostic; /* RO: diagnostic register */ | ||
| 171 | }; | ||
| 172 | |||
| 150 | /* ISA Control and DMA registers */ | 173 | /* ISA Control and DMA registers */ |
| 151 | struct mace_isactrl { | 174 | struct mace_isactrl { |
| 152 | volatile unsigned long ringbase; | 175 | volatile unsigned long ringbase; |
| @@ -199,6 +222,7 @@ struct mace_isactrl { | |||
| 199 | volatile unsigned long _pad[0x2000/8 - 4]; | 222 | volatile unsigned long _pad[0x2000/8 - 4]; |
| 200 | 223 | ||
| 201 | volatile unsigned long dp_ram[0x400]; | 224 | volatile unsigned long dp_ram[0x400]; |
| 225 | struct mace_parport parport; | ||
| 202 | }; | 226 | }; |
| 203 | 227 | ||
| 204 | /* Keyboard & Mouse registers | 228 | /* Keyboard & Mouse registers |
| @@ -277,7 +301,7 @@ struct mace_perif { | |||
| 277 | */ | 301 | */ |
| 278 | 302 | ||
| 279 | /* Parallel port */ | 303 | /* Parallel port */ |
| 280 | struct mace_parallel { /* later... */ | 304 | struct mace_parallel { |
| 281 | }; | 305 | }; |
| 282 | 306 | ||
| 283 | struct mace_ecp1284 { /* later... */ | 307 | struct mace_ecp1284 { /* later... */ |
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h index 961006948c7c..550979a9ea9d 100644 --- a/include/asm-mips/mach-generic/ide.h +++ b/include/asm-mips/mach-generic/ide.h | |||
| @@ -168,8 +168,12 @@ static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count) | |||
| 168 | /* ide_insw calls insw, not __ide_insw. Why? */ | 168 | /* ide_insw calls insw, not __ide_insw. Why? */ |
| 169 | #undef insw | 169 | #undef insw |
| 170 | #undef insl | 170 | #undef insl |
| 171 | #undef outsw | ||
| 172 | #undef outsl | ||
| 171 | #define insw(port, addr, count) __ide_insw(port, addr, count) | 173 | #define insw(port, addr, count) __ide_insw(port, addr, count) |
| 172 | #define insl(port, addr, count) __ide_insl(port, addr, count) | 174 | #define insl(port, addr, count) __ide_insl(port, addr, count) |
| 175 | #define outsw(port, addr, count) __ide_outsw(port, addr, count) | ||
| 176 | #define outsl(port, addr, count) __ide_outsl(port, addr, count) | ||
| 173 | 177 | ||
| 174 | #endif /* __KERNEL__ */ | 178 | #endif /* __KERNEL__ */ |
| 175 | 179 | ||
diff --git a/include/asm-mips/mc146818-time.h b/include/asm-mips/mc146818-time.h index a2c2d2c24303..47214861093b 100644 --- a/include/asm-mips/mc146818-time.h +++ b/include/asm-mips/mc146818-time.h | |||
| @@ -33,7 +33,9 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime) | |||
| 33 | int real_seconds, real_minutes, cmos_minutes; | 33 | int real_seconds, real_minutes, cmos_minutes; |
| 34 | unsigned char save_control, save_freq_select; | 34 | unsigned char save_control, save_freq_select; |
| 35 | int retval = 0; | 35 | int retval = 0; |
| 36 | unsigned long flags; | ||
| 36 | 37 | ||
| 38 | spin_lock_irqsave(&rtc_lock, flags); | ||
| 37 | save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ | 39 | save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ |
| 38 | CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); | 40 | CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); |
| 39 | 41 | ||
| @@ -79,14 +81,30 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime) | |||
| 79 | */ | 81 | */ |
| 80 | CMOS_WRITE(save_control, RTC_CONTROL); | 82 | CMOS_WRITE(save_control, RTC_CONTROL); |
| 81 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); | 83 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); |
| 84 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
| 82 | 85 | ||
| 83 | return retval; | 86 | return retval; |
| 84 | } | 87 | } |
| 85 | 88 | ||
| 89 | /* | ||
| 90 | * Returns true if a clock update is in progress | ||
| 91 | */ | ||
| 92 | static inline unsigned char rtc_is_updating(void) | ||
| 93 | { | ||
| 94 | unsigned char uip; | ||
| 95 | unsigned long flags; | ||
| 96 | |||
| 97 | spin_lock_irqsave(&rtc_lock, flags); | ||
| 98 | uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); | ||
| 99 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
| 100 | return uip; | ||
| 101 | } | ||
| 102 | |||
| 86 | static inline unsigned long mc146818_get_cmos_time(void) | 103 | static inline unsigned long mc146818_get_cmos_time(void) |
| 87 | { | 104 | { |
| 88 | unsigned int year, mon, day, hour, min, sec; | 105 | unsigned int year, mon, day, hour, min, sec; |
| 89 | int i; | 106 | int i; |
| 107 | unsigned long flags; | ||
| 90 | 108 | ||
| 91 | /* | 109 | /* |
| 92 | * The Linux interpretation of the CMOS clock register contents: | 110 | * The Linux interpretation of the CMOS clock register contents: |
| @@ -97,12 +115,13 @@ static inline unsigned long mc146818_get_cmos_time(void) | |||
| 97 | 115 | ||
| 98 | /* read RTC exactly on falling edge of update flag */ | 116 | /* read RTC exactly on falling edge of update flag */ |
| 99 | for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ | 117 | for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ |
| 100 | if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) | 118 | if (rtc_is_updating()) |
| 101 | break; | 119 | break; |
| 102 | for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ | 120 | for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ |
| 103 | if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) | 121 | if (!rtc_is_updating()) |
| 104 | break; | 122 | break; |
| 105 | 123 | ||
| 124 | spin_lock_irqsave(&rtc_lock, flags); | ||
| 106 | do { /* Isn't this overkill ? UIP above should guarantee consistency */ | 125 | do { /* Isn't this overkill ? UIP above should guarantee consistency */ |
| 107 | sec = CMOS_READ(RTC_SECONDS); | 126 | sec = CMOS_READ(RTC_SECONDS); |
| 108 | min = CMOS_READ(RTC_MINUTES); | 127 | min = CMOS_READ(RTC_MINUTES); |
| @@ -120,6 +139,7 @@ static inline unsigned long mc146818_get_cmos_time(void) | |||
| 120 | BCD_TO_BIN(mon); | 139 | BCD_TO_BIN(mon); |
| 121 | BCD_TO_BIN(year); | 140 | BCD_TO_BIN(year); |
| 122 | } | 141 | } |
| 142 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
| 123 | year = mc146818_decode_year(year); | 143 | year = mc146818_decode_year(year); |
| 124 | 144 | ||
| 125 | return mktime(year, mon, day, hour, min, sec); | 145 | return mktime(year, mon, day, hour, min, sec); |
diff --git a/include/asm-mips/module.h b/include/asm-mips/module.h index 2be399311eec..2af496c78c12 100644 --- a/include/asm-mips/module.h +++ b/include/asm-mips/module.h | |||
| @@ -76,43 +76,43 @@ search_module_dbetables(unsigned long addr) | |||
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | #ifdef CONFIG_CPU_MIPS32_R1 | 78 | #ifdef CONFIG_CPU_MIPS32_R1 |
| 79 | #define MODULE_PROC_FAMILY "MIPS32_R1" | 79 | #define MODULE_PROC_FAMILY "MIPS32_R1 " |
| 80 | #elif defined CONFIG_CPU_MIPS32_R2 | 80 | #elif defined CONFIG_CPU_MIPS32_R2 |
| 81 | #define MODULE_PROC_FAMILY "MIPS32_R2" | 81 | #define MODULE_PROC_FAMILY "MIPS32_R2 " |
| 82 | #elif defined CONFIG_CPU_MIPS64_R1 | 82 | #elif defined CONFIG_CPU_MIPS64_R1 |
| 83 | #define MODULE_PROC_FAMILY "MIPS64_R1" | 83 | #define MODULE_PROC_FAMILY "MIPS64_R1 " |
| 84 | #elif defined CONFIG_CPU_MIPS64_R2 | 84 | #elif defined CONFIG_CPU_MIPS64_R2 |
| 85 | #define MODULE_PROC_FAMILY "MIPS64_R2" | 85 | #define MODULE_PROC_FAMILY "MIPS64_R2 " |
| 86 | #elif defined CONFIG_CPU_R3000 | 86 | #elif defined CONFIG_CPU_R3000 |
| 87 | #define MODULE_PROC_FAMILY "R3000" | 87 | #define MODULE_PROC_FAMILY "R3000 " |
| 88 | #elif defined CONFIG_CPU_TX39XX | 88 | #elif defined CONFIG_CPU_TX39XX |
| 89 | #define MODULE_PROC_FAMILY "TX39XX" | 89 | #define MODULE_PROC_FAMILY "TX39XX " |
| 90 | #elif defined CONFIG_CPU_VR41XX | 90 | #elif defined CONFIG_CPU_VR41XX |
| 91 | #define MODULE_PROC_FAMILY "VR41XX" | 91 | #define MODULE_PROC_FAMILY "VR41XX " |
| 92 | #elif defined CONFIG_CPU_R4300 | 92 | #elif defined CONFIG_CPU_R4300 |
| 93 | #define MODULE_PROC_FAMILY "R4300" | 93 | #define MODULE_PROC_FAMILY "R4300 " |
| 94 | #elif defined CONFIG_CPU_R4X00 | 94 | #elif defined CONFIG_CPU_R4X00 |
| 95 | #define MODULE_PROC_FAMILY "R4X00" | 95 | #define MODULE_PROC_FAMILY "R4X00 " |
| 96 | #elif defined CONFIG_CPU_TX49XX | 96 | #elif defined CONFIG_CPU_TX49XX |
| 97 | #define MODULE_PROC_FAMILY "TX49XX" | 97 | #define MODULE_PROC_FAMILY "TX49XX " |
| 98 | #elif defined CONFIG_CPU_R5000 | 98 | #elif defined CONFIG_CPU_R5000 |
| 99 | #define MODULE_PROC_FAMILY "R5000" | 99 | #define MODULE_PROC_FAMILY "R5000 " |
| 100 | #elif defined CONFIG_CPU_R5432 | 100 | #elif defined CONFIG_CPU_R5432 |
| 101 | #define MODULE_PROC_FAMILY "R5432" | 101 | #define MODULE_PROC_FAMILY "R5432 " |
| 102 | #elif defined CONFIG_CPU_R6000 | 102 | #elif defined CONFIG_CPU_R6000 |
| 103 | #define MODULE_PROC_FAMILY "R6000" | 103 | #define MODULE_PROC_FAMILY "R6000 " |
| 104 | #elif defined CONFIG_CPU_NEVADA | 104 | #elif defined CONFIG_CPU_NEVADA |
| 105 | #define MODULE_PROC_FAMILY "NEVADA" | 105 | #define MODULE_PROC_FAMILY "NEVADA " |
| 106 | #elif defined CONFIG_CPU_R8000 | 106 | #elif defined CONFIG_CPU_R8000 |
| 107 | #define MODULE_PROC_FAMILY "R8000" | 107 | #define MODULE_PROC_FAMILY "R8000 " |
| 108 | #elif defined CONFIG_CPU_R10000 | 108 | #elif defined CONFIG_CPU_R10000 |
| 109 | #define MODULE_PROC_FAMILY "R10000" | 109 | #define MODULE_PROC_FAMILY "R10000 " |
| 110 | #elif defined CONFIG_CPU_RM7000 | 110 | #elif defined CONFIG_CPU_RM7000 |
| 111 | #define MODULE_PROC_FAMILY "RM7000" | 111 | #define MODULE_PROC_FAMILY "RM7000 " |
| 112 | #elif defined CONFIG_CPU_RM9000 | 112 | #elif defined CONFIG_CPU_RM9000 |
| 113 | #define MODULE_PROC_FAMILY "RM9000" | 113 | #define MODULE_PROC_FAMILY "RM9000 " |
| 114 | #elif defined CONFIG_CPU_SB1 | 114 | #elif defined CONFIG_CPU_SB1 |
| 115 | #define MODULE_PROC_FAMILY "SB1" | 115 | #define MODULE_PROC_FAMILY "SB1 " |
| 116 | #else | 116 | #else |
| 117 | #error MODULE_PROC_FAMILY undefined for your processor configuration | 117 | #error MODULE_PROC_FAMILY undefined for your processor configuration |
| 118 | #endif | 118 | #endif |
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 34facd996503..702a28fa7a34 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
| @@ -19,6 +19,9 @@ | |||
| 19 | #include <asm/io.h> | 19 | #include <asm/io.h> |
| 20 | #include <asm/pgtable-bits.h> | 20 | #include <asm/pgtable-bits.h> |
| 21 | 21 | ||
| 22 | struct mm_struct; | ||
| 23 | struct vm_area_struct; | ||
| 24 | |||
| 22 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) | 25 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) |
| 23 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ | 26 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ |
| 24 | PAGE_CACHABLE_DEFAULT) | 27 | PAGE_CACHABLE_DEFAULT) |
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h index a60e0dc7c9b9..a2abc4572b63 100644 --- a/include/asm-mips/rtc.h +++ b/include/asm-mips/rtc.h | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | 14 | ||
| 15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
| 16 | 16 | ||
| 17 | #include <linux/spinlock.h> | ||
| 18 | #include <linux/rtc.h> | 17 | #include <linux/rtc.h> |
| 19 | #include <asm/time.h> | 18 | #include <asm/time.h> |
| 20 | 19 | ||
| @@ -29,17 +28,13 @@ | |||
| 29 | #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ | 28 | #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ |
| 30 | #define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ | 29 | #define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ |
| 31 | 30 | ||
| 32 | static DEFINE_SPINLOCK(mips_rtc_lock); | ||
| 33 | |||
| 34 | static inline unsigned int get_rtc_time(struct rtc_time *time) | 31 | static inline unsigned int get_rtc_time(struct rtc_time *time) |
| 35 | { | 32 | { |
| 36 | unsigned long nowtime; | 33 | unsigned long nowtime; |
| 37 | 34 | ||
| 38 | spin_lock(&mips_rtc_lock); | ||
| 39 | nowtime = rtc_get_time(); | 35 | nowtime = rtc_get_time(); |
| 40 | to_tm(nowtime, time); | 36 | to_tm(nowtime, time); |
| 41 | time->tm_year -= 1900; | 37 | time->tm_year -= 1900; |
| 42 | spin_unlock(&mips_rtc_lock); | ||
| 43 | 38 | ||
| 44 | return RTC_24H; | 39 | return RTC_24H; |
| 45 | } | 40 | } |
| @@ -49,12 +44,10 @@ static inline int set_rtc_time(struct rtc_time *time) | |||
| 49 | unsigned long nowtime; | 44 | unsigned long nowtime; |
| 50 | int ret; | 45 | int ret; |
| 51 | 46 | ||
| 52 | spin_lock(&mips_rtc_lock); | ||
| 53 | nowtime = mktime(time->tm_year+1900, time->tm_mon+1, | 47 | nowtime = mktime(time->tm_year+1900, time->tm_mon+1, |
| 54 | time->tm_mday, time->tm_hour, time->tm_min, | 48 | time->tm_mday, time->tm_hour, time->tm_min, |
| 55 | time->tm_sec); | 49 | time->tm_sec); |
| 56 | ret = rtc_set_time(nowtime); | 50 | ret = rtc_set_time(nowtime); |
| 57 | spin_unlock(&mips_rtc_lock); | ||
| 58 | 51 | ||
| 59 | return ret; | 52 | return ret; |
| 60 | } | 53 | } |
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h index 83cdf6ab0d1f..1298c3fdf6c9 100644 --- a/include/asm-mips/rtlx.h +++ b/include/asm-mips/rtlx.h | |||
| @@ -16,21 +16,19 @@ | |||
| 16 | #define RTLX_ID (RTLX_xID | RTLX_VERSION) | 16 | #define RTLX_ID (RTLX_xID | RTLX_VERSION) |
| 17 | #define RTLX_CHANNELS 8 | 17 | #define RTLX_CHANNELS 8 |
| 18 | 18 | ||
| 19 | enum rtlx_state { | ||
| 20 | RTLX_STATE_UNUSED = 0, | ||
| 21 | RTLX_STATE_INITIALISED, | ||
| 22 | RTLX_STATE_REMOTE_READY, | ||
| 23 | RTLX_STATE_OPENED | ||
| 24 | }; | ||
| 25 | |||
| 26 | #define RTLX_BUFFER_SIZE 1024 | 19 | #define RTLX_BUFFER_SIZE 1024 |
| 20 | |||
| 21 | /* | ||
| 22 | * lx_state bits | ||
| 23 | */ | ||
| 24 | #define RTLX_STATE_OPENED 1UL | ||
| 25 | |||
| 27 | /* each channel supports read and write. | 26 | /* each channel supports read and write. |
| 28 | linux (vpe0) reads lx_buffer and writes rt_buffer | 27 | linux (vpe0) reads lx_buffer and writes rt_buffer |
| 29 | SP (vpe1) reads rt_buffer and writes lx_buffer | 28 | SP (vpe1) reads rt_buffer and writes lx_buffer |
| 30 | */ | 29 | */ |
| 31 | typedef struct rtlx_channel { | 30 | struct rtlx_channel { |
| 32 | enum rtlx_state rt_state; | 31 | unsigned long lx_state; |
| 33 | enum rtlx_state lx_state; | ||
| 34 | 32 | ||
| 35 | int buffer_size; | 33 | int buffer_size; |
| 36 | 34 | ||
| @@ -43,14 +41,12 @@ typedef struct rtlx_channel { | |||
| 43 | 41 | ||
| 44 | void *queues; | 42 | void *queues; |
| 45 | 43 | ||
| 46 | } rtlx_channel_t; | 44 | }; |
| 47 | 45 | ||
| 48 | typedef struct rtlx_info { | 46 | struct rtlx_info { |
| 49 | unsigned long id; | 47 | unsigned long id; |
| 50 | enum rtlx_state state; | ||
| 51 | 48 | ||
| 52 | struct rtlx_channel channel[RTLX_CHANNELS]; | 49 | struct rtlx_channel channel[RTLX_CHANNELS]; |
| 50 | }; | ||
| 53 | 51 | ||
| 54 | } rtlx_info_t; | 52 | #endif /* _RTLX_H_ */ |
| 55 | |||
| 56 | #endif | ||
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h index e22a20665871..9cc3564cc2c9 100644 --- a/include/asm-mips/time.h +++ b/include/asm-mips/time.h | |||
| @@ -20,6 +20,9 @@ | |||
| 20 | #include <linux/linkage.h> | 20 | #include <linux/linkage.h> |
| 21 | #include <linux/ptrace.h> | 21 | #include <linux/ptrace.h> |
| 22 | #include <linux/rtc.h> | 22 | #include <linux/rtc.h> |
| 23 | #include <linux/spinlock.h> | ||
| 24 | |||
| 25 | extern spinlock_t rtc_lock; | ||
| 23 | 26 | ||
| 24 | /* | 27 | /* |
| 25 | * RTC ops. By default, they point to no-RTC functions. | 28 | * RTC ops. By default, they point to no-RTC functions. |
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h index c28fb6f48c6c..b4554711c3e7 100644 --- a/include/asm-parisc/pgtable.h +++ b/include/asm-parisc/pgtable.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
| 15 | #include <linux/mm.h> /* for vm_area_struct */ | ||
| 15 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
| 16 | #include <asm/cache.h> | 17 | #include <asm/cache.h> |
| 17 | #include <asm/bitops.h> | 18 | #include <asm/bitops.h> |
| @@ -418,7 +419,6 @@ extern void paging_init (void); | |||
| 418 | 419 | ||
| 419 | #define PG_dcache_dirty PG_arch_1 | 420 | #define PG_dcache_dirty PG_arch_1 |
| 420 | 421 | ||
| 421 | struct vm_area_struct; /* forward declaration (include/linux/mm.h) */ | ||
| 422 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | 422 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); |
| 423 | 423 | ||
| 424 | /* Encode and de-code a swap entry */ | 424 | /* Encode and de-code a swap entry */ |
| @@ -464,6 +464,7 @@ static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned | |||
| 464 | 464 | ||
| 465 | extern spinlock_t pa_dbit_lock; | 465 | extern spinlock_t pa_dbit_lock; |
| 466 | 466 | ||
| 467 | struct mm_struct; | ||
| 467 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 468 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
| 468 | { | 469 | { |
| 469 | pte_t old_pte; | 470 | pte_t old_pte; |
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index c019501daceb..79a0556a0ab8 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h | |||
| @@ -101,6 +101,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); | |||
| 101 | #define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) | 101 | #define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) |
| 102 | #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) | 102 | #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) |
| 103 | #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) | 103 | #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) |
| 104 | #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) | ||
| 104 | #else | 105 | #else |
| 105 | /* ensure on 32b processors the flags are available for compiling but | 106 | /* ensure on 32b processors the flags are available for compiling but |
| 106 | * don't do anything */ | 107 | * don't do anything */ |
| @@ -116,6 +117,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); | |||
| 116 | #define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0) | 117 | #define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0) |
| 117 | #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) | 118 | #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) |
| 118 | #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0) | 119 | #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0) |
| 120 | #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0) | ||
| 119 | #endif | 121 | #endif |
| 120 | 122 | ||
| 121 | #ifndef __ASSEMBLY__ | 123 | #ifndef __ASSEMBLY__ |
| @@ -339,6 +341,7 @@ enum { | |||
| 339 | #ifdef __powerpc64__ | 341 | #ifdef __powerpc64__ |
| 340 | CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | | 342 | CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | |
| 341 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | | 343 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | |
| 344 | CPU_FTR_CI_LARGE_PAGE | | ||
| 342 | #endif | 345 | #endif |
| 343 | 0, | 346 | 0, |
| 344 | 347 | ||
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h index d140577d0a05..feac3458d71f 100644 --- a/include/asm-powerpc/elf.h +++ b/include/asm-powerpc/elf.h | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | #ifndef _ASM_POWERPC_ELF_H | 1 | #ifndef _ASM_POWERPC_ELF_H |
| 2 | #define _ASM_POWERPC_ELF_H | 2 | #define _ASM_POWERPC_ELF_H |
| 3 | 3 | ||
| 4 | #include <linux/sched.h> /* for task_struct */ | ||
| 4 | #include <asm/types.h> | 5 | #include <asm/types.h> |
| 5 | #include <asm/ptrace.h> | 6 | #include <asm/ptrace.h> |
| 6 | #include <asm/cputable.h> | 7 | #include <asm/cputable.h> |
| 7 | #include <asm/auxvec.h> | 8 | #include <asm/auxvec.h> |
| 8 | #include <asm/page.h> | 9 | #include <asm/page.h> |
| 10 | #include <asm/string.h> | ||
| 9 | 11 | ||
| 10 | /* PowerPC relocations defined by the ABIs */ | 12 | /* PowerPC relocations defined by the ABIs */ |
| 11 | #define R_PPC_NONE 0 | 13 | #define R_PPC_NONE 0 |
diff --git a/include/asm-ppc/ide.h b/include/asm-powerpc/ide.h index 7d6e6599fac4..da5f640480cf 100644 --- a/include/asm-ppc/ide.h +++ b/include/asm-powerpc/ide.h | |||
| @@ -1,24 +1,27 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/include/asm-ppc/ide.h | 2 | * Copyright (C) 1994-1996 Linus Torvalds & authors |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1994-1996 Linus Torvalds & authors */ | 4 | * This file contains the powerpc architecture specific IDE code. |
| 5 | |||
| 6 | /* | ||
| 7 | * This file contains the ppc architecture specific IDE code. | ||
| 8 | */ | 5 | */ |
| 9 | 6 | #ifndef _ASM_POWERPC_IDE_H | |
| 10 | #ifndef __ASMPPC_IDE_H | 7 | #define _ASM_POWERPC_IDE_H |
| 11 | #define __ASMPPC_IDE_H | ||
| 12 | 8 | ||
| 13 | #ifdef __KERNEL__ | 9 | #ifdef __KERNEL__ |
| 14 | 10 | ||
| 11 | #ifndef __powerpc64__ | ||
| 15 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
| 16 | #include <asm/mpc8xx.h> | 13 | #include <asm/mpc8xx.h> |
| 14 | #endif | ||
| 17 | 15 | ||
| 18 | #ifndef MAX_HWIFS | 16 | #ifndef MAX_HWIFS |
| 17 | #ifdef __powerpc64__ | ||
| 18 | #define MAX_HWIFS 10 | ||
| 19 | #else | ||
| 19 | #define MAX_HWIFS 8 | 20 | #define MAX_HWIFS 8 |
| 20 | #endif | 21 | #endif |
| 22 | #endif | ||
| 21 | 23 | ||
| 24 | #ifndef __powerpc64__ | ||
| 22 | #include <linux/config.h> | 25 | #include <linux/config.h> |
| 23 | #include <linux/hdreg.h> | 26 | #include <linux/hdreg.h> |
| 24 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
| @@ -59,9 +62,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 59 | return 0; | 62 | return 0; |
| 60 | } | 63 | } |
| 61 | 64 | ||
| 62 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 63 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 64 | |||
| 65 | #ifdef CONFIG_PCI | 65 | #ifdef CONFIG_PCI |
| 66 | #define ide_init_default_irq(base) (0) | 66 | #define ide_init_default_irq(base) (0) |
| 67 | #else | 67 | #else |
| @@ -73,6 +73,11 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 73 | #define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) | 73 | #define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) |
| 74 | #endif | 74 | #endif |
| 75 | 75 | ||
| 76 | #endif /* __powerpc64__ */ | ||
| 77 | |||
| 78 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 79 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 80 | |||
| 76 | #endif /* __KERNEL__ */ | 81 | #endif /* __KERNEL__ */ |
| 77 | 82 | ||
| 78 | #endif /* __ASMPPC_IDE_H */ | 83 | #endif /* _ASM_POWERPC_IDE_H */ |
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h index 9d91bdd667ae..6a35e6570ccd 100644 --- a/include/asm-powerpc/iommu.h +++ b/include/asm-powerpc/iommu.h | |||
| @@ -74,6 +74,11 @@ extern void iommu_devnode_init_pSeries(struct device_node *dn); | |||
| 74 | 74 | ||
| 75 | /* Creates table for an individual device node */ | 75 | /* Creates table for an individual device node */ |
| 76 | extern void iommu_devnode_init_iSeries(struct device_node *dn); | 76 | extern void iommu_devnode_init_iSeries(struct device_node *dn); |
| 77 | /* Get table parameters from HV */ | ||
| 78 | extern void iommu_table_getparms_iSeries(unsigned long busno, | ||
| 79 | unsigned char slotno, | ||
| 80 | unsigned char virtbus, | ||
| 81 | struct iommu_table* tbl); | ||
| 77 | 82 | ||
| 78 | #endif /* CONFIG_PPC_ISERIES */ | 83 | #endif /* CONFIG_PPC_ISERIES */ |
| 79 | 84 | ||
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h index b2f09f17fbe0..6cd0a3bfa280 100644 --- a/include/asm-powerpc/kprobes.h +++ b/include/asm-powerpc/kprobes.h | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | */ | 27 | */ |
| 28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
| 29 | #include <linux/ptrace.h> | 29 | #include <linux/ptrace.h> |
| 30 | #include <linux/percpu.h> | ||
| 30 | 31 | ||
| 31 | struct pt_regs; | 32 | struct pt_regs; |
| 32 | 33 | ||
| @@ -53,6 +54,20 @@ struct arch_specific_insn { | |||
| 53 | kprobe_opcode_t *insn; | 54 | kprobe_opcode_t *insn; |
| 54 | }; | 55 | }; |
| 55 | 56 | ||
| 57 | struct prev_kprobe { | ||
| 58 | struct kprobe *kp; | ||
| 59 | unsigned long status; | ||
| 60 | unsigned long saved_msr; | ||
| 61 | }; | ||
| 62 | |||
| 63 | /* per-cpu kprobe control block */ | ||
| 64 | struct kprobe_ctlblk { | ||
| 65 | unsigned long kprobe_status; | ||
| 66 | unsigned long kprobe_saved_msr; | ||
| 67 | struct pt_regs jprobe_saved_regs; | ||
| 68 | struct prev_kprobe prev_kprobe; | ||
| 69 | }; | ||
| 70 | |||
| 56 | #ifdef CONFIG_KPROBES | 71 | #ifdef CONFIG_KPROBES |
| 57 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 72 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
| 58 | unsigned long val, void *data); | 73 | unsigned long val, void *data); |
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index 629ca964b974..5670f0cd6143 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h | |||
| @@ -47,20 +47,22 @@ struct machdep_calls { | |||
| 47 | #ifdef CONFIG_PPC64 | 47 | #ifdef CONFIG_PPC64 |
| 48 | void (*hpte_invalidate)(unsigned long slot, | 48 | void (*hpte_invalidate)(unsigned long slot, |
| 49 | unsigned long va, | 49 | unsigned long va, |
| 50 | int large, | 50 | int psize, |
| 51 | int local); | 51 | int local); |
| 52 | long (*hpte_updatepp)(unsigned long slot, | 52 | long (*hpte_updatepp)(unsigned long slot, |
| 53 | unsigned long newpp, | 53 | unsigned long newpp, |
| 54 | unsigned long va, | 54 | unsigned long va, |
| 55 | int large, | 55 | int pize, |
| 56 | int local); | 56 | int local); |
| 57 | void (*hpte_updateboltedpp)(unsigned long newpp, | 57 | void (*hpte_updateboltedpp)(unsigned long newpp, |
| 58 | unsigned long ea); | 58 | unsigned long ea, |
| 59 | int psize); | ||
| 59 | long (*hpte_insert)(unsigned long hpte_group, | 60 | long (*hpte_insert)(unsigned long hpte_group, |
| 60 | unsigned long va, | 61 | unsigned long va, |
| 61 | unsigned long prpn, | 62 | unsigned long prpn, |
| 63 | unsigned long rflags, | ||
| 62 | unsigned long vflags, | 64 | unsigned long vflags, |
| 63 | unsigned long rflags); | 65 | int psize); |
| 64 | long (*hpte_remove)(unsigned long hpte_group); | 66 | long (*hpte_remove)(unsigned long hpte_group); |
| 65 | void (*flush_hash_range)(unsigned long number, int local); | 67 | void (*flush_hash_range)(unsigned long number, int local); |
| 66 | 68 | ||
| @@ -80,7 +82,6 @@ struct machdep_calls { | |||
| 80 | void (*iommu_dev_setup)(struct pci_dev *dev); | 82 | void (*iommu_dev_setup)(struct pci_dev *dev); |
| 81 | void (*iommu_bus_setup)(struct pci_bus *bus); | 83 | void (*iommu_bus_setup)(struct pci_bus *bus); |
| 82 | void (*irq_bus_setup)(struct pci_bus *bus); | 84 | void (*irq_bus_setup)(struct pci_bus *bus); |
| 83 | int (*set_dabr)(unsigned long dabr); | ||
| 84 | #endif | 85 | #endif |
| 85 | 86 | ||
| 86 | int (*probe)(int platform); | 87 | int (*probe)(int platform); |
| @@ -156,6 +157,9 @@ struct machdep_calls { | |||
| 156 | platform, called once per cpu. */ | 157 | platform, called once per cpu. */ |
| 157 | void (*enable_pmcs)(void); | 158 | void (*enable_pmcs)(void); |
| 158 | 159 | ||
| 160 | /* Set DABR for this platform, leave empty for default implemenation */ | ||
| 161 | int (*set_dabr)(unsigned long dabr); | ||
| 162 | |||
| 159 | #ifdef CONFIG_PPC32 /* XXX for now */ | 163 | #ifdef CONFIG_PPC32 /* XXX for now */ |
| 160 | /* A general init function, called by ppc_init in init/main.c. | 164 | /* A general init function, called by ppc_init in init/main.c. |
| 161 | May be NULL. */ | 165 | May be NULL. */ |
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h index 2f3c3fc2b796..5f41f3a2b293 100644 --- a/include/asm-powerpc/pmc.h +++ b/include/asm-powerpc/pmc.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <asm/ptrace.h> | 22 | #include <asm/ptrace.h> |
| 23 | 23 | ||
| 24 | typedef void (*perf_irq_t)(struct pt_regs *); | 24 | typedef void (*perf_irq_t)(struct pt_regs *); |
| 25 | extern perf_irq_t perf_irq; | ||
| 25 | 26 | ||
| 26 | int reserve_pmc_hardware(perf_irq_t new_perf_irq); | 27 | int reserve_pmc_hardware(perf_irq_t new_perf_irq); |
| 27 | void release_pmc_hardware(void); | 28 | void release_pmc_hardware(void); |
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index a88728fba8f6..13aacff755f3 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h | |||
| @@ -34,6 +34,7 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre, | |||
| 34 | 34 | ||
| 35 | void pci_devs_phb_init(void); | 35 | void pci_devs_phb_init(void); |
| 36 | void pci_devs_phb_init_dynamic(struct pci_controller *phb); | 36 | void pci_devs_phb_init_dynamic(struct pci_controller *phb); |
| 37 | void __devinit scan_phb(struct pci_controller *hose); | ||
| 37 | 38 | ||
| 38 | /* PCI address cache management routines */ | 39 | /* PCI address cache management routines */ |
| 39 | void pci_addr_cache_insert_device(struct pci_dev *dev); | 40 | void pci_addr_cache_insert_device(struct pci_dev *dev); |
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index 3a0104fa0462..f999df1c5c90 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
| @@ -178,6 +178,14 @@ extern struct device_node *of_get_next_child(const struct device_node *node, | |||
| 178 | extern struct device_node *of_node_get(struct device_node *node); | 178 | extern struct device_node *of_node_get(struct device_node *node); |
| 179 | extern void of_node_put(struct device_node *node); | 179 | extern void of_node_put(struct device_node *node); |
| 180 | 180 | ||
| 181 | /* For scanning the flat device-tree at boot time */ | ||
| 182 | int __init of_scan_flat_dt(int (*it)(unsigned long node, | ||
| 183 | const char *uname, int depth, | ||
| 184 | void *data), | ||
| 185 | void *data); | ||
| 186 | void* __init of_get_flat_dt_prop(unsigned long node, const char *name, | ||
| 187 | unsigned long *size); | ||
| 188 | |||
| 181 | /* For updating the device tree at runtime */ | 189 | /* For updating the device tree at runtime */ |
| 182 | extern void of_attach_node(struct device_node *); | 190 | extern void of_attach_node(struct device_node *); |
| 183 | extern void of_detach_node(const struct device_node *); | 191 | extern void of_detach_node(const struct device_node *); |
| @@ -195,7 +203,7 @@ extern int prom_n_addr_cells(struct device_node* np); | |||
| 195 | extern int prom_n_size_cells(struct device_node* np); | 203 | extern int prom_n_size_cells(struct device_node* np); |
| 196 | extern int prom_n_intr_cells(struct device_node* np); | 204 | extern int prom_n_intr_cells(struct device_node* np); |
| 197 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); | 205 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); |
| 198 | extern void prom_add_property(struct device_node* np, struct property* prop); | 206 | extern int prom_add_property(struct device_node* np, struct property* prop); |
| 199 | 207 | ||
| 200 | #ifdef CONFIG_PPC32 | 208 | #ifdef CONFIG_PPC32 |
| 201 | /* | 209 | /* |
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h index da848412f11b..489cf4c99c21 100644 --- a/include/asm-powerpc/reg.h +++ b/include/asm-powerpc/reg.h | |||
| @@ -396,6 +396,9 @@ | |||
| 396 | #define SPRN_VRSAVE 0x100 /* Vector Register Save Register */ | 396 | #define SPRN_VRSAVE 0x100 /* Vector Register Save Register */ |
| 397 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ | 397 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ |
| 398 | 398 | ||
| 399 | #define SPRN_SCOMC 0x114 /* SCOM Access Control */ | ||
| 400 | #define SPRN_SCOMD 0x115 /* SCOM Access DATA */ | ||
| 401 | |||
| 399 | /* Performance monitor SPRs */ | 402 | /* Performance monitor SPRs */ |
| 400 | #ifdef CONFIG_PPC64 | 403 | #ifdef CONFIG_PPC64 |
| 401 | #define SPRN_MMCR0 795 | 404 | #define SPRN_MMCR0 795 |
| @@ -594,7 +597,11 @@ static inline void ppc64_runlatch_off(void) | |||
| 594 | mtspr(SPRN_CTRLT, ctrl); | 597 | mtspr(SPRN_CTRLT, ctrl); |
| 595 | } | 598 | } |
| 596 | } | 599 | } |
| 597 | #endif | 600 | |
| 601 | extern unsigned long scom970_read(unsigned int address); | ||
| 602 | extern void scom970_write(unsigned int address, unsigned long value); | ||
| 603 | |||
| 604 | #endif /* CONFIG_PPC64 */ | ||
| 598 | 605 | ||
| 599 | #define __get_SP() ({unsigned long sp; \ | 606 | #define __get_SP() ({unsigned long sp; \ |
| 600 | asm volatile("mr %0,1": "=r" (sp)); sp;}) | 607 | asm volatile("mr %0,1": "=r" (sp)); sp;}) |
diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h index 8bcdd0faefea..98581e5a8279 100644 --- a/include/asm-powerpc/smp.h +++ b/include/asm-powerpc/smp.h | |||
| @@ -86,7 +86,6 @@ extern void __cpu_die(unsigned int cpu); | |||
| 86 | #else | 86 | #else |
| 87 | /* for UP */ | 87 | /* for UP */ |
| 88 | #define smp_setup_cpu_maps() | 88 | #define smp_setup_cpu_maps() |
| 89 | #define smp_release_cpus() | ||
| 90 | 89 | ||
| 91 | #endif /* CONFIG_SMP */ | 90 | #endif /* CONFIG_SMP */ |
| 92 | 91 | ||
| @@ -94,6 +93,9 @@ extern void __cpu_die(unsigned int cpu); | |||
| 94 | #define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id) | 93 | #define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id) |
| 95 | #define set_hard_smp_processor_id(CPU, VAL) \ | 94 | #define set_hard_smp_processor_id(CPU, VAL) \ |
| 96 | do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0) | 95 | do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0) |
| 96 | |||
| 97 | extern void smp_release_cpus(void); | ||
| 98 | |||
| 97 | #else | 99 | #else |
| 98 | /* 32-bit */ | 100 | /* 32-bit */ |
| 99 | #ifndef CONFIG_SMP | 101 | #ifndef CONFIG_SMP |
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h index dee8eefe47bc..76c29a9784dd 100644 --- a/include/asm-powerpc/smu.h +++ b/include/asm-powerpc/smu.h | |||
| @@ -20,16 +20,52 @@ | |||
| 20 | /* | 20 | /* |
| 21 | * Partition info commands | 21 | * Partition info commands |
| 22 | * | 22 | * |
| 23 | * I do not know what those are for at this point | 23 | * These commands are used to retreive the sdb-partition-XX datas from |
| 24 | * the SMU. The lenght is always 2. First byte is the subcommand code | ||
| 25 | * and second byte is the partition ID. | ||
| 26 | * | ||
| 27 | * The reply is 6 bytes: | ||
| 28 | * | ||
| 29 | * - 0..1 : partition address | ||
| 30 | * - 2 : a byte containing the partition ID | ||
| 31 | * - 3 : length (maybe other bits are rest of header ?) | ||
| 32 | * | ||
| 33 | * The data must then be obtained with calls to another command: | ||
| 34 | * SMU_CMD_MISC_ee_GET_DATABLOCK_REC (described below). | ||
| 24 | */ | 35 | */ |
| 25 | #define SMU_CMD_PARTITION_COMMAND 0x3e | 36 | #define SMU_CMD_PARTITION_COMMAND 0x3e |
| 37 | #define SMU_CMD_PARTITION_LATEST 0x01 | ||
| 38 | #define SMU_CMD_PARTITION_BASE 0x02 | ||
| 39 | #define SMU_CMD_PARTITION_UPDATE 0x03 | ||
| 26 | 40 | ||
| 27 | 41 | ||
| 28 | /* | 42 | /* |
| 29 | * Fan control | 43 | * Fan control |
| 30 | * | 44 | * |
| 31 | * This is a "mux" for fan control commands, first byte is the | 45 | * This is a "mux" for fan control commands. The command seem to |
| 32 | * "sub" command. | 46 | * act differently based on the number of arguments. With 1 byte |
| 47 | * of argument, this seem to be queries for fans status, setpoint, | ||
| 48 | * etc..., while with 0xe arguments, we will set the fans speeds. | ||
| 49 | * | ||
| 50 | * Queries (1 byte arg): | ||
| 51 | * --------------------- | ||
| 52 | * | ||
| 53 | * arg=0x01: read RPM fans status | ||
| 54 | * arg=0x02: read RPM fans setpoint | ||
| 55 | * arg=0x11: read PWM fans status | ||
| 56 | * arg=0x12: read PWM fans setpoint | ||
| 57 | * | ||
| 58 | * the "status" queries return the current speed while the "setpoint" ones | ||
| 59 | * return the programmed/target speed. It _seems_ that the result is a bit | ||
| 60 | * mask in the first byte of active/available fans, followed by 6 words (16 | ||
| 61 | * bits) containing the requested speed. | ||
| 62 | * | ||
| 63 | * Setpoint (14 bytes arg): | ||
| 64 | * ------------------------ | ||
| 65 | * | ||
| 66 | * first arg byte is 0 for RPM fans and 0x10 for PWM. Second arg byte is the | ||
| 67 | * mask of fans affected by the command. Followed by 6 words containing the | ||
| 68 | * setpoint value for selected fans in the mask (or 0 if mask value is 0) | ||
| 33 | */ | 69 | */ |
| 34 | #define SMU_CMD_FAN_COMMAND 0x4a | 70 | #define SMU_CMD_FAN_COMMAND 0x4a |
| 35 | 71 | ||
| @@ -144,7 +180,11 @@ | |||
| 144 | * - lenght 8 ("VSLEWxyz") has 3 additional bytes appended, and is | 180 | * - lenght 8 ("VSLEWxyz") has 3 additional bytes appended, and is |
| 145 | * used to set the voltage slewing point. The SMU replies with "DONE" | 181 | * used to set the voltage slewing point. The SMU replies with "DONE" |
| 146 | * I yet have to figure out their exact meaning of those 3 bytes in | 182 | * I yet have to figure out their exact meaning of those 3 bytes in |
| 147 | * both cases. | 183 | * both cases. They seem to be: |
| 184 | * x = processor mask | ||
| 185 | * y = op. point index | ||
| 186 | * z = processor freq. step index | ||
| 187 | * I haven't yet decyphered result codes | ||
| 148 | * | 188 | * |
| 149 | */ | 189 | */ |
| 150 | #define SMU_CMD_POWER_COMMAND 0xaa | 190 | #define SMU_CMD_POWER_COMMAND 0xaa |
| @@ -152,6 +192,14 @@ | |||
| 152 | #define SMU_CMD_POWER_SHUTDOWN "SHUTDOWN" | 192 | #define SMU_CMD_POWER_SHUTDOWN "SHUTDOWN" |
| 153 | #define SMU_CMD_POWER_VOLTAGE_SLEW "VSLEW" | 193 | #define SMU_CMD_POWER_VOLTAGE_SLEW "VSLEW" |
| 154 | 194 | ||
| 195 | /* | ||
| 196 | * Read ADC sensors | ||
| 197 | * | ||
| 198 | * This command takes one byte of parameter: the sensor ID (or "reg" | ||
| 199 | * value in the device-tree) and returns a 16 bits value | ||
| 200 | */ | ||
| 201 | #define SMU_CMD_READ_ADC 0xd8 | ||
| 202 | |||
| 155 | /* Misc commands | 203 | /* Misc commands |
| 156 | * | 204 | * |
| 157 | * This command seem to be a grab bag of various things | 205 | * This command seem to be a grab bag of various things |
| @@ -172,6 +220,25 @@ | |||
| 172 | * Misc commands | 220 | * Misc commands |
| 173 | * | 221 | * |
| 174 | * This command seem to be a grab bag of various things | 222 | * This command seem to be a grab bag of various things |
| 223 | * | ||
| 224 | * SMU_CMD_MISC_ee_GET_DATABLOCK_REC is used, among others, to | ||
| 225 | * transfer blocks of data from the SMU. So far, I've decrypted it's | ||
| 226 | * usage to retreive partition data. In order to do that, you have to | ||
| 227 | * break your transfer in "chunks" since that command cannot transfer | ||
| 228 | * more than a chunk at a time. The chunk size used by OF is 0xe bytes, | ||
| 229 | * but it seems that the darwin driver will let you do 0x1e bytes if | ||
| 230 | * your "PMU" version is >= 0x30. You can get the "PMU" version apparently | ||
| 231 | * either in the last 16 bits of property "smu-version-pmu" or as the 16 | ||
| 232 | * bytes at offset 1 of "smu-version-info" | ||
| 233 | * | ||
| 234 | * For each chunk, the command takes 7 bytes of arguments: | ||
| 235 | * byte 0: subcommand code (0x02) | ||
| 236 | * byte 1: 0x04 (always, I don't know what it means, maybe the address | ||
| 237 | * space to use or some other nicety. It's hard coded in OF) | ||
| 238 | * byte 2..5: SMU address of the chunk (big endian 32 bits) | ||
| 239 | * byte 6: size to transfer (up to max chunk size) | ||
| 240 | * | ||
| 241 | * The data is returned directly | ||
| 175 | */ | 242 | */ |
| 176 | #define SMU_CMD_MISC_ee_COMMAND 0xee | 243 | #define SMU_CMD_MISC_ee_COMMAND 0xee |
| 177 | #define SMU_CMD_MISC_ee_GET_DATABLOCK_REC 0x02 | 244 | #define SMU_CMD_MISC_ee_GET_DATABLOCK_REC 0x02 |
| @@ -333,6 +400,128 @@ extern int smu_queue_i2c(struct smu_i2c_cmd *cmd); | |||
| 333 | 400 | ||
| 334 | #endif /* __KERNEL__ */ | 401 | #endif /* __KERNEL__ */ |
| 335 | 402 | ||
| 403 | |||
| 404 | /* | ||
| 405 | * - SMU "sdb" partitions informations - | ||
| 406 | */ | ||
| 407 | |||
| 408 | |||
| 409 | /* | ||
| 410 | * Partition header format | ||
| 411 | */ | ||
| 412 | struct smu_sdbp_header { | ||
| 413 | __u8 id; | ||
| 414 | __u8 len; | ||
| 415 | __u8 version; | ||
| 416 | __u8 flags; | ||
| 417 | }; | ||
| 418 | |||
| 419 | |||
| 420 | /* | ||
| 421 | * demangle 16 and 32 bits integer in some SMU partitions | ||
| 422 | * (currently, afaik, this concerns only the FVT partition | ||
| 423 | * (0x12) | ||
| 424 | */ | ||
| 425 | #define SMU_U16_MIX(x) le16_to_cpu(x); | ||
| 426 | #define SMU_U32_MIX(x) ((((x) & 0xff00ff00u) >> 8)|(((x) & 0x00ff00ffu) << 8)) | ||
| 427 | |||
| 428 | |||
| 429 | /* This is the definition of the SMU sdb-partition-0x12 table (called | ||
| 430 | * CPU F/V/T operating points in Darwin). The definition for all those | ||
| 431 | * SMU tables should be moved to some separate file | ||
| 432 | */ | ||
| 433 | #define SMU_SDB_FVT_ID 0x12 | ||
| 434 | |||
| 435 | struct smu_sdbp_fvt { | ||
| 436 | __u32 sysclk; /* Base SysClk frequency in Hz for | ||
| 437 | * this operating point. Value need to | ||
| 438 | * be unmixed with SMU_U32_MIX() | ||
| 439 | */ | ||
| 440 | __u8 pad; | ||
| 441 | __u8 maxtemp; /* Max temp. supported by this | ||
| 442 | * operating point | ||
| 443 | */ | ||
| 444 | |||
| 445 | __u16 volts[3]; /* CPU core voltage for the 3 | ||
| 446 | * PowerTune modes, a mode with | ||
| 447 | * 0V = not supported. Value need | ||
| 448 | * to be unmixed with SMU_U16_MIX() | ||
| 449 | */ | ||
| 450 | }; | ||
| 451 | |||
| 452 | /* This partition contains voltage & current sensor calibration | ||
| 453 | * informations | ||
| 454 | */ | ||
| 455 | #define SMU_SDB_CPUVCP_ID 0x21 | ||
| 456 | |||
| 457 | struct smu_sdbp_cpuvcp { | ||
| 458 | __u16 volt_scale; /* u4.12 fixed point */ | ||
| 459 | __s16 volt_offset; /* s4.12 fixed point */ | ||
| 460 | __u16 curr_scale; /* u4.12 fixed point */ | ||
| 461 | __s16 curr_offset; /* s4.12 fixed point */ | ||
| 462 | __s32 power_quads[3]; /* s4.28 fixed point */ | ||
| 463 | }; | ||
| 464 | |||
| 465 | /* This partition contains CPU thermal diode calibration | ||
| 466 | */ | ||
| 467 | #define SMU_SDB_CPUDIODE_ID 0x18 | ||
| 468 | |||
| 469 | struct smu_sdbp_cpudiode { | ||
| 470 | __u16 m_value; /* u1.15 fixed point */ | ||
| 471 | __s16 b_value; /* s10.6 fixed point */ | ||
| 472 | |||
| 473 | }; | ||
| 474 | |||
| 475 | /* This partition contains Slots power calibration | ||
| 476 | */ | ||
| 477 | #define SMU_SDB_SLOTSPOW_ID 0x78 | ||
| 478 | |||
| 479 | struct smu_sdbp_slotspow { | ||
| 480 | __u16 pow_scale; /* u4.12 fixed point */ | ||
| 481 | __s16 pow_offset; /* s4.12 fixed point */ | ||
| 482 | }; | ||
| 483 | |||
| 484 | /* This partition contains machine specific version information about | ||
| 485 | * the sensor/control layout | ||
| 486 | */ | ||
| 487 | #define SMU_SDB_SENSORTREE_ID 0x25 | ||
| 488 | |||
| 489 | struct smu_sdbp_sensortree { | ||
| 490 | u8 model_id; | ||
| 491 | u8 unknown[3]; | ||
| 492 | }; | ||
| 493 | |||
| 494 | /* This partition contains CPU thermal control PID informations. So far | ||
| 495 | * only single CPU machines have been seen with an SMU, so we assume this | ||
| 496 | * carries only informations for those | ||
| 497 | */ | ||
| 498 | #define SMU_SDB_CPUPIDDATA_ID 0x17 | ||
| 499 | |||
| 500 | struct smu_sdbp_cpupiddata { | ||
| 501 | u8 unknown1; | ||
| 502 | u8 target_temp_delta; | ||
| 503 | u8 unknown2; | ||
| 504 | u8 history_len; | ||
| 505 | s16 power_adj; | ||
| 506 | u16 max_power; | ||
| 507 | s32 gp,gr,gd; | ||
| 508 | }; | ||
| 509 | |||
| 510 | |||
| 511 | /* Other partitions without known structures */ | ||
| 512 | #define SMU_SDB_DEBUG_SWITCHES_ID 0x05 | ||
| 513 | |||
| 514 | #ifdef __KERNEL__ | ||
| 515 | /* | ||
| 516 | * This returns the pointer to an SMU "sdb" partition data or NULL | ||
| 517 | * if not found. The data format is described below | ||
| 518 | */ | ||
| 519 | extern struct smu_sdbp_header *smu_get_sdb_partition(int id, | ||
| 520 | unsigned int *size); | ||
| 521 | |||
| 522 | #endif /* __KERNEL__ */ | ||
| 523 | |||
| 524 | |||
| 336 | /* | 525 | /* |
| 337 | * - Userland interface - | 526 | * - Userland interface - |
| 338 | */ | 527 | */ |
| @@ -365,8 +554,10 @@ struct smu_user_cmd_hdr | |||
| 365 | __u32 cmdtype; | 554 | __u32 cmdtype; |
| 366 | #define SMU_CMDTYPE_SMU 0 /* SMU command */ | 555 | #define SMU_CMDTYPE_SMU 0 /* SMU command */ |
| 367 | #define SMU_CMDTYPE_WANTS_EVENTS 1 /* switch fd to events mode */ | 556 | #define SMU_CMDTYPE_WANTS_EVENTS 1 /* switch fd to events mode */ |
| 557 | #define SMU_CMDTYPE_GET_PARTITION 2 /* retreive an sdb partition */ | ||
| 368 | 558 | ||
| 369 | __u8 cmd; /* SMU command byte */ | 559 | __u8 cmd; /* SMU command byte */ |
| 560 | __u8 pad[3]; /* padding */ | ||
| 370 | __u32 data_len; /* Lenght of data following */ | 561 | __u32 data_len; /* Lenght of data following */ |
| 371 | }; | 562 | }; |
| 372 | 563 | ||
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index b5da0b851e02..3536a5cd7a2d 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
| @@ -289,7 +289,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new) | |||
| 289 | 289 | ||
| 290 | #ifdef CONFIG_PPC64 | 290 | #ifdef CONFIG_PPC64 |
| 291 | static __inline__ unsigned long | 291 | static __inline__ unsigned long |
| 292 | __cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new) | 292 | __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new) |
| 293 | { | 293 | { |
| 294 | unsigned long prev; | 294 | unsigned long prev; |
| 295 | 295 | ||
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h index ab17db79f69d..e525f49bd179 100644 --- a/include/asm-powerpc/thread_info.h +++ b/include/asm-powerpc/thread_info.h | |||
| @@ -65,23 +65,27 @@ struct thread_info { | |||
| 65 | 65 | ||
| 66 | /* thread information allocation */ | 66 | /* thread information allocation */ |
| 67 | 67 | ||
| 68 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
| 69 | #define THREAD_INFO_GFP GFP_KERNEL | __GFP_ZERO | ||
| 70 | #else | ||
| 71 | #define THREAD_INFO_GFP GFP_KERNEL | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #if THREAD_SHIFT >= PAGE_SHIFT | 68 | #if THREAD_SHIFT >= PAGE_SHIFT |
| 75 | 69 | ||
| 76 | #define THREAD_ORDER (THREAD_SHIFT - PAGE_SHIFT) | 70 | #define THREAD_ORDER (THREAD_SHIFT - PAGE_SHIFT) |
| 77 | 71 | ||
| 72 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
| 78 | #define alloc_thread_info(tsk) \ | 73 | #define alloc_thread_info(tsk) \ |
| 79 | ((struct thread_info *)__get_free_pages(THREAD_INFO_GFP, THREAD_ORDER)) | 74 | ((struct thread_info *)__get_free_pages(GFP_KERNEL | \ |
| 75 | __GFP_ZERO, THREAD_ORDER)) | ||
| 76 | #else | ||
| 77 | #define alloc_thread_info(tsk) \ | ||
| 78 | ((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_ORDER)) | ||
| 79 | #endif | ||
| 80 | #define free_thread_info(ti) free_pages((unsigned long)ti, THREAD_ORDER) | 80 | #define free_thread_info(ti) free_pages((unsigned long)ti, THREAD_ORDER) |
| 81 | 81 | ||
| 82 | #else /* THREAD_SHIFT < PAGE_SHIFT */ | 82 | #else /* THREAD_SHIFT < PAGE_SHIFT */ |
| 83 | 83 | ||
| 84 | #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, THREAD_INFO_GFP) | 84 | #ifdef CONFIG_DEBUG_STACK_USAGE |
| 85 | #define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL) | ||
| 86 | #else | ||
| 87 | #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) | ||
| 88 | #endif | ||
| 85 | #define free_thread_info(ti) kfree(ti) | 89 | #define free_thread_info(ti) kfree(ti) |
| 86 | 90 | ||
| 87 | #endif /* THREAD_SHIFT < PAGE_SHIFT */ | 91 | #endif /* THREAD_SHIFT < PAGE_SHIFT */ |
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h index ca3655672bbc..a2998eee37bb 100644 --- a/include/asm-powerpc/tlbflush.h +++ b/include/asm-powerpc/tlbflush.h | |||
| @@ -31,9 +31,9 @@ struct mm_struct; | |||
| 31 | struct ppc64_tlb_batch { | 31 | struct ppc64_tlb_batch { |
| 32 | unsigned long index; | 32 | unsigned long index; |
| 33 | struct mm_struct *mm; | 33 | struct mm_struct *mm; |
| 34 | pte_t pte[PPC64_TLB_BATCH_NR]; | 34 | real_pte_t pte[PPC64_TLB_BATCH_NR]; |
| 35 | unsigned long vaddr[PPC64_TLB_BATCH_NR]; | 35 | unsigned long vaddr[PPC64_TLB_BATCH_NR]; |
| 36 | unsigned int large; | 36 | unsigned int psize; |
| 37 | }; | 37 | }; |
| 38 | DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); | 38 | DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); |
| 39 | 39 | ||
| @@ -48,8 +48,9 @@ static inline void flush_tlb_pending(void) | |||
| 48 | put_cpu_var(ppc64_tlb_batch); | 48 | put_cpu_var(ppc64_tlb_batch); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | extern void flush_hash_page(unsigned long va, pte_t pte, int local); | 51 | extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize, |
| 52 | void flush_hash_range(unsigned long number, int local); | 52 | int local); |
| 53 | extern void flush_hash_range(unsigned long number, int local); | ||
| 53 | 54 | ||
| 54 | #else /* CONFIG_PPC64 */ | 55 | #else /* CONFIG_PPC64 */ |
| 55 | 56 | ||
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h index 43f7129984c7..ace2072d4a83 100644 --- a/include/asm-powerpc/xmon.h +++ b/include/asm-powerpc/xmon.h | |||
| @@ -7,6 +7,7 @@ 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); | ||
| 10 | 11 | ||
| 11 | #endif | 12 | #endif |
| 12 | #endif | 13 | #endif |
diff --git a/include/asm-ppc/btext.h b/include/asm-ppc/btext.h index 36c7640d00f2..ccaefabe0bf5 100644 --- a/include/asm-ppc/btext.h +++ b/include/asm-ppc/btext.h | |||
| @@ -17,18 +17,18 @@ extern unsigned long disp_BAT[2]; | |||
| 17 | extern boot_infos_t disp_bi; | 17 | extern boot_infos_t disp_bi; |
| 18 | extern int boot_text_mapped; | 18 | extern int boot_text_mapped; |
| 19 | 19 | ||
| 20 | void btext_init(boot_infos_t *bi); | 20 | extern void init_boot_display(void); |
| 21 | void btext_welcome(void); | 21 | extern void btext_welcome(void); |
| 22 | void btext_prepare_BAT(void); | 22 | extern void btext_prepare_BAT(void); |
| 23 | void btext_setup_display(int width, int height, int depth, int pitch, | 23 | extern void btext_setup_display(int width, int height, int depth, int pitch, |
| 24 | unsigned long address); | 24 | unsigned long address); |
| 25 | void map_boot_text(void); | 25 | extern void map_boot_text(void); |
| 26 | void btext_update_display(unsigned long phys, int width, int height, | 26 | extern void btext_update_display(unsigned long phys, int width, int height, |
| 27 | int depth, int pitch); | 27 | int depth, int pitch); |
| 28 | 28 | ||
| 29 | void btext_drawchar(char c); | 29 | extern void btext_drawchar(char c); |
| 30 | void btext_drawstring(const char *str); | 30 | extern void btext_drawstring(const char *str); |
| 31 | void btext_drawhex(unsigned long v); | 31 | extern void btext_drawhex(unsigned long v); |
| 32 | 32 | ||
| 33 | #endif /* __KERNEL__ */ | 33 | #endif /* __KERNEL__ */ |
| 34 | #endif /* __PPC_BTEXT_H */ | 34 | #endif /* __PPC_BTEXT_H */ |
diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h index e5374be86aef..f835066fb3ca 100644 --- a/include/asm-ppc/ibm44x.h +++ b/include/asm-ppc/ibm44x.h | |||
| @@ -34,12 +34,20 @@ | |||
| 34 | /* Lowest TLB slot consumed by the default pinned TLBs */ | 34 | /* Lowest TLB slot consumed by the default pinned TLBs */ |
| 35 | #define PPC44x_LOW_SLOT 63 | 35 | #define PPC44x_LOW_SLOT 63 |
| 36 | 36 | ||
| 37 | /* LS 32-bits of UART0 physical address location for early serial text debug */ | 37 | /* |
| 38 | * Least significant 32-bits and extended real page number (ERPN) of | ||
| 39 | * UART0 physical address location for early serial text debug | ||
| 40 | */ | ||
| 38 | #if defined(CONFIG_440SP) | 41 | #if defined(CONFIG_440SP) |
| 42 | #define UART0_PHYS_ERPN 1 | ||
| 43 | #define UART0_PHYS_IO_BASE 0xf0000200 | ||
| 44 | #elif defined(CONFIG_440SPE) | ||
| 45 | #define UART0_PHYS_ERPN 4 | ||
| 39 | #define UART0_PHYS_IO_BASE 0xf0000200 | 46 | #define UART0_PHYS_IO_BASE 0xf0000200 |
| 40 | #elif defined(CONFIG_440EP) | 47 | #elif defined(CONFIG_440EP) |
| 41 | #define UART0_PHYS_IO_BASE 0xe0000000 | 48 | #define UART0_PHYS_IO_BASE 0xe0000000 |
| 42 | #else | 49 | #else |
| 50 | #define UART0_PHYS_ERPN 1 | ||
| 43 | #define UART0_PHYS_IO_BASE 0x40000200 | 51 | #define UART0_PHYS_IO_BASE 0x40000200 |
| 44 | #endif | 52 | #endif |
| 45 | 53 | ||
| @@ -56,6 +64,11 @@ | |||
| 56 | #define PPC44x_PCICFG_PAGE 0x0000000900000000ULL | 64 | #define PPC44x_PCICFG_PAGE 0x0000000900000000ULL |
| 57 | #define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE | 65 | #define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE |
| 58 | #define PPC44x_PCIMEM_PAGE 0x0000000a00000000ULL | 66 | #define PPC44x_PCIMEM_PAGE 0x0000000a00000000ULL |
| 67 | #elif defined(CONFIG_440SPE) | ||
| 68 | #define PPC44x_IO_PAGE 0x0000000400000000ULL | ||
| 69 | #define PPC44x_PCICFG_PAGE 0x0000000c00000000ULL | ||
| 70 | #define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE | ||
| 71 | #define PPC44x_PCIMEM_PAGE 0x0000000d00000000ULL | ||
| 59 | #elif defined(CONFIG_440EP) | 72 | #elif defined(CONFIG_440EP) |
| 60 | #define PPC44x_IO_PAGE 0x0000000000000000ULL | 73 | #define PPC44x_IO_PAGE 0x0000000000000000ULL |
| 61 | #define PPC44x_PCICFG_PAGE 0x0000000000000000ULL | 74 | #define PPC44x_PCICFG_PAGE 0x0000000000000000ULL |
| @@ -71,7 +84,7 @@ | |||
| 71 | /* | 84 | /* |
| 72 | * 36-bit trap ranges | 85 | * 36-bit trap ranges |
| 73 | */ | 86 | */ |
| 74 | #if defined(CONFIG_440SP) | 87 | #if defined(CONFIG_440SP) || defined(CONFIG_440SPE) |
| 75 | #define PPC44x_IO_LO 0xf0000000UL | 88 | #define PPC44x_IO_LO 0xf0000000UL |
| 76 | #define PPC44x_IO_HI 0xf0000fffUL | 89 | #define PPC44x_IO_HI 0xf0000fffUL |
| 77 | #define PPC44x_PCI0CFG_LO 0x0ec00000UL | 90 | #define PPC44x_PCI0CFG_LO 0x0ec00000UL |
| @@ -109,7 +122,7 @@ | |||
| 109 | */ | 122 | */ |
| 110 | 123 | ||
| 111 | 124 | ||
| 112 | /* CPRs (440GX and 440SP) */ | 125 | /* CPRs (440GX and 440SP/440SPe) */ |
| 113 | #define DCRN_CPR_CONFIG_ADDR 0xc | 126 | #define DCRN_CPR_CONFIG_ADDR 0xc |
| 114 | #define DCRN_CPR_CONFIG_DATA 0xd | 127 | #define DCRN_CPR_CONFIG_DATA 0xd |
| 115 | 128 | ||
| @@ -130,7 +143,7 @@ | |||
| 130 | mtdcr(DCRN_CPR_CONFIG_ADDR, offset); \ | 143 | mtdcr(DCRN_CPR_CONFIG_ADDR, offset); \ |
| 131 | mtdcr(DCRN_CPR_CONFIG_DATA, data);}) | 144 | mtdcr(DCRN_CPR_CONFIG_DATA, data);}) |
| 132 | 145 | ||
| 133 | /* SDRs (440GX and 440SP) */ | 146 | /* SDRs (440GX and 440SP/440SPe) */ |
| 134 | #define DCRN_SDR_CONFIG_ADDR 0xe | 147 | #define DCRN_SDR_CONFIG_ADDR 0xe |
| 135 | #define DCRN_SDR_CONFIG_DATA 0xf | 148 | #define DCRN_SDR_CONFIG_DATA 0xf |
| 136 | #define DCRN_SDR_PFC0 0x4100 | 149 | #define DCRN_SDR_PFC0 0x4100 |
| @@ -180,7 +193,7 @@ | |||
| 180 | mtdcr(DCRN_SDR_CONFIG_ADDR, offset); \ | 193 | mtdcr(DCRN_SDR_CONFIG_ADDR, offset); \ |
| 181 | mtdcr(DCRN_SDR_CONFIG_DATA,data);}) | 194 | mtdcr(DCRN_SDR_CONFIG_DATA,data);}) |
| 182 | 195 | ||
| 183 | /* DMA (excluding 440SP) */ | 196 | /* DMA (excluding 440SP/440SPe) */ |
| 184 | #define DCRN_DMA0_BASE 0x100 | 197 | #define DCRN_DMA0_BASE 0x100 |
| 185 | #define DCRN_DMA1_BASE 0x108 | 198 | #define DCRN_DMA1_BASE 0x108 |
| 186 | #define DCRN_DMA2_BASE 0x110 | 199 | #define DCRN_DMA2_BASE 0x110 |
| @@ -200,12 +213,20 @@ | |||
| 200 | /* UIC */ | 213 | /* UIC */ |
| 201 | #define DCRN_UIC0_BASE 0xc0 | 214 | #define DCRN_UIC0_BASE 0xc0 |
| 202 | #define DCRN_UIC1_BASE 0xd0 | 215 | #define DCRN_UIC1_BASE 0xd0 |
| 203 | #define DCRN_UIC2_BASE 0x210 | ||
| 204 | #define DCRN_UICB_BASE 0x200 | ||
| 205 | #define UIC0 DCRN_UIC0_BASE | 216 | #define UIC0 DCRN_UIC0_BASE |
| 206 | #define UIC1 DCRN_UIC1_BASE | 217 | #define UIC1 DCRN_UIC1_BASE |
| 218 | |||
| 219 | #ifdef CONFIG_440SPE | ||
| 220 | #define DCRN_UIC2_BASE 0xe0 | ||
| 221 | #define DCRN_UIC3_BASE 0xf0 | ||
| 222 | #define UIC2 DCRN_UIC2_BASE | ||
| 223 | #define UIC3 DCRN_UIC3_BASE | ||
| 224 | #else | ||
| 225 | #define DCRN_UIC2_BASE 0x210 | ||
| 226 | #define DCRN_UICB_BASE 0x200 | ||
| 207 | #define UIC2 DCRN_UIC2_BASE | 227 | #define UIC2 DCRN_UIC2_BASE |
| 208 | #define UICB DCRN_UICB_BASE | 228 | #define UICB DCRN_UICB_BASE |
| 229 | #endif | ||
| 209 | 230 | ||
| 210 | #define DCRN_UIC_SR(base) (base + 0x0) | 231 | #define DCRN_UIC_SR(base) (base + 0x0) |
| 211 | #define DCRN_UIC_ER(base) (base + 0x2) | 232 | #define DCRN_UIC_ER(base) (base + 0x2) |
| @@ -218,6 +239,12 @@ | |||
| 218 | 239 | ||
| 219 | #define UIC0_UIC1NC 0x00000002 | 240 | #define UIC0_UIC1NC 0x00000002 |
| 220 | 241 | ||
| 242 | #ifdef CONFIG_440SPE | ||
| 243 | #define UIC0_UIC1NC 0x00000002 | ||
| 244 | #define UIC0_UIC2NC 0x00200000 | ||
| 245 | #define UIC0_UIC3NC 0x00008000 | ||
| 246 | #endif | ||
| 247 | |||
| 221 | #define UICB_UIC0NC 0x40000000 | 248 | #define UICB_UIC0NC 0x40000000 |
| 222 | #define UICB_UIC1NC 0x10000000 | 249 | #define UICB_UIC1NC 0x10000000 |
| 223 | #define UICB_UIC2NC 0x04000000 | 250 | #define UICB_UIC2NC 0x04000000 |
| @@ -297,6 +324,23 @@ | |||
| 297 | #define MALOBISR_CH0 0x80000000 /* EOB channel 1 bit */ | 324 | #define MALOBISR_CH0 0x80000000 /* EOB channel 1 bit */ |
| 298 | #define MALOBISR_CH2 0x40000000 /* EOB channel 2 bit */ | 325 | #define MALOBISR_CH2 0x40000000 /* EOB channel 2 bit */ |
| 299 | 326 | ||
| 327 | #if defined(CONFIG_440SP) || defined(CONFIG_440SPE) | ||
| 328 | /* 440SP/440SPe PLB Arbiter DCRs */ | ||
| 329 | #define DCRN_PLB_REVID 0x080 /* PLB Revision ID */ | ||
| 330 | #define DCRN_PLB_CCR 0x088 /* PLB Crossbar Control */ | ||
| 331 | |||
| 332 | #define DCRN_PLB0_ACR 0x081 /* PLB Arbiter Control */ | ||
| 333 | #define DCRN_PLB0_BESRL 0x082 /* PLB Error Status */ | ||
| 334 | #define DCRN_PLB0_BESRH 0x083 /* PLB Error Status */ | ||
| 335 | #define DCRN_PLB0_BEARL 0x084 /* PLB Error Address Low */ | ||
| 336 | #define DCRN_PLB0_BEARH 0x085 /* PLB Error Address High */ | ||
| 337 | |||
| 338 | #define DCRN_PLB1_ACR 0x089 /* PLB Arbiter Control */ | ||
| 339 | #define DCRN_PLB1_BESRL 0x08a /* PLB Error Status */ | ||
| 340 | #define DCRN_PLB1_BESRH 0x08b /* PLB Error Status */ | ||
| 341 | #define DCRN_PLB1_BEARL 0x08c /* PLB Error Address Low */ | ||
| 342 | #define DCRN_PLB1_BEARH 0x08d /* PLB Error Address High */ | ||
| 343 | #else | ||
| 300 | /* 440GP/GX PLB Arbiter DCRs */ | 344 | /* 440GP/GX PLB Arbiter DCRs */ |
| 301 | #define DCRN_PLB0_REVID 0x082 /* PLB Arbiter Revision ID */ | 345 | #define DCRN_PLB0_REVID 0x082 /* PLB Arbiter Revision ID */ |
| 302 | #define DCRN_PLB0_ACR 0x083 /* PLB Arbiter Control */ | 346 | #define DCRN_PLB0_ACR 0x083 /* PLB Arbiter Control */ |
| @@ -304,6 +348,7 @@ | |||
| 304 | #define DCRN_PLB0_BEARL 0x086 /* PLB Error Address Low */ | 348 | #define DCRN_PLB0_BEARL 0x086 /* PLB Error Address Low */ |
| 305 | #define DCRN_PLB0_BEAR DCRN_PLB0_BEARL /* 40x compatibility */ | 349 | #define DCRN_PLB0_BEAR DCRN_PLB0_BEARL /* 40x compatibility */ |
| 306 | #define DCRN_PLB0_BEARH 0x087 /* PLB Error Address High */ | 350 | #define DCRN_PLB0_BEARH 0x087 /* PLB Error Address High */ |
| 351 | #endif | ||
| 307 | 352 | ||
| 308 | /* 440GP/GX PLB to OPB bridge DCRs */ | 353 | /* 440GP/GX PLB to OPB bridge DCRs */ |
| 309 | #define DCRN_POB0_BESR0 0x090 | 354 | #define DCRN_POB0_BESR0 0x090 |
| @@ -407,9 +452,13 @@ | |||
| 407 | #define PPC44x_MEM_SIZE_1G 0x40000000 | 452 | #define PPC44x_MEM_SIZE_1G 0x40000000 |
| 408 | #define PPC44x_MEM_SIZE_2G 0x80000000 | 453 | #define PPC44x_MEM_SIZE_2G 0x80000000 |
| 409 | 454 | ||
| 410 | /* 440SP memory controller DCRs */ | 455 | /* 440SP/440SPe memory controller DCRs */ |
| 411 | #define DCRN_MQ0_BS0BAS 0x40 | 456 | #define DCRN_MQ0_BS0BAS 0x40 |
| 412 | #define DCRN_MQ0_BS1BAS 0x41 | 457 | #if defined(CONFIG_440SP) |
| 458 | #define MQ0_NUM_BANKS 2 | ||
| 459 | #elif defined(CONFIG_440SPE) | ||
| 460 | #define MQ0_NUM_BANKS 4 | ||
| 461 | #endif | ||
| 413 | 462 | ||
| 414 | #define MQ0_CONFIG_SIZE_MASK 0x0000fff0 | 463 | #define MQ0_CONFIG_SIZE_MASK 0x0000fff0 |
| 415 | #define MQ0_CONFIG_SIZE_8M 0x0000ffc0 | 464 | #define MQ0_CONFIG_SIZE_8M 0x0000ffc0 |
| @@ -421,8 +470,9 @@ | |||
| 421 | #define MQ0_CONFIG_SIZE_512M 0x0000f000 | 470 | #define MQ0_CONFIG_SIZE_512M 0x0000f000 |
| 422 | #define MQ0_CONFIG_SIZE_1G 0x0000e000 | 471 | #define MQ0_CONFIG_SIZE_1G 0x0000e000 |
| 423 | #define MQ0_CONFIG_SIZE_2G 0x0000c000 | 472 | #define MQ0_CONFIG_SIZE_2G 0x0000c000 |
| 473 | #define MQ0_CONFIG_SIZE_4G 0x00008000 | ||
| 424 | 474 | ||
| 425 | /* Internal SRAM Controller 440GX/440SP */ | 475 | /* Internal SRAM Controller 440GX/440SP/440SPe */ |
| 426 | #define DCRN_SRAM0_BASE 0x000 | 476 | #define DCRN_SRAM0_BASE 0x000 |
| 427 | 477 | ||
| 428 | #define DCRN_SRAM0_SB0CR (DCRN_SRAM0_BASE + 0x020) | 478 | #define DCRN_SRAM0_SB0CR (DCRN_SRAM0_BASE + 0x020) |
| @@ -446,7 +496,7 @@ | |||
| 446 | #define DCRN_SRAM0_DPC (DCRN_SRAM0_BASE + 0x02a) | 496 | #define DCRN_SRAM0_DPC (DCRN_SRAM0_BASE + 0x02a) |
| 447 | #define SRAM_DPC_ENABLE 0x80000000 | 497 | #define SRAM_DPC_ENABLE 0x80000000 |
| 448 | 498 | ||
| 449 | /* L2 Cache Controller 440GX/440SP */ | 499 | /* L2 Cache Controller 440GX/440SP/440SPe */ |
| 450 | #define DCRN_L2C0_CFG 0x030 | 500 | #define DCRN_L2C0_CFG 0x030 |
| 451 | #define L2C_CFG_L2M 0x80000000 | 501 | #define L2C_CFG_L2M 0x80000000 |
| 452 | #define L2C_CFG_ICU 0x40000000 | 502 | #define L2C_CFG_ICU 0x40000000 |
| @@ -610,8 +660,10 @@ | |||
| 610 | #define IIC_CLOCK 50 | 660 | #define IIC_CLOCK 50 |
| 611 | 661 | ||
| 612 | #undef NR_UICS | 662 | #undef NR_UICS |
| 613 | #ifdef CONFIG_440GX | 663 | #if defined(CONFIG_440GX) |
| 614 | #define NR_UICS 3 | 664 | #define NR_UICS 3 |
| 665 | #elif defined(CONFIG_440SPE) | ||
| 666 | #define NR_UICS 4 | ||
| 615 | #else | 667 | #else |
| 616 | #define NR_UICS 2 | 668 | #define NR_UICS 2 |
| 617 | #endif | 669 | #endif |
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h index e992369cb8e9..6c28ae7807f4 100644 --- a/include/asm-ppc/ibm4xx.h +++ b/include/asm-ppc/ibm4xx.h | |||
| @@ -97,6 +97,10 @@ void ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 97 | #include <platforms/4xx/luan.h> | 97 | #include <platforms/4xx/luan.h> |
| 98 | #endif | 98 | #endif |
| 99 | 99 | ||
| 100 | #if defined(CONFIG_YUCCA) | ||
| 101 | #include <platforms/4xx/yucca.h> | ||
| 102 | #endif | ||
| 103 | |||
| 100 | #if defined(CONFIG_OCOTEA) | 104 | #if defined(CONFIG_OCOTEA) |
| 101 | #include <platforms/4xx/ocotea.h> | 105 | #include <platforms/4xx/ocotea.h> |
| 102 | #endif | 106 | #endif |
diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h index 6f10a25bd628..9c21de1ff4ed 100644 --- a/include/asm-ppc/ibm_ocp.h +++ b/include/asm-ppc/ibm_ocp.h | |||
| @@ -131,9 +131,22 @@ static inline void ibm_ocp_set_emac(int start, int end) | |||
| 131 | /* Copy MAC addresses to EMAC additions */ | 131 | /* Copy MAC addresses to EMAC additions */ |
| 132 | for (i=start; i<=end; i++) { | 132 | for (i=start; i<=end; i++) { |
| 133 | def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i); | 133 | def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i); |
| 134 | memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr, | 134 | if (i == 0) |
| 135 | &__res.bi_enetaddr[i], | 135 | memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr, |
| 136 | 6); | 136 | __res.bi_enetaddr, 6); |
| 137 | #if defined(CONFIG_405EP) || defined(CONFIG_44x) | ||
| 138 | else if (i == 1) | ||
| 139 | memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr, | ||
| 140 | __res.bi_enet1addr, 6); | ||
| 141 | #endif | ||
| 142 | #if defined(CONFIG_440GX) | ||
| 143 | else if (i == 2) | ||
| 144 | memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr, | ||
| 145 | __res.bi_enet2addr, 6); | ||
| 146 | else if (i == 3) | ||
| 147 | memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr, | ||
| 148 | __res.bi_enet3addr, 6); | ||
| 149 | #endif | ||
| 137 | } | 150 | } |
| 138 | } | 151 | } |
| 139 | #endif | 152 | #endif |
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index f7f614dfc648..2bfdf9c98459 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h | |||
| @@ -237,9 +237,9 @@ static inline void __raw_writel(__u32 b, volatile void __iomem *addr) | |||
| 237 | #define outsl(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl)) | 237 | #define outsl(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl)) |
| 238 | 238 | ||
| 239 | /* | 239 | /* |
| 240 | * On powermacs, we will get a machine check exception if we | 240 | * On powermacs and 8xx we will get a machine check exception |
| 241 | * try to read data from a non-existent I/O port. Because the | 241 | * if we try to read data from a non-existent I/O port. Because |
| 242 | * machine check is an asynchronous exception, it isn't | 242 | * the machine check is an asynchronous exception, it isn't |
| 243 | * well-defined which instruction SRR0 will point to when the | 243 | * well-defined which instruction SRR0 will point to when the |
| 244 | * exception occurs. | 244 | * exception occurs. |
| 245 | * With the sequence below (twi; isync; nop), we have found that | 245 | * With the sequence below (twi; isync; nop), we have found that |
| @@ -258,7 +258,7 @@ extern __inline__ unsigned int name(unsigned int port) \ | |||
| 258 | { \ | 258 | { \ |
| 259 | unsigned int x; \ | 259 | unsigned int x; \ |
| 260 | __asm__ __volatile__( \ | 260 | __asm__ __volatile__( \ |
| 261 | op " %0,0,%1\n" \ | 261 | "0:" op " %0,0,%1\n" \ |
| 262 | "1: twi 0,%0,0\n" \ | 262 | "1: twi 0,%0,0\n" \ |
| 263 | "2: isync\n" \ | 263 | "2: isync\n" \ |
| 264 | "3: nop\n" \ | 264 | "3: nop\n" \ |
| @@ -269,6 +269,7 @@ extern __inline__ unsigned int name(unsigned int port) \ | |||
| 269 | ".previous\n" \ | 269 | ".previous\n" \ |
| 270 | ".section __ex_table,\"a\"\n" \ | 270 | ".section __ex_table,\"a\"\n" \ |
| 271 | " .align 2\n" \ | 271 | " .align 2\n" \ |
| 272 | " .long 0b,5b\n" \ | ||
| 272 | " .long 1b,5b\n" \ | 273 | " .long 1b,5b\n" \ |
| 273 | " .long 2b,5b\n" \ | 274 | " .long 2b,5b\n" \ |
| 274 | " .long 3b,5b\n" \ | 275 | " .long 3b,5b\n" \ |
| @@ -282,11 +283,12 @@ extern __inline__ unsigned int name(unsigned int port) \ | |||
| 282 | extern __inline__ void name(unsigned int val, unsigned int port) \ | 283 | extern __inline__ void name(unsigned int val, unsigned int port) \ |
| 283 | { \ | 284 | { \ |
| 284 | __asm__ __volatile__( \ | 285 | __asm__ __volatile__( \ |
| 285 | op " %0,0,%1\n" \ | 286 | "0:" op " %0,0,%1\n" \ |
| 286 | "1: sync\n" \ | 287 | "1: sync\n" \ |
| 287 | "2:\n" \ | 288 | "2:\n" \ |
| 288 | ".section __ex_table,\"a\"\n" \ | 289 | ".section __ex_table,\"a\"\n" \ |
| 289 | " .align 2\n" \ | 290 | " .align 2\n" \ |
| 291 | " .long 0b,2b\n" \ | ||
| 290 | " .long 1b,2b\n" \ | 292 | " .long 1b,2b\n" \ |
| 291 | ".previous" \ | 293 | ".previous" \ |
| 292 | : : "r" (val), "r" (port + ___IO_BASE)); \ | 294 | : : "r" (val), "r" (port + ___IO_BASE)); \ |
diff --git a/include/asm-ppc/kgdb.h b/include/asm-ppc/kgdb.h index 1d3c927ce626..b617dac82969 100644 --- a/include/asm-ppc/kgdb.h +++ b/include/asm-ppc/kgdb.h | |||
| @@ -31,7 +31,7 @@ extern void breakpoint(void); | |||
| 31 | /* For taking exceptions | 31 | /* For taking exceptions |
| 32 | * these are defined in traps.c | 32 | * these are defined in traps.c |
| 33 | */ | 33 | */ |
| 34 | extern void (*debugger)(struct pt_regs *regs); | 34 | extern int (*debugger)(struct pt_regs *regs); |
| 35 | extern int (*debugger_bpt)(struct pt_regs *regs); | 35 | extern int (*debugger_bpt)(struct pt_regs *regs); |
| 36 | extern int (*debugger_sstep)(struct pt_regs *regs); | 36 | extern int (*debugger_sstep)(struct pt_regs *regs); |
| 37 | extern int (*debugger_iabr_match)(struct pt_regs *regs); | 37 | extern int (*debugger_iabr_match)(struct pt_regs *regs); |
diff --git a/include/asm-ppc/mpc83xx.h b/include/asm-ppc/mpc83xx.h index bb1b0576c947..ce212201db2a 100644 --- a/include/asm-ppc/mpc83xx.h +++ b/include/asm-ppc/mpc83xx.h | |||
| @@ -107,6 +107,7 @@ enum ppc_sys_devices { | |||
| 107 | MPC83xx_SEC2, | 107 | MPC83xx_SEC2, |
| 108 | MPC83xx_USB2_DR, | 108 | MPC83xx_USB2_DR, |
| 109 | MPC83xx_USB2_MPH, | 109 | MPC83xx_USB2_MPH, |
| 110 | MPC83xx_MDIO, | ||
| 110 | }; | 111 | }; |
| 111 | 112 | ||
| 112 | #endif /* CONFIG_83xx */ | 113 | #endif /* CONFIG_83xx */ |
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index b28a713ba862..6d1c39e8a6af 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <asm/processor.h> /* For TASK_SIZE */ | 12 | #include <asm/processor.h> /* For TASK_SIZE */ |
| 13 | #include <asm/mmu.h> | 13 | #include <asm/mmu.h> |
| 14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
| 15 | struct mm_struct; | ||
| 15 | 16 | ||
| 16 | extern unsigned long va_to_phys(unsigned long address); | 17 | extern unsigned long va_to_phys(unsigned long address); |
| 17 | extern pte_t *va_to_pte(unsigned long address); | 18 | extern pte_t *va_to_pte(unsigned long address); |
diff --git a/include/asm-ppc/ppcboot.h b/include/asm-ppc/ppcboot.h index fe24e4520208..6b7b63f71daa 100644 --- a/include/asm-ppc/ppcboot.h +++ b/include/asm-ppc/ppcboot.h | |||
| @@ -73,8 +73,8 @@ typedef struct bd_info { | |||
| 73 | #if defined(CONFIG_HYMOD) | 73 | #if defined(CONFIG_HYMOD) |
| 74 | hymod_conf_t bi_hymod_conf; /* hymod configuration information */ | 74 | hymod_conf_t bi_hymod_conf; /* hymod configuration information */ |
| 75 | #endif | 75 | #endif |
| 76 | #if defined(CONFIG_EVB64260) || defined(CONFIG_44x) || defined(CONFIG_85xx) ||\ | 76 | #if defined(CONFIG_EVB64260) || defined(CONFIG_405EP) || defined(CONFIG_44x) || \ |
| 77 | defined(CONFIG_83xx) | 77 | defined(CONFIG_85xx) || defined(CONFIG_83xx) |
| 78 | /* second onboard ethernet port */ | 78 | /* second onboard ethernet port */ |
| 79 | unsigned char bi_enet1addr[6]; | 79 | unsigned char bi_enet1addr[6]; |
| 80 | #endif | 80 | #endif |
| @@ -96,5 +96,7 @@ typedef struct bd_info { | |||
| 96 | #endif | 96 | #endif |
| 97 | } bd_t; | 97 | } bd_t; |
| 98 | 98 | ||
| 99 | #define bi_tbfreq bi_intfreq | ||
| 100 | |||
| 99 | #endif /* __ASSEMBLY__ */ | 101 | #endif /* __ASSEMBLY__ */ |
| 100 | #endif /* __ASM_PPCBOOT_H__ */ | 102 | #endif /* __ASM_PPCBOOT_H__ */ |
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h index 75c0637acdc8..3e39827ed566 100644 --- a/include/asm-ppc/prom.h +++ b/include/asm-ppc/prom.h | |||
| @@ -93,7 +93,7 @@ extern int device_is_compatible(struct device_node *device, const char *); | |||
| 93 | extern int machine_is_compatible(const char *compat); | 93 | extern int machine_is_compatible(const char *compat); |
| 94 | extern unsigned char *get_property(struct device_node *node, const char *name, | 94 | extern unsigned char *get_property(struct device_node *node, const char *name, |
| 95 | int *lenp); | 95 | int *lenp); |
| 96 | extern void prom_add_property(struct device_node* np, struct property* prop); | 96 | extern int prom_add_property(struct device_node* np, struct property* prop); |
| 97 | extern void prom_get_irq_senses(unsigned char *, int, int); | 97 | extern void prom_get_irq_senses(unsigned char *, int, int); |
| 98 | extern int prom_n_addr_cells(struct device_node* np); | 98 | extern int prom_n_addr_cells(struct device_node* np); |
| 99 | extern int prom_n_size_cells(struct device_node* np); | 99 | extern int prom_n_size_cells(struct device_node* np); |
diff --git a/include/asm-ppc/rio.h b/include/asm-ppc/rio.h new file mode 100644 index 000000000000..0018bf80cb25 --- /dev/null +++ b/include/asm-ppc/rio.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | /* | ||
| 2 | * RapidIO architecture support | ||
| 3 | * | ||
| 4 | * Copyright 2005 MontaVista Software, Inc. | ||
| 5 | * Matt Porter <mporter@kernel.crashing.org> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef ASM_PPC_RIO_H | ||
| 14 | #define ASM_PPC_RIO_H | ||
| 15 | |||
| 16 | extern void platform_rio_init(void); | ||
| 17 | |||
| 18 | #endif /* ASM_PPC_RIO_H */ | ||
diff --git a/include/asm-ppc64/ide.h b/include/asm-ppc64/ide.h deleted file mode 100644 index 0aae1c590c0e..000000000000 --- a/include/asm-ppc64/ide.h +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/asm-ppc/ide.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 1994-1996 Linus Torvalds & authors | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the License, or (at your option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This file contains the ppc64 architecture specific IDE code. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __ASMPPC64_IDE_H | ||
| 17 | #define __ASMPPC64_IDE_H | ||
| 18 | |||
| 19 | #ifdef __KERNEL__ | ||
| 20 | |||
| 21 | #ifndef MAX_HWIFS | ||
| 22 | # define MAX_HWIFS 10 | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #define IDE_ARCH_OBSOLETE_INIT | ||
| 26 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 27 | |||
| 28 | #endif /* __KERNEL__ */ | ||
| 29 | |||
| 30 | #endif /* __ASMPPC64_IDE_H */ | ||
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index e0505acb77d9..4c18a5cb69f5 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h | |||
| @@ -48,13 +48,21 @@ extern char initial_stab[]; | |||
| 48 | 48 | ||
| 49 | /* Bits in the SLB VSID word */ | 49 | /* Bits in the SLB VSID word */ |
| 50 | #define SLB_VSID_SHIFT 12 | 50 | #define SLB_VSID_SHIFT 12 |
| 51 | #define SLB_VSID_B ASM_CONST(0xc000000000000000) | ||
| 52 | #define SLB_VSID_B_256M ASM_CONST(0x0000000000000000) | ||
| 53 | #define SLB_VSID_B_1T ASM_CONST(0x4000000000000000) | ||
| 51 | #define SLB_VSID_KS ASM_CONST(0x0000000000000800) | 54 | #define SLB_VSID_KS ASM_CONST(0x0000000000000800) |
| 52 | #define SLB_VSID_KP ASM_CONST(0x0000000000000400) | 55 | #define SLB_VSID_KP ASM_CONST(0x0000000000000400) |
| 53 | #define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ | 56 | #define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ |
| 54 | #define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage */ | 57 | #define SLB_VSID_L ASM_CONST(0x0000000000000100) |
| 55 | #define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ | 58 | #define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ |
| 56 | #define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */ | 59 | #define SLB_VSID_LP ASM_CONST(0x0000000000000030) |
| 57 | 60 | #define SLB_VSID_LP_00 ASM_CONST(0x0000000000000000) | |
| 61 | #define SLB_VSID_LP_01 ASM_CONST(0x0000000000000010) | ||
| 62 | #define SLB_VSID_LP_10 ASM_CONST(0x0000000000000020) | ||
| 63 | #define SLB_VSID_LP_11 ASM_CONST(0x0000000000000030) | ||
| 64 | #define SLB_VSID_LLP (SLB_VSID_L|SLB_VSID_LP) | ||
| 65 | |||
| 58 | #define SLB_VSID_KERNEL (SLB_VSID_KP) | 66 | #define SLB_VSID_KERNEL (SLB_VSID_KP) |
| 59 | #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C) | 67 | #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C) |
| 60 | 68 | ||
| @@ -69,6 +77,7 @@ extern char initial_stab[]; | |||
| 69 | #define HPTE_V_AVPN_SHIFT 7 | 77 | #define HPTE_V_AVPN_SHIFT 7 |
| 70 | #define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80) | 78 | #define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80) |
| 71 | #define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT) | 79 | #define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT) |
| 80 | #define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & HPTE_V_AVPN)) | ||
| 72 | #define HPTE_V_BOLTED ASM_CONST(0x0000000000000010) | 81 | #define HPTE_V_BOLTED ASM_CONST(0x0000000000000010) |
| 73 | #define HPTE_V_LOCK ASM_CONST(0x0000000000000008) | 82 | #define HPTE_V_LOCK ASM_CONST(0x0000000000000008) |
| 74 | #define HPTE_V_LARGE ASM_CONST(0x0000000000000004) | 83 | #define HPTE_V_LARGE ASM_CONST(0x0000000000000004) |
| @@ -81,6 +90,7 @@ extern char initial_stab[]; | |||
| 81 | #define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000) | 90 | #define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000) |
| 82 | #define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff) | 91 | #define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff) |
| 83 | #define HPTE_R_PP ASM_CONST(0x0000000000000003) | 92 | #define HPTE_R_PP ASM_CONST(0x0000000000000003) |
| 93 | #define HPTE_R_N ASM_CONST(0x0000000000000004) | ||
| 84 | 94 | ||
| 85 | /* Values for PP (assumes Ks=0, Kp=1) */ | 95 | /* Values for PP (assumes Ks=0, Kp=1) */ |
| 86 | /* pp0 will always be 0 for linux */ | 96 | /* pp0 will always be 0 for linux */ |
| @@ -99,100 +109,120 @@ typedef struct { | |||
| 99 | extern hpte_t *htab_address; | 109 | extern hpte_t *htab_address; |
| 100 | extern unsigned long htab_hash_mask; | 110 | extern unsigned long htab_hash_mask; |
| 101 | 111 | ||
| 102 | static inline unsigned long hpt_hash(unsigned long vpn, int large) | 112 | /* |
| 113 | * Page size definition | ||
| 114 | * | ||
| 115 | * shift : is the "PAGE_SHIFT" value for that page size | ||
| 116 | * sllp : is a bit mask with the value of SLB L || LP to be or'ed | ||
| 117 | * directly to a slbmte "vsid" value | ||
| 118 | * penc : is the HPTE encoding mask for the "LP" field: | ||
| 119 | * | ||
| 120 | */ | ||
| 121 | struct mmu_psize_def | ||
| 103 | { | 122 | { |
| 104 | unsigned long vsid; | 123 | unsigned int shift; /* number of bits */ |
| 105 | unsigned long page; | 124 | unsigned int penc; /* HPTE encoding */ |
| 106 | 125 | unsigned int tlbiel; /* tlbiel supported for that page size */ | |
| 107 | if (large) { | 126 | unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */ |
| 108 | vsid = vpn >> 4; | 127 | unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */ |
| 109 | page = vpn & 0xf; | 128 | }; |
| 110 | } else { | ||
| 111 | vsid = vpn >> 16; | ||
| 112 | page = vpn & 0xffff; | ||
| 113 | } | ||
| 114 | 129 | ||
| 115 | return (vsid & 0x7fffffffffUL) ^ page; | 130 | #endif /* __ASSEMBLY__ */ |
| 116 | } | ||
| 117 | |||
| 118 | static inline void __tlbie(unsigned long va, int large) | ||
| 119 | { | ||
| 120 | /* clear top 16 bits, non SLS segment */ | ||
| 121 | va &= ~(0xffffULL << 48); | ||
| 122 | |||
| 123 | if (large) { | ||
| 124 | va &= HPAGE_MASK; | ||
| 125 | asm volatile("tlbie %0,1" : : "r"(va) : "memory"); | ||
| 126 | } else { | ||
| 127 | va &= PAGE_MASK; | ||
| 128 | asm volatile("tlbie %0,0" : : "r"(va) : "memory"); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | 131 | ||
| 132 | static inline void tlbie(unsigned long va, int large) | 132 | /* |
| 133 | { | 133 | * The kernel use the constants below to index in the page sizes array. |
| 134 | asm volatile("ptesync": : :"memory"); | 134 | * The use of fixed constants for this purpose is better for performances |
| 135 | __tlbie(va, large); | 135 | * of the low level hash refill handlers. |
| 136 | asm volatile("eieio; tlbsync; ptesync": : :"memory"); | 136 | * |
| 137 | } | 137 | * A non supported page size has a "shift" field set to 0 |
| 138 | * | ||
| 139 | * Any new page size being implemented can get a new entry in here. Whether | ||
| 140 | * the kernel will use it or not is a different matter though. The actual page | ||
| 141 | * size used by hugetlbfs is not defined here and may be made variable | ||
| 142 | */ | ||
| 138 | 143 | ||
| 139 | static inline void __tlbiel(unsigned long va) | 144 | #define MMU_PAGE_4K 0 /* 4K */ |
| 140 | { | 145 | #define MMU_PAGE_64K 1 /* 64K */ |
| 141 | /* clear top 16 bits, non SLS segment */ | 146 | #define MMU_PAGE_64K_AP 2 /* 64K Admixed (in a 4K segment) */ |
| 142 | va &= ~(0xffffULL << 48); | 147 | #define MMU_PAGE_1M 3 /* 1M */ |
| 143 | va &= PAGE_MASK; | 148 | #define MMU_PAGE_16M 4 /* 16M */ |
| 144 | 149 | #define MMU_PAGE_16G 5 /* 16G */ | |
| 145 | /* | 150 | #define MMU_PAGE_COUNT 6 |
| 146 | * Thanks to Alan Modra we are now able to use machine specific | ||
| 147 | * assembly instructions (like tlbiel) by using the gas -many flag. | ||
| 148 | * However we have to support older toolchains so for the moment | ||
| 149 | * we hardwire it. | ||
| 150 | */ | ||
| 151 | #if 0 | ||
| 152 | asm volatile("tlbiel %0" : : "r"(va) : "memory"); | ||
| 153 | #else | ||
| 154 | asm volatile(".long 0x7c000224 | (%0 << 11)" : : "r"(va) : "memory"); | ||
| 155 | #endif | ||
| 156 | } | ||
| 157 | 151 | ||
| 158 | static inline void tlbiel(unsigned long va) | 152 | #ifndef __ASSEMBLY__ |
| 159 | { | ||
| 160 | asm volatile("ptesync": : :"memory"); | ||
| 161 | __tlbiel(va); | ||
| 162 | asm volatile("ptesync": : :"memory"); | ||
| 163 | } | ||
| 164 | 153 | ||
| 165 | static inline unsigned long slot2va(unsigned long hpte_v, unsigned long slot) | 154 | /* |
| 166 | { | 155 | * The current system page sizes |
| 167 | unsigned long avpn = HPTE_V_AVPN_VAL(hpte_v); | 156 | */ |
| 168 | unsigned long va; | 157 | extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; |
| 158 | extern int mmu_linear_psize; | ||
| 159 | extern int mmu_virtual_psize; | ||
| 169 | 160 | ||
| 170 | va = avpn << 23; | 161 | #ifdef CONFIG_HUGETLB_PAGE |
| 162 | /* | ||
| 163 | * The page size index of the huge pages for use by hugetlbfs | ||
| 164 | */ | ||
| 165 | extern int mmu_huge_psize; | ||
| 171 | 166 | ||
| 172 | if (! (hpte_v & HPTE_V_LARGE)) { | 167 | #endif /* CONFIG_HUGETLB_PAGE */ |
| 173 | unsigned long vpi, pteg; | ||
| 174 | 168 | ||
| 175 | pteg = slot / HPTES_PER_GROUP; | 169 | /* |
| 176 | if (hpte_v & HPTE_V_SECONDARY) | 170 | * This function sets the AVPN and L fields of the HPTE appropriately |
| 177 | pteg = ~pteg; | 171 | * for the page size |
| 172 | */ | ||
| 173 | static inline unsigned long hpte_encode_v(unsigned long va, int psize) | ||
| 174 | { | ||
| 175 | unsigned long v = | ||
| 176 | v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm); | ||
| 177 | v <<= HPTE_V_AVPN_SHIFT; | ||
| 178 | if (psize != MMU_PAGE_4K) | ||
| 179 | v |= HPTE_V_LARGE; | ||
| 180 | return v; | ||
| 181 | } | ||
| 178 | 182 | ||
| 179 | vpi = ((va >> 28) ^ pteg) & htab_hash_mask; | 183 | /* |
| 184 | * This function sets the ARPN, and LP fields of the HPTE appropriately | ||
| 185 | * for the page size. We assume the pa is already "clean" that is properly | ||
| 186 | * aligned for the requested page size | ||
| 187 | */ | ||
| 188 | static inline unsigned long hpte_encode_r(unsigned long pa, int psize) | ||
| 189 | { | ||
| 190 | unsigned long r; | ||
| 180 | 191 | ||
| 181 | va |= vpi << PAGE_SHIFT; | 192 | /* A 4K page needs no special encoding */ |
| 193 | if (psize == MMU_PAGE_4K) | ||
| 194 | return pa & HPTE_R_RPN; | ||
| 195 | else { | ||
| 196 | unsigned int penc = mmu_psize_defs[psize].penc; | ||
| 197 | unsigned int shift = mmu_psize_defs[psize].shift; | ||
| 198 | return (pa & ~((1ul << shift) - 1)) | (penc << 12); | ||
| 182 | } | 199 | } |
| 183 | 200 | return r; | |
| 184 | return va; | ||
| 185 | } | 201 | } |
| 186 | 202 | ||
| 187 | /* | 203 | /* |
| 188 | * Handle a fault by adding an HPTE. If the address can't be determined | 204 | * This hashes a virtual address for a 256Mb segment only for now |
| 189 | * to be valid via Linux page tables, return 1. If handled return 0 | ||
| 190 | */ | 205 | */ |
| 191 | extern int __hash_page(unsigned long ea, unsigned long access, | 206 | |
| 192 | unsigned long vsid, pte_t *ptep, unsigned long trap, | 207 | static inline unsigned long hpt_hash(unsigned long va, unsigned int shift) |
| 193 | int local); | 208 | { |
| 209 | return ((va >> 28) & 0x7fffffffffUL) ^ ((va & 0x0fffffffUL) >> shift); | ||
| 210 | } | ||
| 211 | |||
| 212 | extern int __hash_page_4K(unsigned long ea, unsigned long access, | ||
| 213 | unsigned long vsid, pte_t *ptep, unsigned long trap, | ||
| 214 | unsigned int local); | ||
| 215 | extern int __hash_page_64K(unsigned long ea, unsigned long access, | ||
| 216 | unsigned long vsid, pte_t *ptep, unsigned long trap, | ||
| 217 | unsigned int local); | ||
| 218 | struct mm_struct; | ||
| 219 | extern int hash_huge_page(struct mm_struct *mm, unsigned long access, | ||
| 220 | unsigned long ea, unsigned long vsid, int local); | ||
| 194 | 221 | ||
| 195 | extern void htab_finish_init(void); | 222 | extern void htab_finish_init(void); |
| 223 | extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | ||
| 224 | unsigned long pstart, unsigned long mode, | ||
| 225 | int psize); | ||
| 196 | 226 | ||
| 197 | extern void hpte_init_native(void); | 227 | extern void hpte_init_native(void); |
| 198 | extern void hpte_init_lpar(void); | 228 | extern void hpte_init_lpar(void); |
| @@ -200,17 +230,21 @@ extern void hpte_init_iSeries(void); | |||
| 200 | 230 | ||
| 201 | extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, | 231 | extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, |
| 202 | unsigned long va, unsigned long prpn, | 232 | unsigned long va, unsigned long prpn, |
| 203 | unsigned long vflags, | 233 | unsigned long rflags, |
| 204 | unsigned long rflags); | 234 | unsigned long vflags, int psize); |
| 205 | extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, | 235 | |
| 206 | unsigned long prpn, | 236 | extern long native_hpte_insert(unsigned long hpte_group, |
| 207 | unsigned long vflags, unsigned long rflags); | 237 | unsigned long va, unsigned long prpn, |
| 238 | unsigned long rflags, | ||
| 239 | unsigned long vflags, int psize); | ||
| 208 | 240 | ||
| 209 | extern long iSeries_hpte_bolt_or_insert(unsigned long hpte_group, | 241 | extern long iSeries_hpte_insert(unsigned long hpte_group, |
| 210 | unsigned long va, unsigned long prpn, | 242 | unsigned long va, unsigned long prpn, |
| 211 | unsigned long vflags, unsigned long rflags); | 243 | unsigned long rflags, |
| 244 | unsigned long vflags, int psize); | ||
| 212 | 245 | ||
| 213 | extern void stabs_alloc(void); | 246 | extern void stabs_alloc(void); |
| 247 | extern void slb_initialize(void); | ||
| 214 | 248 | ||
| 215 | #endif /* __ASSEMBLY__ */ | 249 | #endif /* __ASSEMBLY__ */ |
| 216 | 250 | ||
diff --git a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h index 820dd729b895..4f512e9fa6b8 100644 --- a/include/asm-ppc64/mmu_context.h +++ b/include/asm-ppc64/mmu_context.h | |||
| @@ -16,8 +16,16 @@ | |||
| 16 | * 2 of the License, or (at your option) any later version. | 16 | * 2 of the License, or (at your option) any later version. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | 19 | /* |
| 20 | * Getting into a kernel thread, there is no valid user segment, mark | ||
| 21 | * paca->pgdir NULL so that SLB miss on user addresses will fault | ||
| 22 | */ | ||
| 23 | static inline void enter_lazy_tlb(struct mm_struct *mm, | ||
| 24 | struct task_struct *tsk) | ||
| 20 | { | 25 | { |
| 26 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 27 | get_paca()->pgdir = NULL; | ||
| 28 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
| 21 | } | 29 | } |
| 22 | 30 | ||
| 23 | #define NO_CONTEXT 0 | 31 | #define NO_CONTEXT 0 |
| @@ -40,8 +48,13 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
| 40 | cpu_set(smp_processor_id(), next->cpu_vm_mask); | 48 | cpu_set(smp_processor_id(), next->cpu_vm_mask); |
| 41 | 49 | ||
| 42 | /* No need to flush userspace segments if the mm doesnt change */ | 50 | /* No need to flush userspace segments if the mm doesnt change */ |
| 51 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 52 | if (prev == next && get_paca()->pgdir == next->pgd) | ||
| 53 | return; | ||
| 54 | #else | ||
| 43 | if (prev == next) | 55 | if (prev == next) |
| 44 | return; | 56 | return; |
| 57 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
| 45 | 58 | ||
| 46 | #ifdef CONFIG_ALTIVEC | 59 | #ifdef CONFIG_ALTIVEC |
| 47 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) | 60 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) |
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index f68fe91debaf..bccacd6aa93a 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h | |||
| @@ -72,10 +72,15 @@ struct paca_struct { | |||
| 72 | /* | 72 | /* |
| 73 | * Now, starting in cacheline 2, the exception save areas | 73 | * Now, starting in cacheline 2, the exception save areas |
| 74 | */ | 74 | */ |
| 75 | u64 exgen[8] __attribute__((aligned(0x80))); /* used for most interrupts/exceptions */ | 75 | /* used for most interrupts/exceptions */ |
| 76 | u64 exmc[8]; /* used for machine checks */ | 76 | u64 exgen[10] __attribute__((aligned(0x80))); |
| 77 | u64 exslb[8]; /* used for SLB/segment table misses | 77 | u64 exmc[10]; /* used for machine checks */ |
| 78 | * on the linear mapping */ | 78 | u64 exslb[10]; /* used for SLB/segment table misses |
| 79 | * on the linear mapping */ | ||
| 80 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 81 | pgd_t *pgdir; | ||
| 82 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
| 83 | |||
| 79 | mm_context_t context; | 84 | mm_context_t context; |
| 80 | u16 slb_cache[SLB_CACHE_ENTRIES]; | 85 | u16 slb_cache[SLB_CACHE_ENTRIES]; |
| 81 | u16 slb_cache_ptr; | 86 | u16 slb_cache_ptr; |
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index d404431f0a9a..82ce187e5be8 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h | |||
| @@ -13,32 +13,59 @@ | |||
| 13 | #include <linux/config.h> | 13 | #include <linux/config.h> |
| 14 | #include <asm/ppc_asm.h> /* for ASM_CONST */ | 14 | #include <asm/ppc_asm.h> /* for ASM_CONST */ |
| 15 | 15 | ||
| 16 | /* PAGE_SHIFT determines the page size */ | 16 | /* |
| 17 | #define PAGE_SHIFT 12 | 17 | * We support either 4k or 64k software page size. When using 64k pages |
| 18 | #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) | 18 | * however, wether we are really supporting 64k pages in HW or not is |
| 19 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 19 | * irrelevant to those definitions. We always define HW_PAGE_SHIFT to 12 |
| 20 | * as use of 64k pages remains a linux kernel specific, every notion of | ||
| 21 | * page number shared with the firmware, TCEs, iommu, etc... still assumes | ||
| 22 | * a page size of 4096. | ||
| 23 | */ | ||
| 24 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 25 | #define PAGE_SHIFT 16 | ||
| 26 | #else | ||
| 27 | #define PAGE_SHIFT 12 | ||
| 28 | #endif | ||
| 20 | 29 | ||
| 21 | #define SID_SHIFT 28 | 30 | #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) |
| 22 | #define SID_MASK 0xfffffffffUL | 31 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
| 23 | #define ESID_MASK 0xfffffffff0000000UL | ||
| 24 | #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) | ||
| 25 | 32 | ||
| 26 | #define HPAGE_SHIFT 24 | 33 | /* HW_PAGE_SHIFT is always 4k pages */ |
| 27 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | 34 | #define HW_PAGE_SHIFT 12 |
| 28 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 35 | #define HW_PAGE_SIZE (ASM_CONST(1) << HW_PAGE_SHIFT) |
| 36 | #define HW_PAGE_MASK (~(HW_PAGE_SIZE-1)) | ||
| 29 | 37 | ||
| 30 | #ifdef CONFIG_HUGETLB_PAGE | 38 | /* PAGE_FACTOR is the number of bits factor between PAGE_SHIFT and |
| 39 | * HW_PAGE_SHIFT, that is 4k pages | ||
| 40 | */ | ||
| 41 | #define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT) | ||
| 42 | |||
| 43 | /* Segment size */ | ||
| 44 | #define SID_SHIFT 28 | ||
| 45 | #define SID_MASK 0xfffffffffUL | ||
| 46 | #define ESID_MASK 0xfffffffff0000000UL | ||
| 47 | #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) | ||
| 31 | 48 | ||
| 49 | /* Large pages size */ | ||
| 50 | |||
| 51 | #ifndef __ASSEMBLY__ | ||
| 52 | extern unsigned int HPAGE_SHIFT; | ||
| 53 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | ||
| 54 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | ||
| 32 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 55 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
| 56 | #endif /* __ASSEMBLY__ */ | ||
| 57 | |||
| 58 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 59 | |||
| 33 | 60 | ||
| 34 | #define HTLB_AREA_SHIFT 40 | 61 | #define HTLB_AREA_SHIFT 40 |
| 35 | #define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT) | 62 | #define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT) |
| 36 | #define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT) | 63 | #define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT) |
| 37 | 64 | ||
| 38 | #define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ | 65 | #define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ |
| 39 | - (1U << GET_ESID(addr))) & 0xffff) | 66 | - (1U << GET_ESID(addr))) & 0xffff) |
| 40 | #define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \ | 67 | #define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \ |
| 41 | - (1U << GET_HTLB_AREA(addr))) & 0xffff) | 68 | - (1U << GET_HTLB_AREA(addr))) & 0xffff) |
| 42 | 69 | ||
| 43 | #define ARCH_HAS_HUGEPAGE_ONLY_RANGE | 70 | #define ARCH_HAS_HUGEPAGE_ONLY_RANGE |
| 44 | #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE | 71 | #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE |
| @@ -114,7 +141,25 @@ static __inline__ void clear_page(void *addr) | |||
| 114 | : "ctr", "memory"); | 141 | : "ctr", "memory"); |
| 115 | } | 142 | } |
| 116 | 143 | ||
| 117 | extern void copy_page(void *to, void *from); | 144 | extern void copy_4K_page(void *to, void *from); |
| 145 | |||
| 146 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 147 | static inline void copy_page(void *to, void *from) | ||
| 148 | { | ||
| 149 | unsigned int i; | ||
| 150 | for (i=0; i < (1 << (PAGE_SHIFT - 12)); i++) { | ||
| 151 | copy_4K_page(to, from); | ||
| 152 | to += 4096; | ||
| 153 | from += 4096; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | #else /* CONFIG_PPC_64K_PAGES */ | ||
| 157 | static inline void copy_page(void *to, void *from) | ||
| 158 | { | ||
| 159 | copy_4K_page(to, from); | ||
| 160 | } | ||
| 161 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
| 162 | |||
| 118 | struct page; | 163 | struct page; |
| 119 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); | 164 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); |
| 120 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *p); | 165 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *p); |
| @@ -124,43 +169,75 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct pag | |||
| 124 | * These are used to make use of C type-checking. | 169 | * These are used to make use of C type-checking. |
| 125 | * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. | 170 | * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. |
| 126 | */ | 171 | */ |
| 127 | typedef struct { unsigned long pte; } pte_t; | ||
| 128 | typedef struct { unsigned long pmd; } pmd_t; | ||
| 129 | typedef struct { unsigned long pud; } pud_t; | ||
| 130 | typedef struct { unsigned long pgd; } pgd_t; | ||
| 131 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
| 132 | 172 | ||
| 173 | /* PTE level */ | ||
| 174 | typedef struct { unsigned long pte; } pte_t; | ||
| 133 | #define pte_val(x) ((x).pte) | 175 | #define pte_val(x) ((x).pte) |
| 134 | #define pmd_val(x) ((x).pmd) | ||
| 135 | #define pud_val(x) ((x).pud) | ||
| 136 | #define pgd_val(x) ((x).pgd) | ||
| 137 | #define pgprot_val(x) ((x).pgprot) | ||
| 138 | |||
| 139 | #define __pte(x) ((pte_t) { (x) }) | 176 | #define __pte(x) ((pte_t) { (x) }) |
| 177 | |||
| 178 | /* 64k pages additionally define a bigger "real PTE" type that gathers | ||
| 179 | * the "second half" part of the PTE for pseudo 64k pages | ||
| 180 | */ | ||
| 181 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 182 | typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; | ||
| 183 | #else | ||
| 184 | typedef struct { pte_t pte; } real_pte_t; | ||
| 185 | #endif | ||
| 186 | |||
| 187 | /* PMD level */ | ||
| 188 | typedef struct { unsigned long pmd; } pmd_t; | ||
| 189 | #define pmd_val(x) ((x).pmd) | ||
| 140 | #define __pmd(x) ((pmd_t) { (x) }) | 190 | #define __pmd(x) ((pmd_t) { (x) }) |
| 191 | |||
| 192 | /* PUD level exusts only on 4k pages */ | ||
| 193 | #ifndef CONFIG_PPC_64K_PAGES | ||
| 194 | typedef struct { unsigned long pud; } pud_t; | ||
| 195 | #define pud_val(x) ((x).pud) | ||
| 141 | #define __pud(x) ((pud_t) { (x) }) | 196 | #define __pud(x) ((pud_t) { (x) }) |
| 197 | #endif | ||
| 198 | |||
| 199 | /* PGD level */ | ||
| 200 | typedef struct { unsigned long pgd; } pgd_t; | ||
| 201 | #define pgd_val(x) ((x).pgd) | ||
| 142 | #define __pgd(x) ((pgd_t) { (x) }) | 202 | #define __pgd(x) ((pgd_t) { (x) }) |
| 203 | |||
| 204 | /* Page protection bits */ | ||
| 205 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
| 206 | #define pgprot_val(x) ((x).pgprot) | ||
| 143 | #define __pgprot(x) ((pgprot_t) { (x) }) | 207 | #define __pgprot(x) ((pgprot_t) { (x) }) |
| 144 | 208 | ||
| 145 | #else | 209 | #else |
| 210 | |||
| 146 | /* | 211 | /* |
| 147 | * .. while these make it easier on the compiler | 212 | * .. while these make it easier on the compiler |
| 148 | */ | 213 | */ |
| 149 | typedef unsigned long pte_t; | ||
| 150 | typedef unsigned long pmd_t; | ||
| 151 | typedef unsigned long pud_t; | ||
| 152 | typedef unsigned long pgd_t; | ||
| 153 | typedef unsigned long pgprot_t; | ||
| 154 | 214 | ||
| 215 | typedef unsigned long pte_t; | ||
| 155 | #define pte_val(x) (x) | 216 | #define pte_val(x) (x) |
| 217 | #define __pte(x) (x) | ||
| 218 | |||
| 219 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 220 | typedef struct { pte_t pte; unsigned long hidx; } real_pte_t; | ||
| 221 | #else | ||
| 222 | typedef unsigned long real_pte_t; | ||
| 223 | #endif | ||
| 224 | |||
| 225 | |||
| 226 | typedef unsigned long pmd_t; | ||
| 156 | #define pmd_val(x) (x) | 227 | #define pmd_val(x) (x) |
| 228 | #define __pmd(x) (x) | ||
| 229 | |||
| 230 | #ifndef CONFIG_PPC_64K_PAGES | ||
| 231 | typedef unsigned long pud_t; | ||
| 157 | #define pud_val(x) (x) | 232 | #define pud_val(x) (x) |
| 233 | #define __pud(x) (x) | ||
| 234 | #endif | ||
| 235 | |||
| 236 | typedef unsigned long pgd_t; | ||
| 158 | #define pgd_val(x) (x) | 237 | #define pgd_val(x) (x) |
| 159 | #define pgprot_val(x) (x) | 238 | #define pgprot_val(x) (x) |
| 160 | 239 | ||
| 161 | #define __pte(x) (x) | 240 | typedef unsigned long pgprot_t; |
| 162 | #define __pmd(x) (x) | ||
| 163 | #define __pud(x) (x) | ||
| 164 | #define __pgd(x) (x) | 241 | #define __pgd(x) (x) |
| 165 | #define __pgprot(x) (x) | 242 | #define __pgprot(x) (x) |
| 166 | 243 | ||
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h index 342e2d755550..fafdf885a3cc 100644 --- a/include/asm-ppc64/pci.h +++ b/include/asm-ppc64/pci.h | |||
| @@ -162,6 +162,14 @@ pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus); | |||
| 162 | 162 | ||
| 163 | extern struct pci_controller *init_phb_dynamic(struct device_node *dn); | 163 | extern struct pci_controller *init_phb_dynamic(struct device_node *dn); |
| 164 | 164 | ||
| 165 | extern struct pci_dev *of_create_pci_dev(struct device_node *node, | ||
| 166 | struct pci_bus *bus, int devfn); | ||
| 167 | |||
| 168 | extern void of_scan_pci_bridge(struct device_node *node, | ||
| 169 | struct pci_dev *dev); | ||
| 170 | |||
| 171 | extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); | ||
| 172 | |||
| 165 | extern int pci_read_irq_line(struct pci_dev *dev); | 173 | extern int pci_read_irq_line(struct pci_dev *dev); |
| 166 | 174 | ||
| 167 | extern void pcibios_add_platform_entries(struct pci_dev *dev); | 175 | extern void pcibios_add_platform_entries(struct pci_dev *dev); |
diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h index 26bc49c1108d..98da0e4262bd 100644 --- a/include/asm-ppc64/pgalloc.h +++ b/include/asm-ppc64/pgalloc.h | |||
| @@ -8,10 +8,16 @@ | |||
| 8 | 8 | ||
| 9 | extern kmem_cache_t *pgtable_cache[]; | 9 | extern kmem_cache_t *pgtable_cache[]; |
| 10 | 10 | ||
| 11 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 12 | #define PTE_CACHE_NUM 0 | ||
| 13 | #define PMD_CACHE_NUM 0 | ||
| 14 | #define PGD_CACHE_NUM 1 | ||
| 15 | #else | ||
| 11 | #define PTE_CACHE_NUM 0 | 16 | #define PTE_CACHE_NUM 0 |
| 12 | #define PMD_CACHE_NUM 1 | 17 | #define PMD_CACHE_NUM 1 |
| 13 | #define PUD_CACHE_NUM 1 | 18 | #define PUD_CACHE_NUM 1 |
| 14 | #define PGD_CACHE_NUM 0 | 19 | #define PGD_CACHE_NUM 0 |
| 20 | #endif | ||
| 15 | 21 | ||
| 16 | /* | 22 | /* |
| 17 | * This program is free software; you can redistribute it and/or | 23 | * This program is free software; you can redistribute it and/or |
| @@ -30,6 +36,8 @@ static inline void pgd_free(pgd_t *pgd) | |||
| 30 | kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd); | 36 | kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd); |
| 31 | } | 37 | } |
| 32 | 38 | ||
| 39 | #ifndef CONFIG_PPC_64K_PAGES | ||
| 40 | |||
| 33 | #define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD) | 41 | #define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD) |
| 34 | 42 | ||
| 35 | static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) | 43 | static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) |
| @@ -43,7 +51,30 @@ static inline void pud_free(pud_t *pud) | |||
| 43 | kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); | 51 | kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); |
| 44 | } | 52 | } |
| 45 | 53 | ||
| 46 | #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) | 54 | static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) |
| 55 | { | ||
| 56 | pud_set(pud, (unsigned long)pmd); | ||
| 57 | } | ||
| 58 | |||
| 59 | #define pmd_populate(mm, pmd, pte_page) \ | ||
| 60 | pmd_populate_kernel(mm, pmd, page_address(pte_page)) | ||
| 61 | #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, (unsigned long)(pte)) | ||
| 62 | |||
| 63 | |||
| 64 | #else /* CONFIG_PPC_64K_PAGES */ | ||
| 65 | |||
| 66 | #define pud_populate(mm, pud, pmd) pud_set(pud, (unsigned long)pmd) | ||
| 67 | |||
| 68 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, | ||
| 69 | pte_t *pte) | ||
| 70 | { | ||
| 71 | pmd_set(pmd, (unsigned long)pte); | ||
| 72 | } | ||
| 73 | |||
| 74 | #define pmd_populate(mm, pmd, pte_page) \ | ||
| 75 | pmd_populate_kernel(mm, pmd, page_address(pte_page)) | ||
| 76 | |||
| 77 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
| 47 | 78 | ||
| 48 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) | 79 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) |
| 49 | { | 80 | { |
| @@ -56,17 +87,15 @@ static inline void pmd_free(pmd_t *pmd) | |||
| 56 | kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); | 87 | kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); |
| 57 | } | 88 | } |
| 58 | 89 | ||
| 59 | #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) | 90 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
| 60 | #define pmd_populate(mm, pmd, pte_page) \ | 91 | unsigned long address) |
| 61 | pmd_populate_kernel(mm, pmd, page_address(pte_page)) | ||
| 62 | |||
| 63 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | ||
| 64 | { | 92 | { |
| 65 | return kmem_cache_alloc(pgtable_cache[PTE_CACHE_NUM], | 93 | return kmem_cache_alloc(pgtable_cache[PTE_CACHE_NUM], |
| 66 | GFP_KERNEL|__GFP_REPEAT); | 94 | GFP_KERNEL|__GFP_REPEAT); |
| 67 | } | 95 | } |
| 68 | 96 | ||
| 69 | static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 97 | static inline struct page *pte_alloc_one(struct mm_struct *mm, |
| 98 | unsigned long address) | ||
| 70 | { | 99 | { |
| 71 | return virt_to_page(pte_alloc_one_kernel(mm, address)); | 100 | return virt_to_page(pte_alloc_one_kernel(mm, address)); |
| 72 | } | 101 | } |
| @@ -103,7 +132,7 @@ static inline void pgtable_free(pgtable_free_t pgf) | |||
| 103 | kmem_cache_free(pgtable_cache[cachenum], p); | 132 | kmem_cache_free(pgtable_cache[cachenum], p); |
| 104 | } | 133 | } |
| 105 | 134 | ||
| 106 | void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); | 135 | extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); |
| 107 | 136 | ||
| 108 | #define __pte_free_tlb(tlb, ptepage) \ | 137 | #define __pte_free_tlb(tlb, ptepage) \ |
| 109 | pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \ | 138 | pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \ |
| @@ -111,9 +140,11 @@ void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); | |||
| 111 | #define __pmd_free_tlb(tlb, pmd) \ | 140 | #define __pmd_free_tlb(tlb, pmd) \ |
| 112 | pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ | 141 | pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ |
| 113 | PMD_CACHE_NUM, PMD_TABLE_SIZE-1)) | 142 | PMD_CACHE_NUM, PMD_TABLE_SIZE-1)) |
| 143 | #ifndef CONFIG_PPC_64K_PAGES | ||
| 114 | #define __pud_free_tlb(tlb, pmd) \ | 144 | #define __pud_free_tlb(tlb, pmd) \ |
| 115 | pgtable_free_tlb(tlb, pgtable_free_cache(pud, \ | 145 | pgtable_free_tlb(tlb, pgtable_free_cache(pud, \ |
| 116 | PUD_CACHE_NUM, PUD_TABLE_SIZE-1)) | 146 | PUD_CACHE_NUM, PUD_TABLE_SIZE-1)) |
| 147 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
| 117 | 148 | ||
| 118 | #define check_pgt_cache() do { } while (0) | 149 | #define check_pgt_cache() do { } while (0) |
| 119 | 150 | ||
diff --git a/include/asm-ppc64/pgtable-4k.h b/include/asm-ppc64/pgtable-4k.h new file mode 100644 index 000000000000..e9590c06ad92 --- /dev/null +++ b/include/asm-ppc64/pgtable-4k.h | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | /* | ||
| 2 | * Entries per page directory level. The PTE level must use a 64b record | ||
| 3 | * for each page table entry. The PMD and PGD level use a 32b record for | ||
| 4 | * each entry by assuming that each entry is page aligned. | ||
| 5 | */ | ||
| 6 | #define PTE_INDEX_SIZE 9 | ||
| 7 | #define PMD_INDEX_SIZE 7 | ||
| 8 | #define PUD_INDEX_SIZE 7 | ||
| 9 | #define PGD_INDEX_SIZE 9 | ||
| 10 | |||
| 11 | #define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) | ||
| 12 | #define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) | ||
| 13 | #define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) | ||
| 14 | #define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) | ||
| 15 | |||
| 16 | #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) | ||
| 17 | #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) | ||
| 18 | #define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) | ||
| 19 | #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) | ||
| 20 | |||
| 21 | /* PMD_SHIFT determines what a second-level page table entry can map */ | ||
| 22 | #define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE) | ||
| 23 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
| 24 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
| 25 | |||
| 26 | /* With 4k base page size, hugepage PTEs go at the PMD level */ | ||
| 27 | #define MIN_HUGEPTE_SHIFT PMD_SHIFT | ||
| 28 | |||
| 29 | /* PUD_SHIFT determines what a third-level page table entry can map */ | ||
| 30 | #define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) | ||
| 31 | #define PUD_SIZE (1UL << PUD_SHIFT) | ||
| 32 | #define PUD_MASK (~(PUD_SIZE-1)) | ||
| 33 | |||
| 34 | /* PGDIR_SHIFT determines what a fourth-level page table entry can map */ | ||
| 35 | #define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE) | ||
| 36 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
| 37 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
| 38 | |||
| 39 | /* PTE bits */ | ||
| 40 | #define _PAGE_SECONDARY 0x8000 /* software: HPTE is in secondary group */ | ||
| 41 | #define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */ | ||
| 42 | #define _PAGE_F_SECOND _PAGE_SECONDARY | ||
| 43 | #define _PAGE_F_GIX _PAGE_GROUP_IX | ||
| 44 | |||
| 45 | /* PTE flags to conserve for HPTE identification */ | ||
| 46 | #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \ | ||
| 47 | _PAGE_SECONDARY | _PAGE_GROUP_IX) | ||
| 48 | |||
| 49 | /* PAGE_MASK gives the right answer below, but only by accident */ | ||
| 50 | /* It should be preserving the high 48 bits and then specifically */ | ||
| 51 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ | ||
| 52 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ | ||
| 53 | _PAGE_HPTEFLAGS) | ||
| 54 | |||
| 55 | /* Bits to mask out from a PMD to get to the PTE page */ | ||
| 56 | #define PMD_MASKED_BITS 0 | ||
| 57 | /* Bits to mask out from a PUD to get to the PMD page */ | ||
| 58 | #define PUD_MASKED_BITS 0 | ||
| 59 | /* Bits to mask out from a PGD to get to the PUD page */ | ||
| 60 | #define PGD_MASKED_BITS 0 | ||
| 61 | |||
| 62 | /* shift to put page number into pte */ | ||
| 63 | #define PTE_RPN_SHIFT (17) | ||
| 64 | |||
| 65 | #define __real_pte(e,p) ((real_pte_t)(e)) | ||
| 66 | #define __rpte_to_pte(r) (r) | ||
| 67 | #define __rpte_to_hidx(r,index) (pte_val((r)) >> 12) | ||
| 68 | |||
| 69 | #define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \ | ||
| 70 | do { \ | ||
| 71 | index = 0; \ | ||
| 72 | shift = mmu_psize_defs[psize].shift; \ | ||
| 73 | |||
| 74 | #define pte_iterate_hashed_end() } while(0) | ||
| 75 | |||
| 76 | /* | ||
| 77 | * 4-level page tables related bits | ||
| 78 | */ | ||
| 79 | |||
| 80 | #define pgd_none(pgd) (!pgd_val(pgd)) | ||
| 81 | #define pgd_bad(pgd) (pgd_val(pgd) == 0) | ||
| 82 | #define pgd_present(pgd) (pgd_val(pgd) != 0) | ||
| 83 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) | ||
| 84 | #define pgd_page(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) | ||
| 85 | |||
| 86 | #define pud_offset(pgdp, addr) \ | ||
| 87 | (((pud_t *) pgd_page(*(pgdp))) + \ | ||
| 88 | (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) | ||
| 89 | |||
| 90 | #define pud_ERROR(e) \ | ||
| 91 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pud_val(e)) | ||
diff --git a/include/asm-ppc64/pgtable-64k.h b/include/asm-ppc64/pgtable-64k.h new file mode 100644 index 000000000000..154f1840ece4 --- /dev/null +++ b/include/asm-ppc64/pgtable-64k.h | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | #include <asm-generic/pgtable-nopud.h> | ||
| 2 | |||
| 3 | |||
| 4 | #define PTE_INDEX_SIZE 12 | ||
| 5 | #define PMD_INDEX_SIZE 12 | ||
| 6 | #define PUD_INDEX_SIZE 0 | ||
| 7 | #define PGD_INDEX_SIZE 4 | ||
| 8 | |||
| 9 | #define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE) | ||
| 10 | #define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) | ||
| 11 | #define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) | ||
| 12 | |||
| 13 | #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) | ||
| 14 | #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) | ||
| 15 | #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) | ||
| 16 | |||
| 17 | /* With 4k base page size, hugepage PTEs go at the PMD level */ | ||
| 18 | #define MIN_HUGEPTE_SHIFT PAGE_SHIFT | ||
| 19 | |||
| 20 | /* PMD_SHIFT determines what a second-level page table entry can map */ | ||
| 21 | #define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE) | ||
| 22 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
| 23 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
| 24 | |||
| 25 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
| 26 | #define PGDIR_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) | ||
| 27 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
| 28 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
| 29 | |||
| 30 | /* Additional PTE bits (don't change without checking asm in hash_low.S) */ | ||
| 31 | #define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */ | ||
| 32 | #define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */ | ||
| 33 | #define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */ | ||
| 34 | #define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */ | ||
| 35 | #define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */ | ||
| 36 | |||
| 37 | /* PTE flags to conserve for HPTE identification */ | ||
| 38 | #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_HPTE_SUB |\ | ||
| 39 | _PAGE_COMBO) | ||
| 40 | |||
| 41 | /* Shift to put page number into pte. | ||
| 42 | * | ||
| 43 | * That gives us a max RPN of 32 bits, which means a max of 48 bits | ||
| 44 | * of addressable physical space. | ||
| 45 | * We could get 3 more bits here by setting PTE_RPN_SHIFT to 29 but | ||
| 46 | * 32 makes PTEs more readable for debugging for now :) | ||
| 47 | */ | ||
| 48 | #define PTE_RPN_SHIFT (32) | ||
| 49 | #define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT)) | ||
| 50 | #define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1)) | ||
| 51 | |||
| 52 | /* _PAGE_CHG_MASK masks of bits that are to be preserved accross | ||
| 53 | * pgprot changes | ||
| 54 | */ | ||
| 55 | #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ | ||
| 56 | _PAGE_ACCESSED) | ||
| 57 | |||
| 58 | /* Bits to mask out from a PMD to get to the PTE page */ | ||
| 59 | #define PMD_MASKED_BITS 0x1ff | ||
| 60 | /* Bits to mask out from a PGD/PUD to get to the PMD page */ | ||
| 61 | #define PUD_MASKED_BITS 0x1ff | ||
| 62 | |||
| 63 | #ifndef __ASSEMBLY__ | ||
| 64 | |||
| 65 | /* Manipulate "rpte" values */ | ||
| 66 | #define __real_pte(e,p) ((real_pte_t) { \ | ||
| 67 | (e), pte_val(*((p) + PTRS_PER_PTE)) }) | ||
| 68 | #define __rpte_to_hidx(r,index) ((pte_val((r).pte) & _PAGE_COMBO) ? \ | ||
| 69 | (((r).hidx >> ((index)<<2)) & 0xf) : ((pte_val((r).pte) >> 12) & 0xf)) | ||
| 70 | #define __rpte_to_pte(r) ((r).pte) | ||
| 71 | #define __rpte_sub_valid(rpte, index) \ | ||
| 72 | (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index))) | ||
| 73 | |||
| 74 | |||
| 75 | /* Trick: we set __end to va + 64k, which happens works for | ||
| 76 | * a 16M page as well as we want only one iteration | ||
| 77 | */ | ||
| 78 | #define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \ | ||
| 79 | do { \ | ||
| 80 | unsigned long __end = va + PAGE_SIZE; \ | ||
| 81 | unsigned __split = (psize == MMU_PAGE_4K || \ | ||
| 82 | psize == MMU_PAGE_64K_AP); \ | ||
| 83 | shift = mmu_psize_defs[psize].shift; \ | ||
| 84 | for (index = 0; va < __end; index++, va += (1 << shift)) { \ | ||
| 85 | if (!__split || __rpte_sub_valid(rpte, index)) do { \ | ||
| 86 | |||
| 87 | #define pte_iterate_hashed_end() } while(0); } } while(0) | ||
| 88 | |||
| 89 | |||
| 90 | #endif /* __ASSEMBLY__ */ | ||
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h index 8c3f574046b6..a9783ba7fe98 100644 --- a/include/asm-ppc64/pgtable.h +++ b/include/asm-ppc64/pgtable.h | |||
| @@ -13,42 +13,14 @@ | |||
| 13 | #include <asm/mmu.h> | 13 | #include <asm/mmu.h> |
| 14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
| 15 | #include <asm/tlbflush.h> | 15 | #include <asm/tlbflush.h> |
| 16 | struct mm_struct; | ||
| 16 | #endif /* __ASSEMBLY__ */ | 17 | #endif /* __ASSEMBLY__ */ |
| 17 | 18 | ||
| 18 | /* | 19 | #ifdef CONFIG_PPC_64K_PAGES |
| 19 | * Entries per page directory level. The PTE level must use a 64b record | 20 | #include <asm/pgtable-64k.h> |
| 20 | * for each page table entry. The PMD and PGD level use a 32b record for | 21 | #else |
| 21 | * each entry by assuming that each entry is page aligned. | 22 | #include <asm/pgtable-4k.h> |
| 22 | */ | 23 | #endif |
| 23 | #define PTE_INDEX_SIZE 9 | ||
| 24 | #define PMD_INDEX_SIZE 7 | ||
| 25 | #define PUD_INDEX_SIZE 7 | ||
| 26 | #define PGD_INDEX_SIZE 9 | ||
| 27 | |||
| 28 | #define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) | ||
| 29 | #define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) | ||
| 30 | #define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) | ||
| 31 | #define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) | ||
| 32 | |||
| 33 | #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) | ||
| 34 | #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) | ||
| 35 | #define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) | ||
| 36 | #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) | ||
| 37 | |||
| 38 | /* PMD_SHIFT determines what a second-level page table entry can map */ | ||
| 39 | #define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE) | ||
| 40 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
| 41 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
| 42 | |||
| 43 | /* PUD_SHIFT determines what a third-level page table entry can map */ | ||
| 44 | #define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) | ||
| 45 | #define PUD_SIZE (1UL << PUD_SHIFT) | ||
| 46 | #define PUD_MASK (~(PUD_SIZE-1)) | ||
| 47 | |||
| 48 | /* PGDIR_SHIFT determines what a fourth-level page table entry can map */ | ||
| 49 | #define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE) | ||
| 50 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
| 51 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
| 52 | 24 | ||
| 53 | #define FIRST_USER_ADDRESS 0 | 25 | #define FIRST_USER_ADDRESS 0 |
| 54 | 26 | ||
| @@ -75,8 +47,9 @@ | |||
| 75 | #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) | 47 | #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) |
| 76 | 48 | ||
| 77 | /* | 49 | /* |
| 78 | * Bits in a linux-style PTE. These match the bits in the | 50 | * Common bits in a linux-style PTE. These match the bits in the |
| 79 | * (hardware-defined) PowerPC PTE as closely as possible. | 51 | * (hardware-defined) PowerPC PTE as closely as possible. Additional |
| 52 | * bits may be defined in pgtable-*.h | ||
| 80 | */ | 53 | */ |
| 81 | #define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ | 54 | #define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ |
| 82 | #define _PAGE_USER 0x0002 /* matches one of the PP bits */ | 55 | #define _PAGE_USER 0x0002 /* matches one of the PP bits */ |
| @@ -91,15 +64,6 @@ | |||
| 91 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ | 64 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ |
| 92 | #define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */ | 65 | #define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */ |
| 93 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ | 66 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ |
| 94 | #define _PAGE_SECONDARY 0x8000 /* software: HPTE is in secondary group */ | ||
| 95 | #define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */ | ||
| 96 | #define _PAGE_HUGE 0x10000 /* 16MB page */ | ||
| 97 | /* Bits 0x7000 identify the index within an HPT Group */ | ||
| 98 | #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_SECONDARY | _PAGE_GROUP_IX) | ||
| 99 | /* PAGE_MASK gives the right answer below, but only by accident */ | ||
| 100 | /* It should be preserving the high 48 bits and then specifically */ | ||
| 101 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ | ||
| 102 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HPTEFLAGS) | ||
| 103 | 67 | ||
| 104 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) | 68 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) |
| 105 | 69 | ||
| @@ -122,10 +86,10 @@ | |||
| 122 | #define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) | 86 | #define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) |
| 123 | #define HAVE_PAGE_AGP | 87 | #define HAVE_PAGE_AGP |
| 124 | 88 | ||
| 125 | /* | 89 | /* PTEIDX nibble */ |
| 126 | * This bit in a hardware PTE indicates that the page is *not* executable. | 90 | #define _PTEIDX_SECONDARY 0x8 |
| 127 | */ | 91 | #define _PTEIDX_GROUP_IX 0x7 |
| 128 | #define HW_NO_EXEC _PAGE_EXEC | 92 | |
| 129 | 93 | ||
| 130 | /* | 94 | /* |
| 131 | * POWER4 and newer have per page execute protection, older chips can only | 95 | * POWER4 and newer have per page execute protection, older chips can only |
| @@ -164,21 +128,10 @@ extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)]; | |||
| 164 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | 128 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) |
| 165 | #endif /* __ASSEMBLY__ */ | 129 | #endif /* __ASSEMBLY__ */ |
| 166 | 130 | ||
| 167 | /* shift to put page number into pte */ | ||
| 168 | #define PTE_SHIFT (17) | ||
| 169 | |||
| 170 | #ifdef CONFIG_HUGETLB_PAGE | 131 | #ifdef CONFIG_HUGETLB_PAGE |
| 171 | 132 | ||
| 172 | #ifndef __ASSEMBLY__ | ||
| 173 | int hash_huge_page(struct mm_struct *mm, unsigned long access, | ||
| 174 | unsigned long ea, unsigned long vsid, int local); | ||
| 175 | #endif /* __ASSEMBLY__ */ | ||
| 176 | |||
| 177 | #define HAVE_ARCH_UNMAPPED_AREA | 133 | #define HAVE_ARCH_UNMAPPED_AREA |
| 178 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN | 134 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN |
| 179 | #else | ||
| 180 | |||
| 181 | #define hash_huge_page(mm,a,ea,vsid,local) -1 | ||
| 182 | 135 | ||
| 183 | #endif | 136 | #endif |
| 184 | 137 | ||
| @@ -197,7 +150,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
| 197 | pte_t pte; | 150 | pte_t pte; |
| 198 | 151 | ||
| 199 | 152 | ||
| 200 | pte_val(pte) = (pfn << PTE_SHIFT) | pgprot_val(pgprot); | 153 | pte_val(pte) = (pfn << PTE_RPN_SHIFT) | pgprot_val(pgprot); |
| 201 | return pte; | 154 | return pte; |
| 202 | } | 155 | } |
| 203 | 156 | ||
| @@ -209,30 +162,25 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
| 209 | 162 | ||
| 210 | /* pte_clear moved to later in this file */ | 163 | /* pte_clear moved to later in this file */ |
| 211 | 164 | ||
| 212 | #define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT))) | 165 | #define pte_pfn(x) ((unsigned long)((pte_val(x)>>PTE_RPN_SHIFT))) |
| 213 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 166 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
| 214 | 167 | ||
| 215 | #define pmd_set(pmdp, ptep) ({BUG_ON((u64)ptep < KERNELBASE); pmd_val(*(pmdp)) = (unsigned long)(ptep);}) | 168 | #define pmd_set(pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval)) |
| 216 | #define pmd_none(pmd) (!pmd_val(pmd)) | 169 | #define pmd_none(pmd) (!pmd_val(pmd)) |
| 217 | #define pmd_bad(pmd) (pmd_val(pmd) == 0) | 170 | #define pmd_bad(pmd) (pmd_val(pmd) == 0) |
| 218 | #define pmd_present(pmd) (pmd_val(pmd) != 0) | 171 | #define pmd_present(pmd) (pmd_val(pmd) != 0) |
| 219 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) | 172 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) |
| 220 | #define pmd_page_kernel(pmd) (pmd_val(pmd)) | 173 | #define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) |
| 221 | #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) | 174 | #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) |
| 222 | 175 | ||
| 223 | #define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (unsigned long)(pmdp)) | 176 | #define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) |
| 224 | #define pud_none(pud) (!pud_val(pud)) | 177 | #define pud_none(pud) (!pud_val(pud)) |
| 225 | #define pud_bad(pud) ((pud_val(pud)) == 0) | 178 | #define pud_bad(pud) ((pud_val(pud)) == 0) |
| 226 | #define pud_present(pud) (pud_val(pud) != 0) | 179 | #define pud_present(pud) (pud_val(pud) != 0) |
| 227 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) | 180 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) |
| 228 | #define pud_page(pud) (pud_val(pud)) | 181 | #define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS) |
| 229 | 182 | ||
| 230 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) | 183 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) |
| 231 | #define pgd_none(pgd) (!pgd_val(pgd)) | ||
| 232 | #define pgd_bad(pgd) (pgd_val(pgd) == 0) | ||
| 233 | #define pgd_present(pgd) (pgd_val(pgd) != 0) | ||
| 234 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) | ||
| 235 | #define pgd_page(pgd) (pgd_val(pgd)) | ||
| 236 | 184 | ||
| 237 | /* | 185 | /* |
| 238 | * Find an entry in a page-table-directory. We combine the address region | 186 | * Find an entry in a page-table-directory. We combine the address region |
| @@ -243,9 +191,6 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
| 243 | 191 | ||
| 244 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | 192 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) |
| 245 | 193 | ||
| 246 | #define pud_offset(pgdp, addr) \ | ||
| 247 | (((pud_t *) pgd_page(*(pgdp))) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) | ||
| 248 | |||
| 249 | #define pmd_offset(pudp,addr) \ | 194 | #define pmd_offset(pudp,addr) \ |
| 250 | (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) | 195 | (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) |
| 251 | 196 | ||
| @@ -271,7 +216,6 @@ static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC;} | |||
| 271 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} | 216 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} |
| 272 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} | 217 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} |
| 273 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} | 218 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} |
| 274 | static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE;} | ||
| 275 | 219 | ||
| 276 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } | 220 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } |
| 277 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } | 221 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } |
| @@ -286,7 +230,6 @@ static inline pte_t pte_mkclean(pte_t pte) { | |||
| 286 | pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } | 230 | pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } |
| 287 | static inline pte_t pte_mkold(pte_t pte) { | 231 | static inline pte_t pte_mkold(pte_t pte) { |
| 288 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 232 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
| 289 | |||
| 290 | static inline pte_t pte_mkread(pte_t pte) { | 233 | static inline pte_t pte_mkread(pte_t pte) { |
| 291 | pte_val(pte) |= _PAGE_USER; return pte; } | 234 | pte_val(pte) |= _PAGE_USER; return pte; } |
| 292 | static inline pte_t pte_mkexec(pte_t pte) { | 235 | static inline pte_t pte_mkexec(pte_t pte) { |
| @@ -298,7 +241,7 @@ static inline pte_t pte_mkdirty(pte_t pte) { | |||
| 298 | static inline pte_t pte_mkyoung(pte_t pte) { | 241 | static inline pte_t pte_mkyoung(pte_t pte) { |
| 299 | pte_val(pte) |= _PAGE_ACCESSED; return pte; } | 242 | pte_val(pte) |= _PAGE_ACCESSED; return pte; } |
| 300 | static inline pte_t pte_mkhuge(pte_t pte) { | 243 | static inline pte_t pte_mkhuge(pte_t pte) { |
| 301 | pte_val(pte) |= _PAGE_HUGE; return pte; } | 244 | return pte; } |
| 302 | 245 | ||
| 303 | /* Atomic PTE updates */ | 246 | /* Atomic PTE updates */ |
| 304 | static inline unsigned long pte_update(pte_t *p, unsigned long clr) | 247 | static inline unsigned long pte_update(pte_t *p, unsigned long clr) |
| @@ -321,11 +264,13 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr) | |||
| 321 | /* PTE updating functions, this function puts the PTE in the | 264 | /* PTE updating functions, this function puts the PTE in the |
| 322 | * batch, doesn't actually triggers the hash flush immediately, | 265 | * batch, doesn't actually triggers the hash flush immediately, |
| 323 | * you need to call flush_tlb_pending() to do that. | 266 | * you need to call flush_tlb_pending() to do that. |
| 267 | * Pass -1 for "normal" size (4K or 64K) | ||
| 324 | */ | 268 | */ |
| 325 | extern void hpte_update(struct mm_struct *mm, unsigned long addr, unsigned long pte, | 269 | extern void hpte_update(struct mm_struct *mm, unsigned long addr, |
| 326 | int wrprot); | 270 | pte_t *ptep, unsigned long pte, int huge); |
| 327 | 271 | ||
| 328 | static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 272 | static inline int __ptep_test_and_clear_young(struct mm_struct *mm, |
| 273 | unsigned long addr, pte_t *ptep) | ||
| 329 | { | 274 | { |
| 330 | unsigned long old; | 275 | unsigned long old; |
| 331 | 276 | ||
| @@ -333,7 +278,7 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned lon | |||
| 333 | return 0; | 278 | return 0; |
| 334 | old = pte_update(ptep, _PAGE_ACCESSED); | 279 | old = pte_update(ptep, _PAGE_ACCESSED); |
| 335 | if (old & _PAGE_HASHPTE) { | 280 | if (old & _PAGE_HASHPTE) { |
| 336 | hpte_update(mm, addr, old, 0); | 281 | hpte_update(mm, addr, ptep, old, 0); |
| 337 | flush_tlb_pending(); | 282 | flush_tlb_pending(); |
| 338 | } | 283 | } |
| 339 | return (old & _PAGE_ACCESSED) != 0; | 284 | return (old & _PAGE_ACCESSED) != 0; |
| @@ -351,7 +296,8 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned lon | |||
| 351 | * moment we always flush but we need to fix hpte_update and test if the | 296 | * moment we always flush but we need to fix hpte_update and test if the |
| 352 | * optimisation is worth it. | 297 | * optimisation is worth it. |
| 353 | */ | 298 | */ |
| 354 | static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 299 | static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, |
| 300 | unsigned long addr, pte_t *ptep) | ||
| 355 | { | 301 | { |
| 356 | unsigned long old; | 302 | unsigned long old; |
| 357 | 303 | ||
| @@ -359,7 +305,7 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned lon | |||
| 359 | return 0; | 305 | return 0; |
| 360 | old = pte_update(ptep, _PAGE_DIRTY); | 306 | old = pte_update(ptep, _PAGE_DIRTY); |
| 361 | if (old & _PAGE_HASHPTE) | 307 | if (old & _PAGE_HASHPTE) |
| 362 | hpte_update(mm, addr, old, 0); | 308 | hpte_update(mm, addr, ptep, old, 0); |
| 363 | return (old & _PAGE_DIRTY) != 0; | 309 | return (old & _PAGE_DIRTY) != 0; |
| 364 | } | 310 | } |
| 365 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | 311 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY |
| @@ -371,7 +317,8 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned lon | |||
| 371 | }) | 317 | }) |
| 372 | 318 | ||
| 373 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | 319 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT |
| 374 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 320 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, |
| 321 | pte_t *ptep) | ||
| 375 | { | 322 | { |
| 376 | unsigned long old; | 323 | unsigned long old; |
| 377 | 324 | ||
| @@ -379,7 +326,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
| 379 | return; | 326 | return; |
| 380 | old = pte_update(ptep, _PAGE_RW); | 327 | old = pte_update(ptep, _PAGE_RW); |
| 381 | if (old & _PAGE_HASHPTE) | 328 | if (old & _PAGE_HASHPTE) |
| 382 | hpte_update(mm, addr, old, 0); | 329 | hpte_update(mm, addr, ptep, old, 0); |
| 383 | } | 330 | } |
| 384 | 331 | ||
| 385 | /* | 332 | /* |
| @@ -408,21 +355,23 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
| 408 | }) | 355 | }) |
| 409 | 356 | ||
| 410 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | 357 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR |
| 411 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 358 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, |
| 359 | unsigned long addr, pte_t *ptep) | ||
| 412 | { | 360 | { |
| 413 | unsigned long old = pte_update(ptep, ~0UL); | 361 | unsigned long old = pte_update(ptep, ~0UL); |
| 414 | 362 | ||
| 415 | if (old & _PAGE_HASHPTE) | 363 | if (old & _PAGE_HASHPTE) |
| 416 | hpte_update(mm, addr, old, 0); | 364 | hpte_update(mm, addr, ptep, old, 0); |
| 417 | return __pte(old); | 365 | return __pte(old); |
| 418 | } | 366 | } |
| 419 | 367 | ||
| 420 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t * ptep) | 368 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, |
| 369 | pte_t * ptep) | ||
| 421 | { | 370 | { |
| 422 | unsigned long old = pte_update(ptep, ~0UL); | 371 | unsigned long old = pte_update(ptep, ~0UL); |
| 423 | 372 | ||
| 424 | if (old & _PAGE_HASHPTE) | 373 | if (old & _PAGE_HASHPTE) |
| 425 | hpte_update(mm, addr, old, 0); | 374 | hpte_update(mm, addr, ptep, old, 0); |
| 426 | } | 375 | } |
| 427 | 376 | ||
| 428 | /* | 377 | /* |
| @@ -435,7 +384,14 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
| 435 | pte_clear(mm, addr, ptep); | 384 | pte_clear(mm, addr, ptep); |
| 436 | flush_tlb_pending(); | 385 | flush_tlb_pending(); |
| 437 | } | 386 | } |
| 438 | *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); | 387 | pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); |
| 388 | |||
| 389 | #ifdef CONFIG_PPC_64K_PAGES | ||
| 390 | if (mmu_virtual_psize != MMU_PAGE_64K) | ||
| 391 | pte = __pte(pte_val(pte) | _PAGE_COMBO); | ||
| 392 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
| 393 | |||
| 394 | *ptep = pte; | ||
| 439 | } | 395 | } |
| 440 | 396 | ||
| 441 | /* Set the dirty and/or accessed bits atomically in a linux PTE, this | 397 | /* Set the dirty and/or accessed bits atomically in a linux PTE, this |
| @@ -482,8 +438,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
| 482 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | 438 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) |
| 483 | #define pmd_ERROR(e) \ | 439 | #define pmd_ERROR(e) \ |
| 484 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) | 440 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) |
| 485 | #define pud_ERROR(e) \ | ||
| 486 | printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e)) | ||
| 487 | #define pgd_ERROR(e) \ | 441 | #define pgd_ERROR(e) \ |
| 488 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | 442 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) |
| 489 | 443 | ||
| @@ -509,12 +463,12 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | |||
| 509 | /* Encode and de-code a swap entry */ | 463 | /* Encode and de-code a swap entry */ |
| 510 | #define __swp_type(entry) (((entry).val >> 1) & 0x3f) | 464 | #define __swp_type(entry) (((entry).val >> 1) & 0x3f) |
| 511 | #define __swp_offset(entry) ((entry).val >> 8) | 465 | #define __swp_offset(entry) ((entry).val >> 8) |
| 512 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) | 466 | #define __swp_entry(type, offset) ((swp_entry_t){((type)<< 1)|((offset)<<8)}) |
| 513 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> PTE_SHIFT }) | 467 | #define __pte_to_swp_entry(pte) ((swp_entry_t){pte_val(pte) >> PTE_RPN_SHIFT}) |
| 514 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_SHIFT }) | 468 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_RPN_SHIFT }) |
| 515 | #define pte_to_pgoff(pte) (pte_val(pte) >> PTE_SHIFT) | 469 | #define pte_to_pgoff(pte) (pte_val(pte) >> PTE_RPN_SHIFT) |
| 516 | #define pgoff_to_pte(off) ((pte_t) {((off) << PTE_SHIFT)|_PAGE_FILE}) | 470 | #define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE}) |
| 517 | #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_SHIFT) | 471 | #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) |
| 518 | 472 | ||
| 519 | /* | 473 | /* |
| 520 | * kern_addr_valid is intended to indicate whether an address is a valid | 474 | * kern_addr_valid is intended to indicate whether an address is a valid |
| @@ -532,29 +486,22 @@ void pgtable_cache_init(void); | |||
| 532 | /* | 486 | /* |
| 533 | * find_linux_pte returns the address of a linux pte for a given | 487 | * find_linux_pte returns the address of a linux pte for a given |
| 534 | * effective address and directory. If not found, it returns zero. | 488 | * effective address and directory. If not found, it returns zero. |
| 535 | */ | 489 | */static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea) |
| 536 | static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea) | ||
| 537 | { | 490 | { |
| 538 | pgd_t *pg; | 491 | pgd_t *pg; |
| 539 | pud_t *pu; | 492 | pud_t *pu; |
| 540 | pmd_t *pm; | 493 | pmd_t *pm; |
| 541 | pte_t *pt = NULL; | 494 | pte_t *pt = NULL; |
| 542 | pte_t pte; | ||
| 543 | 495 | ||
| 544 | pg = pgdir + pgd_index(ea); | 496 | pg = pgdir + pgd_index(ea); |
| 545 | if (!pgd_none(*pg)) { | 497 | if (!pgd_none(*pg)) { |
| 546 | pu = pud_offset(pg, ea); | 498 | pu = pud_offset(pg, ea); |
| 547 | if (!pud_none(*pu)) { | 499 | if (!pud_none(*pu)) { |
| 548 | pm = pmd_offset(pu, ea); | 500 | pm = pmd_offset(pu, ea); |
| 549 | if (pmd_present(*pm)) { | 501 | if (pmd_present(*pm)) |
| 550 | pt = pte_offset_kernel(pm, ea); | 502 | pt = pte_offset_kernel(pm, ea); |
| 551 | pte = *pt; | ||
| 552 | if (!pte_present(pte)) | ||
| 553 | pt = NULL; | ||
| 554 | } | ||
| 555 | } | 503 | } |
| 556 | } | 504 | } |
| 557 | |||
| 558 | return pt; | 505 | return pt; |
| 559 | } | 506 | } |
| 560 | 507 | ||
diff --git a/include/asm-ppc64/ppcdebug.h b/include/asm-ppc64/ppcdebug.h deleted file mode 100644 index fd7f696065c4..000000000000 --- a/include/asm-ppc64/ppcdebug.h +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | #ifndef __PPCDEBUG_H | ||
| 2 | #define __PPCDEBUG_H | ||
| 3 | /******************************************************************** | ||
| 4 | * Author: Adam Litke, IBM Corp | ||
| 5 | * (c) 2001 | ||
| 6 | * | ||
| 7 | * This file contains definitions and macros for a runtime debugging | ||
| 8 | * system for ppc64 (This should also work on 32 bit with a few | ||
| 9 | * adjustments. | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or | ||
| 12 | * modify it under the terms of the GNU General Public License | ||
| 13 | * as published by the Free Software Foundation; either version | ||
| 14 | * 2 of the License, or (at your option) any later version. | ||
| 15 | * | ||
| 16 | ********************************************************************/ | ||
| 17 | |||
| 18 | #include <linux/config.h> | ||
| 19 | #include <linux/types.h> | ||
| 20 | #include <asm/udbg.h> | ||
| 21 | #include <stdarg.h> | ||
| 22 | |||
| 23 | #define PPCDBG_BITVAL(X) ((1UL)<<((unsigned long)(X))) | ||
| 24 | |||
| 25 | /* Defined below are the bit positions of various debug flags in the | ||
| 26 | * ppc64_debug_switch variable. | ||
| 27 | * -- When adding new values, please enter them into trace names below -- | ||
| 28 | * | ||
| 29 | * Values 62 & 63 can be used to stress the hardware page table management | ||
| 30 | * code. They must be set statically, any attempt to change them dynamically | ||
| 31 | * would be a very bad idea. | ||
| 32 | */ | ||
| 33 | #define PPCDBG_MMINIT PPCDBG_BITVAL(0) | ||
| 34 | #define PPCDBG_MM PPCDBG_BITVAL(1) | ||
| 35 | #define PPCDBG_SYS32 PPCDBG_BITVAL(2) | ||
| 36 | #define PPCDBG_SYS32NI PPCDBG_BITVAL(3) | ||
| 37 | #define PPCDBG_SYS32X PPCDBG_BITVAL(4) | ||
| 38 | #define PPCDBG_SYS32M PPCDBG_BITVAL(5) | ||
| 39 | #define PPCDBG_SYS64 PPCDBG_BITVAL(6) | ||
| 40 | #define PPCDBG_SYS64NI PPCDBG_BITVAL(7) | ||
| 41 | #define PPCDBG_SYS64X PPCDBG_BITVAL(8) | ||
| 42 | #define PPCDBG_SIGNAL PPCDBG_BITVAL(9) | ||
| 43 | #define PPCDBG_SIGNALXMON PPCDBG_BITVAL(10) | ||
| 44 | #define PPCDBG_BINFMT32 PPCDBG_BITVAL(11) | ||
| 45 | #define PPCDBG_BINFMT64 PPCDBG_BITVAL(12) | ||
| 46 | #define PPCDBG_BINFMTXMON PPCDBG_BITVAL(13) | ||
| 47 | #define PPCDBG_BINFMT_32ADDR PPCDBG_BITVAL(14) | ||
| 48 | #define PPCDBG_ALIGNFIXUP PPCDBG_BITVAL(15) | ||
| 49 | #define PPCDBG_TCEINIT PPCDBG_BITVAL(16) | ||
| 50 | #define PPCDBG_TCE PPCDBG_BITVAL(17) | ||
| 51 | #define PPCDBG_PHBINIT PPCDBG_BITVAL(18) | ||
| 52 | #define PPCDBG_SMP PPCDBG_BITVAL(19) | ||
| 53 | #define PPCDBG_BOOT PPCDBG_BITVAL(20) | ||
| 54 | #define PPCDBG_BUSWALK PPCDBG_BITVAL(21) | ||
| 55 | #define PPCDBG_PROM PPCDBG_BITVAL(22) | ||
| 56 | #define PPCDBG_RTAS PPCDBG_BITVAL(23) | ||
| 57 | #define PPCDBG_HTABSTRESS PPCDBG_BITVAL(62) | ||
| 58 | #define PPCDBG_HTABSIZE PPCDBG_BITVAL(63) | ||
| 59 | #define PPCDBG_NONE (0UL) | ||
| 60 | #define PPCDBG_ALL (0xffffffffUL) | ||
| 61 | |||
| 62 | /* The default initial value for the debug switch */ | ||
| 63 | #define PPC_DEBUG_DEFAULT 0 | ||
| 64 | /* #define PPC_DEBUG_DEFAULT PPCDBG_ALL */ | ||
| 65 | |||
| 66 | #define PPCDBG_NUM_FLAGS 64 | ||
| 67 | |||
| 68 | extern u64 ppc64_debug_switch; | ||
| 69 | |||
| 70 | #ifdef WANT_PPCDBG_TAB | ||
| 71 | /* A table of debug switch names to allow name lookup in xmon | ||
| 72 | * (and whoever else wants it. | ||
| 73 | */ | ||
| 74 | char *trace_names[PPCDBG_NUM_FLAGS] = { | ||
| 75 | /* Known debug names */ | ||
| 76 | "mminit", "mm", | ||
| 77 | "syscall32", "syscall32_ni", "syscall32x", "syscall32m", | ||
| 78 | "syscall64", "syscall64_ni", "syscall64x", | ||
| 79 | "signal", "signal_xmon", | ||
| 80 | "binfmt32", "binfmt64", "binfmt_xmon", "binfmt_32addr", | ||
| 81 | "alignfixup", "tceinit", "tce", "phb_init", | ||
| 82 | "smp", "boot", "buswalk", "prom", | ||
| 83 | "rtas" | ||
| 84 | }; | ||
| 85 | #else | ||
| 86 | extern char *trace_names[64]; | ||
| 87 | #endif /* WANT_PPCDBG_TAB */ | ||
| 88 | |||
| 89 | #ifdef CONFIG_PPCDBG | ||
| 90 | /* Macro to conditionally print debug based on debug_switch */ | ||
| 91 | #define PPCDBG(...) udbg_ppcdbg(__VA_ARGS__) | ||
| 92 | |||
| 93 | /* Macro to conditionally call a debug routine based on debug_switch */ | ||
| 94 | #define PPCDBGCALL(FLAGS,FUNCTION) ifppcdebug(FLAGS) FUNCTION | ||
| 95 | |||
| 96 | /* Macros to test for debug states */ | ||
| 97 | #define ifppcdebug(FLAGS) if (udbg_ifdebug(FLAGS)) | ||
| 98 | #define ppcdebugset(FLAGS) (udbg_ifdebug(FLAGS)) | ||
| 99 | #define PPCDBG_BINFMT (test_thread_flag(TIF_32BIT) ? PPCDBG_BINFMT32 : PPCDBG_BINFMT64) | ||
| 100 | |||
| 101 | #else | ||
| 102 | #define PPCDBG(...) do {;} while (0) | ||
| 103 | #define PPCDBGCALL(FLAGS,FUNCTION) do {;} while (0) | ||
| 104 | #define ifppcdebug(...) if (0) | ||
| 105 | #define ppcdebugset(FLAGS) (0) | ||
| 106 | #endif /* CONFIG_PPCDBG */ | ||
| 107 | |||
| 108 | #endif /*__PPCDEBUG_H */ | ||
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h index e8d0d2ab4c0f..76bb0266d67c 100644 --- a/include/asm-ppc64/prom.h +++ b/include/asm-ppc64/prom.h | |||
| @@ -188,6 +188,14 @@ extern struct device_node *of_get_next_child(const struct device_node *node, | |||
| 188 | extern struct device_node *of_node_get(struct device_node *node); | 188 | extern struct device_node *of_node_get(struct device_node *node); |
| 189 | extern void of_node_put(struct device_node *node); | 189 | extern void of_node_put(struct device_node *node); |
| 190 | 190 | ||
| 191 | /* For scanning the flat device-tree at boot time */ | ||
| 192 | int __init of_scan_flat_dt(int (*it)(unsigned long node, | ||
| 193 | const char *uname, int depth, | ||
| 194 | void *data), | ||
| 195 | void *data); | ||
| 196 | void* __init of_get_flat_dt_prop(unsigned long node, const char *name, | ||
| 197 | unsigned long *size); | ||
| 198 | |||
| 191 | /* For updating the device tree at runtime */ | 199 | /* For updating the device tree at runtime */ |
| 192 | extern void of_attach_node(struct device_node *); | 200 | extern void of_attach_node(struct device_node *); |
| 193 | extern void of_detach_node(const struct device_node *); | 201 | extern void of_detach_node(const struct device_node *); |
| @@ -205,6 +213,6 @@ extern int prom_n_addr_cells(struct device_node* np); | |||
| 205 | extern int prom_n_size_cells(struct device_node* np); | 213 | extern int prom_n_size_cells(struct device_node* np); |
| 206 | extern int prom_n_intr_cells(struct device_node* np); | 214 | extern int prom_n_intr_cells(struct device_node* np); |
| 207 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); | 215 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); |
| 208 | extern void prom_add_property(struct device_node* np, struct property* prop); | 216 | extern int prom_add_property(struct device_node* np, struct property* prop); |
| 209 | 217 | ||
| 210 | #endif /* _PPC64_PROM_H */ | 218 | #endif /* _PPC64_PROM_H */ |
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h index 99b8ca52f101..0cdd66c9f4b7 100644 --- a/include/asm-ppc64/system.h +++ b/include/asm-ppc64/system.h | |||
| @@ -248,7 +248,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new) | |||
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | static __inline__ unsigned long | 250 | static __inline__ unsigned long |
| 251 | __cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new) | 251 | __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new) |
| 252 | { | 252 | { |
| 253 | unsigned long prev; | 253 | unsigned long prev; |
| 254 | 254 | ||
diff --git a/include/asm-ppc64/udbg.h b/include/asm-ppc64/udbg.h index 8192fb8541cc..e3b927991851 100644 --- a/include/asm-ppc64/udbg.h +++ b/include/asm-ppc64/udbg.h | |||
| @@ -23,9 +23,6 @@ extern int udbg_read(char *buf, int buflen); | |||
| 23 | 23 | ||
| 24 | extern void register_early_udbg_console(void); | 24 | extern void register_early_udbg_console(void); |
| 25 | extern void udbg_printf(const char *fmt, ...); | 25 | extern void udbg_printf(const char *fmt, ...); |
| 26 | extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...); | ||
| 27 | extern unsigned long udbg_ifdebug(unsigned long flags); | ||
| 28 | extern void __init ppcdbg_initialize(void); | ||
| 29 | 26 | ||
| 30 | extern void udbg_init_uart(void __iomem *comport, unsigned int speed); | 27 | extern void udbg_init_uart(void __iomem *comport, unsigned int speed); |
| 31 | 28 | ||
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index 8651524217fd..b07c578b22ea 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h | |||
| @@ -518,8 +518,8 @@ static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr | |||
| 518 | 518 | ||
| 519 | static inline int | 519 | static inline int |
| 520 | __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { | 520 | __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { |
| 521 | return (((volatile char *) addr) | 521 | return ((((volatile char *) addr) |
| 522 | [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7))); | 522 | [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7)))) != 0; |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | #define test_bit(nr,addr) \ | 525 | #define test_bit(nr,addr) \ |
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h index 7127030ae162..23450ed4b571 100644 --- a/include/asm-s390/debug.h +++ b/include/asm-s390/debug.h | |||
| @@ -129,7 +129,7 @@ void debug_set_level(debug_info_t* id, int new_level); | |||
| 129 | 129 | ||
| 130 | void debug_stop_all(void); | 130 | void debug_stop_all(void); |
| 131 | 131 | ||
| 132 | extern inline debug_entry_t* | 132 | static inline debug_entry_t* |
| 133 | debug_event(debug_info_t* id, int level, void* data, int length) | 133 | debug_event(debug_info_t* id, int level, void* data, int length) |
| 134 | { | 134 | { |
| 135 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 135 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
| @@ -137,7 +137,7 @@ debug_event(debug_info_t* id, int level, void* data, int length) | |||
| 137 | return debug_event_common(id,level,data,length); | 137 | return debug_event_common(id,level,data,length); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | extern inline debug_entry_t* | 140 | static inline debug_entry_t* |
| 141 | debug_int_event(debug_info_t* id, int level, unsigned int tag) | 141 | debug_int_event(debug_info_t* id, int level, unsigned int tag) |
| 142 | { | 142 | { |
| 143 | unsigned int t=tag; | 143 | unsigned int t=tag; |
| @@ -146,7 +146,7 @@ debug_int_event(debug_info_t* id, int level, unsigned int tag) | |||
| 146 | return debug_event_common(id,level,&t,sizeof(unsigned int)); | 146 | return debug_event_common(id,level,&t,sizeof(unsigned int)); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | extern inline debug_entry_t * | 149 | static inline debug_entry_t * |
| 150 | debug_long_event (debug_info_t* id, int level, unsigned long tag) | 150 | debug_long_event (debug_info_t* id, int level, unsigned long tag) |
| 151 | { | 151 | { |
| 152 | unsigned long t=tag; | 152 | unsigned long t=tag; |
| @@ -155,7 +155,7 @@ debug_long_event (debug_info_t* id, int level, unsigned long tag) | |||
| 155 | return debug_event_common(id,level,&t,sizeof(unsigned long)); | 155 | return debug_event_common(id,level,&t,sizeof(unsigned long)); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | extern inline debug_entry_t* | 158 | static inline debug_entry_t* |
| 159 | debug_text_event(debug_info_t* id, int level, const char* txt) | 159 | debug_text_event(debug_info_t* id, int level, const char* txt) |
| 160 | { | 160 | { |
| 161 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 161 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
| @@ -168,7 +168,7 @@ debug_sprintf_event(debug_info_t* id,int level,char *string,...) | |||
| 168 | __attribute__ ((format(printf, 3, 4))); | 168 | __attribute__ ((format(printf, 3, 4))); |
| 169 | 169 | ||
| 170 | 170 | ||
| 171 | extern inline debug_entry_t* | 171 | static inline debug_entry_t* |
| 172 | debug_exception(debug_info_t* id, int level, void* data, int length) | 172 | debug_exception(debug_info_t* id, int level, void* data, int length) |
| 173 | { | 173 | { |
| 174 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 174 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
| @@ -176,7 +176,7 @@ debug_exception(debug_info_t* id, int level, void* data, int length) | |||
| 176 | return debug_exception_common(id,level,data,length); | 176 | return debug_exception_common(id,level,data,length); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | extern inline debug_entry_t* | 179 | static inline debug_entry_t* |
| 180 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) | 180 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) |
| 181 | { | 181 | { |
| 182 | unsigned int t=tag; | 182 | unsigned int t=tag; |
| @@ -185,7 +185,7 @@ debug_int_exception(debug_info_t* id, int level, unsigned int tag) | |||
| 185 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); | 185 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | extern inline debug_entry_t * | 188 | static inline debug_entry_t * |
| 189 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) | 189 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) |
| 190 | { | 190 | { |
| 191 | unsigned long t=tag; | 191 | unsigned long t=tag; |
| @@ -194,7 +194,7 @@ debug_long_exception (debug_info_t* id, int level, unsigned long tag) | |||
| 194 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); | 194 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | extern inline debug_entry_t* | 197 | static inline debug_entry_t* |
| 198 | debug_text_exception(debug_info_t* id, int level, const char* txt) | 198 | debug_text_exception(debug_info_t* id, int level, const char* txt) |
| 199 | { | 199 | { |
| 200 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 200 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h index 20e81e885821..4cbc336e4d60 100644 --- a/include/asm-s390/ebcdic.h +++ b/include/asm-s390/ebcdic.h | |||
| @@ -21,7 +21,7 @@ extern __u8 _ebcasc[]; /* EBCDIC -> ASCII conversion table */ | |||
| 21 | extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ | 21 | extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ |
| 22 | extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ | 22 | extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ |
| 23 | 23 | ||
| 24 | extern __inline__ void | 24 | static inline void |
| 25 | codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) | 25 | codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) |
| 26 | { | 26 | { |
| 27 | if (nr-- <= 0) | 27 | if (nr-- <= 0) |
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h index 3b8bd46832a1..372d51cccd53 100644 --- a/include/asm-s390/elf.h +++ b/include/asm-s390/elf.h | |||
| @@ -96,6 +96,7 @@ | |||
| 96 | * ELF register definitions.. | 96 | * ELF register definitions.. |
| 97 | */ | 97 | */ |
| 98 | 98 | ||
| 99 | #include <linux/sched.h> /* for task_struct */ | ||
| 99 | #include <asm/ptrace.h> | 100 | #include <asm/ptrace.h> |
| 100 | #include <asm/user.h> | 101 | #include <asm/user.h> |
| 101 | #include <asm/system.h> /* for save_access_regs */ | 102 | #include <asm/system.h> /* for save_access_regs */ |
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h index 8188fdc9884f..71f55eb2350a 100644 --- a/include/asm-s390/io.h +++ b/include/asm-s390/io.h | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | * Change virtual addresses to physical addresses and vv. | 24 | * Change virtual addresses to physical addresses and vv. |
| 25 | * These are pretty trivial | 25 | * These are pretty trivial |
| 26 | */ | 26 | */ |
| 27 | extern inline unsigned long virt_to_phys(volatile void * address) | 27 | static inline unsigned long virt_to_phys(volatile void * address) |
| 28 | { | 28 | { |
| 29 | unsigned long real_address; | 29 | unsigned long real_address; |
| 30 | __asm__ ( | 30 | __asm__ ( |
| @@ -42,7 +42,7 @@ extern inline unsigned long virt_to_phys(volatile void * address) | |||
| 42 | return real_address; | 42 | return real_address; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | extern inline void * phys_to_virt(unsigned long address) | 45 | static inline void * phys_to_virt(unsigned long address) |
| 46 | { | 46 | { |
| 47 | return __io_virt(address); | 47 | return __io_virt(address); |
| 48 | } | 48 | } |
| @@ -54,7 +54,7 @@ extern inline void * phys_to_virt(unsigned long address) | |||
| 54 | 54 | ||
| 55 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); | 55 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); |
| 56 | 56 | ||
| 57 | extern inline void * ioremap (unsigned long offset, unsigned long size) | 57 | static inline void * ioremap (unsigned long offset, unsigned long size) |
| 58 | { | 58 | { |
| 59 | return __ioremap(offset, size, 0); | 59 | return __ioremap(offset, size, 0); |
| 60 | } | 60 | } |
| @@ -64,7 +64,7 @@ extern inline void * ioremap (unsigned long offset, unsigned long size) | |||
| 64 | * it's useful if some control registers are in such an area and write combining | 64 | * it's useful if some control registers are in such an area and write combining |
| 65 | * or read caching is not desirable: | 65 | * or read caching is not desirable: |
| 66 | */ | 66 | */ |
| 67 | extern inline void * ioremap_nocache (unsigned long offset, unsigned long size) | 67 | static inline void * ioremap_nocache (unsigned long offset, unsigned long size) |
| 68 | { | 68 | { |
| 69 | return __ioremap(offset, size, 0); | 69 | return __ioremap(offset, size, 0); |
| 70 | } | 70 | } |
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index c6f51c9ce3ff..db0606c1abd4 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
| @@ -346,7 +346,7 @@ struct _lowcore | |||
| 346 | #define S390_lowcore (*((struct _lowcore *) 0)) | 346 | #define S390_lowcore (*((struct _lowcore *) 0)) |
| 347 | extern struct _lowcore *lowcore_ptr[]; | 347 | extern struct _lowcore *lowcore_ptr[]; |
| 348 | 348 | ||
| 349 | extern __inline__ void set_prefix(__u32 address) | 349 | static inline void set_prefix(__u32 address) |
| 350 | { | 350 | { |
| 351 | __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); | 351 | __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); |
| 352 | } | 352 | } |
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h index 3a3bb3f2dad5..bcf24a873874 100644 --- a/include/asm-s390/mmu_context.h +++ b/include/asm-s390/mmu_context.h | |||
| @@ -44,7 +44,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
| 44 | 44 | ||
| 45 | #define deactivate_mm(tsk,mm) do { } while (0) | 45 | #define deactivate_mm(tsk,mm) do { } while (0) |
| 46 | 46 | ||
| 47 | extern inline void activate_mm(struct mm_struct *prev, | 47 | static inline void activate_mm(struct mm_struct *prev, |
| 48 | struct mm_struct *next) | 48 | struct mm_struct *next) |
| 49 | { | 49 | { |
| 50 | switch_mm(prev, next, current); | 50 | switch_mm(prev, next, current); |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index df94f89038cc..859b5e969826 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <linux/threads.h> | 36 | #include <linux/threads.h> |
| 37 | 37 | ||
| 38 | struct vm_area_struct; /* forward declaration (include/linux/mm.h) */ | 38 | struct vm_area_struct; /* forward declaration (include/linux/mm.h) */ |
| 39 | struct mm_struct; | ||
| 39 | 40 | ||
| 40 | extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); | 41 | extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); |
| 41 | extern void paging_init(void); | 42 | extern void paging_init(void); |
| @@ -318,7 +319,7 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
| 318 | * within a page table are directly modified. Thus, the following | 319 | * within a page table are directly modified. Thus, the following |
| 319 | * hook is made available. | 320 | * hook is made available. |
| 320 | */ | 321 | */ |
| 321 | extern inline void set_pte(pte_t *pteptr, pte_t pteval) | 322 | static inline void set_pte(pte_t *pteptr, pte_t pteval) |
| 322 | { | 323 | { |
| 323 | *pteptr = pteval; | 324 | *pteptr = pteval; |
| 324 | } | 325 | } |
| @@ -329,63 +330,63 @@ extern inline void set_pte(pte_t *pteptr, pte_t pteval) | |||
| 329 | */ | 330 | */ |
| 330 | #ifndef __s390x__ | 331 | #ifndef __s390x__ |
| 331 | 332 | ||
| 332 | extern inline int pgd_present(pgd_t pgd) { return 1; } | 333 | static inline int pgd_present(pgd_t pgd) { return 1; } |
| 333 | extern inline int pgd_none(pgd_t pgd) { return 0; } | 334 | static inline int pgd_none(pgd_t pgd) { return 0; } |
| 334 | extern inline int pgd_bad(pgd_t pgd) { return 0; } | 335 | static inline int pgd_bad(pgd_t pgd) { return 0; } |
| 335 | 336 | ||
| 336 | extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } | 337 | static inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } |
| 337 | extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } | 338 | static inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } |
| 338 | extern inline int pmd_bad(pmd_t pmd) | 339 | static inline int pmd_bad(pmd_t pmd) |
| 339 | { | 340 | { |
| 340 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE; | 341 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE; |
| 341 | } | 342 | } |
| 342 | 343 | ||
| 343 | #else /* __s390x__ */ | 344 | #else /* __s390x__ */ |
| 344 | 345 | ||
| 345 | extern inline int pgd_present(pgd_t pgd) | 346 | static inline int pgd_present(pgd_t pgd) |
| 346 | { | 347 | { |
| 347 | return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; | 348 | return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; |
| 348 | } | 349 | } |
| 349 | 350 | ||
| 350 | extern inline int pgd_none(pgd_t pgd) | 351 | static inline int pgd_none(pgd_t pgd) |
| 351 | { | 352 | { |
| 352 | return pgd_val(pgd) & _PGD_ENTRY_INV; | 353 | return pgd_val(pgd) & _PGD_ENTRY_INV; |
| 353 | } | 354 | } |
| 354 | 355 | ||
| 355 | extern inline int pgd_bad(pgd_t pgd) | 356 | static inline int pgd_bad(pgd_t pgd) |
| 356 | { | 357 | { |
| 357 | return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; | 358 | return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; |
| 358 | } | 359 | } |
| 359 | 360 | ||
| 360 | extern inline int pmd_present(pmd_t pmd) | 361 | static inline int pmd_present(pmd_t pmd) |
| 361 | { | 362 | { |
| 362 | return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; | 363 | return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; |
| 363 | } | 364 | } |
| 364 | 365 | ||
| 365 | extern inline int pmd_none(pmd_t pmd) | 366 | static inline int pmd_none(pmd_t pmd) |
| 366 | { | 367 | { |
| 367 | return pmd_val(pmd) & _PMD_ENTRY_INV; | 368 | return pmd_val(pmd) & _PMD_ENTRY_INV; |
| 368 | } | 369 | } |
| 369 | 370 | ||
| 370 | extern inline int pmd_bad(pmd_t pmd) | 371 | static inline int pmd_bad(pmd_t pmd) |
| 371 | { | 372 | { |
| 372 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; | 373 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; |
| 373 | } | 374 | } |
| 374 | 375 | ||
| 375 | #endif /* __s390x__ */ | 376 | #endif /* __s390x__ */ |
| 376 | 377 | ||
| 377 | extern inline int pte_none(pte_t pte) | 378 | static inline int pte_none(pte_t pte) |
| 378 | { | 379 | { |
| 379 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; | 380 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; |
| 380 | } | 381 | } |
| 381 | 382 | ||
| 382 | extern inline int pte_present(pte_t pte) | 383 | static inline int pte_present(pte_t pte) |
| 383 | { | 384 | { |
| 384 | return !(pte_val(pte) & _PAGE_INVALID) || | 385 | return !(pte_val(pte) & _PAGE_INVALID) || |
| 385 | (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; | 386 | (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; |
| 386 | } | 387 | } |
| 387 | 388 | ||
| 388 | extern inline int pte_file(pte_t pte) | 389 | static inline int pte_file(pte_t pte) |
| 389 | { | 390 | { |
| 390 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; | 391 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; |
| 391 | } | 392 | } |
| @@ -396,12 +397,12 @@ extern inline int pte_file(pte_t pte) | |||
| 396 | * query functions pte_write/pte_dirty/pte_young only work if | 397 | * query functions pte_write/pte_dirty/pte_young only work if |
| 397 | * pte_present() is true. Undefined behaviour if not.. | 398 | * pte_present() is true. Undefined behaviour if not.. |
| 398 | */ | 399 | */ |
| 399 | extern inline int pte_write(pte_t pte) | 400 | static inline int pte_write(pte_t pte) |
| 400 | { | 401 | { |
| 401 | return (pte_val(pte) & _PAGE_RO) == 0; | 402 | return (pte_val(pte) & _PAGE_RO) == 0; |
| 402 | } | 403 | } |
| 403 | 404 | ||
| 404 | extern inline int pte_dirty(pte_t pte) | 405 | static inline int pte_dirty(pte_t pte) |
| 405 | { | 406 | { |
| 406 | /* A pte is neither clean nor dirty on s/390. The dirty bit | 407 | /* A pte is neither clean nor dirty on s/390. The dirty bit |
| 407 | * is in the storage key. See page_test_and_clear_dirty for | 408 | * is in the storage key. See page_test_and_clear_dirty for |
| @@ -410,7 +411,7 @@ extern inline int pte_dirty(pte_t pte) | |||
| 410 | return 0; | 411 | return 0; |
| 411 | } | 412 | } |
| 412 | 413 | ||
| 413 | extern inline int pte_young(pte_t pte) | 414 | static inline int pte_young(pte_t pte) |
| 414 | { | 415 | { |
| 415 | /* A pte is neither young nor old on s/390. The young bit | 416 | /* A pte is neither young nor old on s/390. The young bit |
| 416 | * is in the storage key. See page_test_and_clear_young for | 417 | * is in the storage key. See page_test_and_clear_young for |
| @@ -419,7 +420,7 @@ extern inline int pte_young(pte_t pte) | |||
| 419 | return 0; | 420 | return 0; |
| 420 | } | 421 | } |
| 421 | 422 | ||
| 422 | extern inline int pte_read(pte_t pte) | 423 | static inline int pte_read(pte_t pte) |
| 423 | { | 424 | { |
| 424 | /* All pages are readable since we don't use the fetch | 425 | /* All pages are readable since we don't use the fetch |
| 425 | * protection bit in the storage key. | 426 | * protection bit in the storage key. |
| @@ -433,9 +434,9 @@ extern inline int pte_read(pte_t pte) | |||
| 433 | 434 | ||
| 434 | #ifndef __s390x__ | 435 | #ifndef __s390x__ |
| 435 | 436 | ||
| 436 | extern inline void pgd_clear(pgd_t * pgdp) { } | 437 | static inline void pgd_clear(pgd_t * pgdp) { } |
| 437 | 438 | ||
| 438 | extern inline void pmd_clear(pmd_t * pmdp) | 439 | static inline void pmd_clear(pmd_t * pmdp) |
| 439 | { | 440 | { |
| 440 | pmd_val(pmdp[0]) = _PAGE_TABLE_INV; | 441 | pmd_val(pmdp[0]) = _PAGE_TABLE_INV; |
| 441 | pmd_val(pmdp[1]) = _PAGE_TABLE_INV; | 442 | pmd_val(pmdp[1]) = _PAGE_TABLE_INV; |
| @@ -445,12 +446,12 @@ extern inline void pmd_clear(pmd_t * pmdp) | |||
| 445 | 446 | ||
| 446 | #else /* __s390x__ */ | 447 | #else /* __s390x__ */ |
| 447 | 448 | ||
| 448 | extern inline void pgd_clear(pgd_t * pgdp) | 449 | static inline void pgd_clear(pgd_t * pgdp) |
| 449 | { | 450 | { |
| 450 | pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; | 451 | pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; |
| 451 | } | 452 | } |
| 452 | 453 | ||
| 453 | extern inline void pmd_clear(pmd_t * pmdp) | 454 | static inline void pmd_clear(pmd_t * pmdp) |
| 454 | { | 455 | { |
| 455 | pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; | 456 | pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; |
| 456 | pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; | 457 | pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; |
| @@ -458,7 +459,7 @@ extern inline void pmd_clear(pmd_t * pmdp) | |||
| 458 | 459 | ||
| 459 | #endif /* __s390x__ */ | 460 | #endif /* __s390x__ */ |
| 460 | 461 | ||
| 461 | extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 462 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
| 462 | { | 463 | { |
| 463 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; | 464 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; |
| 464 | } | 465 | } |
| @@ -467,14 +468,14 @@ extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt | |||
| 467 | * The following pte modification functions only work if | 468 | * The following pte modification functions only work if |
| 468 | * pte_present() is true. Undefined behaviour if not.. | 469 | * pte_present() is true. Undefined behaviour if not.. |
| 469 | */ | 470 | */ |
| 470 | extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 471 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
| 471 | { | 472 | { |
| 472 | pte_val(pte) &= PAGE_MASK; | 473 | pte_val(pte) &= PAGE_MASK; |
| 473 | pte_val(pte) |= pgprot_val(newprot); | 474 | pte_val(pte) |= pgprot_val(newprot); |
| 474 | return pte; | 475 | return pte; |
| 475 | } | 476 | } |
| 476 | 477 | ||
| 477 | extern inline pte_t pte_wrprotect(pte_t pte) | 478 | static inline pte_t pte_wrprotect(pte_t pte) |
| 478 | { | 479 | { |
| 479 | /* Do not clobber _PAGE_INVALID_NONE pages! */ | 480 | /* Do not clobber _PAGE_INVALID_NONE pages! */ |
| 480 | if (!(pte_val(pte) & _PAGE_INVALID)) | 481 | if (!(pte_val(pte) & _PAGE_INVALID)) |
| @@ -482,13 +483,13 @@ extern inline pte_t pte_wrprotect(pte_t pte) | |||
| 482 | return pte; | 483 | return pte; |
| 483 | } | 484 | } |
| 484 | 485 | ||
| 485 | extern inline pte_t pte_mkwrite(pte_t pte) | 486 | static inline pte_t pte_mkwrite(pte_t pte) |
| 486 | { | 487 | { |
| 487 | pte_val(pte) &= ~_PAGE_RO; | 488 | pte_val(pte) &= ~_PAGE_RO; |
| 488 | return pte; | 489 | return pte; |
| 489 | } | 490 | } |
| 490 | 491 | ||
| 491 | extern inline pte_t pte_mkclean(pte_t pte) | 492 | static inline pte_t pte_mkclean(pte_t pte) |
| 492 | { | 493 | { |
| 493 | /* The only user of pte_mkclean is the fork() code. | 494 | /* The only user of pte_mkclean is the fork() code. |
| 494 | We must *not* clear the *physical* page dirty bit | 495 | We must *not* clear the *physical* page dirty bit |
| @@ -497,7 +498,7 @@ extern inline pte_t pte_mkclean(pte_t pte) | |||
| 497 | return pte; | 498 | return pte; |
| 498 | } | 499 | } |
| 499 | 500 | ||
| 500 | extern inline pte_t pte_mkdirty(pte_t pte) | 501 | static inline pte_t pte_mkdirty(pte_t pte) |
| 501 | { | 502 | { |
| 502 | /* We do not explicitly set the dirty bit because the | 503 | /* We do not explicitly set the dirty bit because the |
| 503 | * sske instruction is slow. It is faster to let the | 504 | * sske instruction is slow. It is faster to let the |
| @@ -506,7 +507,7 @@ extern inline pte_t pte_mkdirty(pte_t pte) | |||
| 506 | return pte; | 507 | return pte; |
| 507 | } | 508 | } |
| 508 | 509 | ||
| 509 | extern inline pte_t pte_mkold(pte_t pte) | 510 | static inline pte_t pte_mkold(pte_t pte) |
| 510 | { | 511 | { |
| 511 | /* S/390 doesn't keep its dirty/referenced bit in the pte. | 512 | /* S/390 doesn't keep its dirty/referenced bit in the pte. |
| 512 | * There is no point in clearing the real referenced bit. | 513 | * There is no point in clearing the real referenced bit. |
| @@ -514,7 +515,7 @@ extern inline pte_t pte_mkold(pte_t pte) | |||
| 514 | return pte; | 515 | return pte; |
| 515 | } | 516 | } |
| 516 | 517 | ||
| 517 | extern inline pte_t pte_mkyoung(pte_t pte) | 518 | static inline pte_t pte_mkyoung(pte_t pte) |
| 518 | { | 519 | { |
| 519 | /* S/390 doesn't keep its dirty/referenced bit in the pte. | 520 | /* S/390 doesn't keep its dirty/referenced bit in the pte. |
| 520 | * There is no point in setting the real referenced bit. | 521 | * There is no point in setting the real referenced bit. |
| @@ -694,7 +695,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) | |||
| 694 | #ifndef __s390x__ | 695 | #ifndef __s390x__ |
| 695 | 696 | ||
| 696 | /* Find an entry in the second-level page table.. */ | 697 | /* Find an entry in the second-level page table.. */ |
| 697 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | 698 | static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) |
| 698 | { | 699 | { |
| 699 | return (pmd_t *) dir; | 700 | return (pmd_t *) dir; |
| 700 | } | 701 | } |
| @@ -757,7 +758,7 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
| 757 | #else | 758 | #else |
| 758 | #define __SWP_OFFSET_MASK (~0UL >> 11) | 759 | #define __SWP_OFFSET_MASK (~0UL >> 11) |
| 759 | #endif | 760 | #endif |
| 760 | extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | 761 | static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) |
| 761 | { | 762 | { |
| 762 | pte_t pte; | 763 | pte_t pte; |
| 763 | offset &= __SWP_OFFSET_MASK; | 764 | offset &= __SWP_OFFSET_MASK; |
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index fc7c96edc697..a949cc077cc7 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h | |||
| @@ -468,6 +468,8 @@ struct user_regs_struct | |||
| 468 | }; | 468 | }; |
| 469 | 469 | ||
| 470 | #ifdef __KERNEL__ | 470 | #ifdef __KERNEL__ |
| 471 | #define __ARCH_SYS_PTRACE 1 | ||
| 472 | |||
| 471 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) | 473 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) |
| 472 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) | 474 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) |
| 473 | #define profile_pc(regs) instruction_pointer(regs) | 475 | #define profile_pc(regs) instruction_pointer(regs) |
diff --git a/include/asm-s390/sigp.h b/include/asm-s390/sigp.h index 3979bc3858e2..fc56458aff66 100644 --- a/include/asm-s390/sigp.h +++ b/include/asm-s390/sigp.h | |||
| @@ -67,7 +67,7 @@ typedef enum | |||
| 67 | /* | 67 | /* |
| 68 | * Signal processor | 68 | * Signal processor |
| 69 | */ | 69 | */ |
| 70 | extern __inline__ sigp_ccode | 70 | static inline sigp_ccode |
| 71 | signal_processor(__u16 cpu_addr, sigp_order_code order_code) | 71 | signal_processor(__u16 cpu_addr, sigp_order_code order_code) |
| 72 | { | 72 | { |
| 73 | sigp_ccode ccode; | 73 | sigp_ccode ccode; |
| @@ -86,7 +86,7 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code) | |||
| 86 | /* | 86 | /* |
| 87 | * Signal processor with parameter | 87 | * Signal processor with parameter |
| 88 | */ | 88 | */ |
| 89 | extern __inline__ sigp_ccode | 89 | static inline sigp_ccode |
| 90 | signal_processor_p(__u32 parameter, __u16 cpu_addr, | 90 | signal_processor_p(__u32 parameter, __u16 cpu_addr, |
| 91 | sigp_order_code order_code) | 91 | sigp_order_code order_code) |
| 92 | { | 92 | { |
| @@ -107,7 +107,7 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr, | |||
| 107 | /* | 107 | /* |
| 108 | * Signal processor with parameter and return status | 108 | * Signal processor with parameter and return status |
| 109 | */ | 109 | */ |
| 110 | extern __inline__ sigp_ccode | 110 | static inline sigp_ccode |
| 111 | signal_processor_ps(__u32 *statusptr, __u32 parameter, | 111 | signal_processor_ps(__u32 *statusptr, __u32 parameter, |
| 112 | __u16 cpu_addr, sigp_order_code order_code) | 112 | __u16 cpu_addr, sigp_order_code order_code) |
| 113 | { | 113 | { |
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index dd50e57a928f..a2ae7628bbaa 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h | |||
| @@ -52,7 +52,7 @@ extern int smp_call_function_on(void (*func) (void *info), void *info, | |||
| 52 | extern int smp_get_cpu(cpumask_t cpu_map); | 52 | extern int smp_get_cpu(cpumask_t cpu_map); |
| 53 | extern void smp_put_cpu(int cpu); | 53 | extern void smp_put_cpu(int cpu); |
| 54 | 54 | ||
| 55 | extern __inline__ __u16 hard_smp_processor_id(void) | 55 | static inline __u16 hard_smp_processor_id(void) |
| 56 | { | 56 | { |
| 57 | __u16 cpu_address; | 57 | __u16 cpu_address; |
| 58 | 58 | ||
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h index 38a5cf8ab9e3..10a619da4761 100644 --- a/include/asm-s390/uaccess.h +++ b/include/asm-s390/uaccess.h | |||
| @@ -200,21 +200,37 @@ extern int __put_user_bad(void) __attribute__((noreturn)); | |||
| 200 | 200 | ||
| 201 | #define __get_user(x, ptr) \ | 201 | #define __get_user(x, ptr) \ |
| 202 | ({ \ | 202 | ({ \ |
| 203 | __typeof__(*(ptr)) __x; \ | ||
| 204 | int __gu_err; \ | 203 | int __gu_err; \ |
| 205 | __chk_user_ptr(ptr); \ | 204 | __chk_user_ptr(ptr); \ |
| 206 | switch (sizeof(*(ptr))) { \ | 205 | switch (sizeof(*(ptr))) { \ |
| 207 | case 1: \ | 206 | case 1: { \ |
| 208 | case 2: \ | 207 | unsigned char __x; \ |
| 209 | case 4: \ | 208 | __get_user_asm(__x, ptr, __gu_err); \ |
| 210 | case 8: \ | 209 | (x) = (__typeof__(*(ptr))) __x; \ |
| 210 | break; \ | ||
| 211 | }; \ | ||
| 212 | case 2: { \ | ||
| 213 | unsigned short __x; \ | ||
| 214 | __get_user_asm(__x, ptr, __gu_err); \ | ||
| 215 | (x) = (__typeof__(*(ptr))) __x; \ | ||
| 216 | break; \ | ||
| 217 | }; \ | ||
| 218 | case 4: { \ | ||
| 219 | unsigned int __x; \ | ||
| 220 | __get_user_asm(__x, ptr, __gu_err); \ | ||
| 221 | (x) = (__typeof__(*(ptr))) __x; \ | ||
| 222 | break; \ | ||
| 223 | }; \ | ||
| 224 | case 8: { \ | ||
| 225 | unsigned long long __x; \ | ||
| 211 | __get_user_asm(__x, ptr, __gu_err); \ | 226 | __get_user_asm(__x, ptr, __gu_err); \ |
| 227 | (x) = (__typeof__(*(ptr))) __x; \ | ||
| 212 | break; \ | 228 | break; \ |
| 229 | }; \ | ||
| 213 | default: \ | 230 | default: \ |
| 214 | __get_user_bad(); \ | 231 | __get_user_bad(); \ |
| 215 | break; \ | 232 | break; \ |
| 216 | } \ | 233 | } \ |
| 217 | (x) = __x; \ | ||
| 218 | __gu_err; \ | 234 | __gu_err; \ |
| 219 | }) | 235 | }) |
| 220 | 236 | ||
diff --git a/include/asm-s390/vtoc.h b/include/asm-s390/vtoc.h index a14e34e80b88..41d369f38b0e 100644 --- a/include/asm-s390/vtoc.h +++ b/include/asm-s390/vtoc.h | |||
| @@ -1,372 +1,179 @@ | |||
| 1 | #ifndef __KERNEL__ | 1 | /* |
| 2 | #include <string.h> | 2 | * include/asm-s390/vtoc.h |
| 3 | #include <stdlib.h> | 3 | * |
| 4 | #include <stdio.h> | 4 | * This file contains volume label definitions for DASD devices. |
| 5 | #include <errno.h> | 5 | * |
| 6 | #include <ctype.h> | 6 | * (C) Copyright IBM Corp. 2005 |
| 7 | #include <time.h> | 7 | * |
| 8 | #include <fcntl.h> | 8 | * Author(s): Volker Sameske <sameske@de.ibm.com> |
| 9 | #include <unistd.h> | 9 | * |
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _ASM_S390_VTOC_H | ||
| 13 | #define _ASM_S390_VTOC_H | ||
| 10 | 14 | ||
| 11 | #include <sys/stat.h> | ||
| 12 | #include <sys/ioctl.h> | ||
| 13 | |||
| 14 | #include <linux/fs.h> | ||
| 15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 16 | #include <linux/hdreg.h> | ||
| 17 | #include <asm/dasd.h> | ||
| 18 | #endif | ||
| 19 | |||
| 20 | |||
| 21 | #define LINE_LENGTH 80 | ||
| 22 | #define VTOC_START_CC 0x0 | ||
| 23 | #define VTOC_START_HH 0x1 | ||
| 24 | #define FIRST_USABLE_CYL 1 | ||
| 25 | #define FIRST_USABLE_TRK 2 | ||
| 26 | |||
| 27 | #define DASD_3380_TYPE 13148 | ||
| 28 | #define DASD_3390_TYPE 13200 | ||
| 29 | #define DASD_9345_TYPE 37701 | ||
| 30 | |||
| 31 | #define DASD_3380_VALUE 0xbb60 | ||
| 32 | #define DASD_3390_VALUE 0xe5a2 | ||
| 33 | #define DASD_9345_VALUE 0xbc98 | ||
| 34 | |||
| 35 | #define VOLSER_LENGTH 6 | ||
| 36 | #define BIG_DISK_SIZE 0x10000 | ||
| 37 | |||
| 38 | #define VTOC_ERROR "VTOC error:" | ||
| 39 | |||
| 40 | 16 | ||
| 41 | typedef struct ttr | 17 | struct vtoc_ttr |
| 42 | { | 18 | { |
| 43 | __u16 tt; | 19 | __u16 tt; |
| 44 | __u8 r; | 20 | __u8 r; |
| 45 | } __attribute__ ((packed)) ttr_t; | 21 | } __attribute__ ((packed)); |
| 46 | 22 | ||
| 47 | typedef struct cchhb | 23 | struct vtoc_cchhb |
| 48 | { | 24 | { |
| 49 | __u16 cc; | 25 | __u16 cc; |
| 50 | __u16 hh; | 26 | __u16 hh; |
| 51 | __u8 b; | 27 | __u8 b; |
| 52 | } __attribute__ ((packed)) cchhb_t; | 28 | } __attribute__ ((packed)); |
| 53 | 29 | ||
| 54 | typedef struct cchh | 30 | struct vtoc_cchh |
| 55 | { | 31 | { |
| 56 | __u16 cc; | 32 | __u16 cc; |
| 57 | __u16 hh; | 33 | __u16 hh; |
| 58 | } __attribute__ ((packed)) cchh_t; | 34 | } __attribute__ ((packed)); |
| 59 | 35 | ||
| 60 | typedef struct labeldate | 36 | struct vtoc_labeldate |
| 61 | { | 37 | { |
| 62 | __u8 year; | 38 | __u8 year; |
| 63 | __u16 day; | 39 | __u16 day; |
| 64 | } __attribute__ ((packed)) labeldate_t; | 40 | } __attribute__ ((packed)); |
| 65 | 41 | ||
| 66 | 42 | struct vtoc_volume_label | |
| 67 | typedef struct volume_label | ||
| 68 | { | 43 | { |
| 69 | char volkey[4]; /* volume key = volume label */ | 44 | char volkey[4]; /* volume key = volume label */ |
| 70 | char vollbl[4]; /* volume label */ | 45 | char vollbl[4]; /* volume label */ |
| 71 | char volid[6]; /* volume identifier */ | 46 | char volid[6]; /* volume identifier */ |
| 72 | __u8 security; /* security byte */ | 47 | __u8 security; /* security byte */ |
| 73 | cchhb_t vtoc; /* VTOC address */ | 48 | struct vtoc_cchhb vtoc; /* VTOC address */ |
| 74 | char res1[5]; /* reserved */ | 49 | char res1[5]; /* reserved */ |
| 75 | char cisize[4]; /* CI-size for FBA,... */ | 50 | char cisize[4]; /* CI-size for FBA,... */ |
| 76 | /* ...blanks for CKD */ | 51 | /* ...blanks for CKD */ |
| 77 | char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */ | 52 | char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */ |
| 78 | char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ | 53 | char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ |
| 79 | char res2[4]; /* reserved */ | 54 | char res2[4]; /* reserved */ |
| 80 | char lvtoc[14]; /* owner code for LVTOC */ | 55 | char lvtoc[14]; /* owner code for LVTOC */ |
| 81 | char res3[29]; /* reserved */ | 56 | char res3[29]; /* reserved */ |
| 82 | } __attribute__ ((packed)) volume_label_t; | 57 | } __attribute__ ((packed)); |
| 83 | 58 | ||
| 84 | 59 | struct vtoc_extent | |
| 85 | typedef struct extent | ||
| 86 | { | 60 | { |
| 87 | __u8 typeind; /* extent type indicator */ | 61 | __u8 typeind; /* extent type indicator */ |
| 88 | __u8 seqno; /* extent sequence number */ | 62 | __u8 seqno; /* extent sequence number */ |
| 89 | cchh_t llimit; /* starting point of this extent */ | 63 | struct vtoc_cchh llimit; /* starting point of this extent */ |
| 90 | cchh_t ulimit; /* ending point of this extent */ | 64 | struct vtoc_cchh ulimit; /* ending point of this extent */ |
| 91 | } __attribute__ ((packed)) extent_t; | 65 | } __attribute__ ((packed)); |
| 92 | |||
| 93 | 66 | ||
| 94 | typedef struct dev_const | 67 | struct vtoc_dev_const |
| 95 | { | 68 | { |
| 96 | __u16 DS4DSCYL; /* number of logical cyls */ | 69 | __u16 DS4DSCYL; /* number of logical cyls */ |
| 97 | __u16 DS4DSTRK; /* number of tracks in a logical cylinder */ | 70 | __u16 DS4DSTRK; /* number of tracks in a logical cylinder */ |
| 98 | __u16 DS4DEVTK; /* device track length */ | 71 | __u16 DS4DEVTK; /* device track length */ |
| 99 | __u8 DS4DEVI; /* non-last keyed record overhead */ | 72 | __u8 DS4DEVI; /* non-last keyed record overhead */ |
| 100 | __u8 DS4DEVL; /* last keyed record overhead */ | 73 | __u8 DS4DEVL; /* last keyed record overhead */ |
| 101 | __u8 DS4DEVK; /* non-keyed record overhead differential */ | 74 | __u8 DS4DEVK; /* non-keyed record overhead differential */ |
| 102 | __u8 DS4DEVFG; /* flag byte */ | 75 | __u8 DS4DEVFG; /* flag byte */ |
| 103 | __u16 DS4DEVTL; /* device tolerance */ | 76 | __u16 DS4DEVTL; /* device tolerance */ |
| 104 | __u8 DS4DEVDT; /* number of DSCB's per track */ | 77 | __u8 DS4DEVDT; /* number of DSCB's per track */ |
| 105 | __u8 DS4DEVDB; /* number of directory blocks per track */ | 78 | __u8 DS4DEVDB; /* number of directory blocks per track */ |
| 106 | } __attribute__ ((packed)) dev_const_t; | 79 | } __attribute__ ((packed)); |
| 107 | 80 | ||
| 108 | 81 | struct vtoc_format1_label | |
| 109 | typedef struct format1_label | ||
| 110 | { | 82 | { |
| 111 | char DS1DSNAM[44]; /* data set name */ | 83 | char DS1DSNAM[44]; /* data set name */ |
| 112 | __u8 DS1FMTID; /* format identifier */ | 84 | __u8 DS1FMTID; /* format identifier */ |
| 113 | char DS1DSSN[6]; /* data set serial number */ | 85 | char DS1DSSN[6]; /* data set serial number */ |
| 114 | __u16 DS1VOLSQ; /* volume sequence number */ | 86 | __u16 DS1VOLSQ; /* volume sequence number */ |
| 115 | labeldate_t DS1CREDT; /* creation date: ydd */ | 87 | struct vtoc_labeldate DS1CREDT; /* creation date: ydd */ |
| 116 | labeldate_t DS1EXPDT; /* expiration date */ | 88 | struct vtoc_labeldate DS1EXPDT; /* expiration date */ |
| 117 | __u8 DS1NOEPV; /* number of extents on volume */ | 89 | __u8 DS1NOEPV; /* number of extents on volume */ |
| 118 | __u8 DS1NOBDB; /* no. of bytes used in last direction blk */ | 90 | __u8 DS1NOBDB; /* no. of bytes used in last direction blk */ |
| 119 | __u8 DS1FLAG1; /* flag 1 */ | 91 | __u8 DS1FLAG1; /* flag 1 */ |
| 120 | char DS1SYSCD[13]; /* system code */ | 92 | char DS1SYSCD[13]; /* system code */ |
| 121 | labeldate_t DS1REFD; /* date last referenced */ | 93 | struct vtoc_labeldate DS1REFD; /* date last referenced */ |
| 122 | __u8 DS1SMSFG; /* system managed storage indicators */ | 94 | __u8 DS1SMSFG; /* system managed storage indicators */ |
| 123 | __u8 DS1SCXTF; /* sec. space extension flag byte */ | 95 | __u8 DS1SCXTF; /* sec. space extension flag byte */ |
| 124 | __u16 DS1SCXTV; /* secondary space extension value */ | 96 | __u16 DS1SCXTV; /* secondary space extension value */ |
| 125 | __u8 DS1DSRG1; /* data set organisation byte 1 */ | 97 | __u8 DS1DSRG1; /* data set organisation byte 1 */ |
| 126 | __u8 DS1DSRG2; /* data set organisation byte 2 */ | 98 | __u8 DS1DSRG2; /* data set organisation byte 2 */ |
| 127 | __u8 DS1RECFM; /* record format */ | 99 | __u8 DS1RECFM; /* record format */ |
| 128 | __u8 DS1OPTCD; /* option code */ | 100 | __u8 DS1OPTCD; /* option code */ |
| 129 | __u16 DS1BLKL; /* block length */ | 101 | __u16 DS1BLKL; /* block length */ |
| 130 | __u16 DS1LRECL; /* record length */ | 102 | __u16 DS1LRECL; /* record length */ |
| 131 | __u8 DS1KEYL; /* key length */ | 103 | __u8 DS1KEYL; /* key length */ |
| 132 | __u16 DS1RKP; /* relative key position */ | 104 | __u16 DS1RKP; /* relative key position */ |
| 133 | __u8 DS1DSIND; /* data set indicators */ | 105 | __u8 DS1DSIND; /* data set indicators */ |
| 134 | __u8 DS1SCAL1; /* secondary allocation flag byte */ | 106 | __u8 DS1SCAL1; /* secondary allocation flag byte */ |
| 135 | char DS1SCAL3[3]; /* secondary allocation quantity */ | 107 | char DS1SCAL3[3]; /* secondary allocation quantity */ |
| 136 | ttr_t DS1LSTAR; /* last used track and block on track */ | 108 | struct vtoc_ttr DS1LSTAR; /* last used track and block on track */ |
| 137 | __u16 DS1TRBAL; /* space remaining on last used track */ | 109 | __u16 DS1TRBAL; /* space remaining on last used track */ |
| 138 | __u16 res1; /* reserved */ | 110 | __u16 res1; /* reserved */ |
| 139 | extent_t DS1EXT1; /* first extent description */ | 111 | struct vtoc_extent DS1EXT1; /* first extent description */ |
| 140 | extent_t DS1EXT2; /* second extent description */ | 112 | struct vtoc_extent DS1EXT2; /* second extent description */ |
| 141 | extent_t DS1EXT3; /* third extent description */ | 113 | struct vtoc_extent DS1EXT3; /* third extent description */ |
| 142 | cchhb_t DS1PTRDS; /* possible pointer to f2 or f3 DSCB */ | 114 | struct vtoc_cchhb DS1PTRDS; /* possible pointer to f2 or f3 DSCB */ |
| 143 | } __attribute__ ((packed)) format1_label_t; | 115 | } __attribute__ ((packed)); |
| 144 | 116 | ||
| 145 | 117 | struct vtoc_format4_label | |
| 146 | typedef struct format4_label | ||
| 147 | { | 118 | { |
| 148 | char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */ | 119 | char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */ |
| 149 | __u8 DS4IDFMT; /* format identifier */ | 120 | __u8 DS4IDFMT; /* format identifier */ |
| 150 | cchhb_t DS4HPCHR; /* highest address of a format 1 DSCB */ | 121 | struct vtoc_cchhb DS4HPCHR; /* highest address of a format 1 DSCB */ |
| 151 | __u16 DS4DSREC; /* number of available DSCB's */ | 122 | __u16 DS4DSREC; /* number of available DSCB's */ |
| 152 | cchh_t DS4HCCHH; /* CCHH of next available alternate track */ | 123 | struct vtoc_cchh DS4HCCHH; /* CCHH of next available alternate track */ |
| 153 | __u16 DS4NOATK; /* number of remaining alternate tracks */ | 124 | __u16 DS4NOATK; /* number of remaining alternate tracks */ |
| 154 | __u8 DS4VTOCI; /* VTOC indicators */ | 125 | __u8 DS4VTOCI; /* VTOC indicators */ |
| 155 | __u8 DS4NOEXT; /* number of extents in VTOC */ | 126 | __u8 DS4NOEXT; /* number of extents in VTOC */ |
| 156 | __u8 DS4SMSFG; /* system managed storage indicators */ | 127 | __u8 DS4SMSFG; /* system managed storage indicators */ |
| 157 | __u8 DS4DEVAC; /* number of alternate cylinders. | 128 | __u8 DS4DEVAC; /* number of alternate cylinders. |
| 158 | Subtract from first two bytes of | 129 | * Subtract from first two bytes of |
| 159 | DS4DEVSZ to get number of usable | 130 | * DS4DEVSZ to get number of usable |
| 160 | cylinders. can be zero. valid | 131 | * cylinders. can be zero. valid |
| 161 | only if DS4DEVAV on. */ | 132 | * only if DS4DEVAV on. */ |
| 162 | dev_const_t DS4DEVCT; /* device constants */ | 133 | struct vtoc_dev_const DS4DEVCT; /* device constants */ |
| 163 | char DS4AMTIM[8]; /* VSAM time stamp */ | 134 | char DS4AMTIM[8]; /* VSAM time stamp */ |
| 164 | char DS4AMCAT[3]; /* VSAM catalog indicator */ | 135 | char DS4AMCAT[3]; /* VSAM catalog indicator */ |
| 165 | char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */ | 136 | char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */ |
| 166 | char res1[5]; /* reserved */ | 137 | char res1[5]; /* reserved */ |
| 167 | char DS4F6PTR[5]; /* pointer to first format 6 DSCB */ | 138 | char DS4F6PTR[5]; /* pointer to first format 6 DSCB */ |
| 168 | extent_t DS4VTOCE; /* VTOC extent description */ | 139 | struct vtoc_extent DS4VTOCE; /* VTOC extent description */ |
| 169 | char res2[10]; /* reserved */ | 140 | char res2[10]; /* reserved */ |
| 170 | __u8 DS4EFLVL; /* extended free-space management level */ | 141 | __u8 DS4EFLVL; /* extended free-space management level */ |
| 171 | cchhb_t DS4EFPTR; /* pointer to extended free-space info */ | 142 | struct vtoc_cchhb DS4EFPTR; /* pointer to extended free-space info */ |
| 172 | char res3[9]; /* reserved */ | 143 | char res3[9]; /* reserved */ |
| 173 | } __attribute__ ((packed)) format4_label_t; | 144 | } __attribute__ ((packed)); |
| 174 | 145 | ||
| 175 | 146 | struct vtoc_ds5ext | |
| 176 | typedef struct ds5ext | ||
| 177 | { | 147 | { |
| 178 | __u16 t; /* RTA of the first track of free extent */ | 148 | __u16 t; /* RTA of the first track of free extent */ |
| 179 | __u16 fc; /* number of whole cylinders in free ext. */ | 149 | __u16 fc; /* number of whole cylinders in free ext. */ |
| 180 | __u8 ft; /* number of remaining free tracks */ | 150 | __u8 ft; /* number of remaining free tracks */ |
| 181 | } __attribute__ ((packed)) ds5ext_t; | 151 | } __attribute__ ((packed)); |
| 182 | |||
| 183 | 152 | ||
| 184 | typedef struct format5_label | 153 | struct vtoc_format5_label |
| 185 | { | 154 | { |
| 186 | char DS5KEYID[4]; /* key identifier */ | 155 | char DS5KEYID[4]; /* key identifier */ |
| 187 | ds5ext_t DS5AVEXT; /* first available (free-space) extent. */ | 156 | struct vtoc_ds5ext DS5AVEXT; /* first available (free-space) extent. */ |
| 188 | ds5ext_t DS5EXTAV[7]; /* seven available extents */ | 157 | struct vtoc_ds5ext DS5EXTAV[7]; /* seven available extents */ |
| 189 | __u8 DS5FMTID; /* format identifier */ | 158 | __u8 DS5FMTID; /* format identifier */ |
| 190 | ds5ext_t DS5MAVET[18]; /* eighteen available extents */ | 159 | struct vtoc_ds5ext DS5MAVET[18]; /* eighteen available extents */ |
| 191 | cchhb_t DS5PTRDS; /* pointer to next format5 DSCB */ | 160 | struct vtoc_cchhb DS5PTRDS; /* pointer to next format5 DSCB */ |
| 192 | } __attribute__ ((packed)) format5_label_t; | 161 | } __attribute__ ((packed)); |
| 193 | 162 | ||
| 194 | 163 | struct vtoc_ds7ext | |
| 195 | typedef struct ds7ext | ||
| 196 | { | 164 | { |
| 197 | __u32 a; /* starting RTA value */ | 165 | __u32 a; /* starting RTA value */ |
| 198 | __u32 b; /* ending RTA value + 1 */ | 166 | __u32 b; /* ending RTA value + 1 */ |
| 199 | } __attribute__ ((packed)) ds7ext_t; | 167 | } __attribute__ ((packed)); |
| 200 | 168 | ||
| 201 | 169 | struct vtoc_format7_label | |
| 202 | typedef struct format7_label | ||
| 203 | { | 170 | { |
| 204 | char DS7KEYID[4]; /* key identifier */ | 171 | char DS7KEYID[4]; /* key identifier */ |
| 205 | ds7ext_t DS7EXTNT[5]; /* space for 5 extent descriptions */ | 172 | struct vtoc_ds7ext DS7EXTNT[5]; /* space for 5 extent descriptions */ |
| 206 | __u8 DS7FMTID; /* format identifier */ | 173 | __u8 DS7FMTID; /* format identifier */ |
| 207 | ds7ext_t DS7ADEXT[11]; /* space for 11 extent descriptions */ | 174 | struct vtoc_ds7ext DS7ADEXT[11]; /* space for 11 extent descriptions */ |
| 208 | char res1[2]; /* reserved */ | 175 | char res1[2]; /* reserved */ |
| 209 | cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ | 176 | struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */ |
| 210 | } __attribute__ ((packed)) format7_label_t; | 177 | } __attribute__ ((packed)); |
| 211 | 178 | ||
| 212 | 179 | #endif /* _ASM_S390_VTOC_H */ | |
| 213 | char * vtoc_ebcdic_enc ( | ||
| 214 | unsigned char source[LINE_LENGTH], | ||
| 215 | unsigned char target[LINE_LENGTH], | ||
| 216 | int l); | ||
| 217 | char * vtoc_ebcdic_dec ( | ||
| 218 | unsigned char source[LINE_LENGTH], | ||
| 219 | unsigned char target[LINE_LENGTH], | ||
| 220 | int l); | ||
| 221 | void vtoc_set_extent ( | ||
| 222 | extent_t * ext, | ||
| 223 | __u8 typeind, | ||
| 224 | __u8 seqno, | ||
| 225 | cchh_t * lower, | ||
| 226 | cchh_t * upper); | ||
| 227 | void vtoc_set_cchh ( | ||
| 228 | cchh_t * addr, | ||
| 229 | __u16 cc, | ||
| 230 | __u16 hh); | ||
| 231 | void vtoc_set_cchhb ( | ||
| 232 | cchhb_t * addr, | ||
| 233 | __u16 cc, | ||
| 234 | __u16 hh, | ||
| 235 | __u8 b); | ||
| 236 | void vtoc_set_date ( | ||
| 237 | labeldate_t * d, | ||
| 238 | __u8 year, | ||
| 239 | __u16 day); | ||
| 240 | |||
| 241 | void vtoc_volume_label_init ( | ||
| 242 | volume_label_t *vlabel); | ||
| 243 | |||
| 244 | int vtoc_read_volume_label ( | ||
| 245 | char * device, | ||
| 246 | unsigned long vlabel_start, | ||
| 247 | volume_label_t * vlabel); | ||
| 248 | |||
| 249 | int vtoc_write_volume_label ( | ||
| 250 | char *device, | ||
| 251 | unsigned long vlabel_start, | ||
| 252 | volume_label_t *vlabel); | ||
| 253 | |||
| 254 | void vtoc_volume_label_set_volser ( | ||
| 255 | volume_label_t *vlabel, | ||
| 256 | char *volser); | ||
| 257 | |||
| 258 | char *vtoc_volume_label_get_volser ( | ||
| 259 | volume_label_t *vlabel, | ||
| 260 | char *volser); | ||
| 261 | |||
| 262 | void vtoc_volume_label_set_key ( | ||
| 263 | volume_label_t *vlabel, | ||
| 264 | char *key); | ||
| 265 | |||
| 266 | void vtoc_volume_label_set_label ( | ||
| 267 | volume_label_t *vlabel, | ||
| 268 | char *lbl); | ||
| 269 | |||
| 270 | char *vtoc_volume_label_get_label ( | ||
| 271 | volume_label_t *vlabel, | ||
| 272 | char *lbl); | ||
| 273 | |||
| 274 | void vtoc_read_label ( | ||
| 275 | char *device, | ||
| 276 | unsigned long position, | ||
| 277 | format1_label_t *f1, | ||
| 278 | format4_label_t *f4, | ||
| 279 | format5_label_t *f5, | ||
| 280 | format7_label_t *f7); | ||
| 281 | |||
| 282 | void vtoc_write_label ( | ||
| 283 | char *device, | ||
| 284 | unsigned long position, | ||
| 285 | format1_label_t *f1, | ||
| 286 | format4_label_t *f4, | ||
| 287 | format5_label_t *f5, | ||
| 288 | format7_label_t *f7); | ||
| 289 | |||
| 290 | |||
| 291 | void vtoc_init_format1_label ( | ||
| 292 | char *volid, | ||
| 293 | unsigned int blksize, | ||
| 294 | extent_t *part_extent, | ||
| 295 | format1_label_t *f1); | ||
| 296 | |||
| 297 | |||
| 298 | void vtoc_init_format4_label ( | ||
| 299 | format4_label_t *f4lbl, | ||
| 300 | unsigned int usable_partitions, | ||
| 301 | unsigned int cylinders, | ||
| 302 | unsigned int tracks, | ||
| 303 | unsigned int blocks, | ||
| 304 | unsigned int blksize, | ||
| 305 | __u16 dev_type); | ||
| 306 | |||
| 307 | void vtoc_update_format4_label ( | ||
| 308 | format4_label_t *f4, | ||
| 309 | cchhb_t *highest_f1, | ||
| 310 | __u16 unused_update); | ||
| 311 | |||
| 312 | |||
| 313 | void vtoc_init_format5_label ( | ||
| 314 | format5_label_t *f5); | ||
| 315 | |||
| 316 | void vtoc_update_format5_label_add ( | ||
| 317 | format5_label_t *f5, | ||
| 318 | int verbose, | ||
| 319 | int cyl, | ||
| 320 | int trk, | ||
| 321 | __u16 a, | ||
| 322 | __u16 b, | ||
| 323 | __u8 c); | ||
| 324 | |||
| 325 | void vtoc_update_format5_label_del ( | ||
| 326 | format5_label_t *f5, | ||
| 327 | int verbose, | ||
| 328 | int cyl, | ||
| 329 | int trk, | ||
| 330 | __u16 a, | ||
| 331 | __u16 b, | ||
| 332 | __u8 c); | ||
| 333 | |||
| 334 | |||
| 335 | void vtoc_init_format7_label ( | ||
| 336 | format7_label_t *f7); | ||
| 337 | |||
| 338 | void vtoc_update_format7_label_add ( | ||
| 339 | format7_label_t *f7, | ||
| 340 | int verbose, | ||
| 341 | __u32 a, | ||
| 342 | __u32 b); | ||
| 343 | |||
| 344 | void vtoc_update_format7_label_del ( | ||
| 345 | format7_label_t *f7, | ||
| 346 | int verbose, | ||
| 347 | __u32 a, | ||
| 348 | __u32 b); | ||
| 349 | |||
| 350 | |||
| 351 | void vtoc_set_freespace( | ||
| 352 | format4_label_t *f4, | ||
| 353 | format5_label_t *f5, | ||
| 354 | format7_label_t *f7, | ||
| 355 | char ch, | ||
| 356 | int verbose, | ||
| 357 | __u32 start, | ||
| 358 | __u32 stop, | ||
| 359 | int cyl, | ||
| 360 | int trk); | ||
| 361 | |||
| 362 | |||
| 363 | |||
| 364 | |||
| 365 | |||
| 366 | |||
| 367 | |||
| 368 | |||
| 369 | |||
| 370 | |||
| 371 | |||
| 372 | |||
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h index 8fe00a1981ce..1b63dfeea4f2 100644 --- a/include/asm-sh/elf.h +++ b/include/asm-sh/elf.h | |||
| @@ -111,6 +111,7 @@ typedef struct user_fpu_struct elf_fpregset_t; | |||
| 111 | 111 | ||
| 112 | #ifdef __KERNEL__ | 112 | #ifdef __KERNEL__ |
| 113 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) | 113 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) |
| 114 | struct task_struct; | ||
| 114 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); | 115 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); |
| 115 | extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); | 116 | extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); |
| 116 | 117 | ||
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-sh/mmzone.h b/include/asm-sh/mmzone.h deleted file mode 100644 index 0e7406601fdf..000000000000 --- a/include/asm-sh/mmzone.h +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/asm-sh/mmzone.h | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License version 2 as | ||
| 6 | * published by the Free Software Foundation. | ||
| 7 | */ | ||
| 8 | #ifndef __ASM_SH_MMZONE_H | ||
| 9 | #define __ASM_SH_MMZONE_H | ||
| 10 | |||
| 11 | #include <linux/config.h> | ||
| 12 | |||
| 13 | #ifdef CONFIG_DISCONTIGMEM | ||
| 14 | |||
| 15 | /* Currently, just for HP690 */ | ||
| 16 | #define PHYSADDR_TO_NID(phys) ((((phys) - __MEMORY_START) >= 0x01000000)?1:0) | ||
| 17 | |||
| 18 | extern pg_data_t discontig_page_data[MAX_NUMNODES]; | ||
| 19 | extern bootmem_data_t discontig_node_bdata[MAX_NUMNODES]; | ||
| 20 | |||
| 21 | /* | ||
| 22 | * Following are macros that each numa implmentation must define. | ||
| 23 | */ | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Given a kernel address, find the home node of the underlying memory. | ||
| 27 | */ | ||
| 28 | #define KVADDR_TO_NID(kaddr) PHYSADDR_TO_NID(__pa(kaddr)) | ||
| 29 | |||
| 30 | /* | ||
| 31 | * Return a pointer to the node data for node n. | ||
| 32 | */ | ||
| 33 | #define NODE_DATA(nid) (&discontig_page_data[nid]) | ||
| 34 | |||
| 35 | /* | ||
| 36 | * NODE_MEM_MAP gives the kaddr for the mem_map of the node. | ||
| 37 | */ | ||
| 38 | #define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) | ||
| 39 | |||
| 40 | #define phys_to_page(phys) \ | ||
| 41 | ({ unsigned int node = PHYSADDR_TO_NID(phys); \ | ||
| 42 | NODE_MEM_MAP(node) \ | ||
| 43 | + (((phys) - NODE_DATA(node)->node_start_paddr) >> PAGE_SHIFT); }) | ||
| 44 | |||
| 45 | static inline int is_valid_page(struct page *page) | ||
| 46 | { | ||
| 47 | unsigned int i; | ||
| 48 | |||
| 49 | for (i = 0; i < MAX_NUMNODES; i++) { | ||
| 50 | if (page >= NODE_MEM_MAP(i) && | ||
| 51 | page < NODE_MEM_MAP(i) + NODE_DATA(i)->node_size) | ||
| 52 | return 1; | ||
| 53 | } | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | |||
| 57 | #define VALID_PAGE(page) is_valid_page(page) | ||
| 58 | #define page_to_phys(page) PHYSADDR(page_address(page)) | ||
| 59 | |||
| 60 | #endif /* CONFIG_DISCONTIGMEM */ | ||
| 61 | #endif | ||
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 324e6cc5ecf7..972c3f655b2a 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h | |||
| @@ -93,11 +93,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
| 93 | 93 | ||
| 94 | #define __MEMORY_START CONFIG_MEMORY_START | 94 | #define __MEMORY_START CONFIG_MEMORY_START |
| 95 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE | 95 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE |
| 96 | #ifdef CONFIG_DISCONTIGMEM | ||
| 97 | /* Just for HP690, for now.. */ | ||
| 98 | #define __MEMORY_START_2ND (__MEMORY_START+0x02000000) | ||
| 99 | #define __MEMORY_SIZE_2ND 0x001000000 /* 16MB */ | ||
| 100 | #endif | ||
| 101 | 96 | ||
| 102 | #define PAGE_OFFSET (0x80000000UL) | 97 | #define PAGE_OFFSET (0x80000000UL) |
| 103 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | 98 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) |
| @@ -105,10 +100,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
| 105 | 100 | ||
| 106 | #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) | 101 | #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) |
| 107 | 102 | ||
| 108 | #ifndef CONFIG_DISCONTIGMEM | ||
| 109 | #define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT)) | 103 | #define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT)) |
| 110 | #define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START) | 104 | #define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START) |
| 111 | #endif | ||
| 112 | 105 | ||
| 113 | /* PFN start number, because of __MEMORY_START */ | 106 | /* PFN start number, because of __MEMORY_START */ |
| 114 | #define PFN_START (__MEMORY_START >> PAGE_SHIFT) | 107 | #define PFN_START (__MEMORY_START >> PAGE_SHIFT) |
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index aef8ae43de13..bb0efb31a8cb 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h | |||
| @@ -196,7 +196,9 @@ static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _ | |||
| 196 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 196 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
| 197 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 197 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
| 198 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } | 198 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } |
| 199 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 199 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } | 200 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } |
| 201 | #endif | ||
| 200 | 202 | ||
| 201 | /* | 203 | /* |
| 202 | * Macro and implementation to make a page protection as uncachable. | 204 | * Macro and implementation to make a page protection as uncachable. |
| @@ -282,6 +284,8 @@ typedef pte_t *pte_addr_t; | |||
| 282 | #define GET_IOSPACE(pfn) 0 | 284 | #define GET_IOSPACE(pfn) 0 |
| 283 | #define GET_PFN(pfn) (pfn) | 285 | #define GET_PFN(pfn) (pfn) |
| 284 | 286 | ||
| 287 | struct mm_struct; | ||
| 288 | |||
| 285 | /* | 289 | /* |
| 286 | * No page table caches to initialise | 290 | * No page table caches to initialise |
| 287 | */ | 291 | */ |
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/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h index 51b05818e4eb..a1906a772df9 100644 --- a/include/asm-sh64/pgtable.h +++ b/include/asm-sh64/pgtable.h | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | #include <linux/threads.h> | 24 | #include <linux/threads.h> |
| 25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
| 26 | 26 | ||
| 27 | struct vm_area_struct; | ||
| 28 | |||
| 27 | extern void paging_init(void); | 29 | extern void paging_init(void); |
| 28 | 30 | ||
| 29 | /* We provide our own get_unmapped_area to avoid cache synonym issue */ | 31 | /* We provide our own get_unmapped_area to avoid cache synonym issue */ |
diff --git a/include/asm-sparc/audioio.h b/include/asm-sparc/audioio.h deleted file mode 100644 index cf16173f521b..000000000000 --- a/include/asm-sparc/audioio.h +++ /dev/null | |||
| @@ -1,234 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/asm-sparc/audioio.h | ||
| 3 | * | ||
| 4 | * Sparc Audio Midlayer | ||
| 5 | * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef _AUDIOIO_H_ | ||
| 9 | #define _AUDIOIO_H_ | ||
| 10 | |||
| 11 | /* | ||
| 12 | * SunOS/Solaris /dev/audio interface | ||
| 13 | */ | ||
| 14 | |||
| 15 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | ||
| 16 | #include <linux/types.h> | ||
| 17 | #include <linux/time.h> | ||
| 18 | #include <linux/ioctl.h> | ||
| 19 | #endif | ||
| 20 | |||
| 21 | /* | ||
| 22 | * This structure contains state information for audio device IO streams. | ||
| 23 | */ | ||
| 24 | typedef struct audio_prinfo { | ||
| 25 | /* | ||
| 26 | * The following values describe the audio data encoding. | ||
| 27 | */ | ||
| 28 | unsigned int sample_rate; /* samples per second */ | ||
| 29 | unsigned int channels; /* number of interleaved channels */ | ||
| 30 | unsigned int precision; /* bit-width of each sample */ | ||
| 31 | unsigned int encoding; /* data encoding method */ | ||
| 32 | |||
| 33 | /* | ||
| 34 | * The following values control audio device configuration | ||
| 35 | */ | ||
| 36 | unsigned int gain; /* gain level: 0 - 255 */ | ||
| 37 | unsigned int port; /* selected I/O port (see below) */ | ||
| 38 | unsigned int avail_ports; /* available I/O ports (see below) */ | ||
| 39 | unsigned int _xxx[2]; /* Reserved for future use */ | ||
| 40 | |||
| 41 | unsigned int buffer_size; /* I/O buffer size */ | ||
| 42 | |||
| 43 | /* | ||
| 44 | * The following values describe driver state | ||
| 45 | */ | ||
| 46 | unsigned int samples; /* number of samples converted */ | ||
| 47 | unsigned int eof; /* End Of File counter (play only) */ | ||
| 48 | |||
| 49 | unsigned char pause; /* non-zero for pause, zero to resume */ | ||
| 50 | unsigned char error; /* non-zero if overflow/underflow */ | ||
| 51 | unsigned char waiting; /* non-zero if a process wants access */ | ||
| 52 | unsigned char balance; /* stereo channel balance */ | ||
| 53 | |||
| 54 | unsigned short minordev; | ||
| 55 | |||
| 56 | /* | ||
| 57 | * The following values are read-only state flags | ||
| 58 | */ | ||
| 59 | unsigned char open; /* non-zero if open access permitted */ | ||
| 60 | unsigned char active; /* non-zero if I/O is active */ | ||
| 61 | } audio_prinfo_t; | ||
| 62 | |||
| 63 | |||
| 64 | /* | ||
| 65 | * This structure describes the current state of the audio device. | ||
| 66 | */ | ||
| 67 | typedef struct audio_info { | ||
| 68 | /* | ||
| 69 | * Per-stream information | ||
| 70 | */ | ||
| 71 | audio_prinfo_t play; /* output status information */ | ||
| 72 | audio_prinfo_t record; /* input status information */ | ||
| 73 | |||
| 74 | /* | ||
| 75 | * Per-unit/channel information | ||
| 76 | */ | ||
| 77 | unsigned int monitor_gain; /* input to output mix: 0 - 255 */ | ||
| 78 | unsigned char output_muted; /* non-zero if output is muted */ | ||
| 79 | unsigned char _xxx[3]; /* Reserved for future use */ | ||
| 80 | unsigned int _yyy[3]; /* Reserved for future use */ | ||
| 81 | } audio_info_t; | ||
| 82 | |||
| 83 | |||
| 84 | /* | ||
| 85 | * Audio encoding types | ||
| 86 | */ | ||
| 87 | #define AUDIO_ENCODING_NONE (0) /* no encoding assigned */ | ||
| 88 | #define AUDIO_ENCODING_ULAW (1) /* u-law encoding */ | ||
| 89 | #define AUDIO_ENCODING_ALAW (2) /* A-law encoding */ | ||
| 90 | #define AUDIO_ENCODING_LINEAR (3) /* Linear PCM encoding */ | ||
| 91 | #define AUDIO_ENCODING_FLOAT (4) /* IEEE float (-1. <-> +1.) */ | ||
| 92 | #define AUDIO_ENCODING_DVI (104) /* DVI ADPCM */ | ||
| 93 | #define AUDIO_ENCODING_LINEAR8 (105) /* 8 bit UNSIGNED */ | ||
| 94 | #define AUDIO_ENCODING_LINEARLE (106) /* Linear PCM LE encoding */ | ||
| 95 | |||
| 96 | /* | ||
| 97 | * These ranges apply to record, play, and monitor gain values | ||
| 98 | */ | ||
| 99 | #define AUDIO_MIN_GAIN (0) /* minimum gain value */ | ||
| 100 | #define AUDIO_MAX_GAIN (255) /* maximum gain value */ | ||
| 101 | |||
| 102 | /* | ||
| 103 | * These values apply to the balance field to adjust channel gain values | ||
| 104 | */ | ||
| 105 | #define AUDIO_LEFT_BALANCE (0) /* left channel only */ | ||
| 106 | #define AUDIO_MID_BALANCE (32) /* equal left/right channel */ | ||
| 107 | #define AUDIO_RIGHT_BALANCE (64) /* right channel only */ | ||
| 108 | #define AUDIO_BALANCE_SHIFT (3) | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Generic minimum/maximum limits for number of channels, both modes | ||
| 112 | */ | ||
| 113 | #define AUDIO_MIN_PLAY_CHANNELS (1) | ||
| 114 | #define AUDIO_MAX_PLAY_CHANNELS (4) | ||
| 115 | #define AUDIO_MIN_REC_CHANNELS (1) | ||
| 116 | #define AUDIO_MAX_REC_CHANNELS (4) | ||
| 117 | |||
| 118 | /* | ||
| 119 | * Generic minimum/maximum limits for sample precision | ||
| 120 | */ | ||
| 121 | #define AUDIO_MIN_PLAY_PRECISION (8) | ||
| 122 | #define AUDIO_MAX_PLAY_PRECISION (32) | ||
| 123 | #define AUDIO_MIN_REC_PRECISION (8) | ||
| 124 | #define AUDIO_MAX_REC_PRECISION (32) | ||
| 125 | |||
| 126 | /* | ||
| 127 | * Define some convenient names for typical audio ports | ||
| 128 | */ | ||
| 129 | /* | ||
| 130 | * output ports (several may be enabled simultaneously) | ||
| 131 | */ | ||
| 132 | #define AUDIO_SPEAKER 0x01 /* output to built-in speaker */ | ||
| 133 | #define AUDIO_HEADPHONE 0x02 /* output to headphone jack */ | ||
| 134 | #define AUDIO_LINE_OUT 0x04 /* output to line out */ | ||
| 135 | |||
| 136 | /* | ||
| 137 | * input ports (usually only one at a time) | ||
| 138 | */ | ||
| 139 | #define AUDIO_MICROPHONE 0x01 /* input from microphone */ | ||
| 140 | #define AUDIO_LINE_IN 0x02 /* input from line in */ | ||
| 141 | #define AUDIO_CD 0x04 /* input from on-board CD inputs */ | ||
| 142 | #define AUDIO_INTERNAL_CD_IN AUDIO_CD /* input from internal CDROM */ | ||
| 143 | #define AUDIO_ANALOG_LOOPBACK 0x40 /* input from output */ | ||
| 144 | |||
| 145 | |||
| 146 | /* | ||
| 147 | * This macro initializes an audio_info structure to 'harmless' values. | ||
| 148 | * Note that (~0) might not be a harmless value for a flag that was | ||
| 149 | * a signed int. | ||
| 150 | */ | ||
| 151 | #define AUDIO_INITINFO(i) { \ | ||
| 152 | unsigned int *__x__; \ | ||
| 153 | for (__x__ = (unsigned int *)(i); \ | ||
| 154 | (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t)); \ | ||
| 155 | *__x__++ = ~0); \ | ||
| 156 | } | ||
| 157 | |||
| 158 | /* | ||
| 159 | * These allow testing for what the user wants to set | ||
| 160 | */ | ||
| 161 | #define AUD_INITVALUE (~0) | ||
| 162 | #define Modify(X) ((unsigned int)(X) != AUD_INITVALUE) | ||
| 163 | #define Modifys(X) ((X) != (unsigned short)AUD_INITVALUE) | ||
| 164 | #define Modifyc(X) ((X) != (unsigned char)AUD_INITVALUE) | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Parameter for the AUDIO_GETDEV ioctl to determine current | ||
| 168 | * audio devices. | ||
| 169 | */ | ||
| 170 | #define MAX_AUDIO_DEV_LEN (16) | ||
| 171 | typedef struct audio_device { | ||
| 172 | char name[MAX_AUDIO_DEV_LEN]; | ||
| 173 | char version[MAX_AUDIO_DEV_LEN]; | ||
| 174 | char config[MAX_AUDIO_DEV_LEN]; | ||
| 175 | } audio_device_t; | ||
| 176 | |||
| 177 | |||
| 178 | /* | ||
| 179 | * Ioctl calls for the audio device. | ||
| 180 | */ | ||
| 181 | |||
| 182 | /* | ||
| 183 | * AUDIO_GETINFO retrieves the current state of the audio device. | ||
| 184 | * | ||
| 185 | * AUDIO_SETINFO copies all fields of the audio_info structure whose | ||
| 186 | * values are not set to the initialized value (-1) to the device state. | ||
| 187 | * It performs an implicit AUDIO_GETINFO to return the new state of the | ||
| 188 | * device. Note that the record.samples and play.samples fields are set | ||
| 189 | * to the last value before the AUDIO_SETINFO took effect. This allows | ||
| 190 | * an application to reset the counters while atomically retrieving the | ||
| 191 | * last value. | ||
| 192 | * | ||
| 193 | * AUDIO_DRAIN suspends the calling process until the write buffers are | ||
| 194 | * empty. | ||
| 195 | * | ||
| 196 | * AUDIO_GETDEV returns a structure of type audio_device_t which contains | ||
| 197 | * three strings. The string "name" is a short identifying string (for | ||
| 198 | * example, the SBus Fcode name string), the string "version" identifies | ||
| 199 | * the current version of the device, and the "config" string identifies | ||
| 200 | * the specific configuration of the audio stream. All fields are | ||
| 201 | * device-dependent -- see the device specific manual pages for details. | ||
| 202 | * | ||
| 203 | * AUDIO_GETDEV_SUNOS returns a number which is an audio device defined | ||
| 204 | * herein (making it not too portable) | ||
| 205 | * | ||
| 206 | * AUDIO_FLUSH stops all playback and recording, clears all queued buffers, | ||
| 207 | * resets error counters, and restarts recording and playback as appropriate | ||
| 208 | * for the current sampling mode. | ||
| 209 | */ | ||
| 210 | #define AUDIO_GETINFO _IOR('A', 1, audio_info_t) | ||
| 211 | #define AUDIO_SETINFO _IOWR('A', 2, audio_info_t) | ||
| 212 | #define AUDIO_DRAIN _IO('A', 3) | ||
| 213 | #define AUDIO_GETDEV _IOR('A', 4, audio_device_t) | ||
| 214 | #define AUDIO_GETDEV_SUNOS _IOR('A', 4, int) | ||
| 215 | #define AUDIO_FLUSH _IO('A', 5) | ||
| 216 | |||
| 217 | /* Define possible audio hardware configurations for | ||
| 218 | * old SunOS-style AUDIO_GETDEV ioctl */ | ||
| 219 | #define AUDIO_DEV_UNKNOWN (0) /* not defined */ | ||
| 220 | #define AUDIO_DEV_AMD (1) /* audioamd device */ | ||
| 221 | #define AUDIO_DEV_SPEAKERBOX (2) /* dbri device with speakerbox */ | ||
| 222 | #define AUDIO_DEV_CODEC (3) /* dbri device (internal speaker) */ | ||
| 223 | #define AUDIO_DEV_CS4231 (5) /* cs4231 device */ | ||
| 224 | |||
| 225 | /* | ||
| 226 | * The following ioctl sets the audio device into an internal loopback mode, | ||
| 227 | * if the hardware supports this. The argument is TRUE to set loopback, | ||
| 228 | * FALSE to reset to normal operation. If the hardware does not support | ||
| 229 | * internal loopback, the ioctl should fail with EINVAL. | ||
| 230 | * Causes ADC data to be digitally mixed in and sent to the DAC. | ||
| 231 | */ | ||
| 232 | #define AUDIO_DIAG_LOOPBACK _IOW('A', 101, int) | ||
| 233 | |||
| 234 | #endif /* _AUDIOIO_H_ */ | ||
diff --git a/include/asm-sparc/kbio.h b/include/asm-sparc/kbio.h deleted file mode 100644 index 3cf496bdf399..000000000000 --- a/include/asm-sparc/kbio.h +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | #ifndef __LINUX_KBIO_H | ||
| 2 | #define __LINUX_KBIO_H | ||
| 3 | |||
| 4 | /* Return keyboard type */ | ||
| 5 | #define KIOCTYPE _IOR('k', 9, int) | ||
| 6 | /* Return Keyboard layout */ | ||
| 7 | #define KIOCLAYOUT _IOR('k', 20, int) | ||
| 8 | |||
| 9 | enum { | ||
| 10 | TR_NONE, | ||
| 11 | TR_ASCII, /* keyboard is in regular state */ | ||
| 12 | TR_EVENT, /* keystrokes sent as firm events */ | ||
| 13 | TR_UNTRANS_EVENT /* EVENT+up and down+no translation */ | ||
| 14 | }; | ||
| 15 | |||
| 16 | /* Return the current keyboard translation */ | ||
| 17 | #define KIOCGTRANS _IOR('k', 5, int) | ||
| 18 | /* Set the keyboard translation */ | ||
| 19 | #define KIOCTRANS _IOW('k', 0, int) | ||
| 20 | |||
| 21 | /* Send a keyboard command */ | ||
| 22 | #define KIOCCMD _IOW('k', 8, int) | ||
| 23 | |||
| 24 | /* Return if keystrokes are being sent to /dev/kbd */ | ||
| 25 | |||
| 26 | /* Set routing of keystrokes to /dev/kbd */ | ||
| 27 | #define KIOCSDIRECT _IOW('k', 10, int) | ||
| 28 | |||
| 29 | /* Set keyboard leds */ | ||
| 30 | #define KIOCSLED _IOW('k', 14, unsigned char) | ||
| 31 | |||
| 32 | /* Get keyboard leds */ | ||
| 33 | #define KIOCGLED _IOR('k', 15, unsigned char) | ||
| 34 | |||
| 35 | /* Used by KIOC[GS]RATE */ | ||
| 36 | struct kbd_rate { | ||
| 37 | unsigned char delay; /* Delay in Hz before first repeat. */ | ||
| 38 | unsigned char rate; /* In characters per second (0..50). */ | ||
| 39 | }; | ||
| 40 | |||
| 41 | /* Set keyboard rate */ | ||
| 42 | #define KIOCSRATE _IOW('k', 40, struct kbd_rate) | ||
| 43 | |||
| 44 | /* Get keyboard rate */ | ||
| 45 | #define KIOCGRATE _IOW('k', 41, struct kbd_rate) | ||
| 46 | |||
| 47 | /* Top bit records if the key is up or down */ | ||
| 48 | #define KBD_UP 0x80 | ||
| 49 | |||
| 50 | /* Usable information */ | ||
| 51 | #define KBD_KEYMASK 0x7f | ||
| 52 | |||
| 53 | /* All keys up */ | ||
| 54 | #define KBD_IDLE 0x75 | ||
| 55 | |||
| 56 | #endif /* __LINUX_KBIO_H */ | ||
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h index a8ecb2d6977a..714497099a42 100644 --- a/include/asm-sparc/ptrace.h +++ b/include/asm-sparc/ptrace.h | |||
| @@ -60,6 +60,9 @@ struct sparc_stackf { | |||
| 60 | #define STACKFRAME_SZ sizeof(struct sparc_stackf) | 60 | #define STACKFRAME_SZ sizeof(struct sparc_stackf) |
| 61 | 61 | ||
| 62 | #ifdef __KERNEL__ | 62 | #ifdef __KERNEL__ |
| 63 | |||
| 64 | #define __ARCH_SYS_PTRACE 1 | ||
| 65 | |||
| 63 | #define user_mode(regs) (!((regs)->psr & PSR_PS)) | 66 | #define user_mode(regs) (!((regs)->psr & PSR_PS)) |
| 64 | #define instruction_pointer(regs) ((regs)->pc) | 67 | #define instruction_pointer(regs) ((regs)->pc) |
| 65 | unsigned long profile_pc(struct pt_regs *); | 68 | unsigned long profile_pc(struct pt_regs *); |
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h index 0a8ad4cac125..d05f83c80989 100644 --- a/include/asm-sparc/termios.h +++ b/include/asm-sparc/termios.h | |||
| @@ -38,15 +38,6 @@ struct sunos_ttysize { | |||
| 38 | int st_columns; /* Columns on the terminal */ | 38 | int st_columns; /* Columns on the terminal */ |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | /* Used for packet mode */ | ||
| 42 | #define TIOCPKT_DATA 0 | ||
| 43 | #define TIOCPKT_FLUSHREAD 1 | ||
| 44 | #define TIOCPKT_FLUSHWRITE 2 | ||
| 45 | #define TIOCPKT_STOP 4 | ||
| 46 | #define TIOCPKT_START 8 | ||
| 47 | #define TIOCPKT_NOSTOP 16 | ||
| 48 | #define TIOCPKT_DOSTOP 32 | ||
| 49 | |||
| 50 | struct winsize { | 41 | struct winsize { |
| 51 | unsigned short ws_row; | 42 | unsigned short ws_row; |
| 52 | unsigned short ws_col; | 43 | unsigned short ws_col; |
diff --git a/include/asm-sparc/vuid_event.h b/include/asm-sparc/vuid_event.h deleted file mode 100644 index 7781e9f2fdd3..000000000000 --- a/include/asm-sparc/vuid_event.h +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | /* SunOS Virtual User Input Device (VUID) compatibility */ | ||
| 2 | |||
| 3 | |||
| 4 | typedef struct firm_event { | ||
| 5 | unsigned short id; /* tag for this event */ | ||
| 6 | unsigned char pair_type; /* unused by X11 */ | ||
| 7 | unsigned char pair; /* unused by X11 */ | ||
| 8 | int value; /* VKEY_UP, VKEY_DOWN or delta */ | ||
| 9 | struct timeval time; | ||
| 10 | } Firm_event; | ||
| 11 | |||
| 12 | enum { | ||
| 13 | FE_PAIR_NONE, | ||
| 14 | FE_PAIR_SET, | ||
| 15 | FE_PAIR_DELTA, | ||
| 16 | FE_PAIR_ABSOLUTE | ||
| 17 | }; | ||
| 18 | |||
| 19 | /* VUID stream formats */ | ||
| 20 | #define VUID_NATIVE 0 /* Native byte stream format */ | ||
| 21 | #define VUID_FIRM_EVENT 1 /* send firm_event structures */ | ||
| 22 | |||
| 23 | /* ioctls */ | ||
| 24 | /* Set input device byte stream format (any of VUID_{NATIVE,FIRM_EVENT}) */ | ||
| 25 | #define VUIDSFORMAT _IOW('v', 1, int) | ||
| 26 | /* Retrieve input device byte stream format */ | ||
| 27 | #define VUIDGFORMAT _IOR('v', 2, int) | ||
| 28 | |||
| 29 | /* Possible tag values */ | ||
| 30 | /* mouse buttons: */ | ||
| 31 | #define MS_LEFT 0x7f20 | ||
| 32 | #define MS_MIDDLE 0x7f21 | ||
| 33 | #define MS_RIGHT 0x7f22 | ||
| 34 | /* motion: */ | ||
| 35 | #define LOC_X_DELTA 0x7f80 | ||
| 36 | #define LOC_Y_DELTA 0x7f81 | ||
| 37 | #define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */ | ||
| 38 | #define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */ | ||
| 39 | |||
| 40 | #define VKEY_UP 0 | ||
| 41 | #define VKEY_DOWN 1 | ||
diff --git a/include/asm-sparc64/audioio.h b/include/asm-sparc64/audioio.h deleted file mode 100644 index cf16173f521b..000000000000 --- a/include/asm-sparc64/audioio.h +++ /dev/null | |||
| @@ -1,234 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/asm-sparc/audioio.h | ||
| 3 | * | ||
| 4 | * Sparc Audio Midlayer | ||
| 5 | * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef _AUDIOIO_H_ | ||
| 9 | #define _AUDIOIO_H_ | ||
| 10 | |||
| 11 | /* | ||
| 12 | * SunOS/Solaris /dev/audio interface | ||
| 13 | */ | ||
| 14 | |||
| 15 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | ||
| 16 | #include <linux/types.h> | ||
| 17 | #include <linux/time.h> | ||
| 18 | #include <linux/ioctl.h> | ||
| 19 | #endif | ||
| 20 | |||
| 21 | /* | ||
| 22 | * This structure contains state information for audio device IO streams. | ||
| 23 | */ | ||
| 24 | typedef struct audio_prinfo { | ||
| 25 | /* | ||
| 26 | * The following values describe the audio data encoding. | ||
| 27 | */ | ||
| 28 | unsigned int sample_rate; /* samples per second */ | ||
| 29 | unsigned int channels; /* number of interleaved channels */ | ||
| 30 | unsigned int precision; /* bit-width of each sample */ | ||
| 31 | unsigned int encoding; /* data encoding method */ | ||
| 32 | |||
| 33 | /* | ||
| 34 | * The following values control audio device configuration | ||
| 35 | */ | ||
| 36 | unsigned int gain; /* gain level: 0 - 255 */ | ||
| 37 | unsigned int port; /* selected I/O port (see below) */ | ||
| 38 | unsigned int avail_ports; /* available I/O ports (see below) */ | ||
| 39 | unsigned int _xxx[2]; /* Reserved for future use */ | ||
| 40 | |||
| 41 | unsigned int buffer_size; /* I/O buffer size */ | ||
| 42 | |||
| 43 | /* | ||
| 44 | * The following values describe driver state | ||
| 45 | */ | ||
| 46 | unsigned int samples; /* number of samples converted */ | ||
| 47 | unsigned int eof; /* End Of File counter (play only) */ | ||
| 48 | |||
| 49 | unsigned char pause; /* non-zero for pause, zero to resume */ | ||
| 50 | unsigned char error; /* non-zero if overflow/underflow */ | ||
| 51 | unsigned char waiting; /* non-zero if a process wants access */ | ||
| 52 | unsigned char balance; /* stereo channel balance */ | ||
| 53 | |||
| 54 | unsigned short minordev; | ||
| 55 | |||
| 56 | /* | ||
| 57 | * The following values are read-only state flags | ||
| 58 | */ | ||
| 59 | unsigned char open; /* non-zero if open access permitted */ | ||
| 60 | unsigned char active; /* non-zero if I/O is active */ | ||
| 61 | } audio_prinfo_t; | ||
| 62 | |||
| 63 | |||
| 64 | /* | ||
| 65 | * This structure describes the current state of the audio device. | ||
| 66 | */ | ||
| 67 | typedef struct audio_info { | ||
| 68 | /* | ||
| 69 | * Per-stream information | ||
| 70 | */ | ||
| 71 | audio_prinfo_t play; /* output status information */ | ||
| 72 | audio_prinfo_t record; /* input status information */ | ||
| 73 | |||
| 74 | /* | ||
| 75 | * Per-unit/channel information | ||
| 76 | */ | ||
| 77 | unsigned int monitor_gain; /* input to output mix: 0 - 255 */ | ||
| 78 | unsigned char output_muted; /* non-zero if output is muted */ | ||
| 79 | unsigned char _xxx[3]; /* Reserved for future use */ | ||
| 80 | unsigned int _yyy[3]; /* Reserved for future use */ | ||
| 81 | } audio_info_t; | ||
| 82 | |||
| 83 | |||
| 84 | /* | ||
| 85 | * Audio encoding types | ||
| 86 | */ | ||
| 87 | #define AUDIO_ENCODING_NONE (0) /* no encoding assigned */ | ||
| 88 | #define AUDIO_ENCODING_ULAW (1) /* u-law encoding */ | ||
| 89 | #define AUDIO_ENCODING_ALAW (2) /* A-law encoding */ | ||
| 90 | #define AUDIO_ENCODING_LINEAR (3) /* Linear PCM encoding */ | ||
| 91 | #define AUDIO_ENCODING_FLOAT (4) /* IEEE float (-1. <-> +1.) */ | ||
| 92 | #define AUDIO_ENCODING_DVI (104) /* DVI ADPCM */ | ||
| 93 | #define AUDIO_ENCODING_LINEAR8 (105) /* 8 bit UNSIGNED */ | ||
| 94 | #define AUDIO_ENCODING_LINEARLE (106) /* Linear PCM LE encoding */ | ||
| 95 | |||
| 96 | /* | ||
| 97 | * These ranges apply to record, play, and monitor gain values | ||
| 98 | */ | ||
| 99 | #define AUDIO_MIN_GAIN (0) /* minimum gain value */ | ||
| 100 | #define AUDIO_MAX_GAIN (255) /* maximum gain value */ | ||
| 101 | |||
| 102 | /* | ||
| 103 | * These values apply to the balance field to adjust channel gain values | ||
| 104 | */ | ||
| 105 | #define AUDIO_LEFT_BALANCE (0) /* left channel only */ | ||
| 106 | #define AUDIO_MID_BALANCE (32) /* equal left/right channel */ | ||
| 107 | #define AUDIO_RIGHT_BALANCE (64) /* right channel only */ | ||
| 108 | #define AUDIO_BALANCE_SHIFT (3) | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Generic minimum/maximum limits for number of channels, both modes | ||
| 112 | */ | ||
| 113 | #define AUDIO_MIN_PLAY_CHANNELS (1) | ||
| 114 | #define AUDIO_MAX_PLAY_CHANNELS (4) | ||
| 115 | #define AUDIO_MIN_REC_CHANNELS (1) | ||
| 116 | #define AUDIO_MAX_REC_CHANNELS (4) | ||
| 117 | |||
| 118 | /* | ||
| 119 | * Generic minimum/maximum limits for sample precision | ||
| 120 | */ | ||
| 121 | #define AUDIO_MIN_PLAY_PRECISION (8) | ||
| 122 | #define AUDIO_MAX_PLAY_PRECISION (32) | ||
| 123 | #define AUDIO_MIN_REC_PRECISION (8) | ||
| 124 | #define AUDIO_MAX_REC_PRECISION (32) | ||
| 125 | |||
| 126 | /* | ||
| 127 | * Define some convenient names for typical audio ports | ||
| 128 | */ | ||
| 129 | /* | ||
| 130 | * output ports (several may be enabled simultaneously) | ||
| 131 | */ | ||
| 132 | #define AUDIO_SPEAKER 0x01 /* output to built-in speaker */ | ||
| 133 | #define AUDIO_HEADPHONE 0x02 /* output to headphone jack */ | ||
| 134 | #define AUDIO_LINE_OUT 0x04 /* output to line out */ | ||
| 135 | |||
| 136 | /* | ||
| 137 | * input ports (usually only one at a time) | ||
| 138 | */ | ||
| 139 | #define AUDIO_MICROPHONE 0x01 /* input from microphone */ | ||
| 140 | #define AUDIO_LINE_IN 0x02 /* input from line in */ | ||
| 141 | #define AUDIO_CD 0x04 /* input from on-board CD inputs */ | ||
| 142 | #define AUDIO_INTERNAL_CD_IN AUDIO_CD /* input from internal CDROM */ | ||
| 143 | #define AUDIO_ANALOG_LOOPBACK 0x40 /* input from output */ | ||
| 144 | |||
| 145 | |||
| 146 | /* | ||
| 147 | * This macro initializes an audio_info structure to 'harmless' values. | ||
| 148 | * Note that (~0) might not be a harmless value for a flag that was | ||
| 149 | * a signed int. | ||
| 150 | */ | ||
| 151 | #define AUDIO_INITINFO(i) { \ | ||
| 152 | unsigned int *__x__; \ | ||
| 153 | for (__x__ = (unsigned int *)(i); \ | ||
| 154 | (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t)); \ | ||
| 155 | *__x__++ = ~0); \ | ||
| 156 | } | ||
| 157 | |||
| 158 | /* | ||
| 159 | * These allow testing for what the user wants to set | ||
| 160 | */ | ||
| 161 | #define AUD_INITVALUE (~0) | ||
| 162 | #define Modify(X) ((unsigned int)(X) != AUD_INITVALUE) | ||
| 163 | #define Modifys(X) ((X) != (unsigned short)AUD_INITVALUE) | ||
| 164 | #define Modifyc(X) ((X) != (unsigned char)AUD_INITVALUE) | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Parameter for the AUDIO_GETDEV ioctl to determine current | ||
| 168 | * audio devices. | ||
| 169 | */ | ||
| 170 | #define MAX_AUDIO_DEV_LEN (16) | ||
| 171 | typedef struct audio_device { | ||
| 172 | char name[MAX_AUDIO_DEV_LEN]; | ||
| 173 | char version[MAX_AUDIO_DEV_LEN]; | ||
| 174 | char config[MAX_AUDIO_DEV_LEN]; | ||
| 175 | } audio_device_t; | ||
| 176 | |||
| 177 | |||
| 178 | /* | ||
| 179 | * Ioctl calls for the audio device. | ||
| 180 | */ | ||
| 181 | |||
| 182 | /* | ||
| 183 | * AUDIO_GETINFO retrieves the current state of the audio device. | ||
| 184 | * | ||
| 185 | * AUDIO_SETINFO copies all fields of the audio_info structure whose | ||
| 186 | * values are not set to the initialized value (-1) to the device state. | ||
| 187 | * It performs an implicit AUDIO_GETINFO to return the new state of the | ||
| 188 | * device. Note that the record.samples and play.samples fields are set | ||
| 189 | * to the last value before the AUDIO_SETINFO took effect. This allows | ||
| 190 | * an application to reset the counters while atomically retrieving the | ||
| 191 | * last value. | ||
| 192 | * | ||
| 193 | * AUDIO_DRAIN suspends the calling process until the write buffers are | ||
| 194 | * empty. | ||
| 195 | * | ||
| 196 | * AUDIO_GETDEV returns a structure of type audio_device_t which contains | ||
| 197 | * three strings. The string "name" is a short identifying string (for | ||
| 198 | * example, the SBus Fcode name string), the string "version" identifies | ||
| 199 | * the current version of the device, and the "config" string identifies | ||
| 200 | * the specific configuration of the audio stream. All fields are | ||
| 201 | * device-dependent -- see the device specific manual pages for details. | ||
| 202 | * | ||
| 203 | * AUDIO_GETDEV_SUNOS returns a number which is an audio device defined | ||
| 204 | * herein (making it not too portable) | ||
| 205 | * | ||
| 206 | * AUDIO_FLUSH stops all playback and recording, clears all queued buffers, | ||
| 207 | * resets error counters, and restarts recording and playback as appropriate | ||
| 208 | * for the current sampling mode. | ||
| 209 | */ | ||
| 210 | #define AUDIO_GETINFO _IOR('A', 1, audio_info_t) | ||
| 211 | #define AUDIO_SETINFO _IOWR('A', 2, audio_info_t) | ||
| 212 | #define AUDIO_DRAIN _IO('A', 3) | ||
| 213 | #define AUDIO_GETDEV _IOR('A', 4, audio_device_t) | ||
| 214 | #define AUDIO_GETDEV_SUNOS _IOR('A', 4, int) | ||
| 215 | #define AUDIO_FLUSH _IO('A', 5) | ||
| 216 | |||
| 217 | /* Define possible audio hardware configurations for | ||
| 218 | * old SunOS-style AUDIO_GETDEV ioctl */ | ||
| 219 | #define AUDIO_DEV_UNKNOWN (0) /* not defined */ | ||
| 220 | #define AUDIO_DEV_AMD (1) /* audioamd device */ | ||
| 221 | #define AUDIO_DEV_SPEAKERBOX (2) /* dbri device with speakerbox */ | ||
| 222 | #define AUDIO_DEV_CODEC (3) /* dbri device (internal speaker) */ | ||
| 223 | #define AUDIO_DEV_CS4231 (5) /* cs4231 device */ | ||
| 224 | |||
| 225 | /* | ||
| 226 | * The following ioctl sets the audio device into an internal loopback mode, | ||
| 227 | * if the hardware supports this. The argument is TRUE to set loopback, | ||
| 228 | * FALSE to reset to normal operation. If the hardware does not support | ||
| 229 | * internal loopback, the ioctl should fail with EINVAL. | ||
| 230 | * Causes ADC data to be digitally mixed in and sent to the DAC. | ||
| 231 | */ | ||
| 232 | #define AUDIO_DIAG_LOOPBACK _IOW('A', 101, int) | ||
| 233 | |||
| 234 | #endif /* _AUDIOIO_H_ */ | ||
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h index 543e4e500a72..7a408a030f52 100644 --- a/include/asm-sparc64/ebus.h +++ b/include/asm-sparc64/ebus.h | |||
| @@ -79,6 +79,7 @@ extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr, | |||
| 79 | size_t len); | 79 | size_t len); |
| 80 | extern void ebus_dma_prepare(struct ebus_dma_info *p, int write); | 80 | extern void ebus_dma_prepare(struct ebus_dma_info *p, int write); |
| 81 | extern unsigned int ebus_dma_residue(struct ebus_dma_info *p); | 81 | extern unsigned int ebus_dma_residue(struct ebus_dma_info *p); |
| 82 | extern unsigned int ebus_dma_addr(struct ebus_dma_info *p); | ||
| 82 | extern void ebus_dma_enable(struct ebus_dma_info *p, int on); | 83 | extern void ebus_dma_enable(struct ebus_dma_info *p, int on); |
| 83 | 84 | ||
| 84 | extern struct linux_ebus *ebus_chain; | 85 | extern struct linux_ebus *ebus_chain; |
diff --git a/include/asm-sparc64/kbio.h b/include/asm-sparc64/kbio.h deleted file mode 100644 index 3cf496bdf399..000000000000 --- a/include/asm-sparc64/kbio.h +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | #ifndef __LINUX_KBIO_H | ||
| 2 | #define __LINUX_KBIO_H | ||
| 3 | |||
| 4 | /* Return keyboard type */ | ||
| 5 | #define KIOCTYPE _IOR('k', 9, int) | ||
| 6 | /* Return Keyboard layout */ | ||
| 7 | #define KIOCLAYOUT _IOR('k', 20, int) | ||
| 8 | |||
| 9 | enum { | ||
| 10 | TR_NONE, | ||
| 11 | TR_ASCII, /* keyboard is in regular state */ | ||
| 12 | TR_EVENT, /* keystrokes sent as firm events */ | ||
| 13 | TR_UNTRANS_EVENT /* EVENT+up and down+no translation */ | ||
| 14 | }; | ||
| 15 | |||
| 16 | /* Return the current keyboard translation */ | ||
| 17 | #define KIOCGTRANS _IOR('k', 5, int) | ||
| 18 | /* Set the keyboard translation */ | ||
| 19 | #define KIOCTRANS _IOW('k', 0, int) | ||
| 20 | |||
| 21 | /* Send a keyboard command */ | ||
| 22 | #define KIOCCMD _IOW('k', 8, int) | ||
| 23 | |||
| 24 | /* Return if keystrokes are being sent to /dev/kbd */ | ||
| 25 | |||
| 26 | /* Set routing of keystrokes to /dev/kbd */ | ||
| 27 | #define KIOCSDIRECT _IOW('k', 10, int) | ||
| 28 | |||
| 29 | /* Set keyboard leds */ | ||
| 30 | #define KIOCSLED _IOW('k', 14, unsigned char) | ||
| 31 | |||
| 32 | /* Get keyboard leds */ | ||
| 33 | #define KIOCGLED _IOR('k', 15, unsigned char) | ||
| 34 | |||
| 35 | /* Used by KIOC[GS]RATE */ | ||
| 36 | struct kbd_rate { | ||
| 37 | unsigned char delay; /* Delay in Hz before first repeat. */ | ||
| 38 | unsigned char rate; /* In characters per second (0..50). */ | ||
| 39 | }; | ||
| 40 | |||
| 41 | /* Set keyboard rate */ | ||
| 42 | #define KIOCSRATE _IOW('k', 40, struct kbd_rate) | ||
| 43 | |||
| 44 | /* Get keyboard rate */ | ||
| 45 | #define KIOCGRATE _IOW('k', 41, struct kbd_rate) | ||
| 46 | |||
| 47 | /* Top bit records if the key is up or down */ | ||
| 48 | #define KBD_UP 0x80 | ||
| 49 | |||
| 50 | /* Usable information */ | ||
| 51 | #define KBD_KEYMASK 0x7f | ||
| 52 | |||
| 53 | /* All keys up */ | ||
| 54 | #define KBD_IDLE 0x75 | ||
| 55 | |||
| 56 | #endif /* __LINUX_KBIO_H */ | ||
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h index a8d326a598f0..7ba845320f5c 100644 --- a/include/asm-sparc64/kprobes.h +++ b/include/asm-sparc64/kprobes.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/percpu.h> | ||
| 6 | 7 | ||
| 7 | typedef u32 kprobe_opcode_t; | 8 | typedef u32 kprobe_opcode_t; |
| 8 | 9 | ||
| @@ -18,6 +19,25 @@ struct arch_specific_insn { | |||
| 18 | kprobe_opcode_t insn[MAX_INSN_SIZE]; | 19 | kprobe_opcode_t insn[MAX_INSN_SIZE]; |
| 19 | }; | 20 | }; |
| 20 | 21 | ||
| 22 | struct prev_kprobe { | ||
| 23 | struct kprobe *kp; | ||
| 24 | unsigned int status; | ||
| 25 | unsigned long orig_tnpc; | ||
| 26 | unsigned long orig_tstate_pil; | ||
| 27 | }; | ||
| 28 | |||
| 29 | /* per-cpu kprobe control block */ | ||
| 30 | struct kprobe_ctlblk { | ||
| 31 | unsigned long kprobe_status; | ||
| 32 | unsigned long kprobe_orig_tnpc; | ||
| 33 | unsigned long kprobe_orig_tstate_pil; | ||
| 34 | long *jprobe_saved_esp; | ||
| 35 | struct pt_regs jprobe_saved_regs; | ||
| 36 | struct pt_regs *jprobe_saved_regs_location; | ||
| 37 | struct sparc_stackf jprobe_saved_stack; | ||
| 38 | struct prev_kprobe prev_kprobe; | ||
| 39 | }; | ||
| 40 | |||
| 21 | #ifdef CONFIG_KPROBES | 41 | #ifdef CONFIG_KPROBES |
| 22 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 42 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
| 23 | unsigned long val, void *data); | 43 | unsigned long val, void *data); |
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h index 87c43c67866e..08ba72d7722c 100644 --- a/include/asm-sparc64/mmu_context.h +++ b/include/asm-sparc64/mmu_context.h | |||
| @@ -87,37 +87,35 @@ extern void __flush_tlb_mm(unsigned long, unsigned long); | |||
| 87 | static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) | 87 | static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) |
| 88 | { | 88 | { |
| 89 | unsigned long ctx_valid; | 89 | unsigned long ctx_valid; |
| 90 | int cpu; | ||
| 90 | 91 | ||
| 92 | /* Note: page_table_lock is used here to serialize switch_mm | ||
| 93 | * and activate_mm, and their calls to get_new_mmu_context. | ||
| 94 | * This use of page_table_lock is unrelated to its other uses. | ||
| 95 | */ | ||
| 91 | spin_lock(&mm->page_table_lock); | 96 | spin_lock(&mm->page_table_lock); |
| 92 | if (CTX_VALID(mm->context)) | 97 | ctx_valid = CTX_VALID(mm->context); |
| 93 | ctx_valid = 1; | 98 | if (!ctx_valid) |
| 94 | else | 99 | get_new_mmu_context(mm); |
| 95 | ctx_valid = 0; | 100 | spin_unlock(&mm->page_table_lock); |
| 96 | 101 | ||
| 97 | if (!ctx_valid || (old_mm != mm)) { | 102 | if (!ctx_valid || (old_mm != mm)) { |
| 98 | if (!ctx_valid) | ||
| 99 | get_new_mmu_context(mm); | ||
| 100 | |||
| 101 | load_secondary_context(mm); | 103 | load_secondary_context(mm); |
| 102 | reload_tlbmiss_state(tsk, mm); | 104 | reload_tlbmiss_state(tsk, mm); |
| 103 | } | 105 | } |
| 104 | 106 | ||
| 105 | { | 107 | /* Even if (mm == old_mm) we _must_ check |
| 106 | int cpu = smp_processor_id(); | 108 | * the cpu_vm_mask. If we do not we could |
| 107 | 109 | * corrupt the TLB state because of how | |
| 108 | /* Even if (mm == old_mm) we _must_ check | 110 | * smp_flush_tlb_{page,range,mm} on sparc64 |
| 109 | * the cpu_vm_mask. If we do not we could | 111 | * and lazy tlb switches work. -DaveM |
| 110 | * corrupt the TLB state because of how | 112 | */ |
| 111 | * smp_flush_tlb_{page,range,mm} on sparc64 | 113 | cpu = smp_processor_id(); |
| 112 | * and lazy tlb switches work. -DaveM | 114 | if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) { |
| 113 | */ | 115 | cpu_set(cpu, mm->cpu_vm_mask); |
| 114 | if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) { | 116 | __flush_tlb_mm(CTX_HWBITS(mm->context), |
| 115 | cpu_set(cpu, mm->cpu_vm_mask); | 117 | SECONDARY_CONTEXT); |
| 116 | __flush_tlb_mm(CTX_HWBITS(mm->context), | ||
| 117 | SECONDARY_CONTEXT); | ||
| 118 | } | ||
| 119 | } | 118 | } |
| 120 | spin_unlock(&mm->page_table_lock); | ||
| 121 | } | 119 | } |
| 122 | 120 | ||
| 123 | #define deactivate_mm(tsk,mm) do { } while (0) | 121 | #define deactivate_mm(tsk,mm) do { } while (0) |
| @@ -127,6 +125,10 @@ static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm | |||
| 127 | { | 125 | { |
| 128 | int cpu; | 126 | int cpu; |
| 129 | 127 | ||
| 128 | /* Note: page_table_lock is used here to serialize switch_mm | ||
| 129 | * and activate_mm, and their calls to get_new_mmu_context. | ||
| 130 | * This use of page_table_lock is unrelated to its other uses. | ||
| 131 | */ | ||
| 130 | spin_lock(&mm->page_table_lock); | 132 | spin_lock(&mm->page_table_lock); |
| 131 | if (!CTX_VALID(mm->context)) | 133 | if (!CTX_VALID(mm->context)) |
| 132 | get_new_mmu_context(mm); | 134 | get_new_mmu_context(mm); |
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h index 6194f771e9fc..7eba90c6c753 100644 --- a/include/asm-sparc64/ptrace.h +++ b/include/asm-sparc64/ptrace.h | |||
| @@ -94,6 +94,9 @@ struct sparc_trapf { | |||
| 94 | #define STACKFRAME32_SZ sizeof(struct sparc_stackf32) | 94 | #define STACKFRAME32_SZ sizeof(struct sparc_stackf32) |
| 95 | 95 | ||
| 96 | #ifdef __KERNEL__ | 96 | #ifdef __KERNEL__ |
| 97 | |||
| 98 | #define __ARCH_SYS_PTRACE 1 | ||
| 99 | |||
| 97 | #define force_successful_syscall_return() \ | 100 | #define force_successful_syscall_return() \ |
| 98 | do { current_thread_info()->syscall_noerror = 1; \ | 101 | do { current_thread_info()->syscall_noerror = 1; \ |
| 99 | } while (0) | 102 | } while (0) |
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h index 9777a9cca88a..ee26a071c677 100644 --- a/include/asm-sparc64/termios.h +++ b/include/asm-sparc64/termios.h | |||
| @@ -38,15 +38,6 @@ struct sunos_ttysize { | |||
| 38 | int st_columns; /* Columns on the terminal */ | 38 | int st_columns; /* Columns on the terminal */ |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | /* Used for packet mode */ | ||
| 42 | #define TIOCPKT_DATA 0 | ||
| 43 | #define TIOCPKT_FLUSHREAD 1 | ||
| 44 | #define TIOCPKT_FLUSHWRITE 2 | ||
| 45 | #define TIOCPKT_STOP 4 | ||
| 46 | #define TIOCPKT_START 8 | ||
| 47 | #define TIOCPKT_NOSTOP 16 | ||
| 48 | #define TIOCPKT_DOSTOP 32 | ||
| 49 | |||
| 50 | struct winsize { | 41 | struct winsize { |
| 51 | unsigned short ws_row; | 42 | unsigned short ws_row; |
| 52 | unsigned short ws_col; | 43 | unsigned short ws_col; |
diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h index 66138d959df5..61c01882b562 100644 --- a/include/asm-sparc64/tlb.h +++ b/include/asm-sparc64/tlb.h | |||
| @@ -58,11 +58,9 @@ static inline struct mmu_gather *tlb_gather_mmu(struct mm_struct *mm, unsigned i | |||
| 58 | static inline void tlb_flush_mmu(struct mmu_gather *mp) | 58 | static inline void tlb_flush_mmu(struct mmu_gather *mp) |
| 59 | { | 59 | { |
| 60 | if (mp->need_flush) { | 60 | if (mp->need_flush) { |
| 61 | free_pages_and_swap_cache(mp->pages, mp->pages_nr); | ||
| 62 | mp->pages_nr = 0; | ||
| 61 | mp->need_flush = 0; | 63 | mp->need_flush = 0; |
| 62 | if (!tlb_fast_mode(mp)) { | ||
| 63 | free_pages_and_swap_cache(mp->pages, mp->pages_nr); | ||
| 64 | mp->pages_nr = 0; | ||
| 65 | } | ||
| 66 | } | 64 | } |
| 67 | 65 | ||
| 68 | } | 66 | } |
| @@ -78,11 +76,9 @@ static inline void tlb_finish_mmu(struct mmu_gather *mp, unsigned long start, un | |||
| 78 | { | 76 | { |
| 79 | tlb_flush_mmu(mp); | 77 | tlb_flush_mmu(mp); |
| 80 | 78 | ||
| 81 | if (mp->fullmm) { | 79 | if (mp->fullmm) |
| 82 | if (CTX_VALID(mp->mm->context)) | ||
| 83 | do_flush_tlb_mm(mp->mm); | ||
| 84 | mp->fullmm = 0; | 80 | mp->fullmm = 0; |
| 85 | } else | 81 | else |
| 86 | flush_tlb_pending(); | 82 | flush_tlb_pending(); |
| 87 | 83 | ||
| 88 | /* keep the page table cache within bounds */ | 84 | /* keep the page table cache within bounds */ |
| @@ -93,11 +89,11 @@ static inline void tlb_finish_mmu(struct mmu_gather *mp, unsigned long start, un | |||
| 93 | 89 | ||
| 94 | static inline void tlb_remove_page(struct mmu_gather *mp, struct page *page) | 90 | static inline void tlb_remove_page(struct mmu_gather *mp, struct page *page) |
| 95 | { | 91 | { |
| 96 | mp->need_flush = 1; | ||
| 97 | if (tlb_fast_mode(mp)) { | 92 | if (tlb_fast_mode(mp)) { |
| 98 | free_page_and_swap_cache(page); | 93 | free_page_and_swap_cache(page); |
| 99 | return; | 94 | return; |
| 100 | } | 95 | } |
| 96 | mp->need_flush = 1; | ||
| 101 | mp->pages[mp->pages_nr++] = page; | 97 | mp->pages[mp->pages_nr++] = page; |
| 102 | if (mp->pages_nr >= FREE_PTE_NR) | 98 | if (mp->pages_nr >= FREE_PTE_NR) |
| 103 | tlb_flush_mmu(mp); | 99 | tlb_flush_mmu(mp); |
diff --git a/include/asm-sparc64/vuid_event.h b/include/asm-sparc64/vuid_event.h deleted file mode 100644 index 9ef4d17ad08f..000000000000 --- a/include/asm-sparc64/vuid_event.h +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | /* SunOS Virtual User Input Device (VUID) compatibility */ | ||
| 2 | |||
| 3 | typedef struct firm_event { | ||
| 4 | unsigned short id; /* tag for this event */ | ||
| 5 | unsigned char pair_type; /* unused by X11 */ | ||
| 6 | unsigned char pair; /* unused by X11 */ | ||
| 7 | int value; /* VKEY_UP, VKEY_DOWN or delta */ | ||
| 8 | struct timeval time; | ||
| 9 | } Firm_event; | ||
| 10 | |||
| 11 | enum { | ||
| 12 | FE_PAIR_NONE, | ||
| 13 | FE_PAIR_SET, | ||
| 14 | FE_PAIR_DELTA, | ||
| 15 | FE_PAIR_ABSOLUTE | ||
| 16 | }; | ||
| 17 | |||
| 18 | /* VUID stream formats */ | ||
| 19 | #define VUID_NATIVE 0 /* Native byte stream format */ | ||
| 20 | #define VUID_FIRM_EVENT 1 /* send firm_event structures */ | ||
| 21 | |||
| 22 | /* ioctls */ | ||
| 23 | /* Set input device byte stream format (any of VUID_{NATIVE,FIRM_EVENT}) */ | ||
| 24 | #define VUIDSFORMAT _IOW('v', 1, int) | ||
| 25 | /* Retrieve input device byte stream format */ | ||
| 26 | #define VUIDGFORMAT _IOR('v', 2, int) | ||
| 27 | |||
| 28 | /* Possible tag values */ | ||
| 29 | /* mouse buttons: */ | ||
| 30 | #define MS_LEFT 0x7f20 | ||
| 31 | #define MS_MIDDLE 0x7f21 | ||
| 32 | #define MS_RIGHT 0x7f22 | ||
| 33 | /* motion: */ | ||
| 34 | #define LOC_X_DELTA 0x7f80 | ||
| 35 | #define LOC_Y_DELTA 0x7f81 | ||
| 36 | #define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */ | ||
| 37 | #define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */ | ||
| 38 | |||
| 39 | #define VKEY_UP 0 | ||
| 40 | #define VKEY_DOWN 1 | ||
diff --git a/include/asm-um/ldt-i386.h b/include/asm-um/ldt-i386.h new file mode 100644 index 000000000000..b42662929b6c --- /dev/null +++ b/include/asm-um/ldt-i386.h | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | ||
| 3 | * Licensed under the GPL | ||
| 4 | * | ||
| 5 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __ASM_LDT_I386_H | ||
| 9 | #define __ASM_LDT_I386_H | ||
| 10 | |||
| 11 | #include "asm/semaphore.h" | ||
| 12 | #include "asm/arch/ldt.h" | ||
| 13 | |||
| 14 | struct mmu_context_skas; | ||
| 15 | extern void ldt_host_info(void); | ||
| 16 | extern long init_new_ldt(struct mmu_context_skas * to_mm, | ||
| 17 | struct mmu_context_skas * from_mm); | ||
| 18 | extern void free_ldt(struct mmu_context_skas * mm); | ||
| 19 | |||
| 20 | #define LDT_PAGES_MAX \ | ||
| 21 | ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE) | ||
| 22 | #define LDT_ENTRIES_PER_PAGE \ | ||
| 23 | (PAGE_SIZE/LDT_ENTRY_SIZE) | ||
| 24 | #define LDT_DIRECT_ENTRIES \ | ||
| 25 | ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE) | ||
| 26 | |||
| 27 | struct ldt_entry { | ||
| 28 | __u32 a; | ||
| 29 | __u32 b; | ||
| 30 | }; | ||
| 31 | |||
| 32 | typedef struct uml_ldt { | ||
| 33 | int entry_count; | ||
| 34 | struct semaphore semaphore; | ||
| 35 | union { | ||
| 36 | struct ldt_entry * pages[LDT_PAGES_MAX]; | ||
| 37 | struct ldt_entry entries[LDT_DIRECT_ENTRIES]; | ||
| 38 | }; | ||
| 39 | } uml_ldt_t; | ||
| 40 | |||
| 41 | /* | ||
| 42 | * macros stolen from include/asm-i386/desc.h | ||
| 43 | */ | ||
| 44 | #define LDT_entry_a(info) \ | ||
| 45 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
| 46 | |||
| 47 | #define LDT_entry_b(info) \ | ||
| 48 | (((info)->base_addr & 0xff000000) | \ | ||
| 49 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
| 50 | ((info)->limit & 0xf0000) | \ | ||
| 51 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
| 52 | ((info)->contents << 10) | \ | ||
| 53 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
| 54 | ((info)->seg_32bit << 22) | \ | ||
| 55 | ((info)->limit_in_pages << 23) | \ | ||
| 56 | ((info)->useable << 20) | \ | ||
| 57 | 0x7000) | ||
| 58 | |||
| 59 | #define LDT_empty(info) (\ | ||
| 60 | (info)->base_addr == 0 && \ | ||
| 61 | (info)->limit == 0 && \ | ||
| 62 | (info)->contents == 0 && \ | ||
| 63 | (info)->read_exec_only == 1 && \ | ||
| 64 | (info)->seg_32bit == 0 && \ | ||
| 65 | (info)->limit_in_pages == 0 && \ | ||
| 66 | (info)->seg_not_present == 1 && \ | ||
| 67 | (info)->useable == 0 ) | ||
| 68 | |||
| 69 | #endif | ||
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h index e908439d338a..4466ff6de0fd 100644 --- a/include/asm-um/ldt.h +++ b/include/asm-um/ldt.h | |||
| @@ -1,3 +1,72 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | ||
| 3 | * Licensed under the GPL | ||
| 4 | * | ||
| 5 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __ASM_LDT_I386_H | ||
| 9 | #define __ASM_LDT_I386_H | ||
| 10 | |||
| 11 | #include "asm/semaphore.h" | ||
| 12 | #include "asm/arch/ldt.h" | ||
| 13 | |||
| 14 | struct mmu_context_skas; | ||
| 15 | extern void ldt_host_info(void); | ||
| 16 | extern long init_new_ldt(struct mmu_context_skas * to_mm, | ||
| 17 | struct mmu_context_skas * from_mm); | ||
| 18 | extern void free_ldt(struct mmu_context_skas * mm); | ||
| 19 | |||
| 20 | #define LDT_PAGES_MAX \ | ||
| 21 | ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE) | ||
| 22 | #define LDT_ENTRIES_PER_PAGE \ | ||
| 23 | (PAGE_SIZE/LDT_ENTRY_SIZE) | ||
| 24 | #define LDT_DIRECT_ENTRIES \ | ||
| 25 | ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE) | ||
| 26 | |||
| 27 | struct ldt_entry { | ||
| 28 | __u32 a; | ||
| 29 | __u32 b; | ||
| 30 | }; | ||
| 31 | |||
| 32 | typedef struct uml_ldt { | ||
| 33 | int entry_count; | ||
| 34 | struct semaphore semaphore; | ||
| 35 | union { | ||
| 36 | struct ldt_entry * pages[LDT_PAGES_MAX]; | ||
| 37 | struct ldt_entry entries[LDT_DIRECT_ENTRIES]; | ||
| 38 | }; | ||
| 39 | } uml_ldt_t; | ||
| 40 | |||
| 41 | /* | ||
| 42 | * macros stolen from include/asm-i386/desc.h | ||
| 43 | */ | ||
| 44 | #define LDT_entry_a(info) \ | ||
| 45 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
| 46 | |||
| 47 | #define LDT_entry_b(info) \ | ||
| 48 | (((info)->base_addr & 0xff000000) | \ | ||
| 49 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
| 50 | ((info)->limit & 0xf0000) | \ | ||
| 51 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
| 52 | ((info)->contents << 10) | \ | ||
| 53 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
| 54 | ((info)->seg_32bit << 22) | \ | ||
| 55 | ((info)->limit_in_pages << 23) | \ | ||
| 56 | ((info)->useable << 20) | \ | ||
| 57 | 0x7000) | ||
| 58 | |||
| 59 | #define LDT_empty(info) (\ | ||
| 60 | (info)->base_addr == 0 && \ | ||
| 61 | (info)->limit == 0 && \ | ||
| 62 | (info)->contents == 0 && \ | ||
| 63 | (info)->read_exec_only == 1 && \ | ||
| 64 | (info)->seg_32bit == 0 && \ | ||
| 65 | (info)->limit_in_pages == 0 && \ | ||
| 66 | (info)->seg_not_present == 1 && \ | ||
| 67 | (info)->useable == 0 ) | ||
| 68 | |||
| 69 | #endif | ||
| 1 | #ifndef __UM_LDT_H | 70 | #ifndef __UM_LDT_H |
| 2 | #define __UM_LDT_H | 71 | #define __UM_LDT_H |
| 3 | 72 | ||
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h index 2edb4f1f789c..9a0e48eb542e 100644 --- a/include/asm-um/mmu_context.h +++ b/include/asm-um/mmu_context.h | |||
| @@ -29,7 +29,8 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) | |||
| 29 | * possible. | 29 | * possible. |
| 30 | */ | 30 | */ |
| 31 | if (old != new && (current->flags & PF_BORROWED_MM)) | 31 | if (old != new && (current->flags & PF_BORROWED_MM)) |
| 32 | force_flush_all(); | 32 | CHOOSE_MODE(force_flush_all(), |
| 33 | switch_mm_skas(&new->context.skas.id)); | ||
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | 36 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
diff --git a/include/asm-v850/atomic.h b/include/asm-v850/atomic.h index 8284aa7363f2..395268a8c0de 100644 --- a/include/asm-v850/atomic.h +++ b/include/asm-v850/atomic.h | |||
| @@ -31,7 +31,7 @@ typedef struct { int counter; } atomic_t; | |||
| 31 | #define atomic_read(v) ((v)->counter) | 31 | #define atomic_read(v) ((v)->counter) |
| 32 | #define atomic_set(v,i) (((v)->counter) = (i)) | 32 | #define atomic_set(v,i) (((v)->counter) = (i)) |
| 33 | 33 | ||
| 34 | extern __inline__ int atomic_add_return (int i, volatile atomic_t *v) | 34 | static inline int atomic_add_return (int i, volatile atomic_t *v) |
| 35 | { | 35 | { |
| 36 | unsigned long flags; | 36 | unsigned long flags; |
| 37 | int res; | 37 | int res; |
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h index 0e5c2f210872..b91e799763fd 100644 --- a/include/asm-v850/bitops.h +++ b/include/asm-v850/bitops.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | * ffz = Find First Zero in word. Undefined if no zero exists, | 30 | * ffz = Find First Zero in word. Undefined if no zero exists, |
| 31 | * so code should check against ~0UL first.. | 31 | * so code should check against ~0UL first.. |
| 32 | */ | 32 | */ |
| 33 | extern __inline__ unsigned long ffz (unsigned long word) | 33 | static inline unsigned long ffz (unsigned long word) |
| 34 | { | 34 | { |
| 35 | unsigned long result = 0; | 35 | unsigned long result = 0; |
| 36 | 36 | ||
| @@ -135,7 +135,7 @@ extern __inline__ unsigned long ffz (unsigned long word) | |||
| 135 | "m" (*((const char *)(addr) + ((nr) >> 3)))); \ | 135 | "m" (*((const char *)(addr) + ((nr) >> 3)))); \ |
| 136 | __test_bit_res; \ | 136 | __test_bit_res; \ |
| 137 | }) | 137 | }) |
| 138 | extern __inline__ int __test_bit (int nr, const void *addr) | 138 | static inline int __test_bit (int nr, const void *addr) |
| 139 | { | 139 | { |
| 140 | int res; | 140 | int res; |
| 141 | __asm__ __volatile__ ("tst1 %1, [%2]; setf nz, %0" | 141 | __asm__ __volatile__ ("tst1 %1, [%2]; setf nz, %0" |
| @@ -157,7 +157,7 @@ extern __inline__ int __test_bit (int nr, const void *addr) | |||
| 157 | #define find_first_zero_bit(addr, size) \ | 157 | #define find_first_zero_bit(addr, size) \ |
| 158 | find_next_zero_bit ((addr), (size), 0) | 158 | find_next_zero_bit ((addr), (size), 0) |
| 159 | 159 | ||
| 160 | extern __inline__ int find_next_zero_bit(const void *addr, int size, int offset) | 160 | static inline int find_next_zero_bit(const void *addr, int size, int offset) |
| 161 | { | 161 | { |
| 162 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); | 162 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); |
| 163 | unsigned long result = offset & ~31UL; | 163 | unsigned long result = offset & ~31UL; |
diff --git a/include/asm-v850/delay.h b/include/asm-v850/delay.h index 1ce65d48a7c5..6d028e6b2354 100644 --- a/include/asm-v850/delay.h +++ b/include/asm-v850/delay.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <asm/param.h> | 17 | #include <asm/param.h> |
| 18 | 18 | ||
| 19 | extern __inline__ void __delay(unsigned long loops) | 19 | static inline void __delay(unsigned long loops) |
| 20 | { | 20 | { |
| 21 | if (loops) | 21 | if (loops) |
| 22 | __asm__ __volatile__ ("1: add -1, %0; bnz 1b" | 22 | __asm__ __volatile__ ("1: add -1, %0; bnz 1b" |
| @@ -33,7 +33,7 @@ extern __inline__ void __delay(unsigned long loops) | |||
| 33 | 33 | ||
| 34 | extern unsigned long loops_per_jiffy; | 34 | extern unsigned long loops_per_jiffy; |
| 35 | 35 | ||
| 36 | extern __inline__ void udelay(unsigned long usecs) | 36 | static inline void udelay(unsigned long usecs) |
| 37 | { | 37 | { |
| 38 | register unsigned long full_loops, part_loops; | 38 | register unsigned long full_loops, part_loops; |
| 39 | 39 | ||
diff --git a/include/asm-v850/hw_irq.h b/include/asm-v850/hw_irq.h index 4bdc98edb9f8..a8aab4342712 100644 --- a/include/asm-v850/hw_irq.h +++ b/include/asm-v850/hw_irq.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef __V850_HW_IRQ_H__ | 1 | #ifndef __V850_HW_IRQ_H__ |
| 2 | #define __V850_HW_IRQ_H__ | 2 | #define __V850_HW_IRQ_H__ |
| 3 | 3 | ||
| 4 | extern inline void hw_resend_irq (struct hw_interrupt_type *h, unsigned int i) | 4 | static inline void hw_resend_irq (struct hw_interrupt_type *h, unsigned int i) |
| 5 | { | 5 | { |
| 6 | } | 6 | } |
| 7 | 7 | ||
diff --git a/include/asm-v850/processor.h b/include/asm-v850/processor.h index d41f925f5182..98f929427d3d 100644 --- a/include/asm-v850/processor.h +++ b/include/asm-v850/processor.h | |||
| @@ -59,7 +59,7 @@ struct thread_struct { | |||
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | /* Do necessary setup to start up a newly executed thread. */ | 61 | /* Do necessary setup to start up a newly executed thread. */ |
| 62 | extern inline void start_thread (struct pt_regs *regs, | 62 | static inline void start_thread (struct pt_regs *regs, |
| 63 | unsigned long pc, unsigned long usp) | 63 | unsigned long pc, unsigned long usp) |
| 64 | { | 64 | { |
| 65 | regs->pc = pc; | 65 | regs->pc = pc; |
| @@ -68,7 +68,7 @@ extern inline void start_thread (struct pt_regs *regs, | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | /* Free all resources held by a thread. */ | 70 | /* Free all resources held by a thread. */ |
| 71 | extern inline void release_thread (struct task_struct *dead_task) | 71 | static inline void release_thread (struct task_struct *dead_task) |
| 72 | { | 72 | { |
| 73 | } | 73 | } |
| 74 | 74 | ||
diff --git a/include/asm-v850/semaphore.h b/include/asm-v850/semaphore.h index df6cdecf6c1f..735baaf3a16e 100644 --- a/include/asm-v850/semaphore.h +++ b/include/asm-v850/semaphore.h | |||
| @@ -24,7 +24,7 @@ struct semaphore { | |||
| 24 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC (name,1) | 24 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC (name,1) |
| 25 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC (name,0) | 25 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC (name,0) |
| 26 | 26 | ||
| 27 | extern inline void sema_init (struct semaphore *sem, int val) | 27 | static inline void sema_init (struct semaphore *sem, int val) |
| 28 | { | 28 | { |
| 29 | *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); | 29 | *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); |
| 30 | } | 30 | } |
| @@ -52,14 +52,14 @@ extern int __down_interruptible (struct semaphore * sem); | |||
| 52 | extern int __down_trylock (struct semaphore * sem); | 52 | extern int __down_trylock (struct semaphore * sem); |
| 53 | extern void __up (struct semaphore * sem); | 53 | extern void __up (struct semaphore * sem); |
| 54 | 54 | ||
| 55 | extern inline void down (struct semaphore * sem) | 55 | static inline void down (struct semaphore * sem) |
| 56 | { | 56 | { |
| 57 | might_sleep(); | 57 | might_sleep(); |
| 58 | if (atomic_dec_return (&sem->count) < 0) | 58 | if (atomic_dec_return (&sem->count) < 0) |
| 59 | __down (sem); | 59 | __down (sem); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | extern inline int down_interruptible (struct semaphore * sem) | 62 | static inline int down_interruptible (struct semaphore * sem) |
| 63 | { | 63 | { |
| 64 | int ret = 0; | 64 | int ret = 0; |
| 65 | might_sleep(); | 65 | might_sleep(); |
| @@ -68,7 +68,7 @@ extern inline int down_interruptible (struct semaphore * sem) | |||
| 68 | return ret; | 68 | return ret; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | extern inline int down_trylock (struct semaphore *sem) | 71 | static inline int down_trylock (struct semaphore *sem) |
| 72 | { | 72 | { |
| 73 | int ret = 0; | 73 | int ret = 0; |
| 74 | if (atomic_dec_return (&sem->count) < 0) | 74 | if (atomic_dec_return (&sem->count) < 0) |
| @@ -76,7 +76,7 @@ extern inline int down_trylock (struct semaphore *sem) | |||
| 76 | return ret; | 76 | return ret; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | extern inline void up (struct semaphore * sem) | 79 | static inline void up (struct semaphore * sem) |
| 80 | { | 80 | { |
| 81 | if (atomic_inc_return (&sem->count) <= 0) | 81 | if (atomic_inc_return (&sem->count) <= 0) |
| 82 | __up (sem); | 82 | __up (sem); |
diff --git a/include/asm-v850/system.h b/include/asm-v850/system.h index 20f4c738c04e..107decbd6e6c 100644 --- a/include/asm-v850/system.h +++ b/include/asm-v850/system.h | |||
| @@ -81,7 +81,7 @@ static inline int irqs_disabled (void) | |||
| 81 | ((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr)))) | 81 | ((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr)))) |
| 82 | #define tas(ptr) (xchg ((ptr), 1)) | 82 | #define tas(ptr) (xchg ((ptr), 1)) |
| 83 | 83 | ||
| 84 | extern inline unsigned long __xchg (unsigned long with, | 84 | static inline unsigned long __xchg (unsigned long with, |
| 85 | __volatile__ void *ptr, int size) | 85 | __volatile__ void *ptr, int size) |
| 86 | { | 86 | { |
| 87 | unsigned long tmp, flags; | 87 | unsigned long tmp, flags; |
diff --git a/include/asm-v850/tlbflush.h b/include/asm-v850/tlbflush.h index 501e4498172c..5f2f85f636ea 100644 --- a/include/asm-v850/tlbflush.h +++ b/include/asm-v850/tlbflush.h | |||
| @@ -56,12 +56,12 @@ static inline void flush_tlb_range(struct vm_area_struct *vma, | |||
| 56 | BUG (); | 56 | BUG (); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | extern inline void flush_tlb_kernel_page(unsigned long addr) | 59 | static inline void flush_tlb_kernel_page(unsigned long addr) |
| 60 | { | 60 | { |
| 61 | BUG (); | 61 | BUG (); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | extern inline void flush_tlb_pgtables(struct mm_struct *mm, | 64 | static inline void flush_tlb_pgtables(struct mm_struct *mm, |
| 65 | unsigned long start, unsigned long end) | 65 | unsigned long start, unsigned long end) |
| 66 | { | 66 | { |
| 67 | BUG (); | 67 | BUG (); |
diff --git a/include/asm-v850/uaccess.h b/include/asm-v850/uaccess.h index 188b28597cf1..64563c409bb2 100644 --- a/include/asm-v850/uaccess.h +++ b/include/asm-v850/uaccess.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #define VERIFY_READ 0 | 14 | #define VERIFY_READ 0 |
| 15 | #define VERIFY_WRITE 1 | 15 | #define VERIFY_WRITE 1 |
| 16 | 16 | ||
| 17 | extern inline int access_ok (int type, const void *addr, unsigned long size) | 17 | static inline int access_ok (int type, const void *addr, unsigned long size) |
| 18 | { | 18 | { |
| 19 | /* XXX I guess we should check against real ram bounds at least, and | 19 | /* XXX I guess we should check against real ram bounds at least, and |
| 20 | possibly make sure ADDR is not within the kernel. | 20 | possibly make sure ADDR is not within the kernel. |
diff --git a/include/asm-v850/unaligned.h b/include/asm-v850/unaligned.h index 65e38362142b..e30b18653a94 100644 --- a/include/asm-v850/unaligned.h +++ b/include/asm-v850/unaligned.h | |||
| @@ -82,19 +82,19 @@ extern int __bug_unaligned_x(void *ptr); | |||
| 82 | }) | 82 | }) |
| 83 | 83 | ||
| 84 | 84 | ||
| 85 | extern inline void __put_unaligned_2(__u32 __v, register __u8 *__p) | 85 | static inline void __put_unaligned_2(__u32 __v, register __u8 *__p) |
| 86 | { | 86 | { |
| 87 | *__p++ = __v; | 87 | *__p++ = __v; |
| 88 | *__p++ = __v >> 8; | 88 | *__p++ = __v >> 8; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | extern inline void __put_unaligned_4(__u32 __v, register __u8 *__p) | 91 | static inline void __put_unaligned_4(__u32 __v, register __u8 *__p) |
| 92 | { | 92 | { |
| 93 | __put_unaligned_2(__v >> 16, __p + 2); | 93 | __put_unaligned_2(__v >> 16, __p + 2); |
| 94 | __put_unaligned_2(__v, __p); | 94 | __put_unaligned_2(__v, __p); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | extern inline void __put_unaligned_8(const unsigned long long __v, register __u8 *__p) | 97 | static inline void __put_unaligned_8(const unsigned long long __v, register __u8 *__p) |
| 98 | { | 98 | { |
| 99 | /* | 99 | /* |
| 100 | * tradeoff: 8 bytes of stack for all unaligned puts (2 | 100 | * tradeoff: 8 bytes of stack for all unaligned puts (2 |
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h index a60a35e79222..43862cd6a569 100644 --- a/include/asm-x86_64/elf.h +++ b/include/asm-x86_64/elf.h | |||
| @@ -149,6 +149,8 @@ extern void set_personality_64bit(void); | |||
| 149 | */ | 149 | */ |
| 150 | #define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) | 150 | #define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) |
| 151 | 151 | ||
| 152 | struct task_struct; | ||
| 153 | |||
| 152 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); | 154 | extern int dump_task_regs (struct task_struct *, elf_gregset_t *); |
| 153 | extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); | 155 | extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); |
| 154 | 156 | ||
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h index 6d6d883fdf6d..4dd7a7e148d4 100644 --- a/include/asm-x86_64/kprobes.h +++ b/include/asm-x86_64/kprobes.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | */ | 25 | */ |
| 26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 27 | #include <linux/ptrace.h> | 27 | #include <linux/ptrace.h> |
| 28 | #include <linux/percpu.h> | ||
| 28 | 29 | ||
| 29 | struct pt_regs; | 30 | struct pt_regs; |
| 30 | 31 | ||
| @@ -48,6 +49,24 @@ struct arch_specific_insn { | |||
| 48 | kprobe_opcode_t *insn; | 49 | kprobe_opcode_t *insn; |
| 49 | }; | 50 | }; |
| 50 | 51 | ||
| 52 | struct prev_kprobe { | ||
| 53 | struct kprobe *kp; | ||
| 54 | unsigned long status; | ||
| 55 | unsigned long old_rflags; | ||
| 56 | unsigned long saved_rflags; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* per-cpu kprobe control block */ | ||
| 60 | struct kprobe_ctlblk { | ||
| 61 | unsigned long kprobe_status; | ||
| 62 | unsigned long kprobe_old_rflags; | ||
| 63 | unsigned long kprobe_saved_rflags; | ||
| 64 | long *jprobe_saved_rsp; | ||
| 65 | struct pt_regs jprobe_saved_regs; | ||
| 66 | kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; | ||
| 67 | struct prev_kprobe prev_kprobe; | ||
| 68 | }; | ||
| 69 | |||
| 51 | /* trap3/1 are intr gates for kprobes. So, restore the status of IF, | 70 | /* trap3/1 are intr gates for kprobes. So, restore the status of IF, |
| 52 | * if necessary, before executing the original int3/1 (trap) handler. | 71 | * if necessary, before executing the original int3/1 (trap) handler. |
| 53 | */ | 72 | */ |
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 7a07196a7202..7309fffeec9a 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
| @@ -105,6 +105,8 @@ static inline void pgd_clear (pgd_t * pgd) | |||
| 105 | 105 | ||
| 106 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) | 106 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) |
| 107 | 107 | ||
| 108 | struct mm_struct; | ||
| 109 | |||
| 108 | static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) | 110 | static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) |
| 109 | { | 111 | { |
| 110 | pte_t pte; | 112 | pte_t pte; |
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h index 64f1f53874fe..de0667453b2e 100644 --- a/include/asm-xtensa/elf.h +++ b/include/asm-xtensa/elf.h | |||
| @@ -209,6 +209,8 @@ extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *); | |||
| 209 | 209 | ||
| 210 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) | 210 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) |
| 211 | 211 | ||
| 212 | struct task_struct; | ||
| 213 | |||
| 212 | extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*, | 214 | extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*, |
| 213 | struct task_struct*); | 215 | struct task_struct*); |
| 214 | extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*, | 216 | extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*, |
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h index 987e3b802313..7b15afb70c56 100644 --- a/include/asm-xtensa/pgtable.h +++ b/include/asm-xtensa/pgtable.h | |||
| @@ -278,6 +278,8 @@ static inline void update_pte(pte_t *ptep, pte_t pteval) | |||
| 278 | #endif | 278 | #endif |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | struct mm_struct; | ||
| 282 | |||
| 281 | static inline void | 283 | static inline void |
| 282 | set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) | 284 | set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) |
| 283 | { | 285 | { |
| @@ -294,6 +296,7 @@ set_pmd(pmd_t *pmdp, pmd_t pmdval) | |||
| 294 | #endif | 296 | #endif |
| 295 | } | 297 | } |
| 296 | 298 | ||
| 299 | struct vm_area_struct; | ||
| 297 | 300 | ||
| 298 | static inline int | 301 | static inline int |
| 299 | ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, | 302 | ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, |
diff --git a/include/asm-xtensa/semaphore.h b/include/asm-xtensa/semaphore.h index 2a10e193b929..f10c3487cd4c 100644 --- a/include/asm-xtensa/semaphore.h +++ b/include/asm-xtensa/semaphore.h | |||
| @@ -38,6 +38,7 @@ struct semaphore { | |||
| 38 | static inline void sema_init (struct semaphore *sem, int val) | 38 | static inline void sema_init (struct semaphore *sem, int val) |
| 39 | { | 39 | { |
| 40 | atomic_set(&sem->count, val); | 40 | atomic_set(&sem->count, val); |
| 41 | sem->sleepers = 0; | ||
| 41 | init_waitqueue_head(&sem->wait); | 42 | init_waitqueue_head(&sem->wait); |
| 42 | } | 43 | } |
| 43 | 44 | ||
diff --git a/include/linux/acct.h b/include/linux/acct.h index 19f70462b3be..93c5b3cdf951 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h | |||
| @@ -117,12 +117,15 @@ struct acct_v3 | |||
| 117 | #include <linux/config.h> | 117 | #include <linux/config.h> |
| 118 | 118 | ||
| 119 | #ifdef CONFIG_BSD_PROCESS_ACCT | 119 | #ifdef CONFIG_BSD_PROCESS_ACCT |
| 120 | struct vfsmount; | ||
| 120 | struct super_block; | 121 | struct super_block; |
| 122 | extern void acct_auto_close_mnt(struct vfsmount *m); | ||
| 121 | extern void acct_auto_close(struct super_block *sb); | 123 | extern void acct_auto_close(struct super_block *sb); |
| 122 | extern void acct_process(long exitcode); | 124 | extern void acct_process(long exitcode); |
| 123 | extern void acct_update_integrals(struct task_struct *tsk); | 125 | extern void acct_update_integrals(struct task_struct *tsk); |
| 124 | extern void acct_clear_integrals(struct task_struct *tsk); | 126 | extern void acct_clear_integrals(struct task_struct *tsk); |
| 125 | #else | 127 | #else |
| 128 | #define acct_auto_close_mnt(x) do { } while (0) | ||
| 126 | #define acct_auto_close(x) do { } while (0) | 129 | #define acct_auto_close(x) do { } while (0) |
| 127 | #define acct_process(x) do { } while (0) | 130 | #define acct_process(x) do { } while (0) |
| 128 | #define acct_update_integrals(x) do { } while (0) | 131 | #define acct_update_integrals(x) do { } while (0) |
diff --git a/include/linux/aio.h b/include/linux/aio.h index 0decf66117c1..403d71dcb7c8 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
| @@ -183,6 +183,7 @@ struct kioctx { | |||
| 183 | struct list_head active_reqs; /* used for cancellation */ | 183 | struct list_head active_reqs; /* used for cancellation */ |
| 184 | struct list_head run_list; /* used for kicked reqs */ | 184 | struct list_head run_list; /* used for kicked reqs */ |
| 185 | 185 | ||
| 186 | /* sys_io_setup currently limits this to an unsigned int */ | ||
| 186 | unsigned max_reqs; | 187 | unsigned max_reqs; |
| 187 | 188 | ||
| 188 | struct aio_ring_info ring_info; | 189 | struct aio_ring_info ring_info; |
| @@ -234,7 +235,7 @@ static inline struct kiocb *list_kiocb(struct list_head *h) | |||
| 234 | } | 235 | } |
| 235 | 236 | ||
| 236 | /* for sysctl: */ | 237 | /* for sysctl: */ |
| 237 | extern atomic_t aio_nr; | 238 | extern unsigned long aio_nr; |
| 238 | extern unsigned aio_max_nr; | 239 | extern unsigned long aio_max_nr; |
| 239 | 240 | ||
| 240 | #endif /* __LINUX__AIO_H */ | 241 | #endif /* __LINUX__AIO_H */ |
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h new file mode 100644 index 000000000000..70ab56317380 --- /dev/null +++ b/include/linux/cn_proc.h | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* | ||
| 2 | * cn_proc.h - process events connector | ||
| 3 | * | ||
| 4 | * Copyright (C) Matt Helsley, IBM Corp. 2005 | ||
| 5 | * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin | ||
| 6 | * Original copyright notice follows: | ||
| 7 | * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com> | ||
| 8 | * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | */ | ||
| 24 | |||
| 25 | #ifndef CN_PROC_H | ||
| 26 | #define CN_PROC_H | ||
| 27 | |||
| 28 | #include <linux/types.h> | ||
| 29 | #include <linux/connector.h> | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Userspace sends this enum to register with the kernel that it is listening | ||
| 33 | * for events on the connector. | ||
| 34 | */ | ||
| 35 | enum proc_cn_mcast_op { | ||
| 36 | PROC_CN_MCAST_LISTEN = 1, | ||
| 37 | PROC_CN_MCAST_IGNORE = 2 | ||
| 38 | }; | ||
| 39 | |||
| 40 | /* | ||
| 41 | * From the user's point of view, the process | ||
| 42 | * ID is the thread group ID and thread ID is the internal | ||
| 43 | * kernel "pid". So, fields are assigned as follow: | ||
| 44 | * | ||
| 45 | * In user space - In kernel space | ||
| 46 | * | ||
| 47 | * parent process ID = parent->tgid | ||
| 48 | * parent thread ID = parent->pid | ||
| 49 | * child process ID = child->tgid | ||
| 50 | * child thread ID = child->pid | ||
| 51 | */ | ||
| 52 | |||
| 53 | struct proc_event { | ||
| 54 | enum what { | ||
| 55 | /* Use successive bits so the enums can be used to record | ||
| 56 | * sets of events as well | ||
| 57 | */ | ||
| 58 | PROC_EVENT_NONE = 0x00000000, | ||
| 59 | PROC_EVENT_FORK = 0x00000001, | ||
| 60 | PROC_EVENT_EXEC = 0x00000002, | ||
| 61 | PROC_EVENT_UID = 0x00000004, | ||
| 62 | PROC_EVENT_GID = 0x00000040, | ||
| 63 | /* "next" should be 0x00000400 */ | ||
| 64 | /* "last" is the last process event: exit */ | ||
| 65 | PROC_EVENT_EXIT = 0x80000000 | ||
| 66 | } what; | ||
| 67 | __u32 cpu; | ||
| 68 | union { /* must be last field of proc_event struct */ | ||
| 69 | struct { | ||
| 70 | __u32 err; | ||
| 71 | } ack; | ||
| 72 | |||
| 73 | struct fork_proc_event { | ||
| 74 | pid_t parent_pid; | ||
| 75 | pid_t parent_tgid; | ||
| 76 | pid_t child_pid; | ||
| 77 | pid_t child_tgid; | ||
| 78 | } fork; | ||
| 79 | |||
| 80 | struct exec_proc_event { | ||
| 81 | pid_t process_pid; | ||
| 82 | pid_t process_tgid; | ||
| 83 | } exec; | ||
| 84 | |||
| 85 | struct id_proc_event { | ||
| 86 | pid_t process_pid; | ||
| 87 | pid_t process_tgid; | ||
| 88 | union { | ||
| 89 | uid_t ruid; /* current->uid */ | ||
| 90 | gid_t rgid; /* current->gid */ | ||
| 91 | } r; | ||
| 92 | union { | ||
| 93 | uid_t euid; | ||
| 94 | gid_t egid; | ||
| 95 | } e; | ||
| 96 | } id; | ||
| 97 | |||
| 98 | struct exit_proc_event { | ||
| 99 | pid_t process_pid; | ||
| 100 | pid_t process_tgid; | ||
| 101 | __u32 exit_code, exit_signal; | ||
| 102 | } exit; | ||
| 103 | } event_data; | ||
| 104 | }; | ||
| 105 | |||
| 106 | #ifdef __KERNEL__ | ||
| 107 | #ifdef CONFIG_PROC_EVENTS | ||
| 108 | void proc_fork_connector(struct task_struct *task); | ||
| 109 | void proc_exec_connector(struct task_struct *task); | ||
| 110 | void proc_id_connector(struct task_struct *task, int which_id); | ||
| 111 | void proc_exit_connector(struct task_struct *task); | ||
| 112 | #else | ||
| 113 | static inline void proc_fork_connector(struct task_struct *task) | ||
| 114 | {} | ||
| 115 | |||
| 116 | static inline void proc_exec_connector(struct task_struct *task) | ||
| 117 | {} | ||
| 118 | |||
| 119 | static inline void proc_id_connector(struct task_struct *task, | ||
| 120 | int which_id) | ||
| 121 | {} | ||
| 122 | |||
| 123 | static inline void proc_exit_connector(struct task_struct *task) | ||
| 124 | {} | ||
| 125 | #endif /* CONFIG_PROC_EVENTS */ | ||
| 126 | #endif /* __KERNEL__ */ | ||
| 127 | #endif /* CN_PROC_H */ | ||
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index ecb0d39c0798..2209ad3499a3 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h | |||
| @@ -10,6 +10,10 @@ | |||
| 10 | #define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl) | 10 | #define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl) |
| 11 | #endif | 11 | #endif |
| 12 | 12 | ||
| 13 | |||
| 14 | COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ | ||
| 15 | COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ | ||
| 16 | |||
| 13 | /* Big T */ | 17 | /* Big T */ |
| 14 | COMPATIBLE_IOCTL(TCGETA) | 18 | COMPATIBLE_IOCTL(TCGETA) |
| 15 | COMPATIBLE_IOCTL(TCSETA) | 19 | COMPATIBLE_IOCTL(TCSETA) |
| @@ -52,13 +56,6 @@ ULONG_IOCTL(TIOCSCTTY) | |||
| 52 | COMPATIBLE_IOCTL(TIOCGPTN) | 56 | COMPATIBLE_IOCTL(TIOCGPTN) |
| 53 | COMPATIBLE_IOCTL(TIOCSPTLCK) | 57 | COMPATIBLE_IOCTL(TIOCSPTLCK) |
| 54 | COMPATIBLE_IOCTL(TIOCSERGETLSR) | 58 | COMPATIBLE_IOCTL(TIOCSERGETLSR) |
| 55 | /* Big F */ | ||
| 56 | COMPATIBLE_IOCTL(FBIOBLANK) | ||
| 57 | COMPATIBLE_IOCTL(FBIOGET_VSCREENINFO) | ||
| 58 | COMPATIBLE_IOCTL(FBIOPUT_VSCREENINFO) | ||
| 59 | COMPATIBLE_IOCTL(FBIOPAN_DISPLAY) | ||
| 60 | COMPATIBLE_IOCTL(FBIOGET_CON2FBMAP) | ||
| 61 | COMPATIBLE_IOCTL(FBIOPUT_CON2FBMAP) | ||
| 62 | /* Little f */ | 59 | /* Little f */ |
| 63 | COMPATIBLE_IOCTL(FIOCLEX) | 60 | COMPATIBLE_IOCTL(FIOCLEX) |
| 64 | COMPATIBLE_IOCTL(FIONCLEX) | 61 | COMPATIBLE_IOCTL(FIONCLEX) |
| @@ -81,6 +78,8 @@ COMPATIBLE_IOCTL(HDIO_DRIVE_CMD) | |||
| 81 | COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) | 78 | COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) |
| 82 | COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE) | 79 | COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE) |
| 83 | COMPATIBLE_IOCTL(HDIO_SET_NICE) | 80 | COMPATIBLE_IOCTL(HDIO_SET_NICE) |
| 81 | COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS) | ||
| 82 | COMPATIBLE_IOCTL(HDIO_SCAN_HWIF) | ||
| 84 | /* 0x02 -- Floppy ioctls */ | 83 | /* 0x02 -- Floppy ioctls */ |
| 85 | COMPATIBLE_IOCTL(FDMSGON) | 84 | COMPATIBLE_IOCTL(FDMSGON) |
| 86 | COMPATIBLE_IOCTL(FDMSGOFF) | 85 | COMPATIBLE_IOCTL(FDMSGOFF) |
| @@ -99,6 +98,7 @@ COMPATIBLE_IOCTL(FDTWADDLE) | |||
| 99 | COMPATIBLE_IOCTL(FDFMTTRK) | 98 | COMPATIBLE_IOCTL(FDFMTTRK) |
| 100 | COMPATIBLE_IOCTL(FDRAWCMD) | 99 | COMPATIBLE_IOCTL(FDRAWCMD) |
| 101 | /* 0x12 */ | 100 | /* 0x12 */ |
| 101 | COMPATIBLE_IOCTL(BLKRASET) | ||
| 102 | COMPATIBLE_IOCTL(BLKROSET) | 102 | COMPATIBLE_IOCTL(BLKROSET) |
| 103 | COMPATIBLE_IOCTL(BLKROGET) | 103 | COMPATIBLE_IOCTL(BLKROGET) |
| 104 | COMPATIBLE_IOCTL(BLKRRPART) | 104 | COMPATIBLE_IOCTL(BLKRRPART) |
| @@ -262,6 +262,7 @@ COMPATIBLE_IOCTL(RTC_WKALM_RD) | |||
| 262 | /* Little m */ | 262 | /* Little m */ |
| 263 | COMPATIBLE_IOCTL(MTIOCTOP) | 263 | COMPATIBLE_IOCTL(MTIOCTOP) |
| 264 | /* Socket level stuff */ | 264 | /* Socket level stuff */ |
| 265 | COMPATIBLE_IOCTL(FIOQSIZE) | ||
| 265 | COMPATIBLE_IOCTL(FIOSETOWN) | 266 | COMPATIBLE_IOCTL(FIOSETOWN) |
| 266 | COMPATIBLE_IOCTL(SIOCSPGRP) | 267 | COMPATIBLE_IOCTL(SIOCSPGRP) |
| 267 | COMPATIBLE_IOCTL(FIOGETOWN) | 268 | COMPATIBLE_IOCTL(FIOGETOWN) |
diff --git a/include/linux/config.h b/include/linux/config.h index 9d1c14f7ad6d..a91f5e55b525 100644 --- a/include/linux/config.h +++ b/include/linux/config.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _LINUX_CONFIG_H | 1 | #ifndef _LINUX_CONFIG_H |
| 2 | #define _LINUX_CONFIG_H | 2 | #define _LINUX_CONFIG_H |
| 3 | 3 | /* This file is no longer in use and kept only for backward compatibility. | |
| 4 | * autoconf.h is now included via -imacros on the commandline | ||
| 5 | */ | ||
| 4 | #include <linux/autoconf.h> | 6 | #include <linux/autoconf.h> |
| 5 | 7 | ||
| 6 | #endif | 8 | #endif |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 95952cc1f525..c5769c6585f4 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
| @@ -27,6 +27,12 @@ | |||
| 27 | #define CN_IDX_CONNECTOR 0xffffffff | 27 | #define CN_IDX_CONNECTOR 0xffffffff |
| 28 | #define CN_VAL_CONNECTOR 0xffffffff | 28 | #define CN_VAL_CONNECTOR 0xffffffff |
| 29 | 29 | ||
| 30 | /* | ||
| 31 | * Process Events connector unique ids -- used for message routing | ||
| 32 | */ | ||
| 33 | #define CN_IDX_PROC 0x1 | ||
| 34 | #define CN_VAL_PROC 0x1 | ||
| 35 | |||
| 30 | #define CN_NETLINK_USERS 1 | 36 | #define CN_NETLINK_USERS 1 |
| 31 | 37 | ||
| 32 | /* | 38 | /* |
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index 725be90ef55e..f8e5587a0f92 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | * to achieve effects such as fast scrolling by changing the origin. | 9 | * to achieve effects such as fast scrolling by changing the origin. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/vt.h> | ||
| 13 | |||
| 12 | struct vt_struct; | 14 | struct vt_struct; |
| 13 | 15 | ||
| 14 | #define NPAR 16 | 16 | #define NPAR 16 |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 1f7b2c097503..43c44530ef9d 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
| @@ -42,6 +42,7 @@ struct notifier_block; | |||
| 42 | /* Need to know about CPUs going up/down? */ | 42 | /* Need to know about CPUs going up/down? */ |
| 43 | extern int register_cpu_notifier(struct notifier_block *nb); | 43 | extern int register_cpu_notifier(struct notifier_block *nb); |
| 44 | extern void unregister_cpu_notifier(struct notifier_block *nb); | 44 | extern void unregister_cpu_notifier(struct notifier_block *nb); |
| 45 | extern int current_in_cpu_hotplug(void); | ||
| 45 | 46 | ||
| 46 | int cpu_up(unsigned int cpu); | 47 | int cpu_up(unsigned int cpu); |
| 47 | 48 | ||
| @@ -54,6 +55,10 @@ static inline int register_cpu_notifier(struct notifier_block *nb) | |||
| 54 | static inline void unregister_cpu_notifier(struct notifier_block *nb) | 55 | static inline void unregister_cpu_notifier(struct notifier_block *nb) |
| 55 | { | 56 | { |
| 56 | } | 57 | } |
| 58 | static inline int current_in_cpu_hotplug(void) | ||
| 59 | { | ||
| 60 | return 0; | ||
| 61 | } | ||
| 57 | 62 | ||
| 58 | #endif /* CONFIG_SMP */ | 63 | #endif /* CONFIG_SMP */ |
| 59 | extern struct sysdev_class cpu_sysdev_class; | 64 | extern struct sysdev_class cpu_sysdev_class; |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index ab04b4f9b0db..46a2ba617595 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -329,6 +329,7 @@ static inline int d_mountpoint(struct dentry *dentry) | |||
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *); | 331 | extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *); |
| 332 | extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int); | ||
| 332 | extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); | 333 | extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); |
| 333 | 334 | ||
| 334 | extern int sysctl_vfs_cache_pressure; | 335 | extern int sysctl_vfs_cache_pressure; |
diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h deleted file mode 100644 index 38afd9da1dfe..000000000000 --- a/include/linux/eeprom.h +++ /dev/null | |||
| @@ -1,136 +0,0 @@ | |||
| 1 | /* credit winbond-840.c | ||
| 2 | */ | ||
| 3 | #include <asm/io.h> | ||
| 4 | struct eeprom_ops { | ||
| 5 | void (*set_cs)(void *ee); | ||
| 6 | void (*clear_cs)(void *ee); | ||
| 7 | }; | ||
| 8 | |||
| 9 | #define EEPOL_EEDI 0x01 | ||
| 10 | #define EEPOL_EEDO 0x02 | ||
| 11 | #define EEPOL_EECLK 0x04 | ||
| 12 | #define EEPOL_EESEL 0x08 | ||
| 13 | |||
| 14 | struct eeprom { | ||
| 15 | void *dev; | ||
| 16 | struct eeprom_ops *ops; | ||
| 17 | |||
| 18 | void __iomem * addr; | ||
| 19 | |||
| 20 | unsigned ee_addr_bits; | ||
| 21 | |||
| 22 | unsigned eesel; | ||
| 23 | unsigned eeclk; | ||
| 24 | unsigned eedo; | ||
| 25 | unsigned eedi; | ||
| 26 | unsigned polarity; | ||
| 27 | unsigned ee_state; | ||
| 28 | |||
| 29 | spinlock_t *lock; | ||
| 30 | u32 *cache; | ||
| 31 | }; | ||
| 32 | |||
| 33 | |||
| 34 | u8 eeprom_readb(struct eeprom *ee, unsigned address); | ||
| 35 | void eeprom_read(struct eeprom *ee, unsigned address, u8 *bytes, | ||
| 36 | unsigned count); | ||
| 37 | void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data); | ||
| 38 | void eeprom_write(struct eeprom *ee, unsigned address, u8 *bytes, | ||
| 39 | unsigned count); | ||
| 40 | |||
| 41 | /* The EEPROM commands include the alway-set leading bit. */ | ||
| 42 | enum EEPROM_Cmds { | ||
| 43 | EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), | ||
| 44 | }; | ||
| 45 | |||
| 46 | void setup_ee_mem_bitbanger(struct eeprom *ee, void __iomem *memaddr, int eesel_bit, int eeclk_bit, int eedo_bit, int eedi_bit, unsigned polarity) | ||
| 47 | { | ||
| 48 | ee->addr = memaddr; | ||
| 49 | ee->eesel = 1 << eesel_bit; | ||
| 50 | ee->eeclk = 1 << eeclk_bit; | ||
| 51 | ee->eedo = 1 << eedo_bit; | ||
| 52 | ee->eedi = 1 << eedi_bit; | ||
| 53 | |||
| 54 | ee->polarity = polarity; | ||
| 55 | |||
| 56 | *ee->cache = readl(ee->addr); | ||
| 57 | } | ||
| 58 | |||
| 59 | /* foo. put this in a .c file */ | ||
| 60 | static inline void eeprom_update(struct eeprom *ee, u32 mask, int pol) | ||
| 61 | { | ||
| 62 | unsigned long flags; | ||
| 63 | u32 data; | ||
| 64 | |||
| 65 | spin_lock_irqsave(ee->lock, flags); | ||
| 66 | data = *ee->cache; | ||
| 67 | |||
| 68 | data &= ~mask; | ||
| 69 | if (pol) | ||
| 70 | data |= mask; | ||
| 71 | |||
| 72 | *ee->cache = data; | ||
| 73 | //printk("update: %08x\n", data); | ||
| 74 | writel(data, ee->addr); | ||
| 75 | spin_unlock_irqrestore(ee->lock, flags); | ||
| 76 | } | ||
| 77 | |||
| 78 | void eeprom_clk_lo(struct eeprom *ee) | ||
| 79 | { | ||
| 80 | int pol = !!(ee->polarity & EEPOL_EECLK); | ||
| 81 | |||
| 82 | eeprom_update(ee, ee->eeclk, pol); | ||
| 83 | udelay(2); | ||
| 84 | } | ||
| 85 | |||
| 86 | void eeprom_clk_hi(struct eeprom *ee) | ||
| 87 | { | ||
| 88 | int pol = !!(ee->polarity & EEPOL_EECLK); | ||
| 89 | |||
| 90 | eeprom_update(ee, ee->eeclk, !pol); | ||
| 91 | udelay(2); | ||
| 92 | } | ||
| 93 | |||
| 94 | void eeprom_send_addr(struct eeprom *ee, unsigned address) | ||
| 95 | { | ||
| 96 | int pol = !!(ee->polarity & EEPOL_EEDI); | ||
| 97 | unsigned i; | ||
| 98 | address |= 6 << 6; | ||
| 99 | |||
| 100 | /* Shift the read command bits out. */ | ||
| 101 | for (i=0; i<11; i++) { | ||
| 102 | eeprom_update(ee, ee->eedi, ((address >> 10) & 1) ^ pol); | ||
| 103 | address <<= 1; | ||
| 104 | eeprom_clk_hi(ee); | ||
| 105 | eeprom_clk_lo(ee); | ||
| 106 | } | ||
| 107 | eeprom_update(ee, ee->eedi, pol); | ||
| 108 | } | ||
| 109 | |||
| 110 | u16 eeprom_readw(struct eeprom *ee, unsigned address) | ||
| 111 | { | ||
| 112 | unsigned i; | ||
| 113 | u16 res = 0; | ||
| 114 | |||
| 115 | eeprom_clk_lo(ee); | ||
| 116 | eeprom_update(ee, ee->eesel, 1 ^ !!(ee->polarity & EEPOL_EESEL)); | ||
| 117 | eeprom_send_addr(ee, address); | ||
| 118 | |||
| 119 | for (i=0; i<16; i++) { | ||
| 120 | u32 data; | ||
| 121 | eeprom_clk_hi(ee); | ||
| 122 | res <<= 1; | ||
| 123 | data = readl(ee->addr); | ||
| 124 | //printk("eeprom_readw: %08x\n", data); | ||
| 125 | res |= !!(data & ee->eedo) ^ !!(ee->polarity & EEPOL_EEDO); | ||
| 126 | eeprom_clk_lo(ee); | ||
| 127 | } | ||
| 128 | eeprom_update(ee, ee->eesel, 0 ^ !!(ee->polarity & EEPOL_EESEL)); | ||
| 129 | |||
| 130 | return res; | ||
| 131 | } | ||
| 132 | |||
| 133 | |||
| 134 | void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data) | ||
| 135 | { | ||
| 136 | } | ||
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index d2c390eff1b2..93535f093216 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -453,10 +453,11 @@ struct ethtool_ops { | |||
| 453 | * it was foced up into this mode or autonegotiated. | 453 | * it was foced up into this mode or autonegotiated. |
| 454 | */ | 454 | */ |
| 455 | 455 | ||
| 456 | /* The forced speed, 10Mb, 100Mb, gigabit, 10GbE. */ | 456 | /* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */ |
| 457 | #define SPEED_10 10 | 457 | #define SPEED_10 10 |
| 458 | #define SPEED_100 100 | 458 | #define SPEED_100 100 |
| 459 | #define SPEED_1000 1000 | 459 | #define SPEED_1000 1000 |
| 460 | #define SPEED_2500 2500 | ||
| 460 | #define SPEED_10000 10000 | 461 | #define SPEED_10000 10000 |
| 461 | 462 | ||
| 462 | /* Duplex, half or full. */ | 463 | /* Duplex, half or full. */ |
diff --git a/include/linux/fb.h b/include/linux/fb.h index c698055266d0..04a58f33ec53 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -201,6 +201,14 @@ struct fb_bitfield { | |||
| 201 | #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ | 201 | #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ |
| 202 | #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ | 202 | #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ |
| 203 | 203 | ||
| 204 | /* | ||
| 205 | * Display rotation support | ||
| 206 | */ | ||
| 207 | #define FB_ROTATE_UR 0 | ||
| 208 | #define FB_ROTATE_CW 1 | ||
| 209 | #define FB_ROTATE_UD 2 | ||
| 210 | #define FB_ROTATE_CCW 3 | ||
| 211 | |||
| 204 | #define PICOS2KHZ(a) (1000000000UL/(a)) | 212 | #define PICOS2KHZ(a) (1000000000UL/(a)) |
| 205 | #define KHZ2PICOS(a) (1000000000UL/(a)) | 213 | #define KHZ2PICOS(a) (1000000000UL/(a)) |
| 206 | 214 | ||
| @@ -489,9 +497,9 @@ struct fb_cursor_user { | |||
| 489 | #define FB_EVENT_MODE_DELETE 0x04 | 497 | #define FB_EVENT_MODE_DELETE 0x04 |
| 490 | /* A driver registered itself */ | 498 | /* A driver registered itself */ |
| 491 | #define FB_EVENT_FB_REGISTERED 0x05 | 499 | #define FB_EVENT_FB_REGISTERED 0x05 |
| 492 | /* get console to framebuffer mapping */ | 500 | /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ |
| 493 | #define FB_EVENT_GET_CONSOLE_MAP 0x06 | 501 | #define FB_EVENT_GET_CONSOLE_MAP 0x06 |
| 494 | /* set console to framebuffer mapping */ | 502 | /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ |
| 495 | #define FB_EVENT_SET_CONSOLE_MAP 0x07 | 503 | #define FB_EVENT_SET_CONSOLE_MAP 0x07 |
| 496 | /* A display blank is requested */ | 504 | /* A display blank is requested */ |
| 497 | #define FB_EVENT_BLANK 0x08 | 505 | #define FB_EVENT_BLANK 0x08 |
| @@ -500,6 +508,12 @@ struct fb_cursor_user { | |||
| 500 | /* The resolution of the passed in fb_info about to change and | 508 | /* The resolution of the passed in fb_info about to change and |
| 501 | all vc's should be changed */ | 509 | all vc's should be changed */ |
| 502 | #define FB_EVENT_MODE_CHANGE_ALL 0x0A | 510 | #define FB_EVENT_MODE_CHANGE_ALL 0x0A |
| 511 | /* CONSOLE-SPECIFIC: set console rotation */ | ||
| 512 | #define FB_EVENT_SET_CON_ROTATE 0x0B | ||
| 513 | /* CONSOLE-SPECIFIC: get console rotation */ | ||
| 514 | #define FB_EVENT_GET_CON_ROTATE 0x0C | ||
| 515 | /* CONSOLE-SPECIFIC: rotate all consoles */ | ||
| 516 | #define FB_EVENT_SET_CON_ROTATE_ALL 0x0D | ||
| 503 | 517 | ||
| 504 | struct fb_event { | 518 | struct fb_event { |
| 505 | struct fb_info *info; | 519 | struct fb_info *info; |
| @@ -810,7 +824,6 @@ struct fb_info { | |||
| 810 | extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); | 824 | extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); |
| 811 | extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); | 825 | extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); |
| 812 | extern int fb_blank(struct fb_info *info, int blank); | 826 | extern int fb_blank(struct fb_info *info, int blank); |
| 813 | extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); | ||
| 814 | extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); | 827 | extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); |
| 815 | extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); | 828 | extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); |
| 816 | extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); | 829 | extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); |
| @@ -818,8 +831,8 @@ extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); | |||
| 818 | /* drivers/video/fbmem.c */ | 831 | /* drivers/video/fbmem.c */ |
| 819 | extern int register_framebuffer(struct fb_info *fb_info); | 832 | extern int register_framebuffer(struct fb_info *fb_info); |
| 820 | extern int unregister_framebuffer(struct fb_info *fb_info); | 833 | extern int unregister_framebuffer(struct fb_info *fb_info); |
| 821 | extern int fb_prepare_logo(struct fb_info *fb_info); | 834 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
| 822 | extern int fb_show_logo(struct fb_info *fb_info); | 835 | extern int fb_show_logo(struct fb_info *fb_info, int rotate); |
| 823 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); | 836 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); |
| 824 | extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, | 837 | extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, |
| 825 | u32 height, u32 shift_high, u32 shift_low, u32 mod); | 838 | u32 height, u32 shift_high, u32 shift_low, u32 mod); |
| @@ -829,6 +842,7 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var, | |||
| 829 | struct fb_fix_screeninfo *fix); | 842 | struct fb_fix_screeninfo *fix); |
| 830 | extern int fb_get_options(char *name, char **option); | 843 | extern int fb_get_options(char *name, char **option); |
| 831 | extern int fb_new_modelist(struct fb_info *info); | 844 | extern int fb_new_modelist(struct fb_info *info); |
| 845 | extern int fb_con_duit(struct fb_info *info, int event, void *data); | ||
| 832 | 846 | ||
| 833 | extern struct fb_info *registered_fb[FB_MAX]; | 847 | extern struct fb_info *registered_fb[FB_MAX]; |
| 834 | extern int num_registered_fb; | 848 | extern int num_registered_fb; |
| @@ -898,11 +912,13 @@ extern struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var, | |||
| 898 | struct list_head *head); | 912 | struct list_head *head); |
| 899 | extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var, | 913 | extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var, |
| 900 | struct list_head *head); | 914 | struct list_head *head); |
| 901 | extern struct fb_videomode *fb_find_nearest_mode(struct fb_var_screeninfo *var, | 915 | extern struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode, |
| 902 | struct list_head *head); | 916 | struct list_head *head); |
| 903 | extern void fb_destroy_modelist(struct list_head *head); | 917 | extern void fb_destroy_modelist(struct list_head *head); |
| 904 | extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num, | 918 | extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num, |
| 905 | struct list_head *head); | 919 | struct list_head *head); |
| 920 | extern struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs, | ||
| 921 | struct list_head *head); | ||
| 906 | 922 | ||
| 907 | /* drivers/video/fbcmap.c */ | 923 | /* drivers/video/fbcmap.c */ |
| 908 | extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); | 924 | extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); |
diff --git a/include/linux/file.h b/include/linux/file.h index f5bbd4c508b3..d3b1a15d5f21 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -59,9 +59,9 @@ extern void FASTCALL(set_close_on_exec(unsigned int fd, int flag)); | |||
| 59 | extern void put_filp(struct file *); | 59 | extern void put_filp(struct file *); |
| 60 | extern int get_unused_fd(void); | 60 | extern int get_unused_fd(void); |
| 61 | extern void FASTCALL(put_unused_fd(unsigned int fd)); | 61 | extern void FASTCALL(put_unused_fd(unsigned int fd)); |
| 62 | struct kmem_cache_s; | 62 | struct kmem_cache; |
| 63 | extern void filp_ctor(void * objp, struct kmem_cache_s *cachep, unsigned long cflags); | 63 | extern void filp_ctor(void * objp, struct kmem_cache *cachep, unsigned long cflags); |
| 64 | extern void filp_dtor(void * objp, struct kmem_cache_s *cachep, unsigned long dflags); | 64 | extern void filp_dtor(void * objp, struct kmem_cache *cachep, unsigned long dflags); |
| 65 | 65 | ||
| 66 | extern struct file ** alloc_fd_array(int); | 66 | extern struct file ** alloc_fd_array(int); |
| 67 | extern void free_fd_array(struct file **, int); | 67 | extern void free_fd_array(struct file **, int); |
diff --git a/include/linux/font.h b/include/linux/font.h index 53b129f07f6f..8aac48c37f3d 100644 --- a/include/linux/font.h +++ b/include/linux/font.h | |||
| @@ -31,6 +31,7 @@ struct font_desc { | |||
| 31 | #define SUN12x22_IDX 7 | 31 | #define SUN12x22_IDX 7 |
| 32 | #define ACORN8x8_IDX 8 | 32 | #define ACORN8x8_IDX 8 |
| 33 | #define MINI4x6_IDX 9 | 33 | #define MINI4x6_IDX 9 |
| 34 | #define RL_IDX 10 | ||
| 34 | 35 | ||
| 35 | extern const struct font_desc font_vga_8x8, | 36 | extern const struct font_desc font_vga_8x8, |
| 36 | font_vga_8x16, | 37 | font_vga_8x16, |
| @@ -41,6 +42,7 @@ extern const struct font_desc font_vga_8x8, | |||
| 41 | font_sun_8x16, | 42 | font_sun_8x16, |
| 42 | font_sun_12x22, | 43 | font_sun_12x22, |
| 43 | font_acorn_8x8, | 44 | font_acorn_8x8, |
| 45 | font_rl, | ||
| 44 | font_mini_4x6; | 46 | font_mini_4x6; |
| 45 | 47 | ||
| 46 | /* Find a font with a specific name */ | 48 | /* Find a font with a specific name */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6d6226732c93..cc35b6ac778d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -104,6 +104,10 @@ extern int dir_notify_enable; | |||
| 104 | #define MS_MOVE 8192 | 104 | #define MS_MOVE 8192 |
| 105 | #define MS_REC 16384 | 105 | #define MS_REC 16384 |
| 106 | #define MS_VERBOSE 32768 | 106 | #define MS_VERBOSE 32768 |
| 107 | #define MS_UNBINDABLE (1<<17) /* change to unbindable */ | ||
| 108 | #define MS_PRIVATE (1<<18) /* change to private */ | ||
| 109 | #define MS_SLAVE (1<<19) /* change to slave */ | ||
| 110 | #define MS_SHARED (1<<20) /* change to shared */ | ||
| 107 | #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ | 111 | #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ |
| 108 | #define MS_ACTIVE (1<<30) | 112 | #define MS_ACTIVE (1<<30) |
| 109 | #define MS_NOUSER (1<<31) | 113 | #define MS_NOUSER (1<<31) |
| @@ -264,6 +268,7 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | |||
| 264 | #define ATTR_ATTR_FLAG 1024 | 268 | #define ATTR_ATTR_FLAG 1024 |
| 265 | #define ATTR_KILL_SUID 2048 | 269 | #define ATTR_KILL_SUID 2048 |
| 266 | #define ATTR_KILL_SGID 4096 | 270 | #define ATTR_KILL_SGID 4096 |
| 271 | #define ATTR_FILE 8192 | ||
| 267 | 272 | ||
| 268 | /* | 273 | /* |
| 269 | * This is the Inode Attributes structure, used for notify_change(). It | 274 | * This is the Inode Attributes structure, used for notify_change(). It |
| @@ -283,6 +288,13 @@ struct iattr { | |||
| 283 | struct timespec ia_atime; | 288 | struct timespec ia_atime; |
| 284 | struct timespec ia_mtime; | 289 | struct timespec ia_mtime; |
| 285 | struct timespec ia_ctime; | 290 | struct timespec ia_ctime; |
| 291 | |||
| 292 | /* | ||
| 293 | * Not an attribute, but an auxilary info for filesystems wanting to | ||
| 294 | * implement an ftruncate() like method. NOTE: filesystem should | ||
| 295 | * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL). | ||
| 296 | */ | ||
| 297 | struct file *ia_file; | ||
| 286 | }; | 298 | }; |
| 287 | 299 | ||
| 288 | /* | 300 | /* |
| @@ -862,6 +874,7 @@ static inline void unlock_super(struct super_block * sb) | |||
| 862 | /* | 874 | /* |
| 863 | * VFS helper functions.. | 875 | * VFS helper functions.. |
| 864 | */ | 876 | */ |
| 877 | extern int vfs_permission(struct nameidata *, int); | ||
| 865 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); | 878 | extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); |
| 866 | extern int vfs_mkdir(struct inode *, struct dentry *, int); | 879 | extern int vfs_mkdir(struct inode *, struct dentry *, int); |
| 867 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); | 880 | extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); |
| @@ -877,6 +890,11 @@ extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct de | |||
| 877 | extern void dentry_unhash(struct dentry *dentry); | 890 | extern void dentry_unhash(struct dentry *dentry); |
| 878 | 891 | ||
| 879 | /* | 892 | /* |
| 893 | * VFS file helper functions. | ||
| 894 | */ | ||
| 895 | extern int file_permission(struct file *, int); | ||
| 896 | |||
| 897 | /* | ||
| 880 | * File types | 898 | * File types |
| 881 | * | 899 | * |
| 882 | * NOTE! These match bits 12..15 of stat.st_mode | 900 | * NOTE! These match bits 12..15 of stat.st_mode |
| @@ -1088,6 +1106,8 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc); | |||
| 1088 | * @get_name: find the name for a given inode in a given directory | 1106 | * @get_name: find the name for a given inode in a given directory |
| 1089 | * @get_parent: find the parent of a given directory | 1107 | * @get_parent: find the parent of a given directory |
| 1090 | * @get_dentry: find a dentry for the inode given a file handle sub-fragment | 1108 | * @get_dentry: find a dentry for the inode given a file handle sub-fragment |
| 1109 | * @find_exported_dentry: | ||
| 1110 | * set by the exporting module to a standard helper function. | ||
| 1091 | * | 1111 | * |
| 1092 | * Description: | 1112 | * Description: |
| 1093 | * The export_operations structure provides a means for nfsd to communicate | 1113 | * The export_operations structure provides a means for nfsd to communicate |
| @@ -1239,7 +1259,12 @@ extern int unregister_filesystem(struct file_system_type *); | |||
| 1239 | extern struct vfsmount *kern_mount(struct file_system_type *); | 1259 | extern struct vfsmount *kern_mount(struct file_system_type *); |
| 1240 | extern int may_umount_tree(struct vfsmount *); | 1260 | extern int may_umount_tree(struct vfsmount *); |
| 1241 | extern int may_umount(struct vfsmount *); | 1261 | extern int may_umount(struct vfsmount *); |
| 1262 | extern void umount_tree(struct vfsmount *, int, struct list_head *); | ||
| 1263 | extern void release_mounts(struct list_head *); | ||
| 1242 | extern long do_mount(char *, char *, char *, unsigned long, void *); | 1264 | extern long do_mount(char *, char *, char *, unsigned long, void *); |
| 1265 | extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int); | ||
| 1266 | extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, | ||
| 1267 | struct vfsmount *); | ||
| 1243 | 1268 | ||
| 1244 | extern int vfs_statfs(struct super_block *, struct kstatfs *); | 1269 | extern int vfs_statfs(struct super_block *, struct kstatfs *); |
| 1245 | 1270 | ||
| @@ -1288,7 +1313,7 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
| 1288 | 1313 | ||
| 1289 | /* fs/open.c */ | 1314 | /* fs/open.c */ |
| 1290 | 1315 | ||
| 1291 | extern int do_truncate(struct dentry *, loff_t start); | 1316 | extern int do_truncate(struct dentry *, loff_t start, struct file *filp); |
| 1292 | extern long do_sys_open(const char __user *filename, int flags, int mode); | 1317 | extern long do_sys_open(const char __user *filename, int flags, int mode); |
| 1293 | extern struct file *filp_open(const char *, int, int); | 1318 | extern struct file *filp_open(const char *, int, int); |
| 1294 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); | 1319 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); |
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index bef23bbf8690..783c476b8674 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #ifndef FS_ENET_PD_H | 16 | #ifndef FS_ENET_PD_H |
| 17 | #define FS_ENET_PD_H | 17 | #define FS_ENET_PD_H |
| 18 | 18 | ||
| 19 | #include <linux/version.h> | ||
| 20 | #include <asm/types.h> | 19 | #include <asm/types.h> |
| 21 | 20 | ||
| 22 | #define FS_ENET_NAME "fs_enet" | 21 | #define FS_ENET_NAME "fs_enet" |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index f98854c2abd7..b76b558b03d4 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #define FUSE_KERNEL_VERSION 7 | 14 | #define FUSE_KERNEL_VERSION 7 |
| 15 | 15 | ||
| 16 | /** Minor version number of this interface */ | 16 | /** Minor version number of this interface */ |
| 17 | #define FUSE_KERNEL_MINOR_VERSION 2 | 17 | #define FUSE_KERNEL_MINOR_VERSION 3 |
| 18 | 18 | ||
| 19 | /** The node ID of the root inode */ | 19 | /** The node ID of the root inode */ |
| 20 | #define FUSE_ROOT_ID 1 | 20 | #define FUSE_ROOT_ID 1 |
| @@ -61,6 +61,7 @@ struct fuse_kstatfs { | |||
| 61 | #define FATTR_SIZE (1 << 3) | 61 | #define FATTR_SIZE (1 << 3) |
| 62 | #define FATTR_ATIME (1 << 4) | 62 | #define FATTR_ATIME (1 << 4) |
| 63 | #define FATTR_MTIME (1 << 5) | 63 | #define FATTR_MTIME (1 << 5) |
| 64 | #define FATTR_FH (1 << 6) | ||
| 64 | 65 | ||
| 65 | /** | 66 | /** |
| 66 | * Flags returned by the OPEN request | 67 | * Flags returned by the OPEN request |
| @@ -99,7 +100,9 @@ enum fuse_opcode { | |||
| 99 | FUSE_OPENDIR = 27, | 100 | FUSE_OPENDIR = 27, |
| 100 | FUSE_READDIR = 28, | 101 | FUSE_READDIR = 28, |
| 101 | FUSE_RELEASEDIR = 29, | 102 | FUSE_RELEASEDIR = 29, |
| 102 | FUSE_FSYNCDIR = 30 | 103 | FUSE_FSYNCDIR = 30, |
| 104 | FUSE_ACCESS = 34, | ||
| 105 | FUSE_CREATE = 35 | ||
| 103 | }; | 106 | }; |
| 104 | 107 | ||
| 105 | /* Conservative buffer size for the client */ | 108 | /* Conservative buffer size for the client */ |
| @@ -152,12 +155,25 @@ struct fuse_link_in { | |||
| 152 | struct fuse_setattr_in { | 155 | struct fuse_setattr_in { |
| 153 | __u32 valid; | 156 | __u32 valid; |
| 154 | __u32 padding; | 157 | __u32 padding; |
| 155 | struct fuse_attr attr; | 158 | __u64 fh; |
| 159 | __u64 size; | ||
| 160 | __u64 unused1; | ||
| 161 | __u64 atime; | ||
| 162 | __u64 mtime; | ||
| 163 | __u64 unused2; | ||
| 164 | __u32 atimensec; | ||
| 165 | __u32 mtimensec; | ||
| 166 | __u32 unused3; | ||
| 167 | __u32 mode; | ||
| 168 | __u32 unused4; | ||
| 169 | __u32 uid; | ||
| 170 | __u32 gid; | ||
| 171 | __u32 unused5; | ||
| 156 | }; | 172 | }; |
| 157 | 173 | ||
| 158 | struct fuse_open_in { | 174 | struct fuse_open_in { |
| 159 | __u32 flags; | 175 | __u32 flags; |
| 160 | __u32 padding; | 176 | __u32 mode; |
| 161 | }; | 177 | }; |
| 162 | 178 | ||
| 163 | struct fuse_open_out { | 179 | struct fuse_open_out { |
| @@ -222,6 +238,11 @@ struct fuse_getxattr_out { | |||
| 222 | __u32 padding; | 238 | __u32 padding; |
| 223 | }; | 239 | }; |
| 224 | 240 | ||
| 241 | struct fuse_access_in { | ||
| 242 | __u32 mask; | ||
| 243 | __u32 padding; | ||
| 244 | }; | ||
| 245 | |||
| 225 | struct fuse_init_in_out { | 246 | struct fuse_init_in_out { |
| 226 | __u32 major; | 247 | __u32 major; |
| 227 | __u32 minor; | 248 | __u32 minor; |
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/i2c-id.h b/include/linux/i2c-id.h index 1ce4b54caa21..74abaecdb572 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
| @@ -27,10 +27,10 @@ | |||
| 27 | * ---- Driver types ----------------------------------------------------- | 27 | * ---- Driver types ----------------------------------------------------- |
| 28 | * device id name + number function description, i2c address(es) | 28 | * device id name + number function description, i2c address(es) |
| 29 | * | 29 | * |
| 30 | * Range 1000-1999 range is defined in sensors/sensors.h | 30 | * Range 1000-1999 range is defined in sensors/sensors.h |
| 31 | * Range 0x100 - 0x1ff is for V4L2 Common Components | 31 | * Range 0x100 - 0x1ff is for V4L2 Common Components |
| 32 | * Range 0xf000 - 0xffff is reserved for local experimentation, and should | 32 | * Range 0xf000 - 0xffff is reserved for local experimentation, and should |
| 33 | * never be used in official drivers | 33 | * never be used in official drivers |
| 34 | */ | 34 | */ |
| 35 | 35 | ||
| 36 | #define I2C_DRIVERID_MSP3400 1 | 36 | #define I2C_DRIVERID_MSP3400 1 |
| @@ -99,7 +99,14 @@ | |||
| 99 | #define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ | 99 | #define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ |
| 100 | #define I2C_DRIVERID_SAA7114H 64 /* video decoder */ | 100 | #define I2C_DRIVERID_SAA7114H 64 /* video decoder */ |
| 101 | #define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */ | 101 | #define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */ |
| 102 | 102 | #define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */ | |
| 103 | #define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ | ||
| 104 | #define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ | ||
| 105 | #define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ | ||
| 106 | #define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */ | ||
| 107 | #define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */ | ||
| 108 | #define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */ | ||
| 109 | #define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ | ||
| 103 | 110 | ||
| 104 | #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ | 111 | #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ |
| 105 | #define I2C_DRIVERID_EXP1 0xF1 | 112 | #define I2C_DRIVERID_EXP1 0xF1 |
| @@ -111,7 +118,7 @@ | |||
| 111 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ | 118 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ |
| 112 | #define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ | 119 | #define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ |
| 113 | 120 | ||
| 114 | /* IDs -- Use DRIVERIDs 1000-1999 for sensors. | 121 | /* IDs -- Use DRIVERIDs 1000-1999 for sensors. |
| 115 | These were originally in sensors.h in the lm_sensors package */ | 122 | These were originally in sensors.h in the lm_sensors package */ |
| 116 | #define I2C_DRIVERID_LM78 1002 | 123 | #define I2C_DRIVERID_LM78 1002 |
| 117 | #define I2C_DRIVERID_LM75 1003 | 124 | #define I2C_DRIVERID_LM75 1003 |
| @@ -190,6 +197,7 @@ | |||
| 190 | #define I2C_HW_B_NVIDIA 0x01001c /* nvidia framebuffer driver */ | 197 | #define I2C_HW_B_NVIDIA 0x01001c /* nvidia framebuffer driver */ |
| 191 | #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ | 198 | #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ |
| 192 | #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ | 199 | #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ |
| 200 | #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ | ||
| 193 | 201 | ||
| 194 | /* --- PCF 8584 based algorithms */ | 202 | /* --- PCF 8584 based algorithms */ |
| 195 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ | 203 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ |
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_ppp.h b/include/linux/if_ppp.h index 572aff7daa21..768372f07caa 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | /* | 23 | /* |
| 24 | * ==FILEVERSION 20000724== | 24 | * ==FILEVERSION 20050812== |
| 25 | * | 25 | * |
| 26 | * NOTE TO MAINTAINERS: | 26 | * NOTE TO MAINTAINERS: |
| 27 | * If you modify this file at all, please set the above date. | 27 | * If you modify this file at all, please set the above date. |
| @@ -35,6 +35,8 @@ | |||
| 35 | #ifndef _IF_PPP_H_ | 35 | #ifndef _IF_PPP_H_ |
| 36 | #define _IF_PPP_H_ | 36 | #define _IF_PPP_H_ |
| 37 | 37 | ||
| 38 | #include <linux/compiler.h> | ||
| 39 | |||
| 38 | /* | 40 | /* |
| 39 | * Packet sizes | 41 | * Packet sizes |
| 40 | */ | 42 | */ |
| @@ -70,7 +72,8 @@ | |||
| 70 | #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ | 72 | #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ |
| 71 | #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ | 73 | #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ |
| 72 | #define SC_SYNC 0x00200000 /* synchronous serial mode */ | 74 | #define SC_SYNC 0x00200000 /* synchronous serial mode */ |
| 73 | #define SC_MASK 0x0f200fff /* bits that user can change */ | 75 | #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ |
| 76 | #define SC_MASK 0x0f600fff /* bits that user can change */ | ||
| 74 | 77 | ||
| 75 | /* state bits */ | 78 | /* state bits */ |
| 76 | #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ | 79 | #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ |
diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h index f25fec8ee2ca..6e5461d69fdd 100644 --- a/include/linux/if_wanpipe_common.h +++ b/include/linux/if_wanpipe_common.h | |||
| @@ -17,8 +17,6 @@ | |||
| 17 | #ifndef _WANPIPE_SOCK_DRIVER_COMMON_H | 17 | #ifndef _WANPIPE_SOCK_DRIVER_COMMON_H |
| 18 | #define _WANPIPE_SOCK_DRIVER_COMMON_H | 18 | #define _WANPIPE_SOCK_DRIVER_COMMON_H |
| 19 | 19 | ||
| 20 | #include <linux/version.h> | ||
| 21 | |||
| 22 | typedef struct { | 20 | typedef struct { |
| 23 | struct net_device *slave; | 21 | struct net_device *slave; |
| 24 | atomic_t packet_sent; | 22 | atomic_t packet_sent; |
diff --git a/include/linux/input.h b/include/linux/input.h index f623c745c21c..3c5823368ddb 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -1007,7 +1007,7 @@ static inline void input_put_device(struct input_dev *dev) | |||
| 1007 | class_device_put(&dev->cdev); | 1007 | class_device_put(&dev->cdev); |
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
| 1010 | void input_register_device(struct input_dev *); | 1010 | int input_register_device(struct input_dev *); |
| 1011 | void input_unregister_device(struct input_dev *); | 1011 | void input_unregister_device(struct input_dev *); |
| 1012 | 1012 | ||
| 1013 | void input_register_handler(struct input_handler *); | 1013 | void input_register_handler(struct input_handler *); |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 18d010bee635..cd6bd001ba4e 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
| @@ -94,7 +94,7 @@ extern struct resource iomem_resource; | |||
| 94 | extern int request_resource(struct resource *root, struct resource *new); | 94 | extern int request_resource(struct resource *root, struct resource *new); |
| 95 | extern struct resource * ____request_resource(struct resource *root, struct resource *new); | 95 | extern struct resource * ____request_resource(struct resource *root, struct resource *new); |
| 96 | extern int release_resource(struct resource *new); | 96 | extern int release_resource(struct resource *new); |
| 97 | extern int insert_resource(struct resource *parent, struct resource *new); | 97 | extern __deprecated_for_modules int insert_resource(struct resource *parent, struct resource *new); |
| 98 | extern int allocate_resource(struct resource *root, struct resource *new, | 98 | extern int allocate_resource(struct resource *root, struct resource *new, |
| 99 | unsigned long size, | 99 | unsigned long size, |
| 100 | unsigned long min, unsigned long max, | 100 | unsigned long min, unsigned long max, |
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 938d55b813a5..d6276e60b3bf 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
| @@ -256,10 +256,7 @@ struct ipmi_recv_msg | |||
| 256 | }; | 256 | }; |
| 257 | 257 | ||
| 258 | /* Allocate and free the receive message. */ | 258 | /* Allocate and free the receive message. */ |
| 259 | static inline void ipmi_free_recv_msg(struct ipmi_recv_msg *msg) | 259 | void ipmi_free_recv_msg(struct ipmi_recv_msg *msg); |
| 260 | { | ||
| 261 | msg->done(msg); | ||
| 262 | } | ||
| 263 | 260 | ||
| 264 | struct ipmi_user_hndl | 261 | struct ipmi_user_hndl |
| 265 | { | 262 | { |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 69681c3b1f05..c516382fbec2 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
| 13 | #include <asm/smp.h> /* cpu_online_map */ | ||
| 13 | 14 | ||
| 14 | #if !defined(CONFIG_ARCH_S390) | 15 | #if !defined(CONFIG_ARCH_S390) |
| 15 | 16 | ||
diff --git a/include/linux/istallion.h b/include/linux/istallion.h index 5f4ee646c119..1f996621bc9c 100644 --- a/include/linux/istallion.h +++ b/include/linux/istallion.h | |||
| @@ -21,8 +21,6 @@ | |||
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include <linux/version.h> | ||
| 25 | |||
| 26 | /*****************************************************************************/ | 24 | /*****************************************************************************/ |
| 27 | #ifndef _ISTALLION_H | 25 | #ifndef _ISTALLION_H |
| 28 | #define _ISTALLION_H | 26 | #define _ISTALLION_H |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index be197eb90077..aa56172c6fed 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
| @@ -611,6 +611,9 @@ struct transaction_s | |||
| 611 | * @j_revoke: The revoke table - maintains the list of revoked blocks in the | 611 | * @j_revoke: The revoke table - maintains the list of revoked blocks in the |
| 612 | * current transaction. | 612 | * current transaction. |
| 613 | * @j_revoke_table: alternate revoke tables for j_revoke | 613 | * @j_revoke_table: alternate revoke tables for j_revoke |
| 614 | * @j_wbuf: array of buffer_heads for journal_commit_transaction | ||
| 615 | * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the | ||
| 616 | * number that will fit in j_blocksize | ||
| 614 | * @j_private: An opaque pointer to fs-private information. | 617 | * @j_private: An opaque pointer to fs-private information. |
| 615 | */ | 618 | */ |
| 616 | 619 | ||
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h index 419fc953ac16..cf792bb3c726 100644 --- a/include/linux/jffs2.h +++ b/include/linux/jffs2.h | |||
| @@ -5,10 +5,10 @@ | |||
| 5 | * | 5 | * |
| 6 | * Created by David Woodhouse <dwmw2@infradead.org> | 6 | * Created by David Woodhouse <dwmw2@infradead.org> |
| 7 | * | 7 | * |
| 8 | * For licensing information, see the file 'LICENCE' in the | 8 | * For licensing information, see the file 'LICENCE' in the |
| 9 | * jffs2 directory. | 9 | * jffs2 directory. |
| 10 | * | 10 | * |
| 11 | * $Id: jffs2.h,v 1.34 2004/11/16 20:36:14 dwmw2 Exp $ | 11 | * $Id: jffs2.h,v 1.38 2005/09/26 11:37:23 havasi Exp $ |
| 12 | * | 12 | * |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| @@ -28,6 +28,9 @@ | |||
| 28 | #define JFFS2_EMPTY_BITMASK 0xffff | 28 | #define JFFS2_EMPTY_BITMASK 0xffff |
| 29 | #define JFFS2_DIRTY_BITMASK 0x0000 | 29 | #define JFFS2_DIRTY_BITMASK 0x0000 |
| 30 | 30 | ||
| 31 | /* Summary node MAGIC marker */ | ||
| 32 | #define JFFS2_SUM_MAGIC 0x02851885 | ||
| 33 | |||
| 31 | /* We only allow a single char for length, and 0xFF is empty flash so | 34 | /* We only allow a single char for length, and 0xFF is empty flash so |
| 32 | we don't want it confused with a real length. Hence max 254. | 35 | we don't want it confused with a real length. Hence max 254. |
| 33 | */ | 36 | */ |
| @@ -43,8 +46,6 @@ | |||
| 43 | #define JFFS2_COMPR_COPY 0x04 | 46 | #define JFFS2_COMPR_COPY 0x04 |
| 44 | #define JFFS2_COMPR_DYNRUBIN 0x05 | 47 | #define JFFS2_COMPR_DYNRUBIN 0x05 |
| 45 | #define JFFS2_COMPR_ZLIB 0x06 | 48 | #define JFFS2_COMPR_ZLIB 0x06 |
| 46 | #define JFFS2_COMPR_LZO 0x07 | ||
| 47 | #define JFFS2_COMPR_LZARI 0x08 | ||
| 48 | /* Compatibility flags. */ | 49 | /* Compatibility flags. */ |
| 49 | #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ | 50 | #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ |
| 50 | #define JFFS2_NODE_ACCURATE 0x2000 | 51 | #define JFFS2_NODE_ACCURATE 0x2000 |
| @@ -62,15 +63,17 @@ | |||
| 62 | #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) | 63 | #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) |
| 63 | #define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) | 64 | #define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) |
| 64 | 65 | ||
| 66 | #define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6) | ||
| 67 | |||
| 65 | // Maybe later... | 68 | // Maybe later... |
| 66 | //#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) | 69 | //#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) |
| 67 | //#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) | 70 | //#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) |
| 68 | 71 | ||
| 69 | 72 | ||
| 70 | #define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at | 73 | #define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at |
| 71 | mount time, don't wait for it to | 74 | mount time, don't wait for it to |
| 72 | happen later */ | 75 | happen later */ |
| 73 | #define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific | 76 | #define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific |
| 74 | compression type */ | 77 | compression type */ |
| 75 | 78 | ||
| 76 | 79 | ||
| @@ -101,7 +104,7 @@ struct jffs2_unknown_node | |||
| 101 | struct jffs2_raw_dirent | 104 | struct jffs2_raw_dirent |
| 102 | { | 105 | { |
| 103 | jint16_t magic; | 106 | jint16_t magic; |
| 104 | jint16_t nodetype; /* == JFFS_NODETYPE_DIRENT */ | 107 | jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ |
| 105 | jint32_t totlen; | 108 | jint32_t totlen; |
| 106 | jint32_t hdr_crc; | 109 | jint32_t hdr_crc; |
| 107 | jint32_t pino; | 110 | jint32_t pino; |
| @@ -117,7 +120,7 @@ struct jffs2_raw_dirent | |||
| 117 | } __attribute__((packed)); | 120 | } __attribute__((packed)); |
| 118 | 121 | ||
| 119 | /* The JFFS2 raw inode structure: Used for storage on physical media. */ | 122 | /* The JFFS2 raw inode structure: Used for storage on physical media. */ |
| 120 | /* The uid, gid, atime, mtime and ctime members could be longer, but | 123 | /* The uid, gid, atime, mtime and ctime members could be longer, but |
| 121 | are left like this for space efficiency. If and when people decide | 124 | are left like this for space efficiency. If and when people decide |
| 122 | they really need them extended, it's simple enough to add support for | 125 | they really need them extended, it's simple enough to add support for |
| 123 | a new type of raw node. | 126 | a new type of raw node. |
| @@ -125,7 +128,7 @@ struct jffs2_raw_dirent | |||
| 125 | struct jffs2_raw_inode | 128 | struct jffs2_raw_inode |
| 126 | { | 129 | { |
| 127 | jint16_t magic; /* A constant magic number. */ | 130 | jint16_t magic; /* A constant magic number. */ |
| 128 | jint16_t nodetype; /* == JFFS_NODETYPE_INODE */ | 131 | jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ |
| 129 | jint32_t totlen; /* Total length of this node (inc data, etc.) */ | 132 | jint32_t totlen; /* Total length of this node (inc data, etc.) */ |
| 130 | jint32_t hdr_crc; | 133 | jint32_t hdr_crc; |
| 131 | jint32_t ino; /* Inode number. */ | 134 | jint32_t ino; /* Inode number. */ |
| @@ -148,9 +151,25 @@ struct jffs2_raw_inode | |||
| 148 | uint8_t data[0]; | 151 | uint8_t data[0]; |
| 149 | } __attribute__((packed)); | 152 | } __attribute__((packed)); |
| 150 | 153 | ||
| 151 | union jffs2_node_union { | 154 | struct jffs2_raw_summary |
| 155 | { | ||
| 156 | jint16_t magic; | ||
| 157 | jint16_t nodetype; /* = JFFS2_NODETYPE_SUMMARY */ | ||
| 158 | jint32_t totlen; | ||
| 159 | jint32_t hdr_crc; | ||
| 160 | jint32_t sum_num; /* number of sum entries*/ | ||
| 161 | jint32_t cln_mkr; /* clean marker size, 0 = no cleanmarker */ | ||
| 162 | jint32_t padded; /* sum of the size of padding nodes */ | ||
| 163 | jint32_t sum_crc; /* summary information crc */ | ||
| 164 | jint32_t node_crc; /* node crc */ | ||
| 165 | jint32_t sum[0]; /* inode summary info */ | ||
| 166 | } __attribute__((packed)); | ||
| 167 | |||
| 168 | union jffs2_node_union | ||
| 169 | { | ||
| 152 | struct jffs2_raw_inode i; | 170 | struct jffs2_raw_inode i; |
| 153 | struct jffs2_raw_dirent d; | 171 | struct jffs2_raw_dirent d; |
| 172 | struct jffs2_raw_summary s; | ||
| 154 | struct jffs2_unknown_node u; | 173 | struct jffs2_unknown_node u; |
| 155 | }; | 174 | }; |
| 156 | 175 | ||
diff --git a/include/linux/jffs2_fs_i.h b/include/linux/jffs2_fs_i.h index 6dbb1cce6646..ef85ab56302b 100644 --- a/include/linux/jffs2_fs_i.h +++ b/include/linux/jffs2_fs_i.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $Id: jffs2_fs_i.h,v 1.17 2004/11/11 23:51:27 dwmw2 Exp $ */ | 1 | /* $Id: jffs2_fs_i.h,v 1.19 2005/11/07 11:14:52 gleixner Exp $ */ |
| 2 | 2 | ||
| 3 | #ifndef _JFFS2_FS_I | 3 | #ifndef _JFFS2_FS_I |
| 4 | #define _JFFS2_FS_I | 4 | #define _JFFS2_FS_I |
| @@ -25,13 +25,16 @@ struct jffs2_inode_info { | |||
| 25 | /* There may be one datanode which isn't referenced by any of the | 25 | /* There may be one datanode which isn't referenced by any of the |
| 26 | above fragments, if it contains a metadata update but no actual | 26 | above fragments, if it contains a metadata update but no actual |
| 27 | data - or if this is a directory inode */ | 27 | data - or if this is a directory inode */ |
| 28 | /* This also holds the _only_ dnode for symlinks/device nodes, | 28 | /* This also holds the _only_ dnode for symlinks/device nodes, |
| 29 | etc. */ | 29 | etc. */ |
| 30 | struct jffs2_full_dnode *metadata; | 30 | struct jffs2_full_dnode *metadata; |
| 31 | 31 | ||
| 32 | /* Directory entries */ | 32 | /* Directory entries */ |
| 33 | struct jffs2_full_dirent *dents; | 33 | struct jffs2_full_dirent *dents; |
| 34 | 34 | ||
| 35 | /* The target path if this is the inode of a symlink */ | ||
| 36 | unsigned char *target; | ||
| 37 | |||
| 35 | /* Some stuff we just have to keep in-core at all times, for each inode. */ | 38 | /* Some stuff we just have to keep in-core at all times, for each inode. */ |
| 36 | struct jffs2_inode_cache *inocache; | 39 | struct jffs2_inode_cache *inocache; |
| 37 | 40 | ||
diff --git a/include/linux/jffs2_fs_sb.h b/include/linux/jffs2_fs_sb.h index 1e21546622de..4bcfb5570221 100644 --- a/include/linux/jffs2_fs_sb.h +++ b/include/linux/jffs2_fs_sb.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $Id: jffs2_fs_sb.h,v 1.52 2005/05/19 16:12:17 gleixner Exp $ */ | 1 | /* $Id: jffs2_fs_sb.h,v 1.54 2005/09/21 13:37:34 dedekind Exp $ */ |
| 2 | 2 | ||
| 3 | #ifndef _JFFS2_FS_SB | 3 | #ifndef _JFFS2_FS_SB |
| 4 | #define _JFFS2_FS_SB | 4 | #define _JFFS2_FS_SB |
| @@ -20,7 +20,7 @@ | |||
| 20 | struct jffs2_inodirty; | 20 | struct jffs2_inodirty; |
| 21 | 21 | ||
| 22 | /* A struct for the overall file system control. Pointers to | 22 | /* A struct for the overall file system control. Pointers to |
| 23 | jffs2_sb_info structs are named `c' in the source code. | 23 | jffs2_sb_info structs are named `c' in the source code. |
| 24 | Nee jffs_control | 24 | Nee jffs_control |
| 25 | */ | 25 | */ |
| 26 | struct jffs2_sb_info { | 26 | struct jffs2_sb_info { |
| @@ -35,7 +35,7 @@ struct jffs2_sb_info { | |||
| 35 | struct completion gc_thread_start; /* GC thread start completion */ | 35 | struct completion gc_thread_start; /* GC thread start completion */ |
| 36 | struct completion gc_thread_exit; /* GC thread exit completion port */ | 36 | struct completion gc_thread_exit; /* GC thread exit completion port */ |
| 37 | 37 | ||
| 38 | struct semaphore alloc_sem; /* Used to protect all the following | 38 | struct semaphore alloc_sem; /* Used to protect all the following |
| 39 | fields, and also to protect against | 39 | fields, and also to protect against |
| 40 | out-of-order writing of nodes. And GC. */ | 40 | out-of-order writing of nodes. And GC. */ |
| 41 | uint32_t cleanmarker_size; /* Size of an _inline_ CLEANMARKER | 41 | uint32_t cleanmarker_size; /* Size of an _inline_ CLEANMARKER |
| @@ -64,7 +64,7 @@ struct jffs2_sb_info { | |||
| 64 | uint32_t nospc_dirty_size; | 64 | uint32_t nospc_dirty_size; |
| 65 | 65 | ||
| 66 | uint32_t nr_blocks; | 66 | uint32_t nr_blocks; |
| 67 | struct jffs2_eraseblock *blocks; /* The whole array of blocks. Used for getting blocks | 67 | struct jffs2_eraseblock *blocks; /* The whole array of blocks. Used for getting blocks |
| 68 | * from the offset (blocks[ofs / sector_size]) */ | 68 | * from the offset (blocks[ofs / sector_size]) */ |
| 69 | struct jffs2_eraseblock *nextblock; /* The block we're currently filling */ | 69 | struct jffs2_eraseblock *nextblock; /* The block we're currently filling */ |
| 70 | 70 | ||
| @@ -82,25 +82,26 @@ struct jffs2_sb_info { | |||
| 82 | struct list_head bad_list; /* Bad blocks. */ | 82 | struct list_head bad_list; /* Bad blocks. */ |
| 83 | struct list_head bad_used_list; /* Bad blocks with valid data in. */ | 83 | struct list_head bad_used_list; /* Bad blocks with valid data in. */ |
| 84 | 84 | ||
| 85 | spinlock_t erase_completion_lock; /* Protect free_list and erasing_list | 85 | spinlock_t erase_completion_lock; /* Protect free_list and erasing_list |
| 86 | against erase completion handler */ | 86 | against erase completion handler */ |
| 87 | wait_queue_head_t erase_wait; /* For waiting for erases to complete */ | 87 | wait_queue_head_t erase_wait; /* For waiting for erases to complete */ |
| 88 | 88 | ||
| 89 | wait_queue_head_t inocache_wq; | 89 | wait_queue_head_t inocache_wq; |
| 90 | struct jffs2_inode_cache **inocache_list; | 90 | struct jffs2_inode_cache **inocache_list; |
| 91 | spinlock_t inocache_lock; | 91 | spinlock_t inocache_lock; |
| 92 | 92 | ||
| 93 | /* Sem to allow jffs2_garbage_collect_deletion_dirent to | 93 | /* Sem to allow jffs2_garbage_collect_deletion_dirent to |
| 94 | drop the erase_completion_lock while it's holding a pointer | 94 | drop the erase_completion_lock while it's holding a pointer |
| 95 | to an obsoleted node. I don't like this. Alternatives welcomed. */ | 95 | to an obsoleted node. I don't like this. Alternatives welcomed. */ |
| 96 | struct semaphore erase_free_sem; | 96 | struct semaphore erase_free_sem; |
| 97 | 97 | ||
| 98 | uint32_t wbuf_pagesize; /* 0 for NOR and other flashes with no wbuf */ | ||
| 99 | |||
| 98 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER | 100 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |
| 99 | /* Write-behind buffer for NAND flash */ | 101 | /* Write-behind buffer for NAND flash */ |
| 100 | unsigned char *wbuf; | 102 | unsigned char *wbuf; |
| 101 | uint32_t wbuf_ofs; | 103 | uint32_t wbuf_ofs; |
| 102 | uint32_t wbuf_len; | 104 | uint32_t wbuf_len; |
| 103 | uint32_t wbuf_pagesize; | ||
| 104 | struct jffs2_inodirty *wbuf_inodes; | 105 | struct jffs2_inodirty *wbuf_inodes; |
| 105 | 106 | ||
| 106 | struct rw_semaphore wbuf_sem; /* Protects the write buffer */ | 107 | struct rw_semaphore wbuf_sem; /* Protects the write buffer */ |
| @@ -112,6 +113,8 @@ struct jffs2_sb_info { | |||
| 112 | uint32_t fsdata_len; | 113 | uint32_t fsdata_len; |
| 113 | #endif | 114 | #endif |
| 114 | 115 | ||
| 116 | struct jffs2_summary *summary; /* Summary information */ | ||
| 117 | |||
| 115 | /* OS-private pointer for getting back to master superblock info */ | 118 | /* OS-private pointer for getting back to master superblock info */ |
| 116 | void *os_priv; | 119 | void *os_priv; |
| 117 | }; | 120 | }; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index f1925ccc9fe1..b1e407a4fbda 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -168,7 +168,7 @@ static inline void console_verbose(void) | |||
| 168 | 168 | ||
| 169 | extern void bust_spinlocks(int yes); | 169 | extern void bust_spinlocks(int yes); |
| 170 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ | 170 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ |
| 171 | extern int panic_timeout; | 171 | extern __deprecated_for_modules int panic_timeout; |
| 172 | extern int panic_on_oops; | 172 | extern int panic_on_oops; |
| 173 | extern int tainted; | 173 | extern int tainted; |
| 174 | extern const char *print_tainted(void); | 174 | extern const char *print_tainted(void); |
| @@ -266,7 +266,6 @@ extern void dump_stack(void); | |||
| 266 | 266 | ||
| 267 | /** | 267 | /** |
| 268 | * container_of - cast a member of a structure out to the containing structure | 268 | * container_of - cast a member of a structure out to the containing structure |
| 269 | * | ||
| 270 | * @ptr: the pointer to the member. | 269 | * @ptr: the pointer to the member. |
| 271 | * @type: the type of the container struct this is embedded in. | 270 | * @type: the type of the container struct this is embedded in. |
| 272 | * @member: the name of the member within the struct. | 271 | * @member: the name of the member within the struct. |
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index dba27749b428..a484572c302e 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
| 7 | #include <linux/threads.h> | 7 | #include <linux/threads.h> |
| 8 | #include <linux/percpu.h> | 8 | #include <linux/percpu.h> |
| 9 | #include <linux/cpumask.h> | ||
| 9 | #include <asm/cputime.h> | 10 | #include <asm/cputime.h> |
| 10 | 11 | ||
| 11 | /* | 12 | /* |
| @@ -43,11 +44,10 @@ extern unsigned long long nr_context_switches(void); | |||
| 43 | */ | 44 | */ |
| 44 | static inline int kstat_irqs(int irq) | 45 | static inline int kstat_irqs(int irq) |
| 45 | { | 46 | { |
| 46 | int i, sum=0; | 47 | int cpu, sum = 0; |
| 47 | 48 | ||
| 48 | for (i = 0; i < NR_CPUS; i++) | 49 | for_each_cpu(cpu) |
| 49 | if (cpu_possible(i)) | 50 | sum += kstat_cpu(cpu).irqs[irq]; |
| 50 | sum += kstat_cpu(i).irqs[irq]; | ||
| 51 | 51 | ||
| 52 | return sum; | 52 | return sum; |
| 53 | } | 53 | } |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index e30afdca7917..e373c4a9de53 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
| @@ -33,6 +33,9 @@ | |||
| 33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
| 34 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
| 35 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
| 36 | #include <linux/percpu.h> | ||
| 37 | #include <linux/spinlock.h> | ||
| 38 | #include <linux/rcupdate.h> | ||
| 36 | 39 | ||
| 37 | #include <asm/kprobes.h> | 40 | #include <asm/kprobes.h> |
| 38 | 41 | ||
| @@ -106,6 +109,9 @@ struct jprobe { | |||
| 106 | kprobe_opcode_t *entry; /* probe handling code to jump to */ | 109 | kprobe_opcode_t *entry; /* probe handling code to jump to */ |
| 107 | }; | 110 | }; |
| 108 | 111 | ||
| 112 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); | ||
| 113 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | ||
| 114 | |||
| 109 | #ifdef ARCH_SUPPORTS_KRETPROBES | 115 | #ifdef ARCH_SUPPORTS_KRETPROBES |
| 110 | extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); | 116 | extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); |
| 111 | #else /* ARCH_SUPPORTS_KRETPROBES */ | 117 | #else /* ARCH_SUPPORTS_KRETPROBES */ |
| @@ -142,17 +148,7 @@ struct kretprobe_instance { | |||
| 142 | }; | 148 | }; |
| 143 | 149 | ||
| 144 | #ifdef CONFIG_KPROBES | 150 | #ifdef CONFIG_KPROBES |
| 145 | /* Locks kprobe: irq must be disabled */ | 151 | extern spinlock_t kretprobe_lock; |
| 146 | void lock_kprobes(void); | ||
| 147 | void unlock_kprobes(void); | ||
| 148 | |||
| 149 | /* kprobe running now on this CPU? */ | ||
| 150 | static inline int kprobe_running(void) | ||
| 151 | { | ||
| 152 | extern unsigned int kprobe_cpu; | ||
| 153 | return kprobe_cpu == smp_processor_id(); | ||
| 154 | } | ||
| 155 | |||
| 156 | extern int arch_prepare_kprobe(struct kprobe *p); | 152 | extern int arch_prepare_kprobe(struct kprobe *p); |
| 157 | extern void arch_copy_kprobe(struct kprobe *p); | 153 | extern void arch_copy_kprobe(struct kprobe *p); |
| 158 | extern void arch_arm_kprobe(struct kprobe *p); | 154 | extern void arch_arm_kprobe(struct kprobe *p); |
| @@ -163,10 +159,26 @@ extern void show_registers(struct pt_regs *regs); | |||
| 163 | extern kprobe_opcode_t *get_insn_slot(void); | 159 | extern kprobe_opcode_t *get_insn_slot(void); |
| 164 | extern void free_insn_slot(kprobe_opcode_t *slot); | 160 | extern void free_insn_slot(kprobe_opcode_t *slot); |
| 165 | 161 | ||
| 166 | /* Get the kprobe at this addr (if any). Must have called lock_kprobes */ | 162 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ |
| 167 | struct kprobe *get_kprobe(void *addr); | 163 | struct kprobe *get_kprobe(void *addr); |
| 168 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); | 164 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); |
| 169 | 165 | ||
| 166 | /* kprobe_running() will just return the current_kprobe on this CPU */ | ||
| 167 | static inline struct kprobe *kprobe_running(void) | ||
| 168 | { | ||
| 169 | return (__get_cpu_var(current_kprobe)); | ||
| 170 | } | ||
| 171 | |||
| 172 | static inline void reset_current_kprobe(void) | ||
| 173 | { | ||
| 174 | __get_cpu_var(current_kprobe) = NULL; | ||
| 175 | } | ||
| 176 | |||
| 177 | static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) | ||
| 178 | { | ||
| 179 | return (&__get_cpu_var(kprobe_ctlblk)); | ||
| 180 | } | ||
| 181 | |||
| 170 | int register_kprobe(struct kprobe *p); | 182 | int register_kprobe(struct kprobe *p); |
| 171 | void unregister_kprobe(struct kprobe *p); | 183 | void unregister_kprobe(struct kprobe *p); |
| 172 | int setjmp_pre_handler(struct kprobe *, struct pt_regs *); | 184 | int setjmp_pre_handler(struct kprobe *, struct pt_regs *); |
| @@ -183,9 +195,9 @@ void add_rp_inst(struct kretprobe_instance *ri); | |||
| 183 | void kprobe_flush_task(struct task_struct *tk); | 195 | void kprobe_flush_task(struct task_struct *tk); |
| 184 | void recycle_rp_inst(struct kretprobe_instance *ri); | 196 | void recycle_rp_inst(struct kretprobe_instance *ri); |
| 185 | #else /* CONFIG_KPROBES */ | 197 | #else /* CONFIG_KPROBES */ |
| 186 | static inline int kprobe_running(void) | 198 | static inline struct kprobe *kprobe_running(void) |
| 187 | { | 199 | { |
| 188 | return 0; | 200 | return NULL; |
| 189 | } | 201 | } |
| 190 | static inline int register_kprobe(struct kprobe *p) | 202 | static inline int register_kprobe(struct kprobe *p) |
| 191 | { | 203 | { |
diff --git a/include/linux/libata.h b/include/linux/libata.h index dcd17e7458ab..6f0752219f64 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -214,7 +214,7 @@ struct ata_probe_ent { | |||
| 214 | struct list_head node; | 214 | struct list_head node; |
| 215 | struct device *dev; | 215 | struct device *dev; |
| 216 | const struct ata_port_operations *port_ops; | 216 | const struct ata_port_operations *port_ops; |
| 217 | Scsi_Host_Template *sht; | 217 | struct scsi_host_template *sht; |
| 218 | struct ata_ioports port[ATA_MAX_PORTS]; | 218 | struct ata_ioports port[ATA_MAX_PORTS]; |
| 219 | unsigned int n_ports; | 219 | unsigned int n_ports; |
| 220 | unsigned int hard_port_no; | 220 | unsigned int hard_port_no; |
| @@ -398,7 +398,7 @@ struct ata_port_operations { | |||
| 398 | }; | 398 | }; |
| 399 | 399 | ||
| 400 | struct ata_port_info { | 400 | struct ata_port_info { |
| 401 | Scsi_Host_Template *sht; | 401 | struct scsi_host_template *sht; |
| 402 | unsigned long host_flags; | 402 | unsigned long host_flags; |
| 403 | unsigned long pio_mask; | 403 | unsigned long pio_mask; |
| 404 | unsigned long mwdma_mask; | 404 | unsigned long mwdma_mask; |
| @@ -433,7 +433,7 @@ extern void ata_pci_remove_one (struct pci_dev *pdev); | |||
| 433 | #endif /* CONFIG_PCI */ | 433 | #endif /* CONFIG_PCI */ |
| 434 | extern int ata_device_add(const struct ata_probe_ent *ent); | 434 | extern int ata_device_add(const struct ata_probe_ent *ent); |
| 435 | extern void ata_host_set_remove(struct ata_host_set *host_set); | 435 | extern void ata_host_set_remove(struct ata_host_set *host_set); |
| 436 | extern int ata_scsi_detect(Scsi_Host_Template *sht); | 436 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
| 437 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 437 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
| 438 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 438 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
| 439 | extern int ata_scsi_error(struct Scsi_Host *host); | 439 | extern int ata_scsi_error(struct Scsi_Host *host); |
diff --git a/include/linux/list.h b/include/linux/list.h index 084971f333fe..fbfca73355a3 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -601,7 +601,7 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | |||
| 601 | * or hlist_del_rcu(), running on this same list. | 601 | * or hlist_del_rcu(), running on this same list. |
| 602 | * However, it is perfectly legal to run concurrently with | 602 | * However, it is perfectly legal to run concurrently with |
| 603 | * the _rcu list-traversal primitives, such as | 603 | * the _rcu list-traversal primitives, such as |
| 604 | * hlist_for_each_rcu(), used to prevent memory-consistency | 604 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency |
| 605 | * problems on Alpha CPUs. Regardless of the type of CPU, the | 605 | * problems on Alpha CPUs. Regardless of the type of CPU, the |
| 606 | * list-traversal primitive must be guarded by rcu_read_lock(). | 606 | * list-traversal primitive must be guarded by rcu_read_lock(). |
| 607 | */ | 607 | */ |
| @@ -650,7 +650,7 @@ static inline void hlist_add_after(struct hlist_node *n, | |||
| 650 | * or hlist_del_rcu(), running on this same list. | 650 | * or hlist_del_rcu(), running on this same list. |
| 651 | * However, it is perfectly legal to run concurrently with | 651 | * However, it is perfectly legal to run concurrently with |
| 652 | * the _rcu list-traversal primitives, such as | 652 | * the _rcu list-traversal primitives, such as |
| 653 | * hlist_for_each_rcu(), used to prevent memory-consistency | 653 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency |
| 654 | * problems on Alpha CPUs. | 654 | * problems on Alpha CPUs. |
| 655 | */ | 655 | */ |
| 656 | static inline void hlist_add_before_rcu(struct hlist_node *n, | 656 | static inline void hlist_add_before_rcu(struct hlist_node *n, |
| @@ -675,7 +675,7 @@ static inline void hlist_add_before_rcu(struct hlist_node *n, | |||
| 675 | * or hlist_del_rcu(), running on this same list. | 675 | * or hlist_del_rcu(), running on this same list. |
| 676 | * However, it is perfectly legal to run concurrently with | 676 | * However, it is perfectly legal to run concurrently with |
| 677 | * the _rcu list-traversal primitives, such as | 677 | * the _rcu list-traversal primitives, such as |
| 678 | * hlist_for_each_rcu(), used to prevent memory-consistency | 678 | * hlist_for_each_entry_rcu(), used to prevent memory-consistency |
| 679 | * problems on Alpha CPUs. | 679 | * problems on Alpha CPUs. |
| 680 | */ | 680 | */ |
| 681 | static inline void hlist_add_after_rcu(struct hlist_node *prev, | 681 | static inline void hlist_add_after_rcu(struct hlist_node *prev, |
| @@ -699,11 +699,6 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 699 | for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ | 699 | for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ |
| 700 | pos = n) | 700 | pos = n) |
| 701 | 701 | ||
| 702 | #define hlist_for_each_rcu(pos, head) \ | ||
| 703 | for ((pos) = (head)->first; \ | ||
| 704 | rcu_dereference((pos)) && ({ prefetch((pos)->next); 1; }); \ | ||
| 705 | (pos) = (pos)->next) | ||
| 706 | |||
| 707 | /** | 702 | /** |
| 708 | * hlist_for_each_entry - iterate over list of given type | 703 | * hlist_for_each_entry - iterate over list of given type |
| 709 | * @tpos: the type * to use as a loop counter. | 704 | * @tpos: the type * to use as a loop counter. |
| @@ -756,7 +751,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 756 | 751 | ||
| 757 | /** | 752 | /** |
| 758 | * hlist_for_each_entry_rcu - iterate over rcu list of given type | 753 | * hlist_for_each_entry_rcu - iterate over rcu list of given type |
| 759 | * @pos: the type * to use as a loop counter. | 754 | * @tpos: the type * to use as a loop counter. |
| 760 | * @pos: the &struct hlist_node to use as a loop counter. | 755 | * @pos: the &struct hlist_node to use as a loop counter. |
| 761 | * @head: the head for your list. | 756 | * @head: the head for your list. |
| 762 | * @member: the name of the hlist_node within the struct. | 757 | * @member: the name of the hlist_node within the struct. |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 0def328ab5cf..9a424383e6c6 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
| @@ -54,6 +54,9 @@ struct memory_block { | |||
| 54 | */ | 54 | */ |
| 55 | #define MEM_MAPPING_INVALID (1<<3) | 55 | #define MEM_MAPPING_INVALID (1<<3) |
| 56 | 56 | ||
| 57 | struct notifier_block; | ||
| 58 | struct mem_section; | ||
| 59 | |||
| 57 | #ifndef CONFIG_MEMORY_HOTPLUG | 60 | #ifndef CONFIG_MEMORY_HOTPLUG |
| 58 | static inline int memory_dev_init(void) | 61 | static inline int memory_dev_init(void) |
| 59 | { | 62 | { |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 5c1fb0a2e806..7b115feca4df 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -932,13 +932,13 @@ int write_one_page(struct page *page, int wait); | |||
| 932 | * turning readahead off */ | 932 | * turning readahead off */ |
| 933 | 933 | ||
| 934 | int do_page_cache_readahead(struct address_space *mapping, struct file *filp, | 934 | int do_page_cache_readahead(struct address_space *mapping, struct file *filp, |
| 935 | unsigned long offset, unsigned long nr_to_read); | 935 | pgoff_t offset, unsigned long nr_to_read); |
| 936 | int force_page_cache_readahead(struct address_space *mapping, struct file *filp, | 936 | int force_page_cache_readahead(struct address_space *mapping, struct file *filp, |
| 937 | unsigned long offset, unsigned long nr_to_read); | 937 | pgoff_t offset, unsigned long nr_to_read); |
| 938 | unsigned long page_cache_readahead(struct address_space *mapping, | 938 | unsigned long page_cache_readahead(struct address_space *mapping, |
| 939 | struct file_ra_state *ra, | 939 | struct file_ra_state *ra, |
| 940 | struct file *filp, | 940 | struct file *filp, |
| 941 | unsigned long offset, | 941 | pgoff_t offset, |
| 942 | unsigned long size); | 942 | unsigned long size); |
| 943 | void handle_ra_miss(struct address_space *mapping, | 943 | void handle_ra_miss(struct address_space *mapping, |
| 944 | struct file_ra_state *ra, pgoff_t offset); | 944 | struct file_ra_state *ra, pgoff_t offset); |
diff --git a/include/linux/mount.h b/include/linux/mount.h index f8f39937e301..dd4e83eba933 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
| @@ -17,12 +17,14 @@ | |||
| 17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
| 18 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
| 19 | 19 | ||
| 20 | #define MNT_NOSUID 1 | 20 | #define MNT_NOSUID 0x01 |
| 21 | #define MNT_NODEV 2 | 21 | #define MNT_NODEV 0x02 |
| 22 | #define MNT_NOEXEC 4 | 22 | #define MNT_NOEXEC 0x04 |
| 23 | #define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */ | ||
| 24 | #define MNT_UNBINDABLE 0x20 /* if the vfsmount is a unbindable mount */ | ||
| 25 | #define MNT_PNODE_MASK 0x30 /* propogation flag mask */ | ||
| 23 | 26 | ||
| 24 | struct vfsmount | 27 | struct vfsmount { |
| 25 | { | ||
| 26 | struct list_head mnt_hash; | 28 | struct list_head mnt_hash; |
| 27 | struct vfsmount *mnt_parent; /* fs we are mounted on */ | 29 | struct vfsmount *mnt_parent; /* fs we are mounted on */ |
| 28 | struct dentry *mnt_mountpoint; /* dentry of mountpoint */ | 30 | struct dentry *mnt_mountpoint; /* dentry of mountpoint */ |
| @@ -36,7 +38,12 @@ struct vfsmount | |||
| 36 | char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ | 38 | char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ |
| 37 | struct list_head mnt_list; | 39 | struct list_head mnt_list; |
| 38 | struct list_head mnt_expire; /* link in fs-specific expiry list */ | 40 | struct list_head mnt_expire; /* link in fs-specific expiry list */ |
| 41 | struct list_head mnt_share; /* circular list of shared mounts */ | ||
| 42 | struct list_head mnt_slave_list;/* list of slave mounts */ | ||
| 43 | struct list_head mnt_slave; /* slave list entry */ | ||
| 44 | struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */ | ||
| 39 | struct namespace *mnt_namespace; /* containing namespace */ | 45 | struct namespace *mnt_namespace; /* containing namespace */ |
| 46 | int mnt_pinned; | ||
| 40 | }; | 47 | }; |
| 41 | 48 | ||
| 42 | static inline struct vfsmount *mntget(struct vfsmount *mnt) | 49 | static inline struct vfsmount *mntget(struct vfsmount *mnt) |
| @@ -46,15 +53,9 @@ static inline struct vfsmount *mntget(struct vfsmount *mnt) | |||
| 46 | return mnt; | 53 | return mnt; |
| 47 | } | 54 | } |
| 48 | 55 | ||
| 49 | extern void __mntput(struct vfsmount *mnt); | 56 | extern void mntput_no_expire(struct vfsmount *mnt); |
| 50 | 57 | extern void mnt_pin(struct vfsmount *mnt); | |
| 51 | static inline void mntput_no_expire(struct vfsmount *mnt) | 58 | extern void mnt_unpin(struct vfsmount *mnt); |
| 52 | { | ||
| 53 | if (mnt) { | ||
| 54 | if (atomic_dec_and_test(&mnt->mnt_count)) | ||
| 55 | __mntput(mnt); | ||
| 56 | } | ||
| 57 | } | ||
| 58 | 59 | ||
| 59 | static inline void mntput(struct vfsmount *mnt) | 60 | static inline void mntput(struct vfsmount *mnt) |
| 60 | { | 61 | { |
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h new file mode 100644 index 000000000000..7a7fbe87fef0 --- /dev/null +++ b/include/linux/mtd/bbm.h | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/mtd/bbm.h | ||
| 3 | * | ||
| 4 | * NAND family Bad Block Management (BBM) header file | ||
| 5 | * - Bad Block Table (BBT) implementation | ||
| 6 | * | ||
| 7 | * Copyright (c) 2005 Samsung Electronics | ||
| 8 | * Kyungmin Park <kyungmin.park@samsung.com> | ||
| 9 | * | ||
| 10 | * Copyright (c) 2000-2005 | ||
| 11 | * Thomas Gleixner <tglx@linuxtronix.de> | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | #ifndef __LINUX_MTD_BBM_H | ||
| 15 | #define __LINUX_MTD_BBM_H | ||
| 16 | |||
| 17 | /* The maximum number of NAND chips in an array */ | ||
| 18 | #define NAND_MAX_CHIPS 8 | ||
| 19 | |||
| 20 | /** | ||
| 21 | * struct nand_bbt_descr - bad block table descriptor | ||
| 22 | * @param options options for this descriptor | ||
| 23 | * @param pages the page(s) where we find the bbt, used with | ||
| 24 | * option BBT_ABSPAGE when bbt is searched, | ||
| 25 | * then we store the found bbts pages here. | ||
| 26 | * Its an array and supports up to 8 chips now | ||
| 27 | * @param offs offset of the pattern in the oob area of the page | ||
| 28 | * @param veroffs offset of the bbt version counter in the oob are of the page | ||
| 29 | * @param version version read from the bbt page during scan | ||
| 30 | * @param len length of the pattern, if 0 no pattern check is performed | ||
| 31 | * @param maxblocks maximum number of blocks to search for a bbt. This number of | ||
| 32 | * blocks is reserved at the end of the device | ||
| 33 | * where the tables are written. | ||
| 34 | * @param reserved_block_code if non-0, this pattern denotes a reserved | ||
| 35 | * (rather than bad) block in the stored bbt | ||
| 36 | * @param pattern pattern to identify bad block table or factory marked | ||
| 37 | * good / bad blocks, can be NULL, if len = 0 | ||
| 38 | * | ||
| 39 | * Descriptor for the bad block table marker and the descriptor for the | ||
| 40 | * pattern which identifies good and bad blocks. The assumption is made | ||
| 41 | * that the pattern and the version count are always located in the oob area | ||
| 42 | * of the first block. | ||
| 43 | */ | ||
| 44 | struct nand_bbt_descr { | ||
| 45 | int options; | ||
| 46 | int pages[NAND_MAX_CHIPS]; | ||
| 47 | int offs; | ||
| 48 | int veroffs; | ||
| 49 | uint8_t version[NAND_MAX_CHIPS]; | ||
| 50 | int len; | ||
| 51 | int maxblocks; | ||
| 52 | int reserved_block_code; | ||
| 53 | uint8_t *pattern; | ||
| 54 | }; | ||
| 55 | |||
| 56 | /* Options for the bad block table descriptors */ | ||
| 57 | |||
| 58 | /* The number of bits used per block in the bbt on the device */ | ||
| 59 | #define NAND_BBT_NRBITS_MSK 0x0000000F | ||
| 60 | #define NAND_BBT_1BIT 0x00000001 | ||
| 61 | #define NAND_BBT_2BIT 0x00000002 | ||
| 62 | #define NAND_BBT_4BIT 0x00000004 | ||
| 63 | #define NAND_BBT_8BIT 0x00000008 | ||
| 64 | /* The bad block table is in the last good block of the device */ | ||
| 65 | #define NAND_BBT_LASTBLOCK 0x00000010 | ||
| 66 | /* The bbt is at the given page, else we must scan for the bbt */ | ||
| 67 | #define NAND_BBT_ABSPAGE 0x00000020 | ||
| 68 | /* The bbt is at the given page, else we must scan for the bbt */ | ||
| 69 | #define NAND_BBT_SEARCH 0x00000040 | ||
| 70 | /* bbt is stored per chip on multichip devices */ | ||
| 71 | #define NAND_BBT_PERCHIP 0x00000080 | ||
| 72 | /* bbt has a version counter at offset veroffs */ | ||
| 73 | #define NAND_BBT_VERSION 0x00000100 | ||
| 74 | /* Create a bbt if none axists */ | ||
| 75 | #define NAND_BBT_CREATE 0x00000200 | ||
| 76 | /* Search good / bad pattern through all pages of a block */ | ||
| 77 | #define NAND_BBT_SCANALLPAGES 0x00000400 | ||
| 78 | /* Scan block empty during good / bad block scan */ | ||
| 79 | #define NAND_BBT_SCANEMPTY 0x00000800 | ||
| 80 | /* Write bbt if neccecary */ | ||
| 81 | #define NAND_BBT_WRITE 0x00001000 | ||
| 82 | /* Read and write back block contents when writing bbt */ | ||
| 83 | #define NAND_BBT_SAVECONTENT 0x00002000 | ||
| 84 | /* Search good / bad pattern on the first and the second page */ | ||
| 85 | #define NAND_BBT_SCAN2NDPAGE 0x00004000 | ||
| 86 | |||
| 87 | /* The maximum number of blocks to scan for a bbt */ | ||
| 88 | #define NAND_BBT_SCAN_MAXBLOCKS 4 | ||
| 89 | |||
| 90 | /* | ||
| 91 | * Constants for oob configuration | ||
| 92 | */ | ||
| 93 | #define ONENAND_BADBLOCK_POS 0 | ||
| 94 | |||
| 95 | /** | ||
| 96 | * struct bbt_info - [GENERIC] Bad Block Table data structure | ||
| 97 | * @param bbt_erase_shift [INTERN] number of address bits in a bbt entry | ||
| 98 | * @param badblockpos [INTERN] position of the bad block marker in the oob area | ||
| 99 | * @param bbt [INTERN] bad block table pointer | ||
| 100 | * @param badblock_pattern [REPLACEABLE] bad block scan pattern used for initial bad block scan | ||
| 101 | * @param priv [OPTIONAL] pointer to private bbm date | ||
| 102 | */ | ||
| 103 | struct bbm_info { | ||
| 104 | int bbt_erase_shift; | ||
| 105 | int badblockpos; | ||
| 106 | int options; | ||
| 107 | |||
| 108 | uint8_t *bbt; | ||
| 109 | |||
| 110 | int (*isbad_bbt)(struct mtd_info *mtd, loff_t ofs, int allowbbt); | ||
| 111 | |||
| 112 | /* TODO Add more NAND specific fileds */ | ||
| 113 | struct nand_bbt_descr *badblock_pattern; | ||
| 114 | |||
| 115 | void *priv; | ||
| 116 | }; | ||
| 117 | |||
| 118 | /* OneNAND BBT interface */ | ||
| 119 | extern int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); | ||
| 120 | extern int onenand_default_bbt(struct mtd_info *mtd); | ||
| 121 | |||
| 122 | #endif /* __LINUX_MTD_BBM_H */ | ||
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 4ebc2e5a16e2..f46afec6fbf8 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: blktrans.h,v 1.5 2003/06/23 12:00:08 dwmw2 Exp $ | 2 | * $Id: blktrans.h,v 1.6 2005/11/07 11:14:54 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * (C) 2003 David Woodhouse <dwmw2@infradead.org> | 4 | * (C) 2003 David Woodhouse <dwmw2@infradead.org> |
| 5 | * | 5 | * |
| @@ -67,6 +67,6 @@ extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr); | |||
| 67 | extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); | 67 | extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); |
| 68 | extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); | 68 | extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); |
| 69 | extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); | 69 | extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | #endif /* __MTD_TRANS_H__ */ | 72 | #endif /* __MTD_TRANS_H__ */ |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index e6b6a1c66bd5..3c9ea4b7adda 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
| @@ -1,14 +1,13 @@ | |||
| 1 | 1 | ||
| 2 | /* Common Flash Interface structures | 2 | /* Common Flash Interface structures |
| 3 | * See http://support.intel.com/design/flash/technote/index.htm | 3 | * See http://support.intel.com/design/flash/technote/index.htm |
| 4 | * $Id: cfi.h,v 1.54 2005/06/06 23:04:36 tpoynor Exp $ | 4 | * $Id: cfi.h,v 1.56 2005/11/07 11:14:54 gleixner Exp $ |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef __MTD_CFI_H__ | 7 | #ifndef __MTD_CFI_H__ |
| 8 | #define __MTD_CFI_H__ | 8 | #define __MTD_CFI_H__ |
| 9 | 9 | ||
| 10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
| 11 | #include <linux/version.h> | ||
| 12 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
| 13 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 14 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
| @@ -82,8 +81,8 @@ static inline int cfi_interleave_supported(int i) | |||
| 82 | } | 81 | } |
| 83 | 82 | ||
| 84 | 83 | ||
| 85 | /* NB: these values must represents the number of bytes needed to meet the | 84 | /* NB: these values must represents the number of bytes needed to meet the |
| 86 | * device type (x8, x16, x32). Eg. a 32 bit device is 4 x 8 bytes. | 85 | * device type (x8, x16, x32). Eg. a 32 bit device is 4 x 8 bytes. |
| 87 | * These numbers are used in calculations. | 86 | * These numbers are used in calculations. |
| 88 | */ | 87 | */ |
| 89 | #define CFI_DEVICETYPE_X8 (8 / 8) | 88 | #define CFI_DEVICETYPE_X8 (8 / 8) |
| @@ -173,6 +172,15 @@ struct cfi_intelext_regioninfo { | |||
| 173 | struct cfi_intelext_blockinfo BlockTypes[1]; | 172 | struct cfi_intelext_blockinfo BlockTypes[1]; |
| 174 | } __attribute__((packed)); | 173 | } __attribute__((packed)); |
| 175 | 174 | ||
| 175 | struct cfi_intelext_programming_regioninfo { | ||
| 176 | uint8_t ProgRegShift; | ||
| 177 | uint8_t Reserved1; | ||
| 178 | uint8_t ControlValid; | ||
| 179 | uint8_t Reserved2; | ||
| 180 | uint8_t ControlInvalid; | ||
| 181 | uint8_t Reserved3; | ||
| 182 | } __attribute__((packed)); | ||
| 183 | |||
| 176 | /* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ | 184 | /* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ |
| 177 | 185 | ||
| 178 | struct cfi_pri_amdstd { | 186 | struct cfi_pri_amdstd { |
| @@ -250,7 +258,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int | |||
| 250 | /* | 258 | /* |
| 251 | * Transforms the CFI command for the given geometry (bus width & interleave). | 259 | * Transforms the CFI command for the given geometry (bus width & interleave). |
| 252 | * It looks too long to be inline, but in the common case it should almost all | 260 | * It looks too long to be inline, but in the common case it should almost all |
| 253 | * get optimised away. | 261 | * get optimised away. |
| 254 | */ | 262 | */ |
| 255 | static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi) | 263 | static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi) |
| 256 | { | 264 | { |
| @@ -259,7 +267,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
| 259 | unsigned long onecmd; | 267 | unsigned long onecmd; |
| 260 | int i; | 268 | int i; |
| 261 | 269 | ||
| 262 | /* We do it this way to give the compiler a fighting chance | 270 | /* We do it this way to give the compiler a fighting chance |
| 263 | of optimising away all the crap for 'bankwidth' larger than | 271 | of optimising away all the crap for 'bankwidth' larger than |
| 264 | an unsigned long, in the common case where that support is | 272 | an unsigned long, in the common case where that support is |
| 265 | disabled */ | 273 | disabled */ |
| @@ -270,7 +278,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
| 270 | wordwidth = map_bankwidth(map); | 278 | wordwidth = map_bankwidth(map); |
| 271 | words_per_bus = 1; | 279 | words_per_bus = 1; |
| 272 | } | 280 | } |
| 273 | 281 | ||
| 274 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); | 282 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); |
| 275 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); | 283 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); |
| 276 | 284 | ||
| @@ -289,7 +297,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
| 289 | break; | 297 | break; |
| 290 | } | 298 | } |
| 291 | 299 | ||
| 292 | /* Now replicate it across the size of an unsigned long, or | 300 | /* Now replicate it across the size of an unsigned long, or |
| 293 | just to the bus width as appropriate */ | 301 | just to the bus width as appropriate */ |
| 294 | switch (chips_per_word) { | 302 | switch (chips_per_word) { |
| 295 | default: BUG(); | 303 | default: BUG(); |
| @@ -305,7 +313,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
| 305 | ; | 313 | ; |
| 306 | } | 314 | } |
| 307 | 315 | ||
| 308 | /* And finally, for the multi-word case, replicate it | 316 | /* And finally, for the multi-word case, replicate it |
| 309 | in all words in the structure */ | 317 | in all words in the structure */ |
| 310 | for (i=0; i < words_per_bus; i++) { | 318 | for (i=0; i < words_per_bus; i++) { |
| 311 | val.x[i] = onecmd; | 319 | val.x[i] = onecmd; |
| @@ -316,14 +324,14 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
| 316 | #define CMD(x) cfi_build_cmd((x), map, cfi) | 324 | #define CMD(x) cfi_build_cmd((x), map, cfi) |
| 317 | 325 | ||
| 318 | 326 | ||
| 319 | static inline unsigned char cfi_merge_status(map_word val, struct map_info *map, | 327 | static inline unsigned long cfi_merge_status(map_word val, struct map_info *map, |
| 320 | struct cfi_private *cfi) | 328 | struct cfi_private *cfi) |
| 321 | { | 329 | { |
| 322 | int wordwidth, words_per_bus, chip_mode, chips_per_word; | 330 | int wordwidth, words_per_bus, chip_mode, chips_per_word; |
| 323 | unsigned long onestat, res = 0; | 331 | unsigned long onestat, res = 0; |
| 324 | int i; | 332 | int i; |
| 325 | 333 | ||
| 326 | /* We do it this way to give the compiler a fighting chance | 334 | /* We do it this way to give the compiler a fighting chance |
| 327 | of optimising away all the crap for 'bankwidth' larger than | 335 | of optimising away all the crap for 'bankwidth' larger than |
| 328 | an unsigned long, in the common case where that support is | 336 | an unsigned long, in the common case where that support is |
| 329 | disabled */ | 337 | disabled */ |
| @@ -334,7 +342,7 @@ static inline unsigned char cfi_merge_status(map_word val, struct map_info *map, | |||
| 334 | wordwidth = map_bankwidth(map); | 342 | wordwidth = map_bankwidth(map); |
| 335 | words_per_bus = 1; | 343 | words_per_bus = 1; |
| 336 | } | 344 | } |
| 337 | 345 | ||
| 338 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); | 346 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); |
| 339 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); | 347 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); |
| 340 | 348 | ||
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h index 953e64fb8ac5..386a52cf8b1b 100644 --- a/include/linux/mtd/doc2000.h +++ b/include/linux/mtd/doc2000.h | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Linux driver for Disk-On-Chip devices | 2 | * Linux driver for Disk-On-Chip devices |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1999 Machine Vision Holdings, Inc. | 4 | * Copyright (C) 1999 Machine Vision Holdings, Inc. |
| 5 | * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> | 5 | * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> |
| 6 | * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> | 6 | * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> |
| 7 | * Copyright (C) 2002-2003 SnapGear Inc | 7 | * Copyright (C) 2002-2003 SnapGear Inc |
| 8 | * | 8 | * |
| 9 | * $Id: doc2000.h,v 1.24 2005/01/05 12:40:38 dwmw2 Exp $ | 9 | * $Id: doc2000.h,v 1.25 2005/11/07 11:14:54 gleixner Exp $ |
| 10 | * | 10 | * |
| 11 | * Released under GPL | 11 | * Released under GPL |
| 12 | */ | 12 | */ |
| @@ -75,10 +75,10 @@ | |||
| 75 | #define DoC_Mplus_CtrlConfirm 0x1076 | 75 | #define DoC_Mplus_CtrlConfirm 0x1076 |
| 76 | #define DoC_Mplus_Power 0x1fff | 76 | #define DoC_Mplus_Power 0x1fff |
| 77 | 77 | ||
| 78 | /* How to access the device? | 78 | /* How to access the device? |
| 79 | * On ARM, it'll be mmap'd directly with 32-bit wide accesses. | 79 | * On ARM, it'll be mmap'd directly with 32-bit wide accesses. |
| 80 | * On PPC, it's mmap'd and 16-bit wide. | 80 | * On PPC, it's mmap'd and 16-bit wide. |
| 81 | * Others use readb/writeb | 81 | * Others use readb/writeb |
| 82 | */ | 82 | */ |
| 83 | #if defined(__arm__) | 83 | #if defined(__arm__) |
| 84 | #define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)))) | 84 | #define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)))) |
| @@ -172,7 +172,7 @@ struct DiskOnChip { | |||
| 172 | unsigned long totlen; | 172 | unsigned long totlen; |
| 173 | unsigned char ChipID; /* Type of DiskOnChip */ | 173 | unsigned char ChipID; /* Type of DiskOnChip */ |
| 174 | int ioreg; | 174 | int ioreg; |
| 175 | 175 | ||
| 176 | unsigned long mfr; /* Flash IDs - only one type of flash per device */ | 176 | unsigned long mfr; /* Flash IDs - only one type of flash per device */ |
| 177 | unsigned long id; | 177 | unsigned long id; |
| 178 | int chipshift; | 178 | int chipshift; |
| @@ -180,10 +180,10 @@ struct DiskOnChip { | |||
| 180 | char pageadrlen; | 180 | char pageadrlen; |
| 181 | char interleave; /* Internal interleaving - Millennium Plus style */ | 181 | char interleave; /* Internal interleaving - Millennium Plus style */ |
| 182 | unsigned long erasesize; | 182 | unsigned long erasesize; |
| 183 | 183 | ||
| 184 | int curfloor; | 184 | int curfloor; |
| 185 | int curchip; | 185 | int curchip; |
| 186 | 186 | ||
| 187 | int numchips; | 187 | int numchips; |
| 188 | struct Nand *chips; | 188 | struct Nand *chips; |
| 189 | struct mtd_info *nextdoc; | 189 | struct mtd_info *nextdoc; |
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index 675776fa3e27..a293a3b78e05 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | 1 | ||
| 2 | /* | 2 | /* |
| 3 | * struct flchip definition | 3 | * struct flchip definition |
| 4 | * | 4 | * |
| 5 | * Contains information about the location and state of a given flash device | 5 | * Contains information about the location and state of a given flash device |
| 6 | * | 6 | * |
| 7 | * (C) 2000 Red Hat. GPLd. | 7 | * (C) 2000 Red Hat. GPLd. |
| 8 | * | 8 | * |
| 9 | * $Id: flashchip.h,v 1.17 2005/03/14 18:27:15 bjd Exp $ | 9 | * $Id: flashchip.h,v 1.18 2005/11/07 11:14:54 gleixner Exp $ |
| 10 | * | 10 | * |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| @@ -15,11 +15,11 @@ | |||
| 15 | 15 | ||
| 16 | /* For spinlocks. sched.h includes spinlock.h from whichever directory it | 16 | /* For spinlocks. sched.h includes spinlock.h from whichever directory it |
| 17 | * happens to be in - so we don't have to care whether we're on 2.2, which | 17 | * happens to be in - so we don't have to care whether we're on 2.2, which |
| 18 | * has asm/spinlock.h, or 2.4, which has linux/spinlock.h | 18 | * has asm/spinlock.h, or 2.4, which has linux/spinlock.h |
| 19 | */ | 19 | */ |
| 20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
| 21 | 21 | ||
| 22 | typedef enum { | 22 | typedef enum { |
| 23 | FL_READY, | 23 | FL_READY, |
| 24 | FL_STATUS, | 24 | FL_STATUS, |
| 25 | FL_CFI_QUERY, | 25 | FL_CFI_QUERY, |
| @@ -45,7 +45,7 @@ typedef enum { | |||
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | /* NOTE: confusingly, this can be used to refer to more than one chip at a time, | 48 | /* NOTE: confusingly, this can be used to refer to more than one chip at a time, |
| 49 | if they're interleaved. This can even refer to individual partitions on | 49 | if they're interleaved. This can even refer to individual partitions on |
| 50 | the same physical chip when present. */ | 50 | the same physical chip when present. */ |
| 51 | 51 | ||
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h index 3678459b4535..d99609113307 100644 --- a/include/linux/mtd/ftl.h +++ b/include/linux/mtd/ftl.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: ftl.h,v 1.6 2003/01/24 13:20:04 dwmw2 Exp $ | 2 | * $Id: ftl.h,v 1.7 2005/11/07 11:14:54 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * Derived from (and probably identical to): | 4 | * Derived from (and probably identical to): |
| 5 | * ftl.h 1.7 1999/10/25 20:23:17 | 5 | * ftl.h 1.7 1999/10/25 20:23:17 |
| 6 | * | 6 | * |
| @@ -12,7 +12,7 @@ | |||
| 12 | * Software distributed under the License is distributed on an "AS IS" | 12 | * Software distributed under the License is distributed on an "AS IS" |
| 13 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See | 13 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See |
| 14 | * the License for the specific language governing rights and | 14 | * the License for the specific language governing rights and |
| 15 | * limitations under the License. | 15 | * limitations under the License. |
| 16 | * | 16 | * |
| 17 | * The initial developer of the original code is David A. Hinds | 17 | * The initial developer of the original code is David A. Hinds |
| 18 | * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds | 18 | * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds |
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h index 3d7bdec14f97..256e7342ed1e 100644 --- a/include/linux/mtd/gen_probe.h +++ b/include/linux/mtd/gen_probe.h | |||
| @@ -1,14 +1,14 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * (C) 2001, 2001 Red Hat, Inc. | 2 | * (C) 2001, 2001 Red Hat, Inc. |
| 3 | * GPL'd | 3 | * GPL'd |
| 4 | * $Id: gen_probe.h,v 1.3 2004/10/20 22:10:33 dwmw2 Exp $ | 4 | * $Id: gen_probe.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef __LINUX_MTD_GEN_PROBE_H__ | 7 | #ifndef __LINUX_MTD_GEN_PROBE_H__ |
| 8 | #define __LINUX_MTD_GEN_PROBE_H__ | 8 | #define __LINUX_MTD_GEN_PROBE_H__ |
| 9 | 9 | ||
| 10 | #include <linux/mtd/flashchip.h> | 10 | #include <linux/mtd/flashchip.h> |
| 11 | #include <linux/mtd/map.h> | 11 | #include <linux/mtd/map.h> |
| 12 | #include <linux/mtd/cfi.h> | 12 | #include <linux/mtd/cfi.h> |
| 13 | #include <linux/bitops.h> | 13 | #include <linux/bitops.h> |
| 14 | 14 | ||
diff --git a/include/linux/mtd/jedec.h b/include/linux/mtd/jedec.h index 2ba0f700ddbc..9006feb218b9 100644 --- a/include/linux/mtd/jedec.h +++ b/include/linux/mtd/jedec.h | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | 1 | ||
| 2 | /* JEDEC Flash Interface. | 2 | /* JEDEC Flash Interface. |
| 3 | * This is an older type of interface for self programming flash. It is | 3 | * This is an older type of interface for self programming flash. It is |
| 4 | * commonly use in older AMD chips and is obsolete compared with CFI. | 4 | * commonly use in older AMD chips and is obsolete compared with CFI. |
| 5 | * It is called JEDEC because the JEDEC association distributes the ID codes | 5 | * It is called JEDEC because the JEDEC association distributes the ID codes |
| 6 | * for the chips. | 6 | * for the chips. |
| 7 | * | 7 | * |
| 8 | * See the AMD flash databook for information on how to operate the interface. | 8 | * See the AMD flash databook for information on how to operate the interface. |
| 9 | * | 9 | * |
| 10 | * $Id: jedec.h,v 1.3 2003/05/21 11:51:01 dwmw2 Exp $ | 10 | * $Id: jedec.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #ifndef __LINUX_MTD_JEDEC_H__ | 13 | #ifndef __LINUX_MTD_JEDEC_H__ |
| @@ -33,16 +33,16 @@ struct jedec_flash_chip | |||
| 33 | __u16 jedec; | 33 | __u16 jedec; |
| 34 | unsigned long size; | 34 | unsigned long size; |
| 35 | unsigned long sectorsize; | 35 | unsigned long sectorsize; |
| 36 | 36 | ||
| 37 | // *(__u8*)(base + (adder << addrshift)) = data << datashift | 37 | // *(__u8*)(base + (adder << addrshift)) = data << datashift |
| 38 | // Address size = size << addrshift | 38 | // Address size = size << addrshift |
| 39 | unsigned long base; // Byte 0 of the flash, will be unaligned | 39 | unsigned long base; // Byte 0 of the flash, will be unaligned |
| 40 | unsigned int datashift; // Useful for 32bit/16bit accesses | 40 | unsigned int datashift; // Useful for 32bit/16bit accesses |
| 41 | unsigned int addrshift; | 41 | unsigned int addrshift; |
| 42 | unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash | 42 | unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash |
| 43 | 43 | ||
| 44 | __u32 capabilities; | 44 | __u32 capabilities; |
| 45 | 45 | ||
| 46 | // These markers are filled in by the flash_chip_scan function | 46 | // These markers are filled in by the flash_chip_scan function |
| 47 | unsigned long start; | 47 | unsigned long start; |
| 48 | unsigned long length; | 48 | unsigned long length; |
| @@ -51,16 +51,16 @@ struct jedec_flash_chip | |||
| 51 | struct jedec_private | 51 | struct jedec_private |
| 52 | { | 52 | { |
| 53 | unsigned long size; // Total size of all the devices | 53 | unsigned long size; // Total size of all the devices |
| 54 | 54 | ||
| 55 | /* Bank handling. If sum(bank_fill) == size then this is linear flash. | 55 | /* Bank handling. If sum(bank_fill) == size then this is linear flash. |
| 56 | Otherwise the mapping has holes in it. bank_fill may be used to | 56 | Otherwise the mapping has holes in it. bank_fill may be used to |
| 57 | find the holes, but in the common symetric case | 57 | find the holes, but in the common symetric case |
| 58 | bank_fill[0] == bank_fill[*], thus addresses may be computed | 58 | bank_fill[0] == bank_fill[*], thus addresses may be computed |
| 59 | mathmatically. bank_fill must be powers of two */ | 59 | mathmatically. bank_fill must be powers of two */ |
| 60 | unsigned is_banked; | 60 | unsigned is_banked; |
| 61 | unsigned long bank_fill[MAX_JEDEC_CHIPS]; | 61 | unsigned long bank_fill[MAX_JEDEC_CHIPS]; |
| 62 | 62 | ||
| 63 | struct jedec_flash_chip chips[MAX_JEDEC_CHIPS]; | 63 | struct jedec_flash_chip chips[MAX_JEDEC_CHIPS]; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | #endif | 66 | #endif |
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index fc28841f3409..fedfbc8a287f 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | /* Overhauled routines for dealing with different mmap regions of flash */ | 2 | /* Overhauled routines for dealing with different mmap regions of flash */ |
| 3 | /* $Id: map.h,v 1.52 2005/05/25 10:29:41 gleixner Exp $ */ | 3 | /* $Id: map.h,v 1.54 2005/11/07 11:14:54 gleixner Exp $ */ |
| 4 | 4 | ||
| 5 | #ifndef __LINUX_MTD_MAP_H__ | 5 | #ifndef __LINUX_MTD_MAP_H__ |
| 6 | #define __LINUX_MTD_MAP_H__ | 6 | #define __LINUX_MTD_MAP_H__ |
| @@ -170,14 +170,14 @@ typedef union { | |||
| 170 | to a chip probe routine -- either JEDEC or CFI probe or both -- via | 170 | to a chip probe routine -- either JEDEC or CFI probe or both -- via |
| 171 | do_map_probe(). If a chip is recognised, the probe code will invoke the | 171 | do_map_probe(). If a chip is recognised, the probe code will invoke the |
| 172 | appropriate chip driver (if present) and return a struct mtd_info. | 172 | appropriate chip driver (if present) and return a struct mtd_info. |
| 173 | At which point, you fill in the mtd->module with your own module | 173 | At which point, you fill in the mtd->module with your own module |
| 174 | address, and register it with the MTD core code. Or you could partition | 174 | address, and register it with the MTD core code. Or you could partition |
| 175 | it and register the partitions instead, or keep it for your own private | 175 | it and register the partitions instead, or keep it for your own private |
| 176 | use; whatever. | 176 | use; whatever. |
| 177 | 177 | ||
| 178 | The mtd->priv field will point to the struct map_info, and any further | 178 | The mtd->priv field will point to the struct map_info, and any further |
| 179 | private data required by the chip driver is linked from the | 179 | private data required by the chip driver is linked from the |
| 180 | mtd->priv->fldrv_priv field. This allows the map driver to get at | 180 | mtd->priv->fldrv_priv field. This allows the map driver to get at |
| 181 | the destructor function map->fldrv_destroy() when it's tired | 181 | the destructor function map->fldrv_destroy() when it's tired |
| 182 | of living. | 182 | of living. |
| 183 | */ | 183 | */ |
| @@ -214,7 +214,7 @@ struct map_info { | |||
| 214 | If there is no cache to care about this can be set to NULL. */ | 214 | If there is no cache to care about this can be set to NULL. */ |
| 215 | void (*inval_cache)(struct map_info *, unsigned long, ssize_t); | 215 | void (*inval_cache)(struct map_info *, unsigned long, ssize_t); |
| 216 | 216 | ||
| 217 | /* set_vpp() must handle being reentered -- enable, enable, disable | 217 | /* set_vpp() must handle being reentered -- enable, enable, disable |
| 218 | must leave it enabled. */ | 218 | must leave it enabled. */ |
| 219 | void (*set_vpp)(struct map_info *, int); | 219 | void (*set_vpp)(struct map_info *, int); |
| 220 | 220 | ||
| @@ -353,7 +353,7 @@ static inline map_word map_word_ff(struct map_info *map) | |||
| 353 | { | 353 | { |
| 354 | map_word r; | 354 | map_word r; |
| 355 | int i; | 355 | int i; |
| 356 | 356 | ||
| 357 | if (map_bankwidth(map) < MAP_FF_LIMIT) { | 357 | if (map_bankwidth(map) < MAP_FF_LIMIT) { |
| 358 | int bw = 8 * map_bankwidth(map); | 358 | int bw = 8 * map_bankwidth(map); |
| 359 | r.x[0] = (1 << bw) - 1; | 359 | r.x[0] = (1 << bw) - 1; |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index c50c3f3927d9..b6f2fdae65c6 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: mtd.h,v 1.59 2005/04/11 10:19:02 gleixner Exp $ | 2 | * $Id: mtd.h,v 1.61 2005/11/07 11:14:54 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. | 4 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. |
| 5 | * | 5 | * |
| @@ -14,7 +14,6 @@ | |||
| 14 | #endif | 14 | #endif |
| 15 | 15 | ||
| 16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
| 17 | #include <linux/version.h> | ||
| 18 | #include <linux/types.h> | 17 | #include <linux/types.h> |
| 19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 20 | #include <linux/uio.h> | 19 | #include <linux/uio.h> |
| @@ -72,7 +71,17 @@ struct mtd_info { | |||
| 72 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) | 71 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) |
| 73 | u_int32_t ecctype; | 72 | u_int32_t ecctype; |
| 74 | u_int32_t eccsize; | 73 | u_int32_t eccsize; |
| 75 | 74 | ||
| 75 | /* | ||
| 76 | * Reuse some of the above unused fields in the case of NOR flash | ||
| 77 | * with configurable programming regions to avoid modifying the | ||
| 78 | * user visible structure layout/size. Only valid when the | ||
| 79 | * MTD_PROGRAM_REGIONS flag is set. | ||
| 80 | * (Maybe we should have an union for those?) | ||
| 81 | */ | ||
| 82 | #define MTD_PROGREGION_SIZE(mtd) (mtd)->oobblock | ||
| 83 | #define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize | ||
| 84 | #define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype | ||
| 76 | 85 | ||
| 77 | // Kernel-only stuff starts here. | 86 | // Kernel-only stuff starts here. |
| 78 | char *name; | 87 | char *name; |
| @@ -80,13 +89,13 @@ struct mtd_info { | |||
| 80 | 89 | ||
| 81 | // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) | 90 | // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) |
| 82 | struct nand_oobinfo oobinfo; | 91 | struct nand_oobinfo oobinfo; |
| 83 | u_int32_t oobavail; // Number of bytes in OOB area available for fs | 92 | u_int32_t oobavail; // Number of bytes in OOB area available for fs |
| 84 | 93 | ||
| 85 | /* Data for variable erase regions. If numeraseregions is zero, | 94 | /* Data for variable erase regions. If numeraseregions is zero, |
| 86 | * it means that the whole device has erasesize as given above. | 95 | * it means that the whole device has erasesize as given above. |
| 87 | */ | 96 | */ |
| 88 | int numeraseregions; | 97 | int numeraseregions; |
| 89 | struct mtd_erase_region_info *eraseregions; | 98 | struct mtd_erase_region_info *eraseregions; |
| 90 | 99 | ||
| 91 | /* This really shouldn't be here. It can go away in 2.5 */ | 100 | /* This really shouldn't be here. It can go away in 2.5 */ |
| 92 | u_int32_t bank_size; | 101 | u_int32_t bank_size; |
| @@ -109,10 +118,10 @@ struct mtd_info { | |||
| 109 | int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 118 | int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 110 | int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); | 119 | int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); |
| 111 | 120 | ||
| 112 | /* | 121 | /* |
| 113 | * Methods to access the protection register area, present in some | 122 | * Methods to access the protection register area, present in some |
| 114 | * flash devices. The user data is one time programmable but the | 123 | * flash devices. The user data is one time programmable but the |
| 115 | * factory data is read only. | 124 | * factory data is read only. |
| 116 | */ | 125 | */ |
| 117 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); | 126 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); |
| 118 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 127 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| @@ -123,14 +132,14 @@ struct mtd_info { | |||
| 123 | 132 | ||
| 124 | /* kvec-based read/write methods. We need these especially for NAND flash, | 133 | /* kvec-based read/write methods. We need these especially for NAND flash, |
| 125 | with its limited number of write cycles per erase. | 134 | with its limited number of write cycles per erase. |
| 126 | NB: The 'count' parameter is the number of _vectors_, each of | 135 | NB: The 'count' parameter is the number of _vectors_, each of |
| 127 | which contains an (ofs, len) tuple. | 136 | which contains an (ofs, len) tuple. |
| 128 | */ | 137 | */ |
| 129 | int (*readv) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, size_t *retlen); | 138 | int (*readv) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, size_t *retlen); |
| 130 | int (*readv_ecc) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, | 139 | int (*readv_ecc) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, |
| 131 | size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel); | 140 | size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel); |
| 132 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); | 141 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); |
| 133 | int (*writev_ecc) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, | 142 | int (*writev_ecc) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, |
| 134 | size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel); | 143 | size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel); |
| 135 | 144 | ||
| 136 | /* Sync */ | 145 | /* Sync */ |
| @@ -194,7 +203,7 @@ int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, | |||
| 194 | #define MTD_WRITEECC(mtd, args...) (*(mtd->write_ecc))(mtd, args) | 203 | #define MTD_WRITEECC(mtd, args...) (*(mtd->write_ecc))(mtd, args) |
| 195 | #define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args) | 204 | #define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args) |
| 196 | #define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args) | 205 | #define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args) |
| 197 | #define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0) | 206 | #define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0) |
| 198 | 207 | ||
| 199 | 208 | ||
| 200 | #ifdef CONFIG_MTD_PARTITIONS | 209 | #ifdef CONFIG_MTD_PARTITIONS |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 9b5b76217584..da5e67b3fc70 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * Steven J. Hill <sjhill@realitydiluted.com> | 5 | * Steven J. Hill <sjhill@realitydiluted.com> |
| 6 | * Thomas Gleixner <tglx@linutronix.de> | 6 | * Thomas Gleixner <tglx@linutronix.de> |
| 7 | * | 7 | * |
| 8 | * $Id: nand.h,v 1.73 2005/05/31 19:39:17 gleixner Exp $ | 8 | * $Id: nand.h,v 1.74 2005/09/15 13:58:50 vwool Exp $ |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
| @@ -24,7 +24,7 @@ | |||
| 24 | * bat later if I did something naughty. | 24 | * bat later if I did something naughty. |
| 25 | * 10-11-2000 SJH Added private NAND flash structure for driver | 25 | * 10-11-2000 SJH Added private NAND flash structure for driver |
| 26 | * 10-24-2000 SJH Added prototype for 'nand_scan' function | 26 | * 10-24-2000 SJH Added prototype for 'nand_scan' function |
| 27 | * 10-29-2001 TG changed nand_chip structure to support | 27 | * 10-29-2001 TG changed nand_chip structure to support |
| 28 | * hardwarespecific function for accessing control lines | 28 | * hardwarespecific function for accessing control lines |
| 29 | * 02-21-2002 TG added support for different read/write adress and | 29 | * 02-21-2002 TG added support for different read/write adress and |
| 30 | * ready/busy line access function | 30 | * ready/busy line access function |
| @@ -36,21 +36,21 @@ | |||
| 36 | * CONFIG_MTD_NAND_ECC_JFFS2 is not set | 36 | * CONFIG_MTD_NAND_ECC_JFFS2 is not set |
| 37 | * 08-10-2002 TG extensions to nand_chip structure to support HW-ECC | 37 | * 08-10-2002 TG extensions to nand_chip structure to support HW-ECC |
| 38 | * | 38 | * |
| 39 | * 08-29-2002 tglx nand_chip structure: data_poi for selecting | 39 | * 08-29-2002 tglx nand_chip structure: data_poi for selecting |
| 40 | * internal / fs-driver buffer | 40 | * internal / fs-driver buffer |
| 41 | * support for 6byte/512byte hardware ECC | 41 | * support for 6byte/512byte hardware ECC |
| 42 | * read_ecc, write_ecc extended for different oob-layout | 42 | * read_ecc, write_ecc extended for different oob-layout |
| 43 | * oob layout selections: NAND_NONE_OOB, NAND_JFFS2_OOB, | 43 | * oob layout selections: NAND_NONE_OOB, NAND_JFFS2_OOB, |
| 44 | * NAND_YAFFS_OOB | 44 | * NAND_YAFFS_OOB |
| 45 | * 11-25-2002 tglx Added Manufacturer code FUJITSU, NATIONAL | 45 | * 11-25-2002 tglx Added Manufacturer code FUJITSU, NATIONAL |
| 46 | * Split manufacturer and device ID structures | 46 | * Split manufacturer and device ID structures |
| 47 | * | 47 | * |
| 48 | * 02-08-2004 tglx added option field to nand structure for chip anomalities | 48 | * 02-08-2004 tglx added option field to nand structure for chip anomalities |
| 49 | * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id | 49 | * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id |
| 50 | * update of nand_chip structure description | 50 | * update of nand_chip structure description |
| 51 | * 01-17-2005 dmarlin added extended commands for AG-AND device and added option | 51 | * 01-17-2005 dmarlin added extended commands for AG-AND device and added option |
| 52 | * for BBT_AUTO_REFRESH. | 52 | * for BBT_AUTO_REFRESH. |
| 53 | * 01-20-2005 dmarlin added optional pointer to hardware specific callback for | 53 | * 01-20-2005 dmarlin added optional pointer to hardware specific callback for |
| 54 | * extra error status checks. | 54 | * extra error status checks. |
| 55 | */ | 55 | */ |
| 56 | #ifndef __LINUX_MTD_NAND_H | 56 | #ifndef __LINUX_MTD_NAND_H |
| @@ -120,8 +120,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 120 | #define NAND_CMD_CACHEDPROG 0x15 | 120 | #define NAND_CMD_CACHEDPROG 0x15 |
| 121 | 121 | ||
| 122 | /* Extended commands for AG-AND device */ | 122 | /* Extended commands for AG-AND device */ |
| 123 | /* | 123 | /* |
| 124 | * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but | 124 | * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but |
| 125 | * there is no way to distinguish that from NAND_CMD_READ0 | 125 | * there is no way to distinguish that from NAND_CMD_READ0 |
| 126 | * until the remaining sequence of commands has been completed | 126 | * until the remaining sequence of commands has been completed |
| 127 | * so add a high order bit and mask it off in the command. | 127 | * so add a high order bit and mask it off in the command. |
| @@ -145,7 +145,7 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 145 | #define NAND_STATUS_READY 0x40 | 145 | #define NAND_STATUS_READY 0x40 |
| 146 | #define NAND_STATUS_WP 0x80 | 146 | #define NAND_STATUS_WP 0x80 |
| 147 | 147 | ||
| 148 | /* | 148 | /* |
| 149 | * Constants for ECC_MODES | 149 | * Constants for ECC_MODES |
| 150 | */ | 150 | */ |
| 151 | 151 | ||
| @@ -191,12 +191,12 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 191 | #define NAND_CACHEPRG 0x00000008 | 191 | #define NAND_CACHEPRG 0x00000008 |
| 192 | /* Chip has copy back function */ | 192 | /* Chip has copy back function */ |
| 193 | #define NAND_COPYBACK 0x00000010 | 193 | #define NAND_COPYBACK 0x00000010 |
| 194 | /* AND Chip which has 4 banks and a confusing page / block | 194 | /* AND Chip which has 4 banks and a confusing page / block |
| 195 | * assignment. See Renesas datasheet for further information */ | 195 | * assignment. See Renesas datasheet for further information */ |
| 196 | #define NAND_IS_AND 0x00000020 | 196 | #define NAND_IS_AND 0x00000020 |
| 197 | /* Chip has a array of 4 pages which can be read without | 197 | /* Chip has a array of 4 pages which can be read without |
| 198 | * additional ready /busy waits */ | 198 | * additional ready /busy waits */ |
| 199 | #define NAND_4PAGE_ARRAY 0x00000040 | 199 | #define NAND_4PAGE_ARRAY 0x00000040 |
| 200 | /* Chip requires that BBT is periodically rewritten to prevent | 200 | /* Chip requires that BBT is periodically rewritten to prevent |
| 201 | * bits from adjacent blocks from 'leaking' in altering data. | 201 | * bits from adjacent blocks from 'leaking' in altering data. |
| 202 | * This happens with the Renesas AG-AND chips, possibly others. */ | 202 | * This happens with the Renesas AG-AND chips, possibly others. */ |
| @@ -219,8 +219,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 219 | /* Use a flash based bad block table. This option is passed to the | 219 | /* Use a flash based bad block table. This option is passed to the |
| 220 | * default bad block table function. */ | 220 | * default bad block table function. */ |
| 221 | #define NAND_USE_FLASH_BBT 0x00010000 | 221 | #define NAND_USE_FLASH_BBT 0x00010000 |
| 222 | /* The hw ecc generator provides a syndrome instead a ecc value on read | 222 | /* The hw ecc generator provides a syndrome instead a ecc value on read |
| 223 | * This can only work if we have the ecc bytes directly behind the | 223 | * This can only work if we have the ecc bytes directly behind the |
| 224 | * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ | 224 | * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ |
| 225 | #define NAND_HWECC_SYNDROME 0x00020000 | 225 | #define NAND_HWECC_SYNDROME 0x00020000 |
| 226 | /* This option skips the bbt scan during initialization. */ | 226 | /* This option skips the bbt scan during initialization. */ |
| @@ -244,6 +244,7 @@ typedef enum { | |||
| 244 | FL_ERASING, | 244 | FL_ERASING, |
| 245 | FL_SYNCING, | 245 | FL_SYNCING, |
| 246 | FL_CACHEDPRG, | 246 | FL_CACHEDPRG, |
| 247 | FL_PM_SUSPENDED, | ||
| 247 | } nand_state_t; | 248 | } nand_state_t; |
| 248 | 249 | ||
| 249 | /* Keep gcc happy */ | 250 | /* Keep gcc happy */ |
| @@ -251,7 +252,7 @@ struct nand_chip; | |||
| 251 | 252 | ||
| 252 | /** | 253 | /** |
| 253 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices | 254 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices |
| 254 | * @lock: protection lock | 255 | * @lock: protection lock |
| 255 | * @active: the mtd device which holds the controller currently | 256 | * @active: the mtd device which holds the controller currently |
| 256 | * @wq: wait queue to sleep on if a NAND operation is in progress | 257 | * @wq: wait queue to sleep on if a NAND operation is in progress |
| 257 | * used instead of the per chip wait queue when a hw controller is available | 258 | * used instead of the per chip wait queue when a hw controller is available |
| @@ -264,8 +265,8 @@ struct nand_hw_control { | |||
| 264 | 265 | ||
| 265 | /** | 266 | /** |
| 266 | * struct nand_chip - NAND Private Flash Chip Data | 267 | * struct nand_chip - NAND Private Flash Chip Data |
| 267 | * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device | 268 | * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device |
| 268 | * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device | 269 | * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device |
| 269 | * @read_byte: [REPLACEABLE] read one byte from the chip | 270 | * @read_byte: [REPLACEABLE] read one byte from the chip |
| 270 | * @write_byte: [REPLACEABLE] write one byte to the chip | 271 | * @write_byte: [REPLACEABLE] write one byte to the chip |
| 271 | * @read_word: [REPLACEABLE] read one word from the chip | 272 | * @read_word: [REPLACEABLE] read one word from the chip |
| @@ -288,7 +289,7 @@ struct nand_hw_control { | |||
| 288 | * be provided if a hardware ECC is available | 289 | * be provided if a hardware ECC is available |
| 289 | * @erase_cmd: [INTERN] erase command write function, selectable due to AND support | 290 | * @erase_cmd: [INTERN] erase command write function, selectable due to AND support |
| 290 | * @scan_bbt: [REPLACEABLE] function to scan bad block table | 291 | * @scan_bbt: [REPLACEABLE] function to scan bad block table |
| 291 | * @eccmode: [BOARDSPECIFIC] mode of ecc, see defines | 292 | * @eccmode: [BOARDSPECIFIC] mode of ecc, see defines |
| 292 | * @eccsize: [INTERN] databytes used per ecc-calculation | 293 | * @eccsize: [INTERN] databytes used per ecc-calculation |
| 293 | * @eccbytes: [INTERN] number of ecc bytes per ecc-calculation step | 294 | * @eccbytes: [INTERN] number of ecc bytes per ecc-calculation step |
| 294 | * @eccsteps: [INTERN] number of ecc calculation steps per page | 295 | * @eccsteps: [INTERN] number of ecc calculation steps per page |
| @@ -300,7 +301,7 @@ struct nand_hw_control { | |||
| 300 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock | 301 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock |
| 301 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry | 302 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry |
| 302 | * @chip_shift: [INTERN] number of address bits in one chip | 303 | * @chip_shift: [INTERN] number of address bits in one chip |
| 303 | * @data_buf: [INTERN] internal buffer for one page + oob | 304 | * @data_buf: [INTERN] internal buffer for one page + oob |
| 304 | * @oob_buf: [INTERN] oob buffer for one eraseblock | 305 | * @oob_buf: [INTERN] oob buffer for one eraseblock |
| 305 | * @oobdirty: [INTERN] indicates that oob_buf must be reinitialized | 306 | * @oobdirty: [INTERN] indicates that oob_buf must be reinitialized |
| 306 | * @data_poi: [INTERN] pointer to a data buffer | 307 | * @data_poi: [INTERN] pointer to a data buffer |
| @@ -315,22 +316,22 @@ struct nand_hw_control { | |||
| 315 | * @bbt: [INTERN] bad block table pointer | 316 | * @bbt: [INTERN] bad block table pointer |
| 316 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup | 317 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup |
| 317 | * @bbt_md: [REPLACEABLE] bad block table mirror descriptor | 318 | * @bbt_md: [REPLACEABLE] bad block table mirror descriptor |
| 318 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan | 319 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan |
| 319 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices | 320 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices |
| 320 | * @priv: [OPTIONAL] pointer to private chip date | 321 | * @priv: [OPTIONAL] pointer to private chip date |
| 321 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks | 322 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks |
| 322 | * (determine if errors are correctable) | 323 | * (determine if errors are correctable) |
| 323 | */ | 324 | */ |
| 324 | 325 | ||
| 325 | struct nand_chip { | 326 | struct nand_chip { |
| 326 | void __iomem *IO_ADDR_R; | 327 | void __iomem *IO_ADDR_R; |
| 327 | void __iomem *IO_ADDR_W; | 328 | void __iomem *IO_ADDR_W; |
| 328 | 329 | ||
| 329 | u_char (*read_byte)(struct mtd_info *mtd); | 330 | u_char (*read_byte)(struct mtd_info *mtd); |
| 330 | void (*write_byte)(struct mtd_info *mtd, u_char byte); | 331 | void (*write_byte)(struct mtd_info *mtd, u_char byte); |
| 331 | u16 (*read_word)(struct mtd_info *mtd); | 332 | u16 (*read_word)(struct mtd_info *mtd); |
| 332 | void (*write_word)(struct mtd_info *mtd, u16 word); | 333 | void (*write_word)(struct mtd_info *mtd, u16 word); |
| 333 | 334 | ||
| 334 | void (*write_buf)(struct mtd_info *mtd, const u_char *buf, int len); | 335 | void (*write_buf)(struct mtd_info *mtd, const u_char *buf, int len); |
| 335 | void (*read_buf)(struct mtd_info *mtd, u_char *buf, int len); | 336 | void (*read_buf)(struct mtd_info *mtd, u_char *buf, int len); |
| 336 | int (*verify_buf)(struct mtd_info *mtd, const u_char *buf, int len); | 337 | int (*verify_buf)(struct mtd_info *mtd, const u_char *buf, int len); |
| @@ -395,7 +396,7 @@ struct nand_chip { | |||
| 395 | * @name: Identify the device type | 396 | * @name: Identify the device type |
| 396 | * @id: device ID code | 397 | * @id: device ID code |
| 397 | * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 | 398 | * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 |
| 398 | * If the pagesize is 0, then the real pagesize | 399 | * If the pagesize is 0, then the real pagesize |
| 399 | * and the eraseize are determined from the | 400 | * and the eraseize are determined from the |
| 400 | * extended id bytes in the chip | 401 | * extended id bytes in the chip |
| 401 | * @erasesize: Size of an erase block in the flash device. | 402 | * @erasesize: Size of an erase block in the flash device. |
| @@ -424,7 +425,7 @@ struct nand_manufacturers { | |||
| 424 | extern struct nand_flash_dev nand_flash_ids[]; | 425 | extern struct nand_flash_dev nand_flash_ids[]; |
| 425 | extern struct nand_manufacturers nand_manuf_ids[]; | 426 | extern struct nand_manufacturers nand_manuf_ids[]; |
| 426 | 427 | ||
| 427 | /** | 428 | /** |
| 428 | * struct nand_bbt_descr - bad block table descriptor | 429 | * struct nand_bbt_descr - bad block table descriptor |
| 429 | * @options: options for this descriptor | 430 | * @options: options for this descriptor |
| 430 | * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE | 431 | * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE |
| @@ -435,14 +436,14 @@ extern struct nand_manufacturers nand_manuf_ids[]; | |||
| 435 | * @version: version read from the bbt page during scan | 436 | * @version: version read from the bbt page during scan |
| 436 | * @len: length of the pattern, if 0 no pattern check is performed | 437 | * @len: length of the pattern, if 0 no pattern check is performed |
| 437 | * @maxblocks: maximum number of blocks to search for a bbt. This number of | 438 | * @maxblocks: maximum number of blocks to search for a bbt. This number of |
| 438 | * blocks is reserved at the end of the device where the tables are | 439 | * blocks is reserved at the end of the device where the tables are |
| 439 | * written. | 440 | * written. |
| 440 | * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than | 441 | * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than |
| 441 | * bad) block in the stored bbt | 442 | * bad) block in the stored bbt |
| 442 | * @pattern: pattern to identify bad block table or factory marked good / | 443 | * @pattern: pattern to identify bad block table or factory marked good / |
| 443 | * bad blocks, can be NULL, if len = 0 | 444 | * bad blocks, can be NULL, if len = 0 |
| 444 | * | 445 | * |
| 445 | * Descriptor for the bad block table marker and the descriptor for the | 446 | * Descriptor for the bad block table marker and the descriptor for the |
| 446 | * pattern which identifies good and bad blocks. The assumption is made | 447 | * pattern which identifies good and bad blocks. The assumption is made |
| 447 | * that the pattern and the version count are always located in the oob area | 448 | * that the pattern and the version count are always located in the oob area |
| 448 | * of the first block. | 449 | * of the first block. |
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h new file mode 100644 index 000000000000..f1fd4215686a --- /dev/null +++ b/include/linux/mtd/onenand.h | |||
| @@ -0,0 +1,155 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/mtd/onenand.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005 Samsung Electronics | ||
| 5 | * Kyungmin Park <kyungmin.park@samsung.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __LINUX_MTD_ONENAND_H | ||
| 13 | #define __LINUX_MTD_ONENAND_H | ||
| 14 | |||
| 15 | #include <linux/spinlock.h> | ||
| 16 | #include <linux/mtd/onenand_regs.h> | ||
| 17 | #include <linux/mtd/bbm.h> | ||
| 18 | |||
| 19 | #define MAX_BUFFERRAM 2 | ||
| 20 | #define MAX_ONENAND_PAGESIZE (2048 + 64) | ||
| 21 | |||
| 22 | /* Scan and identify a OneNAND device */ | ||
| 23 | extern int onenand_scan(struct mtd_info *mtd, int max_chips); | ||
| 24 | /* Free resources held by the OneNAND device */ | ||
| 25 | extern void onenand_release(struct mtd_info *mtd); | ||
| 26 | |||
| 27 | /** | ||
| 28 | * onenand_state_t - chip states | ||
| 29 | * Enumeration for OneNAND flash chip state | ||
| 30 | */ | ||
| 31 | typedef enum { | ||
| 32 | FL_READY, | ||
| 33 | FL_READING, | ||
| 34 | FL_WRITING, | ||
| 35 | FL_ERASING, | ||
| 36 | FL_SYNCING, | ||
| 37 | FL_UNLOCKING, | ||
| 38 | FL_LOCKING, | ||
| 39 | FL_PM_SUSPENDED, | ||
| 40 | } onenand_state_t; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * struct onenand_bufferram - OneNAND BufferRAM Data | ||
| 44 | * @param block block address in BufferRAM | ||
| 45 | * @param page page address in BufferRAM | ||
| 46 | * @param valid valid flag | ||
| 47 | */ | ||
| 48 | struct onenand_bufferram { | ||
| 49 | int block; | ||
| 50 | int page; | ||
| 51 | int valid; | ||
| 52 | }; | ||
| 53 | |||
| 54 | /** | ||
| 55 | * struct onenand_chip - OneNAND Private Flash Chip Data | ||
| 56 | * @param base [BOARDSPECIFIC] address to access OneNAND | ||
| 57 | * @param chipsize [INTERN] the size of one chip for multichip arrays | ||
| 58 | * @param device_id [INTERN] device ID | ||
| 59 | * @param verstion_id [INTERN] version ID | ||
| 60 | * @param options [BOARDSPECIFIC] various chip options. They can partly be set to inform onenand_scan about | ||
| 61 | * @param erase_shift [INTERN] number of address bits in a block | ||
| 62 | * @param page_shift [INTERN] number of address bits in a page | ||
| 63 | * @param ppb_shift [INTERN] number of address bits in a pages per block | ||
| 64 | * @param page_mask [INTERN] a page per block mask | ||
| 65 | * @param bufferam_index [INTERN] BufferRAM index | ||
| 66 | * @param bufferam [INTERN] BufferRAM info | ||
| 67 | * @param readw [REPLACEABLE] hardware specific function for read short | ||
| 68 | * @param writew [REPLACEABLE] hardware specific function for write short | ||
| 69 | * @param command [REPLACEABLE] hardware specific function for writing commands to the chip | ||
| 70 | * @param wait [REPLACEABLE] hardware specific function for wait on ready | ||
| 71 | * @param read_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area | ||
| 72 | * @param write_bufferram [REPLACEABLE] hardware specific function for BufferRAM Area | ||
| 73 | * @param read_word [REPLACEABLE] hardware specific function for read register of OneNAND | ||
| 74 | * @param write_word [REPLACEABLE] hardware specific function for write register of OneNAND | ||
| 75 | * @param scan_bbt [REPLACEALBE] hardware specific function for scaning Bad block Table | ||
| 76 | * @param chip_lock [INTERN] spinlock used to protect access to this structure and the chip | ||
| 77 | * @param wq [INTERN] wait queue to sleep on if a OneNAND operation is in progress | ||
| 78 | * @param state [INTERN] the current state of the OneNAND device | ||
| 79 | * @param autooob [REPLACEABLE] the default (auto)placement scheme | ||
| 80 | * @param bbm [REPLACEABLE] pointer to Bad Block Management | ||
| 81 | * @param priv [OPTIONAL] pointer to private chip date | ||
| 82 | */ | ||
| 83 | struct onenand_chip { | ||
| 84 | void __iomem *base; | ||
| 85 | unsigned int chipsize; | ||
| 86 | unsigned int device_id; | ||
| 87 | unsigned int density_mask; | ||
| 88 | unsigned int options; | ||
| 89 | |||
| 90 | unsigned int erase_shift; | ||
| 91 | unsigned int page_shift; | ||
| 92 | unsigned int ppb_shift; /* Pages per block shift */ | ||
| 93 | unsigned int page_mask; | ||
| 94 | |||
| 95 | unsigned int bufferram_index; | ||
| 96 | struct onenand_bufferram bufferram[MAX_BUFFERRAM]; | ||
| 97 | |||
| 98 | int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len); | ||
| 99 | int (*wait)(struct mtd_info *mtd, int state); | ||
| 100 | int (*read_bufferram)(struct mtd_info *mtd, int area, | ||
| 101 | unsigned char *buffer, int offset, size_t count); | ||
| 102 | int (*write_bufferram)(struct mtd_info *mtd, int area, | ||
| 103 | const unsigned char *buffer, int offset, size_t count); | ||
| 104 | unsigned short (*read_word)(void __iomem *addr); | ||
| 105 | void (*write_word)(unsigned short value, void __iomem *addr); | ||
| 106 | void (*mmcontrol)(struct mtd_info *mtd, int sync_read); | ||
| 107 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); | ||
| 108 | int (*scan_bbt)(struct mtd_info *mtd); | ||
| 109 | |||
| 110 | spinlock_t chip_lock; | ||
| 111 | wait_queue_head_t wq; | ||
| 112 | onenand_state_t state; | ||
| 113 | |||
| 114 | struct nand_oobinfo *autooob; | ||
| 115 | |||
| 116 | void *bbm; | ||
| 117 | |||
| 118 | void *priv; | ||
| 119 | }; | ||
| 120 | |||
| 121 | /* | ||
| 122 | * Helper macros | ||
| 123 | */ | ||
| 124 | #define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index) | ||
| 125 | #define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) | ||
| 126 | #define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) | ||
| 127 | |||
| 128 | #define ONENAND_GET_SYS_CFG1(this) \ | ||
| 129 | (this->read_word(this->base + ONENAND_REG_SYS_CFG1)) | ||
| 130 | #define ONENAND_SET_SYS_CFG1(v, this) \ | ||
| 131 | (this->write_word(v, this->base + ONENAND_REG_SYS_CFG1)) | ||
| 132 | |||
| 133 | /* | ||
| 134 | * Options bits | ||
| 135 | */ | ||
| 136 | #define ONENAND_CONT_LOCK (0x0001) | ||
| 137 | |||
| 138 | |||
| 139 | /* | ||
| 140 | * OneNAND Flash Manufacturer ID Codes | ||
| 141 | */ | ||
| 142 | #define ONENAND_MFR_SAMSUNG 0xec | ||
| 143 | #define ONENAND_MFR_UNKNOWN 0x00 | ||
| 144 | |||
| 145 | /** | ||
| 146 | * struct nand_manufacturers - NAND Flash Manufacturer ID Structure | ||
| 147 | * @param name: Manufacturer name | ||
| 148 | * @param id: manufacturer ID code of device. | ||
| 149 | */ | ||
| 150 | struct onenand_manufacturers { | ||
| 151 | int id; | ||
| 152 | char *name; | ||
| 153 | }; | ||
| 154 | |||
| 155 | #endif /* __LINUX_MTD_ONENAND_H */ | ||
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h new file mode 100644 index 000000000000..d7832ef8ed63 --- /dev/null +++ b/include/linux/mtd/onenand_regs.h | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/mtd/onenand_regs.h | ||
| 3 | * | ||
| 4 | * OneNAND Register header file | ||
| 5 | * | ||
| 6 | * Copyright (C) 2005 Samsung Electronics | ||
| 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 __ONENAND_REG_H | ||
| 14 | #define __ONENAND_REG_H | ||
| 15 | |||
| 16 | /* Memory Address Map Translation (Word order) */ | ||
| 17 | #define ONENAND_MEMORY_MAP(x) ((x) << 1) | ||
| 18 | |||
| 19 | /* | ||
| 20 | * External BufferRAM area | ||
| 21 | */ | ||
| 22 | #define ONENAND_BOOTRAM ONENAND_MEMORY_MAP(0x0000) | ||
| 23 | #define ONENAND_DATARAM ONENAND_MEMORY_MAP(0x0200) | ||
| 24 | #define ONENAND_SPARERAM ONENAND_MEMORY_MAP(0x8010) | ||
| 25 | |||
| 26 | /* | ||
| 27 | * OneNAND Registers | ||
| 28 | */ | ||
| 29 | #define ONENAND_REG_MANUFACTURER_ID ONENAND_MEMORY_MAP(0xF000) | ||
| 30 | #define ONENAND_REG_DEVICE_ID ONENAND_MEMORY_MAP(0xF001) | ||
| 31 | #define ONENAND_REG_VERSION_ID ONENAND_MEMORY_MAP(0xF002) | ||
| 32 | #define ONENAND_REG_DATA_BUFFER_SIZE ONENAND_MEMORY_MAP(0xF003) | ||
| 33 | #define ONENAND_REG_BOOT_BUFFER_SIZE ONENAND_MEMORY_MAP(0xF004) | ||
| 34 | #define ONENAND_REG_NUM_BUFFERS ONENAND_MEMORY_MAP(0xF005) | ||
| 35 | #define ONENAND_REG_TECHNOLOGY ONENAND_MEMORY_MAP(0xF006) | ||
| 36 | |||
| 37 | #define ONENAND_REG_START_ADDRESS1 ONENAND_MEMORY_MAP(0xF100) | ||
| 38 | #define ONENAND_REG_START_ADDRESS2 ONENAND_MEMORY_MAP(0xF101) | ||
| 39 | #define ONENAND_REG_START_ADDRESS3 ONENAND_MEMORY_MAP(0xF102) | ||
| 40 | #define ONENAND_REG_START_ADDRESS4 ONENAND_MEMORY_MAP(0xF103) | ||
| 41 | #define ONENAND_REG_START_ADDRESS5 ONENAND_MEMORY_MAP(0xF104) | ||
| 42 | #define ONENAND_REG_START_ADDRESS6 ONENAND_MEMORY_MAP(0xF105) | ||
| 43 | #define ONENAND_REG_START_ADDRESS7 ONENAND_MEMORY_MAP(0xF106) | ||
| 44 | #define ONENAND_REG_START_ADDRESS8 ONENAND_MEMORY_MAP(0xF107) | ||
| 45 | |||
| 46 | #define ONENAND_REG_START_BUFFER ONENAND_MEMORY_MAP(0xF200) | ||
| 47 | #define ONENAND_REG_COMMAND ONENAND_MEMORY_MAP(0xF220) | ||
| 48 | #define ONENAND_REG_SYS_CFG1 ONENAND_MEMORY_MAP(0xF221) | ||
| 49 | #define ONENAND_REG_SYS_CFG2 ONENAND_MEMORY_MAP(0xF222) | ||
| 50 | #define ONENAND_REG_CTRL_STATUS ONENAND_MEMORY_MAP(0xF240) | ||
| 51 | #define ONENAND_REG_INTERRUPT ONENAND_MEMORY_MAP(0xF241) | ||
| 52 | #define ONENAND_REG_START_BLOCK_ADDRESS ONENAND_MEMORY_MAP(0xF24C) | ||
| 53 | #define ONENAND_REG_END_BLOCK_ADDRESS ONENAND_MEMORY_MAP(0xF24D) | ||
| 54 | #define ONENAND_REG_WP_STATUS ONENAND_MEMORY_MAP(0xF24E) | ||
| 55 | |||
| 56 | #define ONENAND_REG_ECC_STATUS ONENAND_MEMORY_MAP(0xFF00) | ||
| 57 | #define ONENAND_REG_ECC_M0 ONENAND_MEMORY_MAP(0xFF01) | ||
| 58 | #define ONENAND_REG_ECC_S0 ONENAND_MEMORY_MAP(0xFF02) | ||
| 59 | #define ONENAND_REG_ECC_M1 ONENAND_MEMORY_MAP(0xFF03) | ||
| 60 | #define ONENAND_REG_ECC_S1 ONENAND_MEMORY_MAP(0xFF04) | ||
| 61 | #define ONENAND_REG_ECC_M2 ONENAND_MEMORY_MAP(0xFF05) | ||
| 62 | #define ONENAND_REG_ECC_S2 ONENAND_MEMORY_MAP(0xFF06) | ||
| 63 | #define ONENAND_REG_ECC_M3 ONENAND_MEMORY_MAP(0xFF07) | ||
| 64 | #define ONENAND_REG_ECC_S3 ONENAND_MEMORY_MAP(0xFF08) | ||
| 65 | |||
| 66 | /* | ||
| 67 | * Device ID Register F001h (R) | ||
| 68 | */ | ||
| 69 | #define ONENAND_DEVICE_DENSITY_SHIFT (4) | ||
| 70 | #define ONENAND_DEVICE_IS_DDP (1 << 3) | ||
| 71 | #define ONENAND_DEVICE_IS_DEMUX (1 << 2) | ||
| 72 | #define ONENAND_DEVICE_VCC_MASK (0x3) | ||
| 73 | |||
| 74 | #define ONENAND_DEVICE_DENSITY_512Mb (0x002) | ||
| 75 | |||
| 76 | /* | ||
| 77 | * Version ID Register F002h (R) | ||
| 78 | */ | ||
| 79 | #define ONENAND_VERSION_PROCESS_SHIFT (8) | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Start Address 1 F100h (R/W) | ||
| 83 | */ | ||
| 84 | #define ONENAND_DDP_SHIFT (15) | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Start Address 8 F107h (R/W) | ||
| 88 | */ | ||
| 89 | #define ONENAND_FPA_MASK (0x3f) | ||
| 90 | #define ONENAND_FPA_SHIFT (2) | ||
| 91 | #define ONENAND_FSA_MASK (0x03) | ||
| 92 | |||
| 93 | /* | ||
| 94 | * Start Buffer Register F200h (R/W) | ||
| 95 | */ | ||
| 96 | #define ONENAND_BSA_MASK (0x03) | ||
| 97 | #define ONENAND_BSA_SHIFT (8) | ||
| 98 | #define ONENAND_BSA_BOOTRAM (0 << 2) | ||
| 99 | #define ONENAND_BSA_DATARAM0 (2 << 2) | ||
| 100 | #define ONENAND_BSA_DATARAM1 (3 << 2) | ||
| 101 | #define ONENAND_BSC_MASK (0x03) | ||
| 102 | |||
| 103 | /* | ||
| 104 | * Command Register F220h (R/W) | ||
| 105 | */ | ||
| 106 | #define ONENAND_CMD_READ (0x00) | ||
| 107 | #define ONENAND_CMD_READOOB (0x13) | ||
| 108 | #define ONENAND_CMD_PROG (0x80) | ||
| 109 | #define ONENAND_CMD_PROGOOB (0x1A) | ||
| 110 | #define ONENAND_CMD_UNLOCK (0x23) | ||
| 111 | #define ONENAND_CMD_LOCK (0x2A) | ||
| 112 | #define ONENAND_CMD_LOCK_TIGHT (0x2C) | ||
| 113 | #define ONENAND_CMD_ERASE (0x94) | ||
| 114 | #define ONENAND_CMD_RESET (0xF0) | ||
| 115 | #define ONENAND_CMD_READID (0x90) | ||
| 116 | |||
| 117 | /* NOTE: Those are not *REAL* commands */ | ||
| 118 | #define ONENAND_CMD_BUFFERRAM (0x1978) | ||
| 119 | |||
| 120 | /* | ||
| 121 | * System Configuration 1 Register F221h (R, R/W) | ||
| 122 | */ | ||
| 123 | #define ONENAND_SYS_CFG1_SYNC_READ (1 << 15) | ||
| 124 | #define ONENAND_SYS_CFG1_BRL_7 (7 << 12) | ||
| 125 | #define ONENAND_SYS_CFG1_BRL_6 (6 << 12) | ||
| 126 | #define ONENAND_SYS_CFG1_BRL_5 (5 << 12) | ||
| 127 | #define ONENAND_SYS_CFG1_BRL_4 (4 << 12) | ||
| 128 | #define ONENAND_SYS_CFG1_BRL_3 (3 << 12) | ||
| 129 | #define ONENAND_SYS_CFG1_BRL_10 (2 << 12) | ||
| 130 | #define ONENAND_SYS_CFG1_BRL_9 (1 << 12) | ||
| 131 | #define ONENAND_SYS_CFG1_BRL_8 (0 << 12) | ||
| 132 | #define ONENAND_SYS_CFG1_BRL_SHIFT (12) | ||
| 133 | #define ONENAND_SYS_CFG1_BL_32 (4 << 9) | ||
| 134 | #define ONENAND_SYS_CFG1_BL_16 (3 << 9) | ||
| 135 | #define ONENAND_SYS_CFG1_BL_8 (2 << 9) | ||
| 136 | #define ONENAND_SYS_CFG1_BL_4 (1 << 9) | ||
| 137 | #define ONENAND_SYS_CFG1_BL_CONT (0 << 9) | ||
| 138 | #define ONENAND_SYS_CFG1_BL_SHIFT (9) | ||
| 139 | #define ONENAND_SYS_CFG1_NO_ECC (1 << 8) | ||
| 140 | #define ONENAND_SYS_CFG1_RDY (1 << 7) | ||
| 141 | #define ONENAND_SYS_CFG1_INT (1 << 6) | ||
| 142 | #define ONENAND_SYS_CFG1_IOBE (1 << 5) | ||
| 143 | #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) | ||
| 144 | |||
| 145 | /* | ||
| 146 | * Controller Status Register F240h (R) | ||
| 147 | */ | ||
| 148 | #define ONENAND_CTRL_ONGO (1 << 15) | ||
| 149 | #define ONENAND_CTRL_LOCK (1 << 14) | ||
| 150 | #define ONENAND_CTRL_LOAD (1 << 13) | ||
| 151 | #define ONENAND_CTRL_PROGRAM (1 << 12) | ||
| 152 | #define ONENAND_CTRL_ERASE (1 << 11) | ||
| 153 | #define ONENAND_CTRL_ERROR (1 << 10) | ||
| 154 | #define ONENAND_CTRL_RSTB (1 << 7) | ||
| 155 | |||
| 156 | /* | ||
| 157 | * Interrupt Status Register F241h (R) | ||
| 158 | */ | ||
| 159 | #define ONENAND_INT_MASTER (1 << 15) | ||
| 160 | #define ONENAND_INT_READ (1 << 7) | ||
| 161 | #define ONENAND_INT_WRITE (1 << 6) | ||
| 162 | #define ONENAND_INT_ERASE (1 << 5) | ||
| 163 | #define ONENAND_INT_RESET (1 << 4) | ||
| 164 | #define ONENAND_INT_CLEAR (0 << 0) | ||
| 165 | |||
| 166 | /* | ||
| 167 | * NAND Flash Write Protection Status Register F24Eh (R) | ||
| 168 | */ | ||
| 169 | #define ONENAND_WP_US (1 << 2) | ||
| 170 | #define ONENAND_WP_LS (1 << 1) | ||
| 171 | #define ONENAND_WP_LTS (1 << 0) | ||
| 172 | |||
| 173 | /* | ||
| 174 | * ECC Status Reigser FF00h (R) | ||
| 175 | */ | ||
| 176 | #define ONENAND_ECC_1BIT (1 << 0) | ||
| 177 | #define ONENAND_ECC_2BIT (1 << 1) | ||
| 178 | #define ONENAND_ECC_2BIT_ALL (0xAAAA) | ||
| 179 | |||
| 180 | #endif /* __ONENAND_REG_H */ | ||
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index 50b2edfc8f11..b03f512d51b9 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * This code is GPL | 6 | * This code is GPL |
| 7 | * | 7 | * |
| 8 | * $Id: partitions.h,v 1.16 2004/11/16 18:34:40 dwmw2 Exp $ | 8 | * $Id: partitions.h,v 1.17 2005/11/07 11:14:55 gleixner Exp $ |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #ifndef MTD_PARTITIONS_H | 11 | #ifndef MTD_PARTITIONS_H |
| @@ -16,25 +16,25 @@ | |||
| 16 | 16 | ||
| 17 | /* | 17 | /* |
| 18 | * Partition definition structure: | 18 | * Partition definition structure: |
| 19 | * | 19 | * |
| 20 | * An array of struct partition is passed along with a MTD object to | 20 | * An array of struct partition is passed along with a MTD object to |
| 21 | * add_mtd_partitions() to create them. | 21 | * add_mtd_partitions() to create them. |
| 22 | * | 22 | * |
| 23 | * For each partition, these fields are available: | 23 | * For each partition, these fields are available: |
| 24 | * name: string that will be used to label the partition's MTD device. | 24 | * name: string that will be used to label the partition's MTD device. |
| 25 | * size: the partition size; if defined as MTDPART_SIZ_FULL, the partition | 25 | * size: the partition size; if defined as MTDPART_SIZ_FULL, the partition |
| 26 | * will extend to the end of the master MTD device. | 26 | * will extend to the end of the master MTD device. |
| 27 | * offset: absolute starting position within the master MTD device; if | 27 | * offset: absolute starting position within the master MTD device; if |
| 28 | * defined as MTDPART_OFS_APPEND, the partition will start where the | 28 | * defined as MTDPART_OFS_APPEND, the partition will start where the |
| 29 | * previous one ended; if MTDPART_OFS_NXTBLK, at the next erase block. | 29 | * previous one ended; if MTDPART_OFS_NXTBLK, at the next erase block. |
| 30 | * mask_flags: contains flags that have to be masked (removed) from the | 30 | * mask_flags: contains flags that have to be masked (removed) from the |
| 31 | * master MTD flag set for the corresponding MTD partition. | 31 | * master MTD flag set for the corresponding MTD partition. |
| 32 | * For example, to force a read-only partition, simply adding | 32 | * For example, to force a read-only partition, simply adding |
| 33 | * MTD_WRITEABLE to the mask_flags will do the trick. | 33 | * MTD_WRITEABLE to the mask_flags will do the trick. |
| 34 | * | 34 | * |
| 35 | * Note: writeable partitions require their size and offset be | 35 | * Note: writeable partitions require their size and offset be |
| 36 | * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). | 36 | * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). |
| 37 | */ | 37 | */ |
| 38 | 38 | ||
| 39 | struct mtd_partition { | 39 | struct mtd_partition { |
| 40 | char *name; /* identifier string */ | 40 | char *name; /* identifier string */ |
| @@ -66,7 +66,7 @@ struct mtd_part_parser { | |||
| 66 | 66 | ||
| 67 | extern int register_mtd_parser(struct mtd_part_parser *parser); | 67 | extern int register_mtd_parser(struct mtd_part_parser *parser); |
| 68 | extern int deregister_mtd_parser(struct mtd_part_parser *parser); | 68 | extern int deregister_mtd_parser(struct mtd_part_parser *parser); |
| 69 | extern int parse_mtd_partitions(struct mtd_info *master, const char **types, | 69 | extern int parse_mtd_partitions(struct mtd_info *master, const char **types, |
| 70 | struct mtd_partition **pparts, unsigned long origin); | 70 | struct mtd_partition **pparts, unsigned long origin); |
| 71 | 71 | ||
| 72 | #define put_partition_parser(p) do { module_put((p)->owner); } while(0) | 72 | #define put_partition_parser(p) do { module_put((p)->owner); } while(0) |
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index 05aa4970677f..c7b8bcdef013 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * For boards with physically mapped flash and using | 2 | * For boards with physically mapped flash and using |
| 3 | * drivers/mtd/maps/physmap.c mapping driver. | 3 | * drivers/mtd/maps/physmap.c mapping driver. |
| 4 | * | 4 | * |
| 5 | * $Id: physmap.h,v 1.3 2004/07/21 00:16:15 jwboyer Exp $ | 5 | * $Id: physmap.h,v 1.4 2005/11/07 11:14:55 gleixner Exp $ |
| 6 | * | 6 | * |
| 7 | * Copyright (C) 2003 MontaVista Software Inc. | 7 | * Copyright (C) 2003 MontaVista Software Inc. |
| 8 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | 8 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net |
| @@ -18,7 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include <linux/config.h> | 19 | #include <linux/config.h> |
| 20 | 20 | ||
| 21 | #if defined(CONFIG_MTD_PHYSMAP) | 21 | #if defined(CONFIG_MTD_PHYSMAP) |
| 22 | 22 | ||
| 23 | #include <linux/mtd/mtd.h> | 23 | #include <linux/mtd/mtd.h> |
| 24 | #include <linux/mtd/map.h> | 24 | #include <linux/mtd/map.h> |
| @@ -44,12 +44,12 @@ static inline void physmap_configure(unsigned long addr, unsigned long size, int | |||
| 44 | #if defined(CONFIG_MTD_PARTITIONS) | 44 | #if defined(CONFIG_MTD_PARTITIONS) |
| 45 | 45 | ||
| 46 | /* | 46 | /* |
| 47 | * Machines that wish to do flash partition may want to call this function in | 47 | * Machines that wish to do flash partition may want to call this function in |
| 48 | * their setup routine. | 48 | * their setup routine. |
| 49 | * | 49 | * |
| 50 | * physmap_set_partitions(mypartitions, num_parts); | 50 | * physmap_set_partitions(mypartitions, num_parts); |
| 51 | * | 51 | * |
| 52 | * Note that one can always override this hard-coded partition with | 52 | * Note that one can always override this hard-coded partition with |
| 53 | * command line partition (you need to enable CONFIG_MTD_CMDLINE_PARTS). | 53 | * command line partition (you need to enable CONFIG_MTD_CMDLINE_PARTS). |
| 54 | */ | 54 | */ |
| 55 | void physmap_set_partitions(struct mtd_partition *parts, int num_parts); | 55 | void physmap_set_partitions(struct mtd_partition *parts, int num_parts); |
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h index 113e3087f68a..a7f6d20ad407 100644 --- a/include/linux/mtd/pmc551.h +++ b/include/linux/mtd/pmc551.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: pmc551.h,v 1.5 2003/01/24 16:49:53 dwmw2 Exp $ | 2 | * $Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * PMC551 PCI Mezzanine Ram Device | 4 | * PMC551 PCI Mezzanine Ram Device |
| 5 | * | 5 | * |
| @@ -7,7 +7,7 @@ | |||
| 7 | * Mark Ferrell | 7 | * Mark Ferrell |
| 8 | * Copyright 1999,2000 Nortel Networks | 8 | * Copyright 1999,2000 Nortel Networks |
| 9 | * | 9 | * |
| 10 | * License: | 10 | * License: |
| 11 | * As part of this driver was derrived from the slram.c driver it falls | 11 | * As part of this driver was derrived from the slram.c driver it falls |
| 12 | * under the same license, which is GNU General Public License v2 | 12 | * under the same license, which is GNU General Public License v2 |
| 13 | */ | 13 | */ |
| @@ -17,7 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/mtd/mtd.h> | 18 | #include <linux/mtd/mtd.h> |
| 19 | 19 | ||
| 20 | #define PMC551_VERSION "$Id: pmc551.h,v 1.5 2003/01/24 16:49:53 dwmw2 Exp $\n"\ | 20 | #define PMC551_VERSION "$Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $\n"\ |
| 21 | "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" | 21 | "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" |
| 22 | 22 | ||
| 23 | /* | 23 | /* |
| @@ -30,7 +30,7 @@ struct mypriv { | |||
| 30 | u32 curr_map0; | 30 | u32 curr_map0; |
| 31 | u32 asize; | 31 | u32 asize; |
| 32 | struct mtd_info *nextpmc551; | 32 | struct mtd_info *nextpmc551; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | /* | 35 | /* |
| 36 | * Function Prototypes | 36 | * Function Prototypes |
| @@ -39,7 +39,7 @@ static int pmc551_erase(struct mtd_info *, struct erase_info *); | |||
| 39 | static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); | 39 | static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); |
| 40 | static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); | 40 | static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); |
| 41 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 41 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
| 42 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 42 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | /* | 45 | /* |
| @@ -50,7 +50,7 @@ static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_cha | |||
| 50 | #endif | 50 | #endif |
| 51 | 51 | ||
| 52 | #ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC | 52 | #ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC |
| 53 | #define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200 | 53 | #define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200 |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | 56 | ||
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h index 7b7deef6b180..220d50bb71cd 100644 --- a/include/linux/mtd/xip.h +++ b/include/linux/mtd/xip.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
| 13 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
| 14 | * | 14 | * |
| 15 | * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $ | 15 | * $Id: xip.h,v 1.5 2005/11/07 11:14:55 gleixner Exp $ |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #ifndef __LINUX_MTD_XIP_H__ | 18 | #ifndef __LINUX_MTD_XIP_H__ |
| @@ -23,19 +23,19 @@ | |||
| 23 | #ifdef CONFIG_MTD_XIP | 23 | #ifdef CONFIG_MTD_XIP |
| 24 | 24 | ||
| 25 | /* | 25 | /* |
| 26 | * Function that are modifying the flash state away from array mode must | ||
| 27 | * obviously not be running from flash. The __xipram is therefore marking | ||
| 28 | * those functions so they get relocated to ram. | ||
| 29 | */ | ||
| 30 | #define __xipram __attribute__ ((__section__ (".data"))) | ||
| 31 | |||
| 32 | /* | ||
| 33 | * We really don't want gcc to guess anything. | 26 | * We really don't want gcc to guess anything. |
| 34 | * We absolutely _need_ proper inlining. | 27 | * We absolutely _need_ proper inlining. |
| 35 | */ | 28 | */ |
| 36 | #include <linux/compiler.h> | 29 | #include <linux/compiler.h> |
| 37 | 30 | ||
| 38 | /* | 31 | /* |
| 32 | * Function that are modifying the flash state away from array mode must | ||
| 33 | * obviously not be running from flash. The __xipram is therefore marking | ||
| 34 | * those functions so they get relocated to ram. | ||
| 35 | */ | ||
| 36 | #define __xipram noinline __attribute__ ((__section__ (".data"))) | ||
| 37 | |||
| 38 | /* | ||
| 39 | * Each architecture has to provide the following macros. They must access | 39 | * Each architecture has to provide the following macros. They must access |
| 40 | * the hardware directly and not rely on any other (XIP) functions since they | 40 | * the hardware directly and not rely on any other (XIP) functions since they |
| 41 | * won't be available when used (flash not in array mode). | 41 | * won't be available when used (flash not in array mode). |
| @@ -60,9 +60,9 @@ | |||
| 60 | * overflowing. | 60 | * overflowing. |
| 61 | * | 61 | * |
| 62 | * xip_iprefetch() | 62 | * xip_iprefetch() |
| 63 | * | 63 | * |
| 64 | * Macro to fill instruction prefetch | 64 | * Macro to fill instruction prefetch |
| 65 | * e.g. a series of nops: asm volatile (".rep 8; nop; .endr"); | 65 | * e.g. a series of nops: asm volatile (".rep 8; nop; .endr"); |
| 66 | */ | 66 | */ |
| 67 | 67 | ||
| 68 | #include <asm/mtd-xip.h> | 68 | #include <asm/mtd-xip.h> |
diff --git a/include/linux/namei.h b/include/linux/namei.h index 1c975d0d9e94..455660eafba9 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
| @@ -74,7 +74,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | |||
| 74 | extern void release_open_intent(struct nameidata *); | 74 | extern void release_open_intent(struct nameidata *); |
| 75 | 75 | ||
| 76 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); | 76 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); |
| 77 | extern struct dentry * lookup_hash(struct qstr *, struct dentry *); | 77 | extern struct dentry * lookup_hash(struct nameidata *); |
| 78 | 78 | ||
| 79 | extern int follow_down(struct vfsmount **, struct dentry **); | 79 | extern int follow_down(struct vfsmount **, struct dentry **); |
| 80 | extern int follow_up(struct vfsmount **, struct dentry **); | 80 | extern int follow_up(struct vfsmount **, struct dentry **); |
diff --git a/include/linux/namespace.h b/include/linux/namespace.h index 0e5a86f13b2f..6731977c4c13 100644 --- a/include/linux/namespace.h +++ b/include/linux/namespace.h | |||
| @@ -9,7 +9,8 @@ struct namespace { | |||
| 9 | atomic_t count; | 9 | atomic_t count; |
| 10 | struct vfsmount * root; | 10 | struct vfsmount * root; |
| 11 | struct list_head list; | 11 | struct list_head list; |
| 12 | struct rw_semaphore sem; | 12 | wait_queue_head_t poll; |
| 13 | int event; | ||
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 15 | extern int copy_namespace(int, struct task_struct *); | 16 | extern int copy_namespace(int, struct task_struct *); |
diff --git a/include/linux/net.h b/include/linux/net.h index 4e981585a89a..d6a41e6577f6 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -71,6 +71,7 @@ typedef enum { | |||
| 71 | * @SOCK_RAW: raw socket | 71 | * @SOCK_RAW: raw socket |
| 72 | * @SOCK_RDM: reliably-delivered message | 72 | * @SOCK_RDM: reliably-delivered message |
| 73 | * @SOCK_SEQPACKET: sequential packet socket | 73 | * @SOCK_SEQPACKET: sequential packet socket |
| 74 | * @SOCK_DCCP: Datagram Congestion Control Protocol socket | ||
| 74 | * @SOCK_PACKET: linux specific way of getting packets at the dev level. | 75 | * @SOCK_PACKET: linux specific way of getting packets at the dev level. |
| 75 | * For writing rarp and other similar things on the user level. | 76 | * For writing rarp and other similar things on the user level. |
| 76 | * | 77 | * |
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/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index f08e870100f4..72975fa8795d 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -146,7 +146,7 @@ extern void nfnl_unlock(void); | |||
| 146 | extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); | 146 | extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); |
| 147 | extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); | 147 | extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); |
| 148 | 148 | ||
| 149 | extern int nfattr_parse(struct nfattr *tb[], int maxattr, | 149 | extern void nfattr_parse(struct nfattr *tb[], int maxattr, |
| 150 | struct nfattr *nfa, int len); | 150 | struct nfattr *nfa, int len); |
| 151 | 151 | ||
| 152 | #define nfattr_parse_nested(tb, max, nfa) \ | 152 | #define nfattr_parse_nested(tb, max, nfa) \ |
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/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 6d5a24f3fc6d..51c231a1e5a6 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
| @@ -60,7 +60,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | |||
| 60 | extern struct svc_program nfsd_program; | 60 | extern struct svc_program nfsd_program; |
| 61 | extern struct svc_version nfsd_version2, nfsd_version3, | 61 | extern struct svc_version nfsd_version2, nfsd_version3, |
| 62 | nfsd_version4; | 62 | nfsd_version4; |
| 63 | 63 | extern struct svc_serv *nfsd_serv; | |
| 64 | /* | 64 | /* |
| 65 | * Function prototypes. | 65 | * Function prototypes. |
| 66 | */ | 66 | */ |
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index e65c9db6d13f..781efbf94ed3 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h | |||
| @@ -39,6 +39,21 @@ | |||
| 39 | #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ | 39 | #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ |
| 40 | #define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ | 40 | #define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ |
| 41 | 41 | ||
| 42 | /* | ||
| 43 | * Macros used to set version | ||
| 44 | */ | ||
| 45 | #define NFSCTL_VERSET(_cltbits, _v) ((_cltbits) |= (1 << (_v))) | ||
| 46 | #define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << (_v))) | ||
| 47 | #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << (_v))) | ||
| 48 | |||
| 49 | #if defined(CONFIG_NFSD_V4) | ||
| 50 | #define NFSCTL_VERALL (0x1c /* 0b011100 */) | ||
| 51 | #elif defined(CONFIG_NFSD_V3) | ||
| 52 | #define NFSCTL_VERALL (0x0c /* 0b001100 */) | ||
| 53 | #else | ||
| 54 | #define NFSCTL_VERALL (0x04 /* 0b000100 */) | ||
| 55 | #endif | ||
| 56 | |||
| 42 | /* SVC */ | 57 | /* SVC */ |
| 43 | struct nfsctl_svc { | 58 | struct nfsctl_svc { |
| 44 | unsigned short svc_port; | 59 | unsigned short svc_port; |
| @@ -120,6 +135,8 @@ extern int exp_delclient(struct nfsctl_client *ncp); | |||
| 120 | extern int exp_export(struct nfsctl_export *nxp); | 135 | extern int exp_export(struct nfsctl_export *nxp); |
| 121 | extern int exp_unexport(struct nfsctl_export *nxp); | 136 | extern int exp_unexport(struct nfsctl_export *nxp); |
| 122 | 137 | ||
| 138 | extern unsigned int nfsd_versbits; | ||
| 139 | |||
| 123 | #endif /* __KERNEL__ */ | 140 | #endif /* __KERNEL__ */ |
| 124 | 141 | ||
| 125 | #endif /* NFSD_SYSCALL_H */ | 142 | #endif /* NFSD_SYSCALL_H */ |
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h index 21e18ce7ca63..3c2a71b43bac 100644 --- a/include/linux/nfsd/xdr3.h +++ b/include/linux/nfsd/xdr3.h | |||
| @@ -42,7 +42,7 @@ struct nfsd3_writeargs { | |||
| 42 | __u64 offset; | 42 | __u64 offset; |
| 43 | __u32 count; | 43 | __u32 count; |
| 44 | int stable; | 44 | int stable; |
| 45 | int len; | 45 | __u32 len; |
| 46 | struct kvec vec[RPCSVC_MAXPAGES]; | 46 | struct kvec vec[RPCSVC_MAXPAGES]; |
| 47 | int vlen; | 47 | int vlen; |
| 48 | }; | 48 | }; |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 88de3f8ce1a2..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 |
| @@ -519,6 +522,7 @@ | |||
| 519 | #define PCI_DEVICE_ID_MATROX_MIL 0x0519 | 522 | #define PCI_DEVICE_ID_MATROX_MIL 0x0519 |
| 520 | #define PCI_DEVICE_ID_MATROX_MYS 0x051A | 523 | #define PCI_DEVICE_ID_MATROX_MYS 0x051A |
| 521 | #define PCI_DEVICE_ID_MATROX_MIL_2 0x051b | 524 | #define PCI_DEVICE_ID_MATROX_MIL_2 0x051b |
| 525 | #define PCI_DEVICE_ID_MATROX_MYS_AGP 0x051e | ||
| 522 | #define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f | 526 | #define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f |
| 523 | #define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 | 527 | #define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 |
| 524 | #define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 | 528 | #define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 |
| @@ -1785,6 +1789,7 @@ | |||
| 1785 | #define PCI_DEVICE_ID_TIGON3_5704 0x1648 | 1789 | #define PCI_DEVICE_ID_TIGON3_5704 0x1648 |
| 1786 | #define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 | 1790 | #define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 |
| 1787 | #define PCI_DEVICE_ID_NX2_5706 0x164a | 1791 | #define PCI_DEVICE_ID_NX2_5706 0x164a |
| 1792 | #define PCI_DEVICE_ID_NX2_5708 0x164c | ||
| 1788 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d | 1793 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d |
| 1789 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 | 1794 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 |
| 1790 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 | 1795 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 |
| @@ -1809,6 +1814,7 @@ | |||
| 1809 | #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 | 1814 | #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 |
| 1810 | #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 | 1815 | #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 |
| 1811 | #define PCI_DEVICE_ID_NX2_5706S 0x16aa | 1816 | #define PCI_DEVICE_ID_NX2_5706S 0x16aa |
| 1817 | #define PCI_DEVICE_ID_NX2_5708S 0x16ac | ||
| 1812 | #define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 | 1818 | #define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 |
| 1813 | #define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 | 1819 | #define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 |
| 1814 | #define PCI_DEVICE_ID_TIGON3_5781 0x16dd | 1820 | #define PCI_DEVICE_ID_TIGON3_5781 0x16dd |
diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h index d54049eed0c3..a0e31adf3abe 100644 --- a/include/linux/phonedev.h +++ b/include/linux/phonedev.h | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | #define __LINUX_PHONEDEV_H | 2 | #define __LINUX_PHONEDEV_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/version.h> | ||
| 6 | 5 | ||
| 7 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
| 8 | 7 | ||
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 60ffcb9c5791..e87b233615b3 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
| @@ -93,6 +93,7 @@ struct tc_fifo_qopt | |||
| 93 | /* PRIO section */ | 93 | /* PRIO section */ |
| 94 | 94 | ||
| 95 | #define TCQ_PRIO_BANDS 16 | 95 | #define TCQ_PRIO_BANDS 16 |
| 96 | #define TCQ_MIN_PRIO_BANDS 2 | ||
| 96 | 97 | ||
| 97 | struct tc_prio_qopt | 98 | struct tc_prio_qopt |
| 98 | { | 99 | { |
| @@ -169,6 +170,7 @@ struct tc_red_qopt | |||
| 169 | unsigned char Scell_log; /* cell size for idle damping */ | 170 | unsigned char Scell_log; /* cell size for idle damping */ |
| 170 | unsigned char flags; | 171 | unsigned char flags; |
| 171 | #define TC_RED_ECN 1 | 172 | #define TC_RED_ECN 1 |
| 173 | #define TC_RED_HARDDROP 2 | ||
| 172 | }; | 174 | }; |
| 173 | 175 | ||
| 174 | struct tc_red_xstats | 176 | struct tc_red_xstats |
| @@ -194,38 +196,34 @@ enum | |||
| 194 | 196 | ||
| 195 | #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) | 197 | #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) |
| 196 | 198 | ||
| 197 | #define TCA_SET_OFF TCA_GRED_PARMS | ||
| 198 | struct tc_gred_qopt | 199 | struct tc_gred_qopt |
| 199 | { | 200 | { |
| 200 | __u32 limit; /* HARD maximal queue length (bytes) | 201 | __u32 limit; /* HARD maximal queue length (bytes) */ |
| 201 | */ | 202 | __u32 qth_min; /* Min average length threshold (bytes) */ |
| 202 | __u32 qth_min; /* Min average length threshold (bytes) | 203 | __u32 qth_max; /* Max average length threshold (bytes) */ |
| 203 | */ | 204 | __u32 DP; /* upto 2^32 DPs */ |
| 204 | __u32 qth_max; /* Max average length threshold (bytes) | 205 | __u32 backlog; |
| 205 | */ | 206 | __u32 qave; |
| 206 | __u32 DP; /* upto 2^32 DPs */ | 207 | __u32 forced; |
| 207 | __u32 backlog; | 208 | __u32 early; |
| 208 | __u32 qave; | 209 | __u32 other; |
| 209 | __u32 forced; | 210 | __u32 pdrop; |
| 210 | __u32 early; | 211 | __u8 Wlog; /* log(W) */ |
| 211 | __u32 other; | 212 | __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ |
| 212 | __u32 pdrop; | 213 | __u8 Scell_log; /* cell size for idle damping */ |
| 213 | 214 | __u8 prio; /* prio of this VQ */ | |
| 214 | unsigned char Wlog; /* log(W) */ | 215 | __u32 packets; |
| 215 | unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ | 216 | __u32 bytesin; |
| 216 | unsigned char Scell_log; /* cell size for idle damping */ | ||
| 217 | __u8 prio; /* prio of this VQ */ | ||
| 218 | __u32 packets; | ||
| 219 | __u32 bytesin; | ||
| 220 | }; | 217 | }; |
| 218 | |||
| 221 | /* gred setup */ | 219 | /* gred setup */ |
| 222 | struct tc_gred_sopt | 220 | struct tc_gred_sopt |
| 223 | { | 221 | { |
| 224 | __u32 DPs; | 222 | __u32 DPs; |
| 225 | __u32 def_DP; | 223 | __u32 def_DP; |
| 226 | __u8 grio; | 224 | __u8 grio; |
| 227 | __u8 pad1; | 225 | __u8 flags; |
| 228 | __u16 pad2; | 226 | __u16 pad1; |
| 229 | }; | 227 | }; |
| 230 | 228 | ||
| 231 | /* HTB section */ | 229 | /* HTB section */ |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index a726225e0afe..1a165b7ae01b 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -37,4 +37,10 @@ extern int platform_add_devices(struct platform_device **, int); | |||
| 37 | 37 | ||
| 38 | extern struct platform_device *platform_device_register_simple(char *, unsigned int, struct resource *, unsigned int); | 38 | extern struct platform_device *platform_device_register_simple(char *, unsigned int, struct resource *, unsigned int); |
| 39 | 39 | ||
| 40 | extern struct platform_device *platform_device_alloc(const char *name, unsigned int id); | ||
| 41 | extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); | ||
| 42 | extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size); | ||
| 43 | extern int platform_device_add(struct platform_device *pdev); | ||
| 44 | extern void platform_device_put(struct platform_device *pdev); | ||
| 45 | |||
| 40 | #endif /* _PLATFORM_DEVICE_H_ */ | 46 | #endif /* _PLATFORM_DEVICE_H_ */ |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index aadbac29103c..584d57cb393a 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
| @@ -353,7 +353,6 @@ struct pnp_protocol { | |||
| 353 | int pnp_register_protocol(struct pnp_protocol *protocol); | 353 | int pnp_register_protocol(struct pnp_protocol *protocol); |
| 354 | void pnp_unregister_protocol(struct pnp_protocol *protocol); | 354 | void pnp_unregister_protocol(struct pnp_protocol *protocol); |
| 355 | int pnp_add_device(struct pnp_dev *dev); | 355 | int pnp_add_device(struct pnp_dev *dev); |
| 356 | void pnp_remove_device(struct pnp_dev *dev); | ||
| 357 | int pnp_device_attach(struct pnp_dev *pnp_dev); | 356 | int pnp_device_attach(struct pnp_dev *pnp_dev); |
| 358 | void pnp_device_detach(struct pnp_dev *pnp_dev); | 357 | void pnp_device_detach(struct pnp_dev *pnp_dev); |
| 359 | extern struct list_head pnp_global; | 358 | extern struct list_head pnp_global; |
| @@ -399,7 +398,6 @@ static inline int pnp_register_protocol(struct pnp_protocol *protocol) { return | |||
| 399 | static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { } | 398 | static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { } |
| 400 | static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } | 399 | static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } |
| 401 | static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } | 400 | static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } |
| 402 | static inline void pnp_remove_device(struct pnp_dev *dev) { } | ||
| 403 | static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } | 401 | static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } |
| 404 | static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } | 402 | static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } |
| 405 | 403 | ||
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h index 7227e653b3be..e86a7a5cf355 100644 --- a/include/linux/ppp-comp.h +++ b/include/linux/ppp-comp.h | |||
| @@ -111,6 +111,8 @@ struct compressor { | |||
| 111 | 111 | ||
| 112 | /* Used in locking compressor modules */ | 112 | /* Used in locking compressor modules */ |
| 113 | struct module *owner; | 113 | struct module *owner; |
| 114 | /* Extra skb space needed by the compressor algorithm */ | ||
| 115 | unsigned int comp_extra; | ||
| 114 | }; | 116 | }; |
| 115 | 117 | ||
| 116 | /* | 118 | /* |
| @@ -191,6 +193,13 @@ struct compressor { | |||
| 191 | #define DEFLATE_CHK_SEQUENCE 0 | 193 | #define DEFLATE_CHK_SEQUENCE 0 |
| 192 | 194 | ||
| 193 | /* | 195 | /* |
| 196 | * Definitions for MPPE. | ||
| 197 | */ | ||
| 198 | |||
| 199 | #define CI_MPPE 18 /* config option for MPPE */ | ||
| 200 | #define CILEN_MPPE 6 /* length of config option */ | ||
| 201 | |||
| 202 | /* | ||
| 194 | * Definitions for other, as yet unsupported, compression methods. | 203 | * Definitions for other, as yet unsupported, compression methods. |
| 195 | */ | 204 | */ |
| 196 | 205 | ||
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 0563581e3a02..74488e49166d 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
| @@ -66,6 +66,7 @@ struct proc_dir_entry { | |||
| 66 | write_proc_t *write_proc; | 66 | write_proc_t *write_proc; |
| 67 | atomic_t count; /* use count */ | 67 | atomic_t count; /* use count */ |
| 68 | int deleted; /* delete flag */ | 68 | int deleted; /* delete flag */ |
| 69 | void *set; | ||
| 69 | }; | 70 | }; |
| 70 | 71 | ||
| 71 | struct kcore_list { | 72 | struct kcore_list { |
| @@ -139,15 +140,12 @@ extern void proc_tty_unregister_driver(struct tty_driver *driver); | |||
| 139 | /* | 140 | /* |
| 140 | * proc_devtree.c | 141 | * proc_devtree.c |
| 141 | */ | 142 | */ |
| 143 | #ifdef CONFIG_PROC_DEVICETREE | ||
| 142 | struct device_node; | 144 | struct device_node; |
| 145 | struct property; | ||
| 143 | extern void proc_device_tree_init(void); | 146 | extern void proc_device_tree_init(void); |
| 144 | #ifdef CONFIG_PROC_DEVICETREE | ||
| 145 | extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); | 147 | extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); |
| 146 | #else /* !CONFIG_PROC_DEVICETREE */ | 148 | extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); |
| 147 | static inline void proc_device_tree_add_node(struct device_node *np, struct proc_dir_entry *pde) | ||
| 148 | { | ||
| 149 | return; | ||
| 150 | } | ||
| 151 | #endif /* CONFIG_PROC_DEVICETREE */ | 149 | #endif /* CONFIG_PROC_DEVICETREE */ |
| 152 | 150 | ||
| 153 | extern struct proc_dir_entry *proc_symlink(const char *, | 151 | extern struct proc_dir_entry *proc_symlink(const char *, |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index dc6f3647bfbc..b2b3dba1298d 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -78,6 +78,8 @@ | |||
| 78 | #include <linux/compiler.h> /* For unlikely. */ | 78 | #include <linux/compiler.h> /* For unlikely. */ |
| 79 | #include <linux/sched.h> /* For struct task_struct. */ | 79 | #include <linux/sched.h> /* For struct task_struct. */ |
| 80 | 80 | ||
| 81 | |||
| 82 | extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); | ||
| 81 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); | 83 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); |
| 82 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); | 84 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); |
| 83 | extern int ptrace_attach(struct task_struct *tsk); | 85 | extern int ptrace_attach(struct task_struct *tsk); |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 700ead45084f..f33aeb22c26a 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
| @@ -289,7 +289,6 @@ struct quota_info { | |||
| 289 | struct semaphore dqonoff_sem; /* Serialize quotaon & quotaoff */ | 289 | struct semaphore dqonoff_sem; /* Serialize quotaon & quotaoff */ |
| 290 | struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ | 290 | struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ |
| 291 | struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ | 291 | struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ |
| 292 | struct vfsmount *mnt[MAXQUOTAS]; /* mountpoint entries of filesystems with quota files */ | ||
| 293 | struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ | 292 | struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ |
| 294 | struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ | 293 | struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ |
| 295 | }; | 294 | }; |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index d211507ab246..4f34d3d60f2e 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
| @@ -198,38 +198,38 @@ static __inline__ int DQUOT_OFF(struct super_block *sb) | |||
| 198 | #define DQUOT_SYNC(sb) do { } while(0) | 198 | #define DQUOT_SYNC(sb) do { } while(0) |
| 199 | #define DQUOT_OFF(sb) do { } while(0) | 199 | #define DQUOT_OFF(sb) do { } while(0) |
| 200 | #define DQUOT_TRANSFER(inode, iattr) (0) | 200 | #define DQUOT_TRANSFER(inode, iattr) (0) |
| 201 | extern __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 201 | static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) |
| 202 | { | 202 | { |
| 203 | inode_add_bytes(inode, nr); | 203 | inode_add_bytes(inode, nr); |
| 204 | return 0; | 204 | return 0; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | extern __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) | 207 | static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) |
| 208 | { | 208 | { |
| 209 | DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr); | 209 | DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr); |
| 210 | mark_inode_dirty(inode); | 210 | mark_inode_dirty(inode); |
| 211 | return 0; | 211 | return 0; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | extern __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 214 | static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) |
| 215 | { | 215 | { |
| 216 | inode_add_bytes(inode, nr); | 216 | inode_add_bytes(inode, nr); |
| 217 | return 0; | 217 | return 0; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | extern __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) | 220 | static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) |
| 221 | { | 221 | { |
| 222 | DQUOT_ALLOC_SPACE_NODIRTY(inode, nr); | 222 | DQUOT_ALLOC_SPACE_NODIRTY(inode, nr); |
| 223 | mark_inode_dirty(inode); | 223 | mark_inode_dirty(inode); |
| 224 | return 0; | 224 | return 0; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | extern __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 227 | static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) |
| 228 | { | 228 | { |
| 229 | inode_sub_bytes(inode, nr); | 229 | inode_sub_bytes(inode, nr); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | extern __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) | 232 | static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) |
| 233 | { | 233 | { |
| 234 | DQUOT_FREE_SPACE_NODIRTY(inode, nr); | 234 | DQUOT_FREE_SPACE_NODIRTY(inode, nr); |
| 235 | mark_inode_dirty(inode); | 235 | mark_inode_dirty(inode); |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 9f0f9281f42a..36e5d269612f 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
| @@ -46,6 +46,7 @@ do { \ | |||
| 46 | 46 | ||
| 47 | int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); | 47 | int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); |
| 48 | void *radix_tree_lookup(struct radix_tree_root *, unsigned long); | 48 | void *radix_tree_lookup(struct radix_tree_root *, unsigned long); |
| 49 | void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); | ||
| 49 | void *radix_tree_delete(struct radix_tree_root *, unsigned long); | 50 | void *radix_tree_delete(struct radix_tree_root *, unsigned long); |
| 50 | unsigned int | 51 | unsigned int |
| 51 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | 52 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, |
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 9de99198caf1..899437802aea 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
| @@ -6,7 +6,13 @@ | |||
| 6 | #ifndef BITMAP_H | 6 | #ifndef BITMAP_H |
| 7 | #define BITMAP_H 1 | 7 | #define BITMAP_H 1 |
| 8 | 8 | ||
| 9 | #define BITMAP_MAJOR 3 | 9 | #define BITMAP_MAJOR_LO 3 |
| 10 | /* version 4 insists the bitmap is in little-endian order | ||
| 11 | * with version 3, it is host-endian which is non-portable | ||
| 12 | */ | ||
| 13 | #define BITMAP_MAJOR_HI 4 | ||
| 14 | #define BITMAP_MAJOR_HOSTENDIAN 3 | ||
| 15 | |||
| 10 | #define BITMAP_MINOR 39 | 16 | #define BITMAP_MINOR 39 |
| 11 | 17 | ||
| 12 | /* | 18 | /* |
| @@ -133,7 +139,8 @@ typedef __u16 bitmap_counter_t; | |||
| 133 | /* use these for bitmap->flags and bitmap->sb->state bit-fields */ | 139 | /* use these for bitmap->flags and bitmap->sb->state bit-fields */ |
| 134 | enum bitmap_state { | 140 | enum bitmap_state { |
| 135 | BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ | 141 | BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ |
| 136 | BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */ | 142 | BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */ |
| 143 | BITMAP_HOSTENDIAN = 0x8000, | ||
| 137 | }; | 144 | }; |
| 138 | 145 | ||
| 139 | /* the superblock at the front of the bitmap file -- little endian */ | 146 | /* the superblock at the front of the bitmap file -- little endian */ |
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index ffa316ce4dc8..13e7c4b62367 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h | |||
| @@ -66,8 +66,10 @@ | |||
| 66 | * and major_version/minor_version accordingly | 66 | * and major_version/minor_version accordingly |
| 67 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT | 67 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT |
| 68 | * in the super status byte | 68 | * in the super status byte |
| 69 | * >=3 means that bitmap superblock version 4 is supported, which uses | ||
| 70 | * little-ending representation rather than host-endian | ||
| 69 | */ | 71 | */ |
| 70 | #define MD_PATCHLEVEL_VERSION 2 | 72 | #define MD_PATCHLEVEL_VERSION 3 |
| 71 | 73 | ||
| 72 | extern int register_md_personality (int p_num, mdk_personality_t *p); | 74 | extern int register_md_personality (int p_num, mdk_personality_t *p); |
| 73 | extern int unregister_md_personality (int p_num); | 75 | extern int unregister_md_personality (int p_num); |
| @@ -87,6 +89,7 @@ extern void md_print_devices (void); | |||
| 87 | 89 | ||
| 88 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | 90 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, |
| 89 | sector_t sector, int size, struct page *page); | 91 | sector_t sector, int size, struct page *page); |
| 92 | extern void md_super_wait(mddev_t *mddev); | ||
| 90 | extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, | 93 | extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, |
| 91 | struct page *page, int rw); | 94 | struct page *page, int rw); |
| 92 | 95 | ||
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index ebce949b1443..46629a275ba9 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
| @@ -105,6 +105,8 @@ struct mdk_rdev_s | |||
| 105 | int sb_size; /* bytes in the superblock */ | 105 | int sb_size; /* bytes in the superblock */ |
| 106 | int preferred_minor; /* autorun support */ | 106 | int preferred_minor; /* autorun support */ |
| 107 | 107 | ||
| 108 | struct kobject kobj; | ||
| 109 | |||
| 108 | /* A device can be in one of three states based on two flags: | 110 | /* A device can be in one of three states based on two flags: |
| 109 | * Not working: faulty==1 in_sync==0 | 111 | * Not working: faulty==1 in_sync==0 |
| 110 | * Fully working: faulty==0 in_sync==1 | 112 | * Fully working: faulty==0 in_sync==1 |
| @@ -115,11 +117,12 @@ struct mdk_rdev_s | |||
| 115 | * It can never have faulty==1, in_sync==1 | 117 | * It can never have faulty==1, in_sync==1 |
| 116 | * This reduces the burden of testing multiple flags in many cases | 118 | * This reduces the burden of testing multiple flags in many cases |
| 117 | */ | 119 | */ |
| 118 | int faulty; /* if faulty do not issue IO requests */ | ||
| 119 | int in_sync; /* device is a full member of the array */ | ||
| 120 | 120 | ||
| 121 | unsigned long flags; /* Should include faulty and in_sync here. */ | 121 | unsigned long flags; |
| 122 | #define Faulty 1 /* device is known to have a fault */ | ||
| 123 | #define In_sync 2 /* device is in_sync with rest of array */ | ||
| 122 | #define WriteMostly 4 /* Avoid reading if at all possible */ | 124 | #define WriteMostly 4 /* Avoid reading if at all possible */ |
| 125 | #define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */ | ||
| 123 | 126 | ||
| 124 | int desc_nr; /* descriptor index in the superblock */ | 127 | int desc_nr; /* descriptor index in the superblock */ |
| 125 | int raid_disk; /* role of device in array */ | 128 | int raid_disk; /* role of device in array */ |
| @@ -132,6 +135,9 @@ struct mdk_rdev_s | |||
| 132 | * only maintained for arrays that | 135 | * only maintained for arrays that |
| 133 | * support hot removal | 136 | * support hot removal |
| 134 | */ | 137 | */ |
| 138 | atomic_t read_errors; /* number of consecutive read errors that | ||
| 139 | * we have tried to ignore. | ||
| 140 | */ | ||
| 135 | }; | 141 | }; |
| 136 | 142 | ||
| 137 | typedef struct mdk_personality_s mdk_personality_t; | 143 | typedef struct mdk_personality_s mdk_personality_t; |
| @@ -148,6 +154,8 @@ struct mddev_s | |||
| 148 | 154 | ||
| 149 | struct gendisk *gendisk; | 155 | struct gendisk *gendisk; |
| 150 | 156 | ||
| 157 | struct kobject kobj; | ||
| 158 | |||
| 151 | /* Superblock information */ | 159 | /* Superblock information */ |
| 152 | int major_version, | 160 | int major_version, |
| 153 | minor_version, | 161 | minor_version, |
| @@ -171,6 +179,10 @@ struct mddev_s | |||
| 171 | sector_t resync_mark_cnt;/* blocks written at resync_mark */ | 179 | sector_t resync_mark_cnt;/* blocks written at resync_mark */ |
| 172 | 180 | ||
| 173 | sector_t resync_max_sectors; /* may be set by personality */ | 181 | sector_t resync_max_sectors; /* may be set by personality */ |
| 182 | |||
| 183 | sector_t resync_mismatches; /* count of sectors where | ||
| 184 | * parity/replica mismatch found | ||
| 185 | */ | ||
| 174 | /* recovery/resync flags | 186 | /* recovery/resync flags |
| 175 | * NEEDED: we might need to start a resync/recover | 187 | * NEEDED: we might need to start a resync/recover |
| 176 | * RUNNING: a thread is running, or about to be started | 188 | * RUNNING: a thread is running, or about to be started |
| @@ -178,6 +190,8 @@ struct mddev_s | |||
| 178 | * ERR: and IO error was detected - abort the resync/recovery | 190 | * ERR: and IO error was detected - abort the resync/recovery |
| 179 | * INTR: someone requested a (clean) early abort. | 191 | * INTR: someone requested a (clean) early abort. |
| 180 | * DONE: thread is done and is waiting to be reaped | 192 | * DONE: thread is done and is waiting to be reaped |
| 193 | * REQUEST: user-space has requested a sync (used with SYNC) | ||
| 194 | * CHECK: user-space request for for check-only, no repair | ||
| 181 | */ | 195 | */ |
| 182 | #define MD_RECOVERY_RUNNING 0 | 196 | #define MD_RECOVERY_RUNNING 0 |
| 183 | #define MD_RECOVERY_SYNC 1 | 197 | #define MD_RECOVERY_SYNC 1 |
| @@ -185,6 +199,8 @@ struct mddev_s | |||
| 185 | #define MD_RECOVERY_INTR 3 | 199 | #define MD_RECOVERY_INTR 3 |
| 186 | #define MD_RECOVERY_DONE 4 | 200 | #define MD_RECOVERY_DONE 4 |
| 187 | #define MD_RECOVERY_NEEDED 5 | 201 | #define MD_RECOVERY_NEEDED 5 |
| 202 | #define MD_RECOVERY_REQUESTED 6 | ||
| 203 | #define MD_RECOVERY_CHECK 7 | ||
| 188 | unsigned long recovery; | 204 | unsigned long recovery; |
| 189 | 205 | ||
| 190 | int in_sync; /* know to not need resync */ | 206 | int in_sync; /* know to not need resync */ |
| @@ -195,6 +211,13 @@ struct mddev_s | |||
| 195 | int degraded; /* whether md should consider | 211 | int degraded; /* whether md should consider |
| 196 | * adding a spare | 212 | * adding a spare |
| 197 | */ | 213 | */ |
| 214 | int barriers_work; /* initialised to true, cleared as soon | ||
| 215 | * as a barrier request to slave | ||
| 216 | * fails. Only supported | ||
| 217 | */ | ||
| 218 | struct bio *biolist; /* bios that need to be retried | ||
| 219 | * because BIO_RW_BARRIER is not supported | ||
| 220 | */ | ||
| 198 | 221 | ||
| 199 | atomic_t recovery_active; /* blocks scheduled, but not written */ | 222 | atomic_t recovery_active; /* blocks scheduled, but not written */ |
| 200 | wait_queue_head_t recovery_wait; | 223 | wait_queue_head_t recovery_wait; |
| @@ -232,7 +255,7 @@ struct mddev_s | |||
| 232 | 255 | ||
| 233 | static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) | 256 | static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) |
| 234 | { | 257 | { |
| 235 | int faulty = rdev->faulty; | 258 | int faulty = test_bit(Faulty, &rdev->flags); |
| 236 | if (atomic_dec_and_test(&rdev->nr_pending) && faulty) | 259 | if (atomic_dec_and_test(&rdev->nr_pending) && faulty) |
| 237 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 260 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
| 238 | } | 261 | } |
| @@ -270,6 +293,13 @@ struct mdk_personality_s | |||
| 270 | }; | 293 | }; |
| 271 | 294 | ||
| 272 | 295 | ||
| 296 | struct md_sysfs_entry { | ||
| 297 | struct attribute attr; | ||
| 298 | ssize_t (*show)(mddev_t *, char *); | ||
| 299 | ssize_t (*store)(mddev_t *, const char *, size_t); | ||
| 300 | }; | ||
| 301 | |||
| 302 | |||
| 273 | static inline char * mdname (mddev_t * mddev) | 303 | static inline char * mdname (mddev_t * mddev) |
| 274 | { | 304 | { |
| 275 | return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; | 305 | return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; |
| @@ -304,10 +334,8 @@ typedef struct mdk_thread_s { | |||
| 304 | mddev_t *mddev; | 334 | mddev_t *mddev; |
| 305 | wait_queue_head_t wqueue; | 335 | wait_queue_head_t wqueue; |
| 306 | unsigned long flags; | 336 | unsigned long flags; |
| 307 | struct completion *event; | ||
| 308 | struct task_struct *tsk; | 337 | struct task_struct *tsk; |
| 309 | unsigned long timeout; | 338 | unsigned long timeout; |
| 310 | const char *name; | ||
| 311 | } mdk_thread_t; | 339 | } mdk_thread_t; |
| 312 | 340 | ||
| 313 | #define THREAD_WAKEUP 0 | 341 | #define THREAD_WAKEUP 0 |
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 60e19b667548..292b98f2b408 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h | |||
| @@ -110,7 +110,9 @@ struct r1bio_s { | |||
| 110 | #define R1BIO_Uptodate 0 | 110 | #define R1BIO_Uptodate 0 |
| 111 | #define R1BIO_IsSync 1 | 111 | #define R1BIO_IsSync 1 |
| 112 | #define R1BIO_Degraded 2 | 112 | #define R1BIO_Degraded 2 |
| 113 | #define R1BIO_BehindIO 3 | 113 | #define R1BIO_BehindIO 3 |
| 114 | #define R1BIO_Barrier 4 | ||
| 115 | #define R1BIO_BarrierRetry 5 | ||
| 114 | /* For write-behind requests, we call bi_end_io when | 116 | /* For write-behind requests, we call bi_end_io when |
| 115 | * the last non-write-behind device completes, providing | 117 | * the last non-write-behind device completes, providing |
| 116 | * any write was successful. Otherwise we call when | 118 | * any write was successful. Otherwise we call when |
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index 176fc653c284..f025ba6fb14c 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
| @@ -154,6 +154,8 @@ struct stripe_head { | |||
| 154 | #define R5_Wantwrite 5 | 154 | #define R5_Wantwrite 5 |
| 155 | #define R5_Syncio 6 /* this io need to be accounted as resync io */ | 155 | #define R5_Syncio 6 /* this io need to be accounted as resync io */ |
| 156 | #define R5_Overlap 7 /* There is a pending overlapping request on this block */ | 156 | #define R5_Overlap 7 /* There is a pending overlapping request on this block */ |
| 157 | #define R5_ReadError 8 /* seen a read error here recently */ | ||
| 158 | #define R5_ReWrite 9 /* have tried to over-write the readerror */ | ||
| 157 | 159 | ||
| 158 | /* | 160 | /* |
| 159 | * Write method | 161 | * Write method |
diff --git a/include/linux/rio.h b/include/linux/rio.h new file mode 100644 index 000000000000..c7e907faae9c --- /dev/null +++ b/include/linux/rio.h | |||
| @@ -0,0 +1,325 @@ | |||
| 1 | /* | ||
| 2 | * RapidIO interconnect services | ||
| 3 | * (RapidIO Interconnect Specification, http://www.rapidio.org) | ||
| 4 | * | ||
| 5 | * Copyright 2005 MontaVista Software, Inc. | ||
| 6 | * Matt Porter <mporter@kernel.crashing.org> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef LINUX_RIO_H | ||
| 15 | #define LINUX_RIO_H | ||
| 16 | |||
| 17 | #ifdef __KERNEL__ | ||
| 18 | |||
| 19 | #include <linux/types.h> | ||
| 20 | #include <linux/config.h> | ||
| 21 | #include <linux/ioport.h> | ||
| 22 | #include <linux/list.h> | ||
| 23 | #include <linux/errno.h> | ||
| 24 | #include <linux/device.h> | ||
| 25 | #include <linux/rio_regs.h> | ||
| 26 | |||
| 27 | #define RIO_ANY_DESTID 0xff | ||
| 28 | #define RIO_NO_HOPCOUNT -1 | ||
| 29 | |||
| 30 | #define RIO_MAX_MPORT_RESOURCES 16 | ||
| 31 | #define RIO_MAX_DEV_RESOURCES 16 | ||
| 32 | |||
| 33 | #define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's | ||
| 34 | global routing table if it | ||
| 35 | has multiple (or per port) | ||
| 36 | tables */ | ||
| 37 | |||
| 38 | #define RIO_INVALID_ROUTE 0xff /* Indicates that a route table | ||
| 39 | entry is invalid (no route | ||
| 40 | exists for the device ID) */ | ||
| 41 | |||
| 42 | #ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT | ||
| 43 | #define RIO_MAX_ROUTE_ENTRIES (1 << 8) | ||
| 44 | #else | ||
| 45 | #define RIO_MAX_ROUTE_ENTRIES (1 << 16) | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #define RIO_MAX_MBOX 4 | ||
| 49 | #define RIO_MAX_MSG_SIZE 0x1000 | ||
| 50 | |||
| 51 | /* | ||
| 52 | * Error values that may be returned by RIO functions. | ||
| 53 | */ | ||
| 54 | #define RIO_SUCCESSFUL 0x00 | ||
| 55 | #define RIO_BAD_SIZE 0x81 | ||
| 56 | |||
| 57 | /* | ||
| 58 | * For RIO devices, the region numbers are assigned this way: | ||
| 59 | * | ||
| 60 | * 0 RapidIO outbound doorbells | ||
| 61 | * 1-15 RapidIO memory regions | ||
| 62 | * | ||
| 63 | * For RIO master ports, the region number are assigned this way: | ||
| 64 | * | ||
| 65 | * 0 RapidIO inbound doorbells | ||
| 66 | * 1 RapidIO inbound mailboxes | ||
| 67 | * 1 RapidIO outbound mailboxes | ||
| 68 | */ | ||
| 69 | #define RIO_DOORBELL_RESOURCE 0 | ||
| 70 | #define RIO_INB_MBOX_RESOURCE 1 | ||
| 71 | #define RIO_OUTB_MBOX_RESOURCE 2 | ||
| 72 | |||
| 73 | extern struct bus_type rio_bus_type; | ||
| 74 | extern struct list_head rio_devices; /* list of all devices */ | ||
| 75 | |||
| 76 | struct rio_mport; | ||
| 77 | |||
| 78 | /** | ||
| 79 | * struct rio_dev - RIO device info | ||
| 80 | * @global_list: Node in list of all RIO devices | ||
| 81 | * @net_list: Node in list of RIO devices in a network | ||
| 82 | * @net: Network this device is a part of | ||
| 83 | * @did: Device ID | ||
| 84 | * @vid: Vendor ID | ||
| 85 | * @device_rev: Device revision | ||
| 86 | * @asm_did: Assembly device ID | ||
| 87 | * @asm_vid: Assembly vendor ID | ||
| 88 | * @asm_rev: Assembly revision | ||
| 89 | * @efptr: Extended feature pointer | ||
| 90 | * @pef: Processing element features | ||
| 91 | * @swpinfo: Switch port info | ||
| 92 | * @src_ops: Source operation capabilities | ||
| 93 | * @dst_ops: Destination operation capabilities | ||
| 94 | * @dma_mask: Mask of bits of RIO address this device implements | ||
| 95 | * @rswitch: Pointer to &struct rio_switch if valid for this device | ||
| 96 | * @driver: Driver claiming this device | ||
| 97 | * @dev: Device model device | ||
| 98 | * @riores: RIO resources this device owns | ||
| 99 | * @destid: Network destination ID | ||
| 100 | */ | ||
| 101 | struct rio_dev { | ||
| 102 | struct list_head global_list; /* node in list of all RIO devices */ | ||
| 103 | struct list_head net_list; /* node in per net list */ | ||
| 104 | struct rio_net *net; /* RIO net this device resides in */ | ||
| 105 | u16 did; | ||
| 106 | u16 vid; | ||
| 107 | u32 device_rev; | ||
| 108 | u16 asm_did; | ||
| 109 | u16 asm_vid; | ||
| 110 | u16 asm_rev; | ||
| 111 | u16 efptr; | ||
| 112 | u32 pef; | ||
| 113 | u32 swpinfo; /* Only used for switches */ | ||
| 114 | u32 src_ops; | ||
| 115 | u32 dst_ops; | ||
| 116 | u64 dma_mask; | ||
| 117 | struct rio_switch *rswitch; /* RIO switch info */ | ||
| 118 | struct rio_driver *driver; /* RIO driver claiming this device */ | ||
| 119 | struct device dev; /* LDM device structure */ | ||
| 120 | struct resource riores[RIO_MAX_DEV_RESOURCES]; | ||
| 121 | u16 destid; | ||
| 122 | }; | ||
| 123 | |||
| 124 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) | ||
| 125 | #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) | ||
| 126 | #define to_rio_dev(n) container_of(n, struct rio_dev, dev) | ||
| 127 | |||
| 128 | /** | ||
| 129 | * struct rio_msg - RIO message event | ||
| 130 | * @res: Mailbox resource | ||
| 131 | * @mcback: Message event callback | ||
| 132 | */ | ||
| 133 | struct rio_msg { | ||
| 134 | struct resource *res; | ||
| 135 | void (*mcback) (struct rio_mport * mport, void *dev_id, int mbox, int slot); | ||
| 136 | }; | ||
| 137 | |||
| 138 | /** | ||
| 139 | * struct rio_dbell - RIO doorbell event | ||
| 140 | * @node: Node in list of doorbell events | ||
| 141 | * @res: Doorbell resource | ||
| 142 | * @dinb: Doorbell event callback | ||
| 143 | * @dev_id: Device specific pointer to pass on event | ||
| 144 | */ | ||
| 145 | struct rio_dbell { | ||
| 146 | struct list_head node; | ||
| 147 | struct resource *res; | ||
| 148 | void (*dinb) (struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info); | ||
| 149 | void *dev_id; | ||
| 150 | }; | ||
| 151 | |||
| 152 | /** | ||
| 153 | * struct rio_mport - RIO master port info | ||
| 154 | * @dbells: List of doorbell events | ||
| 155 | * @node: Node in global list of master ports | ||
| 156 | * @nnode: Node in network list of master ports | ||
| 157 | * @iores: I/O mem resource that this master port interface owns | ||
| 158 | * @riores: RIO resources that this master port interfaces owns | ||
| 159 | * @inb_msg: RIO inbound message event descriptors | ||
| 160 | * @outb_msg: RIO outbound message event descriptors | ||
| 161 | * @host_deviceid: Host device ID associated with this master port | ||
| 162 | * @ops: configuration space functions | ||
| 163 | * @id: Port ID, unique among all ports | ||
| 164 | * @index: Port index, unique among all port interfaces of the same type | ||
| 165 | * @name: Port name string | ||
| 166 | */ | ||
| 167 | struct rio_mport { | ||
| 168 | struct list_head dbells; /* list of doorbell events */ | ||
| 169 | struct list_head node; /* node in global list of ports */ | ||
| 170 | struct list_head nnode; /* node in net list of ports */ | ||
| 171 | struct resource iores; | ||
| 172 | struct resource riores[RIO_MAX_MPORT_RESOURCES]; | ||
| 173 | struct rio_msg inb_msg[RIO_MAX_MBOX]; | ||
| 174 | struct rio_msg outb_msg[RIO_MAX_MBOX]; | ||
| 175 | int host_deviceid; /* Host device ID */ | ||
| 176 | struct rio_ops *ops; /* maintenance transaction functions */ | ||
| 177 | unsigned char id; /* port ID, unique among all ports */ | ||
| 178 | unsigned char index; /* port index, unique among all port | ||
| 179 | interfaces of the same type */ | ||
| 180 | unsigned char name[40]; | ||
| 181 | }; | ||
| 182 | |||
| 183 | /** | ||
| 184 | * struct rio_net - RIO network info | ||
| 185 | * @node: Node in global list of RIO networks | ||
| 186 | * @devices: List of devices in this network | ||
| 187 | * @mports: List of master ports accessing this network | ||
| 188 | * @hport: Default port for accessing this network | ||
| 189 | * @id: RIO network ID | ||
| 190 | */ | ||
| 191 | struct rio_net { | ||
| 192 | struct list_head node; /* node in list of networks */ | ||
| 193 | struct list_head devices; /* list of devices in this net */ | ||
| 194 | struct list_head mports; /* list of ports accessing net */ | ||
| 195 | struct rio_mport *hport; /* primary port for accessing net */ | ||
| 196 | unsigned char id; /* RIO network ID */ | ||
| 197 | }; | ||
| 198 | |||
| 199 | /** | ||
| 200 | * struct rio_switch - RIO switch info | ||
| 201 | * @node: Node in global list of switches | ||
| 202 | * @switchid: Switch ID that is unique across a network | ||
| 203 | * @hopcount: Hopcount to this switch | ||
| 204 | * @destid: Associated destid in the path | ||
| 205 | * @route_table: Copy of switch routing table | ||
| 206 | * @add_entry: Callback for switch-specific route add function | ||
| 207 | * @get_entry: Callback for switch-specific route get function | ||
| 208 | */ | ||
| 209 | struct rio_switch { | ||
| 210 | struct list_head node; | ||
| 211 | u16 switchid; | ||
| 212 | u16 hopcount; | ||
| 213 | u16 destid; | ||
| 214 | u8 route_table[RIO_MAX_ROUTE_ENTRIES]; | ||
| 215 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
| 216 | u16 table, u16 route_destid, u8 route_port); | ||
| 217 | int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
| 218 | u16 table, u16 route_destid, u8 * route_port); | ||
| 219 | }; | ||
| 220 | |||
| 221 | /* Low-level architecture-dependent routines */ | ||
| 222 | |||
| 223 | /** | ||
| 224 | * struct rio_ops - Low-level RIO configuration space operations | ||
| 225 | * @lcread: Callback to perform local (master port) read of config space. | ||
| 226 | * @lcwrite: Callback to perform local (master port) write of config space. | ||
| 227 | * @cread: Callback to perform network read of config space. | ||
| 228 | * @cwrite: Callback to perform network write of config space. | ||
| 229 | * @dsend: Callback to send a doorbell message. | ||
| 230 | */ | ||
| 231 | struct rio_ops { | ||
| 232 | int (*lcread) (int index, u32 offset, int len, u32 * data); | ||
| 233 | int (*lcwrite) (int index, u32 offset, int len, u32 data); | ||
| 234 | int (*cread) (int index, u16 destid, u8 hopcount, u32 offset, int len, | ||
| 235 | u32 * data); | ||
| 236 | int (*cwrite) (int index, u16 destid, u8 hopcount, u32 offset, int len, | ||
| 237 | u32 data); | ||
| 238 | int (*dsend) (int index, u16 destid, u16 data); | ||
| 239 | }; | ||
| 240 | |||
| 241 | #define RIO_RESOURCE_MEM 0x00000100 | ||
| 242 | #define RIO_RESOURCE_DOORBELL 0x00000200 | ||
| 243 | #define RIO_RESOURCE_MAILBOX 0x00000400 | ||
| 244 | |||
| 245 | #define RIO_RESOURCE_CACHEABLE 0x00010000 | ||
| 246 | #define RIO_RESOURCE_PCI 0x00020000 | ||
| 247 | |||
| 248 | #define RIO_RESOURCE_BUSY 0x80000000 | ||
| 249 | |||
| 250 | /** | ||
| 251 | * struct rio_driver - RIO driver info | ||
| 252 | * @node: Node in list of drivers | ||
| 253 | * @name: RIO driver name | ||
| 254 | * @id_table: RIO device ids to be associated with this driver | ||
| 255 | * @probe: RIO device inserted | ||
| 256 | * @remove: RIO device removed | ||
| 257 | * @suspend: RIO device suspended | ||
| 258 | * @resume: RIO device awakened | ||
| 259 | * @enable_wake: RIO device enable wake event | ||
| 260 | * @driver: LDM driver struct | ||
| 261 | * | ||
| 262 | * Provides info on a RIO device driver for insertion/removal and | ||
| 263 | * power management purposes. | ||
| 264 | */ | ||
| 265 | struct rio_driver { | ||
| 266 | struct list_head node; | ||
| 267 | char *name; | ||
| 268 | const struct rio_device_id *id_table; | ||
| 269 | int (*probe) (struct rio_dev * dev, const struct rio_device_id * id); | ||
| 270 | void (*remove) (struct rio_dev * dev); | ||
| 271 | int (*suspend) (struct rio_dev * dev, u32 state); | ||
| 272 | int (*resume) (struct rio_dev * dev); | ||
| 273 | int (*enable_wake) (struct rio_dev * dev, u32 state, int enable); | ||
| 274 | struct device_driver driver; | ||
| 275 | }; | ||
| 276 | |||
| 277 | #define to_rio_driver(drv) container_of(drv,struct rio_driver, driver) | ||
| 278 | |||
| 279 | /** | ||
| 280 | * struct rio_device_id - RIO device identifier | ||
| 281 | * @did: RIO device ID | ||
| 282 | * @vid: RIO vendor ID | ||
| 283 | * @asm_did: RIO assembly device ID | ||
| 284 | * @asm_vid: RIO assembly vendor ID | ||
| 285 | * | ||
| 286 | * Identifies a RIO device based on both the device/vendor IDs and | ||
| 287 | * the assembly device/vendor IDs. | ||
| 288 | */ | ||
| 289 | struct rio_device_id { | ||
| 290 | u16 did, vid; | ||
| 291 | u16 asm_did, asm_vid; | ||
| 292 | }; | ||
| 293 | |||
| 294 | /** | ||
| 295 | * struct rio_route_ops - Per-switch route operations | ||
| 296 | * @vid: RIO vendor ID | ||
| 297 | * @did: RIO device ID | ||
| 298 | * @add_hook: Callback that adds a route entry | ||
| 299 | * @get_hook: Callback that gets a route entry | ||
| 300 | * | ||
| 301 | * Defines the operations that are necessary to manipulate the route | ||
| 302 | * tables for a particular RIO switch device. | ||
| 303 | */ | ||
| 304 | struct rio_route_ops { | ||
| 305 | u16 vid, did; | ||
| 306 | int (*add_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
| 307 | u16 table, u16 route_destid, u8 route_port); | ||
| 308 | int (*get_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, | ||
| 309 | u16 table, u16 route_destid, u8 * route_port); | ||
| 310 | }; | ||
| 311 | |||
| 312 | /* Architecture and hardware-specific functions */ | ||
| 313 | extern int rio_init_mports(void); | ||
| 314 | extern void rio_register_mport(struct rio_mport *); | ||
| 315 | extern int rio_hw_add_outb_message(struct rio_mport *, struct rio_dev *, int, | ||
| 316 | void *, size_t); | ||
| 317 | extern int rio_hw_add_inb_buffer(struct rio_mport *, int, void *); | ||
| 318 | extern void *rio_hw_get_inb_message(struct rio_mport *, int); | ||
| 319 | extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); | ||
| 320 | extern void rio_close_inb_mbox(struct rio_mport *, int); | ||
| 321 | extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); | ||
| 322 | extern void rio_close_outb_mbox(struct rio_mport *, int); | ||
| 323 | |||
| 324 | #endif /* __KERNEL__ */ | ||
| 325 | #endif /* LINUX_RIO_H */ | ||
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h new file mode 100644 index 000000000000..3bd7cce19e26 --- /dev/null +++ b/include/linux/rio_drv.h | |||
| @@ -0,0 +1,469 @@ | |||
| 1 | /* | ||
| 2 | * RapidIO driver services | ||
| 3 | * | ||
| 4 | * Copyright 2005 MontaVista Software, Inc. | ||
| 5 | * Matt Porter <mporter@kernel.crashing.org> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef LINUX_RIO_DRV_H | ||
| 14 | #define LINUX_RIO_DRV_H | ||
| 15 | |||
| 16 | #ifdef __KERNEL__ | ||
| 17 | |||
| 18 | #include <linux/types.h> | ||
| 19 | #include <linux/config.h> | ||
| 20 | #include <linux/ioport.h> | ||
| 21 | #include <linux/list.h> | ||
| 22 | #include <linux/errno.h> | ||
| 23 | #include <linux/device.h> | ||
| 24 | #include <linux/rio.h> | ||
| 25 | |||
| 26 | extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset, | ||
| 27 | u32 * data); | ||
| 28 | extern int __rio_local_write_config_32(struct rio_mport *port, u32 offset, | ||
| 29 | u32 data); | ||
| 30 | extern int __rio_local_read_config_16(struct rio_mport *port, u32 offset, | ||
| 31 | u16 * data); | ||
| 32 | extern int __rio_local_write_config_16(struct rio_mport *port, u32 offset, | ||
| 33 | u16 data); | ||
| 34 | extern int __rio_local_read_config_8(struct rio_mport *port, u32 offset, | ||
| 35 | u8 * data); | ||
| 36 | extern int __rio_local_write_config_8(struct rio_mport *port, u32 offset, | ||
| 37 | u8 data); | ||
| 38 | |||
| 39 | extern int rio_mport_read_config_32(struct rio_mport *port, u16 destid, | ||
| 40 | u8 hopcount, u32 offset, u32 * data); | ||
| 41 | extern int rio_mport_write_config_32(struct rio_mport *port, u16 destid, | ||
| 42 | u8 hopcount, u32 offset, u32 data); | ||
| 43 | extern int rio_mport_read_config_16(struct rio_mport *port, u16 destid, | ||
| 44 | u8 hopcount, u32 offset, u16 * data); | ||
| 45 | extern int rio_mport_write_config_16(struct rio_mport *port, u16 destid, | ||
| 46 | u8 hopcount, u32 offset, u16 data); | ||
| 47 | extern int rio_mport_read_config_8(struct rio_mport *port, u16 destid, | ||
| 48 | u8 hopcount, u32 offset, u8 * data); | ||
| 49 | extern int rio_mport_write_config_8(struct rio_mport *port, u16 destid, | ||
| 50 | u8 hopcount, u32 offset, u8 data); | ||
| 51 | |||
| 52 | /** | ||
| 53 | * rio_local_read_config_32 - Read 32 bits from local configuration space | ||
| 54 | * @port: Master port | ||
| 55 | * @offset: Offset into local configuration space | ||
| 56 | * @data: Pointer to read data into | ||
| 57 | * | ||
| 58 | * Reads 32 bits of data from the specified offset within the local | ||
| 59 | * device's configuration space. | ||
| 60 | */ | ||
| 61 | static inline int rio_local_read_config_32(struct rio_mport *port, u32 offset, | ||
| 62 | u32 * data) | ||
| 63 | { | ||
| 64 | return __rio_local_read_config_32(port, offset, data); | ||
| 65 | } | ||
| 66 | |||
| 67 | /** | ||
| 68 | * rio_local_write_config_32 - Write 32 bits to local configuration space | ||
| 69 | * @port: Master port | ||
| 70 | * @offset: Offset into local configuration space | ||
| 71 | * @data: Data to be written | ||
| 72 | * | ||
| 73 | * Writes 32 bits of data to the specified offset within the local | ||
| 74 | * device's configuration space. | ||
| 75 | */ | ||
| 76 | static inline int rio_local_write_config_32(struct rio_mport *port, u32 offset, | ||
| 77 | u32 data) | ||
| 78 | { | ||
| 79 | return __rio_local_write_config_32(port, offset, data); | ||
| 80 | } | ||
| 81 | |||
| 82 | /** | ||
| 83 | * rio_local_read_config_16 - Read 16 bits from local configuration space | ||
| 84 | * @port: Master port | ||
| 85 | * @offset: Offset into local configuration space | ||
| 86 | * @data: Pointer to read data into | ||
| 87 | * | ||
| 88 | * Reads 16 bits of data from the specified offset within the local | ||
| 89 | * device's configuration space. | ||
| 90 | */ | ||
| 91 | static inline int rio_local_read_config_16(struct rio_mport *port, u32 offset, | ||
| 92 | u16 * data) | ||
| 93 | { | ||
| 94 | return __rio_local_read_config_16(port, offset, data); | ||
| 95 | } | ||
| 96 | |||
| 97 | /** | ||
| 98 | * rio_local_write_config_16 - Write 16 bits to local configuration space | ||
| 99 | * @port: Master port | ||
| 100 | * @offset: Offset into local configuration space | ||
| 101 | * @data: Data to be written | ||
| 102 | * | ||
| 103 | * Writes 16 bits of data to the specified offset within the local | ||
| 104 | * device's configuration space. | ||
| 105 | */ | ||
| 106 | |||
| 107 | static inline int rio_local_write_config_16(struct rio_mport *port, u32 offset, | ||
| 108 | u16 data) | ||
| 109 | { | ||
| 110 | return __rio_local_write_config_16(port, offset, data); | ||
| 111 | } | ||
| 112 | |||
| 113 | /** | ||
| 114 | * rio_local_read_config_8 - Read 8 bits from local configuration space | ||
| 115 | * @port: Master port | ||
| 116 | * @offset: Offset into local configuration space | ||
| 117 | * @data: Pointer to read data into | ||
| 118 | * | ||
| 119 | * Reads 8 bits of data from the specified offset within the local | ||
| 120 | * device's configuration space. | ||
| 121 | */ | ||
| 122 | static inline int rio_local_read_config_8(struct rio_mport *port, u32 offset, | ||
| 123 | u8 * data) | ||
| 124 | { | ||
| 125 | return __rio_local_read_config_8(port, offset, data); | ||
| 126 | } | ||
| 127 | |||
| 128 | /** | ||
| 129 | * rio_local_write_config_8 - Write 8 bits to local configuration space | ||
| 130 | * @port: Master port | ||
| 131 | * @offset: Offset into local configuration space | ||
| 132 | * @data: Data to be written | ||
| 133 | * | ||
| 134 | * Writes 8 bits of data to the specified offset within the local | ||
| 135 | * device's configuration space. | ||
| 136 | */ | ||
| 137 | static inline int rio_local_write_config_8(struct rio_mport *port, u32 offset, | ||
| 138 | u8 data) | ||
| 139 | { | ||
| 140 | return __rio_local_write_config_8(port, offset, data); | ||
| 141 | } | ||
| 142 | |||
| 143 | /** | ||
| 144 | * rio_read_config_32 - Read 32 bits from configuration space | ||
| 145 | * @rdev: RIO device | ||
| 146 | * @offset: Offset into device configuration space | ||
| 147 | * @data: Pointer to read data into | ||
| 148 | * | ||
| 149 | * Reads 32 bits of data from the specified offset within the | ||
| 150 | * RIO device's configuration space. | ||
| 151 | */ | ||
| 152 | static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, | ||
| 153 | u32 * data) | ||
| 154 | { | ||
| 155 | u8 hopcount = 0xff; | ||
| 156 | u16 destid = rdev->destid; | ||
| 157 | |||
| 158 | if (rdev->rswitch) { | ||
| 159 | destid = rdev->rswitch->destid; | ||
| 160 | hopcount = rdev->rswitch->hopcount; | ||
| 161 | } | ||
| 162 | |||
| 163 | return rio_mport_read_config_32(rdev->net->hport, destid, hopcount, | ||
| 164 | offset, data); | ||
| 165 | }; | ||
| 166 | |||
| 167 | /** | ||
| 168 | * rio_write_config_32 - Write 32 bits to configuration space | ||
| 169 | * @rdev: RIO device | ||
| 170 | * @offset: Offset into device configuration space | ||
| 171 | * @data: Data to be written | ||
| 172 | * | ||
| 173 | * Writes 32 bits of data to the specified offset within the | ||
| 174 | * RIO device's configuration space. | ||
| 175 | */ | ||
| 176 | static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, | ||
| 177 | u32 data) | ||
| 178 | { | ||
| 179 | u8 hopcount = 0xff; | ||
| 180 | u16 destid = rdev->destid; | ||
| 181 | |||
| 182 | if (rdev->rswitch) { | ||
| 183 | destid = rdev->rswitch->destid; | ||
| 184 | hopcount = rdev->rswitch->hopcount; | ||
| 185 | } | ||
| 186 | |||
| 187 | return rio_mport_write_config_32(rdev->net->hport, destid, hopcount, | ||
| 188 | offset, data); | ||
| 189 | }; | ||
| 190 | |||
| 191 | /** | ||
| 192 | * rio_read_config_16 - Read 16 bits from configuration space | ||
| 193 | * @rdev: RIO device | ||
| 194 | * @offset: Offset into device configuration space | ||
| 195 | * @data: Pointer to read data into | ||
| 196 | * | ||
| 197 | * Reads 16 bits of data from the specified offset within the | ||
| 198 | * RIO device's configuration space. | ||
| 199 | */ | ||
| 200 | static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, | ||
| 201 | u16 * data) | ||
| 202 | { | ||
| 203 | u8 hopcount = 0xff; | ||
| 204 | u16 destid = rdev->destid; | ||
| 205 | |||
| 206 | if (rdev->rswitch) { | ||
| 207 | destid = rdev->rswitch->destid; | ||
| 208 | hopcount = rdev->rswitch->hopcount; | ||
| 209 | } | ||
| 210 | |||
| 211 | return rio_mport_read_config_16(rdev->net->hport, destid, hopcount, | ||
| 212 | offset, data); | ||
| 213 | }; | ||
| 214 | |||
| 215 | /** | ||
| 216 | * rio_write_config_16 - Write 16 bits to configuration space | ||
| 217 | * @rdev: RIO device | ||
| 218 | * @offset: Offset into device configuration space | ||
| 219 | * @data: Data to be written | ||
| 220 | * | ||
| 221 | * Writes 16 bits of data to the specified offset within the | ||
| 222 | * RIO device's configuration space. | ||
| 223 | */ | ||
| 224 | static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, | ||
| 225 | u16 data) | ||
| 226 | { | ||
| 227 | u8 hopcount = 0xff; | ||
| 228 | u16 destid = rdev->destid; | ||
| 229 | |||
| 230 | if (rdev->rswitch) { | ||
| 231 | destid = rdev->rswitch->destid; | ||
| 232 | hopcount = rdev->rswitch->hopcount; | ||
| 233 | } | ||
| 234 | |||
| 235 | return rio_mport_write_config_16(rdev->net->hport, destid, hopcount, | ||
| 236 | offset, data); | ||
| 237 | }; | ||
| 238 | |||
| 239 | /** | ||
| 240 | * rio_read_config_8 - Read 8 bits from configuration space | ||
| 241 | * @rdev: RIO device | ||
| 242 | * @offset: Offset into device configuration space | ||
| 243 | * @data: Pointer to read data into | ||
| 244 | * | ||
| 245 | * Reads 8 bits of data from the specified offset within the | ||
| 246 | * RIO device's configuration space. | ||
| 247 | */ | ||
| 248 | static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) | ||
| 249 | { | ||
| 250 | u8 hopcount = 0xff; | ||
| 251 | u16 destid = rdev->destid; | ||
| 252 | |||
| 253 | if (rdev->rswitch) { | ||
| 254 | destid = rdev->rswitch->destid; | ||
| 255 | hopcount = rdev->rswitch->hopcount; | ||
| 256 | } | ||
| 257 | |||
| 258 | return rio_mport_read_config_8(rdev->net->hport, destid, hopcount, | ||
| 259 | offset, data); | ||
| 260 | }; | ||
| 261 | |||
| 262 | /** | ||
| 263 | * rio_write_config_8 - Write 8 bits to configuration space | ||
| 264 | * @rdev: RIO device | ||
| 265 | * @offset: Offset into device configuration space | ||
| 266 | * @data: Data to be written | ||
| 267 | * | ||
| 268 | * Writes 8 bits of data to the specified offset within the | ||
| 269 | * RIO device's configuration space. | ||
| 270 | */ | ||
| 271 | static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data) | ||
| 272 | { | ||
| 273 | u8 hopcount = 0xff; | ||
| 274 | u16 destid = rdev->destid; | ||
| 275 | |||
| 276 | if (rdev->rswitch) { | ||
| 277 | destid = rdev->rswitch->destid; | ||
| 278 | hopcount = rdev->rswitch->hopcount; | ||
| 279 | } | ||
| 280 | |||
| 281 | return rio_mport_write_config_8(rdev->net->hport, destid, hopcount, | ||
| 282 | offset, data); | ||
| 283 | }; | ||
| 284 | |||
| 285 | extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, | ||
| 286 | u16 data); | ||
| 287 | |||
| 288 | /** | ||
| 289 | * rio_send_doorbell - Send a doorbell message to a device | ||
| 290 | * @rdev: RIO device | ||
| 291 | * @data: Doorbell message data | ||
| 292 | * | ||
| 293 | * Send a doorbell message to a RIO device. The doorbell message | ||
| 294 | * has a 16-bit info field provided by the @data argument. | ||
| 295 | */ | ||
| 296 | static inline int rio_send_doorbell(struct rio_dev *rdev, u16 data) | ||
| 297 | { | ||
| 298 | return rio_mport_send_doorbell(rdev->net->hport, rdev->destid, data); | ||
| 299 | }; | ||
| 300 | |||
| 301 | /** | ||
| 302 | * rio_init_mbox_res - Initialize a RIO mailbox resource | ||
| 303 | * @res: resource struct | ||
| 304 | * @start: start of mailbox range | ||
| 305 | * @end: end of mailbox range | ||
| 306 | * | ||
| 307 | * This function is used to initialize the fields of a resource | ||
| 308 | * for use as a mailbox resource. It initializes a range of | ||
| 309 | * mailboxes using the start and end arguments. | ||
| 310 | */ | ||
| 311 | static inline void rio_init_mbox_res(struct resource *res, int start, int end) | ||
| 312 | { | ||
| 313 | memset(res, 0, sizeof(struct resource)); | ||
| 314 | res->start = start; | ||
| 315 | res->end = end; | ||
| 316 | res->flags = RIO_RESOURCE_MAILBOX; | ||
| 317 | } | ||
| 318 | |||
| 319 | /** | ||
| 320 | * rio_init_dbell_res - Initialize a RIO doorbell resource | ||
| 321 | * @res: resource struct | ||
| 322 | * @start: start of doorbell range | ||
| 323 | * @end: end of doorbell range | ||
| 324 | * | ||
| 325 | * This function is used to initialize the fields of a resource | ||
| 326 | * for use as a doorbell resource. It initializes a range of | ||
| 327 | * doorbell messages using the start and end arguments. | ||
| 328 | */ | ||
| 329 | static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end) | ||
| 330 | { | ||
| 331 | memset(res, 0, sizeof(struct resource)); | ||
| 332 | res->start = start; | ||
| 333 | res->end = end; | ||
| 334 | res->flags = RIO_RESOURCE_DOORBELL; | ||
| 335 | } | ||
| 336 | |||
| 337 | /** | ||
| 338 | * RIO_DEVICE - macro used to describe a specific RIO device | ||
| 339 | * @vid: the 16 bit RIO vendor ID | ||
| 340 | * @did: the 16 bit RIO device ID | ||
| 341 | * | ||
| 342 | * This macro is used to create a struct rio_device_id that matches a | ||
| 343 | * specific device. The assembly vendor and assembly device fields | ||
| 344 | * will be set to %RIO_ANY_ID. | ||
| 345 | */ | ||
| 346 | #define RIO_DEVICE(dev,ven) \ | ||
| 347 | .did = (dev), .vid = (ven), \ | ||
| 348 | .asm_did = RIO_ANY_ID, .asm_vid = RIO_ANY_ID | ||
| 349 | |||
| 350 | /* Mailbox management */ | ||
| 351 | extern int rio_request_outb_mbox(struct rio_mport *, void *, int, int, | ||
| 352 | void (*)(struct rio_mport *, void *,int, int)); | ||
| 353 | extern int rio_release_outb_mbox(struct rio_mport *, int); | ||
| 354 | |||
| 355 | /** | ||
| 356 | * rio_add_outb_message - Add RIO message to an outbound mailbox queue | ||
| 357 | * @mport: RIO master port containing the outbound queue | ||
| 358 | * @rdev: RIO device the message is be sent to | ||
| 359 | * @mbox: The outbound mailbox queue | ||
| 360 | * @buffer: Pointer to the message buffer | ||
| 361 | * @len: Length of the message buffer | ||
| 362 | * | ||
| 363 | * Adds a RIO message buffer to an outbound mailbox queue for | ||
| 364 | * transmission. Returns 0 on success. | ||
| 365 | */ | ||
| 366 | static inline int rio_add_outb_message(struct rio_mport *mport, | ||
| 367 | struct rio_dev *rdev, int mbox, | ||
| 368 | void *buffer, size_t len) | ||
| 369 | { | ||
| 370 | return rio_hw_add_outb_message(mport, rdev, mbox, buffer, len); | ||
| 371 | } | ||
| 372 | |||
| 373 | extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int, | ||
| 374 | void (*)(struct rio_mport *, void *, int, int)); | ||
| 375 | extern int rio_release_inb_mbox(struct rio_mport *, int); | ||
| 376 | |||
| 377 | /** | ||
| 378 | * rio_add_inb_buffer - Add buffer to an inbound mailbox queue | ||
| 379 | * @mport: Master port containing the inbound mailbox | ||
| 380 | * @mbox: The inbound mailbox number | ||
| 381 | * @buffer: Pointer to the message buffer | ||
| 382 | * | ||
| 383 | * Adds a buffer to an inbound mailbox queue for reception. Returns | ||
| 384 | * 0 on success. | ||
| 385 | */ | ||
| 386 | static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox, | ||
| 387 | void *buffer) | ||
| 388 | { | ||
| 389 | return rio_hw_add_inb_buffer(mport, mbox, buffer); | ||
| 390 | } | ||
| 391 | |||
| 392 | /** | ||
| 393 | * rio_get_inb_message - Get A RIO message from an inbound mailbox queue | ||
| 394 | * @mport: Master port containing the inbound mailbox | ||
| 395 | * @mbox: The inbound mailbox number | ||
| 396 | * @buffer: Pointer to the message buffer | ||
| 397 | * | ||
| 398 | * Get a RIO message from an inbound mailbox queue. Returns 0 on success. | ||
| 399 | */ | ||
| 400 | static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox) | ||
| 401 | { | ||
| 402 | return rio_hw_get_inb_message(mport, mbox); | ||
| 403 | } | ||
| 404 | |||
| 405 | /* Doorbell management */ | ||
| 406 | extern int rio_request_inb_dbell(struct rio_mport *, void *, u16, u16, | ||
| 407 | void (*)(struct rio_mport *, void *, u16, u16, u16)); | ||
| 408 | extern int rio_release_inb_dbell(struct rio_mport *, u16, u16); | ||
| 409 | extern struct resource *rio_request_outb_dbell(struct rio_dev *, u16, u16); | ||
| 410 | extern int rio_release_outb_dbell(struct rio_dev *, struct resource *); | ||
| 411 | |||
| 412 | /* Memory region management */ | ||
| 413 | int rio_claim_resource(struct rio_dev *, int); | ||
| 414 | int rio_request_regions(struct rio_dev *, char *); | ||
| 415 | void rio_release_regions(struct rio_dev *); | ||
| 416 | int rio_request_region(struct rio_dev *, int, char *); | ||
| 417 | void rio_release_region(struct rio_dev *, int); | ||
| 418 | |||
| 419 | /* LDM support */ | ||
| 420 | int rio_register_driver(struct rio_driver *); | ||
| 421 | void rio_unregister_driver(struct rio_driver *); | ||
| 422 | struct rio_dev *rio_dev_get(struct rio_dev *); | ||
| 423 | void rio_dev_put(struct rio_dev *); | ||
| 424 | |||
| 425 | /** | ||
| 426 | * rio_name - Get the unique RIO device identifier | ||
| 427 | * @rdev: RIO device | ||
| 428 | * | ||
| 429 | * Get the unique RIO device identifier. Returns the device | ||
| 430 | * identifier string. | ||
| 431 | */ | ||
| 432 | static inline char *rio_name(struct rio_dev *rdev) | ||
| 433 | { | ||
| 434 | return rdev->dev.bus_id; | ||
| 435 | } | ||
| 436 | |||
| 437 | /** | ||
| 438 | * rio_get_drvdata - Get RIO driver specific data | ||
| 439 | * @rdev: RIO device | ||
| 440 | * | ||
| 441 | * Get RIO driver specific data. Returns a pointer to the | ||
| 442 | * driver specific data. | ||
| 443 | */ | ||
| 444 | static inline void *rio_get_drvdata(struct rio_dev *rdev) | ||
| 445 | { | ||
| 446 | return dev_get_drvdata(&rdev->dev); | ||
| 447 | } | ||
| 448 | |||
| 449 | /** | ||
| 450 | * rio_set_drvdata - Set RIO driver specific data | ||
| 451 | * @rdev: RIO device | ||
| 452 | * @data: Pointer to driver specific data | ||
| 453 | * | ||
| 454 | * Set RIO driver specific data. device struct driver data pointer | ||
| 455 | * is set to the @data argument. | ||
| 456 | */ | ||
| 457 | static inline void rio_set_drvdata(struct rio_dev *rdev, void *data) | ||
| 458 | { | ||
| 459 | dev_set_drvdata(&rdev->dev, data); | ||
| 460 | } | ||
| 461 | |||
| 462 | /* Misc driver helpers */ | ||
| 463 | extern u16 rio_local_get_device_id(struct rio_mport *port); | ||
| 464 | extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from); | ||
| 465 | extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, | ||
| 466 | struct rio_dev *from); | ||
| 467 | |||
| 468 | #endif /* __KERNEL__ */ | ||
| 469 | #endif /* LINUX_RIO_DRV_H */ | ||
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h new file mode 100644 index 000000000000..919d4e07d54e --- /dev/null +++ b/include/linux/rio_ids.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* | ||
| 2 | * RapidIO devices | ||
| 3 | * | ||
| 4 | * Copyright 2005 MontaVista Software, Inc. | ||
| 5 | * Matt Porter <mporter@kernel.crashing.org> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef LINUX_RIO_IDS_H | ||
| 14 | #define LINUX_RIO_IDS_H | ||
| 15 | |||
| 16 | #define RIO_ANY_ID 0xffff | ||
| 17 | |||
| 18 | #define RIO_VID_FREESCALE 0x0002 | ||
| 19 | #define RIO_DID_MPC8560 0x0003 | ||
| 20 | |||
| 21 | #define RIO_VID_TUNDRA 0x000d | ||
| 22 | #define RIO_DID_TSI500 0x0500 | ||
| 23 | |||
| 24 | #endif /* LINUX_RIO_IDS_H */ | ||
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h new file mode 100644 index 000000000000..326540f9b54e --- /dev/null +++ b/include/linux/rio_regs.h | |||
| @@ -0,0 +1,215 @@ | |||
| 1 | /* | ||
| 2 | * RapidIO register definitions | ||
| 3 | * | ||
| 4 | * Copyright 2005 MontaVista Software, Inc. | ||
| 5 | * Matt Porter <mporter@kernel.crashing.org> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef LINUX_RIO_REGS_H | ||
| 14 | #define LINUX_RIO_REGS_H | ||
| 15 | |||
| 16 | /* | ||
| 17 | * In RapidIO, each device has a 2MB configuration space that is | ||
| 18 | * accessed via maintenance transactions. Portions of configuration | ||
| 19 | * space are standardized and/or reserved. | ||
| 20 | */ | ||
| 21 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ | ||
| 22 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ | ||
| 23 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ | ||
| 24 | #define RIO_ASM_ID_MASK 0xffff0000 /* [I] Asm ID Mask */ | ||
| 25 | #define RIO_ASM_VEN_ID_MASK 0x0000ffff /* [I] Asm Vend Mask */ | ||
| 26 | |||
| 27 | #define RIO_ASM_INFO_CAR 0x0c /* [I] Assembly Information CAR */ | ||
| 28 | #define RIO_ASM_REV_MASK 0xffff0000 /* [I] Asm Rev Mask */ | ||
| 29 | #define RIO_EXT_FTR_PTR_MASK 0x0000ffff /* [I] EF_PTR Mask */ | ||
| 30 | |||
| 31 | #define RIO_PEF_CAR 0x10 /* [I] Processing Element Features CAR */ | ||
| 32 | #define RIO_PEF_BRIDGE 0x80000000 /* [I] Bridge */ | ||
| 33 | #define RIO_PEF_MEMORY 0x40000000 /* [I] MMIO */ | ||
| 34 | #define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */ | ||
| 35 | #define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */ | ||
| 36 | #define RIO_PEF_INB_MBOX 0x00f00000 /* [II] Mailboxes */ | ||
| 37 | #define RIO_PEF_INB_MBOX0 0x00800000 /* [II] Mailbox 0 */ | ||
| 38 | #define RIO_PEF_INB_MBOX1 0x00400000 /* [II] Mailbox 1 */ | ||
| 39 | #define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */ | ||
| 40 | #define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */ | ||
| 41 | #define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */ | ||
| 42 | #define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ | ||
| 43 | #define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */ | ||
| 44 | #define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */ | ||
| 45 | #define RIO_PEF_ADDR_50 0x00000002 /* [I] 50 bits */ | ||
| 46 | #define RIO_PEF_ADDR_34 0x00000001 /* [I] 34 bits */ | ||
| 47 | |||
| 48 | #define RIO_SWP_INFO_CAR 0x14 /* [I] Switch Port Information CAR */ | ||
| 49 | #define RIO_SWP_INFO_PORT_TOTAL_MASK 0x0000ff00 /* [I] Total number of ports */ | ||
| 50 | #define RIO_SWP_INFO_PORT_NUM_MASK 0x000000ff /* [I] Maintenance transaction port number */ | ||
| 51 | #define RIO_GET_TOTAL_PORTS(x) ((x & RIO_SWP_INFO_PORT_TOTAL_MASK) >> 8) | ||
| 52 | |||
| 53 | #define RIO_SRC_OPS_CAR 0x18 /* [I] Source Operations CAR */ | ||
| 54 | #define RIO_SRC_OPS_READ 0x00008000 /* [I] Read op */ | ||
| 55 | #define RIO_SRC_OPS_WRITE 0x00004000 /* [I] Write op */ | ||
| 56 | #define RIO_SRC_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */ | ||
| 57 | #define RIO_SRC_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */ | ||
| 58 | #define RIO_SRC_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */ | ||
| 59 | #define RIO_SRC_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */ | ||
| 60 | #define RIO_SRC_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */ | ||
| 61 | #define RIO_SRC_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */ | ||
| 62 | #define RIO_SRC_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */ | ||
| 63 | #define RIO_SRC_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */ | ||
| 64 | #define RIO_SRC_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ | ||
| 65 | #define RIO_SRC_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ | ||
| 66 | |||
| 67 | #define RIO_DST_OPS_CAR 0x1c /* Destination Operations CAR */ | ||
| 68 | #define RIO_DST_OPS_READ 0x00008000 /* [I] Read op */ | ||
| 69 | #define RIO_DST_OPS_WRITE 0x00004000 /* [I] Write op */ | ||
| 70 | #define RIO_DST_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */ | ||
| 71 | #define RIO_DST_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */ | ||
| 72 | #define RIO_DST_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */ | ||
| 73 | #define RIO_DST_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */ | ||
| 74 | #define RIO_DST_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */ | ||
| 75 | #define RIO_DST_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */ | ||
| 76 | #define RIO_DST_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */ | ||
| 77 | #define RIO_DST_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */ | ||
| 78 | #define RIO_DST_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ | ||
| 79 | #define RIO_DST_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ | ||
| 80 | |||
| 81 | #define RIO_OPS_READ 0x00008000 /* [I] Read op */ | ||
| 82 | #define RIO_OPS_WRITE 0x00004000 /* [I] Write op */ | ||
| 83 | #define RIO_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */ | ||
| 84 | #define RIO_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */ | ||
| 85 | #define RIO_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */ | ||
| 86 | #define RIO_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */ | ||
| 87 | #define RIO_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */ | ||
| 88 | #define RIO_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */ | ||
| 89 | #define RIO_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */ | ||
| 90 | #define RIO_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */ | ||
| 91 | #define RIO_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ | ||
| 92 | #define RIO_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ | ||
| 93 | |||
| 94 | /* 0x20-0x3c *//* Reserved */ | ||
| 95 | |||
| 96 | #define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ | ||
| 97 | #define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */ | ||
| 98 | #define RIO_MBOX0_FULL 0x40000000 /* [II] Mbox 0 full */ | ||
| 99 | #define RIO_MBOX0_EMPTY 0x20000000 /* [II] Mbox 0 empty */ | ||
| 100 | #define RIO_MBOX0_BUSY 0x10000000 /* [II] Mbox 0 busy */ | ||
| 101 | #define RIO_MBOX0_FAIL 0x08000000 /* [II] Mbox 0 fail */ | ||
| 102 | #define RIO_MBOX0_ERROR 0x04000000 /* [II] Mbox 0 error */ | ||
| 103 | #define RIO_MBOX1_AVAIL 0x00800000 /* [II] Mbox 1 avail */ | ||
| 104 | #define RIO_MBOX1_FULL 0x00200000 /* [II] Mbox 1 full */ | ||
| 105 | #define RIO_MBOX1_EMPTY 0x00200000 /* [II] Mbox 1 empty */ | ||
| 106 | #define RIO_MBOX1_BUSY 0x00100000 /* [II] Mbox 1 busy */ | ||
| 107 | #define RIO_MBOX1_FAIL 0x00080000 /* [II] Mbox 1 fail */ | ||
| 108 | #define RIO_MBOX1_ERROR 0x00040000 /* [II] Mbox 1 error */ | ||
| 109 | #define RIO_MBOX2_AVAIL 0x00008000 /* [II] Mbox 2 avail */ | ||
| 110 | #define RIO_MBOX2_FULL 0x00004000 /* [II] Mbox 2 full */ | ||
| 111 | #define RIO_MBOX2_EMPTY 0x00002000 /* [II] Mbox 2 empty */ | ||
| 112 | #define RIO_MBOX2_BUSY 0x00001000 /* [II] Mbox 2 busy */ | ||
| 113 | #define RIO_MBOX2_FAIL 0x00000800 /* [II] Mbox 2 fail */ | ||
| 114 | #define RIO_MBOX2_ERROR 0x00000400 /* [II] Mbox 2 error */ | ||
| 115 | #define RIO_MBOX3_AVAIL 0x00000080 /* [II] Mbox 3 avail */ | ||
| 116 | #define RIO_MBOX3_FULL 0x00000040 /* [II] Mbox 3 full */ | ||
| 117 | #define RIO_MBOX3_EMPTY 0x00000020 /* [II] Mbox 3 empty */ | ||
| 118 | #define RIO_MBOX3_BUSY 0x00000010 /* [II] Mbox 3 busy */ | ||
| 119 | #define RIO_MBOX3_FAIL 0x00000008 /* [II] Mbox 3 fail */ | ||
| 120 | #define RIO_MBOX3_ERROR 0x00000004 /* [II] Mbox 3 error */ | ||
| 121 | |||
| 122 | #define RIO_WRITE_PORT_CSR 0x44 /* [I] Write Port CSR */ | ||
| 123 | #define RIO_DOORBELL_CSR 0x44 /* [II] Doorbell CSR */ | ||
| 124 | #define RIO_DOORBELL_AVAIL 0x80000000 /* [II] Doorbell avail */ | ||
| 125 | #define RIO_DOORBELL_FULL 0x40000000 /* [II] Doorbell full */ | ||
| 126 | #define RIO_DOORBELL_EMPTY 0x20000000 /* [II] Doorbell empty */ | ||
| 127 | #define RIO_DOORBELL_BUSY 0x10000000 /* [II] Doorbell busy */ | ||
| 128 | #define RIO_DOORBELL_FAILED 0x08000000 /* [II] Doorbell failed */ | ||
| 129 | #define RIO_DOORBELL_ERROR 0x04000000 /* [II] Doorbell error */ | ||
| 130 | #define RIO_WRITE_PORT_AVAILABLE 0x00000080 /* [I] Write Port Available */ | ||
| 131 | #define RIO_WRITE_PORT_FULL 0x00000040 /* [I] Write Port Full */ | ||
| 132 | #define RIO_WRITE_PORT_EMPTY 0x00000020 /* [I] Write Port Empty */ | ||
| 133 | #define RIO_WRITE_PORT_BUSY 0x00000010 /* [I] Write Port Busy */ | ||
| 134 | #define RIO_WRITE_PORT_FAILED 0x00000008 /* [I] Write Port Failed */ | ||
| 135 | #define RIO_WRITE_PORT_ERROR 0x00000004 /* [I] Write Port Error */ | ||
| 136 | |||
| 137 | /* 0x48 *//* Reserved */ | ||
| 138 | |||
| 139 | #define RIO_PELL_CTRL_CSR 0x4c /* [I] PE Logical Layer Control CSR */ | ||
| 140 | #define RIO_PELL_ADDR_66 0x00000004 /* [I] 66-bit addr */ | ||
| 141 | #define RIO_PELL_ADDR_50 0x00000002 /* [I] 50-bit addr */ | ||
| 142 | #define RIO_PELL_ADDR_34 0x00000001 /* [I] 34-bit addr */ | ||
| 143 | |||
| 144 | /* 0x50-0x54 *//* Reserved */ | ||
| 145 | |||
| 146 | #define RIO_LCSH_BA 0x58 /* [I] LCS High Base Address */ | ||
| 147 | #define RIO_LCSL_BA 0x5c /* [I] LCS Base Address */ | ||
| 148 | |||
| 149 | #define RIO_DID_CSR 0x60 /* [III] Base Device ID CSR */ | ||
| 150 | |||
| 151 | /* 0x64 *//* Reserved */ | ||
| 152 | |||
| 153 | #define RIO_HOST_DID_LOCK_CSR 0x68 /* [III] Host Base Device ID Lock CSR */ | ||
| 154 | #define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */ | ||
| 155 | |||
| 156 | /* 0x70-0xf8 *//* Reserved */ | ||
| 157 | /* 0x100-0xfff8 *//* [I] Extended Features Space */ | ||
| 158 | /* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */ | ||
| 159 | |||
| 160 | /* | ||
| 161 | * Extended Features Space is a configuration space area where | ||
| 162 | * functionality is mapped into extended feature blocks via a | ||
| 163 | * singly linked list of extended feature pointers (EFT_PTR). | ||
| 164 | * | ||
| 165 | * Each extended feature block can be identified/located in | ||
| 166 | * Extended Features Space by walking the extended feature | ||
| 167 | * list starting with the Extended Feature Pointer located | ||
| 168 | * in the Assembly Information CAR. | ||
| 169 | * | ||
| 170 | * Extended Feature Blocks (EFBs) are identified with an assigned | ||
| 171 | * EFB ID. Extended feature block offsets in the definitions are | ||
| 172 | * relative to the offset of the EFB within the Extended Features | ||
| 173 | * Space. | ||
| 174 | */ | ||
| 175 | |||
| 176 | /* Helper macros to parse the Extended Feature Block header */ | ||
| 177 | #define RIO_EFB_PTR_MASK 0xffff0000 | ||
| 178 | #define RIO_EFB_ID_MASK 0x0000ffff | ||
| 179 | #define RIO_GET_BLOCK_PTR(x) ((x & RIO_EFB_PTR_MASK) >> 16) | ||
| 180 | #define RIO_GET_BLOCK_ID(x) (x & RIO_EFB_ID_MASK) | ||
| 181 | |||
| 182 | /* Extended Feature Block IDs */ | ||
| 183 | #define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */ | ||
| 184 | #define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */ | ||
| 185 | #define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */ | ||
| 186 | #define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */ | ||
| 187 | #define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */ | ||
| 188 | #define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */ | ||
| 189 | |||
| 190 | /* | ||
| 191 | * Physical 8/16 LP-LVDS | ||
| 192 | * ID=0x0001, Generic End Point Devices | ||
| 193 | * ID=0x0002, Generic End Point Devices, software assisted recovery option | ||
| 194 | * ID=0x0003, Generic End Point Free Devices | ||
| 195 | * | ||
| 196 | * Physical LP-Serial | ||
| 197 | * ID=0x0004, Generic End Point Devices | ||
| 198 | * ID=0x0005, Generic End Point Devices, software assisted recovery option | ||
| 199 | * ID=0x0006, Generic End Point Free Devices | ||
| 200 | */ | ||
| 201 | #define RIO_PORT_MNT_HEADER 0x0000 | ||
| 202 | #define RIO_PORT_REQ_CTL_CSR 0x0020 | ||
| 203 | #define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */ | ||
| 204 | #define RIO_PORT_GEN_CTL_CSR 0x003c | ||
| 205 | #define RIO_PORT_GEN_HOST 0x80000000 | ||
| 206 | #define RIO_PORT_GEN_MASTER 0x40000000 | ||
| 207 | #define RIO_PORT_GEN_DISCOVERED 0x20000000 | ||
| 208 | #define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */ | ||
| 209 | #define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */ | ||
| 210 | #define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */ | ||
| 211 | #define RIO_PORT_N_ERR_STS_CSR(x) (0x58 + x*0x20) | ||
| 212 | #define PORT_N_ERR_STS_PORT_OK 0x00000002 | ||
| 213 | #define RIO_PORT_N_CTL_CSR(x) (0x5c + x*0x20) | ||
| 214 | |||
| 215 | #endif /* LINUX_RIO_REGS_H */ | ||
diff --git a/include/linux/rslib.h b/include/linux/rslib.h index 980c8f74d8dc..ace25acfdc97 100644 --- a/include/linux/rslib.h +++ b/include/linux/rslib.h | |||
| @@ -1,15 +1,15 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/linux/rslib.h | 2 | * include/linux/rslib.h |
| 3 | * | 3 | * |
| 4 | * Overview: | 4 | * Overview: |
| 5 | * Generic Reed Solomon encoder / decoder library | 5 | * Generic Reed Solomon encoder / decoder library |
| 6 | * | 6 | * |
| 7 | * Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de) | 7 | * Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de) |
| 8 | * | 8 | * |
| 9 | * RS code lifted from reed solomon library written by Phil Karn | 9 | * RS code lifted from reed solomon library written by Phil Karn |
| 10 | * Copyright 2002 Phil Karn, KA9Q | 10 | * Copyright 2002 Phil Karn, KA9Q |
| 11 | * | 11 | * |
| 12 | * $Id: rslib.h,v 1.3 2004/10/05 22:08:22 gleixner Exp $ | 12 | * $Id: rslib.h,v 1.4 2005/11/07 11:14:52 gleixner Exp $ |
| 13 | * | 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License version 2 as | 15 | * it under the terms of the GNU General Public License version 2 as |
| @@ -21,20 +21,20 @@ | |||
| 21 | 21 | ||
| 22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * struct rs_control - rs control structure | 25 | * struct rs_control - rs control structure |
| 26 | * | 26 | * |
| 27 | * @mm: Bits per symbol | 27 | * @mm: Bits per symbol |
| 28 | * @nn: Symbols per block (= (1<<mm)-1) | 28 | * @nn: Symbols per block (= (1<<mm)-1) |
| 29 | * @alpha_to: log lookup table | 29 | * @alpha_to: log lookup table |
| 30 | * @index_of: Antilog lookup table | 30 | * @index_of: Antilog lookup table |
| 31 | * @genpoly: Generator polynomial | 31 | * @genpoly: Generator polynomial |
| 32 | * @nroots: Number of generator roots = number of parity symbols | 32 | * @nroots: Number of generator roots = number of parity symbols |
| 33 | * @fcr: First consecutive root, index form | 33 | * @fcr: First consecutive root, index form |
| 34 | * @prim: Primitive element, index form | 34 | * @prim: Primitive element, index form |
| 35 | * @iprim: prim-th root of 1, index form | 35 | * @iprim: prim-th root of 1, index form |
| 36 | * @gfpoly: The primitive generator polynominal | 36 | * @gfpoly: The primitive generator polynominal |
| 37 | * @users: Users of this structure | 37 | * @users: Users of this structure |
| 38 | * @list: List entry for the rs control list | 38 | * @list: List entry for the rs control list |
| 39 | */ | 39 | */ |
| 40 | struct rs_control { | 40 | struct rs_control { |
| @@ -58,7 +58,7 @@ int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par, | |||
| 58 | uint16_t invmsk); | 58 | uint16_t invmsk); |
| 59 | #endif | 59 | #endif |
| 60 | #ifdef CONFIG_REED_SOLOMON_DEC8 | 60 | #ifdef CONFIG_REED_SOLOMON_DEC8 |
| 61 | int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len, | 61 | int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len, |
| 62 | uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, | 62 | uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, |
| 63 | uint16_t *corr); | 63 | uint16_t *corr); |
| 64 | #endif | 64 | #endif |
| @@ -75,7 +75,7 @@ int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len, | |||
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | /* Create or get a matching rs control structure */ | 77 | /* Create or get a matching rs control structure */ |
| 78 | struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim, | 78 | struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim, |
| 79 | int nroots); | 79 | int nroots); |
| 80 | 80 | ||
| 81 | /* Release a rs control structure */ | 81 | /* Release a rs control structure */ |
| @@ -87,9 +87,9 @@ void free_rs(struct rs_control *rs); | |||
| 87 | * @x: the value to reduce | 87 | * @x: the value to reduce |
| 88 | * | 88 | * |
| 89 | * where | 89 | * where |
| 90 | * rs->mm = number of bits per symbol | 90 | * rs->mm = number of bits per symbol |
| 91 | * rs->nn = (2^rs->mm) - 1 | 91 | * rs->nn = (2^rs->mm) - 1 |
| 92 | * | 92 | * |
| 93 | * Simple arithmetic modulo would return a wrong result for values | 93 | * Simple arithmetic modulo would return a wrong result for values |
| 94 | * >= 3 * rs->nn | 94 | * >= 3 * rs->nn |
| 95 | */ | 95 | */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 03b68a7b4b82..2bbf968b23d9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -909,6 +909,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) | |||
| 909 | #define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ | 909 | #define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ |
| 910 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ | 910 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ |
| 911 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ | 911 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ |
| 912 | #define PF_HOTPLUG_CPU 0x01000000 /* Currently performing CPU hotplug */ | ||
| 912 | 913 | ||
| 913 | /* | 914 | /* |
| 914 | * Only the _current_ task can read/write to tsk->flags, but other | 915 | * Only the _current_ task can read/write to tsk->flags, but other |
diff --git a/include/linux/sem.h b/include/linux/sem.h index 106f9757339a..3c1f1120fe88 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h | |||
| @@ -79,6 +79,8 @@ struct seminfo { | |||
| 79 | 79 | ||
| 80 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
| 81 | 81 | ||
| 82 | struct task_struct; | ||
| 83 | |||
| 82 | /* One semaphore structure for each semaphore in the system. */ | 84 | /* One semaphore structure for each semaphore in the system. */ |
| 83 | struct sem { | 85 | struct sem { |
| 84 | int semval; /* current value */ | 86 | int semval; /* current value */ |
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 2b799d40d669..cee302aefdb7 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
| @@ -42,6 +42,7 @@ enum { | |||
| 42 | PLAT8250_DEV_BOCA, | 42 | PLAT8250_DEV_BOCA, |
| 43 | PLAT8250_DEV_HUB6, | 43 | PLAT8250_DEV_HUB6, |
| 44 | PLAT8250_DEV_MCA, | 44 | PLAT8250_DEV_MCA, |
| 45 | PLAT8250_DEV_AU1X00, | ||
| 45 | }; | 46 | }; |
| 46 | 47 | ||
| 47 | /* | 48 | /* |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 9d2579230689..a3ac92b19aca 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -211,6 +211,7 @@ struct uart_port { | |||
| 211 | #define UPIO_HUB6 (1) | 211 | #define UPIO_HUB6 (1) |
| 212 | #define UPIO_MEM (2) | 212 | #define UPIO_MEM (2) |
| 213 | #define UPIO_MEM32 (3) | 213 | #define UPIO_MEM32 (3) |
| 214 | #define UPIO_AU (4) /* Au1x00 type IO */ | ||
| 214 | 215 | ||
| 215 | unsigned int read_status_mask; /* driver specific */ | 216 | unsigned int read_status_mask; /* driver specific */ |
| 216 | unsigned int ignore_status_mask; /* driver specific */ | 217 | unsigned int ignore_status_mask; /* driver specific */ |
diff --git a/include/linux/shm.h b/include/linux/shm.h index 80113a1f60bc..a2c896ad0bef 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h | |||
| @@ -92,6 +92,7 @@ struct shmid_kernel /* private to the kernel */ | |||
| 92 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ | 92 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ |
| 93 | #define SHM_LOCKED 02000 /* segment will not be swapped */ | 93 | #define SHM_LOCKED 02000 /* segment will not be swapped */ |
| 94 | #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ | 94 | #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ |
| 95 | #define SHM_NORESERVE 010000 /* don't check for reservations */ | ||
| 95 | 96 | ||
| 96 | #ifdef CONFIG_SYSVIPC | 97 | #ifdef CONFIG_SYSVIPC |
| 97 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); | 98 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 4286d832166f..83010231db99 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 |
| @@ -603,23 +606,23 @@ static inline void skb_queue_head_init(struct sk_buff_head *list) | |||
| 603 | */ | 606 | */ |
| 604 | 607 | ||
| 605 | /** | 608 | /** |
| 606 | * __skb_queue_head - queue a buffer at the list head | 609 | * __skb_queue_after - queue a buffer at the list head |
| 607 | * @list: list to use | 610 | * @list: list to use |
| 611 | * @prev: place after this buffer | ||
| 608 | * @newsk: buffer to queue | 612 | * @newsk: buffer to queue |
| 609 | * | 613 | * |
| 610 | * Queue a buffer at the start of a list. This function takes no locks | 614 | * Queue a buffer int the middle of a list. This function takes no locks |
| 611 | * and you must therefore hold required locks before calling it. | 615 | * and you must therefore hold required locks before calling it. |
| 612 | * | 616 | * |
| 613 | * A buffer cannot be placed on two lists at the same time. | 617 | * A buffer cannot be placed on two lists at the same time. |
| 614 | */ | 618 | */ |
| 615 | extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk); | 619 | static inline void __skb_queue_after(struct sk_buff_head *list, |
| 616 | static inline void __skb_queue_head(struct sk_buff_head *list, | 620 | struct sk_buff *prev, |
| 617 | struct sk_buff *newsk) | 621 | struct sk_buff *newsk) |
| 618 | { | 622 | { |
| 619 | struct sk_buff *prev, *next; | 623 | struct sk_buff *next; |
| 620 | |||
| 621 | list->qlen++; | 624 | list->qlen++; |
| 622 | prev = (struct sk_buff *)list; | 625 | |
| 623 | next = prev->next; | 626 | next = prev->next; |
| 624 | newsk->next = next; | 627 | newsk->next = next; |
| 625 | newsk->prev = prev; | 628 | newsk->prev = prev; |
| @@ -627,6 +630,23 @@ static inline void __skb_queue_head(struct sk_buff_head *list, | |||
| 627 | } | 630 | } |
| 628 | 631 | ||
| 629 | /** | 632 | /** |
| 633 | * __skb_queue_head - queue a buffer at the list head | ||
| 634 | * @list: list to use | ||
| 635 | * @newsk: buffer to queue | ||
| 636 | * | ||
| 637 | * Queue a buffer at the start of a list. This function takes no locks | ||
| 638 | * and you must therefore hold required locks before calling it. | ||
| 639 | * | ||
| 640 | * A buffer cannot be placed on two lists at the same time. | ||
| 641 | */ | ||
| 642 | extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk); | ||
| 643 | static inline void __skb_queue_head(struct sk_buff_head *list, | ||
| 644 | struct sk_buff *newsk) | ||
| 645 | { | ||
| 646 | __skb_queue_after(list, (struct sk_buff *)list, newsk); | ||
| 647 | } | ||
| 648 | |||
| 649 | /** | ||
| 630 | * __skb_queue_tail - queue a buffer at the list tail | 650 | * __skb_queue_tail - queue a buffer at the list tail |
| 631 | * @list: list to use | 651 | * @list: list to use |
| 632 | * @newsk: buffer to queue | 652 | * @newsk: buffer to queue |
| @@ -1203,6 +1223,11 @@ static inline void kunmap_skb_frag(void *vaddr) | |||
| 1203 | prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ | 1223 | prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ |
| 1204 | skb = skb->next) | 1224 | skb = skb->next) |
| 1205 | 1225 | ||
| 1226 | #define skb_queue_reverse_walk(queue, skb) \ | ||
| 1227 | for (skb = (queue)->prev; \ | ||
| 1228 | prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ | ||
| 1229 | skb = skb->prev) | ||
| 1230 | |||
| 1206 | 1231 | ||
| 1207 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, | 1232 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, |
| 1208 | int noblock, int *err); | 1233 | int noblock, int *err); |
| @@ -1291,10 +1316,26 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct) | |||
| 1291 | if (nfct) | 1316 | if (nfct) |
| 1292 | atomic_inc(&nfct->use); | 1317 | atomic_inc(&nfct->use); |
| 1293 | } | 1318 | } |
| 1319 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
| 1320 | static inline void nf_conntrack_get_reasm(struct sk_buff *skb) | ||
| 1321 | { | ||
| 1322 | if (skb) | ||
| 1323 | atomic_inc(&skb->users); | ||
| 1324 | } | ||
| 1325 | static inline void nf_conntrack_put_reasm(struct sk_buff *skb) | ||
| 1326 | { | ||
| 1327 | if (skb) | ||
| 1328 | kfree_skb(skb); | ||
| 1329 | } | ||
| 1330 | #endif | ||
| 1294 | static inline void nf_reset(struct sk_buff *skb) | 1331 | static inline void nf_reset(struct sk_buff *skb) |
| 1295 | { | 1332 | { |
| 1296 | nf_conntrack_put(skb->nfct); | 1333 | nf_conntrack_put(skb->nfct); |
| 1297 | skb->nfct = NULL; | 1334 | skb->nfct = NULL; |
| 1335 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
| 1336 | nf_conntrack_put_reasm(skb->nfct_reasm); | ||
| 1337 | skb->nfct_reasm = NULL; | ||
| 1338 | #endif | ||
| 1298 | } | 1339 | } |
| 1299 | 1340 | ||
| 1300 | #ifdef CONFIG_BRIDGE_NETFILTER | 1341 | #ifdef CONFIG_BRIDGE_NETFILTER |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 09b9aa60063d..d1ea4051b996 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #if defined(__KERNEL__) | 10 | #if defined(__KERNEL__) |
| 11 | 11 | ||
| 12 | typedef struct kmem_cache_s kmem_cache_t; | 12 | typedef struct kmem_cache kmem_cache_t; |
| 13 | 13 | ||
| 14 | #include <linux/config.h> /* kmalloc_sizes.h needs CONFIG_ options */ | 14 | #include <linux/config.h> /* kmalloc_sizes.h needs CONFIG_ options */ |
| 15 | #include <linux/gfp.h> | 15 | #include <linux/gfp.h> |
diff --git a/include/linux/stallion.h b/include/linux/stallion.h index e89b77b6505a..13a37f137ea2 100644 --- a/include/linux/stallion.h +++ b/include/linux/stallion.h | |||
| @@ -21,8 +21,6 @@ | |||
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include <linux/version.h> | ||
| 25 | |||
| 26 | /*****************************************************************************/ | 24 | /*****************************************************************************/ |
| 27 | #ifndef _STALLION_H | 25 | #ifndef _STALLION_H |
| 28 | #define _STALLION_H | 26 | #define _STALLION_H |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 5af8800e0ce3..e4086ec8b952 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
| @@ -171,7 +171,8 @@ xdr_argsize_check(struct svc_rqst *rqstp, u32 *p) | |||
| 171 | { | 171 | { |
| 172 | char *cp = (char *)p; | 172 | char *cp = (char *)p; |
| 173 | struct kvec *vec = &rqstp->rq_arg.head[0]; | 173 | struct kvec *vec = &rqstp->rq_arg.head[0]; |
| 174 | return cp - (char*)vec->iov_base <= vec->iov_len; | 174 | return cp >= (char*)vec->iov_base |
| 175 | && cp <= (char*)vec->iov_base + vec->iov_len; | ||
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | static inline int | 178 | static inline int |
diff --git a/include/linux/superhyway.h b/include/linux/superhyway.h index c906c5a0aaef..17ea468fa362 100644 --- a/include/linux/superhyway.h +++ b/include/linux/superhyway.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | */ | 19 | */ |
| 20 | #define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183 | 20 | #define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183 |
| 21 | 21 | ||
| 22 | struct vcr_info { | 22 | struct superhyway_vcr_info { |
| 23 | u8 perr_flags; /* P-port Error flags */ | 23 | u8 perr_flags; /* P-port Error flags */ |
| 24 | u8 merr_flags; /* Module Error flags */ | 24 | u8 merr_flags; /* Module Error flags */ |
| 25 | u16 mod_vers; /* Module Version */ | 25 | u16 mod_vers; /* Module Version */ |
| @@ -28,6 +28,17 @@ struct vcr_info { | |||
| 28 | u8 top_mb; /* Top Memory block */ | 28 | u8 top_mb; /* Top Memory block */ |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | struct superhyway_ops { | ||
| 32 | int (*read_vcr)(unsigned long base, struct superhyway_vcr_info *vcr); | ||
| 33 | int (*write_vcr)(unsigned long base, struct superhyway_vcr_info vcr); | ||
| 34 | }; | ||
| 35 | |||
| 36 | struct superhyway_bus { | ||
| 37 | struct superhyway_ops *ops; | ||
| 38 | }; | ||
| 39 | |||
| 40 | extern struct superhyway_bus superhyway_channels[]; | ||
| 41 | |||
| 31 | struct superhyway_device_id { | 42 | struct superhyway_device_id { |
| 32 | unsigned int id; | 43 | unsigned int id; |
| 33 | unsigned long driver_data; | 44 | unsigned long driver_data; |
| @@ -55,9 +66,11 @@ struct superhyway_device { | |||
| 55 | 66 | ||
| 56 | struct superhyway_device_id id; | 67 | struct superhyway_device_id id; |
| 57 | struct superhyway_driver *drv; | 68 | struct superhyway_driver *drv; |
| 69 | struct superhyway_bus *bus; | ||
| 58 | 70 | ||
| 59 | struct resource resource; | 71 | int num_resources; |
| 60 | struct vcr_info vcr; | 72 | struct resource *resource; |
| 73 | struct superhyway_vcr_info vcr; | ||
| 61 | }; | 74 | }; |
| 62 | 75 | ||
| 63 | #define to_superhyway_device(d) container_of((d), struct superhyway_device, dev) | 76 | #define to_superhyway_device(d) container_of((d), struct superhyway_device, dev) |
| @@ -65,12 +78,27 @@ struct superhyway_device { | |||
| 65 | #define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev) | 78 | #define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev) |
| 66 | #define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p)) | 79 | #define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p)) |
| 67 | 80 | ||
| 68 | extern int superhyway_scan_bus(void); | 81 | static inline int |
| 82 | superhyway_read_vcr(struct superhyway_device *dev, unsigned long base, | ||
| 83 | struct superhyway_vcr_info *vcr) | ||
| 84 | { | ||
| 85 | return dev->bus->ops->read_vcr(base, vcr); | ||
| 86 | } | ||
| 87 | |||
| 88 | static inline int | ||
| 89 | superhyway_write_vcr(struct superhyway_device *dev, unsigned long base, | ||
| 90 | struct superhyway_vcr_info vcr) | ||
| 91 | { | ||
| 92 | return dev->bus->ops->write_vcr(base, vcr); | ||
| 93 | } | ||
| 94 | |||
| 95 | extern int superhyway_scan_bus(struct superhyway_bus *); | ||
| 69 | 96 | ||
| 70 | /* drivers/sh/superhyway/superhyway.c */ | 97 | /* drivers/sh/superhyway/superhyway.c */ |
| 71 | int superhyway_register_driver(struct superhyway_driver *); | 98 | int superhyway_register_driver(struct superhyway_driver *); |
| 72 | void superhyway_unregister_driver(struct superhyway_driver *); | 99 | void superhyway_unregister_driver(struct superhyway_driver *); |
| 73 | int superhyway_add_device(unsigned int, unsigned long, unsigned long long); | 100 | int superhyway_add_device(unsigned long base, struct superhyway_device *, struct superhyway_bus *); |
| 101 | int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices); | ||
| 74 | 102 | ||
| 75 | /* drivers/sh/superhyway/superhyway-sysfs.c */ | 103 | /* drivers/sh/superhyway/superhyway-sysfs.c */ |
| 76 | extern struct device_attribute superhyway_dev_attrs[]; | 104 | extern struct device_attribute superhyway_dev_attrs[]; |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index fc8e367f671e..22cf5e1ac987 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/compiler.h> | 24 | #include <linux/compiler.h> |
| 25 | 25 | ||
| 26 | struct file; | 26 | struct file; |
| 27 | struct completion; | ||
| 27 | 28 | ||
| 28 | #define CTL_MAXNAME 10 /* how many path components do we allow in a | 29 | #define CTL_MAXNAME 10 /* how many path components do we allow in a |
| 29 | call to sysctl? In other words, what is | 30 | call to sysctl? In other words, what is |
| @@ -204,6 +205,7 @@ enum | |||
| 204 | NET_ECONET=16, | 205 | NET_ECONET=16, |
| 205 | NET_SCTP=17, | 206 | NET_SCTP=17, |
| 206 | NET_LLC=18, | 207 | NET_LLC=18, |
| 208 | NET_NETFILTER=19, | ||
| 207 | }; | 209 | }; |
| 208 | 210 | ||
| 209 | /* /proc/sys/kernel/random */ | 211 | /* /proc/sys/kernel/random */ |
| @@ -269,6 +271,42 @@ enum | |||
| 269 | NET_UNIX_MAX_DGRAM_QLEN=3, | 271 | NET_UNIX_MAX_DGRAM_QLEN=3, |
| 270 | }; | 272 | }; |
| 271 | 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 | |||
| 272 | /* /proc/sys/net/ipv4 */ | 310 | /* /proc/sys/net/ipv4 */ |
| 273 | enum | 311 | enum |
| 274 | { | 312 | { |
| @@ -925,6 +963,8 @@ struct ctl_table_header | |||
| 925 | { | 963 | { |
| 926 | ctl_table *ctl_table; | 964 | ctl_table *ctl_table; |
| 927 | struct list_head ctl_entry; | 965 | struct list_head ctl_entry; |
| 966 | int used; | ||
| 967 | struct completion *unregistering; | ||
| 928 | }; | 968 | }; |
| 929 | 969 | ||
| 930 | struct ctl_table_header * register_sysctl_table(ctl_table * table, | 970 | struct ctl_table_header * register_sysctl_table(ctl_table * table, |
diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 1cc8c31b7988..91140091ced2 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h | |||
| @@ -1,57 +1,16 @@ | |||
| 1 | #ifndef __LINUX_VIDEODEV_H | 1 | #ifndef __LINUX_VIDEODEV_H |
| 2 | #define __LINUX_VIDEODEV_H | 2 | #define __LINUX_VIDEODEV_H |
| 3 | 3 | ||
| 4 | #include <linux/compiler.h> | ||
| 5 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 6 | 5 | ||
| 7 | #define HAVE_V4L2 1 | 6 | #define HAVE_V4L1 1 |
| 7 | |||
| 8 | #include <linux/videodev2.h> | 8 | #include <linux/videodev2.h> |
| 9 | 9 | ||
| 10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
| 11 | 11 | ||
| 12 | #include <linux/poll.h> | ||
| 13 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
| 14 | #include <linux/device.h> | ||
| 15 | |||
| 16 | struct video_device | ||
| 17 | { | ||
| 18 | /* device info */ | ||
| 19 | struct device *dev; | ||
| 20 | char name[32]; | ||
| 21 | int type; /* v4l1 */ | ||
| 22 | int type2; /* v4l2 */ | ||
| 23 | int hardware; | ||
| 24 | int minor; | ||
| 25 | |||
| 26 | /* device ops + callbacks */ | ||
| 27 | struct file_operations *fops; | ||
| 28 | void (*release)(struct video_device *vfd); | ||
| 29 | |||
| 30 | |||
| 31 | /* obsolete -- fops->owner is used instead */ | ||
| 32 | struct module *owner; | ||
| 33 | /* dev->driver_data will be used instead some day. | ||
| 34 | * Use the video_{get|set}_drvdata() helper functions, | ||
| 35 | * so the switch over will be transparent for you. | ||
| 36 | * Or use {pci|usb}_{get|set}_drvdata() directly. */ | ||
| 37 | void *priv; | ||
| 38 | |||
| 39 | /* for videodev.c intenal usage -- please don't touch */ | ||
| 40 | int users; /* video_exclusive_{open|close} ... */ | ||
| 41 | struct semaphore lock; /* ... helper function uses these */ | ||
| 42 | char devfs_name[64]; /* devfs */ | ||
| 43 | struct class_device class_dev; /* sysfs */ | ||
| 44 | }; | ||
| 45 | |||
| 46 | #define VIDEO_MAJOR 81 | ||
| 47 | |||
| 48 | #define VFL_TYPE_GRABBER 0 | ||
| 49 | #define VFL_TYPE_VBI 1 | ||
| 50 | #define VFL_TYPE_RADIO 2 | ||
| 51 | #define VFL_TYPE_VTX 3 | ||
| 52 | 13 | ||
| 53 | extern int video_register_device(struct video_device *, int type, int nr); | ||
| 54 | extern void video_unregister_device(struct video_device *); | ||
| 55 | extern struct video_device* video_devdata(struct file*); | 14 | extern struct video_device* video_devdata(struct file*); |
| 56 | 15 | ||
| 57 | #define to_video_device(cd) container_of(cd, struct video_device, class_dev) | 16 | #define to_video_device(cd) container_of(cd, struct video_device, class_dev) |
| @@ -68,11 +27,7 @@ video_device_remove_file(struct video_device *vfd, | |||
| 68 | class_device_remove_file(&vfd->class_dev, attr); | 27 | class_device_remove_file(&vfd->class_dev, attr); |
| 69 | } | 28 | } |
| 70 | 29 | ||
| 71 | /* helper functions to alloc / release struct video_device, the | 30 | #if OBSOLETE_OWNER /* to be removed in 2.6.15 */ |
| 72 | later can be used for video_device->release() */ | ||
| 73 | struct video_device *video_device_alloc(void); | ||
| 74 | void video_device_release(struct video_device *vfd); | ||
| 75 | |||
| 76 | /* helper functions to access driver private data. */ | 31 | /* helper functions to access driver private data. */ |
| 77 | static inline void *video_get_drvdata(struct video_device *dev) | 32 | static inline void *video_get_drvdata(struct video_device *dev) |
| 78 | { | 33 | { |
| @@ -83,30 +38,12 @@ static inline void video_set_drvdata(struct video_device *dev, void *data) | |||
| 83 | { | 38 | { |
| 84 | dev->priv = data; | 39 | dev->priv = data; |
| 85 | } | 40 | } |
| 41 | #endif | ||
| 86 | 42 | ||
| 87 | extern int video_exclusive_open(struct inode *inode, struct file *file); | 43 | extern int video_exclusive_open(struct inode *inode, struct file *file); |
| 88 | extern int video_exclusive_release(struct inode *inode, struct file *file); | 44 | extern int video_exclusive_release(struct inode *inode, struct file *file); |
| 89 | extern int video_usercopy(struct inode *inode, struct file *file, | ||
| 90 | unsigned int cmd, unsigned long arg, | ||
| 91 | int (*func)(struct inode *inode, struct file *file, | ||
| 92 | unsigned int cmd, void *arg)); | ||
| 93 | #endif /* __KERNEL__ */ | 45 | #endif /* __KERNEL__ */ |
| 94 | 46 | ||
| 95 | #define VID_TYPE_CAPTURE 1 /* Can capture */ | ||
| 96 | #define VID_TYPE_TUNER 2 /* Can tune */ | ||
| 97 | #define VID_TYPE_TELETEXT 4 /* Does teletext */ | ||
| 98 | #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ | ||
| 99 | #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ | ||
| 100 | #define VID_TYPE_CLIPPING 32 /* Can clip */ | ||
| 101 | #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ | ||
| 102 | #define VID_TYPE_SCALES 128 /* Scalable */ | ||
| 103 | #define VID_TYPE_MONOCHROME 256 /* Monochrome only */ | ||
| 104 | #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ | ||
| 105 | #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ | ||
| 106 | #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ | ||
| 107 | #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ | ||
| 108 | #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ | ||
| 109 | |||
| 110 | struct video_capability | 47 | struct video_capability |
| 111 | { | 48 | { |
| 112 | char name[32]; | 49 | char name[32]; |
| @@ -202,9 +139,9 @@ struct video_audio | |||
| 202 | #define VIDEO_SOUND_STEREO 2 | 139 | #define VIDEO_SOUND_STEREO 2 |
| 203 | #define VIDEO_SOUND_LANG1 4 | 140 | #define VIDEO_SOUND_LANG1 4 |
| 204 | #define VIDEO_SOUND_LANG2 8 | 141 | #define VIDEO_SOUND_LANG2 8 |
| 205 | __u16 mode; | 142 | __u16 mode; |
| 206 | __u16 balance; /* Stereo balance */ | 143 | __u16 balance; /* Stereo balance */ |
| 207 | __u16 step; /* Step actual volume uses */ | 144 | __u16 step; /* Step actual volume uses */ |
| 208 | }; | 145 | }; |
| 209 | 146 | ||
| 210 | struct video_clip | 147 | struct video_clip |
| @@ -260,9 +197,6 @@ struct video_key | |||
| 260 | __u32 flags; | 197 | __u32 flags; |
| 261 | }; | 198 | }; |
| 262 | 199 | ||
| 263 | |||
| 264 | #define VIDEO_MAX_FRAME 32 | ||
| 265 | |||
| 266 | struct video_mbuf | 200 | struct video_mbuf |
| 267 | { | 201 | { |
| 268 | int size; /* Total memory to map */ | 202 | int size; /* Total memory to map */ |
| @@ -270,10 +204,8 @@ struct video_mbuf | |||
| 270 | int offsets[VIDEO_MAX_FRAME]; | 204 | int offsets[VIDEO_MAX_FRAME]; |
| 271 | }; | 205 | }; |
| 272 | 206 | ||
| 273 | |||
| 274 | #define VIDEO_NO_UNIT (-1) | 207 | #define VIDEO_NO_UNIT (-1) |
| 275 | 208 | ||
| 276 | |||
| 277 | struct video_unit | 209 | struct video_unit |
| 278 | { | 210 | { |
| 279 | int video; /* Video minor */ | 211 | int video; /* Video minor */ |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 89a055761bed..a114fff6568b 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -15,16 +15,99 @@ | |||
| 15 | */ | 15 | */ |
| 16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
| 17 | #include <linux/time.h> /* need struct timeval */ | 17 | #include <linux/time.h> /* need struct timeval */ |
| 18 | #include <linux/poll.h> | ||
| 19 | #include <linux/device.h> | ||
| 18 | #endif | 20 | #endif |
| 19 | #include <linux/compiler.h> /* need __user */ | 21 | #include <linux/compiler.h> /* need __user */ |
| 20 | 22 | ||
| 23 | |||
| 24 | #define OBSOLETE_OWNER 1 /* It will be removed for 2.6.15 */ | ||
| 25 | #define HAVE_V4L2 1 | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Common stuff for both V4L1 and V4L2 | ||
| 29 | * Moved from videodev.h | ||
| 30 | */ | ||
| 31 | |||
| 32 | #define VIDEO_MAX_FRAME 32 | ||
| 33 | |||
| 34 | #define VID_TYPE_CAPTURE 1 /* Can capture */ | ||
| 35 | #define VID_TYPE_TUNER 2 /* Can tune */ | ||
| 36 | #define VID_TYPE_TELETEXT 4 /* Does teletext */ | ||
| 37 | #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ | ||
| 38 | #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ | ||
| 39 | #define VID_TYPE_CLIPPING 32 /* Can clip */ | ||
| 40 | #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ | ||
| 41 | #define VID_TYPE_SCALES 128 /* Scalable */ | ||
| 42 | #define VID_TYPE_MONOCHROME 256 /* Monochrome only */ | ||
| 43 | #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ | ||
| 44 | #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ | ||
| 45 | #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ | ||
| 46 | #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ | ||
| 47 | #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ | ||
| 48 | |||
| 49 | #ifdef __KERNEL__ | ||
| 50 | |||
| 51 | #define VFL_TYPE_GRABBER 0 | ||
| 52 | #define VFL_TYPE_VBI 1 | ||
| 53 | #define VFL_TYPE_RADIO 2 | ||
| 54 | #define VFL_TYPE_VTX 3 | ||
| 55 | |||
| 56 | struct video_device | ||
| 57 | { | ||
| 58 | /* device info */ | ||
| 59 | struct device *dev; | ||
| 60 | char name[32]; | ||
| 61 | int type; /* v4l1 */ | ||
| 62 | int type2; /* v4l2 */ | ||
| 63 | int hardware; | ||
| 64 | int minor; | ||
| 65 | |||
| 66 | /* device ops + callbacks */ | ||
| 67 | struct file_operations *fops; | ||
| 68 | void (*release)(struct video_device *vfd); | ||
| 69 | |||
| 70 | |||
| 71 | #if OBSOLETE_OWNER /* to be removed in 2.6.15 */ | ||
| 72 | /* obsolete -- fops->owner is used instead */ | ||
| 73 | struct module *owner; | ||
| 74 | /* dev->driver_data will be used instead some day. | ||
| 75 | * Use the video_{get|set}_drvdata() helper functions, | ||
| 76 | * so the switch over will be transparent for you. | ||
| 77 | * Or use {pci|usb}_{get|set}_drvdata() directly. */ | ||
| 78 | void *priv; | ||
| 79 | #endif | ||
| 80 | |||
| 81 | /* for videodev.c intenal usage -- please don't touch */ | ||
| 82 | int users; /* video_exclusive_{open|close} ... */ | ||
| 83 | struct semaphore lock; /* ... helper function uses these */ | ||
| 84 | char devfs_name[64]; /* devfs */ | ||
| 85 | struct class_device class_dev; /* sysfs */ | ||
| 86 | }; | ||
| 87 | |||
| 88 | #define VIDEO_MAJOR 81 | ||
| 89 | |||
| 90 | extern int video_register_device(struct video_device *, int type, int nr); | ||
| 91 | extern void video_unregister_device(struct video_device *); | ||
| 92 | extern int video_usercopy(struct inode *inode, struct file *file, | ||
| 93 | unsigned int cmd, unsigned long arg, | ||
| 94 | int (*func)(struct inode *inode, struct file *file, | ||
| 95 | unsigned int cmd, void *arg)); | ||
| 96 | |||
| 97 | /* helper functions to alloc / release struct video_device, the | ||
| 98 | later can be used for video_device->release() */ | ||
| 99 | struct video_device *video_device_alloc(void); | ||
| 100 | void video_device_release(struct video_device *vfd); | ||
| 101 | |||
| 102 | #endif | ||
| 103 | |||
| 21 | /* | 104 | /* |
| 22 | * M I S C E L L A N E O U S | 105 | * M I S C E L L A N E O U S |
| 23 | */ | 106 | */ |
| 24 | 107 | ||
| 25 | /* Four-character-code (FOURCC) */ | 108 | /* Four-character-code (FOURCC) */ |
| 26 | #define v4l2_fourcc(a,b,c,d)\ | 109 | #define v4l2_fourcc(a,b,c,d)\ |
| 27 | (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) | 110 | (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) |
| 28 | 111 | ||
| 29 | /* | 112 | /* |
| 30 | * E N U M S | 113 | * E N U M S |
| @@ -154,20 +237,20 @@ struct v4l2_capability | |||
| 154 | }; | 237 | }; |
| 155 | 238 | ||
| 156 | /* Values for 'capabilities' field */ | 239 | /* Values for 'capabilities' field */ |
| 157 | #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ | 240 | #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ |
| 158 | #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ | 241 | #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ |
| 159 | #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ | 242 | #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ |
| 160 | #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ | 243 | #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ |
| 161 | #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ | 244 | #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ |
| 162 | #if 1 | 245 | #if 1 |
| 163 | #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ | 246 | #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ |
| 164 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ | 247 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ |
| 165 | #endif | 248 | #endif |
| 166 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ | 249 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ |
| 167 | 250 | ||
| 168 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ | 251 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ |
| 169 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ | 252 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ |
| 170 | #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ | 253 | #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ |
| 171 | 254 | ||
| 172 | #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ | 255 | #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ |
| 173 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ | 256 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ |
| @@ -179,13 +262,13 @@ struct v4l2_capability | |||
| 179 | 262 | ||
| 180 | struct v4l2_pix_format | 263 | struct v4l2_pix_format |
| 181 | { | 264 | { |
| 182 | __u32 width; | 265 | __u32 width; |
| 183 | __u32 height; | 266 | __u32 height; |
| 184 | __u32 pixelformat; | 267 | __u32 pixelformat; |
| 185 | enum v4l2_field field; | 268 | enum v4l2_field field; |
| 186 | __u32 bytesperline; /* for padding, zero if unused */ | 269 | __u32 bytesperline; /* for padding, zero if unused */ |
| 187 | __u32 sizeimage; | 270 | __u32 sizeimage; |
| 188 | enum v4l2_colorspace colorspace; | 271 | enum v4l2_colorspace colorspace; |
| 189 | __u32 priv; /* private data, depends on pixelformat */ | 272 | __u32 priv; /* private data, depends on pixelformat */ |
| 190 | }; | 273 | }; |
| 191 | 274 | ||
| @@ -238,12 +321,12 @@ struct v4l2_pix_format | |||
| 238 | */ | 321 | */ |
| 239 | struct v4l2_fmtdesc | 322 | struct v4l2_fmtdesc |
| 240 | { | 323 | { |
| 241 | __u32 index; /* Format number */ | 324 | __u32 index; /* Format number */ |
| 242 | enum v4l2_buf_type type; /* buffer type */ | 325 | enum v4l2_buf_type type; /* buffer type */ |
| 243 | __u32 flags; | 326 | __u32 flags; |
| 244 | __u8 description[32]; /* Description string */ | 327 | __u8 description[32]; /* Description string */ |
| 245 | __u32 pixelformat; /* Format fourcc */ | 328 | __u32 pixelformat; /* Format fourcc */ |
| 246 | __u32 reserved[4]; | 329 | __u32 reserved[4]; |
| 247 | }; | 330 | }; |
| 248 | 331 | ||
| 249 | #define V4L2_FMT_FLAG_COMPRESSED 0x0001 | 332 | #define V4L2_FMT_FLAG_COMPRESSED 0x0001 |
| @@ -393,7 +476,7 @@ struct v4l2_jpegcompression | |||
| 393 | #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ | 476 | #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ |
| 394 | #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ | 477 | #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ |
| 395 | #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will | 478 | #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will |
| 396 | * allways use APP0 */ | 479 | * allways use APP0 */ |
| 397 | }; | 480 | }; |
| 398 | 481 | ||
| 399 | 482 | ||
| @@ -402,10 +485,10 @@ struct v4l2_jpegcompression | |||
| 402 | */ | 485 | */ |
| 403 | struct v4l2_requestbuffers | 486 | struct v4l2_requestbuffers |
| 404 | { | 487 | { |
| 405 | __u32 count; | 488 | __u32 count; |
| 406 | enum v4l2_buf_type type; | 489 | enum v4l2_buf_type type; |
| 407 | enum v4l2_memory memory; | 490 | enum v4l2_memory memory; |
| 408 | __u32 reserved[2]; | 491 | __u32 reserved[2]; |
| 409 | }; | 492 | }; |
| 410 | 493 | ||
| 411 | struct v4l2_buffer | 494 | struct v4l2_buffer |
| @@ -511,9 +594,9 @@ struct v4l2_outputparm | |||
| 511 | 594 | ||
| 512 | struct v4l2_cropcap { | 595 | struct v4l2_cropcap { |
| 513 | enum v4l2_buf_type type; | 596 | enum v4l2_buf_type type; |
| 514 | struct v4l2_rect bounds; | 597 | struct v4l2_rect bounds; |
| 515 | struct v4l2_rect defrect; | 598 | struct v4l2_rect defrect; |
| 516 | struct v4l2_fract pixelaspect; | 599 | struct v4l2_fract pixelaspect; |
| 517 | }; | 600 | }; |
| 518 | 601 | ||
| 519 | struct v4l2_crop { | 602 | struct v4l2_crop { |
| @@ -544,6 +627,7 @@ typedef __u64 v4l2_std_id; | |||
| 544 | 627 | ||
| 545 | #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) | 628 | #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) |
| 546 | #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) | 629 | #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) |
| 630 | #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) | ||
| 547 | 631 | ||
| 548 | #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) | 632 | #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) |
| 549 | #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) | 633 | #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) |
| @@ -581,13 +665,14 @@ typedef __u64 v4l2_std_id; | |||
| 581 | 665 | ||
| 582 | #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ | 666 | #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ |
| 583 | V4L2_STD_PAL_60 |\ | 667 | V4L2_STD_PAL_60 |\ |
| 584 | V4L2_STD_NTSC) | 668 | V4L2_STD_NTSC |\ |
| 669 | V4L2_STD_NTSC_443) | ||
| 585 | #define V4L2_STD_625_50 (V4L2_STD_PAL |\ | 670 | #define V4L2_STD_625_50 (V4L2_STD_PAL |\ |
| 586 | V4L2_STD_PAL_N |\ | 671 | V4L2_STD_PAL_N |\ |
| 587 | V4L2_STD_PAL_Nc |\ | 672 | V4L2_STD_PAL_Nc |\ |
| 588 | V4L2_STD_SECAM) | 673 | V4L2_STD_SECAM) |
| 589 | #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ | 674 | #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ |
| 590 | V4L2_STD_ATSC_16_VSB) | 675 | V4L2_STD_ATSC_16_VSB) |
| 591 | 676 | ||
| 592 | #define V4L2_STD_UNKNOWN 0 | 677 | #define V4L2_STD_UNKNOWN 0 |
| 593 | #define V4L2_STD_ALL (V4L2_STD_525_60 |\ | 678 | #define V4L2_STD_ALL (V4L2_STD_525_60 |\ |
| @@ -595,7 +680,7 @@ typedef __u64 v4l2_std_id; | |||
| 595 | 680 | ||
| 596 | struct v4l2_standard | 681 | struct v4l2_standard |
| 597 | { | 682 | { |
| 598 | __u32 index; | 683 | __u32 index; |
| 599 | v4l2_std_id id; | 684 | v4l2_std_id id; |
| 600 | __u8 name[24]; | 685 | __u8 name[24]; |
| 601 | struct v4l2_fract frameperiod; /* Frames, not fields */ | 686 | struct v4l2_fract frameperiod; /* Frames, not fields */ |
| @@ -610,9 +695,9 @@ struct v4l2_standard | |||
| 610 | struct v4l2_input | 695 | struct v4l2_input |
| 611 | { | 696 | { |
| 612 | __u32 index; /* Which input */ | 697 | __u32 index; /* Which input */ |
| 613 | __u8 name[32]; /* Label */ | 698 | __u8 name[32]; /* Label */ |
| 614 | __u32 type; /* Type of input */ | 699 | __u32 type; /* Type of input */ |
| 615 | __u32 audioset; /* Associated audios (bitfield) */ | 700 | __u32 audioset; /* Associated audios (bitfield) */ |
| 616 | __u32 tuner; /* Associated tuner */ | 701 | __u32 tuner; /* Associated tuner */ |
| 617 | v4l2_std_id std; | 702 | v4l2_std_id std; |
| 618 | __u32 status; | 703 | __u32 status; |
| @@ -647,9 +732,9 @@ struct v4l2_input | |||
| 647 | struct v4l2_output | 732 | struct v4l2_output |
| 648 | { | 733 | { |
| 649 | __u32 index; /* Which output */ | 734 | __u32 index; /* Which output */ |
| 650 | __u8 name[32]; /* Label */ | 735 | __u8 name[32]; /* Label */ |
| 651 | __u32 type; /* Type of output */ | 736 | __u32 type; /* Type of output */ |
| 652 | __u32 audioset; /* Associated audios (bitfield) */ | 737 | __u32 audioset; /* Associated audios (bitfield) */ |
| 653 | __u32 modulator; /* Associated modulator */ | 738 | __u32 modulator; /* Associated modulator */ |
| 654 | v4l2_std_id std; | 739 | v4l2_std_id std; |
| 655 | __u32 reserved[4]; | 740 | __u32 reserved[4]; |
| @@ -671,12 +756,12 @@ struct v4l2_control | |||
| 671 | /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ | 756 | /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ |
| 672 | struct v4l2_queryctrl | 757 | struct v4l2_queryctrl |
| 673 | { | 758 | { |
| 674 | __u32 id; | 759 | __u32 id; |
| 675 | enum v4l2_ctrl_type type; | 760 | enum v4l2_ctrl_type type; |
| 676 | __u8 name[32]; /* Whatever */ | 761 | __u8 name[32]; /* Whatever */ |
| 677 | __s32 minimum; /* Note signedness */ | 762 | __s32 minimum; /* Note signedness */ |
| 678 | __s32 maximum; | 763 | __s32 maximum; |
| 679 | __s32 step; | 764 | __s32 step; |
| 680 | __s32 default_value; | 765 | __s32 default_value; |
| 681 | __u32 flags; | 766 | __u32 flags; |
| 682 | __u32 reserved[2]; | 767 | __u32 reserved[2]; |
| @@ -779,10 +864,10 @@ struct v4l2_modulator | |||
| 779 | 864 | ||
| 780 | struct v4l2_frequency | 865 | struct v4l2_frequency |
| 781 | { | 866 | { |
| 782 | __u32 tuner; | 867 | __u32 tuner; |
| 783 | enum v4l2_tuner_type type; | 868 | enum v4l2_tuner_type type; |
| 784 | __u32 frequency; | 869 | __u32 frequency; |
| 785 | __u32 reserved[8]; | 870 | __u32 reserved[8]; |
| 786 | }; | 871 | }; |
| 787 | 872 | ||
| 788 | /* | 873 | /* |
| @@ -802,6 +887,7 @@ struct v4l2_audio | |||
| 802 | 887 | ||
| 803 | /* Flags for the 'mode' field */ | 888 | /* Flags for the 'mode' field */ |
| 804 | #define V4L2_AUDMODE_AVL 0x00001 | 889 | #define V4L2_AUDMODE_AVL 0x00001 |
| 890 | #define V4L2_AUDMODE_32BITS 0x00002 | ||
| 805 | 891 | ||
| 806 | struct v4l2_audioout | 892 | struct v4l2_audioout |
| 807 | { | 893 | { |
| @@ -846,14 +932,14 @@ struct v4l2_vbi_format | |||
| 846 | 932 | ||
| 847 | struct v4l2_sliced_vbi_format | 933 | struct v4l2_sliced_vbi_format |
| 848 | { | 934 | { |
| 849 | __u16 service_set; | 935 | __u16 service_set; |
| 850 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field | 936 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field |
| 851 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field | 937 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field |
| 852 | (equals frame lines 313-336 for 625 line video | 938 | (equals frame lines 313-336 for 625 line video |
| 853 | standards, 263-286 for 525 line standards) */ | 939 | standards, 263-286 for 525 line standards) */ |
| 854 | __u16 service_lines[2][24]; | 940 | __u16 service_lines[2][24]; |
| 855 | __u32 io_size; | 941 | __u32 io_size; |
| 856 | __u32 reserved[2]; /* must be zero */ | 942 | __u32 reserved[2]; /* must be zero */ |
| 857 | }; | 943 | }; |
| 858 | 944 | ||
| 859 | #define V4L2_SLICED_TELETEXT_B (0x0001) | 945 | #define V4L2_SLICED_TELETEXT_B (0x0001) |
| @@ -866,22 +952,22 @@ struct v4l2_sliced_vbi_format | |||
| 866 | 952 | ||
| 867 | struct v4l2_sliced_vbi_cap | 953 | struct v4l2_sliced_vbi_cap |
| 868 | { | 954 | { |
| 869 | __u16 service_set; | 955 | __u16 service_set; |
| 870 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field | 956 | /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field |
| 871 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field | 957 | service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field |
| 872 | (equals frame lines 313-336 for 625 line video | 958 | (equals frame lines 313-336 for 625 line video |
| 873 | standards, 263-286 for 525 line standards) */ | 959 | standards, 263-286 for 525 line standards) */ |
| 874 | __u16 service_lines[2][24]; | 960 | __u16 service_lines[2][24]; |
| 875 | __u32 reserved[4]; /* must be 0 */ | 961 | __u32 reserved[4]; /* must be 0 */ |
| 876 | }; | 962 | }; |
| 877 | 963 | ||
| 878 | struct v4l2_sliced_vbi_data | 964 | struct v4l2_sliced_vbi_data |
| 879 | { | 965 | { |
| 880 | __u32 id; | 966 | __u32 id; |
| 881 | __u32 field; /* 0: first field, 1: second field */ | 967 | __u32 field; /* 0: first field, 1: second field */ |
| 882 | __u32 line; /* 1-23 */ | 968 | __u32 line; /* 1-23 */ |
| 883 | __u32 reserved; /* must be 0 */ | 969 | __u32 reserved; /* must be 0 */ |
| 884 | __u8 data[48]; | 970 | __u8 data[48]; |
| 885 | }; | 971 | }; |
| 886 | #endif | 972 | #endif |
| 887 | 973 | ||
| @@ -896,9 +982,9 @@ struct v4l2_format | |||
| 896 | enum v4l2_buf_type type; | 982 | enum v4l2_buf_type type; |
| 897 | union | 983 | union |
| 898 | { | 984 | { |
| 899 | struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE | 985 | struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE |
| 900 | struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY | 986 | struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY |
| 901 | struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE | 987 | struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE |
| 902 | #if 1 | 988 | #if 1 |
| 903 | struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE | 989 | struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE |
| 904 | #endif | 990 | #endif |
| @@ -981,6 +1067,7 @@ struct v4l2_streamparm | |||
| 981 | #if 1 | 1067 | #if 1 |
| 982 | #define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) | 1068 | #define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) |
| 983 | #endif | 1069 | #endif |
| 1070 | #define VIDIOC_LOG_STATUS _IO ('V', 70) | ||
| 984 | 1071 | ||
| 985 | /* for compatibility, will go away some day */ | 1072 | /* for compatibility, will go away some day */ |
| 986 | #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) | 1073 | #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) |
diff --git a/include/linux/wait.h b/include/linux/wait.h index d38c9fecdc36..d28518236b62 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
| @@ -54,6 +54,7 @@ struct __wait_queue_head { | |||
| 54 | }; | 54 | }; |
| 55 | typedef struct __wait_queue_head wait_queue_head_t; | 55 | typedef struct __wait_queue_head wait_queue_head_t; |
| 56 | 56 | ||
| 57 | struct task_struct; | ||
| 57 | 58 | ||
| 58 | /* | 59 | /* |
| 59 | * Macros for declaration and initialisaton of the datatypes | 60 | * Macros for declaration and initialisaton of the datatypes |
diff --git a/include/media/audiochip.h b/include/media/audiochip.h index a7ceee9fc5e9..b7d4b0930408 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h | |||
| @@ -4,6 +4,23 @@ | |||
| 4 | #ifndef AUDIOCHIP_H | 4 | #ifndef AUDIOCHIP_H |
| 5 | #define AUDIOCHIP_H | 5 | #define AUDIOCHIP_H |
| 6 | 6 | ||
| 7 | enum audiochip { | ||
| 8 | AUDIO_CHIP_NONE, | ||
| 9 | AUDIO_CHIP_UNKNOWN, | ||
| 10 | /* Provided by video chip */ | ||
| 11 | AUDIO_CHIP_INTERNAL, | ||
| 12 | /* Provided by tvaudio.c */ | ||
| 13 | AUDIO_CHIP_TDA8425, | ||
| 14 | AUDIO_CHIP_TEA6300, | ||
| 15 | AUDIO_CHIP_TEA6420, | ||
| 16 | AUDIO_CHIP_TDA9840, | ||
| 17 | AUDIO_CHIP_TDA985X, | ||
| 18 | AUDIO_CHIP_TDA9874, | ||
| 19 | AUDIO_CHIP_PIC16C54, | ||
| 20 | /* Provided by msp3400.c */ | ||
| 21 | AUDIO_CHIP_MSP34XX | ||
| 22 | }; | ||
| 23 | |||
| 7 | /* ---------------------------------------------------------------------- */ | 24 | /* ---------------------------------------------------------------------- */ |
| 8 | 25 | ||
| 9 | /* v4l device was opened in Radio mode */ | 26 | /* v4l device was opened in Radio mode */ |
diff --git a/include/media/id.h b/include/media/id.h deleted file mode 100644 index 6d02c94cdc0d..000000000000 --- a/include/media/id.h +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | /* | ||
| 2 | */ | ||
| 3 | |||
| 4 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ | ||
| 5 | |||
| 6 | /* drivers */ | ||
| 7 | #ifndef I2C_DRIVERID_TVMIXER | ||
| 8 | # define I2C_DRIVERID_TVMIXER I2C_DRIVERID_EXP0 | ||
| 9 | #endif | ||
| 10 | #ifndef I2C_DRIVERID_TVAUDIO | ||
| 11 | # define I2C_DRIVERID_TVAUDIO I2C_DRIVERID_EXP1 | ||
| 12 | #endif | ||
| 13 | |||
| 14 | /* chips */ | ||
| 15 | #ifndef I2C_DRIVERID_DPL3518 | ||
| 16 | # define I2C_DRIVERID_DPL3518 I2C_DRIVERID_EXP2 | ||
| 17 | #endif | ||
| 18 | #ifndef I2C_DRIVERID_TDA9873 | ||
| 19 | # define I2C_DRIVERID_TDA9873 I2C_DRIVERID_EXP3 | ||
| 20 | #endif | ||
| 21 | #ifndef I2C_DRIVERID_TDA9875 | ||
| 22 | # define I2C_DRIVERID_TDA9875 I2C_DRIVERID_EXP0+4 | ||
| 23 | #endif | ||
| 24 | #ifndef I2C_DRIVERID_PIC16C54_PV951 | ||
| 25 | # define I2C_DRIVERID_PIC16C54_PV951 I2C_DRIVERID_EXP0+5 | ||
| 26 | #endif | ||
| 27 | #ifndef I2C_DRIVERID_TDA7432 | ||
| 28 | # define I2C_DRIVERID_TDA7432 I2C_DRIVERID_EXP0+6 | ||
| 29 | #endif | ||
| 30 | #ifndef I2C_DRIVERID_TDA9874 | ||
| 31 | # define I2C_DRIVERID_TDA9874 I2C_DRIVERID_EXP0+7 | ||
| 32 | #endif | ||
| 33 | #ifndef I2C_DRIVERID_SAA6752HS | ||
| 34 | # define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8 | ||
| 35 | #endif | ||
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 01b56822df4d..0f1ba95ec8d6 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
| @@ -20,8 +20,10 @@ | |||
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | #include <linux/input.h> | 23 | #ifndef _IR_COMMON |
| 24 | #define _IR_COMMON | ||
| 24 | 25 | ||
| 26 | #include <linux/input.h> | ||
| 25 | 27 | ||
| 26 | #define IR_TYPE_RC5 1 | 28 | #define IR_TYPE_RC5 1 |
| 27 | #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ | 29 | #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ |
| @@ -61,6 +63,8 @@ int ir_dump_samples(u32 *samples, int count); | |||
| 61 | int ir_decode_biphase(u32 *samples, int count, int low, int high); | 63 | int ir_decode_biphase(u32 *samples, int count, int low, int high); |
| 62 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); | 64 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); |
| 63 | 65 | ||
| 66 | #endif | ||
| 67 | |||
| 64 | /* | 68 | /* |
| 65 | * Local variables: | 69 | * Local variables: |
| 66 | * c-basic-offset: 8 | 70 | * c-basic-offset: 8 |
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h new file mode 100644 index 000000000000..00fa57eb9fde --- /dev/null +++ b/include/media/ir-kbd-i2c.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #ifndef _IR_I2C | ||
| 2 | #define _IR_I2C | ||
| 3 | |||
| 4 | #include <media/ir-common.h> | ||
| 5 | |||
| 6 | struct IR_i2c; | ||
| 7 | |||
| 8 | struct IR_i2c { | ||
| 9 | IR_KEYTAB_TYPE *ir_codes; | ||
| 10 | struct i2c_client c; | ||
| 11 | struct input_dev *input; | ||
| 12 | struct ir_input_state ir; | ||
| 13 | |||
| 14 | /* Used to avoid fast repeating */ | ||
| 15 | unsigned char old; | ||
| 16 | |||
| 17 | struct work_struct work; | ||
| 18 | struct timer_list timer; | ||
| 19 | char phys[32]; | ||
| 20 | int (*get_key)(struct IR_i2c*, u32*, u32*); | ||
| 21 | }; | ||
| 22 | #endif | ||
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index f3aa24f8131c..64691753721e 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef __SAA7146_VV__ | 1 | #ifndef __SAA7146_VV__ |
| 2 | #define __SAA7146_VV__ | 2 | #define __SAA7146_VV__ |
| 3 | 3 | ||
| 4 | #include <linux/videodev2.h> | 4 | #include <linux/videodev.h> |
| 5 | 5 | ||
| 6 | #include <media/saa7146.h> | 6 | #include <media/saa7146.h> |
| 7 | #include <media/video-buf.h> | 7 | #include <media/video-buf.h> |
diff --git a/include/media/tuner.h b/include/media/tuner.h index 4ad08e24a1aa..9184e534b7ef 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
| @@ -95,7 +95,7 @@ | |||
| 95 | #define TUNER_THOMSON_DTT7610 52 | 95 | #define TUNER_THOMSON_DTT7610 52 |
| 96 | #define TUNER_PHILIPS_FQ1286 53 | 96 | #define TUNER_PHILIPS_FQ1286 53 |
| 97 | #define TUNER_PHILIPS_TDA8290 54 | 97 | #define TUNER_PHILIPS_TDA8290 54 |
| 98 | #define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ | 98 | #define TUNER_TCL_2002MB 55 /* Hauppauge PVR-150 PAL */ |
| 99 | 99 | ||
| 100 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ | 100 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ |
| 101 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ | 101 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ |
| @@ -110,6 +110,9 @@ | |||
| 110 | #define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ | 110 | #define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ |
| 111 | #define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ | 111 | #define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ |
| 112 | #define TUNER_LG_NTSC_TALN_MINI 66 | 112 | #define TUNER_LG_NTSC_TALN_MINI 66 |
| 113 | #define TUNER_PHILIPS_TD1316 67 | ||
| 114 | |||
| 115 | #define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ | ||
| 113 | 116 | ||
| 114 | #define NOTUNER 0 | 117 | #define NOTUNER 0 |
| 115 | #define PAL 1 /* PAL_BG */ | 118 | #define PAL 1 /* PAL_BG */ |
| @@ -145,6 +148,7 @@ | |||
| 145 | # define TDA9887_INTERCARRIER (1<<4) | 148 | # define TDA9887_INTERCARRIER (1<<4) |
| 146 | # define TDA9887_PORT1_ACTIVE (1<<5) | 149 | # define TDA9887_PORT1_ACTIVE (1<<5) |
| 147 | # define TDA9887_PORT2_ACTIVE (1<<6) | 150 | # define TDA9887_PORT2_ACTIVE (1<<6) |
| 151 | # define TDA9887_INTERCARRIER_NTSC (1<<7) | ||
| 148 | /* config options */ | 152 | /* config options */ |
| 149 | # define TDA9887_DEEMPHASIS_MASK (3<<16) | 153 | # define TDA9887_DEEMPHASIS_MASK (3<<16) |
| 150 | # define TDA9887_DEEMPHASIS_NONE (1<<16) | 154 | # define TDA9887_DEEMPHASIS_NONE (1<<16) |
| @@ -188,8 +192,11 @@ struct tuner { | |||
| 188 | unsigned int radio_if2; | 192 | unsigned int radio_if2; |
| 189 | 193 | ||
| 190 | /* used by tda8290 */ | 194 | /* used by tda8290 */ |
| 191 | unsigned char i2c_easy_mode[2]; | 195 | unsigned char tda8290_easy_mode; |
| 192 | unsigned char i2c_set_freq[8]; | 196 | unsigned char tda827x_lpsel; |
| 197 | unsigned char tda827x_addr; | ||
| 198 | unsigned char tda827x_ver; | ||
| 199 | unsigned int sgIF; | ||
| 193 | 200 | ||
| 194 | /* function ptrs */ | 201 | /* function ptrs */ |
| 195 | void (*tv_freq)(struct i2c_client *c, unsigned int freq); | 202 | void (*tv_freq)(struct i2c_client *c, unsigned int freq); |
| @@ -204,20 +211,21 @@ extern unsigned const int tuner_count; | |||
| 204 | 211 | ||
| 205 | extern int microtune_init(struct i2c_client *c); | 212 | extern int microtune_init(struct i2c_client *c); |
| 206 | extern int tda8290_init(struct i2c_client *c); | 213 | extern int tda8290_init(struct i2c_client *c); |
| 214 | extern int tda8290_probe(struct i2c_client *c); | ||
| 207 | extern int tea5767_tuner_init(struct i2c_client *c); | 215 | extern int tea5767_tuner_init(struct i2c_client *c); |
| 208 | extern int default_tuner_init(struct i2c_client *c); | 216 | extern int default_tuner_init(struct i2c_client *c); |
| 209 | extern int tea5767_autodetection(struct i2c_client *c); | 217 | extern int tea5767_autodetection(struct i2c_client *c); |
| 210 | 218 | ||
| 211 | #define tuner_warn(fmt, arg...) do {\ | 219 | #define tuner_warn(fmt, arg...) do {\ |
| 212 | printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ | 220 | printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ |
| 213 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) | 221 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
| 214 | #define tuner_info(fmt, arg...) do {\ | 222 | #define tuner_info(fmt, arg...) do {\ |
| 215 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ | 223 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ |
| 216 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) | 224 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
| 217 | #define tuner_dbg(fmt, arg...) do {\ | 225 | #define tuner_dbg(fmt, arg...) do {\ |
| 218 | if (tuner_debug) \ | 226 | if (tuner_debug) \ |
| 219 | printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ | 227 | printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ |
| 220 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) | 228 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
| 221 | 229 | ||
| 222 | #endif /* __KERNEL__ */ | 230 | #endif /* __KERNEL__ */ |
| 223 | 231 | ||
diff --git a/include/media/video-buf.h b/include/media/video-buf.h index ae8d7a000440..8ecfd78e0027 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | * (at your option) any later version. | 17 | * (at your option) any later version. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include <linux/videodev.h> | 20 | #include <linux/videodev2.h> |
| 21 | 21 | ||
| 22 | #define UNSET (-1U) | 22 | #define UNSET (-1U) |
| 23 | 23 | ||
| @@ -177,7 +177,7 @@ struct videobuf_queue_ops { | |||
| 177 | }; | 177 | }; |
| 178 | 178 | ||
| 179 | struct videobuf_queue { | 179 | struct videobuf_queue { |
| 180 | struct semaphore lock; | 180 | struct semaphore lock; |
| 181 | spinlock_t *irqlock; | 181 | spinlock_t *irqlock; |
| 182 | struct pci_dev *pci; | 182 | struct pci_dev *pci; |
| 183 | 183 | ||
diff --git a/include/mtd/inftl-user.h b/include/mtd/inftl-user.h index bda4f2c8f728..9b1e2526b45e 100644 --- a/include/mtd/inftl-user.h +++ b/include/mtd/inftl-user.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: inftl-user.h,v 1.1 2004/05/05 15:17:00 dwmw2 Exp $ | 2 | * $Id: inftl-user.h,v 1.2 2005/11/07 11:14:56 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * Parts of INFTL headers shared with userspace | 4 | * Parts of INFTL headers shared with userspace |
| 5 | * | 5 | * |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 428d9122940b..b5994ea56a5a 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: mtd-abi.h,v 1.11 2005/05/19 16:08:58 gleixner Exp $ | 2 | * $Id: mtd-abi.h,v 1.13 2005/11/07 11:14:56 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * Portions of MTD ABI definition which are shared by kernel and user space | 4 | * Portions of MTD ABI definition which are shared by kernel and user space |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef __MTD_ABI_H__ | 7 | #ifndef __MTD_ABI_H__ |
| @@ -42,6 +42,7 @@ struct mtd_oob_buf { | |||
| 42 | #define MTD_OOB 64 // Out-of-band data (NAND flash) | 42 | #define MTD_OOB 64 // Out-of-band data (NAND flash) |
| 43 | #define MTD_ECC 128 // Device capable of automatic ECC | 43 | #define MTD_ECC 128 // Device capable of automatic ECC |
| 44 | #define MTD_NO_VIRTBLOCKS 256 // Virtual blocks not allowed | 44 | #define MTD_NO_VIRTBLOCKS 256 // Virtual blocks not allowed |
| 45 | #define MTD_PROGRAM_REGIONS 512 // Configurable Programming Regions | ||
| 45 | 46 | ||
| 46 | // Some common devices / combinations of capabilities | 47 | // Some common devices / combinations of capabilities |
| 47 | #define MTD_CAP_ROM 0 | 48 | #define MTD_CAP_ROM 0 |
| @@ -80,7 +81,7 @@ struct mtd_info_user { | |||
| 80 | }; | 81 | }; |
| 81 | 82 | ||
| 82 | struct region_info_user { | 83 | struct region_info_user { |
| 83 | uint32_t offset; /* At which this region starts, | 84 | uint32_t offset; /* At which this region starts, |
| 84 | * from the beginning of the MTD */ | 85 | * from the beginning of the MTD */ |
| 85 | uint32_t erasesize; /* For this region */ | 86 | uint32_t erasesize; /* For this region */ |
| 86 | uint32_t numblocks; /* Number of blocks in this region */ | 87 | uint32_t numblocks; /* Number of blocks in this region */ |
diff --git a/include/mtd/nftl-user.h b/include/mtd/nftl-user.h index 924ec0459e9c..b2bca18e7311 100644 --- a/include/mtd/nftl-user.h +++ b/include/mtd/nftl-user.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: nftl-user.h,v 1.1 2004/05/05 14:44:57 dwmw2 Exp $ | 2 | * $Id: nftl-user.h,v 1.2 2005/11/07 11:14:56 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * Parts of NFTL headers shared with userspace | 4 | * Parts of NFTL headers shared with userspace |
| 5 | * | 5 | * |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index e42d728b1620..911ceb5cd263 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -57,8 +57,6 @@ | |||
| 57 | #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) | 57 | #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) |
| 58 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) | 58 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) |
| 59 | 59 | ||
| 60 | extern struct proc_dir_entry *proc_bt; | ||
| 61 | |||
| 62 | /* Connection and socket states */ | 60 | /* Connection and socket states */ |
| 63 | enum { | 61 | enum { |
| 64 | BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ | 62 | BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ |
| @@ -177,4 +175,6 @@ extern int hci_sock_cleanup(void); | |||
| 177 | extern int bt_sysfs_init(void); | 175 | extern int bt_sysfs_init(void); |
| 178 | extern void bt_sysfs_cleanup(void); | 176 | extern void bt_sysfs_cleanup(void); |
| 179 | 177 | ||
| 178 | extern struct class bt_class; | ||
| 179 | |||
| 180 | #endif /* __BLUETOOTH_H */ | 180 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index fa2d12b0579b..b06a2d2f63d2 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -184,10 +184,10 @@ enum { | |||
| 184 | struct hci_rp_read_loc_version { | 184 | struct hci_rp_read_loc_version { |
| 185 | __u8 status; | 185 | __u8 status; |
| 186 | __u8 hci_ver; | 186 | __u8 hci_ver; |
| 187 | __u16 hci_rev; | 187 | __le16 hci_rev; |
| 188 | __u8 lmp_ver; | 188 | __u8 lmp_ver; |
| 189 | __u16 manufacturer; | 189 | __le16 manufacturer; |
| 190 | __u16 lmp_subver; | 190 | __le16 lmp_subver; |
| 191 | } __attribute__ ((packed)); | 191 | } __attribute__ ((packed)); |
| 192 | 192 | ||
| 193 | #define OCF_READ_LOCAL_FEATURES 0x0003 | 193 | #define OCF_READ_LOCAL_FEATURES 0x0003 |
| @@ -199,10 +199,10 @@ struct hci_rp_read_loc_features { | |||
| 199 | #define OCF_READ_BUFFER_SIZE 0x0005 | 199 | #define OCF_READ_BUFFER_SIZE 0x0005 |
| 200 | struct hci_rp_read_buffer_size { | 200 | struct hci_rp_read_buffer_size { |
| 201 | __u8 status; | 201 | __u8 status; |
| 202 | __u16 acl_mtu; | 202 | __le16 acl_mtu; |
| 203 | __u8 sco_mtu; | 203 | __u8 sco_mtu; |
| 204 | __u16 acl_max_pkt; | 204 | __le16 acl_max_pkt; |
| 205 | __u16 sco_max_pkt; | 205 | __le16 sco_max_pkt; |
| 206 | } __attribute__ ((packed)); | 206 | } __attribute__ ((packed)); |
| 207 | 207 | ||
| 208 | #define OCF_READ_BD_ADDR 0x0009 | 208 | #define OCF_READ_BD_ADDR 0x0009 |
| @@ -267,21 +267,21 @@ struct hci_cp_write_dev_class { | |||
| 267 | 267 | ||
| 268 | #define OCF_READ_VOICE_SETTING 0x0025 | 268 | #define OCF_READ_VOICE_SETTING 0x0025 |
| 269 | struct hci_rp_read_voice_setting { | 269 | struct hci_rp_read_voice_setting { |
| 270 | __u8 status; | 270 | __u8 status; |
| 271 | __u16 voice_setting; | 271 | __le16 voice_setting; |
| 272 | } __attribute__ ((packed)); | 272 | } __attribute__ ((packed)); |
| 273 | 273 | ||
| 274 | #define OCF_WRITE_VOICE_SETTING 0x0026 | 274 | #define OCF_WRITE_VOICE_SETTING 0x0026 |
| 275 | struct hci_cp_write_voice_setting { | 275 | struct hci_cp_write_voice_setting { |
| 276 | __u16 voice_setting; | 276 | __le16 voice_setting; |
| 277 | } __attribute__ ((packed)); | 277 | } __attribute__ ((packed)); |
| 278 | 278 | ||
| 279 | #define OCF_HOST_BUFFER_SIZE 0x0033 | 279 | #define OCF_HOST_BUFFER_SIZE 0x0033 |
| 280 | struct hci_cp_host_buffer_size { | 280 | struct hci_cp_host_buffer_size { |
| 281 | __u16 acl_mtu; | 281 | __le16 acl_mtu; |
| 282 | __u8 sco_mtu; | 282 | __u8 sco_mtu; |
| 283 | __u16 acl_max_pkt; | 283 | __le16 acl_max_pkt; |
| 284 | __u16 sco_max_pkt; | 284 | __le16 sco_max_pkt; |
| 285 | } __attribute__ ((packed)); | 285 | } __attribute__ ((packed)); |
| 286 | 286 | ||
| 287 | /* Link Control */ | 287 | /* Link Control */ |
| @@ -289,10 +289,10 @@ struct hci_cp_host_buffer_size { | |||
| 289 | #define OCF_CREATE_CONN 0x0005 | 289 | #define OCF_CREATE_CONN 0x0005 |
| 290 | struct hci_cp_create_conn { | 290 | struct hci_cp_create_conn { |
| 291 | bdaddr_t bdaddr; | 291 | bdaddr_t bdaddr; |
| 292 | __u16 pkt_type; | 292 | __le16 pkt_type; |
| 293 | __u8 pscan_rep_mode; | 293 | __u8 pscan_rep_mode; |
| 294 | __u8 pscan_mode; | 294 | __u8 pscan_mode; |
| 295 | __u16 clock_offset; | 295 | __le16 clock_offset; |
| 296 | __u8 role_switch; | 296 | __u8 role_switch; |
| 297 | } __attribute__ ((packed)); | 297 | } __attribute__ ((packed)); |
| 298 | 298 | ||
| @@ -310,14 +310,14 @@ struct hci_cp_reject_conn_req { | |||
| 310 | 310 | ||
| 311 | #define OCF_DISCONNECT 0x0006 | 311 | #define OCF_DISCONNECT 0x0006 |
| 312 | struct hci_cp_disconnect { | 312 | struct hci_cp_disconnect { |
| 313 | __u16 handle; | 313 | __le16 handle; |
| 314 | __u8 reason; | 314 | __u8 reason; |
| 315 | } __attribute__ ((packed)); | 315 | } __attribute__ ((packed)); |
| 316 | 316 | ||
| 317 | #define OCF_ADD_SCO 0x0007 | 317 | #define OCF_ADD_SCO 0x0007 |
| 318 | struct hci_cp_add_sco { | 318 | struct hci_cp_add_sco { |
| 319 | __u16 handle; | 319 | __le16 handle; |
| 320 | __u16 pkt_type; | 320 | __le16 pkt_type; |
| 321 | } __attribute__ ((packed)); | 321 | } __attribute__ ((packed)); |
| 322 | 322 | ||
| 323 | #define OCF_INQUIRY 0x0001 | 323 | #define OCF_INQUIRY 0x0001 |
| @@ -354,56 +354,56 @@ struct hci_cp_pin_code_neg_reply { | |||
| 354 | 354 | ||
| 355 | #define OCF_CHANGE_CONN_PTYPE 0x000F | 355 | #define OCF_CHANGE_CONN_PTYPE 0x000F |
| 356 | struct hci_cp_change_conn_ptype { | 356 | struct hci_cp_change_conn_ptype { |
| 357 | __u16 handle; | 357 | __le16 handle; |
| 358 | __u16 pkt_type; | 358 | __le16 pkt_type; |
| 359 | } __attribute__ ((packed)); | 359 | } __attribute__ ((packed)); |
| 360 | 360 | ||
| 361 | #define OCF_AUTH_REQUESTED 0x0011 | 361 | #define OCF_AUTH_REQUESTED 0x0011 |
| 362 | struct hci_cp_auth_requested { | 362 | struct hci_cp_auth_requested { |
| 363 | __u16 handle; | 363 | __le16 handle; |
| 364 | } __attribute__ ((packed)); | 364 | } __attribute__ ((packed)); |
| 365 | 365 | ||
| 366 | #define OCF_SET_CONN_ENCRYPT 0x0013 | 366 | #define OCF_SET_CONN_ENCRYPT 0x0013 |
| 367 | struct hci_cp_set_conn_encrypt { | 367 | struct hci_cp_set_conn_encrypt { |
| 368 | __u16 handle; | 368 | __le16 handle; |
| 369 | __u8 encrypt; | 369 | __u8 encrypt; |
| 370 | } __attribute__ ((packed)); | 370 | } __attribute__ ((packed)); |
| 371 | 371 | ||
| 372 | #define OCF_CHANGE_CONN_LINK_KEY 0x0015 | 372 | #define OCF_CHANGE_CONN_LINK_KEY 0x0015 |
| 373 | struct hci_cp_change_conn_link_key { | 373 | struct hci_cp_change_conn_link_key { |
| 374 | __u16 handle; | 374 | __le16 handle; |
| 375 | } __attribute__ ((packed)); | 375 | } __attribute__ ((packed)); |
| 376 | 376 | ||
| 377 | #define OCF_READ_REMOTE_FEATURES 0x001B | 377 | #define OCF_READ_REMOTE_FEATURES 0x001B |
| 378 | struct hci_cp_read_rmt_features { | 378 | struct hci_cp_read_rmt_features { |
| 379 | __u16 handle; | 379 | __le16 handle; |
| 380 | } __attribute__ ((packed)); | 380 | } __attribute__ ((packed)); |
| 381 | 381 | ||
| 382 | #define OCF_READ_REMOTE_VERSION 0x001D | 382 | #define OCF_READ_REMOTE_VERSION 0x001D |
| 383 | struct hci_cp_read_rmt_version { | 383 | struct hci_cp_read_rmt_version { |
| 384 | __u16 handle; | 384 | __le16 handle; |
| 385 | } __attribute__ ((packed)); | 385 | } __attribute__ ((packed)); |
| 386 | 386 | ||
| 387 | /* Link Policy */ | 387 | /* Link Policy */ |
| 388 | #define OGF_LINK_POLICY 0x02 | 388 | #define OGF_LINK_POLICY 0x02 |
| 389 | #define OCF_ROLE_DISCOVERY 0x0009 | 389 | #define OCF_ROLE_DISCOVERY 0x0009 |
| 390 | struct hci_cp_role_discovery { | 390 | struct hci_cp_role_discovery { |
| 391 | __u16 handle; | 391 | __le16 handle; |
| 392 | } __attribute__ ((packed)); | 392 | } __attribute__ ((packed)); |
| 393 | struct hci_rp_role_discovery { | 393 | struct hci_rp_role_discovery { |
| 394 | __u8 status; | 394 | __u8 status; |
| 395 | __u16 handle; | 395 | __le16 handle; |
| 396 | __u8 role; | 396 | __u8 role; |
| 397 | } __attribute__ ((packed)); | 397 | } __attribute__ ((packed)); |
| 398 | 398 | ||
| 399 | #define OCF_READ_LINK_POLICY 0x000C | 399 | #define OCF_READ_LINK_POLICY 0x000C |
| 400 | struct hci_cp_read_link_policy { | 400 | struct hci_cp_read_link_policy { |
| 401 | __u16 handle; | 401 | __le16 handle; |
| 402 | } __attribute__ ((packed)); | 402 | } __attribute__ ((packed)); |
| 403 | struct hci_rp_read_link_policy { | 403 | struct hci_rp_read_link_policy { |
| 404 | __u8 status; | 404 | __u8 status; |
| 405 | __u16 handle; | 405 | __le16 handle; |
| 406 | __u16 policy; | 406 | __le16 policy; |
| 407 | } __attribute__ ((packed)); | 407 | } __attribute__ ((packed)); |
| 408 | 408 | ||
| 409 | #define OCF_SWITCH_ROLE 0x000B | 409 | #define OCF_SWITCH_ROLE 0x000B |
| @@ -414,12 +414,12 @@ struct hci_cp_switch_role { | |||
| 414 | 414 | ||
| 415 | #define OCF_WRITE_LINK_POLICY 0x000D | 415 | #define OCF_WRITE_LINK_POLICY 0x000D |
| 416 | struct hci_cp_write_link_policy { | 416 | struct hci_cp_write_link_policy { |
| 417 | __u16 handle; | 417 | __le16 handle; |
| 418 | __u16 policy; | 418 | __le16 policy; |
| 419 | } __attribute__ ((packed)); | 419 | } __attribute__ ((packed)); |
| 420 | struct hci_rp_write_link_policy { | 420 | struct hci_rp_write_link_policy { |
| 421 | __u8 status; | 421 | __u8 status; |
| 422 | __u16 handle; | 422 | __le16 handle; |
| 423 | } __attribute__ ((packed)); | 423 | } __attribute__ ((packed)); |
| 424 | 424 | ||
| 425 | /* Status params */ | 425 | /* Status params */ |
| @@ -441,7 +441,7 @@ struct inquiry_info { | |||
| 441 | __u8 pscan_period_mode; | 441 | __u8 pscan_period_mode; |
| 442 | __u8 pscan_mode; | 442 | __u8 pscan_mode; |
| 443 | __u8 dev_class[3]; | 443 | __u8 dev_class[3]; |
| 444 | __u16 clock_offset; | 444 | __le16 clock_offset; |
| 445 | } __attribute__ ((packed)); | 445 | } __attribute__ ((packed)); |
| 446 | 446 | ||
| 447 | #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 | 447 | #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 |
| @@ -450,7 +450,7 @@ struct inquiry_info_with_rssi { | |||
| 450 | __u8 pscan_rep_mode; | 450 | __u8 pscan_rep_mode; |
| 451 | __u8 pscan_period_mode; | 451 | __u8 pscan_period_mode; |
| 452 | __u8 dev_class[3]; | 452 | __u8 dev_class[3]; |
| 453 | __u16 clock_offset; | 453 | __le16 clock_offset; |
| 454 | __s8 rssi; | 454 | __s8 rssi; |
| 455 | } __attribute__ ((packed)); | 455 | } __attribute__ ((packed)); |
| 456 | struct inquiry_info_with_rssi_and_pscan_mode { | 456 | struct inquiry_info_with_rssi_and_pscan_mode { |
| @@ -459,7 +459,7 @@ struct inquiry_info_with_rssi_and_pscan_mode { | |||
| 459 | __u8 pscan_period_mode; | 459 | __u8 pscan_period_mode; |
| 460 | __u8 pscan_mode; | 460 | __u8 pscan_mode; |
| 461 | __u8 dev_class[3]; | 461 | __u8 dev_class[3]; |
| 462 | __u16 clock_offset; | 462 | __le16 clock_offset; |
| 463 | __s8 rssi; | 463 | __s8 rssi; |
| 464 | } __attribute__ ((packed)); | 464 | } __attribute__ ((packed)); |
| 465 | 465 | ||
| @@ -469,7 +469,7 @@ struct extended_inquiry_info { | |||
| 469 | __u8 pscan_rep_mode; | 469 | __u8 pscan_rep_mode; |
| 470 | __u8 pscan_period_mode; | 470 | __u8 pscan_period_mode; |
| 471 | __u8 dev_class[3]; | 471 | __u8 dev_class[3]; |
| 472 | __u16 clock_offset; | 472 | __le16 clock_offset; |
| 473 | __s8 rssi; | 473 | __s8 rssi; |
| 474 | __u8 data[240]; | 474 | __u8 data[240]; |
| 475 | } __attribute__ ((packed)); | 475 | } __attribute__ ((packed)); |
| @@ -477,7 +477,7 @@ struct extended_inquiry_info { | |||
| 477 | #define HCI_EV_CONN_COMPLETE 0x03 | 477 | #define HCI_EV_CONN_COMPLETE 0x03 |
| 478 | struct hci_ev_conn_complete { | 478 | struct hci_ev_conn_complete { |
| 479 | __u8 status; | 479 | __u8 status; |
| 480 | __u16 handle; | 480 | __le16 handle; |
| 481 | bdaddr_t bdaddr; | 481 | bdaddr_t bdaddr; |
| 482 | __u8 link_type; | 482 | __u8 link_type; |
| 483 | __u8 encr_mode; | 483 | __u8 encr_mode; |
| @@ -493,27 +493,27 @@ struct hci_ev_conn_request { | |||
| 493 | #define HCI_EV_DISCONN_COMPLETE 0x05 | 493 | #define HCI_EV_DISCONN_COMPLETE 0x05 |
| 494 | struct hci_ev_disconn_complete { | 494 | struct hci_ev_disconn_complete { |
| 495 | __u8 status; | 495 | __u8 status; |
| 496 | __u16 handle; | 496 | __le16 handle; |
| 497 | __u8 reason; | 497 | __u8 reason; |
| 498 | } __attribute__ ((packed)); | 498 | } __attribute__ ((packed)); |
| 499 | 499 | ||
| 500 | #define HCI_EV_AUTH_COMPLETE 0x06 | 500 | #define HCI_EV_AUTH_COMPLETE 0x06 |
| 501 | struct hci_ev_auth_complete { | 501 | struct hci_ev_auth_complete { |
| 502 | __u8 status; | 502 | __u8 status; |
| 503 | __u16 handle; | 503 | __le16 handle; |
| 504 | } __attribute__ ((packed)); | 504 | } __attribute__ ((packed)); |
| 505 | 505 | ||
| 506 | #define HCI_EV_ENCRYPT_CHANGE 0x08 | 506 | #define HCI_EV_ENCRYPT_CHANGE 0x08 |
| 507 | struct hci_ev_encrypt_change { | 507 | struct hci_ev_encrypt_change { |
| 508 | __u8 status; | 508 | __u8 status; |
| 509 | __u16 handle; | 509 | __le16 handle; |
| 510 | __u8 encrypt; | 510 | __u8 encrypt; |
| 511 | } __attribute__ ((packed)); | 511 | } __attribute__ ((packed)); |
| 512 | 512 | ||
| 513 | #define HCI_EV_CHANGE_CONN_LINK_KEY_COMPLETE 0x09 | 513 | #define HCI_EV_CHANGE_CONN_LINK_KEY_COMPLETE 0x09 |
| 514 | struct hci_ev_change_conn_link_key_complete { | 514 | struct hci_ev_change_conn_link_key_complete { |
| 515 | __u8 status; | 515 | __u8 status; |
| 516 | __u16 handle; | 516 | __le16 handle; |
| 517 | } __attribute__ ((packed)); | 517 | } __attribute__ ((packed)); |
| 518 | 518 | ||
| 519 | #define HCI_EV_QOS_SETUP_COMPLETE 0x0D | 519 | #define HCI_EV_QOS_SETUP_COMPLETE 0x0D |
| @@ -526,21 +526,21 @@ struct hci_qos { | |||
| 526 | } __attribute__ ((packed)); | 526 | } __attribute__ ((packed)); |
| 527 | struct hci_ev_qos_setup_complete { | 527 | struct hci_ev_qos_setup_complete { |
| 528 | __u8 status; | 528 | __u8 status; |
| 529 | __u16 handle; | 529 | __le16 handle; |
| 530 | struct hci_qos qos; | 530 | struct hci_qos qos; |
| 531 | } __attribute__ ((packed)); | 531 | } __attribute__ ((packed)); |
| 532 | 532 | ||
| 533 | #define HCI_EV_CMD_COMPLETE 0x0E | 533 | #define HCI_EV_CMD_COMPLETE 0x0E |
| 534 | struct hci_ev_cmd_complete { | 534 | struct hci_ev_cmd_complete { |
| 535 | __u8 ncmd; | 535 | __u8 ncmd; |
| 536 | __u16 opcode; | 536 | __le16 opcode; |
| 537 | } __attribute__ ((packed)); | 537 | } __attribute__ ((packed)); |
| 538 | 538 | ||
| 539 | #define HCI_EV_CMD_STATUS 0x0F | 539 | #define HCI_EV_CMD_STATUS 0x0F |
| 540 | struct hci_ev_cmd_status { | 540 | struct hci_ev_cmd_status { |
| 541 | __u8 status; | 541 | __u8 status; |
| 542 | __u8 ncmd; | 542 | __u8 ncmd; |
| 543 | __u16 opcode; | 543 | __le16 opcode; |
| 544 | } __attribute__ ((packed)); | 544 | } __attribute__ ((packed)); |
| 545 | 545 | ||
| 546 | #define HCI_EV_NUM_COMP_PKTS 0x13 | 546 | #define HCI_EV_NUM_COMP_PKTS 0x13 |
| @@ -559,9 +559,9 @@ struct hci_ev_role_change { | |||
| 559 | #define HCI_EV_MODE_CHANGE 0x14 | 559 | #define HCI_EV_MODE_CHANGE 0x14 |
| 560 | struct hci_ev_mode_change { | 560 | struct hci_ev_mode_change { |
| 561 | __u8 status; | 561 | __u8 status; |
| 562 | __u16 handle; | 562 | __le16 handle; |
| 563 | __u8 mode; | 563 | __u8 mode; |
| 564 | __u16 interval; | 564 | __le16 interval; |
| 565 | } __attribute__ ((packed)); | 565 | } __attribute__ ((packed)); |
| 566 | 566 | ||
| 567 | #define HCI_EV_PIN_CODE_REQ 0x16 | 567 | #define HCI_EV_PIN_CODE_REQ 0x16 |
| @@ -584,24 +584,24 @@ struct hci_ev_link_key_notify { | |||
| 584 | #define HCI_EV_RMT_FEATURES 0x0B | 584 | #define HCI_EV_RMT_FEATURES 0x0B |
| 585 | struct hci_ev_rmt_features { | 585 | struct hci_ev_rmt_features { |
| 586 | __u8 status; | 586 | __u8 status; |
| 587 | __u16 handle; | 587 | __le16 handle; |
| 588 | __u8 features[8]; | 588 | __u8 features[8]; |
| 589 | } __attribute__ ((packed)); | 589 | } __attribute__ ((packed)); |
| 590 | 590 | ||
| 591 | #define HCI_EV_RMT_VERSION 0x0C | 591 | #define HCI_EV_RMT_VERSION 0x0C |
| 592 | struct hci_ev_rmt_version { | 592 | struct hci_ev_rmt_version { |
| 593 | __u8 status; | 593 | __u8 status; |
| 594 | __u16 handle; | 594 | __le16 handle; |
| 595 | __u8 lmp_ver; | 595 | __u8 lmp_ver; |
| 596 | __u16 manufacturer; | 596 | __le16 manufacturer; |
| 597 | __u16 lmp_subver; | 597 | __le16 lmp_subver; |
| 598 | } __attribute__ ((packed)); | 598 | } __attribute__ ((packed)); |
| 599 | 599 | ||
| 600 | #define HCI_EV_CLOCK_OFFSET 0x01C | 600 | #define HCI_EV_CLOCK_OFFSET 0x01C |
| 601 | struct hci_ev_clock_offset { | 601 | struct hci_ev_clock_offset { |
| 602 | __u8 status; | 602 | __u8 status; |
| 603 | __u16 handle; | 603 | __le16 handle; |
| 604 | __u16 clock_offset; | 604 | __le16 clock_offset; |
| 605 | } __attribute__ ((packed)); | 605 | } __attribute__ ((packed)); |
| 606 | 606 | ||
| 607 | #define HCI_EV_PSCAN_REP_MODE 0x20 | 607 | #define HCI_EV_PSCAN_REP_MODE 0x20 |
| @@ -638,7 +638,7 @@ struct hci_ev_si_security { | |||
| 638 | #define HCI_SCO_HDR_SIZE 3 | 638 | #define HCI_SCO_HDR_SIZE 3 |
| 639 | 639 | ||
| 640 | struct hci_command_hdr { | 640 | struct hci_command_hdr { |
| 641 | __u16 opcode; /* OCF & OGF */ | 641 | __le16 opcode; /* OCF & OGF */ |
| 642 | __u8 plen; | 642 | __u8 plen; |
| 643 | } __attribute__ ((packed)); | 643 | } __attribute__ ((packed)); |
| 644 | 644 | ||
| @@ -648,22 +648,22 @@ struct hci_event_hdr { | |||
| 648 | } __attribute__ ((packed)); | 648 | } __attribute__ ((packed)); |
| 649 | 649 | ||
| 650 | struct hci_acl_hdr { | 650 | struct hci_acl_hdr { |
| 651 | __u16 handle; /* Handle & Flags(PB, BC) */ | 651 | __le16 handle; /* Handle & Flags(PB, BC) */ |
| 652 | __u16 dlen; | 652 | __le16 dlen; |
| 653 | } __attribute__ ((packed)); | 653 | } __attribute__ ((packed)); |
| 654 | 654 | ||
| 655 | struct hci_sco_hdr { | 655 | struct hci_sco_hdr { |
| 656 | __u16 handle; | 656 | __le16 handle; |
| 657 | __u8 dlen; | 657 | __u8 dlen; |
| 658 | } __attribute__ ((packed)); | 658 | } __attribute__ ((packed)); |
| 659 | 659 | ||
| 660 | /* Command opcode pack/unpack */ | 660 | /* Command opcode pack/unpack */ |
| 661 | #define hci_opcode_pack(ogf, ocf) (__u16)((ocf & 0x03ff)|(ogf << 10)) | 661 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
| 662 | #define hci_opcode_ogf(op) (op >> 10) | 662 | #define hci_opcode_ogf(op) (op >> 10) |
| 663 | #define hci_opcode_ocf(op) (op & 0x03ff) | 663 | #define hci_opcode_ocf(op) (op & 0x03ff) |
| 664 | 664 | ||
| 665 | /* ACL handle and flags pack/unpack */ | 665 | /* ACL handle and flags pack/unpack */ |
| 666 | #define hci_handle_pack(h, f) (__u16)((h & 0x0fff)|(f << 12)) | 666 | #define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) |
| 667 | #define hci_handle(h) (h & 0x0fff) | 667 | #define hci_handle(h) (h & 0x0fff) |
| 668 | #define hci_flags(h) (h >> 12) | 668 | #define hci_flags(h) (h >> 12) |
| 669 | 669 | ||
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7f933f302078..bb9f81dc8723 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #ifndef __HCI_CORE_H | 25 | #ifndef __HCI_CORE_H |
| 26 | #define __HCI_CORE_H | 26 | #define __HCI_CORE_H |
| 27 | 27 | ||
| 28 | #include <linux/proc_fs.h> | ||
| 29 | #include <net/bluetooth/hci.h> | 28 | #include <net/bluetooth/hci.h> |
| 30 | 29 | ||
| 31 | /* HCI upper protocols */ | 30 | /* HCI upper protocols */ |
| @@ -34,8 +33,6 @@ | |||
| 34 | 33 | ||
| 35 | #define HCI_INIT_TIMEOUT (HZ * 10) | 34 | #define HCI_INIT_TIMEOUT (HZ * 10) |
| 36 | 35 | ||
| 37 | extern struct proc_dir_entry *proc_bt_hci; | ||
| 38 | |||
| 39 | /* HCI Core structures */ | 36 | /* HCI Core structures */ |
| 40 | 37 | ||
| 41 | struct inquiry_data { | 38 | struct inquiry_data { |
| @@ -44,7 +41,7 @@ struct inquiry_data { | |||
| 44 | __u8 pscan_period_mode; | 41 | __u8 pscan_period_mode; |
| 45 | __u8 pscan_mode; | 42 | __u8 pscan_mode; |
| 46 | __u8 dev_class[3]; | 43 | __u8 dev_class[3]; |
| 47 | __u16 clock_offset; | 44 | __le16 clock_offset; |
| 48 | __s8 rssi; | 45 | __s8 rssi; |
| 49 | }; | 46 | }; |
| 50 | 47 | ||
| @@ -126,10 +123,6 @@ struct hci_dev { | |||
| 126 | 123 | ||
| 127 | atomic_t promisc; | 124 | atomic_t promisc; |
| 128 | 125 | ||
| 129 | #ifdef CONFIG_PROC_FS | ||
| 130 | struct proc_dir_entry *proc; | ||
| 131 | #endif | ||
| 132 | |||
| 133 | struct class_device class_dev; | 126 | struct class_device class_dev; |
| 134 | 127 | ||
| 135 | struct module *owner; | 128 | struct module *owner; |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index e656be7c001a..bbfac86734ec 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
| @@ -351,6 +351,4 @@ int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); | |||
| 351 | int rfcomm_init_ttys(void); | 351 | int rfcomm_init_ttys(void); |
| 352 | void rfcomm_cleanup_ttys(void); | 352 | void rfcomm_cleanup_ttys(void); |
| 353 | 353 | ||
| 354 | extern struct proc_dir_entry *proc_bt_rfcomm; | ||
| 355 | |||
| 356 | #endif /* __RFCOMM_H */ | 354 | #endif /* __RFCOMM_H */ |
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/ieee80211.h b/include/net/ieee80211.h index 5e38dca1d082..b93fd8c1d884 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #include <linux/kernel.h> /* ARRAY_SIZE */ | 29 | #include <linux/kernel.h> /* ARRAY_SIZE */ |
| 30 | #include <linux/wireless.h> | 30 | #include <linux/wireless.h> |
| 31 | 31 | ||
| 32 | #define IEEE80211_VERSION "git-1.1.6" | 32 | #define IEEE80211_VERSION "git-1.1.7" |
| 33 | 33 | ||
| 34 | #define IEEE80211_DATA_LEN 2304 | 34 | #define IEEE80211_DATA_LEN 2304 |
| 35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | 35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index 0a1c2d82ca4b..225fc751d464 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h | |||
| @@ -31,6 +31,7 @@ enum { | |||
| 31 | 31 | ||
| 32 | struct ieee80211_crypto_ops { | 32 | struct ieee80211_crypto_ops { |
| 33 | const char *name; | 33 | const char *name; |
| 34 | struct list_head list; | ||
| 34 | 35 | ||
| 35 | /* init new crypto context (e.g., allocate private data space, | 36 | /* init new crypto context (e.g., allocate private data space, |
| 36 | * select IV, etc.); returns NULL on failure or pointer to allocated | 37 | * select IV, etc.); returns NULL on failure or pointer to allocated |
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index f87845e2e965..b0c47e2eccf1 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _INET_ECN_H_ | 2 | #define _INET_ECN_H_ |
| 3 | 3 | ||
| 4 | #include <linux/ip.h> | 4 | #include <linux/ip.h> |
| 5 | #include <linux/skbuff.h> | ||
| 5 | #include <net/dsfield.h> | 6 | #include <net/dsfield.h> |
| 6 | 7 | ||
| 7 | enum { | 8 | enum { |
| @@ -48,7 +49,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner) | |||
| 48 | (label) |= __constant_htons(INET_ECN_ECT_0 << 4); \ | 49 | (label) |= __constant_htons(INET_ECN_ECT_0 << 4); \ |
| 49 | } while (0) | 50 | } while (0) |
| 50 | 51 | ||
| 51 | static inline void IP_ECN_set_ce(struct iphdr *iph) | 52 | static inline int IP_ECN_set_ce(struct iphdr *iph) |
| 52 | { | 53 | { |
| 53 | u32 check = iph->check; | 54 | u32 check = iph->check; |
| 54 | u32 ecn = (iph->tos + 1) & INET_ECN_MASK; | 55 | u32 ecn = (iph->tos + 1) & INET_ECN_MASK; |
| @@ -61,7 +62,7 @@ static inline void IP_ECN_set_ce(struct iphdr *iph) | |||
| 61 | * INET_ECN_CE => 00 | 62 | * INET_ECN_CE => 00 |
| 62 | */ | 63 | */ |
| 63 | if (!(ecn & 2)) | 64 | if (!(ecn & 2)) |
| 64 | return; | 65 | return !ecn; |
| 65 | 66 | ||
| 66 | /* | 67 | /* |
| 67 | * The following gives us: | 68 | * The following gives us: |
| @@ -72,6 +73,7 @@ static inline void IP_ECN_set_ce(struct iphdr *iph) | |||
| 72 | 73 | ||
| 73 | iph->check = check + (check>=0xFFFF); | 74 | iph->check = check + (check>=0xFFFF); |
| 74 | iph->tos |= INET_ECN_CE; | 75 | iph->tos |= INET_ECN_CE; |
| 76 | return 1; | ||
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | static inline void IP_ECN_clear(struct iphdr *iph) | 79 | static inline void IP_ECN_clear(struct iphdr *iph) |
| @@ -87,11 +89,12 @@ static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner) | |||
| 87 | 89 | ||
| 88 | struct ipv6hdr; | 90 | struct ipv6hdr; |
| 89 | 91 | ||
| 90 | static inline void IP6_ECN_set_ce(struct ipv6hdr *iph) | 92 | static inline int IP6_ECN_set_ce(struct ipv6hdr *iph) |
| 91 | { | 93 | { |
| 92 | if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) | 94 | if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) |
| 93 | return; | 95 | return 0; |
| 94 | *(u32*)iph |= htonl(INET_ECN_CE << 20); | 96 | *(u32*)iph |= htonl(INET_ECN_CE << 20); |
| 97 | return 1; | ||
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | static inline void IP6_ECN_clear(struct ipv6hdr *iph) | 100 | static inline void IP6_ECN_clear(struct ipv6hdr *iph) |
| @@ -105,4 +108,21 @@ static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) | |||
| 105 | ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); | 108 | ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); |
| 106 | } | 109 | } |
| 107 | 110 | ||
| 111 | static inline int INET_ECN_set_ce(struct sk_buff *skb) | ||
| 112 | { | ||
| 113 | switch (skb->protocol) { | ||
| 114 | case __constant_htons(ETH_P_IP): | ||
| 115 | if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail) | ||
| 116 | return IP_ECN_set_ce(skb->nh.iph); | ||
| 117 | break; | ||
| 118 | |||
| 119 | case __constant_htons(ETH_P_IPV6): | ||
| 120 | if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail) | ||
| 121 | return IP6_ECN_set_ce(skb->nh.ipv6h); | ||
| 122 | break; | ||
| 123 | } | ||
| 124 | |||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 108 | #endif | 128 | #endif |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index f50f95968340..07840baa9341 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -125,9 +125,7 @@ struct inet_hashinfo { | |||
| 125 | rwlock_t lhash_lock ____cacheline_aligned; | 125 | rwlock_t lhash_lock ____cacheline_aligned; |
| 126 | atomic_t lhash_users; | 126 | atomic_t lhash_users; |
| 127 | wait_queue_head_t lhash_wait; | 127 | wait_queue_head_t lhash_wait; |
| 128 | spinlock_t portalloc_lock; | ||
| 129 | kmem_cache_t *bind_bucket_cachep; | 128 | kmem_cache_t *bind_bucket_cachep; |
| 130 | int port_rover; | ||
| 131 | }; | 129 | }; |
| 132 | 130 | ||
| 133 | static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | 131 | static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 65ec86678a08..6addb4d464d6 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -252,12 +252,25 @@ typedef int (*inet_getfrag_t) (const void *data, | |||
| 252 | char *, | 252 | char *, |
| 253 | unsigned int, unsigned int); | 253 | unsigned int, unsigned int); |
| 254 | 254 | ||
| 255 | 255 | extern int __ipv6_addr_type(const struct in6_addr *addr); | |
| 256 | extern int ipv6_addr_type(const struct in6_addr *addr); | 256 | static inline int ipv6_addr_type(const struct in6_addr *addr) |
| 257 | { | ||
| 258 | return __ipv6_addr_type(addr) & 0xffff; | ||
| 259 | } | ||
| 257 | 260 | ||
| 258 | static inline int ipv6_addr_scope(const struct in6_addr *addr) | 261 | static inline int ipv6_addr_scope(const struct in6_addr *addr) |
| 259 | { | 262 | { |
| 260 | return ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK; | 263 | return __ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK; |
| 264 | } | ||
| 265 | |||
| 266 | static inline int __ipv6_addr_src_scope(int type) | ||
| 267 | { | ||
| 268 | return (type == IPV6_ADDR_ANY ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16)); | ||
| 269 | } | ||
| 270 | |||
| 271 | static inline int ipv6_addr_src_scope(const struct in6_addr *addr) | ||
| 272 | { | ||
| 273 | return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); | ||
| 261 | } | 274 | } |
| 262 | 275 | ||
| 263 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) | 276 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) |
| @@ -341,6 +354,54 @@ static inline int ipv6_addr_any(const struct in6_addr *a) | |||
| 341 | } | 354 | } |
| 342 | 355 | ||
| 343 | /* | 356 | /* |
| 357 | * find the first different bit between two addresses | ||
| 358 | * length of address must be a multiple of 32bits | ||
| 359 | */ | ||
| 360 | static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen) | ||
| 361 | { | ||
| 362 | const __u32 *a1 = token1, *a2 = token2; | ||
| 363 | int i; | ||
| 364 | |||
| 365 | addrlen >>= 2; | ||
| 366 | |||
| 367 | for (i = 0; i < addrlen; i++) { | ||
| 368 | __u32 xb = a1[i] ^ a2[i]; | ||
| 369 | if (xb) { | ||
| 370 | int j = 31; | ||
| 371 | |||
| 372 | xb = ntohl(xb); | ||
| 373 | while ((xb & (1 << j)) == 0) | ||
| 374 | j--; | ||
| 375 | |||
| 376 | return (i * 32 + 31 - j); | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | /* | ||
| 381 | * we should *never* get to this point since that | ||
| 382 | * would mean the addrs are equal | ||
| 383 | * | ||
| 384 | * However, we do get to it 8) And exacly, when | ||
| 385 | * addresses are equal 8) | ||
| 386 | * | ||
| 387 | * ip route add 1111::/128 via ... | ||
| 388 | * ip route add 1111::/64 via ... | ||
| 389 | * and we are here. | ||
| 390 | * | ||
| 391 | * Ideally, this function should stop comparison | ||
| 392 | * at prefix length. It does not, but it is still OK, | ||
| 393 | * if returned value is greater than prefix length. | ||
| 394 | * --ANK (980803) | ||
| 395 | */ | ||
| 396 | return (addrlen << 5); | ||
| 397 | } | ||
| 398 | |||
| 399 | static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2) | ||
| 400 | { | ||
| 401 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); | ||
| 402 | } | ||
| 403 | |||
| 404 | /* | ||
| 344 | * Prototypes exported by ipv6 | 405 | * Prototypes exported by ipv6 |
| 345 | */ | 406 | */ |
| 346 | 407 | ||
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/red.h b/include/net/red.h new file mode 100644 index 000000000000..2ed4358e3295 --- /dev/null +++ b/include/net/red.h | |||
| @@ -0,0 +1,325 @@ | |||
| 1 | #ifndef __NET_SCHED_RED_H | ||
| 2 | #define __NET_SCHED_RED_H | ||
| 3 | |||
| 4 | #include <linux/config.h> | ||
| 5 | #include <linux/types.h> | ||
| 6 | #include <net/pkt_sched.h> | ||
| 7 | #include <net/inet_ecn.h> | ||
| 8 | #include <net/dsfield.h> | ||
| 9 | |||
| 10 | /* Random Early Detection (RED) algorithm. | ||
| 11 | ======================================= | ||
| 12 | |||
| 13 | Source: Sally Floyd and Van Jacobson, "Random Early Detection Gateways | ||
| 14 | for Congestion Avoidance", 1993, IEEE/ACM Transactions on Networking. | ||
| 15 | |||
| 16 | This file codes a "divisionless" version of RED algorithm | ||
| 17 | as written down in Fig.17 of the paper. | ||
| 18 | |||
| 19 | Short description. | ||
| 20 | ------------------ | ||
| 21 | |||
| 22 | When a new packet arrives we calculate the average queue length: | ||
| 23 | |||
| 24 | avg = (1-W)*avg + W*current_queue_len, | ||
| 25 | |||
| 26 | W is the filter time constant (chosen as 2^(-Wlog)), it controls | ||
| 27 | the inertia of the algorithm. To allow larger bursts, W should be | ||
| 28 | decreased. | ||
| 29 | |||
| 30 | if (avg > th_max) -> packet marked (dropped). | ||
| 31 | if (avg < th_min) -> packet passes. | ||
| 32 | if (th_min < avg < th_max) we calculate probability: | ||
| 33 | |||
| 34 | Pb = max_P * (avg - th_min)/(th_max-th_min) | ||
| 35 | |||
| 36 | and mark (drop) packet with this probability. | ||
| 37 | Pb changes from 0 (at avg==th_min) to max_P (avg==th_max). | ||
| 38 | max_P should be small (not 1), usually 0.01..0.02 is good value. | ||
| 39 | |||
| 40 | max_P is chosen as a number, so that max_P/(th_max-th_min) | ||
| 41 | is a negative power of two in order arithmetics to contain | ||
| 42 | only shifts. | ||
| 43 | |||
| 44 | |||
| 45 | Parameters, settable by user: | ||
| 46 | ----------------------------- | ||
| 47 | |||
| 48 | qth_min - bytes (should be < qth_max/2) | ||
| 49 | qth_max - bytes (should be at least 2*qth_min and less limit) | ||
| 50 | Wlog - bits (<32) log(1/W). | ||
| 51 | Plog - bits (<32) | ||
| 52 | |||
| 53 | Plog is related to max_P by formula: | ||
| 54 | |||
| 55 | max_P = (qth_max-qth_min)/2^Plog; | ||
| 56 | |||
| 57 | F.e. if qth_max=128K and qth_min=32K, then Plog=22 | ||
| 58 | corresponds to max_P=0.02 | ||
| 59 | |||
| 60 | Scell_log | ||
| 61 | Stab | ||
| 62 | |||
| 63 | Lookup table for log((1-W)^(t/t_ave). | ||
| 64 | |||
| 65 | |||
| 66 | NOTES: | ||
| 67 | |||
| 68 | Upper bound on W. | ||
| 69 | ----------------- | ||
| 70 | |||
| 71 | If you want to allow bursts of L packets of size S, | ||
| 72 | you should choose W: | ||
| 73 | |||
| 74 | L + 1 - th_min/S < (1-(1-W)^L)/W | ||
| 75 | |||
| 76 | th_min/S = 32 th_min/S = 4 | ||
| 77 | |||
| 78 | log(W) L | ||
| 79 | -1 33 | ||
| 80 | -2 35 | ||
| 81 | -3 39 | ||
| 82 | -4 46 | ||
| 83 | -5 57 | ||
| 84 | -6 75 | ||
| 85 | -7 101 | ||
| 86 | -8 135 | ||
| 87 | -9 190 | ||
| 88 | etc. | ||
| 89 | */ | ||
| 90 | |||
| 91 | #define RED_STAB_SIZE 256 | ||
| 92 | #define RED_STAB_MASK (RED_STAB_SIZE - 1) | ||
| 93 | |||
| 94 | struct red_stats | ||
| 95 | { | ||
| 96 | u32 prob_drop; /* Early probability drops */ | ||
| 97 | u32 prob_mark; /* Early probability marks */ | ||
| 98 | u32 forced_drop; /* Forced drops, qavg > max_thresh */ | ||
| 99 | u32 forced_mark; /* Forced marks, qavg > max_thresh */ | ||
| 100 | u32 pdrop; /* Drops due to queue limits */ | ||
| 101 | u32 other; /* Drops due to drop() calls */ | ||
| 102 | u32 backlog; | ||
| 103 | }; | ||
| 104 | |||
| 105 | struct red_parms | ||
| 106 | { | ||
| 107 | /* Parameters */ | ||
| 108 | u32 qth_min; /* Min avg length threshold: A scaled */ | ||
| 109 | u32 qth_max; /* Max avg length threshold: A scaled */ | ||
| 110 | u32 Scell_max; | ||
| 111 | u32 Rmask; /* Cached random mask, see red_rmask */ | ||
| 112 | u8 Scell_log; | ||
| 113 | u8 Wlog; /* log(W) */ | ||
| 114 | u8 Plog; /* random number bits */ | ||
| 115 | u8 Stab[RED_STAB_SIZE]; | ||
| 116 | |||
| 117 | /* Variables */ | ||
| 118 | int qcount; /* Number of packets since last random | ||
| 119 | number generation */ | ||
| 120 | u32 qR; /* Cached random number */ | ||
| 121 | |||
| 122 | unsigned long qavg; /* Average queue length: A scaled */ | ||
| 123 | psched_time_t qidlestart; /* Start of current idle period */ | ||
| 124 | }; | ||
| 125 | |||
| 126 | static inline u32 red_rmask(u8 Plog) | ||
| 127 | { | ||
| 128 | return Plog < 32 ? ((1 << Plog) - 1) : ~0UL; | ||
| 129 | } | ||
| 130 | |||
| 131 | static inline void red_set_parms(struct red_parms *p, | ||
| 132 | u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog, | ||
| 133 | u8 Scell_log, u8 *stab) | ||
| 134 | { | ||
| 135 | /* Reset average queue length, the value is strictly bound | ||
| 136 | * to the parameters below, reseting hurts a bit but leaving | ||
| 137 | * it might result in an unreasonable qavg for a while. --TGR | ||
| 138 | */ | ||
| 139 | p->qavg = 0; | ||
| 140 | |||
| 141 | p->qcount = -1; | ||
| 142 | p->qth_min = qth_min << Wlog; | ||
| 143 | p->qth_max = qth_max << Wlog; | ||
| 144 | p->Wlog = Wlog; | ||
| 145 | p->Plog = Plog; | ||
| 146 | p->Rmask = red_rmask(Plog); | ||
| 147 | p->Scell_log = Scell_log; | ||
| 148 | p->Scell_max = (255 << Scell_log); | ||
| 149 | |||
| 150 | memcpy(p->Stab, stab, sizeof(p->Stab)); | ||
| 151 | } | ||
| 152 | |||
| 153 | static inline int red_is_idling(struct red_parms *p) | ||
| 154 | { | ||
| 155 | return !PSCHED_IS_PASTPERFECT(p->qidlestart); | ||
| 156 | } | ||
| 157 | |||
| 158 | static inline void red_start_of_idle_period(struct red_parms *p) | ||
| 159 | { | ||
| 160 | PSCHED_GET_TIME(p->qidlestart); | ||
| 161 | } | ||
| 162 | |||
| 163 | static inline void red_end_of_idle_period(struct red_parms *p) | ||
| 164 | { | ||
| 165 | PSCHED_SET_PASTPERFECT(p->qidlestart); | ||
| 166 | } | ||
| 167 | |||
| 168 | static inline void red_restart(struct red_parms *p) | ||
| 169 | { | ||
| 170 | red_end_of_idle_period(p); | ||
| 171 | p->qavg = 0; | ||
| 172 | p->qcount = -1; | ||
| 173 | } | ||
| 174 | |||
| 175 | static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | ||
| 176 | { | ||
| 177 | psched_time_t now; | ||
| 178 | long us_idle; | ||
| 179 | int shift; | ||
| 180 | |||
| 181 | PSCHED_GET_TIME(now); | ||
| 182 | us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max); | ||
| 183 | |||
| 184 | /* | ||
| 185 | * The problem: ideally, average length queue recalcultion should | ||
| 186 | * be done over constant clock intervals. This is too expensive, so | ||
| 187 | * that the calculation is driven by outgoing packets. | ||
| 188 | * When the queue is idle we have to model this clock by hand. | ||
| 189 | * | ||
| 190 | * SF+VJ proposed to "generate": | ||
| 191 | * | ||
| 192 | * m = idletime / (average_pkt_size / bandwidth) | ||
| 193 | * | ||
| 194 | * dummy packets as a burst after idle time, i.e. | ||
| 195 | * | ||
| 196 | * p->qavg *= (1-W)^m | ||
| 197 | * | ||
| 198 | * This is an apparently overcomplicated solution (f.e. we have to | ||
| 199 | * precompute a table to make this calculation in reasonable time) | ||
| 200 | * I believe that a simpler model may be used here, | ||
| 201 | * but it is field for experiments. | ||
| 202 | */ | ||
| 203 | |||
| 204 | shift = p->Stab[(us_idle >> p->Scell_log) & RED_STAB_MASK]; | ||
| 205 | |||
| 206 | if (shift) | ||
| 207 | return p->qavg >> shift; | ||
| 208 | else { | ||
| 209 | /* Approximate initial part of exponent with linear function: | ||
| 210 | * | ||
| 211 | * (1-W)^m ~= 1-mW + ... | ||
| 212 | * | ||
| 213 | * Seems, it is the best solution to | ||
| 214 | * problem of too coarse exponent tabulation. | ||
| 215 | */ | ||
| 216 | us_idle = (p->qavg * us_idle) >> p->Scell_log; | ||
| 217 | |||
| 218 | if (us_idle < (p->qavg >> 1)) | ||
| 219 | return p->qavg - us_idle; | ||
| 220 | else | ||
| 221 | return p->qavg >> 1; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | |||
| 225 | static inline unsigned long red_calc_qavg_no_idle_time(struct red_parms *p, | ||
| 226 | unsigned int backlog) | ||
| 227 | { | ||
| 228 | /* | ||
| 229 | * NOTE: p->qavg is fixed point number with point at Wlog. | ||
| 230 | * The formula below is equvalent to floating point | ||
| 231 | * version: | ||
| 232 | * | ||
| 233 | * qavg = qavg*(1-W) + backlog*W; | ||
| 234 | * | ||
| 235 | * --ANK (980924) | ||
| 236 | */ | ||
| 237 | return p->qavg + (backlog - (p->qavg >> p->Wlog)); | ||
| 238 | } | ||
| 239 | |||
| 240 | static inline unsigned long red_calc_qavg(struct red_parms *p, | ||
| 241 | unsigned int backlog) | ||
| 242 | { | ||
| 243 | if (!red_is_idling(p)) | ||
| 244 | return red_calc_qavg_no_idle_time(p, backlog); | ||
| 245 | else | ||
| 246 | return red_calc_qavg_from_idle_time(p); | ||
| 247 | } | ||
| 248 | |||
| 249 | static inline u32 red_random(struct red_parms *p) | ||
| 250 | { | ||
| 251 | return net_random() & p->Rmask; | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline int red_mark_probability(struct red_parms *p, unsigned long qavg) | ||
| 255 | { | ||
| 256 | /* The formula used below causes questions. | ||
| 257 | |||
| 258 | OK. qR is random number in the interval 0..Rmask | ||
| 259 | i.e. 0..(2^Plog). If we used floating point | ||
| 260 | arithmetics, it would be: (2^Plog)*rnd_num, | ||
| 261 | where rnd_num is less 1. | ||
| 262 | |||
| 263 | Taking into account, that qavg have fixed | ||
| 264 | point at Wlog, and Plog is related to max_P by | ||
| 265 | max_P = (qth_max-qth_min)/2^Plog; two lines | ||
| 266 | below have the following floating point equivalent: | ||
| 267 | |||
| 268 | max_P*(qavg - qth_min)/(qth_max-qth_min) < rnd/qcount | ||
| 269 | |||
| 270 | Any questions? --ANK (980924) | ||
| 271 | */ | ||
| 272 | return !(((qavg - p->qth_min) >> p->Wlog) * p->qcount < p->qR); | ||
| 273 | } | ||
| 274 | |||
| 275 | enum { | ||
| 276 | RED_BELOW_MIN_THRESH, | ||
| 277 | RED_BETWEEN_TRESH, | ||
| 278 | RED_ABOVE_MAX_TRESH, | ||
| 279 | }; | ||
| 280 | |||
| 281 | static inline int red_cmp_thresh(struct red_parms *p, unsigned long qavg) | ||
| 282 | { | ||
| 283 | if (qavg < p->qth_min) | ||
| 284 | return RED_BELOW_MIN_THRESH; | ||
| 285 | else if (qavg >= p->qth_max) | ||
| 286 | return RED_ABOVE_MAX_TRESH; | ||
| 287 | else | ||
| 288 | return RED_BETWEEN_TRESH; | ||
| 289 | } | ||
| 290 | |||
| 291 | enum { | ||
| 292 | RED_DONT_MARK, | ||
| 293 | RED_PROB_MARK, | ||
| 294 | RED_HARD_MARK, | ||
| 295 | }; | ||
| 296 | |||
| 297 | static inline int red_action(struct red_parms *p, unsigned long qavg) | ||
| 298 | { | ||
| 299 | switch (red_cmp_thresh(p, qavg)) { | ||
| 300 | case RED_BELOW_MIN_THRESH: | ||
| 301 | p->qcount = -1; | ||
| 302 | return RED_DONT_MARK; | ||
| 303 | |||
| 304 | case RED_BETWEEN_TRESH: | ||
| 305 | if (++p->qcount) { | ||
| 306 | if (red_mark_probability(p, qavg)) { | ||
| 307 | p->qcount = 0; | ||
| 308 | p->qR = red_random(p); | ||
| 309 | return RED_PROB_MARK; | ||
| 310 | } | ||
| 311 | } else | ||
| 312 | p->qR = red_random(p); | ||
| 313 | |||
| 314 | return RED_DONT_MARK; | ||
| 315 | |||
| 316 | case RED_ABOVE_MAX_TRESH: | ||
| 317 | p->qcount = -1; | ||
| 318 | return RED_HARD_MARK; | ||
| 319 | } | ||
| 320 | |||
| 321 | BUG(); | ||
| 322 | return RED_DONT_MARK; | ||
| 323 | } | ||
| 324 | |||
| 325 | #endif | ||
diff --git a/include/net/sock.h b/include/net/sock.h index e0498bd36004..ff13c4cc287a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -461,16 +461,16 @@ static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb) | |||
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | /* The per-socket spinlock must be held here. */ | 463 | /* The per-socket spinlock must be held here. */ |
| 464 | #define sk_add_backlog(__sk, __skb) \ | 464 | static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) |
| 465 | do { if (!(__sk)->sk_backlog.tail) { \ | 465 | { |
| 466 | (__sk)->sk_backlog.head = \ | 466 | if (!sk->sk_backlog.tail) { |
| 467 | (__sk)->sk_backlog.tail = (__skb); \ | 467 | sk->sk_backlog.head = sk->sk_backlog.tail = skb; |
| 468 | } else { \ | 468 | } else { |
| 469 | ((__sk)->sk_backlog.tail)->next = (__skb); \ | 469 | sk->sk_backlog.tail->next = skb; |
| 470 | (__sk)->sk_backlog.tail = (__skb); \ | 470 | sk->sk_backlog.tail = skb; |
| 471 | } \ | 471 | } |
| 472 | (__skb)->next = NULL; \ | 472 | skb->next = NULL; |
| 473 | } while(0) | 473 | } |
| 474 | 474 | ||
| 475 | #define sk_wait_event(__sk, __timeo, __condition) \ | 475 | #define sk_wait_event(__sk, __timeo, __condition) \ |
| 476 | ({ int rc; \ | 476 | ({ int rc; \ |
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index d11f34832a97..7f0ca79d6c98 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
| @@ -387,15 +387,6 @@ | |||
| 387 | #define AC97_RATES_MIC_ADC 4 | 387 | #define AC97_RATES_MIC_ADC 4 |
| 388 | #define AC97_RATES_SPDIF 5 | 388 | #define AC97_RATES_SPDIF 5 |
| 389 | 389 | ||
| 390 | /* shared controllers */ | ||
| 391 | enum { | ||
| 392 | AC97_SHARED_TYPE_NONE, | ||
| 393 | AC97_SHARED_TYPE_ICH, | ||
| 394 | AC97_SHARED_TYPE_ATIIXP, | ||
| 395 | AC97_SHARED_TYPE_VIA, | ||
| 396 | AC97_SHARED_TYPES | ||
| 397 | }; | ||
| 398 | |||
| 399 | /* | 390 | /* |
| 400 | * | 391 | * |
| 401 | */ | 392 | */ |
| @@ -468,7 +459,6 @@ struct _snd_ac97_bus { | |||
| 468 | unsigned short used_slots[2][4]; /* actually used PCM slots */ | 459 | unsigned short used_slots[2][4]; /* actually used PCM slots */ |
| 469 | unsigned short pcms_count; /* count of PCMs */ | 460 | unsigned short pcms_count; /* count of PCMs */ |
| 470 | struct ac97_pcm *pcms; | 461 | struct ac97_pcm *pcms; |
| 471 | unsigned int shared_type; /* type of shared controller betwen audio and modem */ | ||
| 472 | ac97_t *codec[4]; | 462 | ac97_t *codec[4]; |
| 473 | snd_info_entry_t *proc; | 463 | snd_info_entry_t *proc; |
| 474 | }; | 464 | }; |
diff --git a/include/sound/core.h b/include/sound/core.h index 6d971a4c4ca0..2be65ad2fd83 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #include <linux/pm.h> /* pm_message_t */ | 29 | #include <linux/pm.h> /* pm_message_t */ |
| 30 | 30 | ||
| 31 | /* Typedef's */ | 31 | /* Typedef's */ |
| 32 | typedef struct timespec snd_timestamp_t; | ||
| 33 | typedef struct sndrv_interval snd_interval_t; | 32 | typedef struct sndrv_interval snd_interval_t; |
| 34 | typedef enum sndrv_card_type snd_card_type; | 33 | typedef enum sndrv_card_type snd_card_type; |
| 35 | typedef struct sndrv_xferi snd_xferi_t; | 34 | typedef struct sndrv_xferi snd_xferi_t; |
| @@ -256,6 +255,7 @@ typedef struct _snd_minor snd_minor_t; | |||
| 256 | 255 | ||
| 257 | /* sound.c */ | 256 | /* sound.c */ |
| 258 | 257 | ||
| 258 | extern int snd_major; | ||
| 259 | extern int snd_ecards_limit; | 259 | extern int snd_ecards_limit; |
| 260 | 260 | ||
| 261 | void snd_request_card(int card); | 261 | void snd_request_card(int card); |
| @@ -285,39 +285,6 @@ int snd_oss_init_module(void); | |||
| 285 | 285 | ||
| 286 | /* memory.c */ | 286 | /* memory.c */ |
| 287 | 287 | ||
| 288 | #ifdef CONFIG_SND_DEBUG_MEMORY | ||
| 289 | void snd_memory_init(void); | ||
| 290 | void snd_memory_done(void); | ||
| 291 | int snd_memory_info_init(void); | ||
| 292 | int snd_memory_info_done(void); | ||
| 293 | void *snd_hidden_kmalloc(size_t size, gfp_t flags); | ||
| 294 | void *snd_hidden_kzalloc(size_t size, gfp_t flags); | ||
| 295 | void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags); | ||
| 296 | void snd_hidden_kfree(const void *obj); | ||
| 297 | void *snd_hidden_vmalloc(unsigned long size); | ||
| 298 | void snd_hidden_vfree(void *obj); | ||
| 299 | char *snd_hidden_kstrdup(const char *s, gfp_t flags); | ||
| 300 | #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) | ||
| 301 | #define kzalloc(size, flags) snd_hidden_kzalloc(size, flags) | ||
| 302 | #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) | ||
| 303 | #define kfree(obj) snd_hidden_kfree(obj) | ||
| 304 | #define vmalloc(size) snd_hidden_vmalloc(size) | ||
| 305 | #define vfree(obj) snd_hidden_vfree(obj) | ||
| 306 | #define kmalloc_nocheck(size, flags) snd_wrapper_kmalloc(size, flags) | ||
| 307 | #define vmalloc_nocheck(size) snd_wrapper_vmalloc(size) | ||
| 308 | #define kfree_nocheck(obj) snd_wrapper_kfree(obj) | ||
| 309 | #define vfree_nocheck(obj) snd_wrapper_vfree(obj) | ||
| 310 | #define kstrdup(s, flags) snd_hidden_kstrdup(s, flags) | ||
| 311 | #else | ||
| 312 | #define snd_memory_init() /*NOP*/ | ||
| 313 | #define snd_memory_done() /*NOP*/ | ||
| 314 | #define snd_memory_info_init() /*NOP*/ | ||
| 315 | #define snd_memory_info_done() /*NOP*/ | ||
| 316 | #define kmalloc_nocheck(size, flags) kmalloc(size, flags) | ||
| 317 | #define vmalloc_nocheck(size) vmalloc(size) | ||
| 318 | #define kfree_nocheck(obj) kfree(obj) | ||
| 319 | #define vfree_nocheck(obj) vfree(obj) | ||
| 320 | #endif | ||
| 321 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); | 288 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); |
| 322 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); | 289 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); |
| 323 | 290 | ||
| @@ -373,8 +340,9 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size); | |||
| 373 | #endif | 340 | #endif |
| 374 | 341 | ||
| 375 | /* misc.c */ | 342 | /* misc.c */ |
| 343 | struct resource; | ||
| 344 | void release_and_free_resource(struct resource *res); | ||
| 376 | 345 | ||
| 377 | int snd_task_name(struct task_struct *task, char *name, size_t size); | ||
| 378 | #ifdef CONFIG_SND_VERBOSE_PRINTK | 346 | #ifdef CONFIG_SND_VERBOSE_PRINTK |
| 379 | void snd_verbose_printk(const char *file, int line, const char *format, ...) | 347 | void snd_verbose_printk(const char *file, int line, const char *format, ...) |
| 380 | __attribute__ ((format (printf, 3, 4))); | 348 | __attribute__ ((format (printf, 3, 4))); |
| @@ -429,34 +397,24 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
| 429 | * When CONFIG_SND_DEBUG is not set, the expression is executed but | 397 | * When CONFIG_SND_DEBUG is not set, the expression is executed but |
| 430 | * not checked. | 398 | * not checked. |
| 431 | */ | 399 | */ |
| 432 | #define snd_assert(expr, args...) do {\ | 400 | #define snd_assert(expr, args...) do { \ |
| 433 | if (unlikely(!(expr))) { \ | 401 | if (unlikely(!(expr))) { \ |
| 434 | snd_printk(KERN_ERR "BUG? (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ | 402 | snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \ |
| 435 | args;\ | 403 | dump_stack(); \ |
| 436 | }\ | 404 | args; \ |
| 405 | } \ | ||
| 437 | } while (0) | 406 | } while (0) |
| 438 | /** | 407 | |
| 439 | * snd_runtime_check - run-time assertion macro | 408 | #define snd_BUG() do { \ |
| 440 | * @expr: expression | 409 | snd_printk(KERN_ERR "BUG?\n"); \ |
| 441 | * @args...: the action | 410 | dump_stack(); \ |
| 442 | * | ||
| 443 | * This macro checks the expression in run-time and invokes the commands | ||
| 444 | * given in the rest arguments if the assertion is failed. | ||
| 445 | * Unlike snd_assert(), the action commands are executed even if | ||
| 446 | * CONFIG_SND_DEBUG is not set but without any error messages. | ||
| 447 | */ | ||
| 448 | #define snd_runtime_check(expr, args...) do {\ | ||
| 449 | if (unlikely(!(expr))) { \ | ||
| 450 | snd_printk(KERN_ERR "ERROR (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ | ||
| 451 | args;\ | ||
| 452 | }\ | ||
| 453 | } while (0) | 411 | } while (0) |
| 454 | 412 | ||
| 455 | #else /* !CONFIG_SND_DEBUG */ | 413 | #else /* !CONFIG_SND_DEBUG */ |
| 456 | 414 | ||
| 457 | #define snd_printd(fmt, args...) /* nothing */ | 415 | #define snd_printd(fmt, args...) /* nothing */ |
| 458 | #define snd_assert(expr, args...) (void)(expr) | 416 | #define snd_assert(expr, args...) (void)(expr) |
| 459 | #define snd_runtime_check(expr, args...) do { if (!(expr)) { args; } } while (0) | 417 | #define snd_BUG() /* nothing */ |
| 460 | 418 | ||
| 461 | #endif /* CONFIG_SND_DEBUG */ | 419 | #endif /* CONFIG_SND_DEBUG */ |
| 462 | 420 | ||
| @@ -473,30 +431,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
| 473 | #define snd_printdd(format, args...) /* nothing */ | 431 | #define snd_printdd(format, args...) /* nothing */ |
| 474 | #endif | 432 | #endif |
| 475 | 433 | ||
| 476 | #define snd_BUG() snd_assert(0, ) | ||
| 477 | |||
| 478 | |||
| 479 | static inline void snd_timestamp_now(struct timespec *tstamp, int timespec) | ||
| 480 | { | ||
| 481 | struct timeval val; | ||
| 482 | /* FIXME: use a linear time source */ | ||
| 483 | do_gettimeofday(&val); | ||
| 484 | tstamp->tv_sec = val.tv_sec; | ||
| 485 | tstamp->tv_nsec = val.tv_usec; | ||
| 486 | if (timespec) | ||
| 487 | tstamp->tv_nsec *= 1000L; | ||
| 488 | } | ||
| 489 | |||
| 490 | static inline void snd_timestamp_zero(struct timespec *tstamp) | ||
| 491 | { | ||
| 492 | tstamp->tv_sec = 0; | ||
| 493 | tstamp->tv_nsec = 0; | ||
| 494 | } | ||
| 495 | |||
| 496 | static inline int snd_timestamp_null(struct timespec *tstamp) | ||
| 497 | { | ||
| 498 | return tstamp->tv_sec == 0 && tstamp->tv_nsec == 0; | ||
| 499 | } | ||
| 500 | 434 | ||
| 501 | #define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */ | 435 | #define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */ |
| 502 | 436 | ||
diff --git a/include/sound/driver.h b/include/sound/driver.h index 1ec2fae050a6..3f0416ac24d9 100644 --- a/include/sound/driver.h +++ b/include/sound/driver.h | |||
| @@ -44,21 +44,4 @@ | |||
| 44 | 44 | ||
| 45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
| 46 | 46 | ||
| 47 | /* | ||
| 48 | * ========================================================================== | ||
| 49 | */ | ||
| 50 | |||
| 51 | #ifdef CONFIG_SND_DEBUG_MEMORY | ||
| 52 | #include <linux/slab.h> | ||
| 53 | #include <linux/vmalloc.h> | ||
| 54 | void *snd_wrapper_kmalloc(size_t, gfp_t); | ||
| 55 | #undef kmalloc | ||
| 56 | void snd_wrapper_kfree(const void *); | ||
| 57 | #undef kfree | ||
| 58 | void *snd_wrapper_vmalloc(size_t); | ||
| 59 | #undef vmalloc | ||
| 60 | void snd_wrapper_vfree(void *); | ||
| 61 | #undef vfree | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #endif /* __SOUND_DRIVER_H */ | 47 | #endif /* __SOUND_DRIVER_H */ |
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 46e3c0bf3c94..8411c7ef6f11 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h | |||
| @@ -48,7 +48,8 @@ | |||
| 48 | 48 | ||
| 49 | /* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ | 49 | /* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ |
| 50 | #define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */ | 50 | #define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */ |
| 51 | #define AUDIGY_DMA_MASK 0xffffffffUL /* 32bit */ | 51 | #define AUDIGY_DMA_MASK 0x7fffffffUL /* 31bit FIXME - 32 should work? */ |
| 52 | /* See ALSA bug #1276 - rlrevell */ | ||
| 52 | 53 | ||
| 53 | #define TMEMSIZE 256*1024 | 54 | #define TMEMSIZE 256*1024 |
| 54 | #define TMEMSIZEREG 4 | 55 | #define TMEMSIZEREG 4 |
diff --git a/include/sound/minors.h b/include/sound/minors.h index b7b0d8309449..a17b5c9961bb 100644 --- a/include/sound/minors.h +++ b/include/sound/minors.h | |||
| @@ -27,8 +27,9 @@ | |||
| 27 | #define SNDRV_MINOR(card, dev) (((card) << 5) | (dev)) | 27 | #define SNDRV_MINOR(card, dev) (((card) << 5) | (dev)) |
| 28 | 28 | ||
| 29 | #define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */ | 29 | #define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */ |
| 30 | #define SNDRV_MINOR_SEQUENCER 1 | 30 | #define SNDRV_MINOR_GLOBAL 1 /* 1 */ |
| 31 | #define SNDRV_MINOR_TIMER (1+32) | 31 | #define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32) |
| 32 | #define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32) | ||
| 32 | #define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ | 33 | #define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ |
| 33 | #define SNDRV_MINOR_HWDEPS 4 | 34 | #define SNDRV_MINOR_HWDEPS 4 |
| 34 | #define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ | 35 | #define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ |
| @@ -39,12 +40,9 @@ | |||
| 39 | 40 | ||
| 40 | #define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL | 41 | #define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL |
| 41 | #define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP | 42 | #define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP |
| 42 | #define SNDRV_DEVICE_TYPE_MIXER SNDRV_MINOR_MIXER | ||
| 43 | #define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI | 43 | #define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI |
| 44 | #define SNDRV_DEVICE_TYPE_PCM_PLAYBACK SNDRV_MINOR_PCM_PLAYBACK | 44 | #define SNDRV_DEVICE_TYPE_PCM_PLAYBACK SNDRV_MINOR_PCM_PLAYBACK |
| 45 | #define SNDRV_DEVICE_TYPE_PCM_PLOOP SNDRV_MINOR_PCM_PLOOP | ||
| 46 | #define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE | 45 | #define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE |
| 47 | #define SNDRV_DEVICE_TYPE_PCM_CLOOP SNDRV_MINOR_PCM_CLOOP | ||
| 48 | #define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER | 46 | #define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER |
| 49 | #define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER | 47 | #define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER |
| 50 | 48 | ||
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 2b23a5967071..acc4fa9d5abe 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
| @@ -281,7 +281,7 @@ typedef struct { | |||
| 281 | struct _snd_pcm_runtime { | 281 | struct _snd_pcm_runtime { |
| 282 | /* -- Status -- */ | 282 | /* -- Status -- */ |
| 283 | snd_pcm_substream_t *trigger_master; | 283 | snd_pcm_substream_t *trigger_master; |
| 284 | snd_timestamp_t trigger_tstamp; /* trigger timestamp */ | 284 | struct timespec trigger_tstamp; /* trigger timestamp */ |
| 285 | int overrange; | 285 | int overrange; |
| 286 | snd_pcm_uframes_t avail_max; | 286 | snd_pcm_uframes_t avail_max; |
| 287 | snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ | 287 | snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ |
| @@ -306,7 +306,6 @@ struct _snd_pcm_runtime { | |||
| 306 | unsigned int rate_den; | 306 | unsigned int rate_den; |
| 307 | 307 | ||
| 308 | /* -- SW params -- */ | 308 | /* -- SW params -- */ |
| 309 | int tstamp_timespec; /* use timeval (0) or timespec (1) */ | ||
| 310 | snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ | 309 | snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ |
| 311 | unsigned int period_step; | 310 | unsigned int period_step; |
| 312 | unsigned int sleep_min; /* min ticks to sleep */ | 311 | unsigned int sleep_min; /* min ticks to sleep */ |
diff --git a/include/sound/timer.h b/include/sound/timer.h index 1898511a0f38..b55f38ae56e1 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h | |||
| @@ -88,6 +88,7 @@ struct _snd_timer_hardware { | |||
| 88 | struct _snd_timer { | 88 | struct _snd_timer { |
| 89 | snd_timer_class_t tmr_class; | 89 | snd_timer_class_t tmr_class; |
| 90 | snd_card_t *card; | 90 | snd_card_t *card; |
| 91 | struct module *module; | ||
| 91 | int tmr_device; | 92 | int tmr_device; |
| 92 | int tmr_subdevice; | 93 | int tmr_subdevice; |
| 93 | char id[64]; | 94 | char id[64]; |
diff --git a/include/sound/version.h b/include/sound/version.h index ee32af20dba9..d1bd3b723967 100644 --- a/include/sound/version.h +++ b/include/sound/version.h | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | /* include/version.h. Generated by configure. */ | 1 | /* include/version.h. Generated by configure. */ |
| 2 | #define CONFIG_SND_VERSION "1.0.10rc1" | 2 | #define CONFIG_SND_VERSION "1.0.10rc3" |
| 3 | #define CONFIG_SND_DATE " (Mon Sep 12 08:13:09 2005 UTC)" | 3 | #define CONFIG_SND_DATE " (Mon Nov 07 13:30:21 2005 UTC)" |
