14extern volatile int wait[12];
18static volatile int thread_state[6];
24static inline void wakeup_secondary(
void)
31 void *irq_cntrl = (
void*)0x20050000;
33 std(irq_cntrl + 0x2070, 0x7c);
34 std(irq_cntrl + 0x2008, 0);
35 std(irq_cntrl + 0x2000, 4);
37 std(irq_cntrl + 0x4070, 0x7c);
38 std(irq_cntrl + 0x4008, 0);
39 std(irq_cntrl + 0x4000, 0x10);
41 std(irq_cntrl + 0x10, 0x140078);
47 void *irq = (
void*)0x20050000;
50 std(irq +
id * 0x1000 + 8, 0x7c);
76 void *cpuregs = (
void*)0x20061000;
77 void *cpuregs2 = (
void*)0x20060000;
78 void *irq = (
void*)0x20050000;
86 std(cpuregs2 + 0xb58, ld(cpuregs2 + 0xb58) | 0x8000000000000000ULL);
87 std(cpuregs + 0x50, ld(cpuregs + 0x50) & (0xFFFEULL<<33));
88 std(cpuregs + 0x60, ld(cpuregs + 0x60) | (1ULL << 33));
92 std(irq + 0x6020, 0x400);
93 while (ld(irq + 0x6020) & 0x2000);
95 v = ld(cpuregs + 0x188);
97 int base_vid = (v >> 48) & 0x3F;
150 int vlt = 11000 + (0x3D - ((base_vid < 0x15) ? base_vid + 0x3E : base_vid)) * 125;
152 printf(
" * default VID: %02x (%d.%04dV)\n", base_vid, vlt / 10000, vlt % 10000);
158 int new_vid = base_vid + vid_delta - 0x80;
164 int vlt = 11000 + (0x3D - ((new_vid < 0x15) ? new_vid + 0x3E : new_vid)) * 125;
166 printf(
" * using new VID: %02x (%d.%04dV)\n", new_vid, vlt / 10000, vlt % 10000);
174 std(cpuregs + 0x188, v);
176 while (!(ld(irq + 0x6020) & 0x2000));
178 std(cpuregs + 0x188, ld(cpuregs + 0x188) | 0x8000);
180 std(irq + 0x6020, 0x1047c);
184 v = ld(cpuregs + 0x188);
190 std(cpuregs + 0x188, v);
194 std(cpuregs + 0x188, ld(cpuregs + 0x188) | 0x8000);
196 std(irq + 0x50, ld(irq + 0x60));
198 std(irq + 0x6020, 0);
204 void *cpuregs = (
void*)0x20061000;
205 return ld(cpuregs + 0x188) & 0x7;
210 if (
wait[thread * 2])
212 wait[thread * 2 + 1] = (int)stack;
213 wait[thread * 2] = (int)task;
219 if (
wait[thread * 2])
224static unsigned char stack[5 * 0x1000];
231 printf(
" * Starting threads only, CPU was already made faster !\n");
240 printf(
" !!! could not read VID delta, aborting\n");
244 printf(
" * Make it faster by making it sleep...\n");
248 printf(
" * Make it faster by making it consume more power...\n");
254 printf(
" * Make it faster by awaking the other cores...\n");
257 for (i = 1; i < 6; ++i)
258 while (thread_state[i])
260 printf(
" * fine, they all came back.\n");
281 for (i = 1; i < 6; ++i)
284 for (i = 1; i < 6; ++i)
285 while (!thread_state[i])
void atomic_clearset(unsigned int *v, unsigned int andc, unsigned int or_)
void xenon_config_init(void)
int xenon_config_get_vid_delta()
int xenon_run_thread_task(int thread, void *stack, void *task)
void xenon_make_it_faster(int speed)
void xenon_thread_startup(void)
void prepare_sleep(uint64_t *save)
int xenon_is_thread_task_running(int thread)
void xenon_sleep_thread(int thread)
void xenon_set_speed(int new_speed, int vid_delta)
unsigned int secondary_lock
void xenon_set_single_thread_mode()
void secondary_wakeup(void)
void xenon_thread_sleep(void)
volatile int secondary_alive
void xenon_smc_set_fan_algorithm(int algorithm)