linux-mips
[Top] [All Lists]

Re: [PATCH] cleanup hardcoding __pa/__va macros etc.

To: girishvg@gmail.com
Subject: Re: [PATCH] cleanup hardcoding __pa/__va macros etc.
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 25 Sep 2006 00:26:16 +0900 (JST)
Cc: linux-mips@linux-mips.org
In-reply-to: <34a75100609232239y29cdabd4xeefb898e502c5dfa@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <34a75100609232239y29cdabd4xeefb898e502c5dfa@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
On Sun, 24 Sep 2006 14:39:38 +0900, girish <girishvg@gmail.com> wrote:
> --- linux-vanilla/include/asm-mips/page.h     2006-09-24 12:23:34.000000000 
> +0900
> +++ linux/include/asm-mips/page.h     2006-09-24 14:00:53.000000000 +0900
> @@ -134,8 +134,13 @@ typedef struct { unsigned long pgprot; }
>  /* to align the pointer to the (next) page boundary */
>  #define PAGE_ALIGN(addr)     (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
> 
> -#define __pa(x)                      ((unsigned long) (x) - PAGE_OFFSET)
> -#define __va(x)                      ((void *)((unsigned long) (x) + 
> PAGE_OFFSET))
> +#define UNMAPLIMIT              (UNCAC_BASE - CAC_BASE) /*HIGHMEM_START*/
> +#define ISMAPPED(x)             (KSEGX((x)) > UNMAPLIMIT)
> +#define ___pa(x)             ((unsigned long) (x) - PAGE_OFFSET)
> +#define __pa(x)                      (ISMAPPED(x) ? (x) : ___pa(x))
> +
> +#define ___va(x)             ((void *)((unsigned long) (x) + PAGE_OFFSET))
> +#define __va(x)                      (ISMAPPED(x) ? (x) : ___va(x))
> 
>  #define pfn_to_kaddr(pfn)    __va((pfn) << PAGE_SHIFT)

This part looks broken for 64-bit kernel.

For other parts, it would be better to keep correct indentation level.

---
Atsushi Nemoto

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