Date: Wed, 17 Dec 2014 05:51:14 -0700 From: Ian Lepore <ian@freebsd.org> To: Ruslan Bukin <br@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: <1418820674.1015.14.camel@freebsd.org> In-Reply-To: <201412170934.sBH9Ytqp071808@svn.freebsd.org> References: <201412170934.sBH9Ytqp071808@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2014-12-17 at 09:34 +0000, Ruslan Bukin wrote: > Author: br > Date: Wed Dec 17 09:34:54 2014 > New Revision: 275858 > URL: https://svnweb.freebsd.org/changeset/base/275858 > > Log: > Use memory regions information provided in FDT. > > Reviewed by: brooks > Sponsored by: DARPA, AFRL > > Modified: > head/sys/mips/beri/beri_machdep.c > > 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). -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1418820674.1015.14.camel>