Changeset ae5fb7c8 in mainline


Ignore:
Timestamp:
2013-08-07T21:02:08Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
15187c3
Parents:
0c40fd5
Message:

arm32: Set proper memory type in boot pt.

Add explanatory comments.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/arm32/src/mm.c

    r0c40fd5 rae5fb7c8  
    141141        pte->access_permission_0 = PTE_AP_USER_NO_KERNEL_RW;
    142142#ifdef PROCESSOR_ARCH_armv7_a
     143        /*
     144         * Keeps this setting in sync with memory type attributes in:
     145         * init_boot_pt (boot/arch/arm32/src/mm.c)
     146         * set_pt_level1_flags (kernel/arch/arm32/include/arch/mm/page_armv6.h)
     147         * set_ptl0_addr (kernel/arch/arm32/include/arch/mm/page.h)
     148         */
    143149        //TODO: Use write-back write-allocate caches
    144150        pte->tex = section_cacheable(frame) ? 6 : 0;
     
    161167static void init_boot_pt(void)
    162168{
    163         const pfn_t split_page = PTL0_ENTRIES;
    164         /* Create 1:1 virtual-physical mapping (in lower 2 GB). */
    165         pfn_t page;
    166         for (page = 0; page < split_page; page++)
     169        /*
     170         * Create 1:1 virtual-physical mapping.
     171         * Physical memory on BBxM a BBone starts at 2GB
     172         * boundary, gta02 has a memory mirror at 2GB.
     173         * icp somehow works (probably due to limited address size)
     174         */
     175        for (pfn_t page = 0; page < PTL0_ENTRIES; page++)
    167176                init_ptl0_section(&boot_pt[page], page);
    168        
    169         asm volatile (
    170                 "mcr p15, 0, %[pt], c2, c0, 0\n"
    171                 :: [pt] "r" (boot_pt)
    172         );
     177
     178        /*
     179         * Tell MMU page might be cached. Keeps this setting in sync
     180         * with memory type attributes in:
     181         * init_ptl0_section (boot/arch/arm32/src/mm.c)
     182         * set_pt_level1_flags (kernel/arch/arm32/include/arch/mm/page_armv6.h)
     183         * set_ptl0_addr (kernel/arch/arm32/include/arch/mm/page.h)
     184         */
     185        uint32_t val = (uint32_t)boot_pt & TTBR_ADDR_MASK;
     186        val |= TTBR_RGN_WT_CACHE | TTBR_C_FLAG;
     187        TTBR0_write(val);
    173188}
    174189
  • kernel/arch/arm32/include/arch/mm/page.h

    r0c40fd5 rae5fb7c8  
    146146 *
    147147 * Page tables are always in cacheable memory.
    148  * Make sure the memory type is correct.
     148 * Make sure the memory type is correct, and in sync with:
     149 * init_boot_pt (boot/arch/arm32/src/mm.c)
     150 * init_ptl0_section (boot/arch/arm32/src/mm.c)
     151 * set_pt_level1_flags (kernel/arch/arm32/include/arch/mm/page_armv6.h)
    149152 */
    150153NO_TRACE static inline void set_ptl0_addr(pte_t *pt)
  • kernel/arch/arm32/include/arch/mm/page_armv6.h

    r0c40fd5 rae5fb7c8  
    260260                 * Write-through, no write-allocate memory, see ch. B3.8.2
    261261                 * (p. B3-1358) of ARM Architecture reference manual.
     262                 * Make sure the memory type is correct, and in sync with:
     263                 * init_boot_pt (boot/arch/arm32/src/mm.c)
     264                 * init_ptl0_section (boot/arch/arm32/src/mm.c)
     265                 * set_ptl0_addr (kernel/arch/arm32/include/arch/mm/page.h)
    262266                 */
    263267                //TODO: Use writeback, write-allocate caches
Note: See TracChangeset for help on using the changeset viewer.