ASoC: SOF: ipc: replace fw ready bitfield with explicit bit ordering
authorSlawomir Blauciak <slawomir.blauciak@linux.intel.com>
Mon, 3 Jun 2019 16:20:32 +0000 (11:20 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 3 Jun 2019 16:42:50 +0000 (17:42 +0100)
Previously the structure used bitfields, which do not guarantee bit
ordering.

This change makes sure the order is clearly defined.  It also renames
and repurposes the field for general use.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/sof/info.h
sound/soc/sof/ipc.c

index 21dae04d818398aecdaa3d9bc0c1ad9c64e29d94..16528d2b4a504ea455e86ed904a30cbc2d6394f0 100644 (file)
 
 #define SOF_IPC_MAX_ELEMS      16
 
+/*
+ * Firmware boot info flag bits (64-bit)
+ */
+#define SOF_IPC_INFO_BUILD             BIT(0)
+#define SOF_IPC_INFO_LOCKS             BIT(1)
+#define SOF_IPC_INFO_LOCKSV            BIT(2)
+#define SOF_IPC_INFO_GDB               BIT(3)
+
 /* extended data types that can be appended onto end of sof_ipc_fw_ready */
 enum sof_ipc_ext_data {
        SOF_IPC_EXT_DMA_BUFFER = 0,
@@ -49,16 +57,8 @@ struct sof_ipc_fw_ready {
        uint32_t hostbox_size;
        struct sof_ipc_fw_version version;
 
-       /* Miscellaneous debug flags showing build/debug features enabled */
-       union {
-               uint64_t reserved;
-               struct {
-                       uint64_t build:1;
-                       uint64_t locks:1;
-                       uint64_t locks_verbose:1;
-                       uint64_t gdb:1;
-               } bits;
-       } debug;
+       /* Miscellaneous flags */
+       uint64_t flags;
 
        /* reserved for future use */
        uint32_t reserved[4];
index 10304a90cf25afc7375b28b13bdda4897c04a95f..2414640a32d18dcece27a88018ad82ebd0c485b6 100644 (file)
@@ -763,16 +763,19 @@ int snd_sof_ipc_valid(struct snd_sof_dev *sdev)
                }
        }
 
-       if (ready->debug.bits.build) {
+       if (ready->flags & SOF_IPC_INFO_BUILD) {
                dev_info(sdev->dev,
                         "Firmware debug build %d on %s-%s - options:\n"
                         " GDB: %s\n"
                         " lock debug: %s\n"
                         " lock vdebug: %s\n",
                         v->build, v->date, v->time,
-                        ready->debug.bits.gdb ? "enabled" : "disabled",
-                        ready->debug.bits.locks ? "enabled" : "disabled",
-                        ready->debug.bits.locks_verbose ? "enabled" : "disabled");
+                        ready->flags & SOF_IPC_INFO_GDB ?
+                               "enabled" : "disabled",
+                        ready->flags & SOF_IPC_INFO_LOCKS ?
+                               "enabled" : "disabled",
+                        ready->flags & SOF_IPC_INFO_LOCKSV ?
+                               "enabled" : "disabled");
        }
 
        /* copy the fw_version into debugfs at first boot */