From: Steve L. <slo...@us...> - 2002-09-17 18:20:05
|
Update of /cvsroot/linux-mips/linux/drivers/video In directory usw-pr-cvs1:/tmp/cvs-serv30225/drivers/video Modified Files: epson1356fb.c epson1356fb.h Log Message: - consolidate all architectures to use type phys_addr_t for physical addresses. MIPS-only phys_t is gone, replaced with phys_addr_t. - remap_page_range() will "fixup" physaddr's for platforms with 64-bit physaddr support enabled, just as __ioremap() does. Index: epson1356fb.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/video/epson1356fb.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- epson1356fb.c 12 Apr 2002 22:58:28 -0000 1.9 +++ epson1356fb.c 17 Sep 2002 18:20:01 -0000 1.10 @@ -215,9 +215,6 @@ static struct e1356fb_fix boot_fix; // boot options static struct e1356fb_par boot_par; // boot options -static int e1356_remap_page_range(unsigned long from, phys_t phys_addr, unsigned long size, pgprot_t prot); - - /* ------------------------------------------------------------------------- * Hardware-specific funcions * ------------------------------------------------------------------------- */ @@ -2078,11 +2075,7 @@ { struct fb_info_e1356 *info = (struct fb_info_e1356*)fb; unsigned int len; -#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) - u64 start=0, off; -#else - unsigned long start=0, off; -#endif + phys_addr_t start=0, off; if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { DPRINTK("invalid vma->vm_pgoff\n"); @@ -2163,17 +2156,10 @@ if (info->fix.mmunalign) vma->vm_start += 2; -#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) - if (e1356_remap_page_range(vma->vm_start, off, - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) - return -EAGAIN; -#else if (io_remap_page_range(vma->vm_start, off, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; -#endif info->mmaped = 1; return 0; @@ -3060,99 +3046,3 @@ printk("e1356fb: reserving 1024 bytes for the hwcursor at %p\n", fb_info.membase_virt + fb_info.fb_size); } - -#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) - -/* - * Return indicates whether a page was freed so caller can adjust rss - */ -static inline void forget_pte(pte_t page) -{ - if (!pte_none(page)) { - printk("forget_pte: old mapping existed!\n"); - BUG(); - } -} - -/* - * maps a range of physical memory into the requested pages. the old - * mappings are removed. any references to nonexistent pages results - * in null mappings (currently treated as "copy-on-access") - */ -static inline void e1356_remap_pte_range(pte_t * pte, unsigned long address, unsigned long size, - phys_t phys_addr, pgprot_t prot) -{ - unsigned long end; - - address &= ~PMD_MASK; - end = address + size; - if (end > PMD_SIZE) - end = PMD_SIZE; - do { - struct page *page; - pte_t oldpage; - oldpage = ptep_get_and_clear(pte); - - page = virt_to_page(__va(phys_addr)); - if ((!VALID_PAGE(page)) || PageReserved(page)) - set_pte(pte, mk_pte_phys(phys_addr, prot)); - forget_pte(oldpage); - address += PAGE_SIZE; - phys_addr += PAGE_SIZE; - pte++; - } while (address && (address < end)); -} - -static inline int e1356_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size, - phys_t phys_addr, pgprot_t prot) -{ - unsigned long end; - - address &= ~PGDIR_MASK; - end = address + size; - if (end > PGDIR_SIZE) - end = PGDIR_SIZE; - phys_addr -= address; - do { - pte_t * pte = pte_alloc(mm, pmd, address); - if (!pte) - return -ENOMEM; - e1356_remap_pte_range(pte, address, end - address, address + phys_addr, prot); - address = (address + PMD_SIZE) & PMD_MASK; - pmd++; - } while (address && (address < end)); - return 0; -} - -/* Note: this is only safe if the mm semaphore is held when called. */ -static int e1356_remap_page_range(unsigned long from, phys_t phys_addr, unsigned long size, pgprot_t prot) -{ - int error = 0; - pgd_t * dir; - phys_t beg = from; - phys_t end = from + size; - struct mm_struct *mm = current->mm; - - phys_addr -= from; - dir = pgd_offset(mm, from); - flush_cache_range(mm, beg, end); - if (from >= end) - BUG(); - - spin_lock(&mm->page_table_lock); - do { - pmd_t *pmd = pmd_alloc(mm, dir, from); - error = -ENOMEM; - if (!pmd) - break; - error = e1356_remap_pmd_range(mm, pmd, from, end - from, phys_addr + from, prot); - if (error) - break; - from = (from + PGDIR_SIZE) & PGDIR_MASK; - dir++; - } while (from && (from < end)); - spin_unlock(&mm->page_table_lock); - flush_tlb_range(mm, beg, end); - return error; -} -#endif Index: epson1356fb.h =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/video/epson1356fb.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- epson1356fb.h 2 Apr 2002 22:38:34 -0000 1.7 +++ epson1356fb.h 17 Sep 2002 18:20:01 -0000 1.8 @@ -321,8 +321,8 @@ struct e1356fb_fix { int system; // the number of a pre-packaged system - u64 regbase_phys; // phys start address of registers - u64 membase_phys; // phys start address of fb memory + phys_addr_t regbase_phys; // phys start address of registers + phys_addr_t membase_phys; // phys start address of fb memory // Memory parameters int mem_speed; // speed: 50, 60, 70, or 80 (nsec) @@ -482,17 +482,6 @@ { { // fix SYS_PB1000, - /* - * Note!: these are "pseudo" physical addresses; - * the SED1356 is not actually mapped here, but rather - * at the 36-bit address of 0xE 0000 0000. There is an - * ugly hack in the Au1000 TLB refill handler that will - * translate pte_t's in the range 0xE000 0000 --> - * 0xEFFF FFFF to the 36-bit range 0xE 0000 0000 --> - * 0xE 0FFF FFFF. The long-term solution is to support - * 36-bit physical addresses in linux-mips32 mm, since - * the mips32 specification specifically supports this. - */ 0xE00000000, 0xE00200000, 60, MEM_TYPE_EDO_2CAS, 64, MEM_SMR_CBR, 0, 0, // BUSCLK and MCLK are calculated at run-time @@ -539,17 +528,6 @@ { { // fix SYS_PB1500, - /* - * Note!: these are "pseudo" physical addresses; - * the SED1356 is not actually mapped here, but rather - * at the 36-bit address of 0xE 0000 0000. There is an - * ugly hack in the Au1000 TLB refill handler that will - * translate pte_t's in the range 0xE000 0000 --> - * 0xEFFF FFFF to the 36-bit range 0xE 0000 0000 --> - * 0xE 0FFF FFFF. The long-term solution is to support - * 36-bit physical addresses in linux-mips32 mm, since - * the mips32 specification specifically supports this. - */ 0xE1B000000, 0xE1B200000, 50, MEM_TYPE_EMBEDDED_SDRAM, 64, MEM_SMR_CBR, 0, 0, // BUSCLK and MCLK are calculated at run-time |