Commit 13681fcb authored by Bjorn Andersson's avatar Bjorn Andersson
Browse files

firehose: Make "start_sector" a string again

Assumed to be a remnant of early development lead to a recent transition
of "start_sector" from being represented as a string to an integer. But
it turns out that "start_sector" might be an expression, e.g. to write
something at the end of the disk.

So transition back to carry "start_sector" as a string.

Fixes: b6e0ea31

 ("program: Make start_sector unsigned in")
Reported-by: Julien Robin
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 3c0405c0
......@@ -304,7 +304,7 @@ static int firehose_erase(struct qdl_device *qdl, struct program *program)
xml_setpropf(node, "PAGES_PER_BLOCK", "%d", program->pages_per_block);
xml_setpropf(node, "SECTOR_SIZE_IN_BYTES", "%d", program->sector_size);
xml_setpropf(node, "num_partition_sectors", "%d", program->num_sectors);
xml_setpropf(node, "start_sector", "%d", program->start_sector);
xml_setpropf(node, "start_sector", "%s", program->start_sector);
ret = firehose_write(qdl, doc);
if (ret < 0) {
......@@ -313,7 +313,7 @@ static int firehose_erase(struct qdl_device *qdl, struct program *program)
}
ret = firehose_read(qdl, 30000, firehose_generic_parser, NULL);
fprintf(stderr, "[ERASE] erase 0x%x+0x%x %s\n",
fprintf(stderr, "[ERASE] erase %s+0x%x %s\n",
program->start_sector, program->num_sectors,
ret ? "failed" : "succeeded");
......@@ -364,7 +364,7 @@ static int firehose_program(struct qdl_device *qdl, struct program *program, int
xml_setpropf(node, "SECTOR_SIZE_IN_BYTES", "%d", program->sector_size);
xml_setpropf(node, "num_partition_sectors", "%d", num_sectors);
xml_setpropf(node, "physical_partition_number", "%d", program->partition);
xml_setpropf(node, "start_sector", "%d", program->start_sector);
xml_setpropf(node, "start_sector", "%s", program->start_sector);
if (program->filename)
xml_setpropf(node, "filename", "%s", program->filename);
......@@ -448,7 +448,7 @@ static int firehose_apply_patch(struct qdl_device *qdl, struct patch *patch)
xml_setpropf(node, "filename", "%s", patch->filename);
xml_setpropf(node, "physical_partition_number", "%d", patch->partition);
xml_setpropf(node, "size_in_bytes", "%d", patch->size_in_bytes);
xml_setpropf(node, "start_sector", "%d", patch->start_sector);
xml_setpropf(node, "start_sector", "%s", patch->start_sector);
xml_setpropf(node, "value", "%s", patch->value);
ret = firehose_write(qdl, doc);
......
......@@ -72,7 +72,7 @@ int patch_load(const char *patch_file)
patch->filename = attr_as_string(node, "filename", &errors);
patch->partition = attr_as_unsigned(node, "physical_partition_number", &errors);
patch->size_in_bytes = attr_as_unsigned(node, "size_in_bytes", &errors);
patch->start_sector = attr_as_unsigned(node, "start_sector", &errors);
patch->start_sector = attr_as_string(node, "start_sector", &errors);
patch->value = attr_as_string(node, "value", &errors);
patch->what = attr_as_string(node, "what", &errors);
......
......@@ -9,7 +9,7 @@ struct patch {
const char *filename;
unsigned partition;
unsigned size_in_bytes;
unsigned start_sector;
const char *start_sector;
const char *value;
const char *what;
......
......@@ -60,7 +60,7 @@ static int load_erase_tag(xmlNode *node, bool is_nand)
program->pages_per_block = attr_as_unsigned(node, "PAGES_PER_BLOCK", &errors);
program->sector_size = attr_as_unsigned(node, "SECTOR_SIZE_IN_BYTES", &errors);
program->num_sectors = attr_as_unsigned(node, "num_partition_sectors", &errors);
program->start_sector = attr_as_unsigned(node, "start_sector", &errors);
program->start_sector = attr_as_string(node, "start_sector", &errors);
if (errors) {
fprintf(stderr, "[PROGRAM] errors while parsing erase tag\n");
......@@ -93,7 +93,7 @@ static int load_program_tag(xmlNode *node, bool is_nand)
program->label = attr_as_string(node, "label", &errors);
program->num_sectors = attr_as_unsigned(node, "num_partition_sectors", &errors);
program->partition = attr_as_unsigned(node, "physical_partition_number", &errors);
program->start_sector = attr_as_unsigned(node, "start_sector", &errors);
program->start_sector = attr_as_string(node, "start_sector", &errors);
if (is_nand) {
program->pages_per_block = attr_as_unsigned(node, "PAGES_PER_BLOCK", &errors);
......
......@@ -12,7 +12,7 @@ struct program {
const char *label;
unsigned num_sectors;
unsigned partition;
unsigned start_sector;
const char *start_sector;
unsigned last_sector;
bool is_nand;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment