Skip to content

Commit 347d1c4

Browse files
slawblauciakbroonie
authored andcommitted
ASoC: SOF: ipc: replace fw ready bitfield with explicit bit ordering
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>
1 parent f865883 commit 347d1c4

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

‎include/sound/sof/info.h‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
#define SOF_IPC_MAX_ELEMS 16
2020

21+
/*
22+
* Firmware boot info flag bits (64-bit)
23+
*/
24+
#define SOF_IPC_INFO_BUILD BIT(0)
25+
#define SOF_IPC_INFO_LOCKS BIT(1)
26+
#define SOF_IPC_INFO_LOCKSV BIT(2)
27+
#define SOF_IPC_INFO_GDB BIT(3)
28+
2129
/* extended data types that can be appended onto end of sof_ipc_fw_ready */
2230
enum sof_ipc_ext_data {
2331
SOF_IPC_EXT_DMA_BUFFER = 0,
@@ -49,16 +57,8 @@ struct sof_ipc_fw_ready {
4957
uint32_t hostbox_size;
5058
struct sof_ipc_fw_version version;
5159

52-
/* Miscellaneous debug flags showing build/debug features enabled */
53-
union {
54-
uint64_t reserved;
55-
struct {
56-
uint64_t build:1;
57-
uint64_t locks:1;
58-
uint64_t locks_verbose:1;
59-
uint64_t gdb:1;
60-
} bits;
61-
} debug;
60+
/* Miscellaneous flags */
61+
uint64_t flags;
6262

6363
/* reserved for future use */
6464
uint32_t reserved[4];

‎sound/soc/sof/ipc.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,16 +763,19 @@ int snd_sof_ipc_valid(struct snd_sof_dev *sdev)
763763
}
764764
}
765765

766-
if (ready->debug.bits.build) {
766+
if (ready->flags & SOF_IPC_INFO_BUILD) {
767767
dev_info(sdev->dev,
768768
"Firmware debug build %d on %s-%s - options:\n"
769769
" GDB: %s\n"
770770
" lock debug: %s\n"
771771
" lock vdebug: %s\n",
772772
v->build, v->date, v->time,
773-
ready->debug.bits.gdb ? "enabled" : "disabled",
774-
ready->debug.bits.locks ? "enabled" : "disabled",
775-
ready->debug.bits.locks_verbose ? "enabled" : "disabled");
773+
ready->flags & SOF_IPC_INFO_GDB ?
774+
"enabled" : "disabled",
775+
ready->flags & SOF_IPC_INFO_LOCKS ?
776+
"enabled" : "disabled",
777+
ready->flags & SOF_IPC_INFO_LOCKSV ?
778+
"enabled" : "disabled");
776779
}
777780

778781
/* copy the fw_version into debugfs at first boot */

0 commit comments

Comments
 (0)