void initppc(vaddr_t startkernel, vaddr_t endkernel) { paddr_t addr, memsize; /* Initialize cache info for memcpy, memset, etc. */ cpu_probe_cache(); memset(physmemr, 0, sizeof(physmemr)); /* [1].size = 0 */ memset(availmemr, 0, sizeof(availmemr)); /* [1].size = 0 */ memsize = (PHYSMEM * 1024 * 1024) & ~PGOFSET; physmemr[0].start = 0; physmemr[0].size = memsize; availmemr[0].start = startkernel; availmemr[0].size = memsize - availmemr[0].start; /* Map kernel memory linearly. */ for (addr = 0; addr < endkernel; addr += TLB_PG_SIZE) ppc4xx_tlb_reserve(addr, addr, TLB_PG_SIZE, TLB_EX); /* Give design-specific code a hint for reserved mappings. */ virtex_machdep_init(roundup(memsize, TLB_PG_SIZE), TLB_PG_SIZE, physmemr, availmemr); ibm4xx_init(startkernel, endkernel, pic_ext_intr); #ifdef DDB if (boothowto & RB_KDB) Debugger(); #endif #ifdef IPKDB /* * Now trap to IPKDB */ ipkdb_init(); if (boothowto & RB_KDB) ipkdb_connect(0); #endif #ifdef KGDB /* * Now trap to KGDB */ kgdb_connect(1); #endif /* KGDB */ /* * Look for the ibm4xx modules in the right place. */ module_machine = module_machine_ibm4xx; }
void ibm40x_memsize_init(u_int memsize, u_int startkernel) { /* Initialize cache info for memcpy, etc. */ cpu_probe_cache(); memset(physmemr, 0, sizeof physmemr); memset(availmemr, 0, sizeof availmemr); /* Setup physical memory */ physmemr[0].start = 0; physmemr[0].size = memsize & ~PGOFSET; /* Setup availabl memory, lower memory reserved by evb-BIOS */ availmemr[0].start = startkernel; availmemr[0].size = memsize - availmemr[0].start; }
static void cpuattach(struct device *parent, struct device *self, void *aux) { struct cputab *cp = models; u_int pvr; u_int processor_freq; prop_number_t freq; freq = prop_dictionary_get(board_properties, "processor-frequency"); KASSERT(freq != NULL); processor_freq = (unsigned int) prop_number_integer_value(freq); cpufound++; ncpus++; pvr = mfpvr(); while (cp->name) { if ((pvr & cp->mask) == cp->version) break; cp++; } if (cp->name) strcpy(cpu_model, cp->name); else sprintf(cpu_model, "Version 0x%x", pvr); printf(": %dMHz %s (PVR 0x%x)\n", processor_freq / 1000 / 1000, cp->name ? cp->name : "unknown model", pvr); cpu_probe_cache(); /* We would crash later on anyway so just make the reason obvious */ if (curcpu()->ci_ci.icache_size == 0 && curcpu()->ci_ci.dcache_size == 0) panic("%s could not detect cache size", device_xname(self)); printf("%s: Instruction cache size %d line size %d\n", device_xname(self), curcpu()->ci_ci.icache_size, curcpu()->ci_ci.icache_line_size); printf("%s: Data cache size %d line size %d\n", device_xname(self), curcpu()->ci_ci.dcache_size, curcpu()->ci_ci.dcache_line_size); }