void main(void) { cgapost(0); mach0init(); options(); ioinit(); i8250console(); quotefmtinstall(); screeninit(); print("\nPlan 9\n"); trapinit0(); mmuinit0(); kbdinit(); i8253init(); cpuidentify(); meminit(); confinit(); archinit(); if(!isa20on()) panic("bootstrap didn't leave a20 address line enabled"); xinit(); if(i8237alloc != nil) i8237alloc(); trapinit(); printinit(); cpuidprint(); mmuinit(); fpsavealloc(); if(arch->intrinit) /* launches other processors on an mp */ arch->intrinit(); timersinit(); mathinit(); kbdenable(); if(arch->clockenable) arch->clockenable(); procinit0(); initseg(); if(delaylink){ bootlinks(); pcimatch(0, 0, 0); }else links(); conf.monitor = 1; chandevreset(); cgapost(0xcd); pageinit(); i8253link(); swapinit(); userinit(); active.thunderbirdsarego = 1; cgapost(0x99); schedinit(); }
void main(void) { int machno; /* entry to main pushed stuff onto the stack. */ // memset(edata, 0, (ulong)end-(ulong)edata); machno = getpir(); if (machno > 0) startcpu(machno); // dcrcompile(); if (dverify != 0x01020304) { uartlputs("data segment not initialised\n"); panic("data segment not initialised"); } if (bverify != 0) { uartlputs("bss segment not zeroed\n"); panic("bss segment not zeroed"); } mach0init(); archreset(); quotefmtinstall(); optionsinit("/boot/boot boot"); // archconsole(); meminit(); confinit(); mmuinit(); xinit(); /* xinit would print if it could */ trapinit(); qtminit(); ioinit(); uncinit(); printinit(); uartliteconsole(); mainmem->flags |= POOL_ANTAGONISM; mainmem->panic = mypanic; ethermedium.maxtu = 1512; /* must be multiple of 4 for temac's dma */ // print("\n\nPlan 9k H\n"); /* already printed by l.s */ plan9iniinit(); timersinit(); clockinit(); dma0init(); /* does not start kprocs; see init0 */ fpuinit(); procinit0(); initseg(); links(); chandevreset(); okprint = 1; /* only now can we print */ barriers(); dcflush((uintptr)&okprint, sizeof okprint); cpuidprint(); print("%d Hz clock", HZ); print("; memory size %,ud (%#ux)\n", (uint)memsz, (uint)memsz); pageinit(); swapinit(); userinit(); active.thunderbirdsarego = 1; dcflush((uintptr)&active.thunderbirdsarego, sizeof active.thunderbirdsarego); schedinit(); /* no return */ panic("schedinit returned"); }
/* * at entry, l.s has set m for cpu0 and printed "Plan 9 from Be" * but has not zeroed bss. */ void main(void) { int cpu; static ulong vfy = 0xcafebabe; up = nil; if (vfy != 0xcafebabe) { serialputc('?'); serialputc('d'); panic("data segment misaligned"); } memset(edata, 0, end - edata); /* * we can't lock until smpon has run, but we're supposed to wait * until l1 & l2 are on. too bad. l1 is on, l2 will soon be. */ smpon(); iprint("ll Labs "); cacheinit(); /* * data segment is aligned, bss is zeroed, caches' characteristics * are known. begin initialisation. */ mach0init(); l2pageinit(); mmuinit(); optionsinit("/boot/boot boot"); quotefmtinstall(); /* want plan9.ini to be able to affect memory sizing in confinit */ plan9iniinit(); /* before we step on plan9.ini in low memory */ /* l2 looks for *l2off= in plan9.ini */ l2cache->on(); /* l2->on requires locks to work, thus smpon */ l2cache->info(&cachel[2]); allcache->on(); cortexa9cachecfg(); trapinit(); /* so confinit can probe memory to size it */ confinit(); /* figures out amount of memory */ /* xinit prints (if it can), so finish up the banner here. */ delay(100); navailcpus = getncpus(); iprint("(mp arm; %d cpus)\n\n", navailcpus); delay(100); for (cpu = 1; cpu < navailcpus; cpu++) stopcpu(cpu); xinit(); irqtooearly = 0; /* now that xinit and trapinit have run */ mainmem->flags |= POOL_ANTAGONISM /* | POOL_PARANOIA */ ; /* * Printinit will cause the first malloc call. * (printinit->qopen->malloc) unless any of the * above (like clockinit) do an irqenable, which * will call malloc. * If the system dies here it's probably due * to malloc(->xalloc) not being initialised * correctly, or the data segment is misaligned * (it's amazing how far you can get with * things like that completely broken). * * (Should be) boilerplate from here on. */ archreset(); /* cfg clock signals, print cache cfg */ clockinit(); /* start clocks */ timersinit(); delay(50); /* let uart catch up */ printinit(); kbdenable(); cpuidprint(); chkmissing(); procinit0(); initseg(); // dmainit(); links(); conf.monitor = 1; // screeninit(); iprint("pcireset..."); pcireset(); /* this tends to hang after a reboot */ iprint("ok\n"); chandevreset(); /* most devices are discovered here */ // i8250console(); /* too early; see init0 */ pageinit(); /* prints "1020M memory: ⋯ */ swapinit(); userinit(); /* * starting a cpu will eventually result in it calling schedinit, * so everything necessary to run user processes should be set up * before starting secondary cpus. */ launchinit(); /* SMP & FW are already on when we get here; u-boot set them? */ for (cpu = 1; cpu < navailcpus; cpu++) if (startcpu(cpu) < 0) panic("cpu%d didn't start", cpu); l1diag(); schedinit(); panic("cpu%d: schedinit returned", m->machno); }
void main(void) { Proc *savup; static ulong vfy = Datamagic; static char novga[] = "\nno vga; serial console only\n"; savup = up; up = nil; /* m has been set by l32v.s */ /* * disable address wraps at 1MB boundaries. * if we're 9boot, ldecomp.s already did this. */ a20init(); mach0init(); // options(); /* we don't get options passed to us */ ioinit(); /* we later call i8250console after plan9.ini has been read */ i8250config("0"); /* configure serial port 0 with defaults */ quotefmtinstall(); fmtinstall('i', eipfmt); fmtinstall('I', eipfmt); fmtinstall('E', eipfmt); fmtinstall('V', eipfmt); fmtinstall('M', eipfmt); screeninit(); /* cga setup */ cgapost(0xc); trapinit0(); mmuinit0(); kbdinit(); i8253init(); cpuidentify(); readlsconf(); meminit(); confinit(); archinit(); xinit(); if(i8237alloc != nil) i8237alloc(); /* dma (for floppy) init */ trapinit(); printinit(); sanity(); cgapost(1); /* * soekris servers have no built-in video but each has a serial port. * they must see serial output, if any, before cga output because * otherwise the soekris bios will translate cga output to serial * output, which will garble serial console output. */ pcimatch(nil, 0, 0); /* force scan of pci table */ if (!pcivga) { screenputs = nil; uartputs(novga, sizeof novga - 1); } print(" %s\n\n", hellomsg); if (vfy != Datamagic) panic("data segment incorrectly aligned or loaded"); if (savup) print("up was non-nil (%#p) upon entry to main; bss wasn't zeroed!\n", savup); // xsummary(); cpuidprint(); mmuinit(); if(arch->intrinit) /* launches other processors on an mp */ arch->intrinit(); timersinit(); mathinit(); kbdenable(); /* * 9loadusb runs much faster if we don't use the clock. * perhaps we're competing with the bios for the use of it? */ if(!noclock && arch->clockenable) arch->clockenable(); procinit0(); initseg(); if(delaylink){ bootlinks(); pcimatch(0, 0, 0); }else links(); conf.monitor = 1; cgapost(0xcd); chandevreset(); cgapost(2); pageinit(); /* must follow xinit, and conf.mem must be populated */ i8253link(); userinit(); active.thunderbirdsarego = 1; cgapost(0xb0); schedinit(); }