diff options
Diffstat (limited to 'include')
114 files changed, 1106 insertions, 650 deletions
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h index a322012f16a..4b2ea1e95c5 100644 --- a/include/asm-arm/arch-pxa/pxa-regs.h +++ b/include/asm-arm/arch-pxa/pxa-regs.h @@ -1406,202 +1406,6 @@ #define OSCC_OON (1 << 1) /* 32.768kHz OON (write-once only bit) */ #define OSCC_OOK (1 << 0) /* 32.768kHz OOK (read-only bit) */ - -/* - * LCD - */ - -#define LCCR0 __REG(0x44000000) /* LCD Controller Control Register 0 */ -#define LCCR1 __REG(0x44000004) /* LCD Controller Control Register 1 */ -#define LCCR2 __REG(0x44000008) /* LCD Controller Control Register 2 */ -#define LCCR3 __REG(0x4400000C) /* LCD Controller Control Register 3 */ -#define LCCR4 __REG(0x44000010) /* LCD Controller Control Register 3 */ -#define DFBR0 __REG(0x44000020) /* DMA Channel 0 Frame Branch Register */ -#define DFBR1 __REG(0x44000024) /* DMA Channel 1 Frame Branch Register */ -#define LCSR __REG(0x44000038) /* LCD Controller Status Register */ -#define LIIDR __REG(0x4400003C) /* LCD Controller Interrupt ID Register */ -#define TMEDRGBR __REG(0x44000040) /* TMED RGB Seed Register */ -#define TMEDCR __REG(0x44000044) /* TMED Control Register */ - -#define LCCR3_1BPP (0 << 24) -#define LCCR3_2BPP (1 << 24) -#define LCCR3_4BPP (2 << 24) -#define LCCR3_8BPP (3 << 24) -#define LCCR3_16BPP (4 << 24) - -#define LCCR3_PDFOR_0 (0 << 30) -#define LCCR3_PDFOR_1 (1 << 30) -#define LCCR3_PDFOR_2 (2 << 30) -#define LCCR3_PDFOR_3 (3 << 30) - -#define LCCR4_PAL_FOR_0 (0 << 15) -#define LCCR4_PAL_FOR_1 (1 << 15) -#define LCCR4_PAL_FOR_2 (2 << 15) -#define LCCR4_PAL_FOR_MASK (3 << 15) - -#define FDADR0 __REG(0x44000200) /* DMA Channel 0 Frame Descriptor Address Register */ -#define FSADR0 __REG(0x44000204) /* DMA Channel 0 Frame Source Address Register */ -#define FIDR0 __REG(0x44000208) /* DMA Channel 0 Frame ID Register */ -#define LDCMD0 __REG(0x4400020C) /* DMA Channel 0 Command Register */ -#define FDADR1 __REG(0x44000210) /* DMA Channel 1 Frame Descriptor Address Register */ -#define FSADR1 __REG(0x44000214) /* DMA Channel 1 Frame Source Address Register */ -#define FIDR1 __REG(0x44000218) /* DMA Channel 1 Frame ID Register */ -#define LDCMD1 __REG(0x4400021C) /* DMA Channel 1 Command Register */ - -#define LCCR0_ENB (1 << 0) /* LCD Controller enable */ -#define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */ -#define LCCR0_Color (LCCR0_CMS*0) /* Color display */ -#define LCCR0_Mono (LCCR0_CMS*1) /* Monochrome display */ -#define LCCR0_SDS (1 << 2) /* Single/Dual Panel Display */ - /* Select */ -#define LCCR0_Sngl (LCCR0_SDS*0) /* Single panel display */ -#define LCCR0_Dual (LCCR0_SDS*1) /* Dual panel display */ - -#define LCCR0_LDM (1 << 3) /* LCD Disable Done Mask */ -#define LCCR0_SFM (1 << 4) /* Start of frame mask */ -#define LCCR0_IUM (1 << 5) /* Input FIFO underrun mask */ -#define LCCR0_EFM (1 << 6) /* End of Frame mask */ -#define LCCR0_PAS (1 << 7) /* Passive/Active display Select */ -#define LCCR0_Pas (LCCR0_PAS*0) /* Passive display (STN) */ -#define LCCR0_Act (LCCR0_PAS*1) /* Active display (TFT) */ -#define LCCR0_DPD (1 << 9) /* Double Pixel Data (monochrome */ - /* display mode) */ -#define LCCR0_4PixMono (LCCR0_DPD*0) /* 4-Pixel/clock Monochrome */ - /* display */ -#define LCCR0_8PixMono (LCCR0_DPD*1) /* 8-Pixel/clock Monochrome */ - /* display */ -#define LCCR0_DIS (1 << 10) /* LCD Disable */ -#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */ -#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */ -#define LCCR0_PDD_S 12 -#define LCCR0_BM (1 << 20) /* Branch mask */ -#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */ -#define LCCR0_LCDT (1 << 22) /* LCD panel type */ -#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */ -#define LCCR0_CMDIM (1 << 24) /* Command interrupt mask */ -#define LCCR0_OUC (1 << 25) /* Overlay Underlay control bit */ -#define LCCR0_LDDALT (1 << 26) /* LDD alternate mapping control */ - -#define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */ -#define LCCR1_DisWdth(Pixel) /* Display Width [1..800 pix.] */ \ - (((Pixel) - 1) << FShft (LCCR1_PPL)) - -#define LCCR1_HSW Fld (6, 10) /* Horizontal Synchronization */ -#define LCCR1_HorSnchWdth(Tpix) /* Horizontal Synchronization */ \ - /* pulse Width [1..64 Tpix] */ \ - (((Tpix) - 1) << FShft (LCCR1_HSW)) - -#define LCCR1_ELW Fld (8, 16) /* End-of-Line pixel clock Wait */ - /* count - 1 [Tpix] */ -#define LCCR1_EndLnDel(Tpix) /* End-of-Line Delay */ \ - /* [1..256 Tpix] */ \ - (((Tpix) - 1) << FShft (LCCR1_ELW)) - -#define LCCR1_BLW Fld (8, 24) /* Beginning-of-Line pixel clock */ - /* Wait count - 1 [Tpix] */ -#define LCCR1_BegLnDel(Tpix) /* Beginning-of-Line Delay */ \ - /* [1..256 Tpix] */ \ - (((Tpix) - 1) << FShft (LCCR1_BLW)) - - -#define LCCR2_LPP Fld (10, 0) /* Line Per Panel - 1 */ -#define LCCR2_DisHght(Line) /* Display Height [1..1024 lines] */ \ - (((Line) - 1) << FShft (LCCR2_LPP)) - -#define LCCR2_VSW Fld (6, 10) /* Vertical Synchronization pulse */ - /* Width - 1 [Tln] (L_FCLK) */ -#define LCCR2_VrtSnchWdth(Tln) /* Vertical Synchronization pulse */ \ - /* Width [1..64 Tln] */ \ - (((Tln) - 1) << FShft (LCCR2_VSW)) - -#define LCCR2_EFW Fld (8, 16) /* End-of-Frame line clock Wait */ - /* count [Tln] */ -#define LCCR2_EndFrmDel(Tln) /* End-of-Frame Delay */ \ - /* [0..255 Tln] */ \ - ((Tln) << FShft (LCCR2_EFW)) - -#define LCCR2_BFW Fld (8, 24) /* Beginning-of-Frame line clock */ - /* Wait count [Tln] */ -#define LCCR2_BegFrmDel(Tln) /* Beginning-of-Frame Delay */ \ - /* [0..255 Tln] */ \ - ((Tln) << FShft (LCCR2_BFW)) - -#if 0 -#define LCCR3_PCD (0xff) /* Pixel clock divisor */ -#define LCCR3_ACB (0xff << 8) /* AC Bias pin frequency */ -#define LCCR3_ACB_S 8 -#endif - -#define LCCR3_API (0xf << 16) /* AC Bias pin trasitions per interrupt */ -#define LCCR3_API_S 16 -#define LCCR3_VSP (1 << 20) /* vertical sync polarity */ -#define LCCR3_HSP (1 << 21) /* horizontal sync polarity */ -#define LCCR3_PCP (1 << 22) /* Pixel Clock Polarity (L_PCLK) */ -#define LCCR3_PixRsEdg (LCCR3_PCP*0) /* Pixel clock Rising-Edge */ -#define LCCR3_PixFlEdg (LCCR3_PCP*1) /* Pixel clock Falling-Edge */ - -#define LCCR3_OEP (1 << 23) /* Output Enable Polarity (L_BIAS, */ - /* active display mode) */ -#define LCCR3_OutEnH (LCCR3_OEP*0) /* Output Enable active High */ -#define LCCR3_OutEnL (LCCR3_OEP*1) /* Output Enable active Low */ - -#if 0 -#define LCCR3_BPP (7 << 24) /* bits per pixel */ -#define LCCR3_BPP_S 24 -#endif -#define LCCR3_DPC (1 << 27) /* double pixel clock mode */ - - -#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */ -#define LCCR3_PixClkDiv(Div) /* Pixel Clock Divisor */ \ - (((Div) << FShft (LCCR3_PCD))) - - -#define LCCR3_BPP Fld (3, 24) /* Bit Per Pixel */ -#define LCCR3_Bpp(Bpp) /* Bit Per Pixel */ \ - (((Bpp) << FShft (LCCR3_BPP))) - -#define LCCR3_ACB Fld (8, 8) /* AC Bias */ -#define LCCR3_Acb(Acb) /* BAC Bias */ \ - (((Acb) << FShft (LCCR3_ACB))) - -#define LCCR3_HorSnchH (LCCR3_HSP*0) /* Horizontal Synchronization */ - /* pulse active High */ -#define LCCR3_HorSnchL (LCCR3_HSP*1) /* Horizontal Synchronization */ - -#define LCCR3_VrtSnchH (LCCR3_VSP*0) /* Vertical Synchronization pulse */ - /* active High */ -#define LCCR3_VrtSnchL (LCCR3_VSP*1) /* Vertical Synchronization pulse */ - /* active Low */ - -#define LCSR_LDD (1 << 0) /* LCD Disable Done */ -#define LCSR_SOF (1 << 1) /* Start of frame */ -#define LCSR_BER (1 << 2) /* Bus error */ -#define LCSR_ABC (1 << 3) /* AC Bias count */ -#define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */ -#define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */ -#define LCSR_OU (1 << 6) /* output FIFO underrun */ -#define LCSR_QD (1 << 7) /* quick disable */ -#define LCSR_EOF (1 << 8) /* end of frame */ -#define LCSR_BS (1 << 9) /* branch status */ -#define LCSR_SINT (1 << 10) /* subsequent interrupt */ - -#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */ - -#define LCSR_LDD (1 << 0) /* LCD Disable Done */ -#define LCSR_SOF (1 << 1) /* Start of frame */ -#define LCSR_BER (1 << 2) /* Bus error */ -#define LCSR_ABC (1 << 3) /* AC Bias count */ -#define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */ -#define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */ -#define LCSR_OU (1 << 6) /* output FIFO underrun */ -#define LCSR_QD (1 << 7) /* quick disable */ -#define LCSR_EOF (1 << 8) /* end of frame */ -#define LCSR_BS (1 << 9) /* branch status */ -#define LCSR_SINT (1 << 10) /* subsequent interrupt */ - -#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */ - #ifdef CONFIG_PXA27x /* Camera Interface */ diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h index ea2336aa70e..bbd22396841 100644 --- a/include/asm-arm/arch-pxa/pxafb.h +++ b/include/asm-arm/arch-pxa/pxafb.h @@ -13,6 +13,50 @@ */ #include <linux/fb.h> +#include <asm/arch/regs-lcd.h> + +/* + * Supported LCD connections + * + * bits 0 - 3: for LCD panel type: + * + * STN - for passive matrix + * DSTN - for dual scan passive matrix + * TFT - for active matrix + * + * bits 4 - 9 : for bus width + * bits 10-17 : for AC Bias Pin Frequency + * bit 18 : for output enable polarity + * bit 19 : for pixel clock edge + */ +#define LCD_CONN_TYPE(_x) ((_x) & 0x0f) +#define LCD_CONN_WIDTH(_x) (((_x) >> 4) & 0x1f) + +#define LCD_TYPE_UNKNOWN 0 +#define LCD_TYPE_MONO_STN 1 +#define LCD_TYPE_MONO_DSTN 2 +#define LCD_TYPE_COLOR_STN 3 +#define LCD_TYPE_COLOR_DSTN 4 +#define LCD_TYPE_COLOR_TFT 5 +#define LCD_TYPE_SMART_PANEL 6 +#define LCD_TYPE_MAX 7 + +#define LCD_MONO_STN_4BPP ((4 << 4) | LCD_TYPE_MONO_STN) +#define LCD_MONO_STN_8BPP ((8 << 4) | LCD_TYPE_MONO_STN) +#define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN) +#define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN) +#define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN) +#define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT) +#define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT) +#define LCD_SMART_PANEL_8BPP ((8 << 4) | LCD_TYPE_SMART_PANEL) +#define LCD_SMART_PANEL_16BPP ((16 << 4) | LCD_TYPE_SMART_PANEL) +#define LCD_SMART_PANEL_18BPP ((18 << 4) | LCD_TYPE_SMART_PANEL) + +#define LCD_AC_BIAS_FREQ(x) (((x) & 0xff) << 10) +#define LCD_BIAS_ACTIVE_HIGH (0 << 17) +#define LCD_BIAS_ACTIVE_LOW (1 << 17) +#define LCD_PCLK_EDGE_RISE (0 << 18) +#define LCD_PCLK_EDGE_FALL (1 << 18) /* * This structure describes the machine which we are running on. @@ -26,6 +70,10 @@ struct pxafb_mode_info { u_short yres; u_char bpp; + u_int cmap_greyscale:1, + unused:31; + + /* Parallel Mode Timing */ u_char hsync_len; u_char left_margin; u_char right_margin; @@ -35,14 +83,28 @@ struct pxafb_mode_info { u_char lower_margin; u_char sync; - u_int cmap_greyscale:1, - unused:31; + /* Smart Panel Mode Timing - see PXA27x DM 7.4.15.0.3 for details + * Note: + * 1. all parameters in nanosecond (ns) + * 2. a0cs{rd,wr}_set_hld are controlled by the same register bits + * in pxa27x and pxa3xx, initialize them to the same value or + * the larger one will be used + * 3. same to {rd,wr}_pulse_width + */ + unsigned a0csrd_set_hld; /* A0 and CS Setup/Hold Time before/after L_FCLK_RD */ + unsigned a0cswr_set_hld; /* A0 and CS Setup/Hold Time before/after L_PCLK_WR */ + unsigned wr_pulse_width; /* L_PCLK_WR pulse width */ + unsigned rd_pulse_width; /* L_FCLK_RD pulse width */ + unsigned cmd_inh_time; /* Command Inhibit time between two writes */ + unsigned op_hold_time; /* Output Hold time from L_FCLK_RD negation */ }; struct pxafb_mach_info { struct pxafb_mode_info *modes; unsigned int num_modes; + unsigned int lcd_conn; + u_int fixed_modes:1, cmap_inverse:1, cmap_static:1, @@ -78,8 +140,11 @@ struct pxafb_mach_info { u_int lccr4; void (*pxafb_backlight_power)(int); void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *); - + void (*smart_update)(struct fb_info *); }; void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); void set_pxa_fb_parent(struct device *parent_dev); unsigned long pxafb_get_hsync_time(struct device *dev); + +extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int); +extern int pxafb_smart_flush(struct fb_info *info); diff --git a/include/asm-arm/arch-pxa/regs-lcd.h b/include/asm-arm/arch-pxa/regs-lcd.h new file mode 100644 index 00000000000..f762493f514 --- /dev/null +++ b/include/asm-arm/arch-pxa/regs-lcd.h @@ -0,0 +1,171 @@ +#ifndef __ASM_ARCH_REGS_LCD_H +#define __ASM_ARCH_REGS_LCD_H +/* + * LCD Controller Registers and Bits Definitions + */ +#define LCCR0 (0x000) /* LCD Controller Control Register 0 */ +#define LCCR1 (0x004) /* LCD Controller Control Register 1 */ +#define LCCR2 (0x008) /* LCD Controller Control Register 2 */ +#define LCCR3 (0x00C) /* LCD Controller Control Register 3 */ +#define LCCR4 (0x010) /* LCD Controller Control Register 4 */ +#define LCCR5 (0x014) /* LCD Controller Control Register 5 */ +#define DFBR0 (0x020) /* DMA Channel 0 Frame Branch Register */ +#define DFBR1 (0x024) /* DMA Channel 1 Frame Branch Register */ +#define LCSR (0x038) /* LCD Controller Status Register */ +#define LIIDR (0x03C) /* LCD Controller Interrupt ID Register */ +#define TMEDRGBR (0x040) /* TMED RGB Seed Register */ +#define TMEDCR (0x044) /* TMED Control Register */ + +#define CMDCR (0x100) /* Command Control Register */ +#define PRSR (0x104) /* Panel Read Status Register */ + +#define LCCR3_1BPP (0 << 24) +#define LCCR3_2BPP (1 << 24) +#define LCCR3_4BPP (2 << 24) +#define LCCR3_8BPP (3 << 24) +#define LCCR3_16BPP (4 << 24) + +#define LCCR3_PDFOR_0 (0 << 30) +#define LCCR3_PDFOR_1 (1 << 30) +#define LCCR3_PDFOR_2 (2 << 30) +#define LCCR3_PDFOR_3 (3 << 30) + +#define LCCR4_PAL_FOR_0 (0 << 15) +#define LCCR4_PAL_FOR_1 (1 << 15) +#define LCCR4_PAL_FOR_2 (2 << 15) +#define LCCR4_PAL_FOR_MASK (3 << 15) + +#define FDADR0 (0x200) /* DMA Channel 0 Frame Descriptor Address Register */ +#define FSADR0 (0x204) /* DMA Channel 0 Frame Source Address Register */ +#define FIDR0 (0x208) /* DMA Channel 0 Frame ID Register */ +#define LDCMD0 (0x20C) /* DMA Channel 0 Command Register */ +#define FDADR1 (0x210) /* DMA Channel 1 Frame Descriptor Address Register */ +#define FSADR1 (0x214) /* DMA Channel 1 Frame Source Address Register */ +#define FIDR1 (0x218) /* DMA Channel 1 Frame ID Register */ +#define LDCMD1 (0x21C) /* DMA Channel 1 Command Register */ +#define FDADR6 (0x260) /* DMA Channel 6 Frame Descriptor Address Register */ +#define FSADR6 (0x264) /* DMA Channel 6 Frame Source Address Register */ +#define FIDR6 (0x268) /* DMA Channel 6 Frame ID Register */ + +#define LCCR0_ENB (1 << 0) /* LCD Controller enable */ +#define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */ +#define LCCR0_Color (LCCR0_CMS*0) /* Color display */ +#define LCCR0_Mono (LCCR0_CMS*1) /* Monochrome display */ +#define LCCR0_SDS (1 << 2) /* Single/Dual Panel Display Select */ +#define LCCR0_Sngl (LCCR0_SDS*0) /* Single panel display */ +#define LCCR0_Dual (LCCR0_SDS*1) /* Dual panel display */ + +#define LCCR0_LDM (1 << 3) /* LCD Disable Done Mask */ +#define LCCR0_SFM (1 << 4) /* Start of frame mask */ +#define LCCR0_IUM (1 << 5) /* Input FIFO underrun mask */ +#define LCCR0_EFM (1 << 6) /* End of Frame mask */ +#define LCCR0_PAS (1 << 7) /* Passive/Active display Select */ +#define LCCR0_Pas (LCCR0_PAS*0) /* Passive display (STN) */ +#define LCCR0_Act (LCCR0_PAS*1) /* Active display (TFT) */ +#define LCCR0_DPD (1 << 9) /* Double Pixel Data (monochrome) */ +#define LCCR0_4PixMono (LCCR0_DPD*0) /* 4-Pixel/clock Monochrome display */ +#define LCCR0_8PixMono (LCCR0_DPD*1) /* 8-Pixel/clock Monochrome display */ +#define LCCR0_DIS (1 << 10) /* LCD Disable */ +#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */ +#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */ +#define LCCR0_PDD_S 12 +#define LCCR0_BM (1 << 20) /* Branch mask */ +#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */ +#define LCCR0_LCDT (1 << 22) /* LCD panel type */ +#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */ +#define LCCR0_CMDIM (1 << 24) /* Command interrupt mask */ +#define LCCR0_OUC (1 << 25) /* Overlay Underlay control bit */ +#define LCCR0_LDDALT (1 << 26) /* LDD alternate mapping control */ + +#define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */ +#define LCCR1_DisWdth(Pixel) (((Pixel) - 1) << FShft (LCCR1_PPL)) + +#define LCCR1_HSW Fld (6, 10) /* Horizontal Synchronization */ +#define LCCR1_HorSnchWdth(Tpix) (((Tpix) - 1) << FShft (LCCR1_HSW)) + +#define LCCR1_ELW Fld (8, 16) /* End-of-Line pixel clock Wait - 1 */ +#define LCCR1_EndLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_ELW)) + +#define LCCR1_BLW Fld (8, 24) /* Beginning-of-Line pixel clock */ +#define LCCR1_BegLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_BLW)) + +#define LCCR2_LPP Fld (10, 0) /* Line Per Panel - 1 */ +#define LCCR2_DisHght(Line) (((Line) - 1) << FShft (LCCR2_LPP)) + +#define LCCR2_VSW Fld (6, 10) /* Vertical Synchronization pulse - 1 */ +#define LCCR2_VrtSnchWdth(Tln) (((Tln) - 1) << FShft (LCCR2_VSW)) + +#define LCCR2_EFW Fld (8, 16) /* End-of-Frame line clock Wait */ +#define LCCR2_EndFrmDel(Tln) ((Tln) << FShft (LCCR2_EFW)) + +#define LCCR2_BFW Fld (8, 24) /* Beginning-of-Frame line clock */ +#define LCCR2_BegFrmDel(Tln) ((Tln) << FShft (LCCR2_BFW)) + +#define LCCR3_API (0xf << 16) /* AC Bias pin trasitions per interrupt */ +#define LCCR3_API_S 16 +#define LCCR3_VSP (1 << 20) /* vertical sync polarity */ +#define LCCR3_HSP (1 << 21) /* horizontal sync polarity */ +#define LCCR3_PCP (1 << 22) /* Pixel Clock Polarity (L_PCLK) */ +#define LCCR3_PixRsEdg (LCCR3_PCP*0) /* Pixel clock Rising-Edge */ +#define LCCR3_PixFlEdg (LCCR3_PCP*1) /* Pixel clock Falling-Edge */ + +#define LCCR3_OEP (1 << 23) /* Output Enable Polarity */ +#define LCCR3_OutEnH (LCCR3_OEP*0) /* Output Enable active High */ +#define LCCR3_OutEnL (LCCR3_OEP*1) /* Output Enable active Low */ + +#define LCCR3_DPC (1 << 27) /* double pixel clock mode */ +#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */ +#define LCCR3_PixClkDiv(Div) (((Div) << FShft (LCCR3_PCD))) + +#define LCCR3_BPP Fld (3, 24) /* Bit Per Pixel */ +#define LCCR3_Bpp(Bpp) (((Bpp) << FShft (LCCR3_BPP))) + +#define LCCR3_ACB Fld (8, 8) /* AC Bias */ +#define LCCR3_Acb(Acb) (((Acb) << FShft (LCCR3_ACB))) + +#define LCCR3_HorSnchH (LCCR3_HSP*0) /* HSP Active High */ +#define LCCR3_HorSnchL (LCCR3_HSP*1) /* HSP Active Low */ + +#define LCCR3_VrtSnchH (LCCR3_VSP*0) /* VSP Active High */ +#define LCCR3_VrtSnchL (LCCR3_VSP*1) /* VSP Active Low */ + +#define LCCR5_IUM(x) (1 << ((x) + 23)) /* input underrun mask */ +#define LCCR5_BSM(x) (1 << ((x) + 15)) /* branch mask */ +#define LCCR5_EOFM(x) (1 << ((x) + 7)) /* end of frame mask */ +#define LCCR5_SOFM(x) (1 << ((x) + 0)) /* start of frame mask */ + +#define LCSR_LDD (1 << 0) /* LCD Disable Done */ +#define LCSR_SOF (1 << 1) /* Start of frame */ +#define LCSR_BER (1 << 2) /* Bus error */ +#define LCSR_ABC (1 << 3) /* AC Bias count */ +#define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */ +#define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */ +#define LCSR_OU (1 << 6) /* output FIFO underrun */ +#define LCSR_QD (1 << 7) /* quick disable */ +#define LCSR_EOF (1 << 8) /* end of frame */ +#define LCSR_BS (1 << 9) /* branch status */ +#define LCSR_SINT (1 << 10) /* subsequent interrupt */ +#define LCSR_RD_ST (1 << 11) /* read status */ +#define LCSR_CMD_INT (1 << 12) /* command interrupt */ + +#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */ + +/* smartpanel related */ +#define PRSR_DATA(x) ((x) & 0xff) /* Panel Data */ +#define PRSR_A0 (1 << 8) /* Read Data Source */ +#define PRSR_ST_OK (1 << 9) /* Status OK */ +#define PRSR_CON_NT (1 << 10) /* Continue to Next Command */ + +#define SMART_CMD_A0 (0x1 << 8) +#define SMART_CMD_READ_STATUS_REG (0x0 << 9) +#define SMART_CMD_READ_FRAME_BUFFER ((0x0 << 9) | SMART_CMD_A0) +#define SMART_CMD_WRITE_COMMAND (0x1 << 9) +#define SMART_CMD_WRITE_DATA ((0x1 << 9) | SMART_CMD_A0) +#define SMART_CMD_WRITE_FRAME ((0x2 << 9) | SMART_CMD_A0) +#define SMART_CMD_WAIT_FOR_VSYNC (0x3 << 9) +#define SMART_CMD_NOOP (0x4 << 9) +#define SMART_CMD_INTERRUPT (0x5 << 9) + +#define SMART_CMD(x) (SMART_CMD_WRITE_COMMAND | ((x) & 0xff)) +#define SMART_DAT(x) (SMART_CMD_WRITE_DATA | ((x) & 0xff)) +#endif /* __ASM_ARCH_REGS_LCD_H */ diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index 15e6f253dda..c9f369c4bd7 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h @@ -17,8 +17,6 @@ #include <asm-generic/bitops/fls64.h> #include <asm-generic/bitops/find.h> -#ifdef __KERNEL__ - #ifndef _LINUX_BITOPS_H #error only <linux/bitops.h> can be included directly #endif @@ -32,6 +30,4 @@ #include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/minix.h> -#endif /* __KERNEL__ */ - #endif /* _ASM_GENERIC_BITOPS_H */ diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h index f422df0956a..3c2344f4813 100644 --- a/include/asm-generic/futex.h +++ b/include/asm-generic/futex.h @@ -1,11 +1,9 @@ #ifndef _ASM_GENERIC_FUTEX_H #define _ASM_GENERIC_FUTEX_H -#ifdef __KERNEL__ - #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/errno.h> -#include <asm/uaccess.h> static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) @@ -56,4 +54,3 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) } #endif -#endif diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index 52226e14bd7..ae060c62aff 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h @@ -1,7 +1,6 @@ #ifndef __ASM_MEMORY_MODEL_H #define __ASM_MEMORY_MODEL_H -#ifdef __KERNEL__ #ifndef __ASSEMBLY__ #if defined(CONFIG_FLATMEM) @@ -81,6 +80,5 @@ extern unsigned long page_to_pfn(struct page *page); #endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ #endif /* __ASSEMBLY__ */ -#endif /* __KERNEL__ */ #endif diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h index a96b5d986b6..14db733b8e6 100644 --- a/include/asm-generic/page.h +++ b/include/asm-generic/page.h @@ -1,7 +1,6 @@ #ifndef _ASM_GENERIC_PAGE_H #define _ASM_GENERIC_PAGE_H -#ifdef __KERNEL__ #ifndef __ASSEMBLY__ #include <linux/compiler.h> @@ -21,6 +20,5 @@ static __inline__ __attribute_const__ int get_order(unsigned long size) } #endif /* __ASSEMBLY__ */ -#endif /* __KERNEL__ */ #endif /* _ASM_GENERIC_PAGE_H */ diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h index dd1bed860e6..be4af0029ac 100644 --- a/include/asm-generic/rtc.h +++ b/include/asm-generic/rtc.h @@ -12,8 +12,6 @@ #ifndef __ASM_RTC_H__ #define __ASM_RTC_H__ -#ifdef __KERNEL__ - #include <linux/mc146818rtc.h> #include <linux/rtc.h> #include <linux/bcd.h> @@ -213,5 +211,4 @@ static inline int set_rtc_pll(struct rtc_pll_info *pll) return -EINVAL; } -#endif /* __KERNEL__ */ #endif /* __ASM_RTC_H__ */ diff --git a/include/asm-ia64/futex.h b/include/asm-ia64/futex.h index 8a98a265413..c7f0f062239 100644 --- a/include/asm-ia64/futex.h +++ b/include/asm-ia64/futex.h @@ -2,9 +2,9 @@ #define _ASM_FUTEX_H #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/errno.h> #include <asm/system.h> -#include <asm/uaccess.h> #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ do { \ diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 6da8069a0f7..f30e0558386 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h @@ -101,7 +101,6 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk); #define TIF_SYSCALL_TRACE 2 /* syscall trace active */ #define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */ #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ -#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ #define TIF_NOTIFY_RESUME 6 /* resumption notification requested */ #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_MEMDIE 17 @@ -109,6 +108,7 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk); #define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ #define TIF_FREEZE 20 /* is freezing for suspend */ #define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */ +#define TIF_RESTORE_SIGMASK 22 /* restore signal mask in do_signal() */ #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) @@ -126,8 +126,7 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk); /* "work to do on user-return" bits */ #define TIF_ALLWORK_MASK (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\ - _TIF_NEED_RESCHED| _TIF_SYSCALL_TRACE|\ - _TIF_RESTORE_SIGMASK) + _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE) /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */ #define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)) diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h index 17f082cfea8..b9cce90346c 100644 --- a/include/asm-mips/futex.h +++ b/include/asm-mips/futex.h @@ -11,9 +11,9 @@ #ifdef __KERNEL__ #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/barrier.h> #include <asm/errno.h> -#include <asm/uaccess.h> #include <asm/war.h> #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h index fdc6d055ef7..0c705c3a55e 100644 --- a/include/asm-parisc/futex.h +++ b/include/asm-parisc/futex.h @@ -4,8 +4,8 @@ #ifdef __KERNEL__ #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/errno.h> -#include <asm/uaccess.h> static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h index 3f3673fd3ff..6d406c5c5de 100644 --- a/include/asm-powerpc/futex.h +++ b/include/asm-powerpc/futex.h @@ -4,9 +4,9 @@ #ifdef __KERNEL__ #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/errno.h> #include <asm/synch.h> -#include <asm/uaccess.h> #include <asm/asm-compat.h> #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h index 289053ef5e6..a27f68985a7 100644 --- a/include/asm-s390/ccwgroup.h +++ b/include/asm-s390/ccwgroup.h @@ -57,10 +57,9 @@ struct ccwgroup_driver { extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver); extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver); -extern int ccwgroup_create (struct device *root, - unsigned int creator_id, - struct ccw_driver *gdrv, - int argc, char *argv[]); +int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, + struct ccw_driver *cdrv, int num_devices, + const char *buf); extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); diff --git a/include/asm-s390/hugetlb.h b/include/asm-s390/hugetlb.h new file mode 100644 index 00000000000..600a776f8f7 --- /dev/null +++ b/include/asm-s390/hugetlb.h @@ -0,0 +1,183 @@ +/* + * IBM System z Huge TLB Page Support for Kernel. + * + * Copyright IBM Corp. 2008 + * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com> + */ + +#ifndef _ASM_S390_HUGETLB_H +#define _ASM_S390_HUGETLB_H + +#include <asm/page.h> +#include <asm/pgtable.h> + + +#define is_hugepage_only_range(mm, addr, len) 0 +#define hugetlb_free_pgd_range free_pgd_range + +void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte); + +/* + * If the arch doesn't supply something else, assume that hugepage + * size aligned regions are ok without further preparation. + */ +static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) +{ + if (len & ~HPAGE_MASK) + return -EINVAL; + if (addr & ~HPAGE_MASK) + return -EINVAL; + return 0; +} + +#define hugetlb_prefault_arch_hook(mm) do { } while (0) + +int arch_prepare_hugepage(struct page *page); +void arch_release_hugepage(struct page *page); + +static inline pte_t pte_mkhuge(pte_t pte) +{ + /* + * PROT_NONE needs to be remapped from the pte type to the ste type. + * The HW invalid bit is also different for pte and ste. The pte + * invalid bit happens to be the same as the ste _SEGMENT_ENTRY_LARGE + * bit, so we don't have to clear it. + */ + if (pte_val(pte) & _PAGE_INVALID) { + if (pte_val(pte) & _PAGE_SWT) + pte_val(pte) |= _HPAGE_TYPE_NONE; + pte_val(pte) |= _SEGMENT_ENTRY_INV; + } + /* + * Clear SW pte bits SWT and SWX, there are no SW bits in a segment + * table entry. + */ + pte_val(pte) &= ~(_PAGE_SWT | _PAGE_SWX); + /* + * Also set the change-override bit because we don't need dirty bit + * tracking for hugetlbfs pages. + */ + pte_val(pte) |= (_SEGMENT_ENTRY_LARGE | _SEGMENT_ENTRY_CO); + return pte; +} + +static inline pte_t huge_pte_wrprotect(pte_t pte) +{ + pte_val(pte) |= _PAGE_RO; + return pte; +} + +static inline int huge_pte_none(pte_t pte) +{ + return (pte_val(pte) & _SEGMENT_ENTRY_INV) && + !(pte_val(pte) & _SEGMENT_ENTRY_RO); +} + +static inline pte_t huge_ptep_get(pte_t *ptep) +{ + pte_t pte = *ptep; + unsigned long mask; + + if (!MACHINE_HAS_HPAGE) { + ptep = (pte_t *) (pte_val(pte) & _SEGMENT_ENTRY_ORIGIN); + if (ptep) { + mask = pte_val(pte) & + (_SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO); + pte = pte_mkhuge(*ptep); + pte_val(pte) |= mask; + } + } + return pte; +} + +static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, + unsigned long addr, pte_t *ptep) +{ + pte_t pte = huge_ptep_get(ptep); + + pmd_clear((pmd_t *) ptep); + return pte; +} + +static inline void __pmd_csp(pmd_t *pmdp) +{ + register unsigned long reg2 asm("2") = pmd_val(*pmdp); + register unsigned long reg3 asm("3") = pmd_val(*pmdp) | + _SEGMENT_ENTRY_INV; + register unsigned long reg4 asm("4") = ((unsigned long) pmdp) + 5; + + asm volatile( + " csp %1,%3" + : "=m" (*pmdp) + : "d" (reg2), "d" (reg3), "d" (reg4), "m" (*pmdp) : "cc"); + pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY; +} + +static inline void __pmd_idte(unsigned long address, pmd_t *pmdp) +{ + unsigned long sto = (unsigned long) pmdp - + pmd_index(address) * sizeof(pmd_t); + + if (!(pmd_val(*pmdp) & _SEGMENT_ENTRY_INV)) { + asm volatile( + " .insn rrf,0xb98e0000,%2,%3,0,0" + : "=m" (*pmdp) + : "m" (*pmdp), "a" (sto), + "a" ((address & HPAGE_MASK)) + ); + } + pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY; +} + +static inline void huge_ptep_invalidate(struct mm_struct *mm, + unsigned long address, pte_t *ptep) +{ + pmd_t *pmdp = (pmd_t *) ptep; + + if (!MACHINE_HAS_IDTE) { + __pmd_csp(pmdp); + if (mm->context.noexec) { + pmdp = get_shadow_table(pmdp); + __pmd_csp(pmdp); + } + return; + } + + __pmd_idte(address, pmdp); + if (mm->context.noexec) { + pmdp = get_shadow_table(pmdp); + __pmd_idte(address, pmdp); + } + return; +} + +#define huge_ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \ +({ \ + int __changed = !pte_same(huge_ptep_get(__ptep), __entry); \ + if (__changed) { \ + huge_ptep_invalidate((__vma)->vm_mm, __addr, __ptep); \ + set_huge_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \ + } \ + __changed; \ +}) + +#define huge_ptep_set_wrprotect(__mm, __addr, __ptep) \ +({ \ + pte_t __pte = huge_ptep_get(__ptep); \ + if (pte_write(__pte)) { \ + if (atomic_read(&(__mm)->mm_users) > 1 || \ + (__mm) != current->active_mm) \ + huge_ptep_invalidate(__mm, __addr, __ptep); \ + set_huge_pte_at(__mm, __addr, __ptep, \ + huge_pte_wrprotect(__pte)); \ + } \ +}) + +static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep) +{ + huge_ptep_invalidate(vma->vm_mm, address, ptep); +} + +#endif /* _ASM_S390_HUGETLB_H */ diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index fe7f92b6ae6..f0f4579eac1 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h @@ -19,17 +19,34 @@ #define PAGE_DEFAULT_ACC 0 #define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) +#define HPAGE_SHIFT 20 +#define HPAGE_SIZE (1UL << HPAGE_SHIFT) +#define HPAGE_MASK (~(HPAGE_SIZE - 1)) +#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) + +#define ARCH_HAS_SETCLEAR_HUGE_PTE +#define ARCH_HAS_HUGE_PTE_TYPE +#define ARCH_HAS_PREPARE_HUGEPAGE +#define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH + #include <asm/setup.h> #ifndef __ASSEMBLY__ static inline void clear_page(void *page) { - register unsigned long reg1 asm ("1") = 0; - register void *reg2 asm ("2") = page; - register unsigned long reg3 asm ("3") = 4096; - asm volatile( - " mvcl 2,0" - : "+d" (reg2), "+d" (reg3) : "d" (reg1) : "memory", "cc"); + if (MACHINE_HAS_PFMF) { + asm volatile( + " .insn rre,0xb9af0000,%0,%1" + : : "d" (0x10000), "a" (page) : "memory", "cc"); + } else { + register unsigned long reg1 asm ("1") = 0; + register void *reg2 asm ("2") = page; + register unsigned long reg3 asm ("3") = 4096; + asm volatile( + " mvcl 2,0" + : "+d" (reg2), "+d" (reg3) : "d" (reg1) + : "memory", "cc"); + } } static inline void copy_page(void *to, void *from) @@ -108,26 +125,6 @@ page_get_storage_key(unsigned long addr) return skey; } -extern unsigned long max_pfn; - -static inline int pfn_valid(unsigned long pfn) -{ - unsigned long dummy; - int ccode; - - if (pfn >= max_pfn) - return 0; - - asm volatile( - " lra %0,0(%2)\n" - " ipm %1\n" - " srl %1,28\n" - : "=d" (dummy), "=d" (ccode) - : "a" (pfn << PAGE_SHIFT) - : "cc"); - return !ccode; -} - #endif /* !__ASSEMBLY__ */ /* to align the pointer to the (next) page boundary */ diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index f8347ce9c5a..c7f4f8e3e29 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h @@ -129,7 +129,7 @@ extern char empty_zero_page[PAGE_SIZE]; #define VMEM_MAX_PAGES ((VMEM_MAP_END - VMALLOC_END) / sizeof(struct page)) #define VMEM_MAX_PFN min(VMALLOC_START >> PAGE_SHIFT, VMEM_MAX_PAGES) #define VMEM_MAX_PHYS ((VMEM_MAX_PFN << PAGE_SHIFT) & ~((16 << 20) - 1)) -#define VMEM_MAP ((struct page *) VMALLOC_END) +#define vmemmap ((struct page *) VMALLOC_END) /* * A 31 bit pagetable entry of S390 has following format: @@ -234,6 +234,15 @@ extern char empty_zero_page[PAGE_SIZE]; #define _PAGE_TYPE_EX_RW 0x002 /* + * Only four types for huge pages, using the invalid bit and protection bit + * of a segment table entry. + */ +#define _HPAGE_TYPE_EMPTY 0x020 /* _SEGMENT_ENTRY_INV */ +#define _HPAGE_TYPE_NONE 0x220 +#define _HPAGE_TYPE_RO 0x200 /* _SEGMENT_ENTRY_RO */ +#define _HPAGE_TYPE_RW 0x000 + +/* * PTE type bits are rather complicated. handle_pte_fault uses pte_present, * pte_none and pte_file to find out the pte type WITHOUT holding the page * table lock. ptep_clear_flush on the other hand uses ptep_clear_flush to @@ -325,6 +334,9 @@ extern char empty_zero_page[PAGE_SIZE]; #define _SEGMENT_ENTRY (0) #define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV) +#define _SEGMENT_ENTRY_LARGE 0x400 /* STE-format control, large page */ +#define _SEGMENT_ENTRY_CO 0x100 /* change-recording override */ + #endif /* __s390x__ */ /* @@ -1063,8 +1075,8 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) #define kern_addr_valid(addr) (1) -extern int add_shared_memory(unsigned long start, unsigned long size); -extern int remove_shared_memory(unsigned long start, unsigned long size); +extern int vmem_add_mapping(unsigned long start, unsigned long size); +extern int vmem_remove_mapping(unsigned long start, unsigned long size); extern int s390_enable_sie(void); /* @@ -1072,9 +1084,6 @@ extern int s390_enable_sie(void); */ #define pgtable_cache_init() do { } while (0) -#define __HAVE_ARCH_MEMMAP_INIT -extern void memmap_init(unsigned long, int, unsigned long, unsigned long); - #include <asm-generic/pgtable.h> #endif /* _S390_PAGE_H */ diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 8eaf343a12a..a00f79dd323 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h @@ -172,16 +172,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t); */ extern void task_show_regs(struct seq_file *m, struct task_struct *task); -extern void show_registers(struct pt_regs *regs); extern void show_code(struct pt_regs *regs); -extern void show_trace(struct task_struct *task, unsigned long *sp); -#ifdef CONFIG_64BIT -extern void show_last_breaking_event(struct pt_regs *regs); -#else -static inline void show_last_breaking_event(struct pt_regs *regs) -{ -} -#endif unsigned long get_wchan(struct task_struct *p); #define task_pt_regs(tsk) ((struct pt_regs *) \ diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index 61f6952f2e3..441d7c26085 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h @@ -463,8 +463,6 @@ struct user_regs_struct }; #ifdef __KERNEL__ -#define __ARCH_SYS_PTRACE 1 - /* * These are defined as per linux/ptrace.h, which see. */ diff --git a/include/asm-s390/qdio.h b/include/asm-s390/qdio.h index 4b8ff55f680..11240342a0f 100644 --- a/include/asm-s390/qdio.h +++ b/include/asm-s390/qdio.h @@ -127,6 +127,7 @@ extern int do_QDIO(struct ccw_device*, unsigned int flags, unsigned int qidx,unsigned int count, struct qdio_buffer *buffers); +extern int qdio_get_ssqd_pct(struct ccw_device*); extern int qdio_synchronize(struct ccw_device*, unsigned int flags, unsigned int queue_number); diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h index aaf4b518b94..ba69674012a 100644 --- a/include/asm-s390/setup.h +++ b/include/asm-s390/setup.h @@ -59,23 +59,42 @@ extern unsigned int s390_noexec; */ extern unsigned long machine_flags; -#define MACHINE_IS_VM (machine_flags & 1) -#define MACHINE_IS_P390 (machine_flags & 4) -#define MACHINE_HAS_MVPG (machine_flags & 16) -#define MACHINE_IS_KVM (machine_flags & 64) -#define MACHINE_HAS_IDTE (machine_flags & 128) -#define MACHINE_HAS_DIAG9C (machine_flags & 256) +#define MACHINE_FLAG_VM (1UL << 0) +#define MACHINE_FLAG_IEEE (1UL << 1) +#define MACHINE_FLAG_P390 (1UL << 2) +#define MACHINE_FLAG_CSP (1UL << 3) +#define MACHINE_FLAG_MVPG (1UL << 4) +#define MACHINE_FLAG_DIAG44 (1UL << 5) +#define MACHINE_FLAG_IDTE (1UL << 6) +#define MACHINE_FLAG_DIAG9C (1UL << 7) +#define MACHINE_FLAG_MVCOS (1UL << 8) +#define MACHINE_FLAG_KVM (1UL << 9) +#define MACHINE_FLAG_HPAGE (1UL << 10) +#define MACHINE_FLAG_PFMF (1UL << 11) + +#define MACHINE_IS_VM (machine_flags & MACHINE_FLAG_VM) +#define MACHINE_IS_KVM (machine_flags & MACHINE_FLAG_KVM) +#define MACHINE_IS_P390 (machine_flags & MACHINE_FLAG_P390) +#define MACHINE_HAS_DIAG9C (machine_flags & MACHINE_FLAG_DIAG9C) #ifndef __s390x__ -#define MACHINE_HAS_IEEE (machine_flags & 2) -#define MACHINE_HAS_CSP (machine_flags & 8) +#define MACHINE_HAS_IEEE (machine_flags & MACHINE_FLAG_IEEE) +#define MACHINE_HAS_CSP (machine_flags & MACHINE_FLAG_CSP) +#define MACHINE_HAS_IDTE (0) #define MACHINE_HAS_DIAG44 (1) +#define MACHINE_HAS_MVPG (machine_flags & MACHINE_FLAG_MVPG) #define MACHINE_HAS_MVCOS (0) +#define MACHINE_HAS_HPAGE (0) +#define MACHINE_HAS_PFMF (0) #else /* __s390x__ */ #define MACHINE_HAS_IEEE (1) #define MACHINE_HAS_CSP (1) -#define MACHINE_HAS_DIAG44 (machine_flags & 32) -#define MACHINE_HAS_MVCOS (machine_flags & 512) +#define MACHINE_HAS_IDTE (machine_flags & MACHINE_FLAG_IDTE) +#define MACHINE_HAS_DIAG44 (machine_flags & MACHINE_FLAG_DIAG44) +#define MACHINE_HAS_MVPG (1) +#define MACHINE_HAS_MVCOS (machine_flags & MACHINE_FLAG_MVCOS) +#define MACHINE_HAS_HPAGE (machine_flags & MACHINE_FLAG_HPAGE) +#define MACHINE_HAS_PFMF (machine_flags & MACHINE_FLAG_PFMF) #endif /* __s390x__ */ #define MACHINE_HAS_SCLP (!MACHINE_IS_P390) diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index 6f3821a6a90..ae89cf2478f 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h @@ -19,6 +19,7 @@ #include <asm/lowcore.h> #include <asm/sigp.h> #include <asm/ptrace.h> +#include <asm/system.h> /* s390 specific smp.c headers @@ -53,10 +54,7 @@ extern void machine_power_off_smp(void); static inline __u16 hard_smp_processor_id(void) { - __u16 cpu_address; - - asm volatile("stap %0" : "=m" (cpu_address)); - return cpu_address; + return stap(); } /* @@ -108,5 +106,11 @@ static inline void smp_send_stop(void) #define smp_cpu_not_running(cpu) 1 #endif +#ifdef CONFIG_HOTPLUG_CPU +extern int smp_rescan_cpus(void); +#else +static inline int smp_rescan_cpus(void) { return 0; } +#endif + extern union save_area *zfcpdump_save_areas[NR_CPUS + 1]; #endif diff --git a/include/asm-s390/sparsemem.h b/include/asm-s390/sparsemem.h new file mode 100644 index 00000000000..06dfdab6c0e --- /dev/null +++ b/include/asm-s390/sparsemem.h @@ -0,0 +1,18 @@ +#ifndef _ASM_S390_SPARSEMEM_H +#define _ASM_S390_SPARSEMEM_H + +#define SECTION_SIZE_BITS 25 + +#ifdef CONFIG_64BIT + +#define MAX_PHYSADDR_BITS 42 +#define MAX_PHYSMEM_BITS 42 + +#else + +#define MAX_PHYSADDR_BITS 31 +#define MAX_PHYSMEM_BITS 31 + +#endif /* CONFIG_64BIT */ + +#endif /* _ASM_S390_SPARSEMEM_H */ diff --git a/include/asm-s390/sysinfo.h b/include/asm-s390/sysinfo.h index abe10ae15e4..79d01343f8b 100644 --- a/include/asm-s390/sysinfo.h +++ b/include/asm-s390/sysinfo.h @@ -11,6 +11,9 @@ * Christian Borntraeger <borntraeger@de.ibm.com> */ +#ifndef __ASM_S390_SYSINFO_H +#define __ASM_S390_SYSINFO_H + struct sysinfo_1_1_1 { char reserved_0[32]; char manufacturer[16]; @@ -114,3 +117,5 @@ static inline int stsi(void *sysinfo, int fc, int sel1, int sel2) : "cc", "memory"); return r0; } + +#endif /* __ASM_S390_SYSINFO_H */ diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index 92098df4d6e..c819ae25a84 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h @@ -16,6 +16,7 @@ #include <asm/ptrace.h> #include <asm/setup.h> #include <asm/processor.h> +#include <asm/lowcore.h> #ifdef __KERNEL__ @@ -422,6 +423,23 @@ extern void smp_ctl_clear_bit(int cr, int bit); #endif /* CONFIG_SMP */ +static inline unsigned int stfl(void) +{ + asm volatile( + " .insn s,0xb2b10000,0(0)\n" /* stfl */ + "0:\n" + EX_TABLE(0b,0b)); + return S390_lowcore.stfl_fac_list; +} + +static inline unsigned short stap(void) +{ + unsigned short cpu_address; + + asm volatile("stap %0" : "=m" (cpu_address)); + return cpu_address; +} + extern void (*_machine_restart)(char *command); extern void (*_machine_halt)(void); extern void (*_machine_power_off)(void); diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h index 0a518915bf9..99bbed99a3b 100644 --- a/include/asm-s390/thread_info.h +++ b/include/asm-s390/thread_info.h @@ -89,7 +89,6 @@ static inline struct thread_info *current_thread_info(void) * thread information flags bit numbers */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ -#define TIF_RESTORE_SIGMASK 1 /* restore signal mask in do_signal() */ #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_RESTART_SVC 4 /* restart svc with new svc number */ @@ -101,6 +100,7 @@ static inline struct thread_info *current_thread_info(void) TIF_NEED_RESCHED */ #define TIF_31BIT 18 /* 32bit process */ #define TIF_MEMDIE 19 +#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h index 9e57a93d7de..d60394b9745 100644 --- a/include/asm-s390/tlbflush.h +++ b/include/asm-s390/tlbflush.h @@ -2,6 +2,7 @@ #define _S390_TLBFLUSH_H #include <linux/mm.h> +#include <linux/sched.h> #include <asm/processor.h> #include <asm/pgalloc.h> diff --git a/include/asm-s390/topology.h b/include/asm-s390/topology.h index 8e97b06f298..d96c9164345 100644 --- a/include/asm-s390/topology.h +++ b/include/asm-s390/topology.h @@ -7,6 +7,10 @@ cpumask_t cpu_coregroup_map(unsigned int cpu); +extern cpumask_t cpu_core_map[NR_CPUS]; + +#define topology_core_siblings(cpu) (cpu_core_map[cpu]) + int topology_set_cpu_management(int fc); void topology_schedule_update(void); diff --git a/include/asm-sh/futex.h b/include/asm-sh/futex.h index 74ed3681d33..68256ec5fa3 100644 --- a/include/asm-sh/futex.h +++ b/include/asm-sh/futex.h @@ -4,8 +4,8 @@ #ifdef __KERNEL__ #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/errno.h> -#include <asm/uaccess.h> /* XXX: UP variants, fix for SH-4A and SMP.. */ #include <asm/futex-irq.h> diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h index fcdba511633..e6532c3e09c 100644 --- a/include/asm-sparc/head.h +++ b/include/asm-sparc/head.h @@ -52,6 +52,17 @@ nop; \ nop; +#ifdef CONFIG_KGDB +#define KGDB_TRAP(num) \ + b kgdb_trap_low; \ + rd %psr,%l0; \ + nop; \ + nop; +#else +#define KGDB_TRAP(num) \ + BAD_TRAP(num) +#endif + /* The Get Condition Codes software trap for userland. */ #define GETCC_TRAP \ b getcc_trap_handler; mov %psr, %l0; nop; nop; diff --git a/include/asm-sparc/kgdb.h b/include/asm-sparc/kgdb.h index d120adfb429..b6ef301d05b 100644 --- a/include/asm-sparc/kgdb.h +++ b/include/asm-sparc/kgdb.h @@ -1,94 +1,38 @@ -/* $Id: kgdb.h,v 1.8 1998/01/07 06:33:44 baccala Exp $ - * kgdb.h: Defines and declarations for serial line source level - * remote debugging of the Linux kernel using gdb. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ #ifndef _SPARC_KGDB_H #define _SPARC_KGDB_H -#ifndef __ASSEMBLY__ -/* To init the kgdb engine. */ -extern void set_debug_traps(void); - -/* To enter the debugger explicitly. */ -extern void breakpoint(void); - -/* For convenience we define the format of a kgdb trap breakpoint - * frame here also. - */ -struct kgdb_frame { - unsigned long globals[8]; - unsigned long outs[8]; - unsigned long locals[8]; - unsigned long ins[8]; - unsigned long fpregs[32]; - unsigned long y; - unsigned long psr; - unsigned long wim; - unsigned long tbr; - unsigned long pc; - unsigned long npc; - unsigned long fpsr; - unsigned long cpsr; +#ifdef CONFIG_SPARC32 +#define BUFMAX 2048 +#else +#define BUFMAX 4096 +#endif + +enum regnames { + GDB_G0, GDB_G1, GDB_G2, GDB_G3, GDB_G4, GDB_G5, GDB_G6, GDB_G7, + GDB_O0, GDB_O1, GDB_O2, GDB_O3, GDB_O4, GDB_O5, GDB_SP, GDB_O7, + GDB_L0, GDB_L1, GDB_L2, GDB_L3, GDB_L4, GDB_L5, GDB_L6, GDB_L7, + GDB_I0, GDB_I1, GDB_I2, GDB_I3, GDB_I4, GDB_I5, GDB_FP, GDB_I7, + GDB_F0, + GDB_F31 = GDB_F0 + 31, +#ifdef CONFIG_SPARC32 + GDB_Y, GDB_PSR, GDB_WIM, GDB_TBR, GDB_PC, GDB_NPC, + GDB_FSR, GDB_CSR, +#else + GDB_F32 = GDB_F0 + 32, + GDB_F62 = GDB_F32 + 15, + GDB_PC, GDB_NPC, GDB_STATE, GDB_FSR, GDB_FPRS, GDB_Y, +#endif }; -#endif /* !(__ASSEMBLY__) */ - -/* Macros for assembly usage of the kgdb breakpoint frame. */ -#define KGDB_G0 0x000 -#define KGDB_G1 0x004 -#define KGDB_G2 0x008 -#define KGDB_G4 0x010 -#define KGDB_G6 0x018 -#define KGDB_I0 0x020 -#define KGDB_I2 0x028 -#define KGDB_I4 0x030 -#define KGDB_I6 0x038 -#define KGDB_Y 0x100 -#define KGDB_PSR 0x104 -#define KGDB_WIM 0x108 -#define KGDB_TBR 0x10c -#define KGDB_PC 0x110 -#define KGDB_NPC 0x114 - -#define SAVE_KGDB_GLOBALS(reg) \ - std %g0, [%reg + STACKFRAME_SZ + KGDB_G0]; \ - std %g2, [%reg + STACKFRAME_SZ + KGDB_G2]; \ - std %g4, [%reg + STACKFRAME_SZ + KGDB_G4]; \ - std %g6, [%reg + STACKFRAME_SZ + KGDB_G6]; - -#define SAVE_KGDB_INS(reg) \ - std %i0, [%reg + STACKFRAME_SZ + KGDB_I0]; \ - std %i2, [%reg + STACKFRAME_SZ + KGDB_I2]; \ - std %i4, [%reg + STACKFRAME_SZ + KGDB_I4]; \ - std %i6, [%reg + STACKFRAME_SZ + KGDB_I6]; - -#define SAVE_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \ - st %reg_y, [%reg + STACKFRAME_SZ + KGDB_Y]; \ - st %reg_psr, [%reg + STACKFRAME_SZ + KGDB_PSR]; \ - st %reg_wim, [%reg + STACKFRAME_SZ + KGDB_WIM]; \ - st %reg_tbr, [%reg + STACKFRAME_SZ + KGDB_TBR]; \ - st %reg_pc, [%reg + STACKFRAME_SZ + KGDB_PC]; \ - st %reg_npc, [%reg + STACKFRAME_SZ + KGDB_NPC]; -#define LOAD_KGDB_GLOBALS(reg) \ - ld [%reg + STACKFRAME_SZ + KGDB_G1], %g1; \ - ldd [%reg + STACKFRAME_SZ + KGDB_G2], %g2; \ - ldd [%reg + STACKFRAME_SZ + KGDB_G4], %g4; \ - ldd [%reg + STACKFRAME_SZ + KGDB_G6], %g6; +#ifdef CONFIG_SPARC32 +#define NUMREGBYTES ((GDB_CSR + 1) * 4) +#else +#define NUMREGBYTES ((GDB_Y + 1) * 8) +#endif -#define LOAD_KGDB_INS(reg) \ - ldd [%reg + STACKFRAME_SZ + KGDB_I0], %i0; \ - ldd [%reg + STACKFRAME_SZ + KGDB_I2], %i2; \ - ldd [%reg + STACKFRAME_SZ + KGDB_I4], %i4; \ - ldd [%reg + STACKFRAME_SZ + KGDB_I6], %i6; +extern void arch_kgdb_breakpoint(void); -#define LOAD_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \ - ld [%reg + STACKFRAME_SZ + KGDB_Y], %reg_y; \ - ld [%reg + STACKFRAME_SZ + KGDB_PSR], %reg_psr; \ - ld [%reg + STACKFRAME_SZ + KGDB_WIM], %reg_wim; \ - ld [%reg + STACKFRAME_SZ + KGDB_TBR], %reg_tbr; \ - ld [%reg + STACKFRAME_SZ + KGDB_PC], %reg_pc; \ - ld [%reg + STACKFRAME_SZ + KGDB_NPC], %reg_npc; +#define BREAK_INSTR_SIZE 4 +#define CACHE_FLUSH_IS_SAFE 1 -#endif /* !(_SPARC_KGDB_H) */ +#endif /* _SPARC_KGDB_H */ diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h index b3f492208fd..e6d56159972 100644 --- a/include/asm-sparc/smp.h +++ b/include/asm-sparc/smp.h @@ -51,13 +51,11 @@ void smp_bogo(struct seq_file *); void smp_info(struct seq_file *); BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) -BTFIXUPDEF_CALL(void, smp_message_pass, int, int, unsigned long, int) BTFIXUPDEF_CALL(int, __hard_smp_processor_id, void) BTFIXUPDEF_BLACKBOX(hard_smp_processor_id) BTFIXUPDEF_BLACKBOX(load_current) #define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5) -#define smp_message_pass(target,msg,data,wait) BTFIXUP_CALL(smp_message_pass)(target,msg,data,wait) static inline void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); } static inline void xc1(smpfunc_t func, unsigned long arg1) diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index 4e08210cd4c..b4b024445fc 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h @@ -94,6 +94,8 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, } while(0) #endif +extern void flushw_all(void); + /* * Flush windows so that the VM switch which follows * would not pull the stack from under us. diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h index df1097d6ffb..d8378935ae9 100644 --- a/include/asm-sparc64/futex.h +++ b/include/asm-sparc64/futex.h @@ -2,9 +2,9 @@ #define _SPARC64_FUTEX_H #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/errno.h> #include <asm/system.h> -#include <asm/uaccess.h> #define __futex_cas_op(insn, ret, oldval, uaddr, oparg) \ __asm__ __volatile__( \ diff --git a/include/asm-sparc64/kgdb.h b/include/asm-sparc64/kgdb.h new file mode 100644 index 00000000000..aa6532fd3a1 --- /dev/null +++ b/include/asm-sparc64/kgdb.h @@ -0,0 +1 @@ +#include <asm-sparc/kgdb.h> diff --git a/include/asm-sparc64/pil.h b/include/asm-sparc64/pil.h index 72927749aeb..2f5d126f716 100644 --- a/include/asm-sparc64/pil.h +++ b/include/asm-sparc64/pil.h @@ -19,11 +19,4 @@ #define PIL_SMP_CTX_NEW_VERSION 4 #define PIL_DEVICE_IRQ 5 -#ifndef __ASSEMBLY__ -#define PIL_RESERVED(PIL) ((PIL) == PIL_SMP_CALL_FUNC || \ - (PIL) == PIL_SMP_RECEIVE_SIGNAL || \ - (PIL) == PIL_SMP_CAPTURE || \ - (PIL) == PIL_SMP_CTX_NEW_VERSION) -#endif - #endif /* !(_SPARC64_PIL_H) */ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 53eae091a17..6897ac31be4 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -180,12 +180,13 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \ "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ "ldx [%%g6 + %9], %%g4\n\t" \ - "brz,pt %%o7, 1f\n\t" \ + "brz,pt %%o7, switch_to_pc\n\t" \ " mov %%g7, %0\n\t" \ "sethi %%hi(ret_from_syscall), %%g1\n\t" \ "jmpl %%g1 + %%lo(ret_from_syscall), %%g0\n\t" \ " nop\n\t" \ - "1:\n\t" \ + ".globl switch_to_pc\n\t" \ + "switch_to_pc:\n\t" \ : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ "=r" (__local_per_cpu_offset) \ : "0" (task_thread_info(next)), \ diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h index d3cc4eff39a..1b55538b944 100644 --- a/include/asm-sparc64/ttable.h +++ b/include/asm-sparc64/ttable.h @@ -175,6 +175,12 @@ #define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl) #endif +#ifdef CONFIG_KGDB +#define KGDB_TRAP(lvl) TRAP_IRQ(kgdb_trap, lvl) +#else +#define KGDB_TRAP(lvl) TRAP_ARG(bad_trap, lvl) +#endif + #define SUN4V_ITSB_MISS \ ldxa [%g0] ASI_SCRATCHPAD, %g2; \ ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \ diff --git a/include/asm-x86/futex.h b/include/asm-x86/futex.h index ac0fbf24d72..e7a76b37b33 100644 --- a/include/asm-x86/futex.h +++ b/include/asm-x86/futex.h @@ -4,12 +4,12 @@ #ifdef __KERNEL__ #include <linux/futex.h> +#include <linux/uaccess.h> #include <asm/asm.h> #include <asm/errno.h> #include <asm/processor.h> #include <asm/system.h> -#include <asm/uaccess.h> #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ asm volatile("1:\t" insn "\n" \ diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h index 53185996209..b6338829d1a 100644 --- a/include/asm-x86/thread_info_32.h +++ b/include/asm-x86/thread_info_32.h @@ -131,7 +131,6 @@ static inline struct thread_info *current_thread_info(void) #define TIF_SYSCALL_EMU 5 /* syscall emulation active */ #define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */ #define TIF_SECCOMP 7 /* secure computing */ -#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */ #define TIF_HRTICK_RESCHED 9 /* reprogram hrtick timer */ #define TIF_MEMDIE 16 #define TIF_DEBUG 17 /* uses debug registers */ @@ -151,7 +150,6 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) -#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) #define _TIF_HRTICK_RESCHED (1 << TIF_HRTICK_RESCHED) #define _TIF_DEBUG (1 << TIF_DEBUG) #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) @@ -188,9 +186,20 @@ static inline struct thread_info *current_thread_info(void) this quantum (SMP) */ #define TS_POLLING 0x0002 /* True if in idle loop and not sleeping */ +#define TS_RESTORE_SIGMASK 0x0004 /* restore signal mask in do_signal() */ #define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) +#ifndef __ASSEMBLY__ +#define HAVE_SET_RESTORE_SIGMASK 1 +static inline void set_restore_sigmask(void) +{ + struct thread_info *ti = current_thread_info(); + ti->status |= TS_RESTORE_SIGMASK; + set_bit(TIF_SIGPENDING, &ti->flags); +} +#endif /* !__ASSEMBLY__ */ + #endif /* __KERNEL__ */ #endif /* _ASM_THREAD_INFO_H */ diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h index ed664e874de..cb69f70abba 100644 --- a/include/asm-x86/thread_info_64.h +++ b/include/asm-x86/thread_info_64.h @@ -109,7 +109,6 @@ static inline struct thread_info *stack_thread_info(void) #define TIF_IRET 5 /* force IRET */ #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ #define TIF_SECCOMP 8 /* secure computing */ -#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */ #define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */ #define TIF_HRTICK_RESCHED 11 /* reprogram hrtick timer */ /* 16 free */ @@ -133,7 +132,6 @@ static inline struct thread_info *stack_thread_info(void) #define _TIF_IRET (1 << TIF_IRET) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) -#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) #define _TIF_MCE_NOTIFY (1 << TIF_MCE_NOTIFY) #define _TIF_HRTICK_RESCHED (1 << TIF_HRTICK_RESCHED) #define _TIF_IA32 (1 << TIF_IA32) @@ -178,9 +176,20 @@ static inline struct thread_info *stack_thread_info(void) #define TS_COMPAT 0x0002 /* 32bit syscall active */ #define TS_POLLING 0x0004 /* true if in idle loop and not sleeping */ +#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */ #define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) +#ifndef __ASSEMBLY__ +#define HAVE_SET_RESTORE_SIGMASK 1 +static inline void set_restore_sigmask(void) +{ + struct thread_info *ti = current_thread_info(); + ti->status |= TS_RESTORE_SIGMASK; + set_bit(TIF_SIGPENDING, &ti->flags); +} +#endif /* !__ASSEMBLY__ */ + #endif /* __KERNEL__ */ #endif /* _ASM_THREAD_INFO_H */ diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h index 03e34547d48..661d90d6cf7 100644 --- a/include/linux/agp_backend.h +++ b/include/linux/agp_backend.h @@ -30,8 +30,6 @@ #ifndef _AGP_BACKEND_H #define _AGP_BACKEND_H 1 -#ifdef __KERNEL__ - #ifndef TRUE #define TRUE 1 #endif @@ -111,5 +109,4 @@ extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); extern void agp_backend_release(struct agp_bridge_data *); extern void agp_flush_chipset(struct agp_bridge_data *); -#endif /* __KERNEL__ */ #endif /* _AGP_BACKEND_H */ diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index b66fa2bdfd9..0a24d5550eb 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -11,9 +11,13 @@ #include <linux/percpu_counter.h> #include <linux/log2.h> #include <linux/proportions.h> +#include <linux/kernel.h> +#include <linux/fs.h> #include <asm/atomic.h> struct page; +struct device; +struct dentry; /* * Bits in backing_dev_info.state @@ -48,11 +52,26 @@ struct backing_dev_info { struct prop_local_percpu completions; int dirty_exceeded; + + unsigned int min_ratio; + unsigned int max_ratio, max_prop_frac; + + struct device *dev; + +#ifdef CONFIG_DEBUG_FS + struct dentry *debug_dir; + struct dentry *debug_stats; +#endif }; int bdi_init(struct backing_dev_info *bdi); void bdi_destroy(struct backing_dev_info *bdi); +int bdi_register(struct backing_dev_info *bdi, struct device *parent, + const char *fmt, ...); +int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); +void bdi_unregister(struct backing_dev_info *bdi); + static inline void __add_bdi_stat(struct backing_dev_info *bdi, enum bdi_stat_item item, s64 amount) { @@ -116,6 +135,8 @@ static inline s64 bdi_stat_sum(struct backing_dev_info *bdi, return sum; } +extern void bdi_writeout_inc(struct backing_dev_info *bdi); + /* * maximal error of a stat counter. */ @@ -128,24 +149,48 @@ static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi) #endif } +int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); +int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); + /* * Flags in backing_dev_info::capability - * - The first two flags control whether dirty pages will contribute to the - * VM's accounting and whether writepages() should be called for dirty pages - * (something that would not, for example, be appropriate for ramfs) - * - These flags let !MMU mmap() govern direct device mapping vs immediate - * copying more easily for MAP_PRIVATE, especially for ROM filesystems + * + * The first three flags control whether dirty pages will contribute to the + * VM's accounting and whether writepages() should be called for dirty pages + * (something that would not, for example, be appropriate for ramfs) + * + * WARNING: these flags are closely related and should not normally be + * used separately. The BDI_CAP_NO_ACCT_AND_WRITEBACK combines these + * three flags into a single convenience macro. + * + * BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting + * BDI_CAP_NO_WRITEBACK: Don't write pages back + * BDI_CAP_NO_ACCT_WB: Don't automatically account writeback pages + * + * These flags let !MMU mmap() govern direct device mapping vs immediate + * copying more easily for MAP_PRIVATE, especially for ROM filesystems. + * + * BDI_CAP_MAP_COPY: Copy can be mapped (MAP_PRIVATE) + * BDI_CAP_MAP_DIRECT: Can be mapped directly (MAP_SHARED) + * BDI_CAP_READ_MAP: Can be mapped for reading + * BDI_CAP_WRITE_MAP: Can be mapped for writing + * BDI_CAP_EXEC_MAP: Can be mapped for execution */ -#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 /* Dirty pages shouldn't contribute to accounting */ -#define BDI_CAP_NO_WRITEBACK 0x00000002 /* Don't write pages back */ -#define BDI_CAP_MAP_COPY 0x00000004 /* Copy can be mapped (MAP_PRIVATE) */ -#define BDI_CAP_MAP_DIRECT 0x00000008 /* Can be mapped directly (MAP_SHARED) */ -#define BDI_CAP_READ_MAP 0x00000010 /* Can be mapped for reading */ -#define BDI_CAP_WRITE_MAP 0x00000020 /* Can be mapped for writing */ -#define BDI_CAP_EXEC_MAP 0x00000040 /* Can be mapped for execution */ +#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 +#define BDI_CAP_NO_WRITEBACK 0x00000002 +#define BDI_CAP_MAP_COPY 0x00000004 +#define BDI_CAP_MAP_DIRECT 0x00000008 +#define BDI_CAP_READ_MAP 0x00000010 +#define BDI_CAP_WRITE_MAP 0x00000020 +#define BDI_CAP_EXEC_MAP 0x00000040 +#define BDI_CAP_NO_ACCT_WB 0x00000080 + #define BDI_CAP_VMFLAGS \ (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) +#define BDI_CAP_NO_ACCT_AND_WRITEBACK \ + (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB) + #if defined(VM_MAYREAD) && \ (BDI_CAP_READ_MAP != VM_MAYREAD || \ BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ @@ -185,17 +230,32 @@ void clear_bdi_congested(struct backing_dev_info *bdi, int rw); void set_bdi_congested(struct backing_dev_info *bdi, int rw); long congestion_wait(int rw, long timeout); -#define bdi_cap_writeback_dirty(bdi) \ - (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) -#define bdi_cap_account_dirty(bdi) \ - (!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY)) +static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) +{ + return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK); +} + +static inline bool bdi_cap_account_dirty(struct backing_dev_info *bdi) +{ + return !(bdi->capabilities & BDI_CAP_NO_ACCT_DIRTY); +} -#define mapping_cap_writeback_dirty(mapping) \ - bdi_cap_writeback_dirty((mapping)->backing_dev_info) +static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi) +{ + /* Paranoia: BDI_CAP_NO_WRITEBACK implies BDI_CAP_NO_ACCT_WB */ + return !(bdi->capabilities & (BDI_CAP_NO_ACCT_WB | + BDI_CAP_NO_WRITEBACK)); +} -#define mapping_cap_account_dirty(mapping) \ - bdi_cap_account_dirty((mapping)->backing_dev_info) +static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) +{ + return bdi_cap_writeback_dirty(mapping->backing_dev_info); +} +static inline bool mapping_cap_account_dirty(struct address_space *mapping) +{ + return bdi_cap_account_dirty(mapping->backing_dev_info); +} #endif /* _LINUX_BACKING_DEV_H */ diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild index 79bedddfd9c..1133d5f9d81 100644 --- a/include/linux/byteorder/Kbuild +++ b/include/linux/byteorder/Kbuild @@ -1,5 +1,3 @@ -header-y += big_endian.h -header-y += little_endian.h - -unifdef-y += generic.h +unifdef-y += big_endian.h +unifdef-y += little_endian.h unifdef-y += swab.h diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index bef87891cb2..961ed4b48d8 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h @@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p) #define __cpu_to_be16s(x) do {} while (0) #define __be16_to_cpus(x) do {} while (0) +#ifdef __KERNEL__ #include <linux/byteorder/generic.h> +#endif #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h index d3771551fdd..0846e6b931c 100644 --- a/include/linux/byteorder/generic.h +++ b/include/linux/byteorder/generic.h @@ -82,12 +82,6 @@ * */ - -#if defined(__KERNEL__) -/* - * inside the kernel, we can use nicknames; - * outside of it, we must avoid POSIX namespace pollution... - */ #define cpu_to_le64 __cpu_to_le64 #define le64_to_cpu __le64_to_cpu #define cpu_to_le32 __cpu_to_le32 @@ -176,6 +170,4 @@ static inline void be64_add_cpu(__be64 *var, u64 val) *var = cpu_to_be64(be64_to_cpu(*var) + val); } -#endif /* KERNEL */ - #endif /* _LINUX_BYTEORDER_GENERIC_H */ diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index 86e62b75017..05dc7c35b3b 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h @@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p) #define __cpu_to_be16s(x) __swab16s((x)) #define __be16_to_cpus(x) __swab16s((x)) +#ifdef __KERNEL__ #include <linux/byteorder/generic.h> +#endif #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ diff --git a/include/linux/cdev.h b/include/linux/cdev.h index 1e29b13d006..fb4591977b0 100644 --- a/include/linux/cdev.h +++ b/include/linux/cdev.h @@ -1,6 +1,5 @@ #ifndef _LINUX_CDEV_H #define _LINUX_CDEV_H -#ifdef __KERNEL__ #include <linux/kobject.h> #include <linux/kdev_t.h> @@ -34,4 +33,3 @@ void cd_forget(struct inode *); extern struct backing_dev_info directly_mappable_cdev_bdi; #endif -#endif diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h index 424fe9cf02c..b3ef0c46157 100644 --- a/include/linux/coda_fs_i.h +++ b/include/linux/coda_fs_i.h @@ -8,7 +8,6 @@ #ifndef _LINUX_CODA_FS_I #define _LINUX_CODA_FS_I -#ifdef __KERNEL__ #include <linux/types.h> #include <linux/list.h> #include <linux/coda.h> @@ -52,4 +51,3 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); #endif -#endif diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index b2fd7547b58..5c8351b859f 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -29,10 +29,11 @@ BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) /* - * Force always-inline if the user requests it so via the .config: + * Force always-inline if the user requests it so via the .config, + * or if gcc is too old: */ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) && (__GNUC__ >= 4) + !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) # define inline inline __attribute__((always_inline)) # define __inline__ __inline__ __attribute__((always_inline)) # define __inline __inline __attribute__((always_inline)) diff --git a/include/linux/concap.h b/include/linux/concap.h index 27304651d70..977acb3d1fb 100644 --- a/include/linux/concap.h +++ b/include/linux/concap.h @@ -8,7 +8,7 @@ #ifndef _LINUX_CONCAP_H #define _LINUX_CONCAP_H -#ifdef __KERNEL__ + #include <linux/skbuff.h> #include <linux/netdevice.h> @@ -110,4 +110,3 @@ extern int concap_nop(struct concap_proto *cprot); */ extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb); #endif -#endif diff --git a/include/linux/configfs.h b/include/linux/configfs.h index 4b287ad9371..3ae65b1bf90 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h @@ -35,8 +35,6 @@ #ifndef _CONFIGFS_H_ #define _CONFIGFS_H_ -#ifdef __KERNEL__ - #include <linux/kernel.h> #include <linux/types.h> #include <linux/list.h> @@ -194,6 +192,4 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys); int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target); void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target); -#endif /* __KERNEL__ */ - #endif /* _CONFIGFS_H_ */ diff --git a/include/linux/console.h b/include/linux/console.h index a5f88a6a259..a4f27fbdf54 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -91,6 +91,7 @@ void give_up_console(const struct consw *sw); #define CON_ENABLED (4) #define CON_BOOT (8) #define CON_ANYTIME (16) /* Safe to call when cpu is offline */ +#define CON_BRL (32) /* Used for a braille device */ struct console { char name[16]; @@ -121,6 +122,9 @@ extern struct tty_driver *console_device(int *); extern void console_stop(struct console *); extern void console_start(struct console *); extern int is_console_locked(void); +extern int braille_register_console(struct console *, int index, + char *console_options, char *braille_options); +extern int braille_unregister_console(struct console *); extern int console_suspend_enabled; diff --git a/include/linux/crc-ccitt.h b/include/linux/crc-ccitt.h index 90037617da8..f52696a1ff0 100644 --- a/include/linux/crc-ccitt.h +++ b/include/linux/crc-ccitt.h @@ -1,6 +1,5 @@ #ifndef _LINUX_CRC_CCITT_H #define _LINUX_CRC_CCITT_H -#ifdef __KERNEL__ #include <linux/types.h> @@ -13,5 +12,4 @@ static inline u16 crc_ccitt_byte(u16 crc, const u8 c) return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; } -#endif /* __KERNEL__ */ #endif /* _LINUX_CRC_CCITT_H */ diff --git a/include/linux/dcache.h b/include/linux/dcache.h index cfb1627ac51..2a6639407c8 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -1,8 +1,6 @@ #ifndef __LINUX_DCACHE_H #define __LINUX_DCACHE_H -#ifdef __KERNEL__ - #include <asm/atomic.h> #include <linux/list.h> #include <linux/spinlock.h> @@ -365,6 +363,4 @@ extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); extern int sysctl_vfs_cache_pressure; -#endif /* __KERNEL__ */ - #endif /* __LINUX_DCACHE_H */ diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h new file mode 100644 index 00000000000..8c243aaa86a --- /dev/null +++ b/include/linux/debugobjects.h @@ -0,0 +1,90 @@ +#ifndef _LINUX_DEBUGOBJECTS_H +#define _LINUX_DEBUGOBJECTS_H + +#include <linux/list.h> +#include <linux/spinlock.h> + +enum debug_obj_state { + ODEBUG_STATE_NONE, + ODEBUG_STATE_INIT, + ODEBUG_STATE_INACTIVE, + ODEBUG_STATE_ACTIVE, + ODEBUG_STATE_DESTROYED, + ODEBUG_STATE_NOTAVAILABLE, + ODEBUG_STATE_MAX, +}; + +struct debug_obj_descr; + +/** + * struct debug_obj - representaion of an tracked object + * @node: hlist node to link the object into the tracker list + * @state: tracked object state + * @object: pointer to the real object + * @descr: pointer to an object type specific debug description structure + */ +struct debug_obj { + struct hlist_node node; + enum debug_obj_state state; + void *object; + struct debug_obj_descr *descr; +}; + +/** + * struct debug_obj_descr - object type specific debug description structure + * @name: name of the object typee + * @fixup_init: fixup function, which is called when the init check + * fails + * @fixup_activate: fixup function, which is called when the activate check + * fails + * @fixup_destroy: fixup function, which is called when the destroy check + * fails + * @fixup_free: fixup function, which is called when the free check + * fails + */ +struct debug_obj_descr { + const char *name; + + int (*fixup_init) (void *addr, enum debug_obj_state state); + int (*fixup_activate) (void *addr, enum debug_obj_state state); + int (*fixup_destroy) (void *addr, enum debug_obj_state state); + int (*fixup_free) (void *addr, enum debug_obj_state state); +}; + +#ifdef CONFIG_DEBUG_OBJECTS +extern void debug_object_init (void *addr, struct debug_obj_descr *descr); +extern void +debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr); +extern void debug_object_activate (void *addr, struct debug_obj_descr *descr); +extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); +extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); +extern void debug_object_free (void *addr, struct debug_obj_descr *descr); + +extern void debug_objects_early_init(void); +extern void debug_objects_mem_init(void); +#else +static inline void +debug_object_init (void *addr, struct debug_obj_descr *descr) { } +static inline void +debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { } +static inline void +debug_object_activate (void *addr, struct debug_obj_descr *descr) { } +static inline void +debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { } +static inline void +debug_object_destroy (void *addr, struct debug_obj_descr *descr) { } +static inline void +debug_object_free (void *addr, struct debug_obj_descr *descr) { } + +static inline void debug_objects_early_init(void) { } +static inline void debug_objects_mem_init(void) { } +#endif + +#ifdef CONFIG_DEBUG_OBJECTS_FREE +extern void debug_check_no_obj_freed(const void *address, unsigned long size); +#else +static inline void +debug_check_no_obj_freed(const void *address, unsigned long size) { } +#endif + +#endif diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index ad3b787479a..0d8d419d191 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -8,8 +8,6 @@ #ifndef _LINUX_DEVICE_MAPPER_H #define _LINUX_DEVICE_MAPPER_H -#ifdef __KERNEL__ - #include <linux/bio.h> struct dm_target; @@ -344,5 +342,4 @@ static inline unsigned long to_bytes(sector_t n) return (n << SECTOR_SHIFT); } -#endif /* __KERNEL__ */ #endif /* _LINUX_DEVICE_MAPPER_H */ diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h index b672ddc0073..154769cad3f 100644 --- a/include/linux/devpts_fs.h +++ b/include/linux/devpts_fs.h @@ -17,6 +17,8 @@ #ifdef CONFIG_UNIX98_PTYS +int devpts_new_index(void); +void devpts_kill_index(int idx); int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ struct tty_struct *devpts_get_tty(int number); /* get tty structure */ void devpts_pty_kill(int number); /* unlink */ @@ -24,6 +26,8 @@ void devpts_pty_kill(int number); /* unlink */ #else /* Dummy stubs in the no-pty case */ +static inline int devpts_new_index(void) { return -EINVAL; } +static inline void devpts_kill_index(int idx) { } static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } static inline void devpts_pty_kill(int number) { } diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index b489fc6d0b6..a701399b7fe 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -8,9 +8,6 @@ #ifndef _LINUX_EVENTFD_H #define _LINUX_EVENTFD_H - -#ifdef __KERNEL__ - #ifdef CONFIG_EVENTFD struct file *eventfd_fget(int fd); @@ -24,7 +21,5 @@ static inline int eventfd_signal(struct file *file, int n) #endif /* CONFIG_EVENTFD */ -#endif /* __KERNEL__ */ - #endif /* _LINUX_EVENTFD_H */ diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 2cad5c67397..c415a496de3 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h @@ -14,7 +14,6 @@ * option) any later version. */ -#ifdef __KERNEL__ #ifndef _FSL_DEVICE_H_ #define _FSL_DEVICE_H_ @@ -127,4 +126,3 @@ struct mpc8xx_pcmcia_ops { }; #endif /* _FSL_DEVICE_H_ */ -#endif /* __KERNEL__ */ diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index d4b7c4ac72e..a89513188ce 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -11,8 +11,6 @@ * (C) Copyright 2005 Robert Love */ -#ifdef __KERNEL__ - #include <linux/dnotify.h> #include <linux/inotify.h> #include <linux/audit.h> @@ -296,6 +294,4 @@ static inline void fsnotify_oldname_free(const char *old_name) #endif /* ! CONFIG_INOTIFY */ -#endif /* __KERNEL__ */ - #endif /* _LINUX_FS_NOTIFY_H */ diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h index 5412da28fa4..110833666e3 100644 --- a/include/linux/generic_serial.h +++ b/include/linux/generic_serial.h @@ -78,7 +78,7 @@ struct gs_port { #define GS_DEBUG_WRITE 0x00000040 #ifdef __KERNEL__ -void gs_put_char(struct tty_struct *tty, unsigned char ch); +int gs_put_char(struct tty_struct *tty, unsigned char ch); int gs_write(struct tty_struct *tty, const unsigned char *buf, int count); int gs_write_room(struct tty_struct *tty); diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 56f3236da82..31a4d653389 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -266,6 +266,21 @@ extern ktime_t ktime_get_real(void); extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, enum hrtimer_mode mode); +#ifdef CONFIG_DEBUG_OBJECTS_TIMERS +extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock, + enum hrtimer_mode mode); + +extern void destroy_hrtimer_on_stack(struct hrtimer *timer); +#else +static inline void hrtimer_init_on_stack(struct hrtimer *timer, + clockid_t which_clock, + enum hrtimer_mode mode) +{ + hrtimer_init(timer, which_clock, mode); +} +static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } +#endif + /* Basic timer operations: */ extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode); diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index 85d11916e9e..7244456e7e6 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h @@ -11,7 +11,6 @@ #ifndef LINUX_HWRANDOM_H_ #define LINUX_HWRANDOM_H_ -#ifdef __KERNEL__ #include <linux/types.h> #include <linux/list.h> @@ -46,5 +45,4 @@ extern int hwrng_register(struct hwrng *rng); /** Unregister a Hardware Random Number Generator driver. */ extern void hwrng_unregister(struct hwrng *rng); -#endif /* __KERNEL__ */ #endif /* LINUX_HWRANDOM_H_ */ diff --git a/include/linux/i2o.h b/include/linux/i2o.h index f65e58a1d92..7d51cbca49a 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h @@ -18,8 +18,6 @@ #ifndef _I2O_H #define _I2O_H -#ifdef __KERNEL__ /* This file to be included by kernel only */ - #include <linux/i2o-dev.h> /* How many different OSM's are we allowing */ @@ -1255,5 +1253,4 @@ extern void i2o_dump_message(struct i2o_message *); extern void i2o_dump_hrt(struct i2o_controller *c); extern void i2o_debug_state(struct i2o_controller *c); -#endif /* __KERNEL__ */ #endif /* _I2O_H */ diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index 0d9d7ea2c1c..5f200bac374 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h @@ -1,9 +1,6 @@ #ifndef _LINUX_IF_MACVLAN_H #define _LINUX_IF_MACVLAN_H -#ifdef __KERNEL__ - extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); -#endif /* __KERNEL__ */ #endif /* _LINUX_IF_MACVLAN_H */ diff --git a/include/linux/inet.h b/include/linux/inet.h index 675a7dbe86f..1354080cf8c 100644 --- a/include/linux/inet.h +++ b/include/linux/inet.h @@ -42,11 +42,9 @@ #ifndef _LINUX_INET_H #define _LINUX_INET_H -#ifdef __KERNEL__ #include <linux/types.h> extern __be32 in_aton(const char *str); extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); -#endif #endif /* _LINUX_INET_H */ diff --git a/include/linux/isicom.h b/include/linux/isicom.h index 8f4c71759d7..bbd42197298 100644 --- a/include/linux/isicom.h +++ b/include/linux/isicom.h @@ -1,11 +1,6 @@ #ifndef _LINUX_ISICOM_H #define _LINUX_ISICOM_H -/*#define ISICOM_DEBUG*/ -/*#define ISICOM_DEBUG_DTR_RTS*/ - -#ifdef __KERNEL__ - #define YES 1 #define NO 0 @@ -85,6 +80,4 @@ #define ISI_TXOK 0x0001 -#endif /* __KERNEL__ */ - #endif /* ISICOM_H */ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 53839ba265e..4d46e299afb 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -338,33 +338,90 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, #endif /* __LITTLE_ENDIAN */ /* - * min()/max() macros that also do + * min()/max()/clamp() macros that also do * strict type-checking.. See the * "unnecessary" pointer comparison. */ -#define min(x,y) ({ \ - typeof(x) _x = (x); \ - typeof(y) _y = (y); \ - (void) (&_x == &_y); \ - _x < _y ? _x : _y; }) - -#define max(x,y) ({ \ - typeof(x) _x = (x); \ - typeof(y) _y = (y); \ - (void) (&_x == &_y); \ - _x > _y ? _x : _y; }) +#define min(x, y) ({ \ + typeof(x) _min1 = (x); \ + typeof(y) _min2 = (y); \ + (void) (&_min1 == &_min2); \ + _min1 < _min2 ? _min1 : _min2; }) + +#define max(x, y) ({ \ + typeof(x) _max1 = (x); \ + typeof(y) _max2 = (y); \ + (void) (&_max1 == &_max2); \ + _max1 > _max2 ? _max1 : _max2; }) + +/** + * clamp - return a value clamped to a given range with strict typechecking + * @val: current value + * @min: minimum allowable value + * @max: maximum allowable value + * + * This macro does strict typechecking of min/max to make sure they are of the + * same type as val. See the unnecessary pointer comparisons. + */ +#define clamp(val, min, max) ({ \ + typeof(val) __val = (val); \ + typeof(min) __min = (min); \ + typeof(max) __max = (max); \ + (void) (&__val == &__min); \ + (void) (&__val == &__max); \ + __val = __val < __min ? __min: __val; \ + __val > __max ? __max: __val; }) /* * ..and if you can't take the strict * types, you can specify one yourself. * - * Or not use min/max at all, of course. + * Or not use min/max/clamp at all, of course. + */ +#define min_t(type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1: __min2; }) + +#define max_t(type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1: __max2; }) + +/** + * clamp_t - return a value clamped to a given range using a given type + * @type: the type of variable to use + * @val: current value + * @min: minimum allowable value + * @max: maximum allowable value + * + * This macro does no typechecking and uses temporary variables of type + * 'type' to make all the comparisons. */ -#define min_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) -#define max_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) +#define clamp_t(type, val, min, max) ({ \ + type __val = (val); \ + type __min = (min); \ + type __max = (max); \ + __val = __val < __min ? __min: __val; \ + __val > __max ? __max: __val; }) +/** + * clamp_val - return a value clamped to a given range using val's type + * @val: current value + * @min: minimum allowable value + * @max: maximum allowable value + * + * This macro does no typechecking and uses temporary variables of whatever + * type the input argument 'val' is. This is useful when val is an unsigned + * type and min and max are literals that will otherwise be assigned a signed + * integer type. + */ +#define clamp_val(val, min, max) ({ \ + typeof(val) __val = (val); \ + typeof(val) __min = (min); \ + typeof(val) __max = (max); \ + __val = __val < __min ? __min: __val; \ + __val > __max ? __max: __val; }) /** * container_of - cast a member of a structure out to the containing structure diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 404f4464cb1..29f62e1733f 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h @@ -21,8 +21,6 @@ #ifndef _LINUX_KFIFO_H #define _LINUX_KFIFO_H -#ifdef __KERNEL__ - #include <linux/kernel.h> #include <linux/spinlock.h> @@ -151,7 +149,4 @@ static inline unsigned int kfifo_len(struct kfifo *fifo) return ret; } -#else -#warning "don't include kernel headers in userspace" -#endif /* __KERNEL__ */ #endif diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h index bafe178a381..73717ed9ea7 100644 --- a/include/linux/kobj_map.h +++ b/include/linux/kobj_map.h @@ -1,5 +1,3 @@ -#ifdef __KERNEL__ - #include <linux/mutex.h> typedef struct kobject *kobj_probe_t(dev_t, int *, void *); @@ -10,5 +8,3 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *, void kobj_unmap(struct kobj_map *, dev_t, unsigned long); struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); - -#endif diff --git a/include/linux/kobject.h b/include/linux/kobject.h index caa3f411f15..39e709f88aa 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -16,8 +16,6 @@ #ifndef _KOBJECT_H_ #define _KOBJECT_H_ -#ifdef __KERNEL__ - #include <linux/types.h> #include <linux/list.h> #include <linux/sysfs.h> @@ -224,5 +222,4 @@ static inline int kobject_action_type(const char *buf, size_t count, { return -EINVAL; } #endif -#endif /* __KERNEL__ */ #endif /* _KOBJECT_H_ */ diff --git a/include/linux/kref.h b/include/linux/kref.h index 5d185635786..0cef6badd6f 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -15,8 +15,6 @@ #ifndef _KREF_H_ #define _KREF_H_ -#ifdef __KERNEL__ - #include <linux/types.h> #include <asm/atomic.h> @@ -29,5 +27,4 @@ void kref_init(struct kref *kref); void kref_get(struct kref *kref); int kref_put(struct kref *kref, void (*release) (struct kref *kref)); -#endif /* __KERNEL__ */ #endif /* _KREF_H_ */ diff --git a/include/linux/list.h b/include/linux/list.h index 7627508f1b7..08cf4f65188 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -1,8 +1,6 @@ #ifndef _LINUX_LIST_H #define _LINUX_LIST_H -#ifdef __KERNEL__ - #include <linux/stddef.h> #include <linux/poison.h> #include <linux/prefetch.h> @@ -983,7 +981,4 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = rcu_dereference(pos->next)) -#else -#warning "don't include kernel headers in userspace" -#endif /* __KERNEL__ */ #endif diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index aad98003176..c463cd8a15a 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1,7 +1,6 @@ #ifndef _LINUX_MMZONE_H #define _LINUX_MMZONE_H -#ifdef __KERNEL__ #ifndef __ASSEMBLY__ #ifndef __GENERATING_BOUNDS_H @@ -97,6 +96,7 @@ enum zone_stat_item { NR_UNSTABLE_NFS, /* NFS unstable pages */ NR_BOUNCE, NR_VMSCAN_WRITE, + NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ #ifdef CONFIG_NUMA NUMA_HIT, /* allocated in intended node */ NUMA_MISS, /* allocated in non intended node */ @@ -1004,5 +1004,4 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); #endif /* !__GENERATING_BOUNDS.H */ #endif /* !__ASSEMBLY__ */ -#endif /* __KERNEL__ */ #endif /* _LINUX_MMZONE_H */ diff --git a/include/linux/mount.h b/include/linux/mount.h index b4836d58f42..4374d1adeb4 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -10,7 +10,6 @@ */ #ifndef _LINUX_MOUNT_H #define _LINUX_MOUNT_H -#ifdef __KERNEL__ #include <linux/types.h> #include <linux/list.h> @@ -114,5 +113,4 @@ extern void mark_mounts_for_expiry(struct list_head *mounts); extern spinlock_t vfsmount_lock; extern dev_t name_to_dev_t(char *name); -#endif #endif /* _LINUX_MOUNT_H */ diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h index bdb4c8ae692..4b0bec47784 100644 --- a/include/linux/ncp_fs_i.h +++ b/include/linux/ncp_fs_i.h @@ -8,8 +8,6 @@ #ifndef _LINUX_NCP_FS_I #define _LINUX_NCP_FS_I -#ifdef __KERNEL__ - /* * This is the ncpfs part of the inode structure. This must contain * all the information we need to work with an inode after creation. @@ -28,6 +26,4 @@ struct ncp_inode_info { struct inode vfs_inode; }; -#endif /* __KERNEL__ */ - #endif /* _LINUX_NCP_FS_I */ diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 6dc11959770..afe338217d9 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -1,6 +1,5 @@ #ifndef _LINUX_OF_DEVICE_H #define _LINUX_OF_DEVICE_H -#ifdef __KERNEL__ #include <linux/device.h> #include <linux/of.h> @@ -25,5 +24,4 @@ static inline void of_device_free(struct of_device *dev) of_release_dev(&dev->dev); } -#endif /* __KERNEL__ */ #endif /* _LINUX_OF_DEVICE_H */ diff --git a/include/linux/pid.h b/include/linux/pid.h index c7980810eb0..c21c7e8124a 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -60,7 +60,7 @@ struct pid /* lists of tasks that use this pid */ struct hlist_head tasks[PIDTYPE_MAX]; struct rcu_head rcu; - int level; + unsigned int level; struct upid numbers[1]; }; @@ -89,9 +89,11 @@ extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); * attach_pid() and detach_pid() must be called with the tasklist_lock * write-held. */ -extern int attach_pid(struct task_struct *task, enum pid_type type, - struct pid *pid); +extern void attach_pid(struct task_struct *task, enum pid_type type, + struct pid *pid); extern void detach_pid(struct task_struct *task, enum pid_type); +extern void change_pid(struct task_struct *task, enum pid_type, + struct pid *pid); extern void transfer_pid(struct task_struct *old, struct task_struct *new, enum pid_type); diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index fcd61fa2c83..caff5283d15 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h @@ -20,7 +20,7 @@ struct pid_namespace { int last_pid; struct task_struct *child_reaper; struct kmem_cache *pid_cachep; - int level; + unsigned int level; struct pid_namespace *parent; #ifdef CONFIG_PROC_FS struct vfsmount *proc_mnt; diff --git a/include/linux/pm.h b/include/linux/pm.h index 1de72cbbe0d..39a7ee859b6 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -21,8 +21,6 @@ #ifndef _LINUX_PM_H #define _LINUX_PM_H -#ifdef __KERNEL__ - #include <linux/list.h> #include <asm/atomic.h> #include <asm/errno.h> @@ -225,6 +223,4 @@ extern unsigned int pm_flags; #define PM_APM 1 #define PM_ACPI 2 -#endif /* __KERNEL__ */ - #endif /* _LINUX_PM_H */ diff --git a/include/linux/pnp.h b/include/linux/pnp.h index b2f05c230f4..2f3bcf73052 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -6,8 +6,6 @@ #ifndef _LINUX_PNP_H #define _LINUX_PNP_H -#ifdef __KERNEL__ - #include <linux/device.h> #include <linux/list.h> #include <linux/errno.h> @@ -466,6 +464,4 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { } #define pnp_dbg(format, arg...) do {} while (0) #endif -#endif /* __KERNEL__ */ - #endif /* _LINUX_PNP_H */ diff --git a/include/linux/poison.h b/include/linux/poison.h index a9c31be7052..9f31683728f 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h @@ -10,6 +10,13 @@ #define LIST_POISON1 ((void *) 0x00100100) #define LIST_POISON2 ((void *) 0x00200200) +/********** include/linux/timer.h **********/ +/* + * Magic number "tsta" to indicate a static timer initializer + * for the object debugging code. + */ +#define TIMER_ENTRY_STATIC ((void *) 0x74737461) + /********** mm/slab.c **********/ /* * Magic nums for obj red zoning. diff --git a/include/linux/profile.h b/include/linux/profile.h index ff576d1db67..05c1cc73693 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h @@ -1,8 +1,6 @@ #ifndef _LINUX_PROFILE_H #define _LINUX_PROFILE_H -#ifdef __KERNEL__ - #include <linux/kernel.h> #include <linux/init.h> #include <linux/cpumask.h> @@ -118,6 +116,4 @@ static inline void unregister_timer_hook(int (*hook)(struct pt_regs *)) #endif /* CONFIG_PROFILING */ -#endif /* __KERNEL__ */ - #endif /* _LINUX_PROFILE_H */ diff --git a/include/linux/proportions.h b/include/linux/proportions.h index 2c3b3cad92b..5afc1b23346 100644 --- a/include/linux/proportions.h +++ b/include/linux/proportions.h @@ -78,6 +78,19 @@ void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl) } /* + * Limit the time part in order to ensure there are some bits left for the + * cycle counter and fraction multiply. + */ +#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4) + +#define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1) +#define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT) + +void __prop_inc_percpu_max(struct prop_descriptor *pd, + struct prop_local_percpu *pl, long frac); + + +/* * ----- SINGLE ------ */ diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index ebe0c17039c..f98501ba557 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -98,6 +98,10 @@ extern void ptrace_untrace(struct task_struct *child); extern int ptrace_may_attach(struct task_struct *task); extern int __ptrace_may_attach(struct task_struct *task); +static inline int ptrace_reparented(struct task_struct *child) +{ + return child->real_parent != child->parent; +} static inline void ptrace_link(struct task_struct *child, struct task_struct *new_parent) { diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index 8ab630b67fc..81a1a02d456 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h @@ -94,6 +94,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, extern void md_do_sync(mddev_t *mddev); extern void md_new_event(mddev_t *mddev); extern void md_allow_write(mddev_t *mddev); +extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); #endif /* CONFIG_MD */ #endif diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 7bb6d1abf71..812ffa590cf 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -84,6 +84,10 @@ struct mdk_rdev_s #define AllReserved 6 /* If whole device is reserved for * one array */ #define AutoDetected 7 /* added by auto-detect */ +#define Blocked 8 /* An error occured on an externally + * managed array, don't allow writes + * until it is cleared */ + wait_queue_head_t blocked_wait; int desc_nr; /* descriptor index in the superblock */ int raid_disk; /* role of device in array */ diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h index b3dccd68629..b3aa05baab8 100644 --- a/include/linux/rcuclassic.h +++ b/include/linux/rcuclassic.h @@ -33,8 +33,6 @@ #ifndef __LINUX_RCUCLASSIC_H #define __LINUX_RCUCLASSIC_H -#ifdef __KERNEL__ - #include <linux/cache.h> #include <linux/spinlock.h> #include <linux/threads.h> @@ -163,5 +161,4 @@ extern long rcu_batches_completed_bh(void); #define rcu_enter_nohz() do { } while (0) #define rcu_exit_nohz() do { } while (0) -#endif /* __KERNEL__ */ #endif /* __LINUX_RCUCLASSIC_H */ diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 37a642c5487..8082d6587a0 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -33,8 +33,6 @@ #ifndef __LINUX_RCUPDATE_H #define __LINUX_RCUPDATE_H -#ifdef __KERNEL__ - #include <linux/cache.h> #include <linux/spinlock.h> #include <linux/threads.h> @@ -245,5 +243,4 @@ extern long rcu_batches_completed_bh(void); extern void rcu_init(void); extern int rcu_needs_cpu(int cpu); -#endif /* __KERNEL__ */ #endif /* __LINUX_RCUPDATE_H */ diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index d038aa6e5ee..8a05c7e20bc 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h @@ -33,8 +33,6 @@ #ifndef __LINUX_RCUPREEMPT_H #define __LINUX_RCUPREEMPT_H -#ifdef __KERNEL__ - #include <linux/cache.h> #include <linux/spinlock.h> #include <linux/threads.h> @@ -104,5 +102,4 @@ static inline void rcu_exit_nohz(void) #define rcu_exit_nohz() do { } while (0) #endif /* CONFIG_NO_HZ */ -#endif /* __KERNEL__ */ #endif /* __LINUX_RCUPREEMPT_H */ diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h index 21cd6b2a5c4..b99ae073192 100644 --- a/include/linux/rcupreempt_trace.h +++ b/include/linux/rcupreempt_trace.h @@ -32,7 +32,6 @@ #ifndef __LINUX_RCUPREEMPT_TRACE_H #define __LINUX_RCUPREEMPT_TRACE_H -#ifdef __KERNEL__ #include <linux/types.h> #include <linux/kernel.h> @@ -95,5 +94,4 @@ extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace); extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace); extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace); -#endif /* __KERNEL__ */ #endif /* __LINUX_RCUPREEMPT_TRACE_H */ diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index db5ef9b83c3..336ee43ed7d 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h @@ -177,7 +177,6 @@ struct reiserfs_journal { struct reiserfs_journal_cnode *j_last; /* newest journal block */ struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ - struct file *j_dev_file; struct block_device *j_dev_bd; int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ diff --git a/include/linux/rio.h b/include/linux/rio.h index cfb66bbc0f2..c1c99c9643d 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h @@ -14,8 +14,6 @@ #ifndef LINUX_RIO_H #define LINUX_RIO_H -#ifdef __KERNEL__ - #include <linux/types.h> #include <linux/ioport.h> #include <linux/list.h> @@ -331,5 +329,4 @@ extern void rio_close_inb_mbox(struct rio_mport *, int); extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); extern void rio_close_outb_mbox(struct rio_mport *, int); -#endif /* __KERNEL__ */ #endif /* LINUX_RIO_H */ diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h index 7adb2a1aac9..90987b7bcc1 100644 --- a/include/linux/rio_drv.h +++ b/include/linux/rio_drv.h @@ -13,8 +13,6 @@ #ifndef LINUX_RIO_DRV_H #define LINUX_RIO_DRV_H -#ifdef __KERNEL__ - #include <linux/types.h> #include <linux/ioport.h> #include <linux/list.h> @@ -465,5 +463,4 @@ extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from); extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, struct rio_dev *from); -#endif /* __KERNEL__ */ #endif /* LINUX_RIO_DRV_H */ diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 7b524b4109a..efd348fe8ca 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h @@ -9,8 +9,6 @@ #include <linux/linkage.h> -#ifdef __KERNEL__ - #include <linux/types.h> #include <linux/kernel.h> #include <asm/system.h> @@ -90,5 +88,4 @@ extern void up_read_non_owner(struct rw_semaphore *sem); # define up_read_non_owner(sem) up_read(sem) #endif -#endif /* __KERNEL__ */ #endif /* _LINUX_RWSEM_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 1d02babdb2c..03c238088ae 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -554,6 +554,14 @@ struct signal_struct { #define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */ #define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ #define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ +/* + * Pending notifications to parent. + */ +#define SIGNAL_CLD_STOPPED 0x00000010 +#define SIGNAL_CLD_CONTINUED 0x00000020 +#define SIGNAL_CLD_MASK (SIGNAL_CLD_STOPPED|SIGNAL_CLD_CONTINUED) + +#define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */ /* If true, all threads except ->group_exit_task have pending SIGKILL */ static inline int signal_group_exit(const struct signal_struct *sig) @@ -1167,7 +1175,7 @@ struct task_struct { struct sighand_struct *sighand; sigset_t blocked, real_blocked; - sigset_t saved_sigmask; /* To be restored with TIF_RESTORE_SIGMASK */ + sigset_t saved_sigmask; /* restored if set_restore_sigmask() was used */ struct sigpending pending; unsigned long sas_ss_sp; @@ -1669,7 +1677,10 @@ extern struct pid_namespace init_pid_ns; extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, struct pid_namespace *ns); -extern struct task_struct *find_task_by_pid(pid_t nr); +static inline struct task_struct *__deprecated find_task_by_pid(pid_t nr) +{ + return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns); +} extern struct task_struct *find_task_by_vpid(pid_t nr); extern struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns); @@ -1745,8 +1756,7 @@ extern void zap_other_threads(struct task_struct *p); extern int kill_proc(pid_t, int, int); extern struct sigqueue *sigqueue_alloc(void); extern void sigqueue_free(struct sigqueue *); -extern int send_sigqueue(int, struct sigqueue *, struct task_struct *); -extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *); +extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 5b5369c3c20..a66304a0995 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -1,6 +1,5 @@ #ifndef _LINUX_SEQ_FILE_H #define _LINUX_SEQ_FILE_H -#ifdef __KERNEL__ #include <linux/types.h> #include <linux/string.h> @@ -69,4 +68,3 @@ extern struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos); #endif -#endif diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 7cb094a8245..d32123ae08a 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -149,13 +149,15 @@ /* Freescale ColdFire */ #define PORT_MCF 78 -#define PORT_SC26XX 79 - +/* Blackfin SPORT */ +#define PORT_BFIN_SPORT 79 /* MN10300 on-chip UART numbers */ #define PORT_MN10300 80 #define PORT_MN10300_CTS 81 +#define PORT_SC26XX 82 + #ifdef __KERNEL__ #include <linux/compiler.h> diff --git a/include/linux/signal.h b/include/linux/signal.h index 42d2e0a948f..84f997f8aa5 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -362,8 +362,6 @@ int unhandled_signal(struct task_struct *tsk, int sig); #define sig_kernel_stop(sig) \ (((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK)) -#define sig_needs_tasklist(sig) ((sig) == SIGCONT) - #define sig_user_defined(t, signr) \ (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \ ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN)) diff --git a/include/linux/slab.h b/include/linux/slab.h index f62caaad94e..805ed4b92f9 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -9,8 +9,6 @@ #ifndef _LINUX_SLAB_H #define _LINUX_SLAB_H -#ifdef __KERNEL__ - #include <linux/gfp.h> #include <linux/types.h> @@ -29,6 +27,13 @@ #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ +/* Flag to prevent checks on free */ +#ifdef CONFIG_DEBUG_OBJECTS +# define SLAB_DEBUG_OBJECTS 0x00400000UL +#else +# define SLAB_DEBUG_OBJECTS 0x00000000UL +#endif + /* The following flags affect the page allocator grouping pages by mobility */ #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ @@ -276,5 +281,4 @@ extern const struct seq_operations slabinfo_op; ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); #endif -#endif /* __KERNEL__ */ #endif /* _LINUX_SLAB_H */ diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h index 8516954a514..8ccf4eca2c3 100644 --- a/include/linux/smb_fs_i.h +++ b/include/linux/smb_fs_i.h @@ -9,7 +9,6 @@ #ifndef _LINUX_SMB_FS_I #define _LINUX_SMB_FS_I -#ifdef __KERNEL__ #include <linux/types.h> #include <linux/fs.h> @@ -36,4 +35,3 @@ struct smb_inode_info { }; #endif -#endif diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h index 3aa97aa4277..8a060a7040d 100644 --- a/include/linux/smb_fs_sb.h +++ b/include/linux/smb_fs_sb.h @@ -9,8 +9,6 @@ #ifndef _SMB_FS_SB #define _SMB_FS_SB -#ifdef __KERNEL__ - #include <linux/types.h> #include <linux/smb.h> @@ -96,6 +94,4 @@ smb_unlock_server(struct smb_sb_info *server) up(&(server->sem)); } -#endif /* __KERNEL__ */ - #endif diff --git a/include/linux/svga.h b/include/linux/svga.h index 13ad0b82ac2..c59a51a2b0e 100644 --- a/include/linux/svga.h +++ b/include/linux/svga.h @@ -1,8 +1,6 @@ #ifndef _LINUX_SVGA_H #define _LINUX_SVGA_H -#ifdef __KERNEL__ - #include <linux/pci.h> #include <video/vga.h> @@ -122,6 +120,5 @@ void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninf int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); -#endif /* __KERNEL__ */ #endif /* _LINUX_SVGA_H */ diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h index 004808a6df1..6f371f24160 100644 --- a/include/linux/textsearch.h +++ b/include/linux/textsearch.h @@ -1,8 +1,6 @@ #ifndef __LINUX_TEXTSEARCH_H #define __LINUX_TEXTSEARCH_H -#ifdef __KERNEL__ - #include <linux/types.h> #include <linux/list.h> #include <linux/kernel.h> @@ -177,6 +175,4 @@ static inline void *ts_config_priv(struct ts_config *conf) return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); } -#endif /* __KERNEL__ */ - #endif diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index accd7bad35b..38a56477f27 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -92,6 +92,31 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) -#endif +#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK +/* + * An arch can define its own version of set_restore_sigmask() to get the + * job done however works, with or without TIF_RESTORE_SIGMASK. + */ +#define HAVE_SET_RESTORE_SIGMASK 1 + +/** + * set_restore_sigmask() - make sure saved_sigmask processing gets done + * + * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code + * will run before returning to user mode, to process the flag. For + * all callers, TIF_SIGPENDING is already set or it's no harm to set + * it. TIF_RESTORE_SIGMASK need not be in the set of bits that the + * arch code will notice on return to user mode, in case those bits + * are scarce. We set TIF_SIGPENDING here to ensure that the arch + * signal code always gets run when TIF_RESTORE_SIGMASK is set. + */ +static inline void set_restore_sigmask(void) +{ + set_thread_flag(TIF_RESTORE_SIGMASK); + set_thread_flag(TIF_SIGPENDING); +} +#endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */ + +#endif /* __KERNEL__ */ #endif /* _LINUX_THREAD_INFO_H */ diff --git a/include/linux/timer.h b/include/linux/timer.h index 979fefdeb86..d4ba79248a2 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -4,6 +4,7 @@ #include <linux/list.h> #include <linux/ktime.h> #include <linux/stddef.h> +#include <linux/debugobjects.h> struct tvec_base; @@ -25,6 +26,7 @@ struct timer_list { extern struct tvec_base boot_tvec_bases; #define TIMER_INITIALIZER(_function, _expires, _data) { \ + .entry = { .prev = TIMER_ENTRY_STATIC }, \ .function = (_function), \ .expires = (_expires), \ .data = (_data), \ @@ -38,6 +40,17 @@ extern struct tvec_base boot_tvec_bases; void init_timer(struct timer_list *timer); void init_timer_deferrable(struct timer_list *timer); +#ifdef CONFIG_DEBUG_OBJECTS_TIMERS +extern void init_timer_on_stack(struct timer_list *timer); +extern void destroy_timer_on_stack(struct timer_list *timer); +#else +static inline void destroy_timer_on_stack(struct timer_list *timer) { } +static inline void init_timer_on_stack(struct timer_list *timer) +{ + init_timer(timer); +} +#endif + static inline void setup_timer(struct timer_list * timer, void (*function)(unsigned long), unsigned long data) @@ -47,6 +60,15 @@ static inline void setup_timer(struct timer_list * timer, init_timer(timer); } +static inline void setup_timer_on_stack(struct timer_list *timer, + void (*function)(unsigned long), + unsigned long data) +{ + timer->function = function; + timer->data = data; + init_timer_on_stack(timer); +} + /** * timer_pending - is a timer pending? * @timer: the timer in question @@ -164,5 +186,4 @@ unsigned long __round_jiffies_relative(unsigned long j, int cpu); unsigned long round_jiffies(unsigned long j); unsigned long round_jiffies_relative(unsigned long j); - #endif diff --git a/include/linux/tty.h b/include/linux/tty.h index 265831ccaa8..7f7121f9c96 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -177,27 +177,33 @@ struct signal_struct; * size each time the window is created or resized anyway. * - TYT, 9/14/92 */ + +struct tty_operations; + struct tty_struct { int magic; struct tty_driver *driver; + const struct tty_operations *ops; int index; struct tty_ldisc ldisc; struct mutex termios_mutex; + spinlock_t ctrl_lock; + /* Termios values are protected by the termios mutex */ struct ktermios *termios, *termios_locked; char name[64]; - struct pid *pgrp; + struct pid *pgrp; /* Protected by ctrl lock */ struct pid *session; unsigned long flags; int count; - struct winsize winsize; + struct winsize winsize; /* termios mutex */ unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; unsigned char low_latency:1, warned:1; - unsigned char ctrl_status; + unsigned char ctrl_status; /* ctrl_lock */ unsigned int receive_room; /* Bytes free for queue */ struct tty_struct *link; struct fasync_struct *fasync; - struct tty_bufhead buf; + struct tty_bufhead buf; /* Locked internally */ int alt_speed; /* For magic substitution of 38400 bps */ wait_queue_head_t write_wait; wait_queue_head_t read_wait; @@ -211,6 +217,7 @@ struct tty_struct { /* * The following is data for the N_TTY line discipline. For * historical reasons, this is included in the tty structure. + * Mostly locked by the BKL. */ unsigned int column; unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1; @@ -292,8 +299,15 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index); extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, int buflen); extern void tty_write_message(struct tty_struct *tty, char *msg); +extern int tty_put_char(struct tty_struct *tty, unsigned char c); +extern int tty_chars_in_buffer(struct tty_struct *tty); +extern int tty_write_room(struct tty_struct *tty); +extern void tty_driver_flush_buffer(struct tty_struct *tty); +extern void tty_throttle(struct tty_struct *tty); +extern void tty_unthrottle(struct tty_struct *tty); extern int is_current_pgrp_orphaned(void); +extern struct pid *tty_get_pgrp(struct tty_struct *tty); extern int is_ignored(int sig); extern int tty_signal(int sig, struct tty_struct *tty); extern void tty_hangup(struct tty_struct * tty); @@ -323,8 +337,7 @@ extern void tty_ldisc_put(int); extern void tty_wakeup(struct tty_struct *tty); extern void tty_ldisc_flush(struct tty_struct *tty); -extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg); +extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg); extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 21f69aca450..59f1c0bd8f9 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -12,11 +12,15 @@ * This routine is called when a particular tty device is opened. * This routine is mandatory; if this routine is not filled in, * the attempted open will fail with ENODEV. + * + * Required method. * * void (*close)(struct tty_struct * tty, struct file * filp); * * This routine is called when a particular tty device is closed. * + * Required method. + * * int (*write)(struct tty_struct * tty, * const unsigned char *buf, int count); * @@ -26,7 +30,9 @@ * number of characters actually accepted for writing. This * routine is mandatory. * - * void (*put_char)(struct tty_struct *tty, unsigned char ch); + * Optional: Required for writable devices. + * + * int (*put_char)(struct tty_struct *tty, unsigned char ch); * * This routine is called by the kernel to write a single * character to the tty device. If the kernel uses this routine, @@ -34,10 +40,18 @@ * done stuffing characters into the driver. If there is no room * in the queue, the character is ignored. * + * Optional: Kernel will use the write method if not provided. + * + * Note: Do not call this function directly, call tty_put_char + * * void (*flush_chars)(struct tty_struct *tty); * * This routine is called by the kernel after it has written a * series of characters to the tty device using put_char(). + * + * Optional: + * + * Note: Do not call this function directly, call tty_driver_flush_chars * * int (*write_room)(struct tty_struct *tty); * @@ -45,6 +59,10 @@ * will accept for queuing to be written. This number is subject * to change as output buffers get emptied, or if the output flow * control is acted. + * + * Required if write method is provided else not needed. + * + * Note: Do not call this function directly, call tty_write_room * * int (*ioctl)(struct tty_struct *tty, struct file * file, * unsigned int cmd, unsigned long arg); @@ -53,28 +71,37 @@ * device-specific ioctl's. If the ioctl number passed in cmd * is not recognized by the driver, it should return ENOIOCTLCMD. * + * Optional + * * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, * unsigned int cmd, unsigned long arg); * * implement ioctl processing for 32 bit process on 64 bit system + * + * Optional * * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); * * This routine allows the tty driver to be notified when - * device's termios settings have changed. Note that a - * well-designed tty driver should be prepared to accept the case - * where old == NULL, and try to do something rational. + * device's termios settings have changed. + * + * Optional: Called under the termios lock + * * * void (*set_ldisc)(struct tty_struct *tty); * * This routine allows the tty driver to be notified when the * device's termios settings have changed. + * + * Optional: Called under BKL (currently) * * void (*throttle)(struct tty_struct * tty); * * This routine notifies the tty driver that input buffers for * the line discipline are close to full, and it should somehow * signal that no more characters should be sent to the tty. + * + * Optional: Always invoke via tty_throttle(); * * void (*unthrottle)(struct tty_struct * tty); * @@ -82,21 +109,33 @@ * that characters can now be sent to the tty without fear of * overrunning the input buffers of the line disciplines. * + * Optional: Always invoke via tty_unthrottle(); + * * void (*stop)(struct tty_struct *tty); * * This routine notifies the tty driver that it should stop * outputting characters to the tty device. + * + * Optional: + * + * Note: Call stop_tty not this method. * * void (*start)(struct tty_struct *tty); * * This routine notifies the tty driver that it resume sending * characters to the tty device. + * + * Optional: + * + * Note: Call start_tty not this method. * * void (*hangup)(struct tty_struct *tty); * * This routine notifies the tty driver that it should hangup the * tty device. * + * Required: + * * void (*break_ctl)(struct tty_stuct *tty, int state); * * This optional routine requests the tty driver to turn on or @@ -106,18 +145,26 @@ * * If this routine is implemented, the high-level tty driver will * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, - * TIOCCBRK. Otherwise, these ioctls will be passed down to the - * driver to handle. + * TIOCCBRK. + * + * Optional: Required for TCSBRK/BRKP/etc handling. * * void (*wait_until_sent)(struct tty_struct *tty, int timeout); * * This routine waits until the device has written out all of the * characters in its transmitter FIFO. * + * Optional: If not provided the device is assumed to have no FIFO + * + * Note: Usually correct to call tty_wait_until_sent + * * void (*send_xchar)(struct tty_struct *tty, char ch); * * This routine is used to send a high-priority XON/XOFF * character to the device. + * + * Optional: If not provided then the write method is called under + * the atomic write lock to keep it serialized with the ldisc. */ #include <linux/fs.h> @@ -132,7 +179,7 @@ struct tty_operations { void (*close)(struct tty_struct * tty, struct file * filp); int (*write)(struct tty_struct * tty, const unsigned char *buf, int count); - void (*put_char)(struct tty_struct *tty, unsigned char ch); + int (*put_char)(struct tty_struct *tty, unsigned char ch); void (*flush_chars)(struct tty_struct *tty); int (*write_room)(struct tty_struct *tty); int (*chars_in_buffer)(struct tty_struct *tty); @@ -153,8 +200,6 @@ struct tty_operations { void (*send_xchar)(struct tty_struct *tty, char ch); int (*read_proc)(char *page, char **start, off_t off, int count, int *eof, void *data); - int (*write_proc)(struct file *file, const char __user *buffer, - unsigned long count, void *data); int (*tiocmget)(struct tty_struct *tty, struct file *file); int (*tiocmset)(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); @@ -190,48 +235,13 @@ struct tty_driver { struct tty_struct **ttys; struct ktermios **termios; struct ktermios **termios_locked; - void *driver_state; /* only used for the PTY driver */ - + void *driver_state; + /* - * Interface routines from the upper tty layer to the tty - * driver. Will be replaced with struct tty_operations. + * Driver methods */ - int (*open)(struct tty_struct * tty, struct file * filp); - void (*close)(struct tty_struct * tty, struct file * filp); - int (*write)(struct tty_struct * tty, - const unsigned char *buf, int count); - void (*put_char)(struct tty_struct *tty, unsigned char ch); - void (*flush_chars)(struct tty_struct *tty); - int (*write_room)(struct tty_struct *tty); - int (*chars_in_buffer)(struct tty_struct *tty); - int (*ioctl)(struct tty_struct *tty, struct file * file, - unsigned int cmd, unsigned long arg); - long (*compat_ioctl)(struct tty_struct *tty, struct file * file, - unsigned int cmd, unsigned long arg); - void (*set_termios)(struct tty_struct *tty, struct ktermios * old); - void (*throttle)(struct tty_struct * tty); - void (*unthrottle)(struct tty_struct * tty); - void (*stop)(struct tty_struct *tty); - void (*start)(struct tty_struct *tty); - void (*hangup)(struct tty_struct *tty); - void (*break_ctl)(struct tty_struct *tty, int state); - void (*flush_buffer)(struct tty_struct *tty); - void (*set_ldisc)(struct tty_struct *tty); - void (*wait_until_sent)(struct tty_struct *tty, int timeout); - void (*send_xchar)(struct tty_struct *tty, char ch); - int (*read_proc)(char *page, char **start, off_t off, - int count, int *eof, void *data); - int (*write_proc)(struct file *file, const char __user *buffer, - unsigned long count, void *data); - int (*tiocmget)(struct tty_struct *tty, struct file *file); - int (*tiocmset)(struct tty_struct *tty, struct file *file, - unsigned int set, unsigned int clear); -#ifdef CONFIG_CONSOLE_POLL - int (*poll_init)(struct tty_driver *driver, int line, char *options); - int (*poll_get_char)(struct tty_driver *driver, int line); - void (*poll_put_char)(struct tty_driver *driver, int line, char ch); -#endif + const struct tty_operations *ops; struct list_head tty_drivers; }; diff --git a/include/linux/writeback.h b/include/linux/writeback.h index b7b3362f771..f462439cc28 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -114,6 +114,9 @@ struct file; int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); +void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty, + struct backing_dev_info *bdi); + void page_writeback_init(void); void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, unsigned long nr_pages_dirtied); diff --git a/include/net/compat.h b/include/net/compat.h index 05fa5d0254a..164cb682e22 100644 --- a/include/net/compat.h +++ b/include/net/compat.h @@ -42,5 +42,8 @@ extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsi extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int, int (*)(struct sock *, int, int, char __user *, int)); +extern int compat_mc_getsockopt(struct sock *, int, int, char __user *, + int __user *, int (*)(struct sock *, int, int, char __user *, + int __user *)); #endif /* NET_COMPAT_H */ diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 56f3c94ae62..9a51ebad3f1 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -405,7 +405,8 @@ struct sk_buff; struct ip_vs_protocol { struct ip_vs_protocol *next; char *name; - __u16 protocol; + u16 protocol; + u16 num_states; int dont_defrag; atomic_t appcnt; /* counter of proto app incs */ int *timeout_table; /* protocol timeout table */ diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 1bb7087833d..a6874ba22d5 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -107,16 +107,6 @@ struct nf_conntrack_tuple_mask } src; }; -/* This is optimized opposed to a memset of the whole structure. Everything we - * really care about is the source/destination unions */ -#define NF_CT_TUPLE_U_BLANK(tuple) \ - do { \ - (tuple)->src.u.all = 0; \ - (tuple)->dst.u.all = 0; \ - memset(&(tuple)->src.u3, 0, sizeof((tuple)->src.u3)); \ - memset(&(tuple)->dst.u3, 0, sizeof((tuple)->dst.u3)); \ - } while (0) - #ifdef __KERNEL__ static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) diff --git a/include/net/route.h b/include/net/route.h index c6338802e8f..fc836ff824c 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -116,7 +116,7 @@ extern int __ip_route_output_key(struct net *, struct rtable **, const struct f extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); -extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu); +extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); extern void ip_rt_send_redirect(struct sk_buff *skb); extern unsigned inet_addr_type(struct net *net, __be32 addr); |