mirror of
https://github.com/AsahiLinux/m1n1
synced 2025-02-17 06:08:28 +00:00
chickens: Update Firestorm chickens & complete t600x
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
efca793572
commit
b50a489f41
2 changed files with 88 additions and 49 deletions
132
src/chickens.c
132
src/chickens.c
|
@ -19,21 +19,7 @@
|
|||
#define MIDR_PART GENMASK(15, 4)
|
||||
#define MIDR_REV_HIGH GENMASK(23, 20)
|
||||
|
||||
void init_common(void)
|
||||
{
|
||||
int core = mrs(MPIDR_EL1) & 0xff;
|
||||
|
||||
// Unknown, related to SMP?
|
||||
msr(s3_4_c15_c5_0, core);
|
||||
msr(SYS_IMP_APL_AMX_CTL_EL1, 0x100);
|
||||
|
||||
// Enable IRQs (at least necessary on t600x)
|
||||
msr(s3_4_c15_c10_4, 0);
|
||||
|
||||
sysop("isb");
|
||||
}
|
||||
|
||||
void init_common_icestorm(void)
|
||||
static void init_common_icestorm(void)
|
||||
{
|
||||
// "Sibling Merge in LLC can cause UC load to violate ARM Memory Ordering Rules."
|
||||
reg_set(SYS_IMP_APL_HID5, HID5_DISABLE_FILL_2C_MERGE);
|
||||
|
@ -48,7 +34,7 @@ void init_common_icestorm(void)
|
|||
reg_set(SYS_IMP_APL_EHID20, EHID20_TRAP_SMC);
|
||||
}
|
||||
|
||||
void init_common_firestorm(void)
|
||||
static void init_common_firestorm(void)
|
||||
{
|
||||
reg_set(SYS_IMP_APL_HID0, HID0_SAME_PG_POWER_OPTIMIZATION);
|
||||
|
||||
|
@ -78,10 +64,8 @@ void init_common_firestorm(void)
|
|||
HID16_ENABLE_MP_CYCLONE_7);
|
||||
}
|
||||
|
||||
void init_m1_icestorm(int rev)
|
||||
static void init_m1_icestorm(void)
|
||||
{
|
||||
UNUSED(rev);
|
||||
|
||||
init_common_icestorm();
|
||||
|
||||
reg_set(SYS_IMP_APL_EHID20, EHID20_FORCE_NONSPEC_IF_OLDEST_REDIR_VALID_AND_OLDER |
|
||||
|
@ -89,50 +73,85 @@ void init_m1_icestorm(int rev)
|
|||
|
||||
reg_mask(SYS_IMP_APL_EHID20, EHID20_FORCE_NONSPEC_TARGETED_TIMER_SEL_MASK,
|
||||
EHID20_FORCE_NONSPEC_TARGETED_TIMER_SEL(3));
|
||||
|
||||
init_common();
|
||||
}
|
||||
|
||||
void init_m1_firestorm(int rev)
|
||||
static void init_m1_firestorm(void)
|
||||
{
|
||||
if (rev < 0x10)
|
||||
printf(" Revisions <0x10 not supported!\n");
|
||||
|
||||
init_common_firestorm();
|
||||
|
||||
// "Cross-beat Crypto(AES/PMUL) ICache fusion is not disabled for branch
|
||||
// uncondtional "recoded instruction."
|
||||
reg_set(SYS_IMP_APL_HID0, HID0_FETCH_WIDTH_DISABLE | HID0_CACHE_FUSION_DISABLE);
|
||||
|
||||
if (rev == 0x11)
|
||||
reg_set(SYS_IMP_APL_HID1, HID1_ENABLE_MDSB_STALL_PIPELINE_ECO | HID1_ENABLE_BR_KILL_LIMIT);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID4,
|
||||
HID4_ENABLE_LFSR_STALL_LOAD_PIPE_2_ISSUE | HID4_ENABLE_LFSR_STALL_STQ_REPLAY);
|
||||
|
||||
// "Sibling Merge in LLC can cause UC load to violate ARM Memory Ordering
|
||||
// Rules."
|
||||
reg_set(SYS_IMP_APL_HID5, HID5_DISABLE_FILL_2C_MERGE);
|
||||
|
||||
reg_mask(SYS_IMP_APL_HID6, HID6_UP_CRD_TKN_INIT_C2_MASK, HID6_UP_CRD_TKN_INIT_C2(0));
|
||||
|
||||
reg_set(SYS_IMP_APL_HID7, HID7_FORCE_NONSPEC_IF_STEPPING |
|
||||
HID7_FORCE_NONSPEC_IF_SPEC_FLUSH_POINTER_INVALID_AND_MP_VALID);
|
||||
|
||||
reg_mask(SYS_IMP_APL_HID7, HID7_FORCE_NONSPEC_TARGET_TIMER_SEL_MASK,
|
||||
HID7_FORCE_NONSPEC_TARGET_TIMER_SEL(3));
|
||||
|
||||
reg_set(SYS_IMP_APL_HID9,
|
||||
HID9_TSO_SERIALIZE_VLD_MICROOPS | HID9_FIX_BUG_51667805 | HID9_FIX_BUG_55719865);
|
||||
reg_set(SYS_IMP_APL_HID9, HID9_TSO_SERIALIZE_VLD_MICROOPS | HID9_FIX_BUG_51667805);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID18, HID18_HVC_SPECULATION_DISABLE);
|
||||
|
||||
reg_clr(SYS_IMP_APL_HID21, HID21_ENABLE_LDREX_FILL_REPLY);
|
||||
}
|
||||
|
||||
static void init_t8103_firestorm(int rev)
|
||||
{
|
||||
init_m1_firestorm();
|
||||
|
||||
reg_mask(SYS_IMP_APL_HID6, HID6_UP_CRD_TKN_INIT_C2_MASK, HID6_UP_CRD_TKN_INIT_C2(0));
|
||||
|
||||
if (rev >= 0x10) {
|
||||
reg_set(SYS_IMP_APL_HID4,
|
||||
HID4_ENABLE_LFSR_STALL_LOAD_PIPE_2_ISSUE | HID4_ENABLE_LFSR_STALL_STQ_REPLAY);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID9, HID9_FIX_BUG_55719865);
|
||||
reg_set(SYS_IMP_APL_HID11, HID11_ENABLE_FIX_UC_55719865);
|
||||
}
|
||||
|
||||
if (rev == 0x11)
|
||||
reg_set(SYS_IMP_APL_HID1, HID1_ENABLE_MDSB_STALL_PIPELINE_ECO | HID1_ENABLE_BR_KILL_LIMIT);
|
||||
|
||||
if (rev >= 0x11)
|
||||
reg_set(SYS_IMP_APL_HID18, HID18_SPAREBIT17);
|
||||
}
|
||||
|
||||
reg_clr(SYS_IMP_APL_HID21, HID21_ENABLE_LDREX_FILL_REPLY);
|
||||
static void init_t6000_firestorm(int rev)
|
||||
{
|
||||
init_m1_firestorm();
|
||||
|
||||
init_common();
|
||||
reg_set(SYS_IMP_APL_HID9, HID9_FIX_BUG_55719865);
|
||||
reg_set(SYS_IMP_APL_HID11, HID11_ENABLE_FIX_UC_55719865);
|
||||
|
||||
if (rev >= 0x10) {
|
||||
reg_set(SYS_IMP_APL_HID1, HID1_ENABLE_MDSB_STALL_PIPELINE_ECO | HID1_ENABLE_BR_KILL_LIMIT);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID4,
|
||||
HID4_ENABLE_LFSR_STALL_LOAD_PIPE_2_ISSUE | HID4_ENABLE_LFSR_STALL_STQ_REPLAY);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID18, HID18_SPAREBIT17);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_t6001_firestorm(int rev)
|
||||
{
|
||||
init_m1_firestorm();
|
||||
|
||||
reg_set(SYS_IMP_APL_HID1, HID1_ENABLE_MDSB_STALL_PIPELINE_ECO);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID4,
|
||||
HID4_ENABLE_LFSR_STALL_LOAD_PIPE_2_ISSUE | HID4_ENABLE_LFSR_STALL_STQ_REPLAY);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID9, HID9_FIX_BUG_55719865);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID11, HID11_ENABLE_FIX_UC_55719865);
|
||||
|
||||
if (rev >= 0x10) {
|
||||
reg_set(SYS_IMP_APL_HID1, HID1_ENABLE_BR_KILL_LIMIT);
|
||||
|
||||
reg_set(SYS_IMP_APL_HID18, HID18_SPAREBIT17);
|
||||
}
|
||||
}
|
||||
|
||||
const char *init_cpu(void)
|
||||
|
@ -155,25 +174,33 @@ const char *init_cpu(void)
|
|||
|
||||
switch (part) {
|
||||
case MIDR_PART_T8103_FIRESTORM:
|
||||
case MIDR_PART_T6000_FIRESTORM:
|
||||
case MIDR_PART_T6001_FIRESTORM:
|
||||
cpu = "M1 Firestorm";
|
||||
init_m1_firestorm(rev);
|
||||
init_t8103_firestorm(rev);
|
||||
break;
|
||||
|
||||
case MIDR_PART_T6000_FIRESTORM:
|
||||
cpu = "M1 Pro Firestorm";
|
||||
init_t6000_firestorm(rev);
|
||||
break;
|
||||
|
||||
case MIDR_PART_T6001_FIRESTORM:
|
||||
cpu = "M1 Max Firestorm";
|
||||
init_t6001_firestorm(rev);
|
||||
break;
|
||||
|
||||
case MIDR_PART_T8103_ICESTORM:
|
||||
cpu = "M1 Icestorm";
|
||||
init_m1_icestorm(rev);
|
||||
init_m1_icestorm();
|
||||
break;
|
||||
|
||||
case MIDR_PART_T6000_ICESTORM:
|
||||
cpu = "M1 Pro Icestorm";
|
||||
init_m1_icestorm(rev);
|
||||
init_m1_icestorm();
|
||||
break;
|
||||
|
||||
case MIDR_PART_T6001_ICESTORM:
|
||||
cpu = "M1 Max Icestorm";
|
||||
init_m1_icestorm(rev);
|
||||
init_m1_icestorm();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -181,6 +208,17 @@ const char *init_cpu(void)
|
|||
break;
|
||||
}
|
||||
|
||||
int core = mrs(MPIDR_EL1) & 0xff;
|
||||
|
||||
// Unknown, related to SMP?
|
||||
msr(s3_4_c15_c5_0, core);
|
||||
msr(SYS_IMP_APL_AMX_CTL_EL1, 0x100);
|
||||
|
||||
// Enable IRQs (at least necessary on t600x)
|
||||
msr(s3_4_c15_c10_4, 0);
|
||||
|
||||
sysop("isb");
|
||||
|
||||
/* Unmask external IRQs, set WFI mode to up (2) */
|
||||
reg_mask(SYS_IMP_APL_CYC_OVRD,
|
||||
CYC_OVRD_FIQ_MODE_MASK | CYC_OVRD_IRQ_MODE_MASK | CYC_OVRD_WFI_MODE_MASK,
|
||||
|
|
|
@ -68,8 +68,9 @@
|
|||
#define HID10_FORCE_WAIT_STATE_DRAIN_UC BIT(32)
|
||||
#define HID10_DISABLE_ZVA_TEMPORAL_TSO BIT(49)
|
||||
|
||||
#define SYS_IMP_APL_HID11 sys_reg(3, 0, 15, 11, 0)
|
||||
#define HID11_DISABLE_LD_NT_WIDGET BIT(59)
|
||||
#define SYS_IMP_APL_HID11 sys_reg(3, 0, 15, 11, 0)
|
||||
#define HID11_ENABLE_FIX_UC_55719865 BIT(15)
|
||||
#define HID11_DISABLE_LD_NT_WIDGET BIT(59)
|
||||
|
||||
#define SYS_IMP_APL_HID13 sys_reg(3, 0, 15, 14, 0)
|
||||
#define HID13_PRE_CYCLES(x) (((unsigned long)x) << 14)
|
||||
|
|
Loading…
Add table
Reference in a new issue