Changeset b3e8c90 in mainline for kernel/arch/sparc64/src/sparc64.c


Ignore:
Timestamp:
2006-08-01T11:24:27Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e386cbf
Parents:
c049309
Message:

sparc64 work.

  1. Formatting fixes.
  2. When writing to DMMU ASI's, simple membar() can be used in place of flush().
  3. Substantial changes in the way the TLB is taken over.
  4. Remove unneeded functions.

This is the first revision that also runs on a real world Ultra 5 with UltraSPARC IIi
processor.

Note that 3. needs further work as the current implementation depends on the fact
that the compiler will use registers for local variables in take_over_tlb_and_tt().
Rewrite of that function into assembly is to follow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/sparc64.c

    rc049309 rb3e8c90  
    9797 * trap table.
    9898 *
    99  * The goal of this function is to disable MMU
    100  * so that both TLBs can be purged and new
    101  * kernel 4M locked entry can be installed.
    102  * After TLB is initialized, MMU is enabled
    103  * again.
     99 * First, demap context 0 and install the
     100 * global 4M locked kernel mapping.
    104101 *
    105  * Switching MMU off imposes the requirement for
    106  * the kernel to run in identity mapped environment.
     102 * Second, prepare a temporary IMMU mapping in
     103 * context 1, switch to it, demap context 0,
     104 * install the global 4M locked kernel mapping
     105 * in context 0 and switch back to context 0.
    107106 *
    108107 * @param base Base address that will be hardwired in both TLBs.
     
    115114        page_address_t pg;
    116115
     116        /*
     117         * Switch to the kernel trap table.
     118         */
     119        trap_switch_trap_table();
     120
    117121        fr.address = base;
    118122        pg.address = base;
    119123
    120         immu_disable();
    121         dmmu_disable();
    122 
    123         /*
    124          * Demap everything, especially OpenFirmware.
    125          */
    126         itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0);
    127         dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0);
    128        
    129124        /*
    130125         * We do identity mapping of 4M-page at 4M.
    131126         */
    132         tag.value = ASID_KERNEL;
     127        tag.value = 0;
     128        tag.context = 0;
    133129        tag.vpn = pg.vpn;
    134 
    135         itlb_tag_access_write(tag.value);
    136         dtlb_tag_access_write(tag.value);
    137130
    138131        data.value = 0;
     
    142135        data.l = true;
    143136        data.cp = 1;
    144         data.cv = 1;
     137        data.cv = 0;
    145138        data.p = true;
    146139        data.w = true;
    147140        data.g = true;
    148141
    149         itlb_data_in_write(data.value);
     142        /*
     143         * Straightforwardly demap DMUU context 0,
     144         * and replace it with the locked kernel mapping.
     145         */
     146        dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0);
     147        dtlb_tag_access_write(tag.value);
    150148        dtlb_data_in_write(data.value);
    151149
    152150        /*
    153          * Register window traps can occur before MMU is enabled again.
    154          * This ensures that any such traps will be handled from
    155          * kernel identity mapped trap handler.
     151         * Install kernel code mapping in context 1
     152         * and switch to it.
    156153         */
    157         trap_switch_trap_table();
     154        tag.context = 1;
     155        data.g = false;
     156        itlb_tag_access_write(tag.value);
     157        itlb_data_in_write(data.value);
     158        mmu_primary_context_write(1);
    158159       
    159         tlb_invalidate_all();
    160 
    161         dmmu_enable();
    162         immu_enable();
     160        /*
     161         * Demap old context 0.
     162         */
     163        itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_NUCLEUS, 0);
     164       
     165        /*
     166         * Install the locked kernel mapping in context 0
     167         * and switch to it.
     168         */
     169        tag.context = 0;
     170        data.g = true;
     171        itlb_tag_access_write(tag.value);
     172        itlb_data_in_write(data.value);
     173        mmu_primary_context_write(0);
    163174}
    164175
Note: See TracChangeset for help on using the changeset viewer.