Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/ofw/ofw_machdep.c
| Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | for (phandle = OF_child(OF_peer(0)); phandle != 0; | ||||
| if (OF_getprop(phandle, "name", name, sizeof(name)) <= 0) | if (OF_getprop(phandle, "name", name, sizeof(name)) <= 0) | ||||
| continue; | continue; | ||||
| if (strncmp(name, "memory", sizeof(name)) != 0 && | if (strncmp(name, "memory", sizeof(name)) != 0 && | ||||
| strncmp(name, "memory@", strlen("memory@")) != 0) | strncmp(name, "memory@", strlen("memory@")) != 0) | ||||
| continue; | continue; | ||||
| res = parse_ofw_memory(phandle, "reg", &memp[msz]); | res = parse_ofw_memory(phandle, "reg", &memp[msz]); | ||||
| msz += res/sizeof(struct mem_region); | msz += res/sizeof(struct mem_region); | ||||
| if (OF_getproplen(phandle, "available") >= 0) | |||||
| /* Order is important below. On POWER9 System, device-tree | |||||
| * might have both /linux,usable-memory and /reg properties | |||||
| * with different size values. For discovering memory slots, we | |||||
| * must use /linux-usable-memory otherwise we can grab NVlink | |||||
| * memories that contains len=0 on linux,usable-memory but >0 on | |||||
| * /reg property, even not being a standard memory region, which | |||||
| * is wrong and causes ghost memories to show up. | |||||
| */ | |||||
| if (OF_getproplen(phandle, "linux,usable-memory") >= 0) | |||||
| res = parse_ofw_memory(phandle, "linux,usable-memory", | |||||
| &availp[asz]); | |||||
| else if (OF_getproplen(phandle, "available") >= 0) | |||||
| res = parse_ofw_memory(phandle, "available", | res = parse_ofw_memory(phandle, "available", | ||||
| &availp[asz]); | &availp[asz]); | ||||
| else | else | ||||
| res = parse_ofw_memory(phandle, "reg", &availp[asz]); | res = parse_ofw_memory(phandle, "reg", &availp[asz]); | ||||
| asz += res/sizeof(struct mem_region); | asz += res/sizeof(struct mem_region); | ||||
| } | } | ||||
| #ifdef FDT | #ifdef FDT | ||||
| ▲ Show 20 Lines • Show All 314 Lines • Show Last 20 Lines | |||||