diff options
-rw-r--r-- | sys/arch/sgi/sgi/machdep.c | 152 |
1 files changed, 74 insertions, 78 deletions
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index 1835687eda5..1248fe360d4 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.49 2007/10/22 16:59:56 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.50 2007/12/07 13:07:44 jsing Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -95,18 +95,18 @@ extern void stacktrace(void); void dump_tlb(void); #endif -/* the following is used externally (sysctl_hw) */ -char machine[] = MACHINE; /* machine "architecture" */ +/* The following is used externally (sysctl_hw) */ +char machine[] = MACHINE; /* Machine "architecture" */ char cpu_model[30]; /* * Declare these as initialized data so we can patch them. */ #ifndef BUFCACHEPERCENT -#define BUFCACHEPERCENT 5 /* Can be changed in config */ +#define BUFCACHEPERCENT 5 /* Can be changed in config. */ #endif #ifndef BUFPAGES -#define BUFPAGES 0 /* Can be changed in config */ +#define BUFPAGES 0 /* Can be changed in config. */ #endif int bufpages = BUFPAGES; @@ -119,12 +119,12 @@ int extent_malloc_flags = 0; caddr_t msgbufbase; -int physmem; /* max supported memory, changes to actual */ -int rsvdmem; /* reserved memory not usable */ -int ncpu = 1; /* At least one cpu in the system */ +int physmem; /* Max supported memory, changes to actual. */ +int rsvdmem; /* Reserved memory not usable. */ +int ncpu = 1; /* At least one CPU in the system. */ struct user *proc0paddr; struct user *curprocpaddr; -int console_ok; /* set when console initialized */ +int console_ok; /* Set when console initialized. */ int bootdriveoffs = 0; int32_t *environment; @@ -178,9 +178,8 @@ crime_configure_memory(void) #endif /* - * Do not report memory regions below 256MB, since - * arcbios will do. Moreover, empty banks are reported - * at address zero. + * Do not report memory regions below 256MB, since ARCBIOS will do. + * Moreover, empty banks are reported at address zero. */ if (addr < 256 * 1024 * 1024) continue; @@ -191,8 +190,8 @@ crime_configure_memory(void) last_page = atop(addr + size); /* - * Try to coalesce with other memory segments if banks - * are contiguous. + * Try to coalesce with other memory segments if banks are + * contiguous. */ m = NULL; for (i = 0; i < MAXMEMSEGS; i++) { @@ -249,7 +248,7 @@ mips_init(int argc, void *argv) setsr(getsr() | SR_KX | SR_UX); /* - * Clear the compiled BSS segment in OpenBSD code + * Clear the compiled BSS segment in OpenBSD code. */ bzero(edata, end - edata); @@ -269,8 +268,8 @@ mips_init(int argc, void *argv) } /* - * Initialize the system type and set up memory layout - * Note that some systems have more complex memory setup. + * Initialize the system type and set up memory layout. + * Note that some systems have a more complex memory setup. */ bios_ident(); @@ -302,14 +301,14 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ if (cp && atoi(cp, 10, NULL) > 100) sys_config.cpu[0].clock = atoi(cp, 10, NULL) * 1000000; - /* R1xK O2's are one disk slot machines. Offset slotno */ + /* R1xK O2s are one disk slot machines. Offset slotno. */ switch ((cp0_get_prid() >> 8) & 0xff) { case MIPS_R10000: case MIPS_R12000: bootdriveoffs = -1; break; } - /* R12K O2's must run with DSD on */ + /* R12K O2s must run with DSD on. */ switch ((cp0_get_prid() >> 8) & 0xff) { case MIPS_R12000: setsr(getsr() | SR_DSD); @@ -359,7 +358,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ dobootopts(argc, argv); /* - * Figure out where we was booted from. + * Figure out where we booted from. */ cp = Bios_GetEnvironmentVariable("OSLoadPartition"); if (cp == NULL) @@ -373,7 +372,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ switch (sys_config.system_type) { #if defined(TGT_O2) case SGI_O2: - /* get ethernet address from ARCBIOS */ + /* Get Ethernet address from ARCBIOS. */ cp = Bios_GetEnvironmentVariable("eaddr"); if (cp != NULL && strlen(cp) > 0) strlcpy(bios_enaddr, cp, sizeof bios_enaddr); @@ -384,8 +383,8 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ } /* - * Set pagesize to enable use of page macros and functions. - * Commit available memory to UVM system + * Set pagesize to enable use of page macros and functions. + * Commit available memory to UVM system. */ uvmexp.pagesize = PAGE_SIZE; uvm_setpagesize(); @@ -410,13 +409,13 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ fp = mem_layout[i].mem_first_page; lp = mem_layout[i].mem_last_page; - /* Account for kernel and kernel symbol table */ + /* Account for kernel and kernel symbol table. */ if (fp >= firstkernpage && lp < lastkernpage) - continue; /* In kernel */ + continue; /* In kernel. */ if (lp < firstkernpage || fp > lastkernpage) { uvm_page_physload(fp, lp, fp, lp, VM_FREELIST_DEFAULT); - continue; /* Outside kernel */ + continue; /* Outside kernel. */ } if (fp >= firstkernpage) @@ -444,7 +443,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ sys_config.cpu[0].fpvers_min = cp1_get_prid() & 0x0f; /* - * Configure TLB. + * Configure TLB. */ switch(sys_config.cpu[0].type) { case MIPS_RM7000: @@ -472,7 +471,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ } /* - * Configure Cache. + * Configure cache. */ switch(sys_config.cpu[0].type) { case MIPS_R10000: @@ -501,21 +500,21 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ } /* - * Last chance to call the bios. Wiping the TLB means - * bios data areas are demapped on most systems. - * O2's are OK. Does not have mapped bios text or data. + * Last chance to call the BIOS. Wiping the TLB means the BIOS' data + * areas are demapped on most systems. O2s are okay as they do not have + * mapped BIOS text or data. */ - delay(20*1000); /* Let any uart fifo drain... */ + delay(20*1000); /* Let any UART FIFO drain... */ tlb_set_wired(0); tlb_flush(sys_config.cpu[0].tlbsize); tlb_set_wired(sys_config.cpu[0].tlbwired); #if 0 - /* XXX Save the following as an example on how to optimize I/O mapping */ + /* XXX Save the following as an example on how to optimize I/O mapping. */ /* - * Set up some fixed mappings. These are so frequently - * used so faulting them in will waste to many cycles. + * Set up some fixed mappings. These are frequently used so faulting + * them in will waste too many cycles. */ if (sys_config.system_type == MOMENTUM_CP7000G || sys_config.system_type == MOMENTUM_CP7000 || @@ -546,7 +545,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ #if defined(TGT_ORIGIN200) || defined(TGT_ORIGIN2000) /* - * If an IP27 system set up Node 0's HUB. + * If an IP27 system set up Node 0's HUB. */ if (sys_config.system_type == SGI_O200) { IP27_LHUB_S(PI_REGION_PRESENT, 1); @@ -555,7 +554,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ #endif /* - * Get a console, very early but after initial mapping setup. + * Get a console, very early but after initial mapping setup. */ consinit(); printf("Initial setup done, switching console.\n"); @@ -598,7 +597,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ bcopy(exception, (char *)GEN_EXC_VEC, e_exception - exception); /* - * Turn off bootstrap exception vectors. + * Turn off bootstrap exception vectors. */ setsr(getsr() & ~SR_BOOT_EXC_VEC); proc0.p_md.md_regs->sr = getsr(); @@ -615,7 +614,7 @@ bios_printf("SR=%08x\n", getsr()); /* leave this in for now. need to see sr */ #endif /* - * Return new stack pointer. + * Return new stack pointer. */ return ((caddr_t)proc0paddr + USPACE - 64); } @@ -644,7 +643,7 @@ allocsys(caddr_t v) /* - * Decode boot options. + * Decode boot options. */ static void dobootopts(int argc, void *argv) @@ -696,7 +695,7 @@ dobootopts(int argc, void *argv) } } - /* Catch serial consoles on O2's */ + /* Catch serial consoles on O2s. */ cp = Bios_GetEnvironmentVariable("ConsoleOut"); if (cp != NULL && strncmp(cp, "serial", 6) == 0) boothowto |= RB_SERCONS; @@ -704,9 +703,8 @@ dobootopts(int argc, void *argv) /* - * Console initialization: called early on from main, - * before vm init or startup. Do enough configuration - * to choose and initialize a console. + * Console initialization: called early on from main, before vm init or startup. + * Do enough configuration to choose and initialize a console. */ void consinit() @@ -719,8 +717,8 @@ consinit() } /* - * cpu_startup: allocate memory for variable-sized tables, - * initialize cpu, and do autoconfiguration. + * cpu_startup: allocate memory for variable-sized tables, initialize CPU, and + * do auto-configuration. */ void cpu_startup() @@ -730,7 +728,7 @@ cpu_startup() extern int pmapdebug; int opmapdebug = pmapdebug; - pmapdebug = 0; /* Shut up pmap debug during bootstrap */ + pmapdebug = 0; /* Shut up pmap debug during bootstrap. */ #endif /* @@ -749,20 +747,20 @@ cpu_startup() if (bufpages == 0) bufpages = physmem * bufcachepercent / 100; - /* Restrict to at most 25% filled kvm */ + /* Restrict to at most 25% filled kvm. */ if (bufpages > (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4) bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4; /* - * Allocate a submap for exec arguments. This map effectively + * Allocate a submap for exec arguments. This map effectively * limits the number of processes exec'ing at any time. */ minaddr = vm_map_min(kernel_map); exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, 16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL); - /* Allocate a submap for physio */ + /* Allocate a submap for physio. */ phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, VM_PHYS_SIZE, 0, FALSE, NULL); @@ -797,7 +795,7 @@ cpu_startup() } /* - * machine dependent system variables. + * Machine dependent system variables. */ int cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) @@ -809,9 +807,9 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) size_t newlen; struct proc *p; { - /* all sysctl names at this level are terminal */ + /* All sysctl names at this level are terminal. */ if (namelen != 1) - return ENOTDIR; /* overloaded */ + return ENOTDIR; /* Overloaded */ switch (name[0]) { default: @@ -881,7 +879,7 @@ void boot(int howto) { - /* take a snap shot before clobbering any registers */ + /* Take a snapshot before clobbering any registers. */ if (curproc) savectx(curproc->p_addr, 0); @@ -893,7 +891,7 @@ boot(int howto) if (cold) { /* * If the system is cold, just halt, unless the user - * explicitely asked for reboot. + * explicitly asked for reboot. */ if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -907,14 +905,14 @@ boot(int howto) if (curproc == NULL) curproc = &proc0; /* - * Synchronize the disks.... + * Synchronize the disks... */ waittime = 0; vfs_shutdown(); /* - * If we've been adjusting the clock, the todr - * will be out of synch; adjust it now. + * If we've been adjusting the clock, the todr will be out of + * sync; adjust it now. */ if ((howto & RB_TIMEBAD) == 0) { resettodr(); @@ -923,7 +921,7 @@ boot(int howto) } } - (void) splhigh(); /* extreme priority */ + (void) splhigh(); /* Extreme priority. */ if (howto & RB_DUMP) dumpsys(); @@ -952,8 +950,8 @@ haltsys: /*NOTREACHED*/ } -int dumpmag = (int)0x8fca0101; /* magic number for savecore */ -int dumpsize = 0; /* also for savecore */ +int dumpmag = (int)0x8fca0101; /* Magic number for savecore. */ +int dumpsize = 0; /* Also for savecore. */ long dumplo = 0; void @@ -974,17 +972,16 @@ dumpconf(void) dumplo = nblks - btodb(ctob(physmem)); /* - * Don't dump on the first page - * in case the dump device includes a disk label. + * Don't dump on the first page in case the dump device includes a + * disk label. */ if (dumplo < btodb(PAGE_SIZE)) dumplo = btodb(PAGE_SIZE); } /* - * Doadump comes here after turning off memory management and - * getting on the dump stack, either when called above, or by - * the auto-restart code. + * Doadump comes here after turning off memory management and getting on the + * dump stack, either when called above, or by the auto-restart code. */ void dumpsys() @@ -995,8 +992,8 @@ dumpsys() if (dumpdev == NODEV) return; /* - * For dumps during autoconfiguration, - * if dump device has already configured... + * For dumps during auto-configuration, if dump device has already + * configured... */ if (dumpsize == 0) dumpconf(); @@ -1039,7 +1036,7 @@ initcpu() } /* - * Convert "xx:xx:xx:xx:xx:xx" string to ethernet hardware address. + * Convert "xx:xx:xx:xx:xx:xx" string to Ethernet hardware address. */ void enaddr_aton(const char *s, u_int8_t *a) @@ -1071,18 +1068,18 @@ atoi(const char *s, int b, const char **o) return 0; } - /* skip spaces if any */ + /* Skip spaces if any. */ do { c = *s++; } while (c == ' ' || c == '\t'); - /* parse sign, allow more than one (compat) */ + /* Parse sign, allow more than one (compat). */ while (c == '-') { neg = !neg; c = *s++; } - /* parse base specification, if any */ + /* Parse base specification, if any. */ if (c == '0') { c = *s++; switch (c) { @@ -1101,7 +1098,7 @@ atoi(const char *s, int b, const char **o) } } - /* parse number proper */ + /* Parse number proper. */ for (;;) { if (c >= '0' && c <= '9') d = c - '0'; @@ -1123,9 +1120,8 @@ atoi(const char *s, int b, const char **o) } /* - * RM7000 Performance counter support. + * RM7000 Performance counter support. */ - int rm7k_perfcntr(cmd, arg1, arg2, arg3) int cmd; @@ -1169,8 +1165,8 @@ printf("perfcnt error %d\n", cmd); } /* - * Called when the performance counter d31 gets set. - * Increase spill value and reset d31. + * Called when the performance counter d31 gets set. + * Increase spill value and reset d31. */ void rm7k_perfintr(trapframe) @@ -1194,7 +1190,7 @@ rm7k_watchintr(trapframe) #ifdef DEBUG /* - * Dump TLB contents. + * Dump TLB contents. */ void dump_tlb() |