Skip to content

Commit db50e84

Browse files
intel: base_fw: uaol: move UAOL code out of base_fw
This moves UAOL-related code to a dedicated uaol.c file, which will be extended with additional UAOL functionality in the future. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent f2c2d93 commit db50e84

4 files changed

Lines changed: 106 additions & 75 deletions

File tree

src/audio/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
126126
if(CONFIG_COMP_TONE)
127127
add_subdirectory(tone)
128128
endif()
129+
if(CONFIG_DAI_INTEL_UAOL)
130+
add_local_sources(sof uaol.c)
131+
endif()
129132
if(CONFIG_ZEPHYR_NATIVE_DRIVERS)
130133
list(APPEND base_files host-zephyr.c)
131134
sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-zephyr.c)

src/audio/base_fw_intel.c

Lines changed: 4 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
#include <sof/lib/memory.h>
2525
#include <sof/lib_manager.h>
2626

27-
#if CONFIG_UAOL_INTEL_ADSP
28-
#include <zephyr/drivers/uaol.h>
29-
#endif
30-
3127
#include <ipc4/base_fw.h>
3228
#include <ipc4/alh.h>
3329
#include <rimage/sof/user/manifest.h>
@@ -37,6 +33,10 @@
3733
#include <sof/audio/mic_privacy_manager.h>
3834
#endif
3935

36+
#if CONFIG_UAOL_INTEL_ADSP
37+
#include <sof/audio/uaol.h>
38+
#endif
39+
4040
struct ipc4_modules_info {
4141
uint32_t modules_count;
4242
struct sof_man_module modules[0];
@@ -46,22 +46,6 @@ struct ipc4_modules_info {
4646
STATIC_ASSERT(sizeof(struct ipc4_modules_info) < SOF_IPC_MSG_MAX_SIZE,
4747
invalid_modules_info_struct_size);
4848

49-
#if CONFIG_UAOL_INTEL_ADSP
50-
struct ipc4_uaol_link_capabilities {
51-
uint32_t input_streams_supported : 4;
52-
uint32_t output_streams_supported : 4;
53-
uint32_t bidirectional_streams_supported : 5;
54-
uint32_t rsvd : 19;
55-
uint32_t max_tx_fifo_size;
56-
uint32_t max_rx_fifo_size;
57-
} __packed __aligned(4);
58-
59-
struct ipc4_uaol_capabilities {
60-
uint32_t link_count;
61-
struct ipc4_uaol_link_capabilities link_caps[];
62-
} __packed __aligned(4);
63-
#endif /* CONFIG_UAOL_INTEL_ADSP */
64-
6549
/*
6650
* TODO: default to value of ACE1.x platforms. This is defined
6751
* in multiple places in Zephyr, mm_drv_intel_adsp.h and
@@ -103,61 +87,6 @@ __cold int basefw_vendor_fw_config(uint32_t *data_offset, char *data)
10387
return 0;
10488
}
10589

106-
#if CONFIG_UAOL_INTEL_ADSP
107-
#define DEV_AND_COMMA(node) DEVICE_DT_GET(node),
108-
static const struct device *uaol_devs[] = {
109-
DT_FOREACH_STATUS_OKAY(intel_adsp_uaol, DEV_AND_COMMA)
110-
};
111-
112-
#if !CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY
113-
__cold static void tlv_value_set_uaol_caps(struct sof_tlv *tuple, uint32_t type)
114-
{
115-
const size_t dev_count = ARRAY_SIZE(uaol_devs);
116-
struct uaol_capabilities dev_cap;
117-
struct ipc4_uaol_capabilities *caps = (struct ipc4_uaol_capabilities *)tuple->value;
118-
size_t caps_size = offsetof(struct ipc4_uaol_capabilities, link_caps[dev_count]);
119-
size_t i;
120-
int ret;
121-
122-
assert_can_be_cold();
123-
124-
memset(caps, 0, caps_size);
125-
126-
caps->link_count = dev_count;
127-
for (i = 0; i < dev_count; i++) {
128-
ret = uaol_get_capabilities(uaol_devs[i], &dev_cap);
129-
if (ret)
130-
continue;
131-
132-
caps->link_caps[i].input_streams_supported = dev_cap.input_streams;
133-
caps->link_caps[i].output_streams_supported = dev_cap.output_streams;
134-
caps->link_caps[i].bidirectional_streams_supported = dev_cap.bidirectional_streams;
135-
caps->link_caps[i].max_tx_fifo_size = dev_cap.max_tx_fifo_size;
136-
caps->link_caps[i].max_rx_fifo_size = dev_cap.max_rx_fifo_size;
137-
}
138-
139-
tlv_value_set(tuple, type, caps_size, caps);
140-
}
141-
#endif /* CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY */
142-
143-
__cold static int uaol_stream_id_to_hda_link_stream_id(int uaol_stream_id)
144-
{
145-
size_t dev_count = ARRAY_SIZE(uaol_devs);
146-
size_t i;
147-
148-
assert_can_be_cold();
149-
150-
for (i = 0; i < dev_count; i++) {
151-
int hda_link_stream_id = uaol_get_mapped_hda_link_stream_id(uaol_devs[i],
152-
uaol_stream_id);
153-
if (hda_link_stream_id >= 0)
154-
return hda_link_stream_id;
155-
}
156-
157-
return -1;
158-
}
159-
#endif /* CONFIG_UAOL_INTEL_ADSP */
160-
16190
__cold int basefw_vendor_hw_config(uint32_t *data_offset, char *data)
16291
{
16392
struct sof_tlv *tuple = (struct sof_tlv *)data;

src/audio/uaol.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause
2+
*
3+
* Copyright 2026 Intel Corporation. All rights reserved.
4+
*/
5+
6+
#include <zephyr/drivers/uaol.h>
7+
#include <rtos/string.h>
8+
#include <sof/tlv.h>
9+
#include <sof/audio/component_ext.h>
10+
#include <sof/audio/uaol.h>
11+
12+
LOG_MODULE_REGISTER(uaol, CONFIG_SOF_LOG_LEVEL);
13+
14+
struct ipc4_uaol_link_capabilities {
15+
uint32_t input_streams_supported : 4;
16+
uint32_t output_streams_supported : 4;
17+
uint32_t bidirectional_streams_supported : 5;
18+
uint32_t rsvd : 19;
19+
uint32_t max_tx_fifo_size;
20+
uint32_t max_rx_fifo_size;
21+
} __packed __aligned(4);
22+
23+
struct ipc4_uaol_capabilities {
24+
uint32_t link_count;
25+
struct ipc4_uaol_link_capabilities link_caps[];
26+
} __packed __aligned(4);
27+
28+
#define DEV_AND_COMMA(node) DEVICE_DT_GET(node),
29+
static const struct device *uaol_devs[] = {
30+
DT_FOREACH_STATUS_OKAY(intel_adsp_uaol, DEV_AND_COMMA)
31+
};
32+
33+
#if !CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY
34+
__cold void tlv_value_set_uaol_caps(struct sof_tlv *tuple, uint32_t type)
35+
{
36+
const size_t dev_count = ARRAY_SIZE(uaol_devs);
37+
struct uaol_capabilities dev_cap;
38+
struct ipc4_uaol_capabilities *caps = (struct ipc4_uaol_capabilities *)tuple->value;
39+
size_t caps_size = offsetof(struct ipc4_uaol_capabilities, link_caps[dev_count]);
40+
size_t i;
41+
int ret;
42+
43+
assert_can_be_cold();
44+
45+
memset(caps, 0, caps_size);
46+
47+
caps->link_count = dev_count;
48+
for (i = 0; i < dev_count; i++) {
49+
ret = uaol_get_capabilities(uaol_devs[i], &dev_cap);
50+
if (ret)
51+
continue;
52+
53+
caps->link_caps[i].input_streams_supported = dev_cap.input_streams;
54+
caps->link_caps[i].output_streams_supported = dev_cap.output_streams;
55+
caps->link_caps[i].bidirectional_streams_supported = dev_cap.bidirectional_streams;
56+
caps->link_caps[i].max_tx_fifo_size = dev_cap.max_tx_fifo_size;
57+
caps->link_caps[i].max_rx_fifo_size = dev_cap.max_rx_fifo_size;
58+
}
59+
60+
tlv_value_set(tuple, type, caps_size, caps);
61+
}
62+
#endif /* !CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY */
63+
64+
__cold int uaol_stream_id_to_hda_link_stream_id(int uaol_stream_id)
65+
{
66+
size_t dev_count = ARRAY_SIZE(uaol_devs);
67+
size_t i;
68+
69+
assert_can_be_cold();
70+
71+
for (i = 0; i < dev_count; i++) {
72+
int hda_link_stream_id = uaol_get_mapped_hda_link_stream_id(uaol_devs[i],
73+
uaol_stream_id);
74+
if (hda_link_stream_id >= 0)
75+
return hda_link_stream_id;
76+
}
77+
78+
return -1;
79+
}

src/include/sof/audio/uaol.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause
2+
*
3+
* Copyright 2026 Intel Corporation. All rights reserved.
4+
*/
5+
6+
#ifndef __SOF_AUDIO_UAOL_H__
7+
#define __SOF_AUDIO_UAOL_H__
8+
9+
#include <stdint.h>
10+
#include <sof/lib/memory.h>
11+
12+
struct sof_tlv;
13+
14+
#if !CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY
15+
__cold void tlv_value_set_uaol_caps(struct sof_tlv *tuple, uint32_t type);
16+
#endif /* !CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY */
17+
18+
__cold int uaol_stream_id_to_hda_link_stream_id(int uaol_stream_id);
19+
20+
#endif /* __SOF_AUDIO_UAOL_H__ */

0 commit comments

Comments
 (0)