1 From 650cd61348897bbf19addafe37b8559aa4e75710 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 10 Jan 2019 17:58:06 +0000
4 Subject: [PATCH] firmware: raspberrypi: Report the fw variant during
7 The driver already reported the firmware build date during probe.
8 The mailbox calls have been extended to also report the variant
10 2 = start_x.elf (includes camera stack)
11 3 = start_db.elf (includes assert logging)
12 4 = start_cd.elf (cutdown version for smallest memory footprint).
13 Log the variant during probe.
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
17 firmware: raspberrypi: Report the fw git hash during probe
19 The firmware can now report the git hash from which it was built
20 via the mailbox, so report it during probe.
22 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
24 drivers/firmware/raspberrypi.c | 49 ++++++++++++++++++----
25 include/soc/bcm2835/raspberrypi-firmware.h | 2 +
26 2 files changed, 44 insertions(+), 7 deletions(-)
28 --- a/drivers/firmware/raspberrypi.c
29 +++ b/drivers/firmware/raspberrypi.c
30 @@ -229,21 +229,55 @@ static const struct attribute_group rpi_
32 rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
34 + static const char * const variant_strs[] = {
41 + const char *variant_str = "cmd unsupported";
45 int ret = rpi_firmware_property(fw,
46 RPI_FIRMWARE_GET_FIRMWARE_REVISION,
47 &packet, sizeof(packet));
54 - time64_to_tm(packet, 0, &tm);
55 + ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_FIRMWARE_VARIANT,
56 + &variant, sizeof(variant));
58 - dev_info(fw->cl.dev,
59 - "Attached to firmware from %04ld-%02d-%02d %02d:%02d\n",
60 - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
61 - tm.tm_hour, tm.tm_min);
63 + if (variant >= ARRAY_SIZE(variant_strs))
65 + variant_str = variant_strs[variant];
68 + time64_to_tm(packet, 0, &tm);
70 + dev_info(fw->cl.dev,
71 + "Attached to firmware from %04ld-%02d-%02d %02d:%02d, variant %s\n",
72 + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
73 + tm.tm_min, variant_str);
77 +rpi_firmware_print_firmware_hash(struct rpi_firmware *fw)
80 + int ret = rpi_firmware_property(fw,
81 + RPI_FIRMWARE_GET_FIRMWARE_HASH,
82 + hash, sizeof(hash));
87 + dev_info(fw->cl.dev,
88 + "Firmware hash is %08x%08x%08x%08x%08x\n",
89 + hash[0], hash[1], hash[2], hash[3], hash[4]);
93 @@ -298,6 +332,7 @@ static int rpi_firmware_probe(struct pla
96 rpi_firmware_print_firmware_revision(fw);
97 + rpi_firmware_print_firmware_hash(fw);
98 rpi_register_hwmon_driver(dev, fw);
99 rpi_register_clk_driver(dev);
101 --- a/include/soc/bcm2835/raspberrypi-firmware.h
102 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
103 @@ -38,6 +38,8 @@ struct rpi_firmware_property_tag_header
104 enum rpi_firmware_property_tag {
105 RPI_FIRMWARE_PROPERTY_END = 0,
106 RPI_FIRMWARE_GET_FIRMWARE_REVISION = 0x00000001,
107 + RPI_FIRMWARE_GET_FIRMWARE_VARIANT = 0x00000002,
108 + RPI_FIRMWARE_GET_FIRMWARE_HASH = 0x00000003,
110 RPI_FIRMWARE_SET_CURSOR_INFO = 0x00008010,
111 RPI_FIRMWARE_SET_CURSOR_STATE = 0x00008011,