Beispiel #1
0
/*
 *  ======== Mmu_enable ========
 *  Function to enable the MMU.
 */
Void Mmu_enable()
{
    UInt16 type;
    UInt   key;

    /* if MMU is already enabled then just return */
    if (Mmu_isEnabled()) {
        return;
    }

    key = Hwi_disable();

    /* get the current enabled bits */
    type = Cache_getEnabled();
    
    if (type & Cache_Type_ALLP) {
        /* invalidate all of L1 program cache */
        Cache_invL1pAll();

        /* disable L1P cache */
        Cache_disable(Cache_Type_ALLP);
    }
    
    /* enables the MMU */
    Mmu_enableAsm();
    
    /* set cache back to initial settings */
    Cache_enable(type);

    Hwi_restore(key);
}
Beispiel #2
0
/*
 *  ======== Mmu_disable ========
 *  Function to disable the MMU.
 */
Void Mmu_disable()
{
    UInt16 type;
    UInt   key;

    /* if MMU is alreay disabled, just return */
    if (!(Mmu_isEnabled())) {
        return;
    }

    key = Hwi_disable();

    /* get the current enabled bits */
    type = Cache_getEnabled();

    /* disable all enabled caches */
    Cache_disable(type);

    /* disables the MMU */
    Mmu_disableAsm();

    /* set cache back to initial settings */
    Cache_enable(type);

    Hwi_restore(key);
}
Beispiel #3
0
/*
 *  ======== Mmu_disable ========
 *  Function to disable the MMU.
 */
Void Mmu_disable()
{
    UInt16 type;
    UInt   key;

    /* if MMU is alreay disabled, just return */
    if (!(Mmu_isEnabled())) {
        return;
    }
    
    key = Hwi_disable();

    /* get the current enabled bits */
    type = Cache_getEnabled();
    
    if (type & Cache_Type_L1D) {
        /* writeback invalidate all data cache */ 
        Cache_wbInvAll();
        
        /* drain the write buffer */
        Cache_wait();
        
        /* disable the L1 data cache */
        Cache_disable(Cache_Type_L1D);
    }
    
    if (type & Cache_Type_L1P) {
        /* invalidate all L1 program cache */
        Cache_invL1pAll();

        /* disable L1P cache */
        Cache_disable(Cache_Type_L1P);
    }
    
    /* disables the MMU */
    Mmu_disableAsm();
    
    /* set cache back to initial settings */
    Cache_enable(type);

    Hwi_restore(key);
}
Beispiel #4
0
/*
 *  ======== Mmu_setFirstLevelDesc ========
 */
Void Mmu_setFirstLevelDesc(Ptr virtualAddr, Ptr phyAddr,
                           Mmu_FirstLevelDescAttrs *attrs)
{
    UInt32 index = (UInt32)virtualAddr >> 20;
    UInt32 desc = 0;
    Bool   enabled;
    
    /* Assert that attrs != NULL */
    Assert_isTrue(attrs != NULL, Mmu_A_nullPointer);
    
    /* determine the current state of the MMU */
    enabled = Mmu_isEnabled();

    /* disable the MMU (if already disabled, does nothing) */
    Mmu_disable();

    /* Determine which kind of descriptor. */
    switch (attrs->type) {
        case Mmu_FirstLevelDesc_PAGE_TABLE:
            /* Page table descriptor */
            desc = (attrs->type) |
                   (attrs->domain << 5) |
                   (attrs->imp << 9) |
                   ((UInt32)phyAddr & 0xFFFFFC00);
            break;
            
        /* Section descriptor */