5 Commits
v2.0 ... v2.1

Author SHA1 Message Date
Nicolas Dechesne
ad13228e6a ufs: add support for UFS WriteBooster feature
WriteBooster is a new feature added in UFS3.1. There are new
paramaters in the UFS header config. Trying to provision a 3.1+ device
without these parameters fail.

Also make sure that we don't send them on older devices.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
2024-12-12 07:56:49 -06:00
Nicolas Dechesne
fa070e81b4 qdl: fixup usage function
--serial and --out-chunk-size are parameters which were added recently
  to qdl, but the print_usage() function was not updated accordingly.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
2024-11-26 23:31:25 -06:00
Nicolas Dechesne
f63c4df679 .github: use actions/checkout v4
v2 has been deprecated for a while now, and generates a bunch of
warnings each time an action is executed.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
2024-11-05 18:16:52 -06:00
Bjorn Andersson
b068cc58d9 firehose: Allow bConfigDescrLock to be passed as 1
During the introduction of UFS provisioning, the author left behind an
additional safety measure of forcing the user to explicitly modify the
source and recompile QDL in order to be able to lock the provisioning,
to avoid users accidentally doing so.

While it does reduce the risk of irreversable mistakes, it's not
suitable when QDL is distributed as a binary - and the user already need
to set bConfigDescrLock both in provided XML files and on command line.

So, let's remove the safety net...

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2024-10-10 15:17:05 +02:00
Milosz Wasilewski
f8fae69796 qdl: firehose: program: fail on missing file
When parsing XML files the specified binary to be flashed may not be
present. The default behaviour of QDL is to ignore missing file. This is
sometimes undesireble.

This patch changes the default behaviour. If the file to be flashed
can't be found qdl will exit with error. An optional flag --allow-missing
is introduced. It will allow to skip missing files during flashing procedure.
Default value of the flag is false.

Signed-off-by: Milosz Wasilewski <quic_mwasilew@quicinc.com>
2024-10-01 15:19:26 +02:00
8 changed files with 38 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Dependencies (Ubuntu)
if: runner.os == 'Linux'

View File

@@ -613,7 +613,13 @@ int firehose_apply_ufs_common(struct qdl_device *qdl, struct ufs_common *ufs)
xml_setpropf(node_to_send, "bSecureRemovalType", "%d", ufs->bSecureRemovalType);
xml_setpropf(node_to_send, "bInitActiveICCLevel", "%d", ufs->bInitActiveICCLevel);
xml_setpropf(node_to_send, "wPeriodicRTCUpdate", "%d", ufs->wPeriodicRTCUpdate);
xml_setpropf(node_to_send, "bConfigDescrLock", "%d", 0/*ufs->bConfigDescrLock*/); //Safety, remove before fly
xml_setpropf(node_to_send, "bConfigDescrLock", "%d", ufs->bConfigDescrLock);
if (ufs->wb) {
xml_setpropf(node_to_send, "bWriteBoosterBufferPreserveUserSpaceEn", "%d", ufs->bWriteBoosterBufferPreserveUserSpaceEn);
xml_setpropf(node_to_send, "bWriteBoosterBufferType", "%d", ufs->bWriteBoosterBufferType);
xml_setpropf(node_to_send, "shared_wb_buffer_size_in_kb", "%d", ufs->shared_wb_buffer_size_in_kb);
}
ret = firehose_send_single_tag(qdl, node_to_send);
if (ret)
@@ -725,7 +731,7 @@ static int firehose_reset(struct qdl_device *qdl)
return ret == FIREHOSE_ACK ? 0 : -1;
}
int firehose_run(struct qdl_device *qdl, const char *incdir, const char *storage)
int firehose_run(struct qdl_device *qdl, const char *incdir, const char *storage, bool allow_missing)
{
int bootable;
int ret;
@@ -756,7 +762,7 @@ int firehose_run(struct qdl_device *qdl, const char *incdir, const char *storage
if (ret)
return ret;
ret = program_execute(qdl, firehose_program, incdir);
ret = program_execute(qdl, firehose_program, incdir, allow_missing);
if (ret)
return ret;

View File

@@ -160,7 +160,7 @@ out:
}
int program_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program, int fd),
const char *incdir)
const char *incdir, bool allow_missing)
{
struct program *program;
const char *filename;
@@ -182,7 +182,12 @@ int program_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl,
fd = open(filename, O_RDONLY);
if (fd < 0) {
printf("Unable to open %s...ignoring\n", program->filename);
printf("Unable to open %s", program->filename);
if (!allow_missing) {
printf("...failing\n");
return -1;
}
printf("...ignoring\n");
continue;
}

View File

@@ -23,7 +23,7 @@ struct program {
int program_load(const char *program_file, bool is_nand);
int program_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program, int fd),
const char *incdir);
const char *incdir, bool allow_missing);
int erase_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program));
int program_find_bootable_partition(void);

11
qdl.c
View File

@@ -103,7 +103,7 @@ static void print_usage(void)
{
extern const char *__progname;
fprintf(stderr,
"%s [--debug] [--storage <emmc|nand|ufs>] [--finalize-provisioning] [--include <PATH>] <prog.mbn> [<program> <patch> ...]\n",
"%s [--debug] [--allow-missing] [--storage <emmc|nand|ufs>] [--finalize-provisioning] [--include <PATH>] [--serial <NUM>] [--out-chunk-size <SIZE>] <prog.mbn> [<program> <patch> ...]\n",
__progname);
}
@@ -120,6 +120,7 @@ int main(int argc, char **argv)
int ret;
int opt;
bool qdl_finalize_provisioning = false;
bool allow_missing = false;
long out_chunk_size;
static struct option options[] = {
@@ -129,14 +130,18 @@ int main(int argc, char **argv)
{"out-chunk-size", required_argument, 0, OPT_OUT_CHUNK_SIZE },
{"serial", required_argument, 0, 'S'},
{"storage", required_argument, 0, 's'},
{"allow-missing", no_argument, 0, 'f'},
{0, 0, 0, 0}
};
while ((opt = getopt_long(argc, argv, "di:S:", options, NULL )) != -1) {
while ((opt = getopt_long(argc, argv, "dfi:S:", options, NULL )) != -1) {
switch (opt) {
case 'd':
qdl_debug = true;
break;
case 'f':
allow_missing = true;
break;
case 'i':
incdir = optarg;
break;
@@ -208,7 +213,7 @@ int main(int argc, char **argv)
if (ret < 0)
return 1;
ret = firehose_run(&qdl, incdir, storage);
ret = firehose_run(&qdl, incdir, storage, allow_missing);
if (ret < 0)
return 1;

2
qdl.h
View File

@@ -31,7 +31,7 @@ int qdl_read(struct qdl_device *qdl, void *buf, size_t len, unsigned int timeout
int qdl_write(struct qdl_device *qdl, const void *buf, size_t len);
void qdl_set_out_chunk_size(struct qdl_device *qdl, long size);
int firehose_run(struct qdl_device *qdl, const char *incdir, const char *storage);
int firehose_run(struct qdl_device *qdl, const char *incdir, const char *storage, bool allow_missing);
int sahara_run(struct qdl_device *qdl, char *img_arr[], bool single_image,
const char *ramdump_path, const char *ramdump_filter);
void print_hex_dump(const char *prefix, const void *buf, size_t len);

7
ufs.c
View File

@@ -86,6 +86,13 @@ struct ufs_common *ufs_parse_common_params(xmlNode *node, bool finalize_provisio
return NULL;
}
/* These parameters are optional */
errors = 0;
result->bWriteBoosterBufferPreserveUserSpaceEn = !!attr_as_unsigned(node, "bWriteBoosterBufferPreserveUserSpaceEn", &errors);
result->bWriteBoosterBufferType = !!attr_as_unsigned(node, "bWriteBoosterBufferType", &errors);
result->shared_wb_buffer_size_in_kb = attr_as_unsigned(node, "shared_wb_buffer_size_in_kb", &errors);
result->wb = !errors;
return result;
}

4
ufs.h
View File

@@ -42,6 +42,10 @@ struct ufs_common {
unsigned bInitActiveICCLevel;
unsigned wPeriodicRTCUpdate;
bool bConfigDescrLock;
bool wb;
bool bWriteBoosterBufferPreserveUserSpaceEn;
bool bWriteBoosterBufferType;
unsigned shared_wb_buffer_size_in_kb;
};
struct ufs_body {