linux-mips
[Top] [All Lists]

Re: [PATCH] override of arch/mips/mm/cache.c: __uncached_access

To: tiansm@lemote.com
Subject: Re: [PATCH] override of arch/mips/mm/cache.c: __uncached_access
From: Fuxin Zhang <zhangfx@lemote.com>
Date: Thu, 07 Jun 2007 14:22:59 +0800
Cc: linux-mips@linux-mips.org
In-reply-to: <11811962573610-git-send-email-tiansm@lemote.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20070606182814.GD30017@linux-mips.org> <11811962573610-git-send-email-tiansm@lemote.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.0 (Windows/20070326)
Recent Xorg depends on this hack/patch.

For example,if we are using this memory layout:
0-256MB phys mem
256-512M pci io/mem region
512-768MB phys mem
Xorg will crash due to pci video memory mapping problem.

So this is not really only for Fulong.

BTW:
Songmao, we'd better add a comment to justify this code.

tiansm@lemote.com 写道:
> From: Songmao Tian <tiansm@lemote.com>
>
> Signed-off-by: Songmao Tian <tiansm@lemote.com>
> ---
>  arch/mips/lemote/lm2e/Makefile |    2 +-
>  arch/mips/lemote/lm2e/mem.c    |   25 +++++++++++++++++++++++++
>  2 files changed, 26 insertions(+), 1 deletions(-)
>  create mode 100644 arch/mips/lemote/lm2e/mem.c
>
> diff --git a/arch/mips/lemote/lm2e/Makefile b/arch/mips/lemote/lm2e/Makefile
> index 0ba6f12..fb1b48c 100644
> --- a/arch/mips/lemote/lm2e/Makefile
> +++ b/arch/mips/lemote/lm2e/Makefile
> @@ -2,6 +2,6 @@
>  # Makefile for Lemote Fulong mini-PC board.
>  #
>  
> -obj-y += setup.o prom.o reset.o irq.o pci.o bonito-irq.o dbg_io.o
> +obj-y += setup.o prom.o reset.o irq.o pci.o bonito-irq.o dbg_io.o mem.o
>  EXTRA_AFLAGS := $(CFLAGS)
>  
> diff --git a/arch/mips/lemote/lm2e/mem.c b/arch/mips/lemote/lm2e/mem.c
> new file mode 100644
> index 0000000..6068a17
> --- /dev/null
> +++ b/arch/mips/lemote/lm2e/mem.c
> @@ -0,0 +1,25 @@
> +/*
> + * 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;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +#include <linux/fs.h>
> +#include <linux/fcntl.h>
> +#include <linux/mm.h>
> +
> +/* override of arch/mips/mm/cache.c: __uncached_access */
> +int __uncached_access(struct file *file, unsigned long addr)
> +{
> +     if (file->f_flags & O_SYNC)
> +             return 1;
> +
> +     /* 
> +      * on lemote loongson 2e system, peripheral register 
> +      * reside between 0x1000 0000 and 0x2000 0000
> +      */
> +     return addr >= __pa(high_memory) ||
> +             ((addr >=0x10000000) && (addr < 0x20000000));
> +}
> +
>   

-- 
------------------------------------------------
张福新
江苏中科龙梦科技有限公司
地址:江苏省常熟市虞山镇梦兰工业园

General Manager
JiangSu Lemote Corp. Ltd.
MengLan, Yushan, Changshu, JiangSu Province, China
ZIP: 215500 
Tel: 86-512-52308679
Fax: 86-512-52308688
Email: zhangfx@lemote.com
http://www.lemote.com
------------------------------------------------
 


<Prev in Thread] Current Thread [Next in Thread>