Date: Wed, 17 Dec 2014 13:36:29 +0000 From: Ruslan Bukin <br@FreeBSD.org> To: Ian Lepore <ian@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r275858 - head/sys/mips/beri Message-ID: <20141217133629.GA29458@bsdpad.com> In-Reply-To: <1418820674.1015.14.camel@freebsd.org> References: <201412170934.sBH9Ytqp071808@svn.freebsd.org> <1418820674.1015.14.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 17, 2014 at 05:51:14AM -0700, Ian Lepore wrote: > > Modified: head/sys/mips/beri/beri_machdep.c > > ============================================================================== > > --- head/sys/mips/beri/beri_machdep.c Wed Dec 17 07:47:25 2014 (r275857) > > +++ head/sys/mips/beri/beri_machdep.c Wed Dec 17 09:34:54 2014 (r275858) > > @@ -88,6 +88,11 @@ static void > > mips_init(void) > > { > > int i; > > +#ifdef FDT > > + struct mem_region mr[FDT_MEM_REGIONS]; > > + int mr_cnt, val; > > + int j; > > +#endif > > > > for (i = 0; i < 10; i++) { > > phys_avail[i] = 0; > > @@ -102,6 +107,29 @@ mips_init(void) > > > > physmem = realmem; > > > > +#ifdef FDT > > + if (fdt_get_mem_regions(mr, &mr_cnt, &val) == 0) { > > + > > + physmem = btoc(val); > > + > > + KASSERT((phys_avail[0] >= mr[0].mr_start) && \ > > + (phys_avail[0] < (mr[0].mr_start + mr[0].mr_size)), > > + ("First region is not within FDT memory range")); > > + > > + /* Limit size of the first region */ > > + phys_avail[1] = MIN(mr[0].mr_size, ctob(realmem)); > > + dump_avail[1] = phys_avail[1]; > > + > > + /* Add the rest of regions */ > > + for (i = 1, j = 2; i < mr_cnt; i++, j+=2) { > > + phys_avail[j] = mr[i].mr_start; > > + phys_avail[j+1] = mr[i].mr_size; > > + dump_avail[j] = phys_avail[j]; > > + dump_avail[j+1] = phys_avail[j+1]; > > + } > > + } > > +#endif > > + > > init_param1(); > > init_param2(physmem); > > mips_cpu_init(); > > > > This doesn't look right, the values in the odd-numbered array slots for > phys_avail and dump_avail need to be addresses, not sizes. That is, > avail[j] = start, avail[j+1] = start+size (note: not start+size-1). > > Right, thanks. Sounds like it should be like that Index: sys/mips/beri/beri_machdep.c =================================================================== --- sys/mips/beri/beri_machdep.c (revision 275861) +++ sys/mips/beri/beri_machdep.c (working copy) @@ -117,13 +117,13 @@ ("First region is not within FDT memory range")); /* Limit size of the first region */ - phys_avail[1] = MIN(mr[0].mr_size, ctob(realmem)); + phys_avail[1] = (mr[0].mr_start + MIN(mr[0].mr_size, ctob(realmem))); dump_avail[1] = phys_avail[1]; /* Add the rest of regions */ for (i = 1, j = 2; i < mr_cnt; i++, j+=2) { phys_avail[j] = mr[i].mr_start; - phys_avail[j+1] = mr[i].mr_size; + phys_avail[j+1] = (mr[i].mr_start + mr[i].mr_size); dump_avail[j] = phys_avail[j]; dump_avail[j+1] = phys_avail[j+1]; } Ruslan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141217133629.GA29458>