259 static void startup_init(void);
260 static void startup_memlist(void);
261 static void startup_modules(void);
262 static void startup_bop_gone(void);
263 static void startup_vm(void);
264 static void startup_end(void);
265 static void setup_cage_params(void);
266 static void startup_create_io_node(void);
267
268 static pgcnt_t npages;
269 static struct memlist *memlist;
270 void *memlist_end;
271
272 static pgcnt_t bop_alloc_pages;
273 static caddr_t hblk_base;
274 uint_t hblk_alloc_dynamic = 0;
275 uint_t hblk1_min = H1MIN;
276
277
278 /*
279 * Hook for down-rev firmware
280 */
281 static void do_prom_version_check(void);
282
283 /*
284 * After receiving a thermal interrupt, this is the number of seconds
285 * to delay before shutting off the system, assuming
286 * shutdown fails. Use /etc/system to change the delay if this isn't
287 * large enough.
288 */
289 int thermal_powerdown_delay = 1200;
290
291 /*
292 * Used to hold off page relocations into the cage until OBP has completed
293 * its boot-time handoff of its resources to the kernel.
294 */
295 int page_relocate_ready = 0;
296
297 /*
298 * Indicate if kmem64 allocation was done in small chunks
299 */
300 int kmem64_smchunks = 0;
301
302 /*
303 * Enable some debugging messages concerning memory usage...
1500 int nhblk1, nhblk8;
1501 size_t nhblksz;
1502 pgcnt_t pages_per_hblk;
1503 size_t hme8blk_sz, hme1blk_sz;
1504
1505 /*
1506 * The system file /etc/system was read already under startup_memlist.
1507 */
1508 if (&set_platform_defaults)
1509 set_platform_defaults();
1510
1511 /*
1512 * Calculate default settings of system parameters based upon
1513 * maxusers, yet allow to be overridden via the /etc/system file.
1514 */
1515 param_calc(0);
1516
1517 mod_setup();
1518
1519 /*
1520 * If we are running firmware that isn't 64-bit ready
1521 * then complain and halt.
1522 */
1523 do_prom_version_check();
1524
1525 /*
1526 * Initialize system parameters
1527 */
1528 param_init();
1529
1530 /*
1531 * maxmem is the amount of physical memory we're playing with.
1532 */
1533 maxmem = physmem;
1534
1535 /* Set segkp limits. */
1536 ncbase = kdi_segdebugbase;
1537 ncend = kdi_segdebugbase;
1538
1539 /*
1540 * Initialize the hat layer.
1541 */
1542 hat_init();
1543
1544 /*
1545 * Initialize segment management stuff.
3071 * consconfig runs, OBP's stdin is redirected to this node.
3072 * Whenever the FORTH user interface is used after this switch,
3073 * the node will call back into the kernel for console input.
3074 * If a serial device such as ttya or a UART with a Type 5 keyboard
3075 * attached is used, OBP takes over the serial device when the system
3076 * goes to the debugger after the system is booted. This sharing
3077 * of the relatively simple serial device is difficult but possible.
3078 * Sharing the USB host controller is impossible due its complexity.
3079 *
3080 * Similarly to USB keyboard input redirection, after consconfig_dacf
3081 * configures a kernel console framebuffer as the standard output
3082 * device, OBP's stdout is switched to to vector through the
3083 * /os-io node into the kernel terminal emulator.
3084 */
3085 static void
3086 startup_create_io_node(void)
3087 {
3088 prom_interpret(create_node, 0, 0, 0, 0, 0);
3089 }
3090
3091
3092 static void
3093 do_prom_version_check(void)
3094 {
3095 int i;
3096 pnode_t node;
3097 char buf[64];
3098 static char drev[] = "Down-rev firmware detected%s\n"
3099 "\tPlease upgrade to the following minimum version:\n"
3100 "\t\t%s\n";
3101
3102 i = prom_version_check(buf, sizeof (buf), &node);
3103
3104 if (i == PROM_VER64_OK)
3105 return;
3106
3107 if (i == PROM_VER64_UPGRADE) {
3108 cmn_err(CE_WARN, drev, "", buf);
3109
3110 #ifdef DEBUG
3111 prom_enter_mon(); /* Type 'go' to continue */
3112 cmn_err(CE_WARN, "Booting with down-rev firmware\n");
3113 return;
3114 #else
3115 halt(0);
3116 #endif
3117 }
3118
3119 /*
3120 * The other possibility is that this is a server running
3121 * good firmware, but down-rev firmware was detected on at
3122 * least one other cpu board. We just complain if we see
3123 * that.
3124 */
3125 cmn_err(CE_WARN, drev, " on one or more CPU boards", buf);
3126 }
3127
3128
3129 /*
3130 * Must be defined in platform dependent code.
3131 */
3132 extern caddr_t modtext;
3133 extern size_t modtext_sz;
3134 extern caddr_t moddata;
3135
3136 #define HEAPTEXT_ARENA(addr) \
3137 ((uintptr_t)(addr) < KERNELBASE + 2 * MMU_PAGESIZE4M ? 0 : \
3138 (((uintptr_t)(addr) - HEAPTEXT_BASE) / \
3139 (HEAPTEXT_MAPPED + HEAPTEXT_UNMAPPED) + 1))
3140
3141 #define HEAPTEXT_OVERSIZED(addr) \
3142 ((uintptr_t)(addr) >= HEAPTEXT_BASE + HEAPTEXT_SIZE - HEAPTEXT_OVERSIZE)
3143
3144 #define HEAPTEXT_IN_NUCLEUSDATA(addr) \
3145 (((uintptr_t)(addr) >= KERNELBASE + 2 * MMU_PAGESIZE4M) && \
3146 ((uintptr_t)(addr) < KERNELBASE + 3 * MMU_PAGESIZE4M))
3147
|
259 static void startup_init(void);
260 static void startup_memlist(void);
261 static void startup_modules(void);
262 static void startup_bop_gone(void);
263 static void startup_vm(void);
264 static void startup_end(void);
265 static void setup_cage_params(void);
266 static void startup_create_io_node(void);
267
268 static pgcnt_t npages;
269 static struct memlist *memlist;
270 void *memlist_end;
271
272 static pgcnt_t bop_alloc_pages;
273 static caddr_t hblk_base;
274 uint_t hblk_alloc_dynamic = 0;
275 uint_t hblk1_min = H1MIN;
276
277
278 /*
279 * After receiving a thermal interrupt, this is the number of seconds
280 * to delay before shutting off the system, assuming
281 * shutdown fails. Use /etc/system to change the delay if this isn't
282 * large enough.
283 */
284 int thermal_powerdown_delay = 1200;
285
286 /*
287 * Used to hold off page relocations into the cage until OBP has completed
288 * its boot-time handoff of its resources to the kernel.
289 */
290 int page_relocate_ready = 0;
291
292 /*
293 * Indicate if kmem64 allocation was done in small chunks
294 */
295 int kmem64_smchunks = 0;
296
297 /*
298 * Enable some debugging messages concerning memory usage...
1495 int nhblk1, nhblk8;
1496 size_t nhblksz;
1497 pgcnt_t pages_per_hblk;
1498 size_t hme8blk_sz, hme1blk_sz;
1499
1500 /*
1501 * The system file /etc/system was read already under startup_memlist.
1502 */
1503 if (&set_platform_defaults)
1504 set_platform_defaults();
1505
1506 /*
1507 * Calculate default settings of system parameters based upon
1508 * maxusers, yet allow to be overridden via the /etc/system file.
1509 */
1510 param_calc(0);
1511
1512 mod_setup();
1513
1514 /*
1515 * Initialize system parameters
1516 */
1517 param_init();
1518
1519 /*
1520 * maxmem is the amount of physical memory we're playing with.
1521 */
1522 maxmem = physmem;
1523
1524 /* Set segkp limits. */
1525 ncbase = kdi_segdebugbase;
1526 ncend = kdi_segdebugbase;
1527
1528 /*
1529 * Initialize the hat layer.
1530 */
1531 hat_init();
1532
1533 /*
1534 * Initialize segment management stuff.
3060 * consconfig runs, OBP's stdin is redirected to this node.
3061 * Whenever the FORTH user interface is used after this switch,
3062 * the node will call back into the kernel for console input.
3063 * If a serial device such as ttya or a UART with a Type 5 keyboard
3064 * attached is used, OBP takes over the serial device when the system
3065 * goes to the debugger after the system is booted. This sharing
3066 * of the relatively simple serial device is difficult but possible.
3067 * Sharing the USB host controller is impossible due its complexity.
3068 *
3069 * Similarly to USB keyboard input redirection, after consconfig_dacf
3070 * configures a kernel console framebuffer as the standard output
3071 * device, OBP's stdout is switched to to vector through the
3072 * /os-io node into the kernel terminal emulator.
3073 */
3074 static void
3075 startup_create_io_node(void)
3076 {
3077 prom_interpret(create_node, 0, 0, 0, 0, 0);
3078 }
3079
3080
3081 /*
3082 * Must be defined in platform dependent code.
3083 */
3084 extern caddr_t modtext;
3085 extern size_t modtext_sz;
3086 extern caddr_t moddata;
3087
3088 #define HEAPTEXT_ARENA(addr) \
3089 ((uintptr_t)(addr) < KERNELBASE + 2 * MMU_PAGESIZE4M ? 0 : \
3090 (((uintptr_t)(addr) - HEAPTEXT_BASE) / \
3091 (HEAPTEXT_MAPPED + HEAPTEXT_UNMAPPED) + 1))
3092
3093 #define HEAPTEXT_OVERSIZED(addr) \
3094 ((uintptr_t)(addr) >= HEAPTEXT_BASE + HEAPTEXT_SIZE - HEAPTEXT_OVERSIZE)
3095
3096 #define HEAPTEXT_IN_NUCLEUSDATA(addr) \
3097 (((uintptr_t)(addr) >= KERNELBASE + 2 * MMU_PAGESIZE4M) && \
3098 ((uintptr_t)(addr) < KERNELBASE + 3 * MMU_PAGESIZE4M))
3099
|