soc/mediatek/mt8186: fix incorrect devapc settings

We need to protect debugsys for firmware image without serial console.
Original settings for protecting debugsys is wrong which will cause some
hardware modules to fail to set their registers correctly.

We move the setting from MM_AO_APC to INFRA_AO_APC because the setting
of debugsys is defined in INFRA_AO_APC and set the debugsys index to
correct value of 94.

BUG=b:213125558
TEST=all modules work normally using image without serial console.

Signed-off-by: Runyang Chen <runyang.chen@mediatek.corp-partner.google.com>
Change-Id: Ibce626386ac1f8de42f8717c4ad9ba403640b3ec
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60833
Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Runyang Chen 2022-01-06 14:27:22 +08:00 committed by Felix Held
parent 362a4819b3
commit d4c161ec55
2 changed files with 9 additions and 9 deletions

View File

@ -1229,6 +1229,14 @@ static void set_infra_ao_apc(uintptr_t base)
for (j = 0; j < ARRAY_SIZE(infra_ao_sys0_devices[i].d_permission); j++) for (j = 0; j < ARRAY_SIZE(infra_ao_sys0_devices[i].d_permission); j++)
set_module_apc(base + SYS0_D0_APC_0, i, domain_map[j], set_module_apc(base + SYS0_D0_APC_0, i, domain_map[j],
infra_ao_sys0_devices[i].d_permission[j]); infra_ao_sys0_devices[i].d_permission[j]);
/*
* Extra apc setting.
* Block debugsys to avoid privilege escalation.
*/
if (!CONFIG(CONSOLE_SERIAL))
set_module_apc(base + SYS0_D0_APC_0, DEVAPC_DEBUGSYS_INDEX,
DOMAIN_0, SEC_RW_NS_R);
} }
static void set_mm_ao_apc(uintptr_t base) static void set_mm_ao_apc(uintptr_t base)
@ -1239,14 +1247,6 @@ static void set_mm_ao_apc(uintptr_t base)
for (j = 0; j < ARRAY_SIZE(mm_ao_sys0_devices[i].d_permission); j++) for (j = 0; j < ARRAY_SIZE(mm_ao_sys0_devices[i].d_permission); j++)
set_module_apc(base + SYS0_D0_APC_0, i, domain_map[j], set_module_apc(base + SYS0_D0_APC_0, i, domain_map[j],
mm_ao_sys0_devices[i].d_permission[j]); mm_ao_sys0_devices[i].d_permission[j]);
/*
* Extra apc setting.
* Block debugsys to avoid privilege escalation.
*/
if (!CONFIG(CONSOLE_SERIAL))
set_module_apc(base + SYS0_D0_APC_0, DEVAPC_DEBUGSYS_INDEX,
DOMAIN_0, SEC_RW_NS_R);
} }
static void dump_infra_ao_apc(uintptr_t base) static void dump_infra_ao_apc(uintptr_t base)

View File

@ -73,7 +73,7 @@ enum devapc_sys_dom_num {
}; };
enum devapc_cfg_index { enum devapc_cfg_index {
DEVAPC_DEBUGSYS_INDEX = 17, DEVAPC_DEBUGSYS_INDEX = 94,
}; };
/* PERM_ATTR MACRO */ /* PERM_ATTR MACRO */