Stop special casing 32-bit AIM in memory parsing

There's no need to special case 32-bit AIM to short circuit processing.
Some AIM CPUs can handle 36 bit addresses, and 64-bit CPUs can run 32-bit
OSes, so this will allow us to expand for that in the future if we desire.
This commit is contained in:
Justin Hibbits 2017-11-17 04:10:52 +00:00
parent 2ccee9cc52
commit bb7137e1a3

@ -184,14 +184,6 @@ parse_ofw_memory(phandle_t node, const char *prop, struct mem_region *output)
i = 0;
j = 0;
while (i < sz/sizeof(cell_t)) {
#if !defined(__powerpc64__) && !defined(BOOKE)
/* On 32-bit PPC (OEA), ignore regions starting above 4 GB */
if (address_cells > 1 && OFmem[i] > 0) {
i += address_cells + size_cells;
continue;
}
#endif
output[j].mr_start = OFmem[i++];
if (address_cells == 2) {
output[j].mr_start <<= 32;
@ -204,19 +196,20 @@ parse_ofw_memory(phandle_t node, const char *prop, struct mem_region *output)
output[j].mr_size += OFmem[i++];
}
#if !defined(__powerpc64__) && !defined(BOOKE)
/* Book-E can support 36-bit addresses. */
if (output[j].mr_start > BUS_SPACE_MAXADDR)
continue;
/*
* Check for memory regions extending above 32-bit
* memory space, and restrict them to stay there.
* Constrain memory to that which we can access.
* 32-bit AIM can only reference 32 bits of address currently,
* but Book-E can access 36 bits.
*/
if (((uint64_t)output[j].mr_start +
(uint64_t)output[j].mr_size) >
BUS_SPACE_MAXADDR_32BIT) {
output[j].mr_size = BUS_SPACE_MAXADDR_32BIT -
output[j].mr_start;
(uint64_t)output[j].mr_size - 1) >
BUS_SPACE_MAXADDR) {
output[j].mr_size = BUS_SPACE_MAXADDR -
output[j].mr_start + 1;
}
#endif
j++;
}