Commit af51c25f authored by Timo Alho's avatar Timo Alho Committed by Thierry Reding

firmware: tegra: Use in-band messages for firmware version query

Add support for a new MRQ, that uses in-band messaging instead of IOVA
buffer, to retrieve the firmware version 'tag' during boot. If an
older firmware is used, that does not support the new MRQ, fall back
to the earlier implementation.
Signed-off-by: default avatarTimo Alho <talho@nvidia.com>
Acked-by: default avatarSivaram Nair <sivaramn@nvidia.com>
Acked-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 4bef358c
...@@ -547,7 +547,8 @@ static int tegra_bpmp_ping(struct tegra_bpmp *bpmp) ...@@ -547,7 +547,8 @@ static int tegra_bpmp_ping(struct tegra_bpmp *bpmp)
return err; return err;
} }
static int tegra_bpmp_get_firmware_tag(struct tegra_bpmp *bpmp, char *tag, /* deprecated version of tag query */
static int tegra_bpmp_get_firmware_tag_old(struct tegra_bpmp *bpmp, char *tag,
size_t size) size_t size)
{ {
struct mrq_query_tag_request request; struct mrq_query_tag_request request;
...@@ -585,6 +586,37 @@ static int tegra_bpmp_get_firmware_tag(struct tegra_bpmp *bpmp, char *tag, ...@@ -585,6 +586,37 @@ static int tegra_bpmp_get_firmware_tag(struct tegra_bpmp *bpmp, char *tag,
return err; return err;
} }
static int tegra_bpmp_get_firmware_tag(struct tegra_bpmp *bpmp, char *tag,
size_t size)
{
if (tegra_bpmp_mrq_is_supported(bpmp, MRQ_QUERY_FW_TAG)) {
struct mrq_query_fw_tag_response resp;
struct tegra_bpmp_message msg = {
.mrq = MRQ_QUERY_FW_TAG,
.rx = {
.data = &resp,
.size = sizeof(resp),
},
};
int err;
if (size != sizeof(resp.tag))
return -EINVAL;
err = tegra_bpmp_transfer(bpmp, &msg);
if (err)
return err;
if (msg.rx.ret < 0)
return -EINVAL;
memcpy(tag, resp.tag, sizeof(resp.tag));
return 0;
}
return tegra_bpmp_get_firmware_tag_old(bpmp, tag, size);
}
static void tegra_bpmp_channel_signal(struct tegra_bpmp_channel *channel) static void tegra_bpmp_channel_signal(struct tegra_bpmp_channel *channel)
{ {
unsigned long flags = channel->ob->flags; unsigned long flags = channel->ob->flags;
......
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