diff options
| author | Breno Leitao <leitao@FreeBSD.org> | 2018-06-07 21:24:21 +0000 |
|---|---|---|
| committer | Breno Leitao <leitao@FreeBSD.org> | 2018-06-07 21:24:21 +0000 |
| commit | 6d645c57a36e677c5d1610a26a7c771fe0c1cf2f (patch) | |
| tree | dcd3b5a288a480adfb4864e75b33f4377fbea2f2 | |
| parent | 401e870791c6cbd833e0b6503d9fb9f941b9b178 (diff) | |
Notes
| -rw-r--r-- | sys/powerpc/ofw/ofw_machdep.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/sys/powerpc/ofw/ofw_machdep.c b/sys/powerpc/ofw/ofw_machdep.c index d0137f80e176..7e231373d829 100644 --- a/sys/powerpc/ofw/ofw_machdep.c +++ b/sys/powerpc/ofw/ofw_machdep.c @@ -297,14 +297,37 @@ excise_initrd_region(struct mem_region *avail, int asz) uint64_t start, end; ssize_t size; struct mem_region initrdmap[1]; + pcell_t cell[2]; chosen = OF_finddevice("/chosen"); - size = OF_getprop(chosen, "linux,initrd-start", &start, sizeof(start)); - if (size <= 0) + + size = OF_getencprop(chosen, "linux,initrd-start", cell, sizeof(cell)); + if (size < 0) + return (asz); + else if (size == 4) + start = cell[0]; + else if (size == 8) + start = (uint64_t)cell[0] << 32 | cell[1]; + else { + /* Invalid value length */ + printf("WARNING: linux,initrd-start must be either 4 or 8 bytes long\n"); return (asz); + } + + size = OF_getencprop(chosen, "linux,initrd-end", cell, sizeof(cell)); + if (size < 0) + return (asz); + else if (size == 4) + end = cell[0]; + else if (size == 8) + end = (uint64_t)cell[0] << 32 | cell[1]; + else { + /* Invalid value length */ + printf("WARNING: linux,initrd-end must be either 4 or 8 bytes long\n"); + return (asz); + } - size = OF_getprop(chosen, "linux,initrd-end", &end, sizeof(end)); - if (size <= 0) + if (end <= start) return (asz); initrdmap[0].mr_start = start; |
