31 volatile T_UintPtr iBootFlags2; |
31 volatile T_UintPtr iBootFlags2; |
32 volatile T_UintPtr iBootFlags3; |
32 volatile T_UintPtr iBootFlags3; |
33 volatile T_UintPtr iBootFlags4; |
33 volatile T_UintPtr iBootFlags4; |
34 volatile TUint64 iBPTimestamp; |
34 volatile TUint64 iBPTimestamp; |
35 volatile TUint64 iAPTimestamp; |
35 volatile TUint64 iAPTimestamp; |
|
36 |
|
37 TUint32 i_SAPBootPage_Spare[624]; |
|
38 |
|
39 UPerCpuUncached iPerCpu[KMaxCpus]; |
36 }; |
40 }; |
|
41 |
|
42 __ASSERT_COMPILE(sizeof(SAPBootPage)==4096); |
|
43 |
37 |
44 |
38 extern "C" void _ApEntry(); |
45 extern "C" void _ApEntry(); |
39 extern "C" void KickCpu(volatile T_UintPtr* aPtr, T_UintPtr aRegsPhys); |
46 extern "C" void KickCpu(volatile T_UintPtr* aPtr, T_UintPtr aRegsPhys); |
40 extern void DumpFullRegSet(SFullArmRegSet& a); |
47 extern void DumpFullRegSet(SFullArmRegSet& a); |
41 |
48 |
98 |
105 |
99 __KTRACE_OPT(KBOOT,DEBUGPRINT("BootFlag=%08x %08x %08x %08x n=%d", b, n, pB[1], pB[2], pB[3])); |
106 __KTRACE_OPT(KBOOT,DEBUGPRINT("BootFlag=%08x %08x %08x %08x n=%d", b, n, pB[1], pB[2], pB[3])); |
100 __KTRACE_OPT(KBOOT,DEBUGPRINT("SCU: iCtrl=%08x iConfig=%08x iCpuStat=%08x", SCU.iCtrl, SCU.iConfig, SCU.iCpuStatus)); |
107 __KTRACE_OPT(KBOOT,DEBUGPRINT("SCU: iCtrl=%08x iConfig=%08x iCpuStat=%08x", SCU.iCtrl, SCU.iConfig, SCU.iCpuStatus)); |
101 if (n==0) |
108 if (n==0) |
102 return KErrTimedOut; |
109 return KErrTimedOut; |
103 NKern::DisableAllInterrupts(); |
110 |
104 arm_dsb(); |
111 #if defined(__NKERN_TIMESTAMP_USE_LOCAL_TIMER__) |
105 while (bootPage.iBootFlags2==0) |
112 #error Use of local timer for NKern::Timestamp() no longer supported |
106 {} |
113 #endif |
107 arm_dsb(); |
114 |
108 bootPage.iBootFlags2 = 2; |
|
109 arm_dsb(); |
|
110 bootPage.iBPTimestamp = NKern::Timestamp(); |
|
111 arm_dsb(); |
|
112 while (bootPage.iBootFlags2==2) |
|
113 {} |
|
114 arm_dsb(); |
|
115 NKern::EnableAllInterrupts(); |
|
116 return KErrNone; |
115 return KErrNone; |
117 } |
116 } |
118 |
117 |
119 void InitAPTimestamp(SNThreadCreateInfo& aInfo) |
118 void InitTimestamp(TSubScheduler* aSS, SNThreadCreateInfo& aInfo) |
120 { |
119 { |
121 volatile SArmAPBootInfo& a = *(volatile SArmAPBootInfo*)aInfo.iParameterBlock; |
120 NThread* t = (NThread*)aSS->iCurrentThread; |
122 volatile SAPBootPage& bootPage = *(volatile SAPBootPage*)a.iAPBootLin; |
121 t->iActiveState = 1; |
123 NKern::DisableAllInterrupts(); |
122 if (aSS->iCpuNum == 0) |
124 bootPage.iBootFlags2 = 1; |
123 { |
125 arm_dsb(); |
124 aSS->iLastTimestamp.i64 = 0; |
126 while (bootPage.iBootFlags2==1) |
125 t->iLastActivationTime.i64 = 0; |
127 {} |
126 return; |
128 arm_dsb(); |
127 } |
129 bootPage.iAPTimestamp = NKern::Timestamp(); |
128 TUint64 ts = 0; |
130 arm_dsb(); |
129 #if defined(__NKERN_TIMESTAMP_USE_LOCAL_TIMER__) |
131 TUint64 bpt = bootPage.iBPTimestamp; |
130 #error Use of local timer for NKern::Timestamp() no longer supported |
132 TUint64 apt = bootPage.iAPTimestamp; |
131 #endif |
133 TUint64 delta = bpt - apt; |
132 ts = NKern::Timestamp(); |
134 SubScheduler().iLastTimestamp64 += delta; |
133 aSS->iLastTimestamp.i64 = ts; |
135 __KTRACE_OPT(KBOOT,DEBUGPRINT("APT=0x%lx BPT=0x%lx Delta=0x%lx", apt, bpt, delta)); |
134 t->iLastActivationTime.i64 = ts; |
136 arm_dsb(); |
|
137 bootPage.iBootFlags2 = 3; |
|
138 NKern::EnableAllInterrupts(); |
|
139 } |
135 } |
140 |
136 |