ts-7000
[Top] [All Lists]

[ts-7000] Re: [2.6.28.3-m] Fix sparsemem bug

To:
Subject: [ts-7000] Re: [2.6.28.3-m] Fix sparsemem bug
From: "charliem_1216" <>
Date: Wed, 11 Feb 2009 05:51:21 -0000
Hi Christian --

--- In  Christian Gagneraud <>
wrote:
>
> Hi all,
> 
> Here is a fix to be able to boot a ts7260 with 64MB of SDRAM using the 
> kernel 2.6.28.3-m.
> If people could test it, as i'm not sure this is the definitive answer 
> to the problem.
> 
> In short, it was as simple as a clash between C macros and inline 
> function!  (+ potentially the 0xC0000000 thingie pointed to by Charlie).

Nice spotting!  I looked at that quite a few times, wondering why the
mappings were still going to 0xa0000000, without realizing why the new
mapping functions were not being used.

> If you have a look at arch/arm/include/asm/memory.h, you will see this:
> #ifndef __virt_to_phys
> #define __virt_to_phys(x)     ((x) - PAGE_OFFSET + PHYS_OFFSET)
> #define __phys_to_virt(x)     ((x) - PHYS_OFFSET + PAGE_OFFSET)
> #endif
> 
> I realized that once __phys_to_virt() modified to try Charlie's 
> remark, i still get 0xe0000000 translated to 0xa0000000, which was 
> impossible unless i was not using my modified version.
> 
> I did not run extensive tests, but at least my kernel boot and shows:
> Memory: 8MB 8MB 8MB 8MB 8MB 8MB 8MB 8MB = 64MB total
> 
> 
> Regards,
> Christian
> 
> --- linux-2.6.28.3-m/arch/arm/mach-ep93xx/include/mach/memory.h
2009-02-10 19:58:51.000000000 +0000
> +++ linux-2.6.28.3-fixed/arch/arm/mach-ep93xx/include/mach/memory.h
2009-02-10 19:56:48.000000000 +0000
> @@ -13,14 +13,19 @@
>  #ifndef __ASSEMBLY__
>  static inline unsigned long __phys_to_virt(unsigned long pa)
>  {
> -     return (pa & 0x07ffffff) | ((pa & 0xe0000000) ? 0x08000000 : 0);
> +     return (pa & 0x07ffffff) | ((pa & 0xe0000000) ? 0x08000000 : 0) |
CONFIG_PAGE_OFFSET;
>  }
>  
>  static inline unsigned long __virt_to_phys(unsigned long va)
>  {
>       return (va & 0x07ffffff) | ((va & 0x08000000) ? 0xe0000000 : 0);
>  }
> -#endif

My first thought was that __virt_to_phys needed to change as well, but
working through the mappings it seems right like above.

> +
> +/* We need to define them as macro as well otherwise
> +   __ASM_ARM_MEMORY_H will define them with defaults values */
> +#define __phys_to_virt(pa) __phys_to_virt((pa))
> +#define __virt_to_phys(va) __virt_to_phys((va))
> +#endif 

I think this is confusing and not needed.  Why not just have the
following #defines:

#define __phys_to_virt(p)   \
        (((p) & 0x07ffffff) | (((p) & 0xe0000000) ? 0x08000000 : 0) |
CONFIG_PAGE_OFFSET)
#define __virt_to_phys(v)   \
        (((v) & 0x07ffffff) | (((v) & 0x08000000) ? 0xe0000000 : 0 ))

regards, ......... Charlie

>  #define SECTION_SIZE_BITS 24
>  #define MAX_PHYSMEM_BITS 32
>




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

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

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU