Skip to content

Commit 72de4c0

Browse files
committed
audio: base_fw: refactor memory power management register access
This commit refactors the memory power management register access to use the HPSRAM_REGS and LPSRAM_REGS macros instead of direct io_reg_read calls. Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
1 parent fc49de7 commit 72de4c0

File tree

6 files changed

+12
-38
lines changed

6 files changed

+12
-38
lines changed

src/audio/base_fw.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,11 @@ static int basefw_mem_state_info(uint32_t *data_offset, char *data)
194194
tuple_data[index++] = info.ebb_state_dword_count;
195195
for (i = 0; i < info.ebb_state_dword_count; i++) {
196196
#ifdef INTEL_ADSP
197-
tuple_data[index + i] = io_reg_read(SHIM_HSPGCTL(i));
197+
tuple_data[index++] = HPSRAM_REGS(i)->HSxPGCTL;
198198
#else
199-
tuple_data[index + i] = 0;
199+
tuple_data[index++] = 0;
200200
#endif
201201
}
202-
index += info.ebb_state_dword_count;
203202

204203
tuple_data[index++] = info.page_alloc_struct.page_alloc_count;
205204
/* TLB is not supported now, so all pages are marked as occupied
@@ -222,11 +221,14 @@ static int basefw_mem_state_info(uint32_t *data_offset, char *data)
222221
index = 0;
223222
tuple_data[index++] = info.free_phys_mem_pages;
224223
tuple_data[index++] = info.ebb_state_dword_count;
224+
for (i = 0; i < info.ebb_state_dword_count; i++) {
225225
#ifdef INTEL_ADSP
226-
tuple_data[index++] = io_reg_read(LSPGCTL);
226+
tuple_data[index++] = LPSRAM_REGS(i)->USxPGCTL;
227227
#else
228-
tuple_data[index++] = 0;
228+
tuple_data[index++] = 0;
229229
#endif
230+
}
231+
230232
tuple_data[index++] = info.page_alloc_struct.page_alloc_count;
231233
ptr = (uint16_t *)(tuple_data + index);
232234
for (i = 0; i < info.page_alloc_struct.page_alloc_count; i++)

src/platform/intel/cavs/include/cavs/lib/pm_memory.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <sof/lib/shim.h>
2323
#include <rtos/wait.h>
2424
#include <sof/math/numbers.h>
25+
#include <adsp_memory.h>
2526

2627
#include <stdbool.h>
2728
#include <stdint.h>
@@ -72,14 +73,14 @@ static inline void cavs_pm_memory_hp_sram_mask_set(uint32_t mask, int segment,
7273
uint32_t delay = 0;
7374
uint32_t i;
7475

75-
io_reg_update_bits(SHIM_HSPGCTL(segment), mask, enabled ? 0 : mask);
76-
io_reg_update_bits(SHIM_HSRMCTL(segment), mask, enabled ? 0 : mask);
76+
io_reg_update_bits(&HPSRAM_REGS(segment)->HSxPGCTL, mask, enabled ? 0 : mask);
77+
io_reg_update_bits(&HPSRAM_REGS(segment)->HSxRMCTL, mask, enabled ? 0 : mask);
7778

7879
/* Double check of PG status needed to confirm EBB readiness */
7980
for (i = 0; i < 2; i++) {
8081
idelay(MEMORY_POWER_CHANGE_DELAY);
8182

82-
while ((io_reg_read(SHIM_HSPGISTS(segment)) & mask) != expected) {
83+
while ((io_reg_read(&HPSRAM_REGS(segment)->HSxPGISTS) & mask) != expected) {
8384
idelay(MEMORY_POWER_CHANGE_DELAY);
8485
delay += MEMORY_POWER_CHANGE_DELAY;
8586
if (delay >= MEMORY_POWER_CHANGE_TIMEOUT)

src/platform/lunarlake/include/platform/lib/shim.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
/** \brief LP RING Oscillator Clock Status */
4545
#define SHIM_CLKSTS_LROSCCS BIT(29)
4646

47-
#define L2HSBPM(x) (0x17A800 + 0x0008 * (x))
48-
#define SHIM_HSPGCTL(x) (L2HSBPM(x) + 0x0000)
49-
50-
#define LSPGCTL 0x71D80
51-
5247
#endif /* __PLATFORM_LIB_SHIM_H__ */
5348

5449
#else

src/platform/meteorlake/include/platform/lib/shim.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
/** \brief LP RING Oscillator Clock Status */
4545
#define SHIM_CLKSTS_LROSCCS BIT(29)
4646

47-
#define L2HSBPM(x) (0x17A800 + 0x0008 * (x))
48-
#define SHIM_HSPGCTL(x) (L2HSBPM(x) + 0x0000)
49-
50-
#define LSPGCTL 0x71D80
51-
5247
#endif /* __PLATFORM_LIB_SHIM_H__ */
5348

5449
#else

src/platform/tigerlake/include/platform/lib/shim.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -224,25 +224,6 @@
224224
#define I2SLCTL_SPA(x) BIT(0 + x)
225225
#define I2SLCTL_CPA(x) BIT(8 + x)
226226

227-
#define L2LMCAP 0x71D00
228-
#define L2MPAT 0x71D04
229-
230-
#define HSPGCTL0 0x71D10
231-
#define HSRMCTL0 0x71D14
232-
#define HSPGISTS0 0x71D18
233-
234-
#define SHIM_HSPGCTL(x) (HSPGCTL0 + 0x10 * (x))
235-
#define SHIM_HSRMCTL(x) (HSRMCTL0 + 0x10 * (x))
236-
#define SHIM_HSPGISTS(x) (HSPGISTS0 + 0x10 * (x))
237-
238-
#define HSPGCTL1 0x71D20
239-
#define HSRMCTL1 0x71D24
240-
#define HSPGISTS1 0x71D28
241-
242-
#define LSPGCTL 0x71D50
243-
#define LSRMCTL 0x71D54
244-
#define LSPGISTS 0x71D58
245-
246227
#define SHIM_L2_MECS (SHIM_BASE + 0xd0)
247228

248229
/** \brief LDO Control */

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ manifest:
4343

4444
- name: zephyr
4545
repo-path: zephyr
46-
revision: 2ccf775396c225f4398db1014886397a91f6d42f
46+
revision: pull/70221/head
4747
remote: zephyrproject
4848

4949
# Import some projects listed in zephyr/west.yml@revision

0 commit comments

Comments
 (0)