Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/powernv/platform_powernv.c
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | powernv_attach(platform_t plat) | ||||
int32_t lp_size, lp_encoding; | int32_t lp_size, lp_encoding; | ||||
char buf[255]; | char buf[255]; | ||||
pcell_t refpoints[3]; | pcell_t refpoints[3]; | ||||
pcell_t prop; | pcell_t prop; | ||||
phandle_t cpu; | phandle_t cpu; | ||||
phandle_t opal; | phandle_t opal; | ||||
int res, len, idx; | int res, len, idx; | ||||
register_t msr; | register_t msr; | ||||
bool has_lp; | |||||
/* Ping OPAL again just to make sure */ | /* Ping OPAL again just to make sure */ | ||||
opal_check(); | opal_check(); | ||||
#if BYTE_ORDER == LITTLE_ENDIAN | #if BYTE_ORDER == LITTLE_ENDIAN | ||||
opal_call(OPAL_REINIT_CPUS, 2 /* Little endian */); | opal_call(OPAL_REINIT_CPUS, 2 /* Little endian */); | ||||
#else | #else | ||||
opal_call(OPAL_REINIT_CPUS, 1 /* Big endian */); | opal_call(OPAL_REINIT_CPUS, 1 /* Big endian */); | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | if (len > 0) { | ||||
* We have to use a variable length array on the stack | * We have to use a variable length array on the stack | ||||
* since we have very limited stack space. | * since we have very limited stack space. | ||||
*/ | */ | ||||
pcell_t arr[len/sizeof(cell_t)]; | pcell_t arr[len/sizeof(cell_t)]; | ||||
res = OF_getencprop(cpu, "ibm,segment-page-sizes", arr, | res = OF_getencprop(cpu, "ibm,segment-page-sizes", arr, | ||||
sizeof(arr)); | sizeof(arr)); | ||||
len /= 4; | len /= 4; | ||||
idx = 0; | idx = 0; | ||||
has_lp = false; | |||||
while (len > 0) { | while (len > 0) { | ||||
shift = arr[idx]; | shift = arr[idx]; | ||||
slb_encoding = arr[idx + 1]; | slb_encoding = arr[idx + 1]; | ||||
nptlp = arr[idx + 2]; | nptlp = arr[idx + 2]; | ||||
idx += 3; | idx += 3; | ||||
len -= 3; | len -= 3; | ||||
while (len > 0 && nptlp) { | while (len > 0 && nptlp) { | ||||
lp_size = arr[idx]; | lp_size = arr[idx]; | ||||
lp_encoding = arr[idx+1]; | lp_encoding = arr[idx+1]; | ||||
if (slb_encoding == SLBV_L && lp_encoding == 0) | if (slb_encoding == SLBV_L && lp_encoding == 0) | ||||
break; | has_lp = true; | ||||
if (slb_encoding == SLB_PGSZ_4K_4K && | |||||
lp_encoding == LP_4K_16M) | |||||
moea64_has_lp_4k_16m = true; | |||||
idx += 2; | idx += 2; | ||||
len -= 2; | len -= 2; | ||||
nptlp--; | nptlp--; | ||||
} | } | ||||
if (nptlp && slb_encoding == SLBV_L && lp_encoding == 0) | if (has_lp && moea64_has_lp_4k_16m) | ||||
break; | break; | ||||
} | } | ||||
if (len == 0) | if (!has_lp) | ||||
panic("Standard large pages (SLB[L] = 1, PTE[LP] = 0) " | panic("Standard large pages (SLB[L] = 1, PTE[LP] = 0) " | ||||
"not supported by this system."); | "not supported by this system."); | ||||
moea64_large_page_shift = shift; | moea64_large_page_shift = shift; | ||||
moea64_large_page_size = 1ULL << lp_size; | moea64_large_page_size = 1ULL << lp_size; | ||||
} | } | ||||
out: | out: | ||||
▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines |