<div class="gmail_quote">On Sun, Dec 25, 2011 at 8:42 AM, Stefan Tauner <span dir="ltr"><<a href="mailto:stefan.tauner@student.tuwien.ac.at">stefan.tauner@student.tuwien.ac.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">> Design issues:</div><div class="im">
> Specifying a file name from which flashrom should fetch a region and to<br>
> which flashrom should write a region has three main issues:<br>
> - It kills UI consistency. What happens if you have a region called<br>
> "all" which covers the whole flash chip? Specifying a filename for<br>
> region "all" means any supplied filename as --read or --write parameter<br>
> will be completely ignored but still be required.<br>
<br>
</div>for --read it is not ignored iirc but only those regions marked to be<br>
fetched via -i are included and the rest is filled with 0x00s. this<br>
creates a chip-sized file which might be useful to some e.g. if they<br>
want to manipulate it by editing some stuff. i will call this (i.e.<br>
files which are parameters to --write/--read/--verify but are<br>
used/filled only partially) "complete" files below.<br></blockquote><div><br></div><div>Yes -- the idea here is to be able to quickly read only the specified region(s), manipulate them, and then write them back.</div>

<div><br></div><div>It's kind of a funky usage model, but it's helped us save a lot of precious time during device manufacturing.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


in the case of --read'ing "all" this would produce two identical files<br>
(i guess).</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> for --write you are right to the point.<br>
i notices this problem but did not even try to mitigate it because i<br>
wanted to discuss the whole approached first so thanks for bringing it<br>
up :)<br></blockquote><div><br></div><div>For read, if the sum of regions included covers the entire chip, then you will end up with two identical files. Included regions will also show up in the -r argument, while the rest is filled in with 0xff's.</div>

<div><br></div><div>For write, the -w argument gets ignored if a region and input file is specified with -i region:filename. The -w argument is used if the :filename portion is omitted, or if no -i argument is used. It's kind of a kludge, and the "write_it" variable needs to be set somehow which is why -w is required in any case.</div>

<div><br></div><div>In both cases, the assumption is that users to specify -i explicitly wish to supersede default behavior of -r and -w. To make this more explicit, perhaps -r and -w should no longer require an argument?</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">currently i always write a "complete" image for --read operations but<br>
this might not be wanted and could be optional - if the -i option is<br>
used at least once. atm it is not necessary to give an image name<br>
because it defaults to the range's name. but this also forcibly creates<br>
files, when the -i option is used - even if the user does not need it.<br>
maybe we should let the desire for an image be defined by including the<br>
(optional) ':'?<br></blockquote><div><br></div><div>Using the :filename syntax is currently optional, and does not forcibly create files. (Maybe there is something in your patch that is not in chromium os branch that I am missing?)</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">for --write we need enough data to cover the to be written range(s).<br>
this can come from the "complete" image or the -i ones. and in case we<br>
care for the erase block layout we also need to be sure that the data<br>
is read from the chip where it is needed because it would get deleted<br>
but was not supplied/included via files. the latter is not an issue<br>
(yet) because the complete chip is (still) read in the case of writes.<br></blockquote><div><br></div><div>Yes... I think the old infrastructure was not quite sufficient to take into account the erase block sizes and intelligently read all the data necessary to do the partial write. So we ended up just reading the entire ROM anyway.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">another point which needs to be discussed is the precedence of</div>
overlapping regions. without any -i's files given this is not an issue.<br>
we just merge the regions automatically - the data for a single address<br>
is the same anyway.<br>
when different files are given this is no longer true. i think the best<br>
option would be to abort and/or require --force in that case in<br>
addition to a defined precedence (e.g. last -i wins).<br></blockquote><div><br></div><div>I'd prefer to simply abort if -i files are given and the regions overlap. Better to simply avoid doing something damaging in that case, IMHO.</div>

</div><div><br></div>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.<br>