diff options
Diffstat (limited to 'firmware/system.c')
-rw-r--r-- | firmware/system.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/firmware/system.c b/firmware/system.c index befc785823..52be7a1a71 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -33,10 +33,10 @@ long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ; | |||
33 | static int boost_counter SHAREDBSS_ATTR = 0; | 33 | static int boost_counter SHAREDBSS_ATTR = 0; |
34 | static bool cpu_idle SHAREDBSS_ATTR = false; | 34 | static bool cpu_idle SHAREDBSS_ATTR = false; |
35 | #if NUM_CORES > 1 | 35 | #if NUM_CORES > 1 |
36 | struct spinlock boostctrl_spin SHAREDBSS_ATTR; | 36 | static struct corelock boostctrl_cl SHAREDBSS_ATTR; |
37 | void cpu_boost_init(void) | 37 | void cpu_boost_init(void) |
38 | { | 38 | { |
39 | spinlock_init(&boostctrl_spin); | 39 | corelock_init(&boostctrl_cl); |
40 | } | 40 | } |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -57,9 +57,7 @@ int cpu_boost_log_getcount(void) | |||
57 | char * cpu_boost_log_getlog_first(void) | 57 | char * cpu_boost_log_getlog_first(void) |
58 | { | 58 | { |
59 | char *first; | 59 | char *first; |
60 | #if NUM_CORES > 1 | 60 | corelock_lock(&boostctrl_cl); |
61 | spinlock_lock(&boostctrl_spin); | ||
62 | #endif | ||
63 | 61 | ||
64 | first = NULL; | 62 | first = NULL; |
65 | 63 | ||
@@ -69,10 +67,7 @@ char * cpu_boost_log_getlog_first(void) | |||
69 | first = cpu_boost_calls[cpu_boost_first]; | 67 | first = cpu_boost_calls[cpu_boost_first]; |
70 | } | 68 | } |
71 | 69 | ||
72 | #if NUM_CORES > 1 | 70 | corelock_unlock(&boostctrl_cl); |
73 | spinlock_unlock(&boostctrl_spin); | ||
74 | #endif | ||
75 | |||
76 | return first; | 71 | return first; |
77 | } | 72 | } |
78 | 73 | ||
@@ -81,9 +76,7 @@ char * cpu_boost_log_getlog_next(void) | |||
81 | int message; | 76 | int message; |
82 | char *next; | 77 | char *next; |
83 | 78 | ||
84 | #if NUM_CORES > 1 | 79 | corelock_lock(&boostctrl_cl); |
85 | spinlock_lock(&boostctrl_spin); | ||
86 | #endif | ||
87 | 80 | ||
88 | message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG; | 81 | message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG; |
89 | next = NULL; | 82 | next = NULL; |
@@ -94,18 +87,13 @@ char * cpu_boost_log_getlog_next(void) | |||
94 | next = cpu_boost_calls[message]; | 87 | next = cpu_boost_calls[message]; |
95 | } | 88 | } |
96 | 89 | ||
97 | #if NUM_CORES > 1 | 90 | corelock_unlock(&boostctrl_cl); |
98 | spinlock_unlock(&boostctrl_spin); | ||
99 | #endif | ||
100 | |||
101 | return next; | 91 | return next; |
102 | } | 92 | } |
103 | 93 | ||
104 | void cpu_boost_(bool on_off, char* location, int line) | 94 | void cpu_boost_(bool on_off, char* location, int line) |
105 | { | 95 | { |
106 | #if NUM_CORES > 1 | 96 | corelock_lock(&boostctrl_cl); |
107 | spinlock_lock(&boostctrl_spin); | ||
108 | #endif | ||
109 | 97 | ||
110 | if (cpu_boost_calls_count == MAX_BOOST_LOG) | 98 | if (cpu_boost_calls_count == MAX_BOOST_LOG) |
111 | { | 99 | { |
@@ -124,10 +112,7 @@ void cpu_boost_(bool on_off, char* location, int line) | |||
124 | #else | 112 | #else |
125 | void cpu_boost(bool on_off) | 113 | void cpu_boost(bool on_off) |
126 | { | 114 | { |
127 | #if NUM_CORES > 1 | 115 | corelock_lock(&boostctrl_cl); |
128 | spinlock_lock(&boostctrl_spin); | ||
129 | #endif | ||
130 | |||
131 | #endif /* CPU_BOOST_LOGGING */ | 116 | #endif /* CPU_BOOST_LOGGING */ |
132 | if(on_off) | 117 | if(on_off) |
133 | { | 118 | { |
@@ -153,16 +138,12 @@ void cpu_boost(bool on_off) | |||
153 | } | 138 | } |
154 | } | 139 | } |
155 | 140 | ||
156 | #if NUM_CORES > 1 | 141 | corelock_unlock(&boostctrl_cl); |
157 | spinlock_unlock(&boostctrl_spin); | ||
158 | #endif | ||
159 | } | 142 | } |
160 | 143 | ||
161 | void cpu_idle_mode(bool on_off) | 144 | void cpu_idle_mode(bool on_off) |
162 | { | 145 | { |
163 | #if NUM_CORES > 1 | 146 | corelock_lock(&boostctrl_cl); |
164 | spinlock_lock(&boostctrl_spin); | ||
165 | #endif | ||
166 | 147 | ||
167 | cpu_idle = on_off; | 148 | cpu_idle = on_off; |
168 | 149 | ||
@@ -176,9 +157,7 @@ void cpu_idle_mode(bool on_off) | |||
176 | set_cpu_frequency(CPUFREQ_NORMAL); | 157 | set_cpu_frequency(CPUFREQ_NORMAL); |
177 | } | 158 | } |
178 | 159 | ||
179 | #if NUM_CORES > 1 | 160 | corelock_unlock(&boostctrl_cl); |
180 | spinlock_unlock(&boostctrl_spin); | ||
181 | #endif | ||
182 | } | 161 | } |
183 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ | 162 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |
184 | 163 | ||