DTC: write_dt_blob() question

2 messages, 2 authors, 2005-07-14 · open the first message on its own page

DTC: write_dt_blob() question

From: Jon Loeliger <hidden>
Date: 2005-07-13 16:16:32

David,

Over in flattree.c's write_dt_blob() there is this code:

	make_bph(&bph, vi, reservenum, dtbuf.len, strbuf.len);

	/* Align the reserve map to an 8 byte boundary */
	for (i = vi->hdr_size; i < be32_to_cpu(bph.off_mem_rsvmap); i++)
		fputc(0, f);

	fwrite(&bph, vi->hdr_size, 1, f);
	for (i = 0; i < reservenum+1; i++)
		fwrite(&re, sizeof(re), 1, f);

However, I think the boot_param_header should be emitted
first, before the alignment:

	make_bph(&bph, vi, reservenum, dtbuf.len, strbuf.len);

	fwrite(&bph, vi->hdr_size, 1, f);

	/* Align the reserve map to an 8 byte boundary */
	for (i = vi->hdr_size; i < be32_to_cpu(bph.off_mem_rsvmap); i++)
		fputc(0, f);

	for (i = 0; i < reservenum+1; i++)
		fwrite(&re, sizeof(re), 1, f);

Thoughts?

Thanks,
jdl

Re: DTC: write_dt_blob() question

From: David Gibson <hidden>
Date: 2005-07-14 01:28:33

On Wed, Jul 13, 2005 at 11:16:32AM -0500, Jon Loeliger wrote:
David,

Over in flattree.c's write_dt_blob() there is this code:

	make_bph(&bph, vi, reservenum, dtbuf.len, strbuf.len);

	/* Align the reserve map to an 8 byte boundary */
	for (i = vi->hdr_size; i < be32_to_cpu(bph.off_mem_rsvmap); i++)
		fputc(0, f);

	fwrite(&bph, vi->hdr_size, 1, f);
	for (i = 0; i < reservenum+1; i++)
		fwrite(&re, sizeof(re), 1, f);

However, I think the boot_param_header should be emitted
first, before the alignment:

	make_bph(&bph, vi, reservenum, dtbuf.len, strbuf.len);

	fwrite(&bph, vi->hdr_size, 1, f);

	/* Align the reserve map to an 8 byte boundary */
	for (i = vi->hdr_size; i < be32_to_cpu(bph.off_mem_rsvmap); i++)
		fputc(0, f);

	for (i = 0; i < reservenum+1; i++)
		fwrite(&re, sizeof(re), 1, f);

Thoughts?
Oops, yes, stupid screwup on my part.  I've really got to get this
testsuite thing going...

I've committed a fix for this, but it won't go up on the site until
I'm able to fix my laptop, unfortunately (disk died the other day).

-- 
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help