Author: leitao Date: Thu Jun 7 21:24:21 2018 New Revision: 334816 URL: https://svnweb.freebsd.org/changeset/base/334816
Log: Fix excise_initrd_region() to support 32- and 64-bit initrd params. Changed excise_initrd_region to support both 32- and 64-bit values for linux,initrd-start and linux,initrd-end. This fixes the boot problem on some machines after rS334485. Submitted by: Luis Pires <lffpi...@ruabrasil.org> Reviewed by: jhibbits, leitao Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D15667 Modified: head/sys/powerpc/ofw/ofw_machdep.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Thu Jun 7 20:57:12 2018 (r334815) +++ head/sys/powerpc/ofw/ofw_machdep.c Thu Jun 7 21:24:21 2018 (r334816) @@ -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_getprop(chosen, "linux,initrd-end", &end, sizeof(end)); - if (size <= 0) + 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); + } + + if (end <= start) return (asz); initrdmap[0].mr_start = start; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
