207 char bootblock_fstype[16]; |
207 char bootblock_fstype[16]; |
208 |
208 |
209 char kern_bootargs[OBP_MAXPATHLEN]; |
209 char kern_bootargs[OBP_MAXPATHLEN]; |
210 |
210 |
211 /* |
211 /* |
|
212 * ZFS zio segment. This allows us to exclude large portions of ZFS data that |
|
213 * gets cached in kmem caches on the heap. If this is set to zero, we allocate |
|
214 * zio buffers from their own segment, otherwise they are allocated from the |
|
215 * heap. The optimization of allocating zio buffers from their own segment is |
|
216 * only valid on 64-bit kernels. |
|
217 */ |
|
218 #if defined(__amd64) |
|
219 int segzio_fromheap = 0; |
|
220 #else |
|
221 int segzio_fromheap = 1; |
|
222 #endif |
|
223 |
|
224 /* |
212 * new memory fragmentations are possible in startup() due to BOP_ALLOCs. this |
225 * new memory fragmentations are possible in startup() due to BOP_ALLOCs. this |
213 * depends on number of BOP_ALLOC calls made and requested size, memory size |
226 * depends on number of BOP_ALLOC calls made and requested size, memory size |
214 * combination and whether boot.bin memory needs to be freed. |
227 * combination and whether boot.bin memory needs to be freed. |
215 */ |
228 */ |
216 #define POSS_NEW_FRAGMENTS 12 |
229 #define POSS_NEW_FRAGMENTS 12 |
237 #else |
250 #else |
238 struct seg *segkpm = NULL; /* Unused on IA32 */ |
251 struct seg *segkpm = NULL; /* Unused on IA32 */ |
239 #endif |
252 #endif |
240 |
253 |
241 caddr_t segkp_base; /* Base address of segkp */ |
254 caddr_t segkp_base; /* Base address of segkp */ |
|
255 caddr_t segzio_base; /* Base address of segzio */ |
242 #if defined(__amd64) |
256 #if defined(__amd64) |
243 pgcnt_t segkpsize = btop(SEGKPDEFSIZE); /* size of segkp segment in pages */ |
257 pgcnt_t segkpsize = btop(SEGKPDEFSIZE); /* size of segkp segment in pages */ |
244 #else |
258 #else |
245 pgcnt_t segkpsize = 0; |
259 pgcnt_t segkpsize = 0; |
246 #endif |
260 #endif |
|
261 pgcnt_t segziosize = 0; /* size of zio segment in pages */ |
247 |
262 |
248 struct memseg *memseg_base; |
263 struct memseg *memseg_base; |
249 struct vnode unused_pages_vp; |
264 struct vnode unused_pages_vp; |
250 |
265 |
251 #define FOURGB 0x100000000LL |
266 #define FOURGB 0x100000000LL |
360 * 0xFFFFFXXX.XXX00000 |-----------------------|- kernelheap (floating) |
375 * 0xFFFFFXXX.XXX00000 |-----------------------|- kernelheap (floating) |
361 * | segkmap | |
376 * | segkmap | |
362 * 0xFFFFFXXX.XXX00000 |-----------------------|- segkmap_start (floating) |
377 * 0xFFFFFXXX.XXX00000 |-----------------------|- segkmap_start (floating) |
363 * | device mappings | |
378 * | device mappings | |
364 * 0xFFFFFXXX.XXX00000 |-----------------------|- toxic_addr (floating) |
379 * 0xFFFFFXXX.XXX00000 |-----------------------|- toxic_addr (floating) |
|
380 * | segzio | |
|
381 * 0xFFFFFXXX.XXX00000 |-----------------------|- segzio_base (floating) |
365 * | segkp | |
382 * | segkp | |
366 * --- |-----------------------|- segkp_base |
383 * --- |-----------------------|- segkp_base |
367 * | segkpm | |
384 * | segkpm | |
368 * 0xFFFFFE00.00000000 |-----------------------| |
385 * 0xFFFFFE00.00000000 |-----------------------| |
369 * | Red Zone | |
386 * | Red Zone | |
1561 segkpsize = mmu_btop(ROUND_UP_LPAGE(sz)); |
1578 segkpsize = mmu_btop(ROUND_UP_LPAGE(sz)); |
1562 segkp_base = final_kernelheap; |
1579 segkp_base = final_kernelheap; |
1563 PRM_DEBUG(segkpsize); |
1580 PRM_DEBUG(segkpsize); |
1564 PRM_DEBUG(segkp_base); |
1581 PRM_DEBUG(segkp_base); |
1565 final_kernelheap = segkp_base + mmu_ptob(segkpsize); |
1582 final_kernelheap = segkp_base + mmu_ptob(segkpsize); |
|
1583 PRM_DEBUG(final_kernelheap); |
|
1584 } |
|
1585 |
|
1586 if (!segzio_fromheap) { |
|
1587 size_t size; |
|
1588 |
|
1589 /* size is in bytes, segziosize is in pages */ |
|
1590 if (segziosize == 0) { |
|
1591 size = mmu_ptob(physmem * 2); |
|
1592 } else { |
|
1593 size = mmu_ptob(segziosize); |
|
1594 } |
|
1595 |
|
1596 if (size < SEGZIOMINSIZE) { |
|
1597 size = SEGZIOMINSIZE; |
|
1598 } else if (size > mmu_ptob(physmem * 4)) { |
|
1599 size = mmu_ptob(physmem * 4); |
|
1600 } |
|
1601 segziosize = mmu_btop(ROUND_UP_LPAGE(size)); |
|
1602 segzio_base = final_kernelheap; |
|
1603 PRM_DEBUG(segziosize); |
|
1604 PRM_DEBUG(segzio_base); |
|
1605 final_kernelheap = segzio_base + mmu_ptob(segziosize); |
1566 PRM_DEBUG(final_kernelheap); |
1606 PRM_DEBUG(final_kernelheap); |
1567 } |
1607 } |
1568 |
1608 |
1569 /* |
1609 /* |
1570 * put the range of VA for device mappings next |
1610 * put the range of VA for device mappings next |
2375 (void) segkmem_create(&kvseg); |
2415 (void) segkmem_create(&kvseg); |
2376 |
2416 |
2377 #if defined(__amd64) |
2417 #if defined(__amd64) |
2378 (void) seg_attach(&kas, (caddr_t)core_base, core_size, &kvseg_core); |
2418 (void) seg_attach(&kas, (caddr_t)core_base, core_size, &kvseg_core); |
2379 (void) segkmem_create(&kvseg_core); |
2419 (void) segkmem_create(&kvseg_core); |
|
2420 |
|
2421 /* segzio optimization is only valid for 64-bit kernels */ |
|
2422 if (!segzio_fromheap) { |
|
2423 (void) seg_attach(&kas, segzio_base, mmu_ptob(segziosize), |
|
2424 &kzioseg); |
|
2425 (void) segkmem_zio_create(&kzioseg); |
|
2426 |
|
2427 /* create zio area covering new segment */ |
|
2428 segkmem_zio_init(segzio_base, mmu_ptob(segziosize)); |
|
2429 } |
2380 #endif |
2430 #endif |
2381 |
2431 |
2382 (void) seg_attach(&kas, (caddr_t)SEGDEBUGBASE, (size_t)SEGDEBUGSIZE, |
2432 (void) seg_attach(&kas, (caddr_t)SEGDEBUGBASE, (size_t)SEGDEBUGSIZE, |
2383 &kdebugseg); |
2433 &kdebugseg); |
2384 (void) segkmem_create(&kdebugseg); |
2434 (void) segkmem_create(&kdebugseg); |