diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 021c51d413f..d46b39fcf93 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -85,7 +85,6 @@ powerpc/aim/mmu_oea.c optional aim powerpc powerpc/aim/mmu_oea64.c optional aim powerpc/aim/mp_cpudep.c optional aim smp powerpc/aim/nexus.c optional aim -powerpc/aim/ofw_machdep.c optional aim powerpc/aim/ofwmagic.S optional aim powerpc/aim/slb.c optional aim powerpc64 powerpc/aim/swtch32.S optional aim powerpc @@ -131,6 +130,7 @@ powerpc/mpc85xx/nexus.c optional mpc85xx powerpc/mpc85xx/openpic_fdt.c optional fdt powerpc/mpc85xx/pci_fdt.c optional pci mpc85xx powerpc/ofw/ofw_cpu.c optional aim +powerpc/ofw/ofw_machdep.c optional aim powerpc/ofw/ofw_pcibus.c optional pci aim powerpc/ofw/ofw_pcib_pci.c optional pci aim powerpc/ofw/ofw_real.c optional aim diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index 456fa4473d6..87aa482b9d4 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -159,8 +159,6 @@ int setfault(faultbuf); /* defined in locore.S */ long Maxmem = 0; long realmem = 0; -struct pmap ofw_pmap; - #ifndef __powerpc64__ struct bat battable[16]; #endif diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 5ba029c3f5c..7bd07e11372 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -197,8 +197,6 @@ static u_int phys_avail_count; static int regions_sz, pregions_sz; static struct ofw_map *translations; -extern struct pmap ofw_pmap; - /* * Lock for the pteg and pvo tables. */ @@ -669,10 +667,7 @@ moea_cpu_bootstrap(mmu_t mmup, int ap) isync(); for (i = 0; i < 16; i++) - mtsrin(i << ADDR_SR_SHFT, EMPTY_SEGMENT); - - __asm __volatile("mtsr %0,%1" :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT)); - __asm __volatile("mtsr %0,%1" :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT)); + mtsrin(i << ADDR_SR_SHFT, kernel_pmap->pm_sr[i]); powerpc_sync(); sdr = (u_int)moea_pteg_table | (moea_pteg_mask >> 10); @@ -859,11 +854,16 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) moea_vsid_bitmap[0] |= 1; /* - * Set up the Open Firmware pmap and add it's mappings. + * Initialize the kernel pmap (which is statically allocated). + */ + PMAP_LOCK_INIT(kernel_pmap); + for (i = 0; i < 16; i++) + kernel_pmap->pm_sr[i] = EMPTY_SEGMENT + i; + kernel_pmap->pm_active = ~0; + + /* + * Set up the Open Firmware mappings */ - moea_pinit(mmup, &ofw_pmap); - ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT; - ofw_pmap.pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT; if ((chosen = OF_finddevice("/chosen")) == -1) panic("moea_bootstrap: can't find /chosen"); OF_getprop(chosen, "mmu", &mmui, 4); @@ -900,16 +900,8 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) /* Enter the pages */ for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { - struct vm_page m; - - m.phys_addr = translations[i].om_pa + off; - m.md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT; - m.oflags = VPO_BUSY; - PMAP_LOCK(&ofw_pmap); - moea_enter_locked(&ofw_pmap, - translations[i].om_va + off, &m, - VM_PROT_ALL, 1); - PMAP_UNLOCK(&ofw_pmap); + moea_kenter(mmup, translations[i].om_va + off, + translations[i].om_pa + off); ofw_mappings++; } } @@ -921,17 +913,6 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) ; Maxmem = powerpc_btop(phys_avail[i + 1]); - /* - * Initialize the kernel pmap (which is statically allocated). - */ - PMAP_LOCK_INIT(kernel_pmap); - for (i = 0; i < 16; i++) { - kernel_pmap->pm_sr[i] = EMPTY_SEGMENT; - } - kernel_pmap->pm_sr[KERNEL_SR] = KERNEL_SEGMENT; - kernel_pmap->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT; - kernel_pmap->pm_active = ~0; - moea_cpu_bootstrap(mmup,0); pmap_bootstrapped++; diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index a2c80c079f4..506676fa226 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -275,8 +275,6 @@ static struct mem_region *pregions; static u_int phys_avail_count; static int regions_sz, pregions_sz; -extern struct pmap ofw_pmap; - extern void bs_remap_earlyboot(void); @@ -1119,13 +1117,6 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) chosen = OF_finddevice("/chosen"); if (chosen != -1 && OF_getprop(chosen, "mmu", &mmui, 4) != -1) { - #ifndef __powerpc64__ - moea64_pinit(mmup, &ofw_pmap); - - for (i = 0; i < 16; i++) - ofw_pmap.pm_sr[i] = kernel_pmap->pm_sr[i]; - #endif - mmu = OF_instance_to_package(mmui); if (mmu == -1 || (sz = OF_getproplen(mmu, "translations")) == -1) sz = 0; diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/ofw/ofw_machdep.c similarity index 93% rename from sys/powerpc/aim/ofw_machdep.c rename to sys/powerpc/ofw/ofw_machdep.c index 84f9cf0ae72..f0daa4f2813 100644 --- a/sys/powerpc/aim/ofw_machdep.c +++ b/sys/powerpc/ofw/ofw_machdep.c @@ -66,7 +66,6 @@ static struct mem_region OFfree[OFMEM_REGIONS + 3]; static int nOFmem; extern register_t ofmsr[5]; -extern struct pmap ofw_pmap; static int (*ofwcall)(void *); static void *fdt; int ofw_real_mode; @@ -417,59 +416,27 @@ openfirmware_core(void *args) { int result; register_t oldmsr; - #ifndef __powerpc64__ - register_t srsave[16]; - u_int i; - #endif /* * Turn off exceptions - we really don't want to end up - * anywhere unexpected with PCPU set to something strange, - * the stack pointer wrong, or the OFW mapping enabled. + * anywhere unexpected with PCPU set to something strange + * or the stack pointer wrong. */ oldmsr = intr_disable(); ofw_sprg_prepare(); - #ifndef __powerpc64__ - if (pmap_bootstrapped && !ofw_real_mode) { - /* - * Swap the kernel's address space with Open Firmware's - */ - - for (i = 0; i < 16; i++) { - srsave[i] = mfsrin(i << ADDR_SR_SHFT); - mtsrin(i << ADDR_SR_SHFT, ofw_pmap.pm_sr[i]); - } - - /* - * Clear battable[] translations - */ - if (!(cpu_features & PPC_FEATURE_64)) { - __asm __volatile("mtdbatu 2, %0\n" - "mtdbatu 3, %0" : : "r" (0)); - } - isync(); - } - #endif +#if defined(AIM) && !defined(__powerpc64__) + /* + * Clear battable[] translations + */ + if (!(cpu_features & PPC_FEATURE_64)) + __asm __volatile("mtdbatu 2, %0\n" + "mtdbatu 3, %0" : : "r" (0)); + isync(); +#endif result = ofwcall(args); - - #ifndef __powerpc64__ - if (pmap_bootstrapped && !ofw_real_mode) { - /* - * Restore the kernel's addr space. The isync() doesn;t - * work outside the loop unless mtsrin() is open-coded - * in an asm statement :( - */ - - for (i = 0; i < 16; i++) { - mtsrin(i << ADDR_SR_SHFT, srsave[i]); - isync(); - } - } - #endif - ofw_sprg_restore(); intr_restore(oldmsr);