diff options
Diffstat (limited to 'include')
129 files changed, 2224 insertions, 1729 deletions
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h index bae7f05716d..8cc97bfd378 100644 --- a/include/asm-alpha/page.h +++ b/include/asm-alpha/page.h @@ -3,11 +3,12 @@ #ifdef __KERNEL__ +#include <linux/const.h> #include <asm/pal.h> /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 13 -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) #ifndef __ASSEMBLY__ diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h index 9933b8b3612..32c7a5cddd5 100644 --- a/include/asm-alpha/ptrace.h +++ b/include/asm-alpha/ptrace.h @@ -68,8 +68,6 @@ struct switch_stack { #ifdef __KERNEL__ -#define __ARCH_SYS_PTRACE 1 - #define user_mode(regs) (((regs)->ps & 8) != 0) #define instruction_pointer(regs) ((regs)->pc) #define profile_pc(regs) instruction_pointer(regs) diff --git a/include/asm-arm/arch-imx/imxfb.h b/include/asm-arm/arch-imx/imxfb.h index 7dbc7bbba65..3ed9ec8b9f0 100644 --- a/include/asm-arm/arch-imx/imxfb.h +++ b/include/asm-arm/arch-imx/imxfb.h @@ -7,6 +7,7 @@ struct imxfb_mach_info { u_short xres; u_short yres; + u_int nonstd; u_char bpp; u_char hsync_len; u_char left_margin; diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h index 67f53e07db8..bb68b598c43 100644 --- a/include/asm-arm/arch-pxa/pxa-regs.h +++ b/include/asm-arm/arch-pxa/pxa-regs.h @@ -1823,6 +1823,7 @@ #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 */ @@ -1836,6 +1837,16 @@ #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 */ diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h index 81c3928d608..ea2336aa70e 100644 --- a/include/asm-arm/arch-pxa/pxafb.h +++ b/include/asm-arm/arch-pxa/pxafb.h @@ -70,7 +70,12 @@ struct pxafb_mach_info { * LCCR3_HSP, LCCR3_VSP, LCCR0_Pcd(x), LCCR3_Bpp */ u_int lccr3; - + /* The following should be defined in LCCR4 + * LCCR4_PAL_FOR_0 or LCCR4_PAL_FOR_1 or LCCR4_PAL_FOR_2 + * + * All other bits in LCCR4 should be left alone. + */ + u_int lccr4; void (*pxafb_backlight_power)(int); void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *); diff --git a/include/asm-arm/arch-s3c2410/fb.h b/include/asm-arm/arch-s3c2410/fb.h index 93a58e7862b..5d0262601a7 100644 --- a/include/asm-arm/arch-s3c2410/fb.h +++ b/include/asm-arm/arch-s3c2410/fb.h @@ -14,12 +14,6 @@ #include <asm/arch/regs-lcd.h> -struct s3c2410fb_val { - unsigned int defval; - unsigned int min; - unsigned int max; -}; - struct s3c2410fb_hw { unsigned long lcdcon1; unsigned long lcdcon2; @@ -28,23 +22,37 @@ struct s3c2410fb_hw { unsigned long lcdcon5; }; -struct s3c2410fb_mach_info { - unsigned char fixed_syncs; /* do not update sync/border */ - - /* LCD types */ - int type; +/* LCD description */ +struct s3c2410fb_display { + /* LCD type */ + unsigned type; /* Screen size */ - int width; - int height; + unsigned short width; + unsigned short height; /* Screen info */ - struct s3c2410fb_val xres; - struct s3c2410fb_val yres; - struct s3c2410fb_val bpp; + unsigned short xres; + unsigned short yres; + unsigned short bpp; + + unsigned pixclock; /* pixclock in picoseconds */ + unsigned short left_margin; /* value in pixels (TFT) or HCLKs (STN) */ + unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */ + unsigned short hsync_len; /* value in pixels (TFT) or HCLKs (STN) */ + unsigned short upper_margin; /* value in lines (TFT) or 0 (STN) */ + unsigned short lower_margin; /* value in lines (TFT) or 0 (STN) */ + unsigned short vsync_len; /* value in lines (TFT) or 0 (STN) */ /* lcd configuration registers */ - struct s3c2410fb_hw regs; + unsigned long lcdcon5; +}; + +struct s3c2410fb_mach_info { + + struct s3c2410fb_display *displays; /* attached diplays info */ + unsigned num_displays; /* number of defined displays */ + unsigned default_display; /* GPIOs */ diff --git a/include/asm-avr32/kdebug.h b/include/asm-avr32/kdebug.h index 7f54e2b15d1..fd7e99046b2 100644 --- a/include/asm-avr32/kdebug.h +++ b/include/asm-avr32/kdebug.h @@ -1,26 +1,10 @@ #ifndef __ASM_AVR32_KDEBUG_H #define __ASM_AVR32_KDEBUG_H -#include <linux/notifier.h> - /* Grossly misnamed. */ enum die_val { DIE_BREAKPOINT, DIE_SSTEP, }; -/* - * These are only here because kprobes.c wants them to implement a - * blatant layering violation. Will hopefully go away soon once all - * architectures are updated. - */ -static inline int register_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} -static inline int unregister_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} - #endif /* __ASM_AVR32_KDEBUG_H */ diff --git a/include/asm-avr32/kprobes.h b/include/asm-avr32/kprobes.h index 190a6377c80..996cb656474 100644 --- a/include/asm-avr32/kprobes.h +++ b/include/asm-avr32/kprobes.h @@ -17,7 +17,7 @@ typedef u16 kprobe_opcode_t; #define BREAKPOINT_INSTRUCTION 0xd673 /* breakpoint */ #define MAX_INSN_SIZE 2 -#define ARCH_INACTIVE_KPROBE_COUNT 1 +#define kretprobe_blacklist_size 0 #define arch_remove_kprobe(p) do { } while (0) diff --git a/include/asm-blackfin/mach-bf548/bf54x-lq043.h b/include/asm-blackfin/mach-bf548/bf54x-lq043.h new file mode 100644 index 00000000000..9c7ca62a45e --- /dev/null +++ b/include/asm-blackfin/mach-bf548/bf54x-lq043.h @@ -0,0 +1,30 @@ +#ifndef BF54X_LQ043_H +#define BF54X_LQ043_H + +struct bfin_bf54xfb_val { + unsigned int defval; + unsigned int min; + unsigned int max; +}; + +struct bfin_bf54xfb_mach_info { + unsigned char fixed_syncs; /* do not update sync/border */ + + /* LCD types */ + int type; + + /* Screen size */ + int width; + int height; + + /* Screen info */ + struct bfin_bf54xfb_val xres; + struct bfin_bf54xfb_val yres; + struct bfin_bf54xfb_val bpp; + + /* GPIOs */ + unsigned short disp; + +}; + +#endif /* BF54X_LQ043_H */ diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h index cc5433e78b5..348b8f1df17 100644 --- a/include/asm-frv/thread_info.h +++ b/include/asm-frv/thread_info.h @@ -88,9 +88,8 @@ register struct thread_info *__current_thread_info asm("gr15"); ({ \ struct thread_info *ret; \ \ - ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \ - if (ret) \ - memset(ret, 0, THREAD_SIZE); \ + ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \ + \ ret; \ }) #else diff --git a/include/asm-frv/tlbflush.h b/include/asm-frv/tlbflush.h index da3a3179a85..8370f97e41e 100644 --- a/include/asm-frv/tlbflush.h +++ b/include/asm-frv/tlbflush.h @@ -57,8 +57,7 @@ do { \ #define __flush_tlb_global() flush_tlb_all() #define flush_tlb() flush_tlb_all() #define flush_tlb_kernel_range(start, end) flush_tlb_all() -#define flush_tlb_pgtables(mm,start,end) \ - asm volatile("movgs %0,scr0 ! movgs %0,scr1" :: "r"(ULONG_MAX) : "memory"); +#define flush_tlb_pgtables(mm,start,end) do { } while(0) #else diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index 30d8d33491d..52226e14bd7 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h @@ -46,6 +46,12 @@ __pgdat->node_start_pfn; \ }) +#elif defined(CONFIG_SPARSEMEM_VMEMMAP) + +/* memmap is virtually contigious. */ +#define __pfn_to_page(pfn) (vmemmap + (pfn)) +#define __page_to_pfn(page) ((page) - vmemmap) + #elif defined(CONFIG_SPARSEMEM) /* * Note: section's mem_map is encorded to reflect its start_pfn. diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 5f0d797d33f..44ef329531c 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -125,10 +125,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres #define pgd_offset_gate(mm, addr) pgd_offset(mm, addr) #endif -#ifndef __HAVE_ARCH_LAZY_MMU_PROT_UPDATE -#define lazy_mmu_prot_update(pte) do { } while (0) -#endif - #ifndef __HAVE_ARCH_MOVE_PTE #define move_pte(pte, prot, old_addr, new_addr) (pte) #endif diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h index 3ca6d5c14b2..f1735a22d0e 100644 --- a/include/asm-ia64/dma-mapping.h +++ b/include/asm-ia64/dma-mapping.h @@ -6,7 +6,7 @@ * David Mosberger-Tang <davidm@hpl.hp.com> */ #include <asm/machvec.h> -#include <asm/scatterlist.h> +#include <linux/scatterlist.h> #define dma_alloc_coherent platform_dma_alloc_coherent /* coherent mem. is cheap */ diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h index 320cd8e754e..35e49407d06 100644 --- a/include/asm-ia64/kdebug.h +++ b/include/asm-ia64/kdebug.h @@ -26,21 +26,6 @@ * 2005-Oct Keith Owens <kaos@sgi.com>. Expand notify_die to cover more * events. */ -#include <linux/notifier.h> - -/* - * These are only here because kprobes.c wants them to implement a - * blatant layering violation. Will hopefully go away soon once all - * architectures are updated. - */ -static inline int register_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} -static inline int unregister_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} enum die_val { DIE_BREAK = 1, diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h index 067d9dea68f..a93ce9ef07f 100644 --- a/include/asm-ia64/kprobes.h +++ b/include/asm-ia64/kprobes.h @@ -83,7 +83,7 @@ struct kprobe_ctlblk { }; #define ARCH_SUPPORTS_KRETPROBES -#define ARCH_INACTIVE_KPROBE_COUNT 1 +#define kretprobe_blacklist_size 0 #define SLOT0_OPCODE_SHIFT (37) #define SLOT1_p1_OPCODE_SHIFT (37 - (64-46)) diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index de6d01e24dd..0971ec90807 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h @@ -223,12 +223,6 @@ ia64_phys_addr_valid (unsigned long addr) * page table. */ -/* - * On some architectures, special things need to be done when setting - * the PTE in a page table. Nothing special needs to be on IA-64. - */ -#define set_pte(ptep, pteval) (*(ptep) = (pteval)) -#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) #define VMALLOC_START (RGN_BASE(RGN_GATE) + 0x200000000UL) #ifdef CONFIG_VIRTUAL_MEM_MAP @@ -236,8 +230,14 @@ ia64_phys_addr_valid (unsigned long addr) # define VMALLOC_END vmalloc_end extern unsigned long vmalloc_end; #else +#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_SPARSEMEM_VMEMMAP) +/* SPARSEMEM_VMEMMAP uses half of vmalloc... */ +# define VMALLOC_END (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 10))) +# define vmemmap ((struct page *)VMALLOC_END) +#else # define VMALLOC_END (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9))) #endif +#endif /* fs/proc/kcore.c */ #define kc_vaddr_to_offset(v) ((v) - RGN_BASE(RGN_GATE)) @@ -315,6 +315,36 @@ ia64_phys_addr_valid (unsigned long addr) #define pte_mkhuge(pte) (__pte(pte_val(pte))) /* + * Because ia64's Icache and Dcache is not coherent (on a cpu), we need to + * sync icache and dcache when we insert *new* executable page. + * __ia64_sync_icache_dcache() check Pg_arch_1 bit and flush icache + * if necessary. + * + * set_pte() is also called by the kernel, but we can expect that the kernel + * flushes icache explicitly if necessary. + */ +#define pte_present_exec_user(pte)\ + ((pte_val(pte) & (_PAGE_P | _PAGE_PL_MASK | _PAGE_AR_RX)) == \ + (_PAGE_P | _PAGE_PL_3 | _PAGE_AR_RX)) + +extern void __ia64_sync_icache_dcache(pte_t pteval); +static inline void set_pte(pte_t *ptep, pte_t pteval) +{ + /* page is present && page is user && page is executable + * && (page swapin or new page or page migraton + * || copy_on_write with page copying.) + */ + if (pte_present_exec_user(pteval) && + (!pte_present(*ptep) || + pte_pfn(*ptep) != pte_pfn(pteval))) + /* load_module() calles flush_icache_range() explicitly*/ + __ia64_sync_icache_dcache(pteval); + *ptep = pteval; +} + +#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) + +/* * Make page protection values cacheable, uncacheable, or write- * combining. Note that "protection" is really a misnomer here as the * protection value contains the memory attribute bits, dirty bits, and @@ -483,12 +513,6 @@ extern struct page *zero_page_memmap_ptr; #define HUGETLB_PGDIR_MASK (~(HUGETLB_PGDIR_SIZE-1)) #endif -/* - * IA-64 doesn't have any external MMU info: the page tables contain all the necessary - * information. However, we use this routine to take care of any (delayed) i-cache - * flushing that may be necessary. - */ -extern void lazy_mmu_prot_update (pte_t pte); #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS /* @@ -578,7 +602,7 @@ extern void lazy_mmu_prot_update (pte_t pte); #define __HAVE_ARCH_PTEP_SET_WRPROTECT #define __HAVE_ARCH_PTE_SAME #define __HAVE_ARCH_PGD_OFFSET_GATE -#define __HAVE_ARCH_LAZY_MMU_PROT_UPDATE + #ifndef CONFIG_PGTABLE_4 #include <asm-generic/pgtable-nopud.h> diff --git a/include/asm-ia64/scatterlist.h b/include/asm-ia64/scatterlist.h index a452ea24205..7d5234d5031 100644 --- a/include/asm-ia64/scatterlist.h +++ b/include/asm-ia64/scatterlist.h @@ -30,4 +30,6 @@ struct scatterlist { #define sg_dma_len(sg) ((sg)->dma_length) #define sg_dma_address(sg) ((sg)->dma_address) +#define ARCH_HAS_SG_CHAIN + #endif /* _ASM_IA64_SCATTERLIST_H */ diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h index 6314b29e8c4..1703c9d885b 100644 --- a/include/asm-ia64/smp.h +++ b/include/asm-ia64/smp.h @@ -58,7 +58,7 @@ extern char no_int_routing __devinitdata; extern cpumask_t cpu_online_map; extern cpumask_t cpu_core_map[NR_CPUS]; -extern cpumask_t cpu_sibling_map[NR_CPUS]; +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); extern int smp_num_siblings; extern int smp_num_cpucores; extern void __iomem *ipi_base_addr; diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h index 233f1caae04..2d67b72b18d 100644 --- a/include/asm-ia64/topology.h +++ b/include/asm-ia64/topology.h @@ -112,7 +112,7 @@ void build_cpu_to_node_map(void); #define topology_physical_package_id(cpu) (cpu_data(cpu)->socket_id) #define topology_core_id(cpu) (cpu_data(cpu)->core_id) #define topology_core_siblings(cpu) (cpu_core_map[cpu]) -#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) +#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) #define smt_capable() (smp_num_siblings > 1) #endif diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h index 632b4ce4269..a0755b98202 100644 --- a/include/asm-m32r/ptrace.h +++ b/include/asm-m32r/ptrace.h @@ -120,7 +120,10 @@ struct pt_regs { #include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */ -#define __ARCH_SYS_PTRACE 1 +struct task_struct; +extern void init_debug_traps(struct task_struct *); +#define arch_ptrace_attach(child) \ + init_debug_traps(child) #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) #define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h index b7ccc3e6860..c039820dba7 100644 --- a/include/asm-m32r/thread_info.h +++ b/include/asm-m32r/thread_info.h @@ -100,9 +100,8 @@ static inline struct thread_info *current_thread_info(void) ({ \ struct thread_info *ret; \ \ - ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \ - if (ret) \ - memset(ret, 0, THREAD_SIZE); \ + ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \ + \ ret; \ }) #else diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h index 5da43a5d12a..1bd1142685e 100644 --- a/include/asm-m68knommu/system.h +++ b/include/asm-m68knommu/system.h @@ -253,8 +253,7 @@ cmpxchg(volatile int *p, int old, int new) "); \ }) #elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ - defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \ - defined(CONFIG_CLEOPATRA) + defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA) #define HARD_RESET_NOW() ({ \ asm(" \ movew #0x2700, %sr; \ diff --git a/include/asm-mips/xxs1500.h b/include/asm-mips/xxs1500.h deleted file mode 100644 index 4d84a90b0f2..00000000000 --- a/include/asm-mips/xxs1500.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * MyCable XXS1500 Referrence Board - * - * Copyright 2003 MontaVista Software Inc. - * Author: Pete Popov, MontaVista Software, Inc. - * ppopov@mvista.com or source@mvista.com - * - * ######################################################################## - * - * This program is free software; you can distribute it and/or modify it - * under the terms of the GNU General Public License (Version 2) as - * published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * ######################################################################## - * - * - */ -#ifndef __ASM_XXS1500_H -#define __ASM_XXS1500_H - -/* PCMCIA XXS1500 specific defines */ -#define PCMCIA_MAX_SOCK 0 -#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) -#define PCMCIA_IRQ AU1000_GPIO_4 - -#endif /* __ASM_XXS1500_ */ diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h index d05891608f7..2af321f36ab 100644 --- a/include/asm-powerpc/dma-mapping.h +++ b/include/asm-powerpc/dma-mapping.h @@ -6,149 +6,6 @@ */ #ifndef _ASM_DMA_MAPPING_H #define _ASM_DMA_MAPPING_H -#ifdef __KERNEL__ - -#include <linux/types.h> -#include <linux/cache.h> -/* need struct page definitions */ -#include <linux/mm.h> -#include <asm/scatterlist.h> -#include <asm/io.h> - -#define DMA_ERROR_CODE (~(dma_addr_t)0x0) - -#ifdef CONFIG_NOT_COHERENT_CACHE -/* - * DMA-consistent mapping functions for PowerPCs that don't support - * cache snooping. These allocate/free a region of uncached mapped - * memory space for use with DMA devices. Alternatively, you could - * allocate the space "normally" and use the cache management functions - * to ensure it is consistent. - */ -extern void *__dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp); -extern void __dma_free_coherent(size_t size, void *vaddr); -extern void __dma_sync(void *vaddr, size_t size, int direction); -extern void __dma_sync_page(struct page *page, unsigned long offset, - size_t size, int direction); - -#else /* ! CONFIG_NOT_COHERENT_CACHE */ -/* - * Cache coherent cores. - */ - -#define __dma_alloc_coherent(gfp, size, handle) NULL -#define __dma_free_coherent(size, addr) ((void)0) -#define __dma_sync(addr, size, rw) ((void)0) -#define __dma_sync_page(pg, off, sz, rw) ((void)0) - -#endif /* ! CONFIG_NOT_COHERENT_CACHE */ - -#ifdef CONFIG_PPC64 -/* - * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO - */ -struct dma_mapping_ops { - void * (*alloc_coherent)(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag); - void (*free_coherent)(struct device *dev, size_t size, - void *vaddr, dma_addr_t dma_handle); - dma_addr_t (*map_single)(struct device *dev, void *ptr, - size_t size, enum dma_data_direction direction); - void (*unmap_single)(struct device *dev, dma_addr_t dma_addr, - size_t size, enum dma_data_direction direction); - int (*map_sg)(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction direction); - void (*unmap_sg)(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction direction); - int (*dma_supported)(struct device *dev, u64 mask); - int (*set_dma_mask)(struct device *dev, u64 dma_mask); -}; - -static inline struct dma_mapping_ops *get_dma_ops(struct device *dev) -{ - /* We don't handle the NULL dev case for ISA for now. We could - * do it via an out of line call but it is not needed for now. The - * only ISA DMA device we support is the floppy and we have a hack - * in the floppy driver directly to get a device for us. - */ - if (unlikely(dev == NULL || dev->archdata.dma_ops == NULL)) - return NULL; - return dev->archdata.dma_ops; -} - -static inline int dma_supported(struct device *dev, u64 mask) -{ - struct dma_mapping_ops *dma_ops = get_dma_ops(dev); - - if (unlikely(dma_ops == NULL)) - return 0; - if (dma_ops->dma_supported == NULL) - return 1; - return dma_ops->dma_supported(dev, mask); -} - -static inline int dma_set_mask(struct device *dev, u64 dma_mask) -{ - struct dma_mapping_ops *dma_ops = get_dma_ops(dev); - - if (unlikely(dma_ops == NULL)) - return -EIO; - if (dma_ops->set_dma_mask != NULL) - return dma_ops->set_dma_mask(dev, dma_mask); - if (!dev->dma_mask || !dma_supported(dev, dma_mask)) - return -EIO; - *dev->dma_mask = dma_mask; - return 0; -} - -static inline void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) -{ - struct dma_mapping_ops *dma_ops = get_dma_ops(dev); - - BUG_ON(!dma_ops); - return dma_ops->alloc_coherent(dev, size, dma_handle, flag); -} - -static inline void dma_free_coherent(struct device *dev, size_t size, - void *cpu_addr, dma_addr_t dma_handle) -{ - struct dma_mapping_ops *dma_ops = get_dma_ops(dev); - - BUG_ON(!dma_ops); - dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); -} - -static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, - size_t size, - enum dma_data_direction direction) -{ - struct dma_mapping_ops *dma_ops = get_dma_ops(dev); - - BUG_ON(!dma_ops); - return dma_ops->map_single(dev, cpu_addr, size, direction); -} - -static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, - size_t size, - enum dma_data_direction direction) -{ - struct dma_mapping_ops *dma_ops = get_dma_ops(dev); - - BUG_ON(!dma_ops); - dma_ops->unmap_single(dev, dma_addr, size, direction); -} - -static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, - enum dma_data_direction direction) -{ - struct dma_mapping_ops *dma_ops = get_dma_ops(dev); - - BUG_ON(!dma_ops); - return dma_ops->map_single(dev, page_address(page) + offset, size, - direction); -} static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, @@ -276,14 +133,15 @@ static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, } static inline int -dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, +dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents, enum dma_data_direction direction) { + struct scatterlist *sg; int i; BUG_ON(direction == DMA_NONE); - for (i = 0; i < nents; i++, sg++) { + for_each_sg(sgl, sg, nents, i) { BUG_ON(!sg->page); __dma_sync_page(sg->page, sg->offset, sg->length, direction); sg->dma_address = page_to_bus(sg->page) + sg->offset; @@ -318,26 +176,28 @@ static inline void dma_sync_single_for_device(struct device *dev, } static inline void dma_sync_sg_for_cpu(struct device *dev, - struct scatterlist *sg, int nents, + struct scatterlist *sgl, int nents, enum dma_data_direction direction) { + struct scatterlist *sg; int i; BUG_ON(direction == DMA_NONE); - for (i = 0; i < nents; i++, sg++) + for_each_sg(sgl, sg, nents, i) __dma_sync_page(sg->page, sg->offset, sg->length, direction); } static inline void dma_sync_sg_for_device(struct device *dev, - struct scatterlist *sg, int nents, + struct scatterlist *sgl, int nents, enum dma_data_direction direction) { + struct scatterlist *sg; int i; BUG_ON(direction == DMA_NONE); - for (i = 0; i < nents; i++, sg++) + for_each_sg(sgl, sg, nents, i) __dma_sync_page(sg->page, sg->offset, sg->length, direction); } diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h index 295f0162c60..ae6d206728a 100644 --- a/include/asm-powerpc/kdebug.h +++ b/include/asm-powerpc/kdebug.h @@ -2,25 +2,6 @@ #define _ASM_POWERPC_KDEBUG_H #ifdef __KERNEL__ -/* nearly identical to x86_64/i386 code */ - -#include <linux/notifier.h> - -/* - * These are only here because kprobes.c wants them to implement a - * blatant layering violation. Will hopefully go away soon once all - * architectures are updated. - */ -static inline int register_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} -static inline int unregister_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} -extern struct atomic_notifier_head powerpc_die_chain; - /* Grossly misnamed. */ enum die_val { DIE_OOPS = 1, diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h index 8b08b447d6f..afabad230db 100644 --- a/include/asm-powerpc/kprobes.h +++ b/include/asm-powerpc/kprobes.h @@ -81,8 +81,8 @@ typedef unsigned int kprobe_opcode_t; #endif #define ARCH_SUPPORTS_KRETPROBES -#define ARCH_INACTIVE_KPROBE_COUNT 1 #define flush_insn_slot(p) do { } while (0) +#define kretprobe_blacklist_size 0 void kretprobe_trampoline(void); extern void arch_remove_kprobe(struct kprobe *p); diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h index 300f9a199bf..dd4c26dc57d 100644 --- a/include/asm-powerpc/pgtable-ppc64.h +++ b/include/asm-powerpc/pgtable-ppc64.h @@ -68,6 +68,14 @@ #define USER_REGION_ID (0UL) /* + * Defines the address of the vmemap area, in the top 16th of the + * kernel region. + */ +#define VMEMMAP_BASE (ASM_CONST(CONFIG_KERNEL_START) + \ + (0xfUL << (REGION_SHIFT - 4))) +#define vmemmap ((struct page *)VMEMMAP_BASE) + +/* * Common bits in a linux-style PTE. These match the bits in the * (hardware-defined) PowerPC PTE as closely as possible. Additional * bits may be defined in pgtable-*.h diff --git a/include/asm-powerpc/ps3av.h b/include/asm-powerpc/ps3av.h index 7df4250802d..967930b82ed 100644 --- a/include/asm-powerpc/ps3av.h +++ b/include/asm-powerpc/ps3av.h @@ -283,7 +283,7 @@ #define PS3AV_CMD_VIDEO_CS_YUV422 0x0002 #define PS3AV_CMD_VIDEO_CS_YUV444 0x0003 -/* for automode */ +/* for broadcast automode */ #define PS3AV_RESBIT_720x480P 0x0003 /* 0x0001 | 0x0002 */ #define PS3AV_RESBIT_720x576P 0x0003 /* 0x0001 | 0x0002 */ #define PS3AV_RESBIT_1280x720P 0x0004 @@ -298,13 +298,22 @@ | PS3AV_RESBIT_1920x1080I \ | PS3AV_RESBIT_1920x1080P) +/* for VESA automode */ +#define PS3AV_RESBIT_VGA 0x0001 +#define PS3AV_RESBIT_WXGA 0x0002 +#define PS3AV_RESBIT_SXGA 0x0004 +#define PS3AV_RESBIT_WUXGA 0x0008 +#define PS3AV_RES_MASK_VESA (PS3AV_RESBIT_WXGA |\ + PS3AV_RESBIT_SXGA |\ + PS3AV_RESBIT_WUXGA) + #define PS3AV_MONITOR_TYPE_HDMI 1 /* HDMI */ #define PS3AV_MONITOR_TYPE_DVI 2 /* DVI */ -#define PS3AV_DEFAULT_HDMI_VID_REG_60 PS3AV_CMD_VIDEO_VID_480P -#define PS3AV_DEFAULT_AVMULTI_VID_REG_60 PS3AV_CMD_VIDEO_VID_480I -#define PS3AV_DEFAULT_HDMI_VID_REG_50 PS3AV_CMD_VIDEO_VID_576P -#define PS3AV_DEFAULT_AVMULTI_VID_REG_50 PS3AV_CMD_VIDEO_VID_576I -#define PS3AV_DEFAULT_DVI_VID PS3AV_CMD_VIDEO_VID_480P + +#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_60 2 /* 480p */ +#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_60 1 /* 480i */ +#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_50 7 /* 576p */ +#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_50 6 /* 576i */ #define PS3AV_REGION_60 0x01 #define PS3AV_REGION_50 0x02 @@ -697,20 +706,12 @@ extern int ps3av_cmd_audio_mute(int, u32 *, u32); extern int ps3av_cmd_audio_active(int, u32); extern int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *, u32); extern int ps3av_cmd_av_get_hw_conf(struct ps3av_pkt_av_get_hw_conf *); -#ifdef PS3AV_DEBUG -extern void ps3av_cmd_av_hw_conf_dump(const struct ps3av_pkt_av_get_hw_conf *); -extern void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *); -#else -static inline void ps3av_cmd_av_hw_conf_dump(const struct ps3av_pkt_av_get_hw_conf *hw_conf) {} -static inline void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *monitor_info) {} -#endif extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *, u32); -extern int ps3av_set_video_mode(u32, int); +extern int ps3av_set_video_mode(u32); extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32); -extern int ps3av_get_auto_mode(int); -extern int ps3av_set_mode(u32, int); +extern int ps3av_get_auto_mode(void); extern int ps3av_get_mode(void); extern int ps3av_get_scanmode(int); extern int ps3av_get_refresh_rate(int); diff --git a/include/asm-powerpc/scatterlist.h b/include/asm-powerpc/scatterlist.h index 8c992d1491d..b075f619c3b 100644 --- a/include/asm-powerpc/scatterlist.h +++ b/include/asm-powerpc/scatterlist.h @@ -41,5 +41,7 @@ struct scatterlist { #define ISA_DMA_THRESHOLD (~0UL) #endif +#define ARCH_HAS_SG_CHAIN + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_SCATTERLIST_H */ diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h index 19102bfc14c..505f35bacaa 100644 --- a/include/asm-powerpc/smp.h +++ b/include/asm-powerpc/smp.h @@ -26,6 +26,7 @@ #ifdef CONFIG_PPC64 #include <asm/paca.h> #endif +#include <asm/percpu.h> extern int boot_cpuid; @@ -58,7 +59,7 @@ extern int smp_hw_index[]; (smp_hw_index[(cpu)] = (phys)) #endif -extern cpumask_t cpu_sibling_map[NR_CPUS]; +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. * @@ -77,6 +78,7 @@ void smp_init_pSeries(void); void smp_init_cell(void); void smp_init_celleb(void); void smp_setup_cpu_maps(void); +void smp_setup_cpu_sibling_map(void); extern int __cpu_disable(void); extern void __cpu_die(unsigned int cpu); diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h index 0ad21a849b5..ca23b681ad0 100644 --- a/include/asm-powerpc/topology.h +++ b/include/asm-powerpc/topology.h @@ -108,7 +108,7 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev, #ifdef CONFIG_PPC64 #include <asm/smp.h> -#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) +#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) #endif #endif diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h index 04418af08f8..40db27cd6e6 100644 --- a/include/asm-s390/kdebug.h +++ b/include/asm-s390/kdebug.h @@ -4,24 +4,9 @@ /* * Feb 2006 Ported to s390 <grundym@us.ibm.com> */ -#include <linux/notifier.h> struct pt_regs; -/* - * These are only here because kprobes.c wants them to implement a - * blatant layering violation. Will hopefully go away soon once all - * architectures are updated. - */ -static inline int register_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} -static inline int unregister_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} - enum die_val { DIE_OOPS = 1, DIE_BPT, diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h index 340ba10446e..948db3d0d05 100644 --- a/include/asm-s390/kprobes.h +++ b/include/asm-s390/kprobes.h @@ -47,7 +47,7 @@ typedef u16 kprobe_opcode_t; : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) #define ARCH_SUPPORTS_KRETPROBES -#define ARCH_INACTIVE_KPROBE_COUNT 0 +#define kretprobe_blacklist_size 0 #define KPROBE_SWAP_INST 0x10 diff --git a/include/asm-sh/kdebug.h b/include/asm-sh/kdebug.h index 382cfc7deb7..49cd69051a8 100644 --- a/include/asm-sh/kdebug.h +++ b/include/asm-sh/kdebug.h @@ -1,8 +1,6 @@ #ifndef __ASM_SH_KDEBUG_H #define __ASM_SH_KDEBUG_H -#include <linux/notifier.h> - /* Grossly misnamed. */ enum die_val { DIE_TRAP, diff --git a/include/asm-sparc/scatterlist.h b/include/asm-sparc/scatterlist.h index a4fcf9ac964..4055af90ad7 100644 --- a/include/asm-sparc/scatterlist.h +++ b/include/asm-sparc/scatterlist.h @@ -19,4 +19,6 @@ struct scatterlist { #define ISA_DMA_THRESHOLD (~0UL) +#define ARCH_HAS_SG_CHAIN + #endif /* !(_SPARC_SCATTERLIST_H) */ diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h index 9974c7b0aeb..f905b773235 100644 --- a/include/asm-sparc64/kdebug.h +++ b/include/asm-sparc64/kdebug.h @@ -1,26 +1,8 @@ #ifndef _SPARC64_KDEBUG_H #define _SPARC64_KDEBUG_H -/* Nearly identical to x86_64/i386 code. */ - -#include <linux/notifier.h> - struct pt_regs; -/* - * These are only here because kprobes.c wants them to implement a - * blatant layering violation. Will hopefully go away soon once all - * architectures are updated. - */ -static inline int register_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} -static inline int unregister_page_fault_notifier(struct notifier_block *nb) -{ - return 0; -} - extern void bad_trap(struct pt_regs *, long); /* Grossly misnamed. */ diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h index 7f6774dca5f..5020eaf67c2 100644 --- a/include/asm-sparc64/kprobes.h +++ b/include/asm-sparc64/kprobes.h @@ -10,8 +10,9 @@ typedef u32 kprobe_opcode_t; #define BREAKPOINT_INSTRUCTION_2 0x91d02071 /* ta 0x71 */ #define MAX_INSN_SIZE 2 +#define kretprobe_blacklist_size 0 + #define arch_remove_kprobe(p) do {} while (0) -#define ARCH_INACTIVE_KPROBE_COUNT 0 #define flush_insn_slot(p) \ do { flushi(&(p)->ainsn.insn[0]); \ diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 0393380d754..3167ccff64f 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -42,6 +42,9 @@ #define HI_OBP_ADDRESS _AC(0x0000000100000000,UL) #define VMALLOC_START _AC(0x0000000100000000,UL) #define VMALLOC_END _AC(0x0000000200000000,UL) +#define VMEMMAP_BASE _AC(0x0000000200000000,UL) + +#define vmemmap ((struct page *)VMEMMAP_BASE) /* XXX All of this needs to be rethought so we can take advantage * XXX cheetah's full 64-bit virtual address space, ie. no more hole diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h index 048fdb40e81..703c5bbe6c8 100644 --- a/include/asm-sparc64/scatterlist.h +++ b/include/asm-sparc64/scatterlist.h @@ -20,4 +20,6 @@ struct scatterlist { #define ISA_DMA_THRESHOLD (~0UL) +#define ARCH_HAS_SG_CHAIN + #endif /* !(_SPARC64_SCATTERLIST_H) */ diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index e8a96a31761..42c09949526 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h @@ -28,8 +28,9 @@ #include <asm/bitops.h> #include <asm/atomic.h> +#include <asm/percpu.h> -extern cpumask_t cpu_sibling_map[NR_CPUS]; +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); extern cpumask_t cpu_core_map[NR_CPUS]; extern int sparc64_multi_core; diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h index 290ac75f385..c6b557034f6 100644 --- a/include/asm-sparc64/topology.h +++ b/include/asm-sparc64/topology.h @@ -5,7 +5,7 @@ #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id) #define topology_core_id(cpu) (cpu_data(cpu).core_id) #define topology_core_siblings(cpu) (cpu_core_map[cpu]) -#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) +#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) #define mc_capable() (sparc64_multi_core) #define smt_capable() (sparc64_multi_core) #endif /* CONFIG_SMP */ diff --git a/include/asm-um/a.out.h b/include/asm-um/a.out.h index 78bc9eed26b..9281dd8eb33 100644 --- a/include/asm-um/a.out.h +++ b/include/asm-um/a.out.h @@ -1,8 +1,12 @@ +/* + * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) + * Licensed under the GPL + */ + #ifndef __UM_A_OUT_H #define __UM_A_OUT_H #include "asm/arch/a.out.h" -#include "choose-mode.h" #undef STACK_TOP #undef STACK_TOP_MAX @@ -13,10 +17,8 @@ extern unsigned long host_task_size; #define STACK_ROOM (stacksizelim) -extern int honeypot; -#define STACK_TOP \ - CHOOSE_MODE((honeypot ? host_task_size : task_size), task_size) +#define STACK_TOP task_size -#define STACK_TOP_MAX STACK_TOP +#define STACK_TOP_MAX STACK_TOP #endif diff --git a/include/asm-um/elf-i386.h b/include/asm-um/elf-i386.h index 9bab712dc5c..ca94a136dfe 100644 --- a/include/asm-um/elf-i386.h +++ b/include/asm-um/elf-i386.h @@ -5,7 +5,8 @@ #ifndef __UM_ELF_I386_H #define __UM_ELF_I386_H -#include <asm/user.h> +#include <linux/sched.h> +#include "skas.h" #define R_386_NONE 0 #define R_386_32 1 @@ -75,6 +76,15 @@ typedef struct user_i387_struct elf_fpregset_t; pr_reg[16] = PT_REGS_SS(regs); \ } while(0); +static inline int elf_core_copy_fpregs(struct task_struct *t, + elf_fpregset_t *fpu) +{ + int cpu = ((struct thread_info *) t->stack)->cpu; + return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu); +} + +#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) + extern long elf_aux_hwcap; #define ELF_HWCAP (elf_aux_hwcap) diff --git a/include/asm-um/elf-x86_64.h b/include/asm-um/elf-x86_64.h index 857471c49da..3c9d543eb61 100644 --- a/include/asm-um/elf-x86_64.h +++ b/include/asm-um/elf-x86_64.h @@ -1,5 +1,6 @@ /* * Copyright 2003 PathScale, Inc. + * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * * Licensed under the GPL */ @@ -36,7 +37,7 @@ typedef unsigned long elf_greg_t; #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -typedef struct { } elf_fpregset_t; +typedef struct user_i387_struct elf_fpregset_t; /* * This is used to ensure we don't load something for the wrong architecture. @@ -67,27 +68,27 @@ typedef struct { } elf_fpregset_t; } while (0) #define ELF_CORE_COPY_REGS(pr_reg, regs) \ - (pr_reg)[0] = (regs)->regs.skas.regs[0]; \ - (pr_reg)[1] = (regs)->regs.skas.regs[1]; \ - (pr_reg)[2] = (regs)->regs.skas.regs[2]; \ - (pr_reg)[3] = (regs)->regs.skas.regs[3]; \ - (pr_reg)[4] = (regs)->regs.skas.regs[4]; \ - (pr_reg)[5] = (regs)->regs.skas.regs[5]; \ - (pr_reg)[6] = (regs)->regs.skas.regs[6]; \ - (pr_reg)[7] = (regs)->regs.skas.regs[7]; \ - (pr_reg)[8] = (regs)->regs.skas.regs[8]; \ - (pr_reg)[9] = (regs)->regs.skas.regs[9]; \ - (pr_reg)[10] = (regs)->regs.skas.regs[10]; \ - (pr_reg)[11] = (regs)->regs.skas.regs[11]; \ - (pr_reg)[12] = (regs)->regs.skas.regs[12]; \ - (pr_reg)[13] = (regs)->regs.skas.regs[13]; \ - (pr_reg)[14] = (regs)->regs.skas.regs[14]; \ - (pr_reg)[15] = (regs)->regs.skas.regs[15]; \ - (pr_reg)[16] = (regs)->regs.skas.regs[16]; \ - (pr_reg)[17] = (regs)->regs.skas.regs[17]; \ - (pr_reg)[18] = (regs)->regs.skas.regs[18]; \ - (pr_reg)[19] = (regs)->regs.skas.regs[19]; \ - (pr_reg)[20] = (regs)->regs.skas.regs[20]; \ + (pr_reg)[0] = (regs)->regs.gp[0]; \ + (pr_reg)[1] = (regs)->regs.gp[1]; \ + (pr_reg)[2] = (regs)->regs.gp[2]; \ + (pr_reg)[3] = (regs)->regs.gp[3]; \ + (pr_reg)[4] = (regs)->regs.gp[4]; \ + (pr_reg)[5] = (regs)->regs.gp[5]; \ + (pr_reg)[6] = (regs)->regs.gp[6]; \ + (pr_reg)[7] = (regs)->regs.gp[7]; \ + (pr_reg)[8] = (regs)->regs.gp[8]; \ + (pr_reg)[9] = (regs)->regs.gp[9]; \ + (pr_reg)[10] = (regs)->regs.gp[10]; \ + (pr_reg)[11] = (regs)->regs.gp[11]; \ + (pr_reg)[12] = (regs)->regs.gp[12]; \ + (pr_reg)[13] = (regs)->regs.gp[13]; \ + (pr_reg)[14] = (regs)->regs.gp[14]; \ + (pr_reg)[15] = (regs)->regs.gp[15]; \ + (pr_reg)[16] = (regs)->regs.gp[16]; \ + (pr_reg)[17] = (regs)->regs.gp[17]; \ + (pr_reg)[18] = (regs)->regs.gp[18]; \ + (pr_reg)[19] = (regs)->regs.gp[19]; \ + (pr_reg)[20] = (regs)->regs.gp[20]; \ (pr_reg)[21] = current->thread.arch.fs; \ (pr_reg)[22] = 0; \ (pr_reg)[23] = 0; \ @@ -122,14 +123,3 @@ extern long elf_aux_hwcap; #define SET_PERSONALITY(ex, ibcs2) do ; while(0) #endif - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h index 96f82a456ce..b2553f3e87e 100644 --- a/include/asm-um/ldt.h +++ b/include/asm-um/ldt.h @@ -11,11 +11,7 @@ #include "asm/semaphore.h" #include "asm/host_ldt.h" -struct mmu_context_skas; extern void ldt_host_info(void); -extern long init_new_ldt(struct mmu_context_skas * to_mm, - struct mmu_context_skas * from_mm); -extern void free_ldt(struct mmu_context_skas * mm); #define LDT_PAGES_MAX \ ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE) diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h index 9aa4b44e8cc..5f3b863aef9 100644 --- a/include/asm-um/mmu_context.h +++ b/include/asm-um/mmu_context.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */ @@ -9,7 +9,6 @@ #include <asm-generic/mm_hooks.h> #include "linux/sched.h" -#include "choose-mode.h" #include "um_mmu.h" #define get_mmu_context(task) do ; while(0) @@ -30,8 +29,7 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) * possible. */ if (old != new && (current->flags & PF_BORROWED_MM)) - CHOOSE_MODE(force_flush_all(), - switch_mm_skas(&new->context.skas.id)); + __switch_mm(&new->context.id); } static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, @@ -43,8 +41,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, cpu_clear(cpu, prev->cpu_vm_mask); cpu_set(cpu, next->cpu_vm_mask); if(next != &init_mm) - CHOOSE_MODE((void) 0, - switch_mm_skas(&next->context.skas.id)); + __switch_mm(&next->context.id); } } @@ -53,38 +50,8 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, { } -extern int init_new_context_skas(struct task_struct *task, - struct mm_struct *mm); +extern int init_new_context(struct task_struct *task, struct mm_struct *mm); -static inline int init_new_context_tt(struct task_struct *task, - struct mm_struct *mm) -{ - return(0); -} - -static inline int init_new_context(struct task_struct *task, - struct mm_struct *mm) -{ - return(CHOOSE_MODE_PROC(init_new_context_tt, init_new_context_skas, - task, mm)); -} - -extern void destroy_context_skas(struct mm_struct *mm); - -static inline void destroy_context(struct mm_struct *mm) -{ - CHOOSE_MODE((void) 0, destroy_context_skas(mm)); -} +extern void destroy_context(struct mm_struct *mm); #endif - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/include/asm-um/page.h b/include/asm-um/page.h index 8e310d81e5b..4b424c75fca 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h @@ -9,6 +9,7 @@ struct page; +#include <linux/types.h> #include <asm/vm-flags.h> /* PAGE_SHIFT determines the page size */ diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h index 34ab268ef40..14904876e8f 100644 --- a/include/asm-um/pgalloc.h +++ b/include/asm-um/pgalloc.h @@ -42,7 +42,7 @@ static inline void pte_free(struct page *pte) #ifdef CONFIG_3_LEVEL_PGTABLES -extern __inline__ void pmd_free(pmd_t *pmd) +static inline void pmd_free(pmd_t *pmd) { free_page((unsigned long)pmd); } diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index ca0c2a92a11..aa82b88db80 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h @@ -69,7 +69,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) return pmd; } -extern inline void pud_clear (pud_t *pud) +static inline void pud_clear (pud_t *pud) { set_pud(pud, __pud(0)); } diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h index d99bbddffdb..78c0599cc80 100644 --- a/include/asm-um/processor-generic.h +++ b/include/asm-um/processor-generic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */ @@ -11,44 +11,32 @@ struct pt_regs; struct task_struct; #include "asm/ptrace.h" -#include "choose-mode.h" #include "registers.h" #include "sysdep/archsetjmp.h" struct mm_struct; struct thread_struct { - /* This flag is set to 1 before calling do_fork (and analyzed in + struct task_struct *saved_task; + /* + * This flag is set to 1 before calling do_fork (and analyzed in * copy_thread) to mark that we are begin called from userspace (fork / * vfork / clone), and reset to 0 after. It is left to 0 when called - * from kernelspace (i.e. kernel_thread() or fork_idle(), as of 2.6.11). */ - struct task_struct *saved_task; + * from kernelspace (i.e. kernel_thread() or fork_idle(), + * as of 2.6.11). + */ int forking; int nsyscalls; struct pt_regs regs; int singlestep_syscall; void *fault_addr; - void *fault_catcher; + jmp_buf *fault_catcher; struct task_struct *prev_sched; unsigned long temp_stack; - void *exec_buf; + jmp_buf *exec_buf; struct arch_thread arch; - union { -#ifdef CONFIG_MODE_TT - struct { - int extern_pid; - int tracing; - int switch_pipe[2]; - int vm_seq; - } tt; -#endif -#ifdef CONFIG_MODE_SKAS - struct { - jmp_buf switch_buf; - int mm_count; - } skas; -#endif - } mode; + jmp_buf switch_buf; + int mm_count; struct { int op; union { @@ -71,7 +59,7 @@ struct thread_struct { { \ .forking = 0, \ .nsyscalls = 0, \ - .regs = EMPTY_REGS, \ + .regs = EMPTY_REGS, \ .fault_addr = NULL, \ .prev_sched = NULL, \ .temp_stack = 0, \ @@ -86,7 +74,10 @@ typedef struct { extern struct task_struct *alloc_task_struct(void); -extern void release_thread(struct task_struct *); +static inline void release_thread(struct task_struct *task) +{ +} + extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); static inline void prepare_to_copy(struct task_struct *tsk) @@ -136,12 +127,7 @@ extern struct cpuinfo_um cpu_data[]; #endif -#ifdef CONFIG_MODE_SKAS -#define KSTK_REG(tsk, reg) \ - get_thread_reg(reg, &tsk->thread.mode.skas.switch_buf) -#else -#define KSTK_REG(tsk, reg) (0xbadbabe) -#endif +#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf) #define get_wchan(p) (0) #endif diff --git a/include/asm-um/processor-x86_64.h b/include/asm-um/processor-x86_64.h index 31c2d4d685b..d946bf2d334 100644 --- a/include/asm-um/processor-x86_64.h +++ b/include/asm-um/processor-x86_64.h @@ -18,7 +18,7 @@ struct arch_thread { }; /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ -extern inline void rep_nop(void) +static inline void rep_nop(void) { __asm__ __volatile__("rep;nop": : :"memory"); } diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h index 99c87c5ce99..6aefcd32fc6 100644 --- a/include/asm-um/ptrace-generic.h +++ b/include/asm-um/ptrace-generic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */ @@ -9,10 +9,11 @@ #ifndef __ASSEMBLY__ #include "asm/arch/ptrace-abi.h" +#include <asm/user.h> #include "sysdep/ptrace.h" struct pt_regs { - union uml_pt_regs regs; + struct uml_pt_regs regs; }; #define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS } @@ -35,16 +36,18 @@ struct pt_regs { struct task_struct; +extern long subarch_ptrace(struct task_struct *child, long request, long addr, + long data); extern unsigned long getreg(struct task_struct *child, int regno); extern int putreg(struct task_struct *child, int regno, unsigned long value); -extern int get_fpregs(unsigned long buf, struct task_struct *child); -extern int set_fpregs(unsigned long buf, struct task_struct *child); -extern int get_fpxregs(unsigned long buf, struct task_struct *child); -extern int set_fpxregs(unsigned long buf, struct task_struct *tsk); +extern int get_fpregs(struct user_i387_struct __user *buf, + struct task_struct *child); +extern int set_fpregs(struct user_i387_struct __user *buf, + struct task_struct *child); extern void show_regs(struct pt_regs *regs); -extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, +extern void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs, int error_code); extern int arch_copy_tls(struct task_struct *new); diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h index 6e2528bb008..b2d24c5ea2c 100644 --- a/include/asm-um/ptrace-i386.h +++ b/include/asm-um/ptrace-i386.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */ @@ -9,10 +9,9 @@ #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 #include "linux/compiler.h" -#include "sysdep/ptrace.h" #include "asm/ptrace-generic.h" -#include "asm/host_ldt.h" -#include "choose-mode.h" +#include <asm/user.h> +#include "sysdep/ptrace.h" #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) @@ -41,34 +40,21 @@ #define user_mode(r) UPT_IS_USER(&(r)->regs) +/* + * Forward declaration to avoid including sysdep/tls.h, which causes a + * circular include, and compilation failures. + */ +struct user_desc; + +extern int get_fpxregs(struct user_fxsr_struct __user *buf, + struct task_struct *child); +extern int set_fpxregs(struct user_fxsr_struct __user *buf, + struct task_struct *tsk); + extern int ptrace_get_thread_area(struct task_struct *child, int idx, struct user_desc __user *user_desc); extern int ptrace_set_thread_area(struct task_struct *child, int idx, struct user_desc __user *user_desc); -extern int do_set_thread_area_skas(struct user_desc *info); -extern int do_get_thread_area_skas(struct user_desc *info); - -extern int do_set_thread_area_tt(struct user_desc *info); -extern int do_get_thread_area_tt(struct user_desc *info); - -extern int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to); -extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to); - -extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to); -extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to); - -static inline int do_get_thread_area(struct user_desc *info) -{ - return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info); -} - -static inline int do_set_thread_area(struct user_desc *info) -{ - return CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, info); -} - -struct task_struct; - #endif diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h index bf61d17de3f..4c475350dcf 100644 --- a/include/asm-um/ptrace-x86_64.h +++ b/include/asm-um/ptrace-x86_64.h @@ -76,15 +76,6 @@ static inline int ptrace_set_thread_area(struct task_struct *child, int idx, return -ENOSYS; } -static inline void arch_switch_to_tt(struct task_struct *from, - struct task_struct *to) -{ -} - -extern void arch_switch_to_skas(struct task_struct *from, - struct task_struct *to); - -extern long arch_prctl_skas(struct task_struct *task, int code, - unsigned long __user *addr); - +extern long arch_prctl(struct task_struct *task, int code, + unsigned long __user *addr); #endif diff --git a/include/asm-um/smp.h b/include/asm-um/smp.h index 84f8cf29324..f27a9631317 100644 --- a/include/asm-um/smp.h +++ b/include/asm-um/smp.h @@ -18,7 +18,7 @@ extern int hard_smp_processor_id(void); extern int ncpus; -extern inline void smp_cpus_done(unsigned int maxcpus) +static inline void smp_cpus_done(unsigned int maxcpus) { } diff --git a/include/asm-um/tlbflush.h b/include/asm-um/tlbflush.h index e78c28c1f35..9d647c55350 100644 --- a/include/asm-um/tlbflush.h +++ b/include/asm-um/tlbflush.h @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) +/* + * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */ @@ -7,7 +7,6 @@ #define __UM_TLBFLUSH_H #include <linux/mm.h> -#include "choose-mode.h" /* * TLB flushing: @@ -25,19 +24,7 @@ extern void flush_tlb_all(void); extern void flush_tlb_mm(struct mm_struct *mm); extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); -extern void flush_tlb_page_skas(struct vm_area_struct *vma, - unsigned long address); - -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long address) -{ - address &= PAGE_MASK; - - CHOOSE_MODE(flush_tlb_range(vma, address, address + PAGE_SIZE), - flush_tlb_page_skas(vma, address)); -} - -extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); +extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long address); extern void flush_tlb_kernel_vm(void); extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); extern void __flush_tlb_one(unsigned long addr); diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h index 16c734af919..077032d4fc4 100644 --- a/include/asm-um/uaccess.h +++ b/include/asm-um/uaccess.h @@ -80,7 +80,7 @@ __put_user(x, private_ptr) : -EFAULT); \ }) -#define strlen_user(str) strnlen_user(str, ~0UL >> 1) +#define strlen_user(str) strnlen_user(str, ~0U >> 1) struct exception_table_entry { diff --git a/include/asm-x86/cpufeature_32.h b/include/asm-x86/cpufeature_32.h index 7b3aa28ebc6..f17e688dfb0 100644 --- a/include/asm-x86/cpufeature_32.h +++ b/include/asm-x86/cpufeature_32.h @@ -92,6 +92,7 @@ #define X86_FEATURE_CID (4*32+10) /* Context ID */ #define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ #define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ +#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ #define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */ diff --git a/include/asm-x86/dma-mapping_32.h b/include/asm-x86/dma-mapping_32.h index f1d72d177f6..6a2d26cb5da 100644 --- a/include/asm-x86/dma-mapping_32.h +++ b/include/asm-x86/dma-mapping_32.h @@ -2,10 +2,10 @@ #define _ASM_I386_DMA_MAPPING_H #include <linux/mm.h> +#include <linux/scatterlist.h> #include <asm/cache.h> #include <asm/io.h> -#include <asm/scatterlist.h> #include <asm/bug.h> #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) @@ -35,18 +35,19 @@ dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, } static inline int -dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, +dma_map_sg(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction) { + struct scatterlist *sg; int i; BUG_ON(!valid_dma_direction(direction)); - WARN_ON(nents == 0 || sg[0].length == 0); + WARN_ON(nents == 0 || sglist[0].length == 0); - for (i = 0; i < nents; i++ ) { - BUG_ON(!sg[i].page); + for_each_sg(sglist, sg, nents, i) { + BUG_ON(!sg->page); - sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; + sg->dma_address = page_to_phys(sg->page) + sg->offset; } flush_write_buffers(); diff --git a/include/asm-x86/dma-mapping_64.h b/include/asm-x86/dma-mapping_64.h index 6897e2a436e..ecd0f6125ba 100644 --- a/include/asm-x86/dma-mapping_64.h +++ b/include/asm-x86/dma-mapping_64.h @@ -6,8 +6,7 @@ * documentation. */ - -#include <asm/scatterlist.h> +#include <linux/scatterlist.h> #include <asm/io.h> #include <asm/swiotlb.h> diff --git a/include/asm-x86/kdebug_32.h b/include/asm-x86/kdebug_32.h index a185b5f73e7..181d437eef4 100644 --- a/include/asm-x86/kdebug_32.h +++ b/include/asm-x86/kdebug_32.h @@ -5,14 +5,9 @@ * Aug-05 2004 Ported by Prasanna S Panchamukhi <prasanna@in.ibm.com> * from x86_64 architecture. */ -#include <linux/notifier.h> struct pt_regs; -extern int register_page_fault_notifier(struct notifier_block *); -extern int unregister_page_fault_notifier(struct notifier_block *); - - /* Grossly misnamed. */ enum die_val { DIE_OOPS = 1, @@ -27,7 +22,6 @@ enum die_val { DIE_GPF, DIE_CALL, DIE_NMI_IPI, - DIE_PAGE_FAULT, }; #endif diff --git a/include/asm-x86/kdebug_64.h b/include/asm-x86/kdebug_64.h index d7e2bcf49e4..df413e05375 100644 --- a/include/asm-x86/kdebug_64.h +++ b/include/asm-x86/kdebug_64.h @@ -1,13 +1,10 @@ #ifndef _X86_64_KDEBUG_H #define _X86_64_KDEBUG_H 1 -#include <linux/notifier.h> +#include <linux/compiler.h> struct pt_regs; -extern int register_page_fault_notifier(struct notifier_block *); -extern int unregister_page_fault_notifier(struct notifier_block *); - /* Grossly misnamed. */ enum die_val { DIE_OOPS = 1, @@ -22,7 +19,6 @@ enum die_val { DIE_GPF, DIE_CALL, DIE_NMI_IPI, - DIE_PAGE_FAULT, }; extern void printk_address(unsigned long address); diff --git a/include/asm-x86/kprobes_32.h b/include/asm-x86/kprobes_32.h index 06f7303c30c..b772d5b3868 100644 --- a/include/asm-x86/kprobes_32.h +++ b/include/asm-x86/kprobes_32.h @@ -43,9 +43,10 @@ typedef u8 kprobe_opcode_t; : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) #define ARCH_SUPPORTS_KRETPROBES -#define ARCH_INACTIVE_KPROBE_COUNT 0 #define flush_insn_slot(p) do { } while (0) +extern const int kretprobe_blacklist_size; + void arch_remove_kprobe(struct kprobe *p); void kretprobe_trampoline(void); @@ -89,4 +90,5 @@ static inline void restore_interrupts(struct pt_regs *regs) extern int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, void *data); +extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); #endif /* _ASM_KPROBES_H */ diff --git a/include/asm-x86/kprobes_64.h b/include/asm-x86/kprobes_64.h index 7db825403e0..53f4d850735 100644 --- a/include/asm-x86/kprobes_64.h +++ b/include/asm-x86/kprobes_64.h @@ -42,7 +42,7 @@ typedef u8 kprobe_opcode_t; : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) #define ARCH_SUPPORTS_KRETPROBES -#define ARCH_INACTIVE_KPROBE_COUNT 1 +extern const int kretprobe_blacklist_size; void kretprobe_trampoline(void); extern void arch_remove_kprobe(struct kprobe *p); diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h index 88adf1afb0a..c3b52bcb171 100644 --- a/include/asm-x86/page_64.h +++ b/include/asm-x86/page_64.h @@ -134,6 +134,7 @@ extern unsigned long __phys_addr(unsigned long); VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) #define __HAVE_ARCH_GATE_AREA 1 +#define vmemmap ((struct page *)VMEMMAP_START) #include <asm-generic/memory_model.h> #include <asm-generic/page.h> diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h index 57dd6b3107e..a79f5355e3b 100644 --- a/include/asm-x86/pgtable_64.h +++ b/include/asm-x86/pgtable_64.h @@ -137,6 +137,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long #define MAXMEM _AC(0x3fffffffffff, UL) #define VMALLOC_START _AC(0xffffc20000000000, UL) #define VMALLOC_END _AC(0xffffe1ffffffffff, UL) +#define VMEMMAP_START _AC(0xffffe20000000000, UL) #define MODULES_VADDR _AC(0xffffffff88000000, UL) #define MODULES_END _AC(0xfffffffffff00000, UL) #define MODULES_LEN (MODULES_END - MODULES_VADDR) diff --git a/include/asm-x86/scatterlist_32.h b/include/asm-x86/scatterlist_32.h index d7e45a8f1aa..bd5164aa8f6 100644 --- a/include/asm-x86/scatterlist_32.h +++ b/include/asm-x86/scatterlist_32.h @@ -10,6 +10,8 @@ struct scatterlist { unsigned int length; }; +#define ARCH_HAS_SG_CHAIN + /* These macros should be used after a pci_map_sg call has been done * to get bus addresses of each of the SG entries and their lengths. * You should only work with the number of sg entries pci_map_sg diff --git a/include/asm-x86/scatterlist_64.h b/include/asm-x86/scatterlist_64.h index eaf7ada27e1..ef3986ba4b7 100644 --- a/include/asm-x86/scatterlist_64.h +++ b/include/asm-x86/scatterlist_64.h @@ -11,6 +11,8 @@ struct scatterlist { unsigned int dma_length; }; +#define ARCH_HAS_SG_CHAIN + #define ISA_DMA_THRESHOLD (0x00ffffff) /* These macros should be used after a pci_map_sg call has been done diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h index 1f73bde165b..955dd7c8538 100644 --- a/include/asm-x86/smp_32.h +++ b/include/asm-x86/smp_32.h @@ -30,8 +30,8 @@ extern void smp_alloc_memory(void); extern int pic_mode; extern int smp_num_siblings; -extern cpumask_t cpu_sibling_map[]; -extern cpumask_t cpu_core_map[]; +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); +DECLARE_PER_CPU(cpumask_t, cpu_core_map); extern void (*mtrr_hook) (void); extern void zap_low_mappings (void); diff --git a/include/asm-x86/smp_64.h b/include/asm-x86/smp_64.h index 3f303d2365e..f5bcee1c092 100644 --- a/include/asm-x86/smp_64.h +++ b/include/asm-x86/smp_64.h @@ -38,8 +38,15 @@ extern void unlock_ipi_call_lock(void); extern int smp_num_siblings; extern void smp_send_reschedule(int cpu); -extern cpumask_t cpu_sibling_map[NR_CPUS]; -extern cpumask_t cpu_core_map[NR_CPUS]; +/* + * cpu_sibling_map and cpu_core_map now live + * in the per cpu area + * + * extern cpumask_t cpu_sibling_map[NR_CPUS]; + * extern cpumask_t cpu_core_map[NR_CPUS]; + */ +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); +DECLARE_PER_CPU(cpumask_t, cpu_core_map); extern u8 cpu_llc_id[NR_CPUS]; #define SMP_TRAMPOLINE_BASE 0x6000 diff --git a/include/asm-x86/topology_32.h b/include/asm-x86/topology_32.h index 19b2dafd0c8..ae1074603c4 100644 --- a/include/asm-x86/topology_32.h +++ b/include/asm-x86/topology_32.h @@ -30,8 +30,8 @@ #ifdef CONFIG_X86_HT #define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) -#define topology_core_siblings(cpu) (cpu_core_map[cpu]) -#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) +#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) +#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) #endif #ifdef CONFIG_NUMA diff --git a/include/asm-x86/topology_64.h b/include/asm-x86/topology_64.h index 36e52fba796..848c17f9222 100644 --- a/include/asm-x86/topology_64.h +++ b/include/asm-x86/topology_64.h @@ -58,8 +58,8 @@ extern int __node_distance(int, int); #ifdef CONFIG_SMP #define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) -#define topology_core_siblings(cpu) (cpu_core_map[cpu]) -#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) +#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) +#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) #define mc_capable() (boot_cpu_data.x86_max_cores > 1) #define smt_capable() (smp_num_siblings > 1) #endif diff --git a/include/linux/bio.h b/include/linux/bio.h index 089a8bc55dd..4da441337d6 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -176,13 +176,28 @@ struct bio { #define bio_offset(bio) bio_iovec((bio))->bv_offset #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) #define bio_sectors(bio) ((bio)->bi_size >> 9) -#define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9) -#define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio))) #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) +#define bio_empty_barrier(bio) (bio_barrier(bio) && !(bio)->bi_size) + +static inline unsigned int bio_cur_sectors(struct bio *bio) +{ + if (bio->bi_vcnt) + return bio_iovec(bio)->bv_len >> 9; + + return 0; +} + +static inline void *bio_data(struct bio *bio) +{ + if (bio->bi_vcnt) + return page_address(bio_page(bio)) + bio_offset(bio); + + return NULL; +} /* * will die diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 638165f571d..b9fb8ee3308 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -8,6 +8,12 @@ */ #include <asm/bitops.h> +#define for_each_bit(bit, addr, size) \ + for ((bit) = find_first_bit((addr), (size)); \ + (bit) < (size); \ + (bit) = find_next_bit((addr), (size), (bit) + 1)) + + static __inline__ int get_bitmask_order(unsigned int count) { int order; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 5ed888b04b2..bbf906a0b41 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -330,7 +330,6 @@ typedef void (unplug_fn) (struct request_queue *); struct bio_vec; typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); -typedef int (issue_flush_fn) (struct request_queue *, struct gendisk *, sector_t *); typedef void (prepare_flush_fn) (struct request_queue *, struct request *); typedef void (softirq_done_fn)(struct request *); @@ -368,7 +367,6 @@ struct request_queue prep_rq_fn *prep_rq_fn; unplug_fn *unplug_fn; merge_bvec_fn *merge_bvec_fn; - issue_flush_fn *issue_flush_fn; prepare_flush_fn *prepare_flush_fn; softirq_done_fn *softirq_done_fn; @@ -540,6 +538,7 @@ enum { #define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) #define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) +#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) @@ -729,7 +728,9 @@ static inline void blk_run_address_space(struct address_space *mapping) extern int end_that_request_first(struct request *, int, int); extern int end_that_request_chunk(struct request *, int, int); extern void end_that_request_last(struct request *, int); -extern void end_request(struct request *req, int uptodate); +extern void end_request(struct request *, int); +extern void end_queued_request(struct request *, int); +extern void end_dequeued_request(struct request *, int); extern void blk_complete_request(struct request *); /* @@ -767,7 +768,6 @@ extern void blk_queue_dma_alignment(struct request_queue *, int); extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); -extern void blk_queue_issue_flush_fn(struct request_queue *, issue_flush_fn *); extern int blk_do_ordered(struct request_queue *, struct request **); extern unsigned blk_ordered_cur_seq(struct request_queue *); extern unsigned blk_ordered_req_seq(struct request *); diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 35cadad84b1..da0d83fbadc 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -203,10 +203,20 @@ void block_invalidatepage(struct page *page, unsigned long offset); int block_write_full_page(struct page *page, get_block_t *get_block, struct writeback_control *wbc); int block_read_full_page(struct page*, get_block_t*); +int block_write_begin(struct file *, struct address_space *, + loff_t, unsigned, unsigned, + struct page **, void **, get_block_t*); +int block_write_end(struct file *, struct address_space *, + loff_t, unsigned, unsigned, + struct page *, void *); +int generic_write_end(struct file *, struct address_space *, + loff_t, unsigned, unsigned, + struct page *, void *); +void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); -int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*, - loff_t *); -int generic_cont_expand(struct inode *inode, loff_t size); +int cont_write_begin(struct file *, struct address_space *, loff_t, + unsigned, unsigned, struct page **, void **, + get_block_t *, loff_t *); int generic_cont_expand_simple(struct inode *inode, loff_t size); int block_commit_write(struct page *page, unsigned from, unsigned to); int block_page_mkwrite(struct vm_area_struct *vma, struct page *page, @@ -216,9 +226,13 @@ sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); int generic_commit_write(struct file *, struct page *, unsigned, unsigned); int block_truncate_page(struct address_space *, loff_t, get_block_t *); int file_fsync(struct file *, struct dentry *, int); -int nobh_prepare_write(struct page*, unsigned, unsigned, get_block_t*); -int nobh_commit_write(struct file *, struct page *, unsigned, unsigned); -int nobh_truncate_page(struct address_space *, loff_t); +int nobh_write_begin(struct file *, struct address_space *, + loff_t, unsigned, unsigned, + struct page **, void **, get_block_t*); +int nobh_write_end(struct file *, struct address_space *, + loff_t, unsigned, unsigned, + struct page *, void *); +int nobh_truncate_page(struct address_space *, loff_t, get_block_t *); int nobh_writepage(struct page *page, get_block_t *get_block, struct writeback_control *wbc); diff --git a/include/linux/connector.h b/include/linux/connector.h index b62f823e90c..13fc4541bf2 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h @@ -36,14 +36,15 @@ #define CN_VAL_CIFS 0x1 #define CN_W1_IDX 0x3 /* w1 communication */ #define CN_W1_VAL 0x1 +#define CN_IDX_V86D 0x4 +#define CN_VAL_V86D_UVESAFB 0x1 - -#define CN_NETLINK_USERS 4 +#define CN_NETLINK_USERS 5 /* * Maximum connector's message size. */ -#define CONNECTOR_MAX_MSG_SIZE 1024 +#define CONNECTOR_MAX_MSG_SIZE 16384 /* * idx and val are unique identifiers which diff --git a/include/linux/console.h b/include/linux/console.h index 56a7bcda49c..0a4542ddb73 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -45,7 +45,8 @@ struct consw { int (*con_font_get)(struct vc_data *, struct console_font *); int (*con_font_default)(struct vc_data *, struct console_font *, char *); int (*con_font_copy)(struct vc_data *, int); - int (*con_resize)(struct vc_data *, unsigned int, unsigned int); + int (*con_resize)(struct vc_data *, unsigned int, unsigned int, + unsigned int); int (*con_set_palette)(struct vc_data *, unsigned char *); int (*con_scrolldelta)(struct vc_data *, int); int (*con_set_origin)(struct vc_data *); diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index dc77fed7b28..d71f7c0f931 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h @@ -100,6 +100,7 @@ struct vc_data { unsigned char vc_G1_charset; unsigned char vc_saved_G0; unsigned char vc_saved_G1; + unsigned int vc_resize_user; /* resize request from user */ unsigned int vc_bell_pitch; /* Console bell pitch */ unsigned int vc_bell_duration; /* Console bell duration */ struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 826b15e914e..9e633ea103c 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -93,7 +93,7 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) return node_possible_map; } -#define cpuset_current_mems_allowed (node_online_map) +#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) static inline void cpuset_init_current_mems_allowed(void) {} static inline void cpuset_update_task_memory_state(void) {} #define cpuset_nodes_subset_current_mems_allowed(nodes) (1) diff --git a/include/linux/dca.h b/include/linux/dca.h new file mode 100644 index 00000000000..83eaecc6f8a --- /dev/null +++ b/include/linux/dca.h @@ -0,0 +1,47 @@ +#ifndef DCA_H +#define DCA_H +/* DCA Provider API */ + +/* DCA Notifier Interface */ +void dca_register_notify(struct notifier_block *nb); +void dca_unregister_notify(struct notifier_block *nb); + +#define DCA_PROVIDER_ADD 0x0001 +#define DCA_PROVIDER_REMOVE 0x0002 + +struct dca_provider { + struct dca_ops *ops; + struct class_device *cd; + int id; +}; + +struct dca_ops { + int (*add_requester) (struct dca_provider *, struct device *); + int (*remove_requester) (struct dca_provider *, struct device *); + u8 (*get_tag) (struct dca_provider *, int cpu); +}; + +struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); +void free_dca_provider(struct dca_provider *dca); +int register_dca_provider(struct dca_provider *dca, struct device *dev); +void unregister_dca_provider(struct dca_provider *dca); + +static inline void *dca_priv(struct dca_provider *dca) +{ + return (void *)dca + sizeof(struct dca_provider); +} + +/* Requester API */ +int dca_add_requester(struct device *dev); +int dca_remove_requester(struct device *dev); +u8 dca_get_tag(int cpu); + +/* internal stuff */ +int __init dca_sysfs_init(void); +void __exit dca_sysfs_exit(void); +int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev); +void dca_sysfs_remove_provider(struct dca_provider *dca); +int dca_sysfs_add_req(struct dca_provider *dca, struct device *dev, int slot); +void dca_sysfs_remove_req(struct dca_provider *dca, int slot); + +#endif /* DCA_H */ diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 2dc21cbeb30..0ebfafbd338 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -24,6 +24,8 @@ enum dma_data_direction { #define DMA_28BIT_MASK 0x000000000fffffffULL #define DMA_24BIT_MASK 0x0000000000ffffffULL +#define DMA_MASK_NONE 0x0ULL + static inline int valid_dma_direction(int dma_direction) { return ((dma_direction == DMA_BIDIRECTIONAL) || @@ -31,6 +33,11 @@ static inline int valid_dma_direction(int dma_direction) (dma_direction == DMA_FROM_DEVICE)); } +static inline int is_device_dma_capable(struct device *dev) +{ + return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; +} + #ifdef CONFIG_HAS_DMA #include <asm/dma-mapping.h> #else diff --git a/include/linux/fb.h b/include/linux/fb.h index cec54106aa8..58c57a33e5d 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -180,6 +180,7 @@ struct fb_bitfield { }; #define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ +#define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */ #define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/ #define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ @@ -206,6 +207,7 @@ struct fb_bitfield { #define FB_VMODE_NONINTERLACED 0 /* non interlaced */ #define FB_VMODE_INTERLACED 1 /* interlaced */ #define FB_VMODE_DOUBLE 2 /* double scan */ +#define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */ #define FB_VMODE_MASK 255 #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ @@ -1054,6 +1056,7 @@ struct fb_videomode { u32 flag; }; +extern const char *fb_mode_option; extern const struct fb_videomode vesa_modes[]; struct fb_modelist { diff --git a/include/linux/fs.h b/include/linux/fs.h index 4a6a21077ba..f70d52c4661 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -381,7 +381,7 @@ struct iattr { * trying again. The aop will be taking reasonable * precautions not to livelock. If the caller held a page * reference, it should drop it before retrying. Returned - * by readpage(), prepare_write(), and commit_write(). + * by readpage(). * * address_space_operation functions return these large constants to indicate * special semantics to the caller. These are much larger than the bytes in a @@ -394,6 +394,9 @@ enum positive_aop_returns { AOP_TRUNCATED_PAGE = 0x80001, }; +#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ +#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ + /* * oh the beauties of C type declarations. */ @@ -401,6 +404,39 @@ struct page; struct address_space; struct writeback_control; +struct iov_iter { + const struct iovec *iov; + unsigned long nr_segs; + size_t iov_offset; + size_t count; +}; + +size_t iov_iter_copy_from_user_atomic(struct page *page, + struct iov_iter *i, unsigned long offset, size_t bytes); +size_t iov_iter_copy_from_user(struct page *page, + struct iov_iter *i, unsigned long offset, size_t bytes); +void iov_iter_advance(struct iov_iter *i, size_t bytes); +int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); +size_t iov_iter_single_seg_count(struct iov_iter *i); + +static inline void iov_iter_init(struct iov_iter *i, + const struct iovec *iov, unsigned long nr_segs, + size_t count, size_t written) +{ + i->iov = iov; + i->nr_segs = nr_segs; + i->iov_offset = 0; + i->count = count + written; + + iov_iter_advance(i, written); +} + +static inline size_t iov_iter_count(struct iov_iter *i) +{ + return i->count; +} + + struct address_space_operations { int (*writepage)(struct page *page, struct writeback_control *wbc); int (*readpage)(struct file *, struct page *); @@ -421,6 +457,14 @@ struct address_space_operations { */ int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); int (*commit_write)(struct file *, struct page *, unsigned, unsigned); + + int (*write_begin)(struct file *, struct address_space *mapping, + loff_t pos, unsigned len, unsigned flags, + struct page **pagep, void **fsdata); + int (*write_end)(struct file *, struct address_space *mapping, + loff_t pos, unsigned len, unsigned copied, + struct page *page, void *fsdata); + /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ sector_t (*bmap)(struct address_space *, sector_t); void (*invalidatepage) (struct page *, unsigned long); @@ -435,6 +479,18 @@ struct address_space_operations { int (*launder_page) (struct page *); }; +/* + * pagecache_write_begin/pagecache_write_end must be used by general code + * to write into the pagecache. + */ +int pagecache_write_begin(struct file *, struct address_space *mapping, + loff_t pos, unsigned len, unsigned flags, + struct page **pagep, void **fsdata); + +int pagecache_write_end(struct file *, struct address_space *mapping, + loff_t pos, unsigned len, unsigned copied, + struct page *page, void *fsdata); + struct backing_dev_info; struct address_space { struct inode *host; /* owner: inode, block_device */ @@ -697,16 +753,14 @@ struct fown_struct { * Track a single file's readahead state */ struct file_ra_state { - pgoff_t start; /* where readahead started */ - unsigned long size; /* # of readahead pages */ - unsigned long async_size; /* do asynchronous readahead when + pgoff_t start; /* where readahead started */ + unsigned int size; /* # of readahead pages */ + unsigned int async_size; /* do asynchronous readahead when there are only # of pages ahead */ - unsigned long ra_pages; /* Maximum readahead window */ - unsigned long mmap_hit; /* Cache hit stat for mmap accesses */ - unsigned long mmap_miss; /* Cache miss stat for mmap accesses */ - unsigned long prev_index; /* Cache last read() position */ - unsigned int prev_offset; /* Offset where last read() ended in a page */ + unsigned int ra_pages; /* Maximum readahead window */ + int mmap_miss; /* Cache miss stat for mmap accesses */ + loff_t prev_pos; /* Cache last read() position */ }; /* @@ -1835,6 +1889,12 @@ extern int simple_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to); extern int simple_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to); +extern int simple_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, unsigned flags, + struct page **pagep, void **fsdata); +extern int simple_write_end(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, unsigned copied, + struct page *page, void *fsdata); extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); diff --git a/include/linux/gfp.h b/include/linux/gfp.h index bc68dd9a6d4..7e93a9ae706 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -48,18 +48,12 @@ struct vm_area_struct; #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ #define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ -#define __GFP_MOVABLE ((__force gfp_t)0x80000u) /* Page is movable */ +#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */ +#define __GFP_MOVABLE ((__force gfp_t)0x100000u) /* Page is movable */ -#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ +#define __GFP_BITS_SHIFT 21 /* Room for 21 __GFP_FOO bits */ #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) -/* if you forget to add the bitmask here kernel will crash, period */ -#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ - __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ - __GFP_NOFAIL|__GFP_NORETRY|__GFP_COMP| \ - __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE| \ - __GFP_MOVABLE) - /* This equals 0, but use constants in case they ever change */ #define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) /* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */ @@ -67,6 +61,8 @@ struct vm_area_struct; #define GFP_NOIO (__GFP_WAIT) #define GFP_NOFS (__GFP_WAIT | __GFP_IO) #define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS) +#define GFP_TEMPORARY (__GFP_WAIT | __GFP_IO | __GFP_FS | \ + __GFP_RECLAIMABLE) #define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL) #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ __GFP_HIGHMEM) @@ -86,6 +82,19 @@ struct vm_area_struct; #define GFP_THISNODE ((__force gfp_t)0) #endif +/* This mask makes up all the page movable related flags */ +#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE) + +/* Control page allocator reclaim behavior */ +#define GFP_RECLAIM_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS|\ + __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\ + __GFP_NORETRY|__GFP_NOMEMALLOC) + +/* Control allocation constraints */ +#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) + +/* Do not use these with a slab allocator */ +#define GFP_SLAB_BUG_MASK (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK) /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some platforms, used as appropriate on others */ @@ -95,25 +104,50 @@ struct vm_area_struct; /* 4GB DMA on some platforms */ #define GFP_DMA32 __GFP_DMA32 +/* Convert GFP flags to their corresponding migrate type */ +static inline int allocflags_to_migratetype(gfp_t gfp_flags) +{ + WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); + + if (unlikely(page_group_by_mobility_disabled)) + return MIGRATE_UNMOVABLE; + + /* Group based on mobility */ + return (((gfp_flags & __GFP_MOVABLE) != 0) << 1) | + ((gfp_flags & __GFP_RECLAIMABLE) != 0); +} static inline enum zone_type gfp_zone(gfp_t flags) { + int base = 0; + +#ifdef CONFIG_NUMA + if (flags & __GFP_THISNODE) + base = MAX_NR_ZONES; +#endif + #ifdef CONFIG_ZONE_DMA if (flags & __GFP_DMA) - return ZONE_DMA; + return base + ZONE_DMA; #endif #ifdef CONFIG_ZONE_DMA32 if (flags & __GFP_DMA32) - return ZONE_DMA32; + return base + ZONE_DMA32; #endif if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == (__GFP_HIGHMEM | __GFP_MOVABLE)) - return ZONE_MOVABLE; + return base + ZONE_MOVABLE; #ifdef CONFIG_HIGHMEM if (flags & __GFP_HIGHMEM) - return ZONE_HIGHMEM; + return base + ZONE_HIGHMEM; #endif - return ZONE_NORMAL; + return base + ZONE_NORMAL; +} + +static inline gfp_t set_migrateflags(gfp_t gfp, gfp_t migrate_flags) +{ + BUG_ON((gfp & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); + return (gfp & ~(GFP_MOVABLE_MASK)) | migrate_flags; } /* diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 3a19b032c0e..ea0f50bfbe0 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -33,6 +33,7 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); extern unsigned long max_huge_pages; extern unsigned long hugepages_treat_as_movable; +extern int hugetlb_dynamic_pool; extern const unsigned long hugetlb_zero, hugetlb_infinity; extern int sysctl_hugetlb_shm_group; diff --git a/include/linux/i2o.h b/include/linux/i2o.h index 9752307d16b..7da5b98d90e 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h @@ -32,6 +32,7 @@ #include <linux/workqueue.h> /* work_struct */ #include <linux/mempool.h> #include <linux/mutex.h> +#include <linux/scatterlist.h> #include <asm/io.h> #include <asm/semaphore.h> /* Needed for MUTEX init macros */ @@ -837,7 +838,7 @@ static inline int i2o_dma_map_sg(struct i2o_controller *c, if ((sizeof(dma_addr_t) > 4) && c->pae_support) *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg))); #endif - sg++; + sg = sg_next(sg); } *sg_ptr = mptr; diff --git a/include/linux/ide.h b/include/linux/ide.h index 02a27e8cbad..30a1931466a 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -772,7 +772,7 @@ typedef struct hwif_s { unsigned int nsect; unsigned int nleft; - unsigned int cursg; + struct scatterlist *cursg; unsigned int cursg_ofs; int rqsize; /* max sectors per request */ @@ -1093,11 +1093,6 @@ extern ide_startstop_t ide_do_reset (ide_drive_t *); extern void ide_init_drive_cmd (struct request *rq); /* - * this function returns error location sector offset in case of a write error - */ -extern u64 ide_get_error_location(ide_drive_t *, char *); - -/* * "action" parameter type for ide_do_drive_cmd() below. */ typedef enum { diff --git a/include/linux/init.h b/include/linux/init.h index f8d9d0b5cff..9b7a2ba8237 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -67,8 +67,10 @@ /* For assembly routines */ #define __INIT .section ".init.text","ax" +#define __INIT_REFOK .section ".text.init.refok","ax" #define __FINIT .previous #define __INITDATA .section ".init.data","aw" +#define __INITDATA_REFOK .section ".data.init.refok","aw" #ifndef __ASSEMBLY__ /* diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 5523f19d88d..8e5f289052a 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -205,6 +205,15 @@ static inline int disable_irq_wake(unsigned int irq) enable_irq(irq) # endif +static inline int enable_irq_wake(unsigned int irq) +{ + return 0; +} + +static inline int disable_irq_wake(unsigned int irq) +{ + return 0; +} #endif /* CONFIG_GENERIC_HARDIRQS */ #ifndef __ARCH_SET_SOFTIRQ_PENDING diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 71ea9231924..6187a8567bc 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -110,9 +110,6 @@ extern int allocate_resource(struct resource *root, struct resource *new, int adjust_resource(struct resource *res, resource_size_t start, resource_size_t size); -/* get registered SYSTEM_RAM resources in specified area */ -extern int find_next_system_ram(struct resource *res); - /* Convenience shorthand with allocation */ #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name)) diff --git a/include/linux/isdn.h b/include/linux/isdn.h index d5dda4b643a..d0ecc8eebfb 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h @@ -167,6 +167,7 @@ typedef struct { #include <linux/etherdevice.h> #include <linux/skbuff.h> #include <linux/tcp.h> +#include <linux/mutex.h> #define ISDN_TTY_MAJOR 43 #define ISDN_TTYAUX_MAJOR 44 @@ -616,7 +617,7 @@ typedef struct isdn_devt { int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */ atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */ isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */ - struct semaphore sem; /* serialize list access*/ + struct mutex mtx; /* serialize list access*/ unsigned long global_features; } isdn_dev; diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 700a93b7918..72f52237292 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -372,6 +372,7 @@ struct jbd_revoke_table_s; * @h_sync: flag for sync-on-close * @h_jdata: flag to force data journaling * @h_aborted: flag indicating fatal error on handle + * @h_lockdep_map: lockdep info for debugging lock problems **/ /* Docbook can't yet cope with the bit fields, but will leave the documentation diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index e757a74b9d1..8b080024bbc 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -148,6 +148,8 @@ static inline u64 get_jiffies_64(void) */ #define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1) +extern unsigned long preset_lpj; + /* * We want to do realistic conversions of time so we need to use the same * values the update wall clock code uses as the jiffies size. This value diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d9725a28a26..5fdbc814c2e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -35,6 +35,7 @@ extern const char linux_proc_banner[]; #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) +#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0) #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 51464d12a4e..81891581e89 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -166,6 +166,12 @@ struct kretprobe_instance { struct task_struct *task; }; +struct kretprobe_blackpoint { + const char *name; + void *addr; +}; +extern struct kretprobe_blackpoint kretprobe_blacklist[]; + static inline void kretprobe_assert(struct kretprobe_instance *ri, unsigned long orig_ret_address, unsigned long trampoline_address) { diff --git a/include/linux/libata.h b/include/linux/libata.h index 229a9ff9f92..377e6d4d9be 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -29,7 +29,7 @@ #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/dma-mapping.h> -#include <asm/scatterlist.h> +#include <linux/scatterlist.h> #include <linux/io.h> #include <linux/ata.h> #include <linux/workqueue.h> @@ -416,6 +416,7 @@ struct ata_queued_cmd { unsigned long flags; /* ATA_QCFLAG_xxx */ unsigned int tag; unsigned int n_elem; + unsigned int n_iter; unsigned int orig_n_elem; int dma_dir; @@ -426,7 +427,7 @@ struct ata_queued_cmd { unsigned int nbytes; unsigned int curbytes; - unsigned int cursg; + struct scatterlist *cursg; unsigned int cursg_ofs; struct scatterlist sgent; @@ -1043,7 +1044,7 @@ ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc) return 1; if (qc->pad_len) return 0; - if (((sg - qc->__sg) + 1) == qc->n_elem) + if (qc->n_iter == qc->n_elem) return 1; return 0; } @@ -1051,6 +1052,7 @@ ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc) static inline struct scatterlist * ata_qc_first_sg(struct ata_queued_cmd *qc) { + qc->n_iter = 0; if (qc->n_elem) return qc->__sg; if (qc->pad_len) @@ -1063,8 +1065,8 @@ ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) { if (sg == &qc->pad_sgent) return NULL; - if (++sg - qc->__sg < qc->n_elem) - return sg; + if (++qc->n_iter < qc->n_elem) + return sg_next(sg); if (qc->pad_len) return &qc->pad_sgent; return NULL; @@ -1309,9 +1311,11 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc) qc->dma_dir = DMA_NONE; qc->__sg = NULL; qc->flags = 0; - qc->cursg = qc->cursg_ofs = 0; + qc->cursg = NULL; + qc->cursg_ofs = 0; qc->nbytes = qc->curbytes = 0; qc->n_elem = 0; + qc->n_iter = 0; qc->err_mask = 0; qc->pad_len = 0; qc->sect_size = ATA_SECT_SIZE; diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 7b54666cea8..8fee7a45736 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -3,7 +3,6 @@ #include <linux/mmzone.h> #include <linux/spinlock.h> -#include <linux/mmzone.h> #include <linux/notifier.h> struct page; @@ -59,11 +58,21 @@ extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); extern void online_page(struct page *page); /* VM interface that may be used by firmware interface */ extern int online_pages(unsigned long, unsigned long); +extern void __offline_isolated_pages(unsigned long, unsigned long); +extern int offline_pages(unsigned long, unsigned long, unsigned long); /* reasonably generic interface to expand the physical pages in a zone */ extern int __add_pages(struct zone *zone, unsigned long start_pfn, unsigned long nr_pages); +/* + * Walk thorugh all memory which is registered as resource. + * arg is (start_pfn, nr_pages, private_arg_pointer) + */ +extern int walk_memory_resource(unsigned long start_pfn, + unsigned long nr_pages, void *arg, + int (*func)(unsigned long, unsigned long, void *)); + #ifdef CONFIG_NUMA extern int memory_add_physaddr_to_nid(u64 start); #else @@ -161,13 +170,6 @@ static inline int mhp_notimplemented(const char *func) } #endif /* ! CONFIG_MEMORY_HOTPLUG */ -static inline int __remove_pages(struct zone *zone, unsigned long start_pfn, - unsigned long nr_pages) -{ - printk(KERN_WARNING "%s() called, not yet supported\n", __FUNCTION__); - dump_stack(); - return -ENOSYS; -} extern int add_memory(int nid, u64 start, u64 size); extern int arch_add_memory(int nid, u64 start, u64 size); diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index a020eb2d4e2..38c04d61ee0 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -19,6 +19,7 @@ /* Flags for get_mem_policy */ #define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ #define MPOL_F_ADDR (1<<1) /* look up vma using address */ +#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ /* Flags for mbind */ #define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ @@ -143,7 +144,6 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, extern void numa_default_policy(void); extern void numa_policy_init(void); -extern void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *new); extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new); extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); @@ -235,11 +235,6 @@ static inline void numa_default_policy(void) { } -static inline void mpol_rebind_policy(struct mempolicy *pol, - const nodemask_t *new) -{ -} - static inline void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new) { diff --git a/include/linux/mm.h b/include/linux/mm.h index 1692dd6cb91..7e87e1b1662 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -50,69 +50,6 @@ extern int sysctl_legacy_va_layout; * mmap() functions). */ -/* - * This struct defines a memory VMM memory area. There is one of these - * per VM-area/task. A VM area is any part of the process virtual memory - * space that has a special rule for the page-fault handlers (ie a shared - * library, the executable area etc). - */ -struct vm_area_struct { - struct mm_struct * vm_mm; /* The address space we belong to. */ - unsigned long vm_start; /* Our start address within vm_mm. */ - unsigned long vm_end; /* The first byte after our end address - within vm_mm. */ - - /* linked list of VM areas per task, sorted by address */ - struct vm_area_struct *vm_next; - - pgprot_t vm_page_prot; /* Access permissions of this VMA. */ - unsigned long vm_flags; /* Flags, listed below. */ - - struct rb_node vm_rb; - - /* - * For areas with an address space and backing store, - * linkage into the address_space->i_mmap prio tree, or - * linkage to the list of like vmas hanging off its node, or - * linkage of vma in the address_space->i_mmap_nonlinear list. - */ - union { - struct { - struct list_head list; - void *parent; /* aligns with prio_tree_node parent */ - struct vm_area_struct *head; - } vm_set; - - struct raw_prio_tree_node prio_tree_node; - } shared; - - /* - * A file's MAP_PRIVATE vma can be in both i_mmap tree and anon_vma - * list, after a COW of one of the file pages. A MAP_SHARED vma - * can only be in the i_mmap tree. An anonymous MAP_PRIVATE, stack - * or brk vma (with NULL file) can only be in an anon_vma list. - */ - struct list_head anon_vma_node; /* Serialized by anon_vma->lock */ - struct anon_vma *anon_vma; /* Serialized by page_table_lock */ - - /* Function pointers to deal with this struct. */ - struct vm_operations_struct * vm_ops; - - /* Information about our backing store: */ - unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE - units, *not* PAGE_CACHE_SIZE */ - struct file * vm_file; /* File we map to (can be NULL). */ - void * vm_private_data; /* was vm_pte (shared mem) */ - unsigned long vm_truncate_count;/* truncate_count or restart_addr */ - -#ifndef CONFIG_MMU - atomic_t vm_usage; /* refcount (VMAs shared if !MMU) */ -#endif -#ifdef CONFIG_NUMA - struct mempolicy *vm_policy; /* NUMA policy for the VMA */ -#endif -}; - extern struct kmem_cache *vm_area_cachep; /* @@ -631,10 +568,6 @@ static inline struct address_space *page_mapping(struct page *page) VM_BUG_ON(PageSlab(page)); if (unlikely(PageSwapCache(page))) mapping = &swapper_space; -#ifdef CONFIG_SLUB - else if (unlikely(PageSlab(page))) - mapping = NULL; -#endif else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) mapping = NULL; return mapping; @@ -715,9 +648,6 @@ static inline int page_mapped(struct page *page) extern void show_free_areas(void); #ifdef CONFIG_SHMEM -int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new); -struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, - unsigned long addr); int shmem_lock(struct file *file, int lock, struct user_struct *user); #else static inline int shmem_lock(struct file *file, int lock, @@ -725,18 +655,6 @@ static inline int shmem_lock(struct file *file, int lock, { return 0; } - -static inline int shmem_set_policy(struct vm_area_struct *vma, - struct mempolicy *new) -{ - return 0; -} - -static inline struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, - unsigned long addr) -{ - return NULL; -} #endif struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); @@ -779,8 +697,6 @@ void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma, unsigned long floor, unsigned long ceiling); int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma); -int zeromap_page_range(struct vm_area_struct *vma, unsigned long from, - unsigned long size, pgprot_t prot); void unmap_mapping_range(struct address_space *mapping, loff_t const holebegin, loff_t const holelen, int even_cows); @@ -1106,8 +1022,6 @@ int write_one_page(struct page *page, int wait); /* readahead.c */ #define VM_MAX_READAHEAD 128 /* kbytes */ #define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ -#define VM_MAX_CACHE_HIT 256 /* max pages in a row in cache before - * turning readahead off */ int do_page_cache_readahead(struct address_space *mapping, struct file *filp, pgoff_t offset, unsigned long nr_to_read); @@ -1218,5 +1132,16 @@ extern int randomize_va_space; const char * arch_vma_name(struct vm_area_struct *vma); +struct page *sparse_mem_map_populate(unsigned long pnum, int nid); +pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); +pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node); +pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node); +pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); +void *vmemmap_alloc_block(unsigned long size, int node); +void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); +int vmemmap_populate_basepages(struct page *start_page, + unsigned long pages, int node); +int vmemmap_populate(struct page *start_page, unsigned long pages, int node); + #endif /* __KERNEL__ */ #endif /* _LINUX_MM_H */ diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index d5bb1796e12..87766791845 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -1,13 +1,26 @@ #ifndef _LINUX_MM_TYPES_H #define _LINUX_MM_TYPES_H +#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ #include <linux/types.h> #include <linux/threads.h> #include <linux/list.h> #include <linux/spinlock.h> +#include <linux/prio_tree.h> +#include <linux/rbtree.h> +#include <linux/rwsem.h> +#include <linux/completion.h> +#include <asm/page.h> +#include <asm/mmu.h> struct address_space; +#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS +typedef atomic_long_t mm_counter_t; +#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ +typedef unsigned long mm_counter_t; +#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ + /* * Each physical page in the system has a struct page associated with * it to keep track of whatever it is we are using the page for at the @@ -24,10 +37,7 @@ struct page { * to show when page is mapped * & limit reverse map searches. */ - struct { /* SLUB uses */ - short unsigned int inuse; - short unsigned int offset; - }; + unsigned int inuse; /* SLUB: Nr of objects */ }; union { struct { @@ -49,13 +59,8 @@ struct page { #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS spinlock_t ptl; #endif - struct { /* SLUB uses */ - void **lockless_freelist; - struct kmem_cache *slab; /* Pointer to slab */ - }; - struct { - struct page *first_page; /* Compound pages */ - }; + struct kmem_cache *slab; /* SLUB: Pointer to slab */ + struct page *first_page; /* Compound tail pages */ }; union { pgoff_t index; /* Our offset within mapping. */ @@ -80,4 +85,135 @@ struct page { #endif /* WANT_PAGE_VIRTUAL */ }; +/* + * This struct defines a memory VMM memory area. There is one of these + * per VM-area/task. A VM area is any part of the process virtual memory + * space that has a special rule for the page-fault handlers (ie a shared + * library, the executable area etc). + */ +struct vm_area_struct { + struct mm_struct * vm_mm; /* The address space we belong to. */ + unsigned long vm_start; /* Our start address within vm_mm. */ + unsigned long vm_end; /* The first byte after our end address + within vm_mm. */ + + /* linked list of VM areas per task, sorted by address */ + struct vm_area_struct *vm_next; + + pgprot_t vm_page_prot; /* Access permissions of this VMA. */ + unsigned long vm_flags; /* Flags, listed below. */ + + struct rb_node vm_rb; + + /* + * For areas with an address space and backing store, + * linkage into the address_space->i_mmap prio tree, or + * linkage to the list of like vmas hanging off its node, or + * linkage of vma in the address_space->i_mmap_nonlinear list. + */ + union { + struct { + struct list_head list; + void *parent; /* aligns with prio_tree_node parent */ + struct vm_area_struct *head; + } vm_set; + + struct raw_prio_tree_node prio_tree_node; + } shared; + + /* + * A file's MAP_PRIVATE vma can be in both i_mmap tree and anon_vma + * list, after a COW of one of the file pages. A MAP_SHARED vma + * can only be in the i_mmap tree. An anonymous MAP_PRIVATE, stack + * or brk vma (with NULL file) can only be in an anon_vma list. + */ + struct list_head anon_vma_node; /* Serialized by anon_vma->lock */ + struct anon_vma *anon_vma; /* Serialized by page_table_lock */ + + /* Function pointers to deal with this struct. */ + struct vm_operations_struct * vm_ops; + + /* Information about our backing store: */ + unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE + units, *not* PAGE_CACHE_SIZE */ + struct file * vm_file; /* File we map to (can be NULL). */ + void * vm_private_data; /* was vm_pte (shared mem) */ + unsigned long vm_truncate_count;/* truncate_count or restart_addr */ + +#ifndef CONFIG_MMU + atomic_t vm_usage; /* refcount (VMAs shared if !MMU) */ +#endif +#ifdef CONFIG_NUMA + struct mempolicy *vm_policy; /* NUMA policy for the VMA */ +#endif +}; + +struct mm_struct { + struct vm_area_struct * mmap; /* list of VMAs */ + struct rb_root mm_rb; + struct vm_area_struct * mmap_cache; /* last find_vma result */ + unsigned long (*get_unmapped_area) (struct file *filp, + unsigned long addr, unsigned long len, + unsigned long pgoff, unsigned long flags); + void (*unmap_area) (struct mm_struct *mm, unsigned long addr); + unsigned long mmap_base; /* base of mmap area */ + unsigned long task_size; /* size of task vm space */ + unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ + unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */ + pgd_t * pgd; + atomic_t mm_users; /* How many users with user space? */ + atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ + int map_count; /* number of VMAs */ + struct rw_semaphore mmap_sem; + spinlock_t page_table_lock; /* Protects page tables and some counters */ + + struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung + * together off init_mm.mmlist, and are protected + * by mmlist_lock + */ + + /* Special counters, in some configurations protected by the + * page_table_lock, in other configurations by being atomic. + */ + mm_counter_t _file_rss; + mm_counter_t _anon_rss; + + unsigned long hiwater_rss; /* High-watermark of RSS usage */ + unsigned long hiwater_vm; /* High-water virtual memory usage */ + + unsigned long total_vm, locked_vm, shared_vm, exec_vm; + unsigned long stack_vm, reserved_vm, def_flags, nr_ptes; + unsigned long start_code, end_code, start_data, end_data; + unsigned long start_brk, brk, start_stack; + unsigned long arg_start, arg_end, env_start, env_end; + + unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ + + cpumask_t cpu_vm_mask; + + /* Architecture-specific MM context */ + mm_context_t context; + + /* Swap token stuff */ + /* + * Last value of global fault stamp as seen by this process. + * In other words, this value gives an indication of how long + * it has been since this task got the token. + * Look at mm/thrash.c + */ + unsigned int faultstamp; + unsigned int token_priority; + unsigned int last_interval; + + unsigned long flags; /* Must use atomic bitops to access the bits */ + + /* coredumping support */ + int core_waiters; + struct completion *core_startup_done, core_done; + + /* aio bits */ + rwlock_t ioctx_list_lock; + struct kioctx *ioctx_list; +}; + #endif /* _LINUX_MM_TYPES_H */ diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 4e5627379b0..f4bfe824834 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -13,6 +13,7 @@ #include <linux/init.h> #include <linux/seqlock.h> #include <linux/nodemask.h> +#include <linux/pageblock-flags.h> #include <asm/atomic.h> #include <asm/page.h> @@ -32,8 +33,29 @@ */ #define PAGE_ALLOC_COSTLY_ORDER 3 +#define MIGRATE_UNMOVABLE 0 +#define MIGRATE_RECLAIMABLE 1 +#define MIGRATE_MOVABLE 2 +#define MIGRATE_RESERVE 3 +#define MIGRATE_ISOLATE 4 /* can't allocate from here */ +#define MIGRATE_TYPES 5 + +#define for_each_migratetype_order(order, type) \ + for (order = 0; order < MAX_ORDER; order++) \ + for (type = 0; type < MIGRATE_TYPES; type++) + +extern int page_group_by_mobility_disabled; + +static inline int get_pageblock_migratetype(struct page *page) +{ + if (unlikely(page_group_by_mobility_disabled)) + return MIGRATE_UNMOVABLE; + + return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); +} + struct free_area { - struct list_head free_list; + struct list_head free_list[MIGRATE_TYPES]; unsigned long nr_free; }; @@ -222,6 +244,14 @@ struct zone { #endif struct free_area free_area[MAX_ORDER]; +#ifndef CONFIG_SPARSEMEM + /* + * Flags for a pageblock_nr_pages block. See pageblock-flags.h. + * In SPARSEMEM, this map is stored in struct mem_section + */ + unsigned long *pageblock_flags; +#endif /* CONFIG_SPARSEMEM */ + ZONE_PADDING(_pad1_) @@ -324,6 +354,17 @@ struct zone { #define MAX_ZONES_PER_ZONELIST (MAX_NUMNODES * MAX_NR_ZONES) #ifdef CONFIG_NUMA + +/* + * The NUMA zonelists are doubled becausse we need zonelists that restrict the + * allocations to a single node for GFP_THISNODE. + * + * [0 .. MAX_NR_ZONES -1] : Zonelists with fallback + * [MAZ_NR_ZONES ... MAZ_ZONELISTS -1] : No fallback (GFP_THISNODE) + */ +#define MAX_ZONELISTS (2 * MAX_NR_ZONES) + + /* * We cache key information from each zonelist for smaller cache * footprint when scanning for free pages in get_page_from_freelist(). @@ -389,6 +430,7 @@ struct zonelist_cache { unsigned long last_full_zap; /* when last zap'd (jiffies) */ }; #else +#define MAX_ZONELISTS MAX_NR_ZONES struct zonelist_cache; #endif @@ -455,7 +497,7 @@ extern struct page *mem_map; struct bootmem_data; typedef struct pglist_data { struct zone node_zones[MAX_NR_ZONES]; - struct zonelist node_zonelists[MAX_NR_ZONES]; + struct zonelist node_zonelists[MAX_ZONELISTS]; int nr_zones; #ifdef CONFIG_FLAT_NODE_MEM_MAP struct page *node_mem_map; @@ -708,6 +750,9 @@ extern struct zone *next_zone(struct zone *zone); #define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT) #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) +#define SECTION_BLOCKFLAGS_BITS \ + ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS) + #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS #error Allocator MAX_ORDER exceeds SECTION_SIZE #endif @@ -727,6 +772,9 @@ struct mem_section { * before using it wrong. */ unsigned long section_mem_map; + + /* See declaration of similar field in struct zone */ + unsigned long *pageblock_flags; }; #ifdef CONFIG_SPARSEMEM_EXTREME @@ -771,12 +819,17 @@ static inline struct page *__section_mem_map_addr(struct mem_section *section) return (struct page *)map; } -static inline int valid_section(struct mem_section *section) +static inline int present_section(struct mem_section *section) { return (section && (section->section_mem_map & SECTION_MARKED_PRESENT)); } -static inline int section_has_mem_map(struct mem_section *section) +static inline int present_section_nr(unsigned long nr) +{ + return present_section(__nr_to_section(nr)); +} + +static inline int valid_section(struct mem_section *section) { return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP)); } @@ -798,6 +851,13 @@ static inline int pfn_valid(unsigned long pfn) return valid_section(__nr_to_section(pfn_to_section_nr(pfn))); } +static inline int pfn_present(unsigned long pfn) +{ + if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) + return 0; + return present_section(__nr_to_section(pfn_to_section_nr(pfn))); +} + /* * These are _only_ used during initialisation, therefore they * can use __initdata ... They could have names to indicate diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index 5cd19246909..bcb7abafbca 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h @@ -127,17 +127,9 @@ void nfsd_export_shutdown(void); void nfsd_export_flush(void); void exp_readlock(void); void exp_readunlock(void); -struct svc_export * exp_get_by_name(struct auth_domain *clp, - struct vfsmount *mnt, - struct dentry *dentry, - struct cache_req *reqp); struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, struct vfsmount *, struct dentry *); -struct svc_export * exp_parent(struct auth_domain *clp, - struct vfsmount *mnt, - struct dentry *dentry, - struct cache_req *reqp); struct svc_export * rqst_exp_parent(struct svc_rqst *, struct vfsmount *mnt, struct dentry *dentry); @@ -157,9 +149,6 @@ static inline void exp_get(struct svc_export *exp) { cache_get(&exp->h); } -extern struct svc_export * -exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv, - struct cache_req *reqp); struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *); #endif /* __KERNEL__ */ diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 52c54a5720f..905e18f4b41 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -338,31 +338,88 @@ static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp, #endif /* MAX_NUMNODES */ /* + * Bitmasks that are kept for all the nodes. + */ +enum node_states { + N_POSSIBLE, /* The node could become online at some point */ + N_ONLINE, /* The node is online */ + N_NORMAL_MEMORY, /* The node has regular memory */ +#ifdef CONFIG_HIGHMEM + N_HIGH_MEMORY, /* The node has regular or high memory */ +#else + N_HIGH_MEMORY = N_NORMAL_MEMORY, +#endif + N_CPU, /* The node has one or more cpus */ + NR_NODE_STATES +}; + +/* * The following particular system nodemasks and operations * on them manage all possible and online nodes. */ -extern nodemask_t node_online_map; -extern nodemask_t node_possible_map; +extern nodemask_t node_states[NR_NODE_STATES]; #if MAX_NUMNODES > 1 -#define num_online_nodes() nodes_weight(node_online_map) -#define num_possible_nodes() nodes_weight(node_possible_map) -#define node_online(node) node_isset((node), node_online_map) -#define node_possible(node) node_isset((node), node_possible_map) -#define first_online_node first_node(node_online_map) -#define next_online_node(nid) next_node((nid), node_online_map) +static inline int node_state(int node, enum node_states state) +{ + return node_isset(node, node_states[state]); +} + +static inline void node_set_state(int node, enum node_states state) +{ + __node_set(node, &node_states[state]); +} + +static inline void node_clear_state(int node, enum node_states state) +{ + __node_clear(node, &node_states[state]); +} + +static inline int num_node_state(enum node_states state) +{ + return nodes_weight(node_states[state]); +} + +#define for_each_node_state(__node, __state) \ + for_each_node_mask((__node), node_states[__state]) + +#define first_online_node first_node(node_states[N_ONLINE]) +#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) + extern int nr_node_ids; #else -#define num_online_nodes() 1 -#define num_possible_nodes() 1 -#define node_online(node) ((node) == 0) -#define node_possible(node) ((node) == 0) + +static inline int node_state(int node, enum node_states state) +{ + return node == 0; +} + +static inline void node_set_state(int node, enum node_states state) +{ +} + +static inline void node_clear_state(int node, enum node_states state) +{ +} + +static inline int num_node_state(enum node_states state) +{ + return 1; +} + +#define for_each_node_state(node, __state) \ + for ( (node) = 0; (node) == 0; (node) = 1) + #define first_online_node 0 #define next_online_node(nid) (MAX_NUMNODES) #define nr_node_ids 1 + #endif +#define node_online_map node_states[N_ONLINE] +#define node_possible_map node_states[N_POSSIBLE] + #define any_online_node(mask) \ ({ \ int node; \ @@ -372,10 +429,15 @@ extern int nr_node_ids; node; \ }) -#define node_set_online(node) set_bit((node), node_online_map.bits) -#define node_set_offline(node) clear_bit((node), node_online_map.bits) +#define num_online_nodes() num_node_state(N_ONLINE) +#define num_possible_nodes() num_node_state(N_POSSIBLE) +#define node_online(node) node_state((node), N_ONLINE) +#define node_possible(node) node_state((node), N_POSSIBLE) + +#define node_set_online(node) node_set_state((node), N_ONLINE) +#define node_set_offline(node) node_clear_state((node), N_ONLINE) -#define for_each_node(node) for_each_node_mask((node), node_possible_map) -#define for_each_online_node(node) for_each_node_mask((node), node_online_map) +#define for_each_node(node) for_each_node_state(node, N_POSSIBLE) +#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) #endif /* __LINUX_NODEMASK_H */ diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h new file mode 100644 index 00000000000..051c1b1ede4 --- /dev/null +++ b/include/linux/page-isolation.h @@ -0,0 +1,37 @@ +#ifndef __LINUX_PAGEISOLATION_H +#define __LINUX_PAGEISOLATION_H + +/* + * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. + * If specified range includes migrate types other than MOVABLE, + * this will fail with -EBUSY. + * + * For isolating all pages in the range finally, the caller have to + * free all pages in the range. test_page_isolated() can be used for + * test it. + */ +extern int +start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn); + +/* + * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. + * target range is [start_pfn, end_pfn) + */ +extern int +undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn); + +/* + * test all pages in [start_pfn, end_pfn)are isolated or not. + */ +extern int +test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn); + +/* + * Internal funcs.Changes pageblock's migrate type. + * Please use make_pagetype_isolated()/make_pagetype_movable(). + */ +extern int set_migratetype_isolate(struct page *page); +extern void unset_migratetype_isolate(struct page *page); + + +#endif diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h new file mode 100644 index 00000000000..e875905f7b1 --- /dev/null +++ b/include/linux/pageblock-flags.h @@ -0,0 +1,75 @@ +/* + * Macros for manipulating and testing flags related to a + * pageblock_nr_pages number of pages. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright (C) IBM Corporation, 2006 + * + * Original author, Mel Gorman + * Major cleanups and reduction of bit operations, Andy Whitcroft + */ +#ifndef PAGEBLOCK_FLAGS_H +#define PAGEBLOCK_FLAGS_H + +#include <linux/types.h> + +/* Macro to aid the definition of ranges of bits */ +#define PB_range(name, required_bits) \ + name, name ## _end = (name + required_bits) - 1 + +/* Bit indices that affect a whole block of pages */ +enum pageblock_bits { + PB_range(PB_migrate, 3), /* 3 bits required for migrate types */ + NR_PAGEBLOCK_BITS +}; + +#ifdef CONFIG_HUGETLB_PAGE + +#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE + +/* Huge page sizes are variable */ +extern int pageblock_order; + +#else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ + +/* Huge pages are a constant size */ +#define pageblock_order HUGETLB_PAGE_ORDER + +#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ + +#else /* CONFIG_HUGETLB_PAGE */ + +/* If huge pages are not used, group by MAX_ORDER_NR_PAGES */ +#define pageblock_order (MAX_ORDER-1) + +#endif /* CONFIG_HUGETLB_PAGE */ + +#define pageblock_nr_pages (1UL << pageblock_order) + +/* Forward declaration */ +struct page; + +/* Declarations for getting and setting flags. See mm/page_alloc.c */ +unsigned long get_pageblock_flags_group(struct page *page, + int start_bitidx, int end_bitidx); +void set_pageblock_flags_group(struct page *page, unsigned long flags, + int start_bitidx, int end_bitidx); + +#define get_pageblock_flags(page) \ + get_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) +#define set_pageblock_flags(page) \ + set_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) + +#endif /* PAGEBLOCK_FLAGS_H */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 8a83537d697..db8a410ae9e 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -84,11 +84,11 @@ static inline struct page *page_cache_alloc_cold(struct address_space *x) typedef int filler_t(void *, struct page *); extern struct page * find_get_page(struct address_space *mapping, - unsigned long index); + pgoff_t index); extern struct page * find_lock_page(struct address_space *mapping, - unsigned long index); + pgoff_t index); extern struct page * find_or_create_page(struct address_space *mapping, - unsigned long index, gfp_t gfp_mask); + pgoff_t index, gfp_t gfp_mask); unsigned find_get_pages(struct address_space *mapping, pgoff_t start, unsigned int nr_pages, struct page **pages); unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, @@ -96,44 +96,47 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index, int tag, unsigned int nr_pages, struct page **pages); +struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index); + /* * Returns locked page at given index in given cache, creating it if needed. */ -static inline struct page *grab_cache_page(struct address_space *mapping, unsigned long index) +static inline struct page *grab_cache_page(struct address_space *mapping, + pgoff_t index) { return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); } extern struct page * grab_cache_page_nowait(struct address_space *mapping, - unsigned long index); + pgoff_t index); extern struct page * read_cache_page_async(struct address_space *mapping, - unsigned long index, filler_t *filler, + pgoff_t index, filler_t *filler, void *data); extern struct page * read_cache_page(struct address_space *mapping, - unsigned long index, filler_t *filler, + pgoff_t index, filler_t *filler, void *data); extern int read_cache_pages(struct address_space *mapping, struct list_head *pages, filler_t *filler, void *data); static inline struct page *read_mapping_page_async( struct address_space *mapping, - unsigned long index, void *data) + pgoff_t index, void *data) { filler_t *filler = (filler_t *)mapping->a_ops->readpage; return read_cache_page_async(mapping, index, filler, data); } static inline struct page *read_mapping_page(struct address_space *mapping, - unsigned long index, void *data) + pgoff_t index, void *data) { filler_t *filler = (filler_t *)mapping->a_ops->readpage; return read_cache_page(mapping, index, filler, data); } int add_to_page_cache(struct page *page, struct address_space *mapping, - unsigned long index, gfp_t gfp_mask); + pgoff_t index, gfp_t gfp_mask); int add_to_page_cache_lru(struct page *page, struct address_space *mapping, - unsigned long index, gfp_t gfp_mask); + pgoff_t index, gfp_t gfp_mask); extern void remove_from_page_cache(struct page *page); extern void __remove_from_page_cache(struct page *page); @@ -218,6 +221,9 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size) { int ret; + if (unlikely(size == 0)) + return 0; + /* * Writing zeroes into userspace here is OK, because we know that if * the zero gets there, we'll be overwriting it. @@ -237,19 +243,23 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size) return ret; } -static inline void fault_in_pages_readable(const char __user *uaddr, int size) +static inline int fault_in_pages_readable(const char __user *uaddr, int size) { volatile char c; int ret; + if (unlikely(size == 0)) + return 0; + ret = __get_user(c, uaddr); if (ret == 0) { const char __user *end = uaddr + size - 1; if (((unsigned long)uaddr & PAGE_MASK) != ((unsigned long)end & PAGE_MASK)) - __get_user(c, end); + ret = __get_user(c, end); } + return ret; } #endif /* _LINUX_PAGEMAP_H */ diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 2c49561f9b4..df948b44eda 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1995,6 +1995,8 @@ #define PCI_VENDOR_ID_TOPIC 0x151f #define PCI_DEVICE_ID_TOPIC_TP560 0x0000 +#define PCI_VENDOR_ID_MAINPINE 0x1522 +#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100 #define PCI_VENDOR_ID_ENE 0x1524 #define PCI_DEVICE_ID_ENE_CB712_SD 0x0550 #define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551 @@ -2324,6 +2326,8 @@ #define PCI_DEVICE_ID_INTEL_MCH_PC 0x3599 #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e +#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b +#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff #define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 #define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index f9e77d2ee32..b6116b4445c 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -26,28 +26,31 @@ #include <linux/rcupdate.h> /* - * A direct pointer (root->rnode pointing directly to a data item, - * rather than another radix_tree_node) is signalled by the low bit - * set in the root->rnode pointer. + * An indirect pointer (root->rnode pointing to a radix_tree_node, rather + * than a data item) is signalled by the low bit set in the root->rnode + * pointer. * - * In this case root->height is also NULL, but the direct pointer tests are - * needed for RCU lookups when root->height is unreliable. + * In this case root->height is > 0, but the indirect pointer tests are + * needed for RCU lookups (because root->height is unreliable). The only + * time callers need worry about this is when doing a lookup_slot under + * RCU. */ -#define RADIX_TREE_DIRECT_PTR 1 +#define RADIX_TREE_INDIRECT_PTR 1 +#define RADIX_TREE_RETRY ((void *)-1UL) -static inline void *radix_tree_ptr_to_direct(void *ptr) +static inline void *radix_tree_ptr_to_indirect(void *ptr) { - return (void *)((unsigned long)ptr | RADIX_TREE_DIRECT_PTR); + return (void *)((unsigned long)ptr | RADIX_TREE_INDIRECT_PTR); } -static inline void *radix_tree_direct_to_ptr(void *ptr) +static inline void *radix_tree_indirect_to_ptr(void *ptr) { - return (void *)((unsigned long)ptr & ~RADIX_TREE_DIRECT_PTR); + return (void *)((unsigned long)ptr & ~RADIX_TREE_INDIRECT_PTR); } -static inline int radix_tree_is_direct_ptr(void *ptr) +static inline int radix_tree_is_indirect_ptr(void *ptr) { - return (int)((unsigned long)ptr & RADIX_TREE_DIRECT_PTR); + return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR); } /*** radix-tree API starts here ***/ @@ -130,7 +133,10 @@ do { \ */ static inline void *radix_tree_deref_slot(void **pslot) { - return radix_tree_direct_to_ptr(*pslot); + void *ret = *pslot; + if (unlikely(radix_tree_is_indirect_ptr(ret))) + ret = RADIX_TREE_RETRY; + return ret; } /** * radix_tree_replace_slot - replace item in a slot @@ -142,10 +148,8 @@ static inline void *radix_tree_deref_slot(void **pslot) */ static inline void radix_tree_replace_slot(void **pslot, void *item) { - BUG_ON(radix_tree_is_direct_ptr(item)); - rcu_assign_pointer(*pslot, - (void *)((unsigned long)item | - ((unsigned long)*pslot & RADIX_TREE_DIRECT_PTR))); + BUG_ON(radix_tree_is_indirect_ptr(item)); + rcu_assign_pointer(*pslot, item); } int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); @@ -155,6 +159,8 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long); unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results, unsigned long first_index, unsigned int max_items); +unsigned long radix_tree_next_hole(struct radix_tree_root *root, + unsigned long index, unsigned long max_scan); int radix_tree_preload(gfp_t gfp_mask); void radix_tree_init(void); void *radix_tree_tag_set(struct radix_tree_root *root, diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 4efbd9c445f..2dc7464cce5 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -20,4 +20,88 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf, sg_set_buf(sg, buf, buflen); } +/* + * We overload the LSB of the page pointer to indicate whether it's + * a valid sg entry, or whether it points to the start of a new scatterlist. + * Those low bits are there for everyone! (thanks mason :-) + */ +#define sg_is_chain(sg) ((unsigned long) (sg)->page & 0x01) +#define sg_chain_ptr(sg) \ + ((struct scatterlist *) ((unsigned long) (sg)->page & ~0x01)) + +/** + * sg_next - return the next scatterlist entry in a list + * @sg: The current sg entry + * + * Usually the next entry will be @sg@ + 1, but if this sg element is part + * of a chained scatterlist, it could jump to the start of a new + * scatterlist array. + * + * Note that the caller must ensure that there are further entries after + * the current entry, this function will NOT return NULL for an end-of-list. + * + */ +static inline struct scatterlist *sg_next(struct scatterlist *sg) +{ + sg++; + + if (unlikely(sg_is_chain(sg))) + sg = sg_chain_ptr(sg); + + return sg; +} + +/* + * Loop over each sg element, following the pointer to a new list if necessary + */ +#define for_each_sg(sglist, sg, nr, __i) \ + for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg)) + +/** + * sg_last - return the last scatterlist entry in a list + * @sgl: First entry in the scatterlist + * @nents: Number of entries in the scatterlist + * + * Should only be used casually, it (currently) scan the entire list + * to get the last entry. + * + * Note that the @sgl@ pointer passed in need not be the first one, + * the important bit is that @nents@ denotes the number of entries that + * exist from @sgl@. + * + */ +static inline struct scatterlist *sg_last(struct scatterlist *sgl, + unsigned int nents) +{ +#ifndef ARCH_HAS_SG_CHAIN + struct scatterlist *ret = &sgl[nents - 1]; +#else + struct scatterlist *sg, *ret = NULL; + int i; + + for_each_sg(sgl, sg, nents, i) + ret = sg; + +#endif + return ret; +} + +/** + * sg_chain - Chain two sglists together + * @prv: First scatterlist + * @prv_nents: Number of entries in prv + * @sgl: Second scatterlist + * + * Links @prv@ and @sgl@ together, to form a longer scatterlist. + * + */ +static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, + struct scatterlist *sgl) +{ +#ifndef ARCH_HAS_SG_CHAIN + BUG(); +#endif + prv[prv_nents - 1].page = (struct page *) ((unsigned long) sgl | 0x01); +} + #endif /* _LINUX_SCATTERLIST_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 228e0a8ce24..592e3a55f81 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1,8 +1,6 @@ #ifndef _LINUX_SCHED_H #define _LINUX_SCHED_H -#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ - /* * cloning flags: */ @@ -58,12 +56,12 @@ struct sched_param { #include <linux/cpumask.h> #include <linux/errno.h> #include <linux/nodemask.h> +#include <linux/mm_types.h> #include <asm/system.h> #include <asm/semaphore.h> #include <asm/page.h> #include <asm/ptrace.h> -#include <asm/mmu.h> #include <asm/cputime.h> #include <linux/smp.h> @@ -319,7 +317,6 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); #define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member) #define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) #define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) -typedef atomic_long_t mm_counter_t; #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ /* @@ -331,7 +328,6 @@ typedef atomic_long_t mm_counter_t; #define add_mm_counter(mm, member, value) (mm)->_##member += (value) #define inc_mm_counter(mm, member) (mm)->_##member++ #define dec_mm_counter(mm, member) (mm)->_##member-- -typedef unsigned long mm_counter_t; #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ @@ -368,74 +364,6 @@ extern int get_dumpable(struct mm_struct *mm); #define MMF_DUMP_FILTER_DEFAULT \ ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED)) -struct mm_struct { - struct vm_area_struct * mmap; /* list of VMAs */ - struct rb_root mm_rb; - struct vm_area_struct * mmap_cache; /* last find_vma result */ - unsigned long (*get_unmapped_area) (struct file *filp, - unsigned long addr, unsigned long len, - unsigned long pgoff, unsigned long flags); - void (*unmap_area) (struct mm_struct *mm, unsigned long addr); - unsigned long mmap_base; /* base of mmap area */ - unsigned long task_size; /* size of task vm space */ - unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ - unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */ - pgd_t * pgd; - atomic_t mm_users; /* How many users with user space? */ - atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ - int map_count; /* number of VMAs */ - struct rw_semaphore mmap_sem; - spinlock_t page_table_lock; /* Protects page tables and some counters */ - - struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung - * together off init_mm.mmlist, and are protected - * by mmlist_lock - */ - - /* Special counters, in some configurations protected by the - * page_table_lock, in other configurations by being atomic. - */ - mm_counter_t _file_rss; - mm_counter_t _anon_rss; - - unsigned long hiwater_rss; /* High-watermark of RSS usage */ - unsigned long hiwater_vm; /* High-water virtual memory usage */ - - unsigned long total_vm, locked_vm, shared_vm, exec_vm; - unsigned long stack_vm, reserved_vm, def_flags, nr_ptes; - unsigned long start_code, end_code, start_data, end_data; - unsigned long start_brk, brk, start_stack; - unsigned long arg_start, arg_end, env_start, env_end; - - unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ - - cpumask_t cpu_vm_mask; - - /* Architecture-specific MM context */ - mm_context_t context; - - /* Swap token stuff */ - /* - * Last value of global fault stamp as seen by this process. - * In other words, this value gives an indication of how long - * it has been since this task got the token. - * Look at mm/thrash.c - */ - unsigned int faultstamp; - unsigned int token_priority; - unsigned int last_interval; - - unsigned long flags; /* Must use atomic bitops to access the bits */ - - /* coredumping support */ - int core_waiters; - struct completion *core_startup_done, core_done; - - /* aio bits */ - rwlock_t ioctx_list_lock; - struct kioctx *ioctx_list; -}; - struct sighand_struct { atomic_t count; struct k_sigaction action[_NSIG]; @@ -801,9 +729,6 @@ struct sched_domain { #endif }; -extern int partition_sched_domains(cpumask_t *partition1, - cpumask_t *partition2); - #endif /* CONFIG_SMP */ /* diff --git a/include/linux/selection.h b/include/linux/selection.h index f9457861937..8cdaa1151d2 100644 --- a/include/linux/selection.h +++ b/include/linux/selection.h @@ -13,6 +13,7 @@ struct tty_struct; extern struct vc_data *sel_cons; +struct tty_struct; extern void clear_selection(void); extern int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty); diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 09d17b06bf0..4db77249281 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -291,7 +291,8 @@ struct uart_port { resource_size_t mapbase; /* for ioremap */ struct device *dev; /* parent device */ unsigned char hub6; /* this should be in the 8250 driver */ - unsigned char unused[3]; + unsigned char suspended; + unsigned char unused[2]; void *private_data; /* generic platform data pointer */ }; diff --git a/include/linux/slab.h b/include/linux/slab.h index d859354b9e5..3a5bad3ad12 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -24,12 +24,14 @@ #define SLAB_HWCACHE_ALIGN 0x00002000UL /* Align objs on cache lines */ #define SLAB_CACHE_DMA 0x00004000UL /* Use GFP_DMA memory */ #define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */ -#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ #define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */ #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ +/* 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 */ /* * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. * diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 74962077f63..d65159d1d4f 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -11,6 +11,14 @@ #include <linux/workqueue.h> #include <linux/kobject.h> +struct kmem_cache_cpu { + void **freelist; + struct page *page; + int node; + unsigned int offset; + unsigned int objsize; +}; + struct kmem_cache_node { spinlock_t list_lock; /* Protect partial list and nr_partial */ unsigned long nr_partial; @@ -54,7 +62,11 @@ struct kmem_cache { int defrag_ratio; struct kmem_cache_node *node[MAX_NUMNODES]; #endif - struct page *cpu_slab[NR_CPUS]; +#ifdef CONFIG_SMP + struct kmem_cache_cpu *cpu_slab[NR_CPUS]; +#else + struct kmem_cache_cpu cpu_slab; +#endif }; /* @@ -72,7 +84,7 @@ struct kmem_cache { * We keep the general caches in an array of slab caches that are used for * 2^x bytes of allocations. */ -extern struct kmem_cache kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; +extern struct kmem_cache kmalloc_caches[PAGE_SHIFT]; /* * Sorry that the following has to be that ugly but some versions of GCC @@ -83,9 +95,6 @@ static __always_inline int kmalloc_index(size_t size) if (!size) return 0; - if (size > KMALLOC_MAX_SIZE) - return -1; - if (size <= KMALLOC_MIN_SIZE) return KMALLOC_SHIFT_LOW; @@ -102,6 +111,10 @@ static __always_inline int kmalloc_index(size_t size) if (size <= 512) return 9; if (size <= 1024) return 10; if (size <= 2 * 1024) return 11; +/* + * The following is only needed to support architectures with a larger page + * size than 4k. + */ if (size <= 4 * 1024) return 12; if (size <= 8 * 1024) return 13; if (size <= 16 * 1024) return 14; @@ -109,13 +122,9 @@ static __always_inline int kmalloc_index(size_t size) if (size <= 64 * 1024) return 16; if (size <= 128 * 1024) return 17; if (size <= 256 * 1024) return 18; - if (size <= 512 * 1024) return 19; + if (size <= 512 * 1024) return 19; if (size <= 1024 * 1024) return 20; if (size <= 2 * 1024 * 1024) return 21; - if (size <= 4 * 1024 * 1024) return 22; - if (size <= 8 * 1024 * 1024) return 23; - if (size <= 16 * 1024 * 1024) return 24; - if (size <= 32 * 1024 * 1024) return 25; return -1; /* @@ -140,19 +149,6 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size) if (index == 0) return NULL; - /* - * This function only gets expanded if __builtin_constant_p(size), so - * testing it here shouldn't be needed. But some versions of gcc need - * help. - */ - if (__builtin_constant_p(size) && index < 0) { - /* - * Generate a link failure. Would be great if we could - * do something to stop the compile here. - */ - extern void __kmalloc_size_too_large(void); - __kmalloc_size_too_large(); - } return &kmalloc_caches[index]; } @@ -168,15 +164,21 @@ void *__kmalloc(size_t size, gfp_t flags); static __always_inline void *kmalloc(size_t size, gfp_t flags) { - if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) { - struct kmem_cache *s = kmalloc_slab(size); + if (__builtin_constant_p(size)) { + if (size > PAGE_SIZE / 2) + return (void *)__get_free_pages(flags | __GFP_COMP, + get_order(size)); - if (!s) - return ZERO_SIZE_PTR; + if (!(flags & SLUB_DMA)) { + struct kmem_cache *s = kmalloc_slab(size); - return kmem_cache_alloc(s, flags); - } else - return __kmalloc(size, flags); + if (!s) + return ZERO_SIZE_PTR; + + return kmem_cache_alloc(s, flags); + } + } + return __kmalloc(size, flags); } #ifdef CONFIG_NUMA @@ -185,15 +187,16 @@ void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) { - if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) { - struct kmem_cache *s = kmalloc_slab(size); + if (__builtin_constant_p(size) && + size <= PAGE_SIZE / 2 && !(flags & SLUB_DMA)) { + struct kmem_cache *s = kmalloc_slab(size); if (!s) return ZERO_SIZE_PTR; return kmem_cache_alloc_node(s, flags, node); - } else - return __kmalloc_node(size, flags, node); + } + return __kmalloc_node(size, flags, node); } #endif diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h index 014e73b31fc..df7620dd8f3 100644 --- a/include/linux/sm501-regs.h +++ b/include/linux/sm501-regs.h @@ -15,6 +15,24 @@ /* config 1 */ #define SM501_SYSTEM_CONTROL (0x000000) + +#define SM501_SYSCTRL_PANEL_TRISTATE (1<<0) +#define SM501_SYSCTRL_MEM_TRISTATE (1<<1) +#define SM501_SYSCTRL_CRT_TRISTATE (1<<2) + +#define SM501_SYSCTRL_PCI_SLAVE_BURST_MASK (3<<4) +#define SM501_SYSCTRL_PCI_SLAVE_BURST_1 (0<<4) +#define SM501_SYSCTRL_PCI_SLAVE_BURST_2 (1<<4) +#define SM501_SYSCTRL_PCI_SLAVE_BURST_4 (2<<4) +#define SM501_SYSCTRL_PCI_SLAVE_BURST_8 (3<<4) + +#define SM501_SYSCTRL_PCI_CLOCK_RUN_EN (1<<6) +#define SM501_SYSCTRL_PCI_RETRY_DISABLE (1<<7) +#define SM501_SYSCTRL_PCI_SUBSYS_LOCK (1<<11) +#define SM501_SYSCTRL_PCI_BURST_READ_EN (1<<15) + +/* miscellaneous control */ + #define SM501_MISC_CONTROL (0x000004) #define SM501_MISC_BUS_SH (0x0) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 002a3cddbdd..387e428f1cd 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -195,7 +195,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) /** * struct spi_master - interface to SPI master controller - * @cdev: class interface to this driver + * @dev: device interface to this driver * @bus_num: board-specific (and often SOC-specific) identifier for a * given SPI controller. * @num_chipselect: chipselects are used to distinguish individual @@ -222,7 +222,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * message's completion function when the transaction completes. */ struct spi_master { - struct class_device cdev; + struct device dev; /* other than negative (== assign one dynamically), bus_num is fully * board-specific. usually that simplifies to being SOC-specific. @@ -268,17 +268,17 @@ struct spi_master { static inline void *spi_master_get_devdata(struct spi_master *master) { - return class_get_devdata(&master->cdev); + return dev_get_drvdata(&master->dev); } static inline void spi_master_set_devdata(struct spi_master *master, void *data) { - class_set_devdata(&master->cdev, data); + dev_set_drvdata(&master->dev, data); } static inline struct spi_master *spi_master_get(struct spi_master *master) { - if (!master || !class_device_get(&master->cdev)) + if (!master || !get_device(&master->dev)) return NULL; return master; } @@ -286,7 +286,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master) static inline void spi_master_put(struct spi_master *master) { if (master) - class_device_put(&master->cdev); + put_device(&master->dev); } diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 46705e91573..c1527c2ef3c 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -481,7 +481,7 @@ static inline void *get_gadget_data (struct usb_gadget *gadget) /** * gadget_is_dualspeed - return true iff the hardware handles high speed - * @gadget: controller that might support both high and full speeds + * @g: controller that might support both high and full speeds */ static inline int gadget_is_dualspeed(struct usb_gadget *g) { @@ -497,7 +497,7 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g) /** * gadget_is_otg - return true iff the hardware is OTG-ready - * @gadget: controller that might have a Mini-AB connector + * @g: controller that might have a Mini-AB connector * * This is a runtime test, since kernels with a USB-OTG stack sometimes * run on boards which only have a Mini-B (or Mini-A) connector. diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 90ef552c42d..f047a1fd64f 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -184,6 +184,7 @@ struct pcmcia_device { char * prod_id[4]; + u64 dma_mask; struct device dev; #ifdef CONFIG_PCMCIA_IOCTL diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 9f8f80ab0c8..702fcfeb37f 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -11,13 +11,6 @@ #include <linux/types.h> /* - * The maximum sg list length SCSI can cope with - * (currently must be a power of 2 between 32 and 256) - */ -#define SCSI_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS - - -/* * SCSI command lengths */ diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 65ab5145a09..3f47e522a1e 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -5,6 +5,7 @@ #include <linux/list.h> #include <linux/types.h> #include <linux/timer.h> +#include <linux/scatterlist.h> struct request; struct scatterlist; @@ -68,7 +69,7 @@ struct scsi_cmnd { /* These elements define the operation we ultimately want to perform */ unsigned short use_sg; /* Number of pieces of scatter-gather */ - unsigned short sglist_len; /* size of malloc'd scatter-gather list */ + unsigned short __use_sg; unsigned underflow; /* Return error if less than this amount is transferred */ @@ -128,7 +129,7 @@ extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count, extern void scsi_kunmap_atomic_sg(void *virt); extern struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *, gfp_t); -extern void scsi_free_sgtable(struct scatterlist *, int); +extern void scsi_free_sgtable(struct scsi_cmnd *); extern int scsi_dma_map(struct scsi_cmnd *cmd); extern void scsi_dma_unmap(struct scsi_cmnd *cmd); @@ -148,6 +149,6 @@ static inline int scsi_get_resid(struct scsi_cmnd *cmd) } #define scsi_for_each_sg(cmd, sg, nseg, __i) \ - for (__i = 0, sg = scsi_sglist(cmd); __i < (nseg); __i++, (sg)++) + for_each_sg(scsi_sglist(cmd), sg, nseg, __i) #endif /* _SCSI_SCSI_CMND_H */ diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 7d210cd6c38..0fd4746ee39 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -39,6 +39,9 @@ struct blk_queue_tags; #define DISABLE_CLUSTERING 0 #define ENABLE_CLUSTERING 1 +#define DISABLE_SG_CHAINING 0 +#define ENABLE_SG_CHAINING 1 + enum scsi_eh_timer_return { EH_NOT_HANDLED, EH_HANDLED, @@ -443,6 +446,15 @@ struct scsi_host_template { unsigned ordered_tag:1; /* + * true if the low-level driver can support sg chaining. this + * will be removed eventually when all the drivers are + * converted to support sg chaining. + * + * Status: OBSOLETE + */ + unsigned use_sg_chaining:1; + + /* * Countdown for host blocking with no commands outstanding */ unsigned int max_host_blocked; @@ -586,6 +598,7 @@ struct Scsi_Host { unsigned unchecked_isa_dma:1; unsigned use_clustering:1; unsigned use_blk_tcq:1; + unsigned use_sg_chaining:1; /* * Host has requested that no further requests come through for the diff --git a/include/video/Kbuild b/include/video/Kbuild index a14f9c045b8..53a6c7310e6 100644 --- a/include/video/Kbuild +++ b/include/video/Kbuild @@ -1 +1 @@ -unifdef-y += sisfb.h +unifdef-y += sisfb.h uvesafb.h diff --git a/include/video/mbxfb.h b/include/video/mbxfb.h index 20b9002712e..ea18961fc5e 100644 --- a/include/video/mbxfb.h +++ b/include/video/mbxfb.h @@ -29,18 +29,18 @@ struct mbxfb_platform_data { }; /* planar */ -#define MBXFB_FMT_YUV12 0 +#define MBXFB_FMT_YUV16 0 +#define MBXFB_FMT_YUV12 1 /* packed */ -#define MBXFB_FMT_UY0VY1 1 -#define MBXFB_FMT_VY0UY1 2 -#define MBXFB_FMT_Y0UY1V 3 -#define MBXFB_FMT_Y0VY1U 4 +#define MBXFB_FMT_UY0VY1 2 +#define MBXFB_FMT_VY0UY1 3 +#define MBXFB_FMT_Y0UY1V 4 +#define MBXFB_FMT_Y0VY1U 5 struct mbxfb_overlaySetup { __u32 enable; __u32 x, y; __u32 width, height; - __u32 alpha; __u32 fmt; __u32 mem_offset; __u32 scaled_width; @@ -54,6 +54,45 @@ struct mbxfb_overlaySetup { __u16 UV_stride; }; -#define MBXFB_IOCX_OVERLAY _IOWR(0xF4, 0x00,struct mbxfb_overlaySetup) +#define MBXFB_ALPHABLEND_NONE 0 +#define MBXFB_ALPHABLEND_GLOBAL 1 +#define MBXFB_ALPHABLEND_PIXEL 2 + +#define MBXFB_COLORKEY_DISABLED 0 +#define MBXFB_COLORKEY_PREVIOUS 1 +#define MBXFB_COLORKEY_CURRENT 2 +struct mbxfb_alphaCtl { + __u8 overlay_blend_mode; + __u8 overlay_colorkey_mode; + __u8 overlay_global_alpha; + __u32 overlay_colorkey; + __u32 overlay_colorkey_mask; + + __u8 graphics_blend_mode; + __u8 graphics_colorkey_mode; + __u8 graphics_global_alpha; + __u32 graphics_colorkey; + __u32 graphics_colorkey_mask; +}; + +#define MBXFB_PLANE_GRAPHICS 0 +#define MBXFB_PLANE_VIDEO 1 +struct mbxfb_planeorder { + __u8 bottom; + __u8 top; +}; + +struct mbxfb_reg { + __u32 addr; /* offset from 0x03fe 0000 */ + __u32 val; /* value */ + __u32 mask; /* which bits to touch (for write) */ +}; + +#define MBXFB_IOCX_OVERLAY _IOWR(0xF4, 0x00,struct mbxfb_overlaySetup) +#define MBXFB_IOCG_ALPHA _IOR(0xF4, 0x01,struct mbxfb_alphaCtl) +#define MBXFB_IOCS_ALPHA _IOW(0xF4, 0x02,struct mbxfb_alphaCtl) +#define MBXFB_IOCS_PLANEORDER _IOR(0xF4, 0x03,struct mbxfb_planeorder) +#define MBXFB_IOCS_REG _IOW(0xF4, 0x04,struct mbxfb_reg) +#define MBXFB_IOCX_REG _IOWR(0xF4, 0x05,struct mbxfb_reg) #endif /* __MBX_FB_H */ diff --git a/include/video/permedia2.h b/include/video/permedia2.h index 9e49c9571ec..9ce9adbfda2 100644 --- a/include/video/permedia2.h +++ b/include/video/permedia2.h @@ -58,7 +58,14 @@ #define PM2R_RD_PALETTE_DATA 0x4008 #define PM2R_RD_PIXEL_MASK 0x4010 #define PM2R_RD_PALETTE_READ_ADDRESS 0x4018 +#define PM2R_RD_CURSOR_COLOR_ADDRESS 0x4020 +#define PM2R_RD_CURSOR_COLOR_DATA 0x4028 #define PM2R_RD_INDEXED_DATA 0x4050 +#define PM2R_RD_CURSOR_DATA 0x4058 +#define PM2R_RD_CURSOR_X_LSB 0x4060 +#define PM2R_RD_CURSOR_X_MSB 0x4068 +#define PM2R_RD_CURSOR_Y_LSB 0x4070 +#define PM2R_RD_CURSOR_Y_MSB 0x4078 #define PM2R_START_X_DOM 0x8000 #define PM2R_D_X_DOM 0x8008 @@ -68,11 +75,14 @@ #define PM2R_D_Y 0x8028 #define PM2R_COUNT 0x8030 #define PM2R_RENDER 0x8038 +#define PM2R_BIT_MASK_PATTERN 0x8068 #define PM2R_RASTERIZER_MODE 0x80a0 #define PM2R_RECTANGLE_ORIGIN 0x80d0 #define PM2R_RECTANGLE_SIZE 0x80d8 #define PM2R_PACKED_DATA_LIMITS 0x8150 #define PM2R_SCISSOR_MODE 0x8180 +#define PM2R_SCISSOR_MIN_XY 0x8188 +#define PM2R_SCISSOR_MAX_XY 0x8190 #define PM2R_SCREEN_SIZE 0x8198 #define PM2R_AREA_STIPPLE_MODE 0x81a0 #define PM2R_WINDOW_ORIGIN 0x81c8 @@ -83,7 +93,9 @@ #define PM2R_TEXEL_LUT_MODE 0x8678 #define PM2R_TEXTURE_COLOR_MODE 0x8680 #define PM2R_FOG_MODE 0x8690 +#define PM2R_TEXEL0 0x8760 #define PM2R_COLOR_DDA_MODE 0x87e0 +#define PM2R_CONSTANT_COLOR 0x87e8 #define PM2R_ALPHA_BLEND_MODE 0x8810 #define PM2R_DITHER_MODE 0x8818 #define PM2R_FB_SOFT_WRITE_MASK 0x8820 @@ -148,6 +160,7 @@ #define PM2VI_RD_CURSOR_Y_HIGH 0x00A #define PM2VI_RD_CURSOR_X_HOT 0x00B #define PM2VI_RD_CURSOR_Y_HOT 0x00C +#define PM2VI_RD_OVERLAY_KEY 0x00D #define PM2VI_RD_CLK0_PRESCALE 0x201 #define PM2VI_RD_CLK0_FEEDBACK 0x202 #define PM2VI_RD_CLK0_POSTSCALE 0x203 @@ -169,6 +182,8 @@ #define PM2F_RENDER_TRAPEZOID (1L<<6) #define PM2F_RENDER_POINT (2L<<6) #define PM2F_RENDER_RECTANGLE (3L<<6) +#define PM2F_RENDER_SYNC_ON_BIT_MASK (1L<<11) +#define PM2F_RENDER_TEXTURE_ENABLE (1L<<13) #define PM2F_SYNCHRONIZATION (1L<<10) #define PM2F_PLL_LOCKED 0x10 #define PM2F_BEING_RESET (1L<<31) @@ -224,6 +239,8 @@ #define PM2F_APERTURE_STANDARD 0 #define PM2F_APERTURE_BYTESWAP 1 #define PM2F_APERTURE_HALFWORDSWAP 2 +#define PM2F_CURSORMODE_CURSOR_ENABLE (1 << 0) +#define PM2F_CURSORMODE_TYPE_X (1 << 4) typedef enum { PM2_TYPE_PERMEDIA2, diff --git a/include/video/pm3fb.h b/include/video/pm3fb.h index d52e45a1e9b..2b85134fe96 100644 --- a/include/video/pm3fb.h +++ b/include/video/pm3fb.h @@ -1,6 +1,6 @@ /* * linux/drivers/video/pm3fb.h -- 3DLabs Permedia3 frame buffer device - * + * * Copyright (C) 2001 Romain Dolbeau <dolbeau@irisa.fr> * Copyright (C) 2001 Sven Luther, <luther@dpt-info.u-strasbg.fr> * @@ -51,37 +51,36 @@ * GLINT Permedia3 Region 0 Bypass Controls * ***********************************************/ #define PM3ByAperture1Mode 0x0300 - #define PM3ByApertureMode_BYTESWAP_ABCD (0<<0) - #define PM3ByApertureMode_BYTESWAP_BADC (1<<0) - #define PM3ByApertureMode_BYTESWAP_CDAB (2<<0) - #define PM3ByApertureMode_BYTESWAP_DCBA (3<<0) - #define PM3ByApertureMode_PATCH_DISABLE (0<<2) - #define PM3ByApertureMode_PATCH_ENABLE (1<<2) - #define PM3ByApertureMode_FORMAT_RAW (0<<3) - #define PM3ByApertureMode_FORMAT_YUYV (1<<3) - #define PM3ByApertureMode_FORMAT_UYVY (2<<3) - #define PM3ByApertureMode_PIXELSIZE_8BIT (0<<5) - #define PM3ByApertureMode_PIXELSIZE_16BIT (1<<5) - #define PM3ByApertureMode_PIXELSIZE_32BIT (2<<5) - #define PM3ByApertureMode_PIXELSIZE_MASK (3<<5) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_1024 (0<<7) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_2048 (1<<7) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_4096 (2<<7) - #define PM3ByApertureMode_EFFECTIVE_STRIDE_8192 (3<<7) - #define PM3ByApertureMode_PATCH_OFFSET_X(off) (((off)&7f)<<9) - #define PM3ByApertureMode_PATCH_OFFSET_Y(off) (((off)&7f)<<16) - #define PM3ByApertureMode_FRAMEBUFFER (0<<21) - #define PM3ByApertureMode_LOCALBUFFER (1<<21) - #define PM3ByApertureMode_DOUBLE_WRITE_OFF (0<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_1MB (1<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_2MB (2<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_4MB (3<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_8MB (4<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_16MB (5<<22) - #define PM3ByApertureMode_DOUBLE_WRITE_32MB (6<<22) + #define PM3ByApertureMode_BYTESWAP_ABCD (0 << 0) + #define PM3ByApertureMode_BYTESWAP_BADC (1 << 0) + #define PM3ByApertureMode_BYTESWAP_CDAB (2 << 0) + #define PM3ByApertureMode_BYTESWAP_DCBA (3 << 0) + #define PM3ByApertureMode_PATCH_ENABLE (1 << 2) + #define PM3ByApertureMode_FORMAT_RAW (0 << 3) + #define PM3ByApertureMode_FORMAT_YUYV (1 << 3) + #define PM3ByApertureMode_FORMAT_UYVY (2 << 3) + #define PM3ByApertureMode_PIXELSIZE_8BIT (0 << 5) + #define PM3ByApertureMode_PIXELSIZE_16BIT (1 << 5) + #define PM3ByApertureMode_PIXELSIZE_32BIT (2 << 5) + #define PM3ByApertureMode_PIXELSIZE_MASK (3 << 5) + #define PM3ByApertureMode_EFFECTIVE_STRIDE_1024 (0 << 7) + #define PM3ByApertureMode_EFFECTIVE_STRIDE_2048 (1 << 7) + #define PM3ByApertureMode_EFFECTIVE_STRIDE_4096 (2 << 7) + #define PM3ByApertureMode_EFFECTIVE_STRIDE_8192 (3 << 7) + #define PM3ByApertureMode_PATCH_OFFSET_X(off) (((off) & 0x7f) << 9) + #define PM3ByApertureMode_PATCH_OFFSET_Y(off) (((off) & 0x7f) << 16) + #define PM3ByApertureMode_FRAMEBUFFER (0 << 21) + #define PM3ByApertureMode_LOCALBUFFER (1 << 21) + #define PM3ByApertureMode_DOUBLE_WRITE_OFF (0 << 22) + #define PM3ByApertureMode_DOUBLE_WRITE_1MB (1 << 22) + #define PM3ByApertureMode_DOUBLE_WRITE_2MB (2 << 22) + #define PM3ByApertureMode_DOUBLE_WRITE_4MB (3 << 22) + #define PM3ByApertureMode_DOUBLE_WRITE_8MB (4 << 22) + #define PM3ByApertureMode_DOUBLE_WRITE_16MB (5 << 22) + #define PM3ByApertureMode_DOUBLE_WRITE_32MB (6 << 22) #define PM3ByAperture2Mode 0x0328 - + /********************************************** * GLINT Permedia3 Memory Control (0x1000) * ***********************************************/ @@ -89,7 +88,7 @@ #define PM3MemBypassWriteMask 0x1008 #define PM3MemScratch 0x1010 #define PM3LocalMemCaps 0x1018 - #define PM3LocalMemCaps_NoWriteMask (1 << 28) + #define PM3LocalMemCaps_NoWriteMask (1 << 28) #define PM3LocalMemTimings 0x1020 #define PM3LocalMemControl 0x1028 #define PM3LocalMemRefresh 0x1030 @@ -112,45 +111,41 @@ #define PM3VsStart 0x3048 #define PM3VsEnd 0x3050 #define PM3VideoControl 0x3058 - #define PM3VideoControl_DISABLE (0<<0) - #define PM3VideoControl_ENABLE (1<<0) - #define PM3VideoControl_BLANK_ACTIVE_HIGH (0<<1) - #define PM3VideoControl_BLANK_ACTIVE_LOW (1<<1) - #define PM3VideoControl_LINE_DOUBLE_OFF (0<<2) - #define PM3VideoControl_LINE_DOUBLE_ON (1<<2) - #define PM3VideoControl_HSYNC_FORCE_HIGH (0<<3) - #define PM3VideoControl_HSYNC_ACTIVE_HIGH (1<<3) - #define PM3VideoControl_HSYNC_FORCE_LOW (2<<3) - #define PM3VideoControl_HSYNC_ACTIVE_LOW (3<<3) - #define PM3VideoControl_HSYNC_MASK (3<<3) - #define PM3VideoControl_VSYNC_FORCE_HIGH (0<<5) - #define PM3VideoControl_VSYNC_ACTIVE_HIGH (1<<5) - #define PM3VideoControl_VSYNC_FORCE_LOW (2<<5) - #define PM3VideoControl_VSYNC_ACTIVE_LOW (3<<5) - #define PM3VideoControl_VSYNC_MASK (3<<5) - #define PM3VideoControl_BYTE_DOUBLE_OFF (0<<7) - #define PM3VideoControl_BYTE_DOUBLE_ON (1<<7) - #define PM3VideoControl_BUFFER_SWAP_SYNCON_FRAMEBLANK (0<<9) - #define PM3VideoControl_BUFFER_SWAP_FREE_RUNNING (1<<9) - #define PM3VideoControl_BUFFER_SWAP_LIMITETO_FRAMERATE (2<<9) - #define PM3VideoControl_STEREO_DISABLE (0<<11) - #define PM3VideoControl_STEREO_ENABLE (1<<11) - #define PM3VideoControl_RIGHT_EYE_ACTIVE_HIGH (0<<12) - #define PM3VideoControl_RIGHT_EYE_ACTIVE_LOW (1<<12) - #define PM3VideoControl_VIDEO_EXT_LOW (0<<14) - #define PM3VideoControl_VIDEO_EXT_HIGH (1<<14) - #define PM3VideoControl_SYNC_MODE_INDEPENDENT (0<<16) - #define PM3VideoControl_SYNC_MODE_SYNCTO_VSA (1<<16) - #define PM3VideoControl_SYNC_MODE_SYNCTO_VSB (2<<16) - #define PM3VideoControl_PATCH_DISABLE (0<<18) - #define PM3VideoControl_PATCH_ENABLE (1<<18) - #define PM3VideoControl_PIXELSIZE_8BIT (0<<19) - #define PM3VideoControl_PIXELSIZE_16BIT (1<<19) - #define PM3VideoControl_PIXELSIZE_32BIT (2<<19) - #define PM3VideoControl_DISPLAY_DISABLE (0<<21) - #define PM3VideoControl_DISPLAY_ENABLE (1<<21) - #define PM3VideoControl_PATCH_OFFSET_X(off) (((off)&0x3f)<<22) - #define PM3VideoControl_PATCH_OFFSET_Y(off) (((off)&0x3f)<<28) + #define PM3VideoControl_ENABLE (1 << 0) + #define PM3VideoControl_BLANK_ACTIVE_HIGH (0 << 1) + #define PM3VideoControl_BLANK_ACTIVE_LOW (1 << 1) + #define PM3VideoControl_LINE_DOUBLE_OFF (0 << 2) + #define PM3VideoControl_LINE_DOUBLE_ON (1 << 2) + #define PM3VideoControl_HSYNC_FORCE_HIGH (0 << 3) + #define PM3VideoControl_HSYNC_ACTIVE_HIGH (1 << 3) + #define PM3VideoControl_HSYNC_FORCE_LOW (2 << 3) + #define PM3VideoControl_HSYNC_ACTIVE_LOW (3 << 3) + #define PM3VideoControl_HSYNC_MASK (3 << 3) + #define PM3VideoControl_VSYNC_FORCE_HIGH (0 << 5) + #define PM3VideoControl_VSYNC_ACTIVE_HIGH (1 << 5) + #define PM3VideoControl_VSYNC_FORCE_LOW (2 << 5) + #define PM3VideoControl_VSYNC_ACTIVE_LOW (3 << 5) + #define PM3VideoControl_VSYNC_MASK (3 << 5) + #define PM3VideoControl_BYTE_DOUBLE_OFF (0 << 7) + #define PM3VideoControl_BYTE_DOUBLE_ON (1 << 7) + #define PM3VideoControl_BUFFER_SWAP_SYNCON_FRAMEBLANK (0 << 9) + #define PM3VideoControl_BUFFER_SWAP_FREE_RUNNING (1 << 9) + #define PM3VideoControl_BUFFER_SWAP_LIMITETO_FRAMERATE (2 << 9) + #define PM3VideoControl_STEREO_ENABLE (1 << 11) + #define PM3VideoControl_RIGHT_EYE_ACTIVE_HIGH (0 << 12) + #define PM3VideoControl_RIGHT_EYE_ACTIVE_LOW (1 << 12) + #define PM3VideoControl_VIDEO_EXT_LOW (0 << 14) + #define PM3VideoControl_VIDEO_EXT_HIGH (1 << 14) + #define PM3VideoControl_SYNC_MODE_INDEPENDENT (0 << 16) + #define PM3VideoControl_SYNC_MODE_SYNCTO_VSA (1 << 16) + #define PM3VideoControl_SYNC_MODE_SYNCTO_VSB (2 << 16) + #define PM3VideoControl_PATCH_ENABLE (1 << 18) + #define PM3VideoControl_PIXELSIZE_8BIT (0 << 19) + #define PM3VideoControl_PIXELSIZE_16BIT (1 << 19) + #define PM3VideoControl_PIXELSIZE_32BIT (2 << 19) + #define PM3VideoControl_DISPLAY_ENABLE (1 << 21) + #define PM3VideoControl_PATCH_OFFSET_X(off) (((off) & 0x3f) << 22) + #define PM3VideoControl_PATCH_OFFSET_Y(off) (((off) & 0x3f) << 28) #define PM3InterruptLine 0x3060 #define PM3DisplayData 0x3068 #define PM3VerticalLineCount 0x3070 @@ -159,80 +154,93 @@ #define PM3MiscControl 0x3088 #define PM3VideoOverlayUpdate 0x3100 - #define PM3VideoOverlayUpdate_DISABLE (0<<0) - #define PM3VideoOverlayUpdate_ENABLE (1<<0) + #define PM3VideoOverlayUpdate_ENABLE (1 << 0) #define PM3VideoOverlayMode 0x3108 - #define PM3VideoOverlayMode_DISABLE (0<<0) - #define PM3VideoOverlayMode_ENABLE (1<<0) - #define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0<<1) - #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1<<1) - #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2<<1) - #define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0<<4) - #define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1<<4) - #define PM3VideoOverlayMode_PIXELSIZE_8BIT (0<<5) - #define PM3VideoOverlayMode_PIXELSIZE_16BIT (1<<5) - #define PM3VideoOverlayMode_PIXELSIZE_32BIT (2<<5) - #define PM3VideoOverlayMode_COLORFORMAT_RGB8888 ((0<<7)|(1<<12)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB4444 ((1<<7)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB5551 ((2<<7)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB565 ((3<<7)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_RGB332 ((4<<7)|(1<<12)|(0<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR8888 ((0<<7)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR4444 ((1<<7)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR5551 ((2<<7)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR565 ((3<<7)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_BGR332 ((4<<7)|(0<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_CI8 ((5<<7)|(1<<12)|(0<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_VUY444 ((2<<10)|(1<<12)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_YUV444 ((2<<10)|(2<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_VUY422 ((1<<10)|(1<<12)|(1<<5)) - #define PM3VideoOverlayMode_COLORFORMAT_YUV422 ((1<<10)|(1<<5)) - #define PM3VideoOverlayMode_COLORORDER_BGR (0<<12) - #define PM3VideoOverlayMode_COLORORDER_RGB (1<<12) - #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13) - #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13) - #define PM3VideoOverlayMode_FILTER_MASK (3<<14) - #define PM3VideoOverlayMode_FILTER_OFF (0<<14) - #define PM3VideoOverlayMode_FILTER_FULL (1<<14) - #define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14) - #define PM3VideoOverlayMode_DEINTERLACE_OFF (0<<16) - #define PM3VideoOverlayMode_DEINTERLACE_BOB (1<<16) - #define PM3VideoOverlayMode_PATCHMODE_OFF (0<<18) - #define PM3VideoOverlayMode_PATCHMODE_ON (1<<18) - #define PM3VideoOverlayMode_FLIP_VIDEO (0<<20) - #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20) - #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20) - #define PM3VideoOverlayMode_MIRROR_MASK (3<<23) - #define PM3VideoOverlayMode_MIRRORX_OFF (0<<23) - #define PM3VideoOverlayMode_MIRRORX_ON (1<<23) - #define PM3VideoOverlayMode_MIRRORY_OFF (0<<24) - #define PM3VideoOverlayMode_MIRRORY_ON (1<<24) + #define PM3VideoOverlayMode_ENABLE (1 << 0) + #define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0 << 1) + #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1 << 1) + #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2 << 1) + #define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0 << 4) + #define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1 << 4) + #define PM3VideoOverlayMode_PIXELSIZE_8BIT (0 << 5) + #define PM3VideoOverlayMode_PIXELSIZE_16BIT (1 << 5) + #define PM3VideoOverlayMode_PIXELSIZE_32BIT (2 << 5) + #define PM3VideoOverlayMode_COLORFORMAT_RGB8888 \ + ((0 << 7)|(1 << 12)|(2 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB4444 \ + ((1 << 7)|(1 << 12)|(1 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB5551 \ + ((2 << 7)|(1 << 12)|(1 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB565 \ + ((3 << 7)|(1 << 12)|(1 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB332 \ + ((4 << 7)|(1 << 12)|(0 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR8888 \ + ((0 << 7)|(2 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR4444 \ + ((1 << 7)|(1 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR5551 \ + ((2 << 7)|(1 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR565 \ + ((3 << 7)|(1 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR332 \ + ((4 << 7)|(0 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_CI8 \ + ((5 << 7)|(1 << 12)|(0 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_VUY444 \ + ((2 << 10)|(1 << 12)|(2 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_YUV444 \ + ((2 << 10)|(2 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_VUY422 \ + ((1 << 10)|(1 << 12)|(1 << 5)) + #define PM3VideoOverlayMode_COLORFORMAT_YUV422 \ + ((1 << 10)|(1 << 5)) + #define PM3VideoOverlayMode_COLORORDER_BGR (0 << 12) + #define PM3VideoOverlayMode_COLORORDER_RGB (1 << 12) + #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0 << 13) + #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1 << 13) + #define PM3VideoOverlayMode_FILTER_MASK (3 << 14) + #define PM3VideoOverlayMode_FILTER_OFF (0 << 14) + #define PM3VideoOverlayMode_FILTER_FULL (1 << 14) + #define PM3VideoOverlayMode_FILTER_PARTIAL (2 << 14) + #define PM3VideoOverlayMode_DEINTERLACE_OFF (0 << 16) + #define PM3VideoOverlayMode_DEINTERLACE_BOB (1 << 16) + #define PM3VideoOverlayMode_PATCHMODE_OFF (0 << 18) + #define PM3VideoOverlayMode_PATCHMODE_ON (1 << 18) + #define PM3VideoOverlayMode_FLIP_VIDEO (0 << 20) + #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1 << 20) + #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2 << 20) + #define PM3VideoOverlayMode_MIRROR_MASK (3 << 23) + #define PM3VideoOverlayMode_MIRRORX_OFF (0 << 23) + #define PM3VideoOverlayMode_MIRRORX_ON (1 << 23) + #define PM3VideoOverlayMode_MIRRORY_OFF (0 << 24) + #define PM3VideoOverlayMode_MIRRORY_ON (1 << 24) #define PM3VideoOverlayFifoControl 0x3110 #define PM3VideoOverlayIndex 0x3118 #define PM3VideoOverlayBase0 0x3120 #define PM3VideoOverlayBase1 0x3128 #define PM3VideoOverlayBase2 0x3130 #define PM3VideoOverlayStride 0x3138 - #define PM3VideoOverlayStride_STRIDE(s) (((s)&0xfff)<<0) -#define PM3VideoOverlayWidth 0x3140 - #define PM3VideoOverlayWidth_WIDTH(w) (((w)&0xfff)<<0) -#define PM3VideoOverlayHeight 0x3148 - #define PM3VideoOverlayHeight_HEIGHT(h) (((h)&0xfff)<<0) -#define PM3VideoOverlayOrigin 0x3150 - #define PM3VideoOverlayOrigin_XORIGIN(x) (((x)&0xfff)<<0) - #define PM3VideoOverlayOrigin_YORIGIN(y) (((y)&0xfff)<<16) -#define PM3VideoOverlayShrinkXDelta 0x3158 - #define PM3VideoOverlayShrinkXDelta_NONE (1<<16) - #define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \ - ((((s)<<16)/(d))&0x0ffffff0) -#define PM3VideoOverlayZoomXDelta 0x3160 - #define PM3VideoOverlayZoomXDelta_NONE (1<<16) - #define PM3VideoOverlayZoomXDelta_DELTA(s,d) \ - ((((s)<<16)/(d))&0x0001fff0) -#define PM3VideoOverlayYDelta 0x3168 - #define PM3VideoOverlayYDelta_NONE (1<<16) - #define PM3VideoOverlayYDelta_DELTA(s,d) \ - ((((s)<<16)/(d))&0x0ffffff0) + #define PM3VideoOverlayStride_STRIDE(s) (((s) & 0xfff) << 0) +#define PM3VideoOverlayWidth 0x3140 + #define PM3VideoOverlayWidth_WIDTH(w) (((w) & 0xfff) << 0) +#define PM3VideoOverlayHeight 0x3148 + #define PM3VideoOverlayHeight_HEIGHT(h) (((h) & 0xfff) << 0) +#define PM3VideoOverlayOrigin 0x3150 + #define PM3VideoOverlayOrigin_XORIGIN(x) (((x) & 0xfff) << 0) + #define PM3VideoOverlayOrigin_YORIGIN(y) (((y) & 0xfff) << 16) +#define PM3VideoOverlayShrinkXDelta 0x3158 + #define PM3VideoOverlayShrinkXDelta_NONE (1 << 16) + #define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \ + ((((s) << 16)/(d)) & 0x0ffffff0) +#define PM3VideoOverlayZoomXDelta 0x3160 + #define PM3VideoOverlayZoomXDelta_NONE (1 << 16) + #define PM3VideoOverlayZoomXDelta_DELTA(s,d) \ + ((((s) << 16)/(d)) & 0x0001fff0) +#define PM3VideoOverlayYDelta 0x3168 + #define PM3VideoOverlayYDelta_NONE (1 << 16) + #define PM3VideoOverlayYDelta_DELTA(s,d) \ + ((((s) << 16)/(d)) & 0x0ffffff0) #define PM3VideoOverlayFieldOffset 0x3170 #define PM3VideoOverlayStatus 0x3178 @@ -249,102 +257,82 @@ #define PM3RD_IndexHigh 0x4028 #define PM3RD_IndexedData 0x4030 #define PM3RD_IndexControl 0x4038 - #define PM3RD_IndexControl_AUTOINCREMENT_ENABLE (1<<0) - #define PM3RD_IndexControl_AUTOINCREMENT_DISABLE (0<<0) + #define PM3RD_IndexControl_AUTOINCREMENT_ENABLE (1 << 0) /* Indirect Registers */ #define PM3RD_MiscControl 0x000 - #define PM3RD_MiscControl_HIGHCOLOR_RES_DISABLE (0<<0) - #define PM3RD_MiscControl_HIGHCOLOR_RES_ENABLE (1<<0) - #define PM3RD_MiscControl_PIXELDOUBLE_DISABLE (0<<1) - #define PM3RD_MiscControl_PIXELDOUBLE_ENABLE (1<<1) - #define PM3RD_MiscControl_LASTREAD_ADDR_DISABLE (0<<2) - #define PM3RD_MiscControl_LASTREAD_ADDR_ENABLE (1<<2) - #define PM3RD_MiscControl_DIRECTCOLOR_DISABLE (0<<3) - #define PM3RD_MiscControl_DIRECTCOLOR_ENABLE (1<<3) - #define PM3RD_MiscControl_OVERLAY_DISABLE (0<<4) - #define PM3RD_MiscControl_OVERLAY_ENABLE (1<<4) - #define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_DISABLE (0<<5) - #define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_ENABLE (1<<5) - #define PM3RD_MiscControl_VSB_OUTPUT_DISABLE (0<<6) - #define PM3RD_MiscControl_VSB_OUTPUT_ENABLE (1<<6) - #define PM3RD_MiscControl_STEREODOUBLE_BUFFER_DISABLE (0<<7) - #define PM3RD_MiscControl_STEREODOUBLE_BUFFER_ENABLE (1<<7) + #define PM3RD_MiscControl_HIGHCOLOR_RES_ENABLE (1 << 0) + #define PM3RD_MiscControl_PIXELDOUBLE_ENABLE (1 << 1) + #define PM3RD_MiscControl_LASTREAD_ADDR_ENABLE (1 << 2) + #define PM3RD_MiscControl_DIRECTCOLOR_ENABLE (1 << 3) + #define PM3RD_MiscControl_OVERLAY_ENABLE (1 << 4) + #define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_ENABLE (1 << 5) + #define PM3RD_MiscControl_VSB_OUTPUT_ENABLE (1 << 6) + #define PM3RD_MiscControl_STEREODOUBLE_BUFFER_ENABLE (1 << 7) #define PM3RD_SyncControl 0x001 - #define PM3RD_SyncControl_HSYNC_ACTIVE_LOW (0<<0) - #define PM3RD_SyncControl_HSYNC_ACTIVE_HIGH (1<<0) - #define PM3RD_SyncControl_HSYNC_FORCE_ACTIVE (3<<0) - #define PM3RD_SyncControl_HSYNC_FORCE_INACTIVE (4<<0) - #define PM3RD_SyncControl_HSYNC_TRI_STATE (2<<0) - #define PM3RD_SyncControl_VSYNC_ACTIVE_LOW (0<<3) - #define PM3RD_SyncControl_VSYNC_ACTIVE_HIGH (1<<3) - #define PM3RD_SyncControl_VSYNC_TRI_STATE (2<<3) - #define PM3RD_SyncControl_VSYNC_FORCE_ACTIVE (3<<3) - #define PM3RD_SyncControl_VSYNC_FORCE_INACTIVE (4<<3) - #define PM3RD_SyncControl_HSYNC_OVERRIDE_SETBY_HSYNC (0<<6) - #define PM3RD_SyncControl_HSYNC_OVERRIDE_FORCE_HIGH (1<<6) - #define PM3RD_SyncControl_VSYNC_OVERRIDE_SETBY_VSYNC (0<<7) - #define PM3RD_SyncControl_VSYNC_OVERRIDE_FORCE_HIGH (1<<7) + #define PM3RD_SyncControl_HSYNC_ACTIVE_LOW (0 << 0) + #define PM3RD_SyncControl_HSYNC_ACTIVE_HIGH (1 << 0) + #define PM3RD_SyncControl_HSYNC_FORCE_ACTIVE (3 << 0) + #define PM3RD_SyncControl_HSYNC_FORCE_INACTIVE (4 << 0) + #define PM3RD_SyncControl_HSYNC_TRI_STATE (2 << 0) + #define PM3RD_SyncControl_VSYNC_ACTIVE_LOW (0 << 3) + #define PM3RD_SyncControl_VSYNC_ACTIVE_HIGH (1 << 3) + #define PM3RD_SyncControl_VSYNC_TRI_STATE (2 << 3) + #define PM3RD_SyncControl_VSYNC_FORCE_ACTIVE (3 << 3) + #define PM3RD_SyncControl_VSYNC_FORCE_INACTIVE (4 << 3) + #define PM3RD_SyncControl_HSYNC_OVERRIDE_SETBY_HSYNC (0 << 6) + #define PM3RD_SyncControl_HSYNC_OVERRIDE_FORCE_HIGH (1 << 6) + #define PM3RD_SyncControl_VSYNC_OVERRIDE_SETBY_VSYNC (0 << 7) + #define PM3RD_SyncControl_VSYNC_OVERRIDE_FORCE_HIGH (1 << 7) #define PM3RD_DACControl 0x002 - #define PM3RD_DACControl_DAC_POWER_ON (0<<0) - #define PM3RD_DACControl_DAC_POWER_OFF (1<<0) - #define PM3RD_DACControl_SYNC_ON_GREEN_DISABLE (0<<3) - #define PM3RD_DACControl_SYNC_ON_GREEN_ENABLE (1<<3) - #define PM3RD_DACControl_BLANK_RED_DAC_DISABLE (0<<4) - #define PM3RD_DACControl_BLANK_RED_DAC_ENABLE (1<<4) - #define PM3RD_DACControl_BLANK_GREEN_DAC_DISABLE (0<<5) - #define PM3RD_DACControl_BLANK_GREEN_DAC_ENABLE (1<<5) - #define PM3RD_DACControl_BLANK_BLUE_DAC_DISABLE (0<<6) - #define PM3RD_DACControl_BLANK_BLUE_DAC_ENABLE (1<<6) - #define PM3RD_DACControl_BLANK_PEDESTAL_DISABLE (0<<7) - #define PM3RD_DACControl_BLANK_PEDESTAL_ENABLE (1<<7) + #define PM3RD_DACControl_DAC_POWER_ON (0 << 0) + #define PM3RD_DACControl_DAC_POWER_OFF (1 << 0) + #define PM3RD_DACControl_SYNC_ON_GREEN_ENABLE (1 << 3) + #define PM3RD_DACControl_BLANK_RED_DAC_ENABLE (1 << 4) + #define PM3RD_DACControl_BLANK_GREEN_DAC_ENABLE (1 << 5) + #define PM3RD_DACControl_BLANK_BLUE_DAC_ENABLE (1 << 6) + #define PM3RD_DACControl_BLANK_PEDESTAL_ENABLE (1 << 7) #define PM3RD_PixelSize 0x003 - #define PM3RD_PixelSize_24_BIT_PIXELS (4<<0) - #define PM3RD_PixelSize_32_BIT_PIXELS (2<<0) - #define PM3RD_PixelSize_16_BIT_PIXELS (1<<0) - #define PM3RD_PixelSize_8_BIT_PIXELS (0<<0) + #define PM3RD_PixelSize_24_BIT_PIXELS (4 << 0) + #define PM3RD_PixelSize_32_BIT_PIXELS (2 << 0) + #define PM3RD_PixelSize_16_BIT_PIXELS (1 << 0) + #define PM3RD_PixelSize_8_BIT_PIXELS (0 << 0) #define PM3RD_ColorFormat 0x004 - #define PM3RD_ColorFormat_LINEAR_COLOR_EXT_ENABLE (1<<6) - #define PM3RD_ColorFormat_LINEAR_COLOR_EXT_DISABLE (0<<6) - #define PM3RD_ColorFormat_COLOR_ORDER_BLUE_LOW (1<<5) - #define PM3RD_ColorFormat_COLOR_ORDER_RED_LOW (0<<5) - #define PM3RD_ColorFormat_COLOR_FORMAT_MASK (0x1f<<0) - #define PM3RD_ColorFormat_8888_COLOR (0<<0) - #define PM3RD_ColorFormat_5551_FRONT_COLOR (1<<0) - #define PM3RD_ColorFormat_4444_COLOR (2<<0) - #define PM3RD_ColorFormat_332_FRONT_COLOR (5<<0) - #define PM3RD_ColorFormat_332_BACK_COLOR (6<<0) - #define PM3RD_ColorFormat_2321_FRONT_COLOR (9<<0) - #define PM3RD_ColorFormat_2321_BACK_COLOR (10<<0) - #define PM3RD_ColorFormat_232_FRONTOFF_COLOR (11<<0) - #define PM3RD_ColorFormat_232_BACKOFF_COLOR (12<<0) - #define PM3RD_ColorFormat_5551_BACK_COLOR (13<<0) - #define PM3RD_ColorFormat_CI8_COLOR (14<<0) - #define PM3RD_ColorFormat_565_FRONT_COLOR (16<<0) - #define PM3RD_ColorFormat_565_BACK_COLOR (17<<0) + #define PM3RD_ColorFormat_LINEAR_COLOR_EXT_ENABLE (1 << 6) + #define PM3RD_ColorFormat_COLOR_ORDER_BLUE_LOW (1 << 5) + #define PM3RD_ColorFormat_COLOR_ORDER_RED_LOW (0 << 5) + #define PM3RD_ColorFormat_COLOR_FORMAT_MASK (0x1f << 0) + #define PM3RD_ColorFormat_8888_COLOR (0 << 0) + #define PM3RD_ColorFormat_5551_FRONT_COLOR (1 << 0) + #define PM3RD_ColorFormat_4444_COLOR (2 << 0) + #define PM3RD_ColorFormat_332_FRONT_COLOR (5 << 0) + #define PM3RD_ColorFormat_332_BACK_COLOR (6 << 0) + #define PM3RD_ColorFormat_2321_FRONT_COLOR (9 << 0) + #define PM3RD_ColorFormat_2321_BACK_COLOR (10 << 0) + #define PM3RD_ColorFormat_232_FRONTOFF_COLOR (11 << 0) + #define PM3RD_ColorFormat_232_BACKOFF_COLOR (12 << 0) + #define PM3RD_ColorFormat_5551_BACK_COLOR (13 << 0) + #define PM3RD_ColorFormat_CI8_COLOR (14 << 0) + #define PM3RD_ColorFormat_565_FRONT_COLOR (16 << 0) + #define PM3RD_ColorFormat_565_BACK_COLOR (17 << 0) #define PM3RD_CursorMode 0x005 - #define PM3RD_CursorMode_CURSOR_DISABLE (0<<0) - #define PM3RD_CursorMode_CURSOR_ENABLE (1<<0) - #define PM3RD_CursorMode_FORMAT_64x64_2BPE_P0123 (0<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P0 (1<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P1 (2<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P2 (3<<2) - #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P3 (4<<2) - #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P01 (5<<2) - #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P23 (6<<2) - #define PM3RD_CursorMode_TYPE_MS (0<<4) - #define PM3RD_CursorMode_TYPE_X (1<<4) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_DISABLE (0<<6) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_ENABLE (1<<6) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_3_COLOR (2<<6) - #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_15_COLOR (3<<6) + #define PM3RD_CursorMode_CURSOR_ENABLE (1 << 0) + #define PM3RD_CursorMode_FORMAT_64x64_2BPE_P0123 (0 << 2) + #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P0 (1 << 2) + #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P1 (2 << 2) + #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P2 (3 << 2) + #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P3 (4 << 2) + #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P01 (5 << 2) + #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P23 (6 << 2) + #define PM3RD_CursorMode_TYPE_MS (0 << 4) + #define PM3RD_CursorMode_TYPE_X (1 << 4) + #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_ENABLE (1 << 6) + #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_3_COLOR (2 << 6) + #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_15_COLOR (3 << 6) #define PM3RD_CursorControl 0x006 - #define PM3RD_CursorControl_DOUBLE_X_DISABLED (0<<0) - #define PM3RD_CursorControl_DOUBLE_X_ENABLED (1<<0) - #define PM3RD_CursorControl_DOUBLE_Y_DISABLED (0<<1) - #define PM3RD_CursorControl_DOUBLE_Y_ENABLED (1<<1) - #define PM3RD_CursorControl_READBACK_POS_DISABLED (0<<2) - #define PM3RD_CursorControl_READBACK_POS_ENABLED (1<<2) + #define PM3RD_CursorControl_DOUBLE_X_ENABLED (1 << 0) + #define PM3RD_CursorControl_DOUBLE_Y_ENABLED (1 << 1) + #define PM3RD_CursorControl_READBACK_POS_ENABLED (1 << 2) #define PM3RD_CursorXLow 0x007 #define PM3RD_CursorXHigh 0x008 @@ -354,17 +342,13 @@ #define PM3RD_CursorHotSpotY 0x00c #define PM3RD_OverlayKey 0x00d #define PM3RD_Pan 0x00e - #define PM3RD_Pan_DISABLE (0<<0) - #define PM3RD_Pan_ENABLE (1<<0) - #define PM3RD_Pan_GATE_DISABLE (0<<1) - #define PM3RD_Pan_GATE_ENABLE (1<<1) + #define PM3RD_Pan_ENABLE (1 << 0) + #define PM3RD_Pan_GATE_ENABLE (1 << 1) #define PM3RD_Sense 0x00f #define PM3RD_CheckControl 0x018 - #define PM3RD_CheckControl_PIXEL_DISABLED (0<<0) - #define PM3RD_CheckControl_PIXEL_ENABLED (1<<0) - #define PM3RD_CheckControl_LUT_DISABLED (0<<1) - #define PM3RD_CheckControl_LUT_ENABLED (1<<1) + #define PM3RD_CheckControl_PIXEL_ENABLED (1 << 0) + #define PM3RD_CheckControl_LUT_ENABLED (1 << 1) #define PM3RD_CheckPixelRed 0x019 #define PM3RD_CheckPixelGreen 0x01a #define PM3RD_CheckPixelBlue 0x01b @@ -374,19 +358,17 @@ #define PM3RD_Scratch 0x01f #define PM3RD_VideoOverlayControl 0x020 - #define PM3RD_VideoOverlayControl_DISABLE (0<<0) - #define PM3RD_VideoOverlayControl_ENABLE (1<<0) - #define PM3RD_VideoOverlayControl_MODE_MASK (3<<1) - #define PM3RD_VideoOverlayControl_MODE_MAINKEY (0<<1) - #define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1<<1) - #define PM3RD_VideoOverlayControl_MODE_ALWAYS (2<<1) - #define PM3RD_VideoOverlayControl_MODE_BLEND (3<<1) - #define PM3RD_VideoOverlayControl_DIRECTCOLOR_DISABLED (0<<3) - #define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1<<3) - #define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0<<4) - #define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1<<4) - #define PM3RD_VideoOverlayControl_KEY_COLOR (0<<5) - #define PM3RD_VideoOverlayControl_KEY_ALPHA (1<<5) + #define PM3RD_VideoOverlayControl_ENABLE (1 << 0) + #define PM3RD_VideoOverlayControl_MODE_MASK (3 << 1) + #define PM3RD_VideoOverlayControl_MODE_MAINKEY (0 << 1) + #define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1 << 1) + #define PM3RD_VideoOverlayControl_MODE_ALWAYS (2 << 1) + #define PM3RD_VideoOverlayControl_MODE_BLEND (3 << 1) + #define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1 << 3) + #define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0 << 4) + #define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1 << 4) + #define PM3RD_VideoOverlayControl_KEY_COLOR (0 << 5) + #define PM3RD_VideoOverlayControl_KEY_ALPHA (1 << 5) #define PM3RD_VideoOverlayXStartLow 0x021 #define PM3RD_VideoOverlayXStartHigh 0x022 #define PM3RD_VideoOverlayYStartLow 0x023 @@ -399,10 +381,10 @@ #define PM3RD_VideoOverlayKeyG 0x02a #define PM3RD_VideoOverlayKeyB 0x02b #define PM3RD_VideoOverlayBlend 0x02c - #define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0<<6) - #define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1<<6) - #define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (2<<6) - #define PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT (3<<6) + #define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0 << 6) + #define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1 << 6) + #define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (2 << 6) + #define PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT (3 << 6) #define PM3RD_DClkSetup1 0x1f0 #define PM3RD_DClkSetup2 0x1f1 @@ -410,21 +392,20 @@ #define PM3RD_KClkSetup2 0x1f3 #define PM3RD_DClkControl 0x200 - #define PM3RD_DClkControl_SOURCE_PLL (0<<4) - #define PM3RD_DClkControl_SOURCE_VSA (1<<4) - #define PM3RD_DClkControl_SOURCE_VSB (2<<4) - #define PM3RD_DClkControl_SOURCE_EXT (3<<4) - #define PM3RD_DClkControl_STATE_RUN (2<<2) - #define PM3RD_DClkControl_STATE_HIGH (1<<2) - #define PM3RD_DClkControl_STATE_LOW (0<<2) - #define PM3RD_DClkControl_LOCKED (1<<1) - #define PM3RD_DClkControl_NOT_LOCKED (0<<1) - #define PM3RD_DClkControl_ENABLE (1<<0) - #define PM3RD_DClkControl_DISABLE (0<<0) + #define PM3RD_DClkControl_SOURCE_PLL (0 << 4) + #define PM3RD_DClkControl_SOURCE_VSA (1 << 4) + #define PM3RD_DClkControl_SOURCE_VSB (2 << 4) + #define PM3RD_DClkControl_SOURCE_EXT (3 << 4) + #define PM3RD_DClkControl_STATE_RUN (2 << 2) + #define PM3RD_DClkControl_STATE_HIGH (1 << 2) + #define PM3RD_DClkControl_STATE_LOW (0 << 2) + #define PM3RD_DClkControl_LOCKED (1 << 1) + #define PM3RD_DClkControl_NOT_LOCKED (0 << 1) + #define PM3RD_DClkControl_ENABLE (1 << 0) #define PM3RD_DClk0PreScale 0x201 #define PM3RD_DClk0FeedbackScale 0x202 #define PM3RD_DClk0PostScale 0x203 - #define PM3_REF_CLOCK 14318 + #define PM3_REF_CLOCK 14318 #define PM3RD_DClk1PreScale 0x204 #define PM3RD_DClk1FeedbackScale 0x205 #define PM3RD_DClk1PostScale 0x206 @@ -435,59 +416,56 @@ #define PM3RD_DClk3FeedbackScale 0x20b #define PM3RD_DClk3PostScale 0x20c #define PM3RD_KClkControl 0x20d - #define PM3RD_KClkControl_DISABLE (0<<0) - #define PM3RD_KClkControl_ENABLE (1<<0) - #define PM3RD_KClkControl_NOT_LOCKED (0<<1) - #define PM3RD_KClkControl_LOCKED (1<<1) - #define PM3RD_KClkControl_STATE_LOW (0<<2) - #define PM3RD_KClkControl_STATE_HIGH (1<<2) - #define PM3RD_KClkControl_STATE_RUN (2<<2) - #define PM3RD_KClkControl_STATE_LOW_POWER (3<<2) - #define PM3RD_KClkControl_SOURCE_PCLK (0<<4) - #define PM3RD_KClkControl_SOURCE_HALF_PCLK (1<<4) - #define PM3RD_KClkControl_SOURCE_PLL (2<<4) + #define PM3RD_KClkControl_ENABLE (1 << 0) + #define PM3RD_KClkControl_NOT_LOCKED (0 << 1) + #define PM3RD_KClkControl_LOCKED (1 << 1) + #define PM3RD_KClkControl_STATE_LOW (0 << 2) + #define PM3RD_KClkControl_STATE_HIGH (1 << 2) + #define PM3RD_KClkControl_STATE_RUN (2 << 2) + #define PM3RD_KClkControl_STATE_LOW_POWER (3 << 2) + #define PM3RD_KClkControl_SOURCE_PCLK (0 << 4) + #define PM3RD_KClkControl_SOURCE_HALF_PCLK (1 << 4) + #define PM3RD_KClkControl_SOURCE_PLL (2 << 4) #define PM3RD_KClkPreScale 0x20e #define PM3RD_KClkFeedbackScale 0x20f #define PM3RD_KClkPostScale 0x210 #define PM3RD_MClkControl 0x211 - #define PM3RD_MClkControl_DISABLE (0<<0) - #define PM3RD_MClkControl_ENABLE (1<<0) - #define PM3RD_MClkControl_NOT_LOCKED (0<<1) - #define PM3RD_MClkControl_LOCKED (1<<1) - #define PM3RD_MClkControl_STATE_LOW (0<<2) - #define PM3RD_MClkControl_STATE_HIGH (1<<2) - #define PM3RD_MClkControl_STATE_RUN (2<<2) - #define PM3RD_MClkControl_STATE_LOW_POWER (3<<2) - #define PM3RD_MClkControl_SOURCE_PCLK (0<<4) - #define PM3RD_MClkControl_SOURCE_HALF_PCLK (1<<4) - #define PM3RD_MClkControl_SOURCE_HALF_EXT (3<<4) - #define PM3RD_MClkControl_SOURCE_EXT (4<<4) - #define PM3RD_MClkControl_SOURCE_HALF_KCLK (5<<4) - #define PM3RD_MClkControl_SOURCE_KCLK (6<<4) + #define PM3RD_MClkControl_ENABLE (1 << 0) + #define PM3RD_MClkControl_NOT_LOCKED (0 << 1) + #define PM3RD_MClkControl_LOCKED (1 << 1) + #define PM3RD_MClkControl_STATE_LOW (0 << 2) + #define PM3RD_MClkControl_STATE_HIGH (1 << 2) + #define PM3RD_MClkControl_STATE_RUN (2 << 2) + #define PM3RD_MClkControl_STATE_LOW_POWER (3 << 2) + #define PM3RD_MClkControl_SOURCE_PCLK (0 << 4) + #define PM3RD_MClkControl_SOURCE_HALF_PCLK (1 << 4) + #define PM3RD_MClkControl_SOURCE_HALF_EXT (3 << 4) + #define PM3RD_MClkControl_SOURCE_EXT (4 << 4) + #define PM3RD_MClkControl_SOURCE_HALF_KCLK (5 << 4) + #define PM3RD_MClkControl_SOURCE_KCLK (6 << 4) #define PM3RD_MClkPreScale 0x212 #define PM3RD_MClkFeedbackScale 0x213 #define PM3RD_MClkPostScale 0x214 #define PM3RD_SClkControl 0x215 - #define PM3RD_SClkControl_DISABLE (0<<0) - #define PM3RD_SClkControl_ENABLE (1<<0) - #define PM3RD_SClkControl_NOT_LOCKED (0<<1) - #define PM3RD_SClkControl_LOCKED (1<<1) - #define PM3RD_SClkControl_STATE_LOW (0<<2) - #define PM3RD_SClkControl_STATE_HIGH (1<<2) - #define PM3RD_SClkControl_STATE_RUN (2<<2) - #define PM3RD_SClkControl_STATE_LOW_POWER (3<<2) - #define PM3RD_SClkControl_SOURCE_PCLK (0<<4) - #define PM3RD_SClkControl_SOURCE_HALF_PCLK (1<<4) - #define PM3RD_SClkControl_SOURCE_HALF_EXT (3<<4) - #define PM3RD_SClkControl_SOURCE_EXT (4<<4) - #define PM3RD_SClkControl_SOURCE_HALF_KCLK (5<<4) - #define PM3RD_SClkControl_SOURCE_KCLK (6<<4) + #define PM3RD_SClkControl_ENABLE (1 << 0) + #define PM3RD_SClkControl_NOT_LOCKED (0 << 1) + #define PM3RD_SClkControl_LOCKED (1 << 1) + #define PM3RD_SClkControl_STATE_LOW (0 << 2) + #define PM3RD_SClkControl_STATE_HIGH (1 << 2) + #define PM3RD_SClkControl_STATE_RUN (2 << 2) + #define PM3RD_SClkControl_STATE_LOW_POWER (3 << 2) + #define PM3RD_SClkControl_SOURCE_PCLK (0 << 4) + #define PM3RD_SClkControl_SOURCE_HALF_PCLK (1 << 4) + #define PM3RD_SClkControl_SOURCE_HALF_EXT (3 << 4) + #define PM3RD_SClkControl_SOURCE_EXT (4 << 4) + #define PM3RD_SClkControl_SOURCE_HALF_KCLK (5 << 4) + #define PM3RD_SClkControl_SOURCE_KCLK (6 << 4) #define PM3RD_SClkPreScale 0x216 #define PM3RD_SClkFeedbackScale 0x217 #define PM3RD_SClkPostScale 0x218 -#define PM3RD_CursorPalette(p) (0x303+(p)) -#define PM3RD_CursorPattern(p) (0x400+(p)) +#define PM3RD_CursorPalette(p) (0x303 + (p)) +#define PM3RD_CursorPattern(p) (0x400 + (p)) /****************************************************** * GLINT Permedia3 Video Streaming Registers (0x5000) * *******************************************************/ @@ -521,10 +499,10 @@ #define PM3ColorDDAModeOr 0xabe8 #define PM3CommandInterrupt 0xa990 #define PM3ConstantColorDDA 0xafb0 - #define PM3ConstantColorDDA_R(r) ((r)&0xff) - #define PM3ConstantColorDDA_G(g) (((g)&0xff)<<8) - #define PM3ConstantColorDDA_B(b) (((b)&0xff)<<16) - #define PM3ConstantColorDDA_A(a) (((a)&0xff)<<24) + #define PM3ConstantColorDDA_R(r) ((r) & 0xff) + #define PM3ConstantColorDDA_G(g) (((g) & 0xff) << 8) + #define PM3ConstantColorDDA_B(b) (((b) & 0xff) << 16) + #define PM3ConstantColorDDA_A(a) (((a) & 0xff) << 24) #define PM3ContextData 0x8dd0 #define PM3ContextDump 0x8dc0 #define PM3ContextRestore 0x8dc8 @@ -568,59 +546,59 @@ #define PM3FBDestReadBufferOffset1 0xaea8 #define PM3FBDestReadBufferOffset2 0xaeb0 #define PM3FBDestReadBufferOffset3 0xaeb8 - #define PM3FBDestReadBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FBDestReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) + #define PM3FBDestReadBufferOffset_XOffset(x) ((x) & 0xffff) + #define PM3FBDestReadBufferOffset_YOffset(y) (((y) & 0xffff) << 16) #define PM3FBDestReadBufferWidth0 0xaec0 #define PM3FBDestReadBufferWidth1 0xaec8 #define PM3FBDestReadBufferWidth2 0xaed0 #define PM3FBDestReadBufferWidth3 0xaed8 - #define PM3FBDestReadBufferWidth_Width(w) ((w)&0x0fff) + #define PM3FBDestReadBufferWidth_Width(w) ((w) & 0x0fff) #define PM3FBDestReadEnables 0xaee8 #define PM3FBDestReadEnablesAnd 0xad20 #define PM3FBDestReadEnablesOr 0xad28 - #define PM3FBDestReadEnables_E(e) ((e)&0xff) - #define PM3FBDestReadEnables_E0 1<<0 - #define PM3FBDestReadEnables_E1 1<<1 - #define PM3FBDestReadEnables_E2 1<<2 - #define PM3FBDestReadEnables_E3 1<<3 - #define PM3FBDestReadEnables_E4 1<<4 - #define PM3FBDestReadEnables_E5 1<<5 - #define PM3FBDestReadEnables_E6 1<<6 - #define PM3FBDestReadEnables_E7 1<<7 - #define PM3FBDestReadEnables_R(r) (((r)&0xff)<<8) - #define PM3FBDestReadEnables_R0 1<<8 - #define PM3FBDestReadEnables_R1 1<<9 - #define PM3FBDestReadEnables_R2 1<<10 - #define PM3FBDestReadEnables_R3 1<<11 - #define PM3FBDestReadEnables_R4 1<<12 - #define PM3FBDestReadEnables_R5 1<<13 - #define PM3FBDestReadEnables_R6 1<<14 - #define PM3FBDestReadEnables_R7 1<<15 - #define PM3FBDestReadEnables_ReferenceAlpha(a) (((a)&0xff)<<24) + #define PM3FBDestReadEnables_E(e) ((e) & 0xff) + #define PM3FBDestReadEnables_E0 (1 << 0) + #define PM3FBDestReadEnables_E1 (1 << 1) + #define PM3FBDestReadEnables_E2 (1 << 2) + #define PM3FBDestReadEnables_E3 (1 << 3) + #define PM3FBDestReadEnables_E4 (1 << 4) + #define PM3FBDestReadEnables_E5 (1 << 5) + #define PM3FBDestReadEnables_E6 (1 << 6) + #define PM3FBDestReadEnables_E7 (1 << 7) + #define PM3FBDestReadEnables_R(r) (((r) & 0xff) << 8) + #define PM3FBDestReadEnables_R0 (1 << 8) + #define PM3FBDestReadEnables_R1 (1 << 9) + #define PM3FBDestReadEnables_R2 (1 << 10) + #define PM3FBDestReadEnables_R3 (1 << 11) + #define PM3FBDestReadEnables_R4 (1 << 12) + #define PM3FBDestReadEnables_R5 (1 << 13) + #define PM3FBDestReadEnables_R6 (1 << 14) + #define PM3FBDestReadEnables_R7 (1 << 15) + #define PM3FBDestReadEnables_ReferenceAlpha(a) (((a) & 0xff) << 24) #define PM3FBDestReadMode 0xaee0 #define PM3FBDestReadModeAnd 0xac90 #define PM3FBDestReadModeOr 0xac98 - #define PM3FBDestReadMode_ReadDisable 0<<0 - #define PM3FBDestReadMode_ReadEnable 1<<0 - #define PM3FBDestReadMode_StripePitch(sp) (((sp)&0x7)<<2) - #define PM3FBDestReadMode_StripeHeight(sh) (((sh)&0x7)<<7) - #define PM3FBDestReadMode_Enable0 1<<8 - #define PM3FBDestReadMode_Enable1 1<<9 - #define PM3FBDestReadMode_Enable2 1<<10 - #define PM3FBDestReadMode_Enable3 1<<11 - #define PM3FBDestReadMode_Layout0(l) (((l)&0x3)<<12) - #define PM3FBDestReadMode_Layout1(l) (((l)&0x3)<<14) - #define PM3FBDestReadMode_Layout2(l) (((l)&0x3)<<16) - #define PM3FBDestReadMode_Layout3(l) (((l)&0x3)<<18) - #define PM3FBDestReadMode_Origin0 1<<20 - #define PM3FBDestReadMode_Origin1 1<<21 - #define PM3FBDestReadMode_Origin2 1<<22 - #define PM3FBDestReadMode_Origin3 1<<23 - #define PM3FBDestReadMode_Blocking 1<<24 - #define PM3FBDestReadMode_UseReadEnabled 1<<26 - #define PM3FBDestReadMode_AlphaFiltering 1<<27 + #define PM3FBDestReadMode_ReadDisable (0 << 0) + #define PM3FBDestReadMode_ReadEnable (1 << 0) + #define PM3FBDestReadMode_StripePitch(sp) (((sp) & 0x7) << 2) + #define PM3FBDestReadMode_StripeHeight(sh) (((sh) & 0x7) << 7) + #define PM3FBDestReadMode_Enable0 (1 << 8) + #define PM3FBDestReadMode_Enable1 (1 << 9) + #define PM3FBDestReadMode_Enable2 (1 << 10) + #define PM3FBDestReadMode_Enable3 (1 << 11) + #define PM3FBDestReadMode_Layout0(l) (((l) & 0x3) << 12) + #define PM3FBDestReadMode_Layout1(l) (((l) & 0x3) << 14) + #define PM3FBDestReadMode_Layout2(l) (((l) & 0x3) << 16) + #define PM3FBDestReadMode_Layout3(l) (((l) & 0x3) << 18) + #define PM3FBDestReadMode_Origin0 (1 << 20) + #define PM3FBDestReadMode_Origin1 (1 << 21) + #define PM3FBDestReadMode_Origin2 (1 << 22) + #define PM3FBDestReadMode_Origin3 (1 << 23) + #define PM3FBDestReadMode_Blocking (1 << 24) + #define PM3FBDestReadMode_UseReadEnabled (1 << 26) + #define PM3FBDestReadMode_AlphaFiltering (1 << 27) #define PM3FBHardwareWriteMask 0x8ac0 #define PM3FBSoftwareWriteMask 0x8820 @@ -628,65 +606,65 @@ #define PM3FBSourceData 0x8aa8 #define PM3FBSourceReadBufferAddr 0xaf08 #define PM3FBSourceReadBufferOffset 0xaf10 - #define PM3FBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) + #define PM3FBSourceReadBufferOffset_XOffset(x) ((x) & 0xffff) + #define PM3FBSourceReadBufferOffset_YOffset(y) (((y) & 0xffff) << 16) #define PM3FBSourceReadBufferWidth 0xaf18 - #define PM3FBSourceReadBufferWidth_Width(w) ((w)&0x0fff) + #define PM3FBSourceReadBufferWidth_Width(w) ((w) & 0x0fff) #define PM3FBSourceReadMode 0xaf00 #define PM3FBSourceReadModeAnd 0xaca0 #define PM3FBSourceReadModeOr 0xaca8 - #define PM3FBSourceReadMode_ReadDisable (0<<0) - #define PM3FBSourceReadMode_ReadEnable (1<<0) - #define PM3FBSourceReadMode_StripePitch(sp) (((sp)&0x7)<<2) - #define PM3FBSourceReadMode_StripeHeight(sh) (((sh)&0x7)<<7) - #define PM3FBSourceReadMode_Layout(l) (((l)&0x3)<<8) - #define PM3FBSourceReadMode_Origin 1<<10 - #define PM3FBSourceReadMode_Blocking 1<<11 - #define PM3FBSourceReadMode_UserTexelCoord 1<<13 - #define PM3FBSourceReadMode_WrapXEnable 1<<14 - #define PM3FBSourceReadMode_WrapYEnable 1<<15 - #define PM3FBSourceReadMode_WrapX(w) (((w)&0xf)<<16) - #define PM3FBSourceReadMode_WrapY(w) (((w)&0xf)<<20) - #define PM3FBSourceReadMode_ExternalSourceData 1<<24 -#define PM3FBWriteBufferAddr0 0xb000 -#define PM3FBWriteBufferAddr1 0xb008 -#define PM3FBWriteBufferAddr2 0xb010 -#define PM3FBWriteBufferAddr3 0xb018 + #define PM3FBSourceReadMode_ReadDisable (0 << 0) + #define PM3FBSourceReadMode_ReadEnable (1 << 0) + #define PM3FBSourceReadMode_StripePitch(sp) (((sp) & 0x7) << 2) + #define PM3FBSourceReadMode_StripeHeight(sh) (((sh) & 0x7) << 7) + #define PM3FBSourceReadMode_Layout(l) (((l) & 0x3) << 8) + #define PM3FBSourceReadMode_Origin (1 << 10) + #define PM3FBSourceReadMode_Blocking (1 << 11) + #define PM3FBSourceReadMode_UserTexelCoord (1 << 13) + #define PM3FBSourceReadMode_WrapXEnable (1 << 14) + #define PM3FBSourceReadMode_WrapYEnable (1 << 15) + #define PM3FBSourceReadMode_WrapX(w) (((w) & 0xf) << 16) + #define PM3FBSourceReadMode_WrapY(w) (((w) & 0xf) << 20) + #define PM3FBSourceReadMode_ExternalSourceData (1 << 24) +#define PM3FBWriteBufferAddr0 0xb000 +#define PM3FBWriteBufferAddr1 0xb008 +#define PM3FBWriteBufferAddr2 0xb010 +#define PM3FBWriteBufferAddr3 0xb018 -#define PM3FBWriteBufferOffset0 0xb020 -#define PM3FBWriteBufferOffset1 0xb028 -#define PM3FBWriteBufferOffset2 0xb030 -#define PM3FBWriteBufferOffset3 0xb038 - #define PM3FBWriteBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FBWriteBufferOffset_YOffset(y) (((y)&0xffff)<<16) +#define PM3FBWriteBufferOffset0 0xb020 +#define PM3FBWriteBufferOffset1 0xb028 +#define PM3FBWriteBufferOffset2 0xb030 +#define PM3FBWriteBufferOffset3 0xb038 + #define PM3FBWriteBufferOffset_XOffset(x) ((x) & 0xffff) + #define PM3FBWriteBufferOffset_YOffset(y) (((y) & 0xffff) << 16) -#define PM3FBWriteBufferWidth0 0xb040 -#define PM3FBWriteBufferWidth1 0xb048 -#define PM3FBWriteBufferWidth2 0xb050 -#define PM3FBWriteBufferWidth3 0xb058 - #define PM3FBWriteBufferWidth_Width(w) ((w)&0x0fff) +#define PM3FBWriteBufferWidth0 0xb040 +#define PM3FBWriteBufferWidth1 0xb048 +#define PM3FBWriteBufferWidth2 0xb050 +#define PM3FBWriteBufferWidth3 0xb058 + #define PM3FBWriteBufferWidth_Width(w) ((w) & 0x0fff) -#define PM3FBWriteMode 0x8ab8 -#define PM3FBWriteModeAnd 0xacf0 -#define PM3FBWriteModeOr 0xacf8 - #define PM3FBWriteMode_WriteDisable 0<<0 - #define PM3FBWriteMode_WriteEnable 1<<0 - #define PM3FBWriteMode_Replicate 1<<4 - #define PM3FBWriteMode_OpaqueSpan 1<<5 - #define PM3FBWriteMode_StripePitch(p) (((p)&0x7)<<6) - #define PM3FBWriteMode_StripeHeight(h) (((h)&0x7)<<9) - #define PM3FBWriteMode_Enable0 1<<12 - #define PM3FBWriteMode_Enable1 1<<13 - #define PM3FBWriteMode_Enable2 1<<14 - #define PM3FBWriteMode_Enable3 1<<15 - #define PM3FBWriteMode_Layout0(l) (((l)&0x3)<<16) - #define PM3FBWriteMode_Layout1(l) (((l)&0x3)<<18) - #define PM3FBWriteMode_Layout2(l) (((l)&0x3)<<20) - #define PM3FBWriteMode_Layout3(l) (((l)&0x3)<<22) - #define PM3FBWriteMode_Origin0 1<<24 - #define PM3FBWriteMode_Origin1 1<<25 - #define PM3FBWriteMode_Origin2 1<<26 - #define PM3FBWriteMode_Origin3 1<<27 +#define PM3FBWriteMode 0x8ab8 +#define PM3FBWriteModeAnd 0xacf0 +#define PM3FBWriteModeOr 0xacf8 + #define PM3FBWriteMode_WriteDisable (0 << 0) + #define PM3FBWriteMode_WriteEnable (1 << 0) + #define PM3FBWriteMode_Replicate (1 << 4) + #define PM3FBWriteMode_OpaqueSpan (1 << 5) + #define PM3FBWriteMode_StripePitch(p) (((p) & 0x7) << 6) + #define PM3FBWriteMode_StripeHeight(h) (((h) & 0x7) << 9) + #define PM3FBWriteMode_Enable0 (1 << 12) + #define PM3FBWriteMode_Enable1 (1 << 13) + #define PM3FBWriteMode_Enable2 (1 << 14) + #define PM3FBWriteMode_Enable3 (1 << 15) + #define PM3FBWriteMode_Layout0(l) (((l) & 0x3) << 16) + #define PM3FBWriteMode_Layout1(l) (((l) & 0x3) << 18) + #define PM3FBWriteMode_Layout2(l) (((l) & 0x3) << 20) + #define PM3FBWriteMode_Layout3(l) (((l) & 0x3) << 22) + #define PM3FBWriteMode_Origin0 (1 << 24) + #define PM3FBWriteMode_Origin1 (1 << 25) + #define PM3FBWriteMode_Origin2 (1 << 26) + #define PM3FBWriteMode_Origin3 (1 << 27) #define PM3ForegroundColor 0xb0c0 /* ... */ #define PM3GIDMode 0xb538 @@ -701,55 +679,55 @@ #define PM3LBDestReadMode 0xb500 #define PM3LBDestReadModeAnd 0xb580 #define PM3LBDestReadModeOr 0xb588 - #define PM3LBDestReadMode_Disable 0<<0 - #define PM3LBDestReadMode_Enable 1<<0 - #define PM3LBDestReadMode_StripePitch(p) (((p)&0x7)<<2) - #define PM3LBDestReadMode_StripeHeight(h) (((h)&0x7)<<5) - #define PM3LBDestReadMode_Layout 1<<8 - #define PM3LBDestReadMode_Origin 1<<9 - #define PM3LBDestReadMode_UserReadEnables 1<<10 - #define PM3LBDestReadMode_Packed16 1<<11 - #define PM3LBDestReadMode_Width(w) (((w)&0xfff)<<12) + #define PM3LBDestReadMode_Disable (0 << 0) + #define PM3LBDestReadMode_Enable (1 << 0) + #define PM3LBDestReadMode_StripePitch(p) (((p) & 0x7) << 2) + #define PM3LBDestReadMode_StripeHeight(h) (((h) & 0x7) << 5) + #define PM3LBDestReadMode_Layout (1 << 8) + #define PM3LBDestReadMode_Origin (1 << 9) + #define PM3LBDestReadMode_UserReadEnables (1 << 10) + #define PM3LBDestReadMode_Packed16 (1 << 11) + #define PM3LBDestReadMode_Width(w) (((w) & 0xfff) << 12) #define PM3LBReadFormat 0x8888 - #define PM3LBReadFormat_DepthWidth(w) (((w)&0x3)<<0) - #define PM3LBReadFormat_StencilWidth(w) (((w)&0xf)<<2) - #define PM3LBReadFormat_StencilPosition(p) (((p)&0x1f)<<6) - #define PM3LBReadFormat_FCPWidth(w) (((w)&0xf)<<11) - #define PM3LBReadFormat_FCPPosition(p) (((p)&0x1f)<<15) - #define PM3LBReadFormat_GIDWidth(w) (((w)&0x7)<<20) - #define PM3LBReadFormat_GIDPosition(p) (((p)&0x1f)<<23) + #define PM3LBReadFormat_DepthWidth(w) (((w) & 0x3) << 0) + #define PM3LBReadFormat_StencilWidth(w) (((w) & 0xf) << 2) + #define PM3LBReadFormat_StencilPosition(p) (((p) & 0x1f) << 6) + #define PM3LBReadFormat_FCPWidth(w) (((w) & 0xf) << 11) + #define PM3LBReadFormat_FCPPosition(p) (((p) & 0x1f) << 15) + #define PM3LBReadFormat_GIDWidth(w) (((w) & 0x7) << 20) + #define PM3LBReadFormat_GIDPosition(p) (((p) & 0x1f) << 23) #define PM3LBSourceReadBufferAddr 0xb528 #define PM3LBSourceReadBufferOffset 0xb530 #define PM3LBSourceReadMode 0xb520 #define PM3LBSourceReadModeAnd 0xb5a0 #define PM3LBSourceReadModeOr 0xb5a8 - #define PM3LBSourceReadMode_Enable 1<<0 - #define PM3LBSourceReadMode_StripePitch(p) (((p)&0x7)<<2) - #define PM3LBSourceReadMode_StripeHeight(h) (((h)&0x7)<<5) - #define PM3LBSourceReadMode_Layout 1<<8 - #define PM3LBSourceReadMode_Origin 1<<9 - #define PM3LBSourceReadMode_Packed16 1<<10 - #define PM3LBSourceReadMode_Width(w) (((w)&0xfff)<<11) + #define PM3LBSourceReadMode_Enable (1 << 0) + #define PM3LBSourceReadMode_StripePitch(p) (((p) & 0x7) << 2) + #define PM3LBSourceReadMode_StripeHeight(h) (((h) & 0x7) << 5) + #define PM3LBSourceReadMode_Layout (1 << 8) + #define PM3LBSourceReadMode_Origin (1 << 9) + #define PM3LBSourceReadMode_Packed16 (1 << 10) + #define PM3LBSourceReadMode_Width(w) (((w) & 0xfff) << 11) #define PM3LBStencil 0x88a8 #define PM3LBWriteBufferAddr 0xb540 #define PM3LBWriteBufferOffset 0xb548 #define PM3LBWriteFormat 0x88c8 - #define PM3LBWriteFormat_DepthWidth(w) (((w)&0x3)<<0) - #define PM3LBWriteFormat_StencilWidth(w) (((w)&0xf)<<2) - #define PM3LBWriteFormat_StencilPosition(p) (((p)&0x1f)<<6) - #define PM3LBWriteFormat_GIDWidth(w) (((w)&0x7)<<20) - #define PM3LBWriteFormat_GIDPosition(p) (((p)&0x1f)<<23) + #define PM3LBWriteFormat_DepthWidth(w) (((w) & 0x3) << 0) + #define PM3LBWriteFormat_StencilWidth(w) (((w) & 0xf) << 2) + #define PM3LBWriteFormat_StencilPosition(p) (((p) & 0x1f) << 6) + #define PM3LBWriteFormat_GIDWidth(w) (((w) & 0x7) << 20) + #define PM3LBWriteFormat_GIDPosition(p) (((p) & 0x1f) << 23) #define PM3LBWriteMode 0x88c0 #define PM3LBWriteModeAnd 0xac80 #define PM3LBWriteModeOr 0xac88 - #define PM3LBWriteMode_WriteDisable 0<<0 - #define PM3LBWriteMode_WriteEnable 1<<0 - #define PM3LBWriteMode_StripePitch(p) (((p)&0x7)<<3) - #define PM3LBWriteMode_StripeHeight(h) (((h)&0x7)<<6) - #define PM3LBWriteMode_Layout 1<<9 - #define PM3LBWriteMode_Origin 1<<10 - #define PM3LBWriteMode_Packed16 1<<11 - #define PM3LBWriteMode_Width(w) (((w)&0xfff)<<12) + #define PM3LBWriteMode_WriteDisable (0 << 0) + #define PM3LBWriteMode_WriteEnable (1 << 0) + #define PM3LBWriteMode_StripePitch(p) (((p) & 0x7) << 3) + #define PM3LBWriteMode_StripeHeight(h) (((h) & 0x7) << 6) + #define PM3LBWriteMode_Layout (1 << 9) + #define PM3LBWriteMode_Origin (1 << 10) + #define PM3LBWriteMode_Packed16 (1 << 11) + #define PM3LBWriteMode_Width(w) (((w) & 0xfff) << 12) /* ... */ #define PM3LineStippleMode 0x81a8 #define PM3LineStippleModeAnd 0xabc0 @@ -759,19 +737,16 @@ #define PM3LogicalOpMode 0x8828 #define PM3LogicalOpModeAnd 0xace0 #define PM3LogicalOpModeOr 0xace8 - #define PM3LogicalOpMode_Disable (0<<0) - #define PM3LogicalOpMode_Enable (1<<0) - #define PM3LogicalOpMode_LogicOp(op) (((op)&0xf)<<1) - #define PM3LogicalOpMode_UseConstantWriteData_Disable (0<<5) - #define PM3LogicalOpMode_UseConstantWriteData_Enable (1<<5) - #define PM3LogicalOpMode_Background_Disable (0<<6) - #define PM3LogicalOpMode_Background_Enable (1<<6) - #define PM3LogicalOpMode_Background_LogicOp(op) (((op)&0xf)<<7) - #define PM3LogicalOpMode_UseConstantSource_Disable (0<<11) - #define PM3LogicalOpMode_UseConstantSource_Enable (1<<11) - -/* ... */ -#define PM3LUT 0x8e80 + #define PM3LogicalOpMode_Disable (0 << 0) + #define PM3LogicalOpMode_Enable (1 << 0) + #define PM3LogicalOpMode_LogicOp(op) (((op) & 0xf) << 1) + #define PM3LogicalOpMode_UseConstantWriteData_Disable (0 << 5) + #define PM3LogicalOpMode_UseConstantWriteData_Enable (1 << 5) + #define PM3LogicalOpMode_Background_Disable (0 << 6) + #define PM3LogicalOpMode_Background_Enable (1 << 6) + #define PM3LogicalOpMode_Background_LogicOp(op) (((op) & 0xf) << 7) + #define PM3LogicalOpMode_UseConstantSource_Disable (0 << 11) + #define PM3LogicalOpMode_UseConstantSource_Enable (1 << 11) /* ... */ #define PM3LUT 0x8e80 #define PM3LUTAddress 0x84d0 @@ -783,75 +758,74 @@ #define PM3LUTTransfer 0x84d8 /* ... */ #define PM3PixelSize 0x80c0 - #define PM3PixelSize_GLOBAL_32BIT (0<<0) - #define PM3PixelSize_GLOBAL_16BIT (1<<0) - #define PM3PixelSize_GLOBAL_8BIT (2<<0) - #define PM3PixelSize_RASTERIZER_32BIT (0<<2) - #define PM3PixelSize_RASTERIZER_16BIT (1<<2) - #define PM3PixelSize_RASTERIZER_8BIT (2<<2) - #define PM3PixelSize_SCISSOR_AND_STIPPLE_32BIT (0<<4) - #define PM3PixelSize_SCISSOR_AND_STIPPLE_16BIT (1<<4) - #define PM3PixelSize_SCISSOR_AND_STIPPLE_8BIT (2<<4) - #define PM3PixelSize_TEXTURE_32BIT (0<<6) - #define PM3PixelSize_TEXTURE_16BIT (1<<6) - #define PM3PixelSize_TEXTURE_8BIT (2<<6) - #define PM3PixelSize_LUT_32BIT (0<<8) - #define PM3PixelSize_LUT_16BIT (1<<8) - #define PM3PixelSize_LUT_8BIT (2<<8) - #define PM3PixelSize_FRAMEBUFFER_32BIT (0<<10) - #define PM3PixelSize_FRAMEBUFFER_16BIT (1<<10) - #define PM3PixelSize_FRAMEBUFFER_8BIT (2<<10) - #define PM3PixelSize_LOGICAL_OP_32BIT (0<<12) - #define PM3PixelSize_LOGICAL_OP_16BIT (1<<12) - #define PM3PixelSize_LOGICAL_OP_8BIT (2<<12) - #define PM3PixelSize_LOCALBUFFER_32BIT (0<<14) - #define PM3PixelSize_LOCALBUFFER_16BIT (1<<14) - #define PM3PixelSize_LOCALBUFFER_8BIT (2<<14) - #define PM3PixelSize_SETUP_32BIT (0<<16) - #define PM3PixelSize_SETUP_16BIT (1<<16) - #define PM3PixelSize_SETUP_8BIT (2<<16) - #define PM3PixelSize_GLOBAL (0<<31) - #define PM3PixelSize_INDIVIDUAL (1<<31) + #define PM3PixelSize_GLOBAL_32BIT (0 << 0) + #define PM3PixelSize_GLOBAL_16BIT (1 << 0) + #define PM3PixelSize_GLOBAL_8BIT (2 << 0) + #define PM3PixelSize_RASTERIZER_32BIT (0 << 2) + #define PM3PixelSize_RASTERIZER_16BIT (1 << 2) + #define PM3PixelSize_RASTERIZER_8BIT (2 << 2) + #define PM3PixelSize_SCISSOR_AND_STIPPLE_32BIT (0 << 4) + #define PM3PixelSize_SCISSOR_AND_STIPPLE_16BIT (1 << 4) + #define PM3PixelSize_SCISSOR_AND_STIPPLE_8BIT (2 << 4) + #define PM3PixelSize_TEXTURE_32BIT (0 << 6) + #define PM3PixelSize_TEXTURE_16BIT (1 << 6) + #define PM3PixelSize_TEXTURE_8BIT (2 << 6) + #define PM3PixelSize_LUT_32BIT (0 << 8) + #define PM3PixelSize_LUT_16BIT (1 << 8) + #define PM3PixelSize_LUT_8BIT (2 << 8) + #define PM3PixelSize_FRAMEBUFFER_32BIT (0 << 10) + #define PM3PixelSize_FRAMEBUFFER_16BIT (1 << 10) + #define PM3PixelSize_FRAMEBUFFER_8BIT (2 << 10) + #define PM3PixelSize_LOGICAL_OP_32BIT (0 << 12) + #define PM3PixelSize_LOGICAL_OP_16BIT (1 << 12) + #define PM3PixelSize_LOGICAL_OP_8BIT (2 << 12) + #define PM3PixelSize_LOCALBUFFER_32BIT (0 << 14) + #define PM3PixelSize_LOCALBUFFER_16BIT (1 << 14) + #define PM3PixelSize_LOCALBUFFER_8BIT (2 << 14) + #define PM3PixelSize_SETUP_32BIT (0 << 16) + #define PM3PixelSize_SETUP_16BIT (1 << 16) + #define PM3PixelSize_SETUP_8BIT (2 << 16) + #define PM3PixelSize_GLOBAL (0 << 31) + #define PM3PixelSize_INDIVIDUAL (1 << 31) /* ... */ #define PM3Render 0x8038 - #define PM3Render_AreaStipple_Disable (0<<0) - #define PM3Render_AreaStipple_Enable (1<<0) - #define PM3Render_LineStipple_Disable (0<<1) - #define PM3Render_LineStipple_Enable (1<<1) - #define PM3Render_ResetLine_Disable (0<<2) - #define PM3Render_ResetLine_Enable (1<<2) - #define PM3Render_FastFill_Disable (0<<3) - #define PM3Render_FastFill_Enable (1<<3) - #define PM3Render_Primitive_Line (0<<6) - #define PM3Render_Primitive_Trapezoid (1<<6) - #define PM3Render_Primitive_Point (2<<6) - #define PM3Render_Antialias_Disable (0<<8) - #define PM3Render_Antialias_Enable (1<<8) - #define PM3Render_Antialias_SubPixelRes_4x4 (0<<9) - #define PM3Render_Antialias_SubPixelRes_8x8 (1<<9) - #define PM3Render_UsePointTable_Disable (0<<10) - #define PM3Render_UsePointTable_Enable (1<<10) - #define PM3Render_SyncOnbitMask_Disable (0<<11) - #define PM3Render_SyncOnBitMask_Enable (1<<11) - #define PM3Render_SyncOnHostData_Disable (0<<12) - #define PM3Render_SyncOnHostData_Enable (1<<12) - #define PM3Render_Texture_Disable (0<<13) - #define PM3Render_Texture_Enable (1<<13) - #define PM3Render_Fog_Disable (0<<14) - #define PM3Render_Fog_Enable (1<<14) - #define PM3Render_Coverage_Disable (0<<15) - #define PM3Render_Coverage_Enable (1<<15) - #define PM3Render_SubPixelCorrection_Disable (0<<16) - #define PM3Render_SubPixelCorrection_Enable (1<<16) - #define PM3Render_SpanOperation_Disable (0<<18) - #define PM3Render_SpanOperation_Enable (1<<18) - #define PM3Render_FBSourceRead_Disable (0<<27) - #define PM3Render_FBSourceRead_Enable (1<<27) + #define PM3Render_AreaStipple_Disable (0 << 0) + #define PM3Render_AreaStipple_Enable (1 << 0) + #define PM3Render_LineStipple_Disable (0 << 1) + #define PM3Render_LineStipple_Enable (1 << 1) + #define PM3Render_ResetLine_Disable (0 << 2) + #define PM3Render_ResetLine_Enable (1 << 2) + #define PM3Render_FastFill_Disable (0 << 3) + #define PM3Render_FastFill_Enable (1 << 3) + #define PM3Render_Primitive_Line (0 << 6) + #define PM3Render_Primitive_Trapezoid (1 << 6) + #define PM3Render_Primitive_Point (2 << 6) + #define PM3Render_Antialias_Disable (0 << 8) + #define PM3Render_Antialias_Enable (1 << 8) + #define PM3Render_Antialias_SubPixelRes_4x4 (0 << 9) + #define PM3Render_Antialias_SubPixelRes_8x8 (1 << 9) + #define PM3Render_UsePointTable_Disable (0 << 10) + #define PM3Render_UsePointTable_Enable (1 << 10) + #define PM3Render_SyncOnbitMask_Disable (0 << 11) + #define PM3Render_SyncOnBitMask_Enable (1 << 11) + #define PM3Render_SyncOnHostData_Disable (0 << 12) + #define PM3Render_SyncOnHostData_Enable (1 << 12) + #define PM3Render_Texture_Disable (0 << 13) + #define PM3Render_Texture_Enable (1 << 13) + #define PM3Render_Fog_Disable (0 << 14) + #define PM3Render_Fog_Enable (1 << 14) + #define PM3Render_Coverage_Disable (0 << 15) + #define PM3Render_Coverage_Enable (1 << 15) + #define PM3Render_SubPixelCorrection_Disable (0 << 16) + #define PM3Render_SubPixelCorrection_Enable (1 << 16) + #define PM3Render_SpanOperation_Disable (0 << 18) + #define PM3Render_SpanOperation_Enable (1 << 18) + #define PM3Render_FBSourceRead_Disable (0 << 27) + #define PM3Render_FBSourceRead_Enable (1 << 27) #define PM3RasterizerMode 0x80a0 #define PM3RasterizerModeAnd 0xaba0 -#define PM3RasterizerModeOr 0xabb8 +#define PM3RasterizerModeOr 0xaba8 #define PM3RectangleHeight 0x94e0 -#define PM3Render 0x8038 #define PM3RepeatLine 0x9328 #define PM3ResetPickResult 0x8c20 #define PM3RLEMask 0x8c48 @@ -918,31 +892,31 @@ #define PM3TextureIndexMode1And 0xb3d0 #define PM3TextureIndexMode1Or 0xb3d8 /* ... */ -#define PM3TextureMapSize 0xb428 -#define PM3TextureMapWidth0 0x8580 -#define PM3TextureMapWidth1 0x8588 - #define PM3TextureMapWidth_Width(w) ((w&0xfff)<<0) - #define PM3TextureMapWidth_BorderLayout (1<<12) - #define PM3TextureMapWidth_Layout_Linear (0<<13) - #define PM3TextureMapWidth_Layout_Patch64 (1<<13) - #define PM3TextureMapWidth_Layout_Patch32_2 (2<<13) - #define PM3TextureMapWidth_Layout_Patch2 (3<<13) - #define PM3TextureMapWidth_HostTexture (1<<15) -#define PM3TextureReadMode0 0xb400 -#define PM3TextureReadMode0And 0xac30 -#define PM3TextureReadMode0Or 0xac38 -#define PM3TextureReadMode1 0xb408 -#define PM3TextureReadMode1And 0xad40 -#define PM3TextureReadMode1Or 0xad48 +#define PM3TextureMapSize 0xb428 +#define PM3TextureMapWidth0 0x8580 +#define PM3TextureMapWidth1 0x8588 + #define PM3TextureMapWidth_Width(w) (((w) & 0xfff) << 0) + #define PM3TextureMapWidth_BorderLayout (1 << 12) + #define PM3TextureMapWidth_Layout_Linear (0 << 13) + #define PM3TextureMapWidth_Layout_Patch64 (1 << 13) + #define PM3TextureMapWidth_Layout_Patch32_2 (2 << 13) + #define PM3TextureMapWidth_Layout_Patch2 (3 << 13) + #define PM3TextureMapWidth_HostTexture (1 << 15) +#define PM3TextureReadMode0 0xb400 +#define PM3TextureReadMode0And 0xac30 +#define PM3TextureReadMode0Or 0xac38 +#define PM3TextureReadMode1 0xb408 +#define PM3TextureReadMode1And 0xad40 +#define PM3TextureReadMode1Or 0xad48 /* ... */ #define PM3WaitForCompletion 0x80b8 #define PM3Window 0x8980 - #define PM3Window_ForceLBUpdate 1<<3 - #define PM3Window_LBUpdateSource 1<<4 - #define PM3Window_FrameCount(c) (((c)&0xff)<<9) - #define PM3Window_StencilFCP 1<<17 - #define PM3Window_DepthFCP 1<<18 - #define PM3Window_OverrideWriteFiltering 1<<19 + #define PM3Window_ForceLBUpdate (1 << 3) + #define PM3Window_LBUpdateSource (1 << 4) + #define PM3Window_FrameCount(c) (((c) & 0xff) << 9) + #define PM3Window_StencilFCP (1 << 17) + #define PM3Window_DepthFCP (1 << 18) + #define PM3Window_OverrideWriteFiltering (1 << 19) #define PM3WindowAnd 0xab80 #define PM3WindowOr 0xab88 #define PM3WindowOrigin 0x81c8 @@ -957,169 +931,131 @@ /********************************************** -* GLINT Permedia3 2D setup Unit * +* GLINT Permedia3 2D setup Unit * ***********************************************/ #define PM3Config2D 0xb618 - #define PM3Config2D_OpaqueSpan 1<<0 - #define PM3Config2D_MultiRXBlit 1<<1 - #define PM3Config2D_UserScissorEnable 1<<2 - #define PM3Config2D_FBDestReadEnable 1<<3 - #define PM3Config2D_AlphaBlendEnable 1<<4 - #define PM3Config2D_DitherEnable 1<<5 - #define PM3Config2D_ForegroundROPEnable 1<<6 - #define PM3Config2D_ForegroundROP(rop) (((rop)&0xf)<<7) - #define PM3Config2D_BackgroundROPEnable 1<<11 - #define PM3Config2D_BackgroundROP(rop) (((rop)&0xf)<<12) - #define PM3Config2D_UseConstantSource 1<<16 - #define PM3Config2D_FBWriteEnable 1<<17 - #define PM3Config2D_Blocking 1<<18 - #define PM3Config2D_ExternalSourceData 1<<19 - #define PM3Config2D_LUTModeEnable 1<<20 + #define PM3Config2D_OpaqueSpan (1 << 0) + #define PM3Config2D_MultiRXBlit (1 << 1) + #define PM3Config2D_UserScissorEnable (1 << 2) + #define PM3Config2D_FBDestReadEnable (1 << 3) + #define PM3Config2D_AlphaBlendEnable (1 << 4) + #define PM3Config2D_DitherEnable (1 << 5) + #define PM3Config2D_ForegroundROPEnable (1 << 6) + #define PM3Config2D_ForegroundROP(rop) (((rop) & 0xf) << 7) + #define PM3Config2D_BackgroundROPEnable (1 << 11) + #define PM3Config2D_BackgroundROP(rop) (((rop) & 0xf) << 12) + #define PM3Config2D_UseConstantSource (1 << 16) + #define PM3Config2D_FBWriteEnable (1 << 17) + #define PM3Config2D_Blocking (1 << 18) + #define PM3Config2D_ExternalSourceData (1 << 19) + #define PM3Config2D_LUTModeEnable (1 << 20) #define PM3DownloadGlyphwidth 0xb658 - #define PM3DownloadGlyphwidth_GlyphWidth(gw) ((gw)&0xffff) + #define PM3DownloadGlyphwidth_GlyphWidth(gw) ((gw) & 0xffff) #define PM3DownloadTarget 0xb650 - #define PM3DownloadTarget_TagName(tag) ((tag)&0x1fff) + #define PM3DownloadTarget_TagName(tag) ((tag) & 0x1fff) #define PM3GlyphData 0xb660 #define PM3GlyphPosition 0xb608 - #define PM3GlyphPosition_XOffset(x) ((x)&0xffff) - #define PM3GlyphPosition_YOffset(y) (((y)&0xffff)<<16) + #define PM3GlyphPosition_XOffset(x) ((x) & 0xffff) + #define PM3GlyphPosition_YOffset(y) (((y) & 0xffff) << 16) #define PM3Packed4Pixels 0xb668 #define PM3Packed8Pixels 0xb630 #define PM3Packed16Pixels 0xb638 #define PM3RectanglePosition 0xb600 - #define PM3RectanglePosition_XOffset(x) ((x)&0xffff) - #define PM3RectanglePosition_YOffset(y) (((y)&0xffff)<<16) + #define PM3RectanglePosition_XOffset(x) ((x) & 0xffff) + #define PM3RectanglePosition_YOffset(y) (((y) & 0xffff) << 16) #define PM3Render2D 0xb640 - #define PM3Render2D_Width(w) ((w)&0x0fff) - #define PM3Render2D_Operation_Normal 0<<12 - #define PM3Render2D_Operation_SyncOnHostData 1<<12 - #define PM3Render2D_Operation_SyncOnBitMask 2<<12 - #define PM3Render2D_Operation_PatchOrderRendering 3<<12 - #define PM3Render2D_FBSourceReadEnable 1<<14 - #define PM3Render2D_SpanOperation 1<<15 - #define PM3Render2D_Height(h) (((h)&0x0fff)<<16) - #define PM3Render2D_XPositive 1<<28 - #define PM3Render2D_YPositive 1<<29 - #define PM3Render2D_AreaStippleEnable 1<<30 - #define PM3Render2D_TextureEnable 1<<31 + #define PM3Render2D_Width(w) ((w) & 0x0fff) + #define PM3Render2D_Operation_Normal (0 << 12) + #define PM3Render2D_Operation_SyncOnHostData (1 << 12) + #define PM3Render2D_Operation_SyncOnBitMask (2 << 12) + #define PM3Render2D_Operation_PatchOrderRendering (3 << 12) + #define PM3Render2D_FBSourceReadEnable (1 << 14) + #define PM3Render2D_SpanOperation (1 << 15) + #define PM3Render2D_Height(h) (((h) & 0x0fff) << 16) + #define PM3Render2D_XPositive (1 << 28) + #define PM3Render2D_YPositive (1 << 29) + #define PM3Render2D_AreaStippleEnable (1 << 30) + #define PM3Render2D_TextureEnable (1 << 31) #define PM3Render2DGlyph 0xb648 - #define PM3Render2DGlyph_Width(w) ((w)&0x7f) - #define PM3Render2DGlyph_Height(h) (((h)&0x7f)<<7) - #define PM3Render2DGlyph_XOffset(x) (((x)&0x1ff)<<14) - #define PM3Render2DGlyph_YOffset(y) (((y)&0x1ff)<<23) + #define PM3Render2DGlyph_Width(w) ((w) & 0x7f) + #define PM3Render2DGlyph_Height(h) (((h) & 0x7f) << 7) + #define PM3Render2DGlyph_XOffset(x) (((x) & 0x1ff) << 14) + #define PM3Render2DGlyph_YOffset(y) (((y) & 0x1ff) << 23) #define PM3RenderPatchOffset 0xb610 - #define PM3RenderPatchOffset_XOffset(x) ((x)&0xffff) - #define PM3RenderPatchOffset_YOffset(y) (((y)&0xffff)<<16) + #define PM3RenderPatchOffset_XOffset(x) ((x) & 0xffff) + #define PM3RenderPatchOffset_YOffset(y) (((y) & 0xffff) << 16) #define PM3RLCount 0xb678 - #define PM3RLCount_Count(c) ((c)&0x0fff) + #define PM3RLCount_Count(c) ((c) & 0x0fff) #define PM3RLData 0xb670 /********************************************** -* GLINT Permedia3 Alias Register * +* GLINT Permedia3 Alias Register * ***********************************************/ -#define PM3FillBackgroundColor 0x8330 -#define PM3FillConfig2D0 0x8338 -#define PM3FillConfig2D1 0x8360 - #define PM3FillConfig2D_OpaqueSpan 1<<0 - #define PM3FillConfig2D_MultiRXBlit 1<<1 - #define PM3FillConfig2D_UserScissorEnable 1<<2 - #define PM3FillConfig2D_FBDestReadEnable 1<<3 - #define PM3FillConfig2D_AlphaBlendEnable 1<<4 - #define PM3FillConfig2D_DitherEnable 1<<5 - #define PM3FillConfig2D_ForegroundROPEnable 1<<6 - #define PM3FillConfig2D_ForegroundROP(rop) (((rop)&0xf)<<7) - #define PM3FillConfig2D_BackgroundROPEnable 1<<11 - #define PM3FillConfig2D_BackgroundROP(rop) (((rop)&0xf)<<12) - #define PM3FillConfig2D_UseConstantSource 1<<16 - #define PM3FillConfig2D_FBWriteEnable 1<<17 - #define PM3FillConfig2D_Blocking 1<<18 - #define PM3FillConfig2D_ExternalSourceData 1<<19 - #define PM3FillConfig2D_LUTModeEnable 1<<20 -#define PM3FillFBDestReadBufferAddr 0x8310 -#define PM3FillFBSourceReadBufferAddr 0x8308 -#define PM3FillFBSourceReadBufferOffset 0x8340 - #define PM3FillFBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) - #define PM3FillFBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) -#define PM3FillFBWriteBufferAddr 0x8300 -#define PM3FillForegroundColor0 0x8328 -#define PM3FillForegroundColor1 0x8358 -#define PM3FillGlyphPosition 0x8368 - #define PM3FillGlyphPosition_XOffset(x) ((x)&0xffff) - #define PM3FillGlyphPosition_YOffset(y) (((y)&0xffff)<<16) -#define PM3FillRectanglePosition 0x8348 - #define PM3FillRectanglePosition_XOffset(x) ((x)&0xffff) - #define PM3FillRectanglePosition_YOffset(y) (((y)&0xffff)<<16) +#define PM3FillBackgroundColor 0x8330 +#define PM3FillConfig2D0 0x8338 +#define PM3FillConfig2D1 0x8360 + #define PM3FillConfig2D_OpaqueSpan (1 << 0) + #define PM3FillConfig2D_MultiRXBlit (1 << 1) + #define PM3FillConfig2D_UserScissorEnable (1 << 2) + #define PM3FillConfig2D_FBDestReadEnable (1 << 3) + #define PM3FillConfig2D_AlphaBlendEnable (1 << 4) + #define PM3FillConfig2D_DitherEnable (1 << 5) + #define PM3FillConfig2D_ForegroundROPEnable (1 << 6) + #define PM3FillConfig2D_ForegroundROP(rop) (((rop) & 0xf) << 7) + #define PM3FillConfig2D_BackgroundROPEnable (1 << 11) + #define PM3FillConfig2D_BackgroundROP(rop) (((rop) & 0xf) << 12) + #define PM3FillConfig2D_UseConstantSource (1 << 16) + #define PM3FillConfig2D_FBWriteEnable (1 << 17) + #define PM3FillConfig2D_Blocking (1 << 18) + #define PM3FillConfig2D_ExternalSourceData (1 << 19) + #define PM3FillConfig2D_LUTModeEnable (1 << 20) +#define PM3FillFBDestReadBufferAddr 0x8310 +#define PM3FillFBSourceReadBufferAddr 0x8308 +#define PM3FillFBSourceReadBufferOffset 0x8340 + #define PM3FillFBSourceReadBufferOffset_XOffset(x) ((x) & 0xffff) + #define PM3FillFBSourceReadBufferOffset_YOffset(y) \ + (((y) & 0xffff) << 16) +#define PM3FillFBWriteBufferAddr 0x8300 +#define PM3FillForegroundColor0 0x8328 +#define PM3FillForegroundColor1 0x8358 +#define PM3FillGlyphPosition 0x8368 + #define PM3FillGlyphPosition_XOffset(x) ((x) & 0xffff) + #define PM3FillGlyphPosition_YOffset(y) (((y) & 0xffff) << 16) +#define PM3FillRectanglePosition 0x8348 + #define PM3FillRectanglePosition_XOffset(x) ((x) & 0xffff) + #define PM3FillRectanglePosition_YOffset(y) (((y) & 0xffff) << 16) -#define PM3_REGS_SIZE 0x10000 -#define PM3_MAX_PIXCLOCK 300000 /* a few more useful registers & regs value... */ -#define PM3Sync 0x8c40 - #define PM3Sync_Tag 0x188 -#define PM3FilterMode 0x8c00 - #define PM3FilterModeSync 0x400 -#define PM3OutputFifo 0x2000 -#define PM3StatisticMode 0x8c08 -#define PM3AreaStippleMode 0x81a0 - #define AreaStipplePattern0 (0x8200) - #define AreaStipplePattern1 (0x8208) - #define AreaStipplePattern2 (0x8210) - #define AreaStipplePattern3 (0x8218) - #define AreaStipplePattern4 (0x8220) - #define AreaStipplePattern5 (0x8228) - #define AreaStipplePattern6 (0x8230) - #define AreaStipplePattern7 (0x8238) - #define AreaStipplePattern8 (0x8240) - #define AreaStipplePattern9 (0x8248) - #define AreaStipplePattern10 (0x8250) - #define AreaStipplePattern11 (0x8258) - #define AreaStipplePattern12 (0x8260) - #define AreaStipplePattern13 (0x8268) - #define AreaStipplePattern14 (0x8270) - #define AreaStipplePattern15 (0x8278) - #define AreaStipplePattern16 (0x8280) - #define AreaStipplePattern17 (0x8288) - #define AreaStipplePattern18 (0x8290) - #define AreaStipplePattern19 (0x8298) - #define AreaStipplePattern20 (0x82a0) - #define AreaStipplePattern21 (0x82a8) - #define AreaStipplePattern22 (0x82b0) - #define AreaStipplePattern23 (0x82b8) - #define AreaStipplePattern24 (0x82c0) - #define AreaStipplePattern25 (0x82c8) - #define AreaStipplePattern26 (0x82d0) - #define AreaStipplePattern27 (0x82d8) - #define AreaStipplePattern28 (0x82eo) - #define AreaStipplePattern29 (0x82e8) - #define AreaStipplePattern30 (0x82f0) - #define AreaStipplePattern31 (0x82f8) - #define AreaStipplePattern_indexed(i) (0x8200 + ((i) * 0x8)) +#define PM3Sync 0x8c40 + #define PM3Sync_Tag 0x188 +#define PM3FilterMode 0x8c00 + #define PM3FilterModeSync 0x400 +#define PM3OutputFifo 0x2000 +#define PM3StatisticMode 0x8c08 +#define PM3AreaStippleMode 0x81a0 +#define AreaStipplePattern_indexed(i) (0x8200 + ((i) * 0x8)) -#define PM3DepthMode 0x89a0 -#define PM3StencilMode 0x8988 -#define PM3StencilData 0x8990 -#define PM3TextureReadMode 0x8670 -#define PM3FogMode 0x8690 -#define PM3ChromaTestMode 0x8f18 -#define PM3YUVMode 0x8f00 -#define PM3BitMaskPattern 0x8068 +#define PM3DepthMode 0x89a0 +#define PM3StencilMode 0x8988 +#define PM3StencilData 0x8990 +#define PM3TextureReadMode 0x8670 +#define PM3FogMode 0x8690 +#define PM3ChromaTestMode 0x8f18 +#define PM3YUVMode 0x8f00 +#define PM3BitMaskPattern 0x8068 /* ***************************** */ /* ***** pm3fb IOCTL const ***** */ /* ***************************** */ -/* debug-only IOCTL */ -#define PM3FBIO_CLEARMEMORY 0x504D3300 /* 'PM3\000' */ -#define PM3FBIO_CLEARCMAP 0x504D3301 /* 'PM3\001' */ -/* common use IOCTL */ -#define PM3FBIO_RESETCHIP 0x504D33FF /* 'PM3\377' */ +#define PM3FBIO_RESETCHIP 0x504D33FF /* 'PM3\377' */ /* ***************************************** */ /* ***** pm3fb useful define and macro ***** */ /* ***************************************** */ -/* max size of options */ -#define PM3_OPTIONS_SIZE 256 - -/* max size of font name */ -#define PM3_FONTNAME_SIZE 40 +/* fifo size in chip */ +#define PM3_FIFO_SIZE 120 +#define PM3_REGS_SIZE 0x10000 +#define PM3_MAX_PIXCLOCK 300000 #endif /* PM3FB_H */ diff --git a/include/video/tdfx.h b/include/video/tdfx.h index c1cc94ba3fd..05b63c2a5ab 100644 --- a/include/video/tdfx.h +++ b/include/video/tdfx.h @@ -2,140 +2,140 @@ #define _TDFX_H /* membase0 register offsets */ -#define STATUS 0x00 -#define PCIINIT0 0x04 -#define SIPMONITOR 0x08 -#define LFBMEMORYCONFIG 0x0c -#define MISCINIT0 0x10 -#define MISCINIT1 0x14 -#define DRAMINIT0 0x18 -#define DRAMINIT1 0x1c -#define AGPINIT 0x20 -#define TMUGBEINIT 0x24 -#define VGAINIT0 0x28 -#define VGAINIT1 0x2c -#define DRAMCOMMAND 0x30 -#define DRAMDATA 0x34 -/* reserved 0x38 */ -/* reserved 0x3c */ -#define PLLCTRL0 0x40 -#define PLLCTRL1 0x44 -#define PLLCTRL2 0x48 -#define DACMODE 0x4c -#define DACADDR 0x50 -#define DACDATA 0x54 -#define RGBMAXDELTA 0x58 -#define VIDPROCCFG 0x5c -#define HWCURPATADDR 0x60 -#define HWCURLOC 0x64 -#define HWCURC0 0x68 -#define HWCURC1 0x6c -#define VIDINFORMAT 0x70 -#define VIDINSTATUS 0x74 -#define VIDSERPARPORT 0x78 -#define VIDINXDELTA 0x7c -#define VIDININITERR 0x80 -#define VIDINYDELTA 0x84 -#define VIDPIXBUFTHOLD 0x88 -#define VIDCHRMIN 0x8c -#define VIDCHRMAX 0x90 -#define VIDCURLIN 0x94 -#define VIDSCREENSIZE 0x98 -#define VIDOVRSTARTCRD 0x9c -#define VIDOVRENDCRD 0xa0 -#define VIDOVRDUDX 0xa4 -#define VIDOVRDUDXOFF 0xa8 -#define VIDOVRDVDY 0xac -/* ... */ -#define VIDOVRDVDYOFF 0xe0 -#define VIDDESKSTART 0xe4 -#define VIDDESKSTRIDE 0xe8 -#define VIDINADDR0 0xec -#define VIDINADDR1 0xf0 -#define VIDINADDR2 0xf4 -#define VIDINSTRIDE 0xf8 -#define VIDCUROVRSTART 0xfc - -#define INTCTRL (0x00100000 + 0x04) -#define CLIP0MIN (0x00100000 + 0x08) -#define CLIP0MAX (0x00100000 + 0x0c) -#define DSTBASE (0x00100000 + 0x10) -#define DSTFORMAT (0x00100000 + 0x14) -#define SRCBASE (0x00100000 + 0x34) -#define COMMANDEXTRA_2D (0x00100000 + 0x38) -#define CLIP1MIN (0x00100000 + 0x4c) -#define CLIP1MAX (0x00100000 + 0x50) -#define SRCFORMAT (0x00100000 + 0x54) -#define SRCSIZE (0x00100000 + 0x58) -#define SRCXY (0x00100000 + 0x5c) -#define COLORBACK (0x00100000 + 0x60) -#define COLORFORE (0x00100000 + 0x64) -#define DSTSIZE (0x00100000 + 0x68) -#define DSTXY (0x00100000 + 0x6c) -#define COMMAND_2D (0x00100000 + 0x70) -#define LAUNCH_2D (0x00100000 + 0x80) - -#define COMMAND_3D (0x00200000 + 0x120) +#define STATUS 0x00 +#define PCIINIT0 0x04 +#define SIPMONITOR 0x08 +#define LFBMEMORYCONFIG 0x0c +#define MISCINIT0 0x10 +#define MISCINIT1 0x14 +#define DRAMINIT0 0x18 +#define DRAMINIT1 0x1c +#define AGPINIT 0x20 +#define TMUGBEINIT 0x24 +#define VGAINIT0 0x28 +#define VGAINIT1 0x2c +#define DRAMCOMMAND 0x30 +#define DRAMDATA 0x34 +/* reserved 0x38 */ +/* reserved 0x3c */ +#define PLLCTRL0 0x40 +#define PLLCTRL1 0x44 +#define PLLCTRL2 0x48 +#define DACMODE 0x4c +#define DACADDR 0x50 +#define DACDATA 0x54 +#define RGBMAXDELTA 0x58 +#define VIDPROCCFG 0x5c +#define HWCURPATADDR 0x60 +#define HWCURLOC 0x64 +#define HWCURC0 0x68 +#define HWCURC1 0x6c +#define VIDINFORMAT 0x70 +#define VIDINSTATUS 0x74 +#define VIDSERPARPORT 0x78 +#define VIDINXDELTA 0x7c +#define VIDININITERR 0x80 +#define VIDINYDELTA 0x84 +#define VIDPIXBUFTHOLD 0x88 +#define VIDCHRMIN 0x8c +#define VIDCHRMAX 0x90 +#define VIDCURLIN 0x94 +#define VIDSCREENSIZE 0x98 +#define VIDOVRSTARTCRD 0x9c +#define VIDOVRENDCRD 0xa0 +#define VIDOVRDUDX 0xa4 +#define VIDOVRDUDXOFF 0xa8 +#define VIDOVRDVDY 0xac +/* ... */ +#define VIDOVRDVDYOFF 0xe0 +#define VIDDESKSTART 0xe4 +#define VIDDESKSTRIDE 0xe8 +#define VIDINADDR0 0xec +#define VIDINADDR1 0xf0 +#define VIDINADDR2 0xf4 +#define VIDINSTRIDE 0xf8 +#define VIDCUROVRSTART 0xfc + +#define INTCTRL (0x00100000 + 0x04) +#define CLIP0MIN (0x00100000 + 0x08) +#define CLIP0MAX (0x00100000 + 0x0c) +#define DSTBASE (0x00100000 + 0x10) +#define DSTFORMAT (0x00100000 + 0x14) +#define SRCBASE (0x00100000 + 0x34) +#define COMMANDEXTRA_2D (0x00100000 + 0x38) +#define CLIP1MIN (0x00100000 + 0x4c) +#define CLIP1MAX (0x00100000 + 0x50) +#define SRCFORMAT (0x00100000 + 0x54) +#define SRCSIZE (0x00100000 + 0x58) +#define SRCXY (0x00100000 + 0x5c) +#define COLORBACK (0x00100000 + 0x60) +#define COLORFORE (0x00100000 + 0x64) +#define DSTSIZE (0x00100000 + 0x68) +#define DSTXY (0x00100000 + 0x6c) +#define COMMAND_2D (0x00100000 + 0x70) +#define LAUNCH_2D (0x00100000 + 0x80) + +#define COMMAND_3D (0x00200000 + 0x120) /* register bitfields (not all, only as needed) */ -#define BIT(x) (1UL << (x)) +#define BIT(x) (1UL << (x)) /* COMMAND_2D reg. values */ -#define TDFX_ROP_COPY 0xcc // src -#define TDFX_ROP_INVERT 0x55 // NOT dst -#define TDFX_ROP_XOR 0x66 // src XOR dst - -#define AUTOINC_DSTX BIT(10) -#define AUTOINC_DSTY BIT(11) -#define COMMAND_2D_FILLRECT 0x05 -#define COMMAND_2D_S2S_BITBLT 0x01 // screen to screen -#define COMMAND_2D_H2S_BITBLT 0x03 // host to screen - -#define COMMAND_3D_NOP 0x00 -#define STATUS_RETRACE BIT(6) -#define STATUS_BUSY BIT(9) -#define MISCINIT1_CLUT_INV BIT(0) -#define MISCINIT1_2DBLOCK_DIS BIT(15) -#define DRAMINIT0_SGRAM_NUM BIT(26) -#define DRAMINIT0_SGRAM_TYPE BIT(27) -#define DRAMINIT0_SGRAM_TYPE_MASK (BIT(27)|BIT(28)|BIT(29)) +#define TDFX_ROP_COPY 0xcc /* src */ +#define TDFX_ROP_INVERT 0x55 /* NOT dst */ +#define TDFX_ROP_XOR 0x66 /* src XOR dst */ + +#define AUTOINC_DSTX BIT(10) +#define AUTOINC_DSTY BIT(11) +#define COMMAND_2D_FILLRECT 0x05 +#define COMMAND_2D_S2S_BITBLT 0x01 /* screen to screen */ +#define COMMAND_2D_H2S_BITBLT 0x03 /* host to screen */ + +#define COMMAND_3D_NOP 0x00 +#define STATUS_RETRACE BIT(6) +#define STATUS_BUSY BIT(9) +#define MISCINIT1_CLUT_INV BIT(0) +#define MISCINIT1_2DBLOCK_DIS BIT(15) +#define DRAMINIT0_SGRAM_NUM BIT(26) +#define DRAMINIT0_SGRAM_TYPE BIT(27) +#define DRAMINIT0_SGRAM_TYPE_MASK (BIT(27) | BIT(28) | BIT(29)) #define DRAMINIT0_SGRAM_TYPE_SHIFT 27 -#define DRAMINIT1_MEM_SDRAM BIT(30) -#define VGAINIT0_VGA_DISABLE BIT(0) -#define VGAINIT0_EXT_TIMING BIT(1) -#define VGAINIT0_8BIT_DAC BIT(2) -#define VGAINIT0_EXT_ENABLE BIT(6) -#define VGAINIT0_WAKEUP_3C3 BIT(8) -#define VGAINIT0_LEGACY_DISABLE BIT(9) -#define VGAINIT0_ALT_READBACK BIT(10) -#define VGAINIT0_FAST_BLINK BIT(11) -#define VGAINIT0_EXTSHIFTOUT BIT(12) -#define VGAINIT0_DECODE_3C6 BIT(13) -#define VGAINIT0_SGRAM_HBLANK_DISABLE BIT(22) -#define VGAINIT1_MASK 0x1fffff -#define VIDCFG_VIDPROC_ENABLE BIT(0) -#define VIDCFG_CURS_X11 BIT(1) -#define VIDCFG_INTERLACE BIT(3) -#define VIDCFG_HALF_MODE BIT(4) -#define VIDCFG_DESK_ENABLE BIT(7) -#define VIDCFG_CLUT_BYPASS BIT(10) -#define VIDCFG_2X BIT(26) -#define VIDCFG_HWCURSOR_ENABLE BIT(27) +#define DRAMINIT1_MEM_SDRAM BIT(30) +#define VGAINIT0_VGA_DISABLE BIT(0) +#define VGAINIT0_EXT_TIMING BIT(1) +#define VGAINIT0_8BIT_DAC BIT(2) +#define VGAINIT0_EXT_ENABLE BIT(6) +#define VGAINIT0_WAKEUP_3C3 BIT(8) +#define VGAINIT0_LEGACY_DISABLE BIT(9) +#define VGAINIT0_ALT_READBACK BIT(10) +#define VGAINIT0_FAST_BLINK BIT(11) +#define VGAINIT0_EXTSHIFTOUT BIT(12) +#define VGAINIT0_DECODE_3C6 BIT(13) +#define VGAINIT0_SGRAM_HBLANK_DISABLE BIT(22) +#define VGAINIT1_MASK 0x1fffff +#define VIDCFG_VIDPROC_ENABLE BIT(0) +#define VIDCFG_CURS_X11 BIT(1) +#define VIDCFG_INTERLACE BIT(3) +#define VIDCFG_HALF_MODE BIT(4) +#define VIDCFG_DESK_ENABLE BIT(7) +#define VIDCFG_CLUT_BYPASS BIT(10) +#define VIDCFG_2X BIT(26) +#define VIDCFG_HWCURSOR_ENABLE BIT(27) #define VIDCFG_PIXFMT_SHIFT 18 -#define DACMODE_2X BIT(0) +#define DACMODE_2X BIT(0) /* VGA rubbish, need to change this for multihead support */ -#define MISC_W 0x3c2 -#define MISC_R 0x3cc -#define SEQ_I 0x3c4 -#define SEQ_D 0x3c5 -#define CRT_I 0x3d4 -#define CRT_D 0x3d5 -#define ATT_IW 0x3c0 -#define IS1_R 0x3da -#define GRA_I 0x3ce -#define GRA_D 0x3cf +#define MISC_W 0x3c2 +#define MISC_R 0x3cc +#define SEQ_I 0x3c4 +#define SEQ_D 0x3c5 +#define CRT_I 0x3d4 +#define CRT_D 0x3d5 +#define ATT_IW 0x3c0 +#define IS1_R 0x3da +#define GRA_I 0x3ce +#define GRA_D 0x3cf #ifdef __KERNEL__ @@ -143,9 +143,9 @@ struct banshee_reg { /* VGA rubbish */ unsigned char att[21]; unsigned char crt[25]; - unsigned char gra[ 9]; + unsigned char gra[9]; unsigned char misc[1]; - unsigned char seq[ 5]; + unsigned char seq[5]; /* Banshee extensions */ unsigned char ext[2]; @@ -167,8 +167,6 @@ struct banshee_reg { unsigned long clip0max; unsigned long clip1min; unsigned long clip1max; - unsigned long srcbase; - unsigned long dstbase; unsigned long miscinit0; }; @@ -177,18 +175,10 @@ struct tdfx_par { u32 palette[16]; void __iomem *regbase_virt; unsigned long iobase; - u32 baseline; - - struct { - int w,u,d; - unsigned long enable,disable; - struct timer_list timer; - } hwcursor; - - spinlock_t DAClock; + int mtrr_handle; }; -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ -#endif /* _TDFX_H */ +#endif /* _TDFX_H */ diff --git a/include/video/uvesafb.h b/include/video/uvesafb.h new file mode 100644 index 00000000000..95bcef19395 --- /dev/null +++ b/include/video/uvesafb.h @@ -0,0 +1,193 @@ +#ifndef _UVESAFB_H +#define _UVESAFB_H + +struct v86_regs { + __u32 ebx; + __u32 ecx; + __u32 edx; + __u32 esi; + __u32 edi; + __u32 ebp; + __u32 eax; + __u32 eip; + __u32 eflags; + __u32 esp; + __u16 cs; + __u16 ss; + __u16 es; + __u16 ds; + __u16 fs; + __u16 gs; +}; + +/* Task flags */ +#define TF_VBEIB 0x01 +#define TF_BUF_ESDI 0x02 +#define TF_BUF_ESBX 0x04 +#define TF_BUF_RET 0x08 +#define TF_EXIT 0x10 + +struct uvesafb_task { + __u8 flags; + int buf_len; + struct v86_regs regs; +}; + +/* Constants for the capabilities field + * in vbe_ib */ +#define VBE_CAP_CAN_SWITCH_DAC 0x01 +#define VBE_CAP_VGACOMPAT 0x02 + +/* The VBE Info Block */ +struct vbe_ib { + char vbe_signature[4]; + __u16 vbe_version; + __u32 oem_string_ptr; + __u32 capabilities; + __u32 mode_list_ptr; + __u16 total_memory; + __u16 oem_software_rev; + __u32 oem_vendor_name_ptr; + __u32 oem_product_name_ptr; + __u32 oem_product_rev_ptr; + __u8 reserved[222]; + char oem_data[256]; + char misc_data[512]; +} __attribute__ ((packed)); + +#ifdef __KERNEL__ + +/* VBE CRTC Info Block */ +struct vbe_crtc_ib { + u16 horiz_total; + u16 horiz_start; + u16 horiz_end; + u16 vert_total; + u16 vert_start; + u16 vert_end; + u8 flags; + u32 pixel_clock; + u16 refresh_rate; + u8 reserved[40]; +} __attribute__ ((packed)); + +#define VBE_MODE_VGACOMPAT 0x20 +#define VBE_MODE_COLOR 0x08 +#define VBE_MODE_SUPPORTEDHW 0x01 +#define VBE_MODE_GRAPHICS 0x10 +#define VBE_MODE_LFB 0x80 + +#define VBE_MODE_MASK (VBE_MODE_COLOR | VBE_MODE_SUPPORTEDHW | \ + VBE_MODE_GRAPHICS | VBE_MODE_LFB) + +/* VBE Mode Info Block */ +struct vbe_mode_ib { + /* for all VBE revisions */ + u16 mode_attr; + u8 winA_attr; + u8 winB_attr; + u16 win_granularity; + u16 win_size; + u16 winA_seg; + u16 winB_seg; + u32 win_func_ptr; + u16 bytes_per_scan_line; + + /* for VBE 1.2+ */ + u16 x_res; + u16 y_res; + u8 x_char_size; + u8 y_char_size; + u8 planes; + u8 bits_per_pixel; + u8 banks; + u8 memory_model; + u8 bank_size; + u8 image_pages; + u8 reserved1; + + /* Direct color fields for direct/6 and YUV/7 memory models. */ + /* Offsets are bit positions of lsb in the mask. */ + u8 red_len; + u8 red_off; + u8 green_len; + u8 green_off; + u8 blue_len; + u8 blue_off; + u8 rsvd_len; + u8 rsvd_off; + u8 direct_color_info; /* direct color mode attributes */ + + /* for VBE 2.0+ */ + u32 phys_base_ptr; + u8 reserved2[6]; + + /* for VBE 3.0+ */ + u16 lin_bytes_per_scan_line; + u8 bnk_image_pages; + u8 lin_image_pages; + u8 lin_red_len; + u8 lin_red_off; + u8 lin_green_len; + u8 lin_green_off; + u8 lin_blue_len; + u8 lin_blue_off; + u8 lin_rsvd_len; + u8 lin_rsvd_off; + u32 max_pixel_clock; + u16 mode_id; + u8 depth; +} __attribute__ ((packed)); + +#define UVESAFB_DEFAULT_MODE "640x480-16" + +/* How long to wait for a reply from userspace [ms] */ +#define UVESAFB_TIMEOUT 5000 + +/* Max number of concurrent tasks */ +#define UVESAFB_TASKS_MAX 16 + +#define dac_reg (0x3c8) +#define dac_val (0x3c9) + +struct uvesafb_pal_entry { + u_char blue, green, red, pad; +} __attribute__ ((packed)); + +struct uvesafb_ktask { + struct uvesafb_task t; + void *buf; + struct completion *done; + u32 ack; +}; + +static int uvesafb_exec(struct uvesafb_ktask *tsk); + +#define UVESAFB_EXACT_RES 1 +#define UVESAFB_EXACT_DEPTH 2 + +struct uvesafb_par { + struct vbe_ib vbe_ib; /* VBE Info Block */ + struct vbe_mode_ib *vbe_modes; /* list of supported VBE modes */ + int vbe_modes_cnt; + + u8 nocrtc; + u8 ypan; /* 0 - nothing, 1 - ypan, 2 - ywrap */ + u8 pmi_setpal; /* PMI for palette changes */ + u16 *pmi_base; /* protected mode interface location */ + void *pmi_start; + void *pmi_pal; + u8 *vbe_state_orig; /* + * original hardware state, before the + * driver was loaded + */ + u8 *vbe_state_saved; /* state saved by fb_save_state */ + int vbe_state_size; + atomic_t ref_count; + + int mode_idx; + struct vbe_crtc_ib crtc; +}; + +#endif /* __KERNEL__ */ +#endif /* _UVESAFB_H */ |