Ignore:
File:
1 edited

Legend:

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

    r9d58539 rdf334ca  
    3838#include <arch/mm.h>
    3939
     40/** Check if caching can be enabled for a given memory section.
     41 *
     42 * Memory areas used for I/O are excluded from caching.
     43 * At the moment caching is enabled only on GTA02.
     44 *
     45 * @param section       The section number.
     46 *
     47 * @return      1 if the given section can be mapped as cacheable, 0 otherwise.
     48*/
     49static inline int section_cacheable(pfn_t section)
     50{
     51#ifdef MACHINE_gta02
     52        unsigned long address = section << PTE_SECTION_SHIFT;
     53
     54        if (address >= GTA02_IOMEM_START && address < GTA02_IOMEM_END)
     55                return 0;
     56        else
     57                return 1;
     58#elif defined MACHINE_beagleboardxm
     59        const unsigned long address = section << PTE_SECTION_SHIFT;
     60        if (address >= BBXM_RAM_START && address < BBXM_RAM_END)
     61                return 1;
     62#endif
     63        return 0;
     64}
     65
    4066/** Initialize "section" page table entry.
    4167 *
     
    5480{
    5581        pte->descriptor_type = PTE_DESCRIPTOR_SECTION;
    56         pte->bufferable = 0;
    57         pte->cacheable = 0;
    58         pte->impl_specific = 0;
     82        pte->bufferable = 1;
     83        pte->cacheable = section_cacheable(frame);
     84        pte->xn = 0;
    5985        pte->domain = 0;
    6086        pte->should_be_zero_1 = 0;
    61         pte->access_permission = PTE_AP_USER_NO_KERNEL_RW;
     87        pte->access_permission_0 = PTE_AP_USER_NO_KERNEL_RW;
     88        pte->tex = 0;
     89        pte->access_permission_1 = 0;
     90        pte->non_global = 0;
    6291        pte->should_be_zero_2 = 0;
     92        pte->non_secure = 0;
    6393        pte->section_base_addr = frame;
    6494}
     
    6797static void init_boot_pt(void)
    6898{
    69         pfn_t split_page = 0x800;
    70        
     99        const pfn_t split_page = PTL0_ENTRIES;
    71100        /* Create 1:1 virtual-physical mapping (in lower 2 GB). */
    72101        pfn_t page;
     
    78107         * (upper 2 GB), physical addresses start from 0.
    79108         */
     109        /* BeagleBoard-xM (DM37x) memory starts at 2GB border,
     110         * thus mapping only lower 2GB is not not enough.
     111         * Map entire AS 1:1 instead and hope it works. */
    80112        for (page = split_page; page < PTL0_ENTRIES; page++)
     113#ifndef MACHINE_beagleboardxm
    81114                init_ptl0_section(&boot_pt[page], page - split_page);
     115#else
     116                init_ptl0_section(&boot_pt[page], page);
     117#endif
    82118       
    83119        asm volatile (
     
    95131                /* Behave as a client of domains */
    96132                "ldr r0, =0x55555555\n"
    97                 "mcr p15, 0, r0, c3, c0, 0\n" 
     133                "mcr p15, 0, r0, c3, c0, 0\n"
    98134               
    99135                /* Current settings */
    100136                "mrc p15, 0, r0, c1, c0, 0\n"
    101137               
    102                 /* Mask to enable paging */
    103                 "ldr r1, =0x00000001\n"
     138                /* Enable ICache, DCache, BPredictors and MMU,
     139                 * we disable caches before jumping to kernel
     140                 * so this is safe for all archs.
     141                 */
     142                "ldr r1, =0x00001805\n"
     143               
    104144                "orr r0, r0, r1\n"
    105145               
Note: See TracChangeset for help on using the changeset viewer.