PERFORCE change 100379 for review
Kip Macy
kmacy at FreeBSD.org
Sat Jul 1 04:54:16 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=100379
Change 100379 by kmacy at kmacy_storage:sun4v_work_stable on 2006/07/01 04:53:23
fix hw.physmem loader option
Affected files ...
.. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/pmap.c#5 edit
Differences ...
==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/pmap.c#5 (text+ko) ====
@@ -428,7 +428,7 @@
vm_size_t physsz, virtsz, kernel_hash_size;
ihandle_t pmem, vmem;
int i, sz, j;
- uint64_t tsb_8k_size, tsb_4m_size, error;
+ uint64_t tsb_8k_size, tsb_4m_size, error, physmem_tunable;
/*
* Find out what physical memory is available from the prom and
@@ -452,20 +452,22 @@
qsort(mra, sz, sizeof (*mra), mr_cmp);
physsz = 0;
- getenv_quad("hw.physmem", &physmem);
- physmem = ctob(physmem);
+
+ if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
+ physmem = atop(physmem_tunable);
+ printf("desired physmem=0x%lx\n", physmem_tunable);
for (i = 0, j = 0; i < sz; i++, j += 2) {
CTR2(KTR_PMAP, "start=%#lx size=%#lx\n", mra[i].mr_start,
mra[i].mr_size);
KDPRINTF("start=%#lx size=%#lx\n", mra[i].mr_start,
mra[i].mr_size);
- if (physmem != 0 && btoc(physsz + mra[i].mr_size) >= physmem) {
- if (btoc(physsz) < physmem) {
+ if (physmem_tunable != 0 && (physsz + mra[i].mr_size) >= physmem_tunable) {
+ if (physsz < physmem_tunable) {
phys_avail[j] = mra[i].mr_start;
phys_avail[j + 1] = mra[i].mr_start +
- (ctob(physmem) - physsz);
- physsz = ctob(physmem);
+ (physmem_tunable - physsz);
+ physsz = physmem_tunable;
}
break;
}
@@ -607,7 +609,7 @@
* currently (not by design) used for permanent mappings
*/
- tsb_4m_size = virtsz >> (PAGE_SHIFT_4M - TTE_SHIFT);
+ tsb_4m_size = (virtsz >> (PAGE_SHIFT_4M - TTE_SHIFT));
pa = pmap_bootstrap_alloc(tsb_4m_size);
KDPRINTF("tsb_4m_pa is 0x%lx tsb_4m_size is 0x%lx\n", pa, tsb_4m_size);
@@ -688,12 +690,11 @@
*
*/
pa = PAGE_SIZE_4M;
- for (i = 0; phys_avail[i + 2] != 0; i += 2)
- for (; pa < phys_avail[i + 1]; pa += PAGE_SIZE_4M) {
- tsb_set_tte_real(&kernel_td[TSB4M_INDEX], TLB_PHYS_TO_DIRECT(pa),
- pa | TTE_KERNEL | VTD_4M, 0);
- }
-
+ for (i = 0; phys_avail[i] != 0; i += 2)
+ for (; pa < phys_avail[i + 1]; pa += PAGE_SIZE_4M)
+ tsb_set_tte_real(&kernel_td[TSB4M_INDEX], TLB_PHYS_TO_DIRECT(pa),
+ pa | TTE_KERNEL | VTD_4M, 0);
+
for (i = 0; i < 2; i++) {
pa = nucleus_mappings[i];
tsb_set_tte_real(&kernel_td[TSB4M_INDEX], TLB_PHYS_TO_DIRECT(pa),
@@ -751,6 +752,9 @@
pa = TTE_GET_PA(translations[i].om_tte) + off;
tte_hash_insert(pm->pm_hash, va, pa | TTE_KERNEL | VTD_8K);
}
+ KDPRINTF("set om_size=%ld om_start=%lx om_tte=%lx\n",
+ translations[i].om_size, translations[i].om_start,
+ translations[i].om_tte);
}
for (i = 0; i < KSTACK_PAGES; i++) {
pa = kstack0_phys + i * PAGE_SIZE;
@@ -771,6 +775,7 @@
for (i = 0; phys_avail[i + 2] != 0; i += 2)
if (phys_avail[i + 1] - phys_avail[i] < PAGE_SIZE_4M)
phys_avail[i] = phys_avail[i+1] = 0;
+
}
More information about the p4-projects
mailing list