1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
4 * This program and the accompanying materials
5 * are made available under the terms of the BSD License
6 * which accompanies this distribution, and is available at
7 * http://www.opensource.org/licenses/bsd-license.php
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
22 extern void call_client_interface(of_arg_t *);
23 extern void m_sync(void);
25 int callback(int argc, char *argv[]);
27 #define boot_rom_bin_start _binary_______boot_rom_bin_start
28 #define boot_rom_bin_end _binary_______boot_rom_bin_end
30 extern char boot_rom_bin_start;
31 extern char boot_rom_bin_end;
34 # define UNUSED __attribute__((unused))
48 static const char *wheel = "|/-\\";
50 volatile int dly = 0xf0000;
52 asm volatile (" nop ");
53 printf("\b%c", wheel[i++]);
64 call_client_interface(&arg);
68 startCpu(int num, int addr, int reg)
75 call_client_interface(&arg);
79 volatile unsigned long slaveQuitt;
83 main(int argc, char *argv[])
87 unsigned long slaveMask;
88 extern int slaveLoop[];
89 extern int slaveLoopNoTakeover[];
95 asm volatile ("mfmsr %0":"=r" (msr));
96 if (msr & 0x1000000000000000)
101 cpus = of_finddevice("/cpus");
102 cpu = of_child(cpus);
107 of_getprop(cpu, "device_type", devType, sizeof(devType));
108 if (strcmp(devType, "cpu") == 0) {
109 of_getprop(cpu, "reg", ®, sizeof(reg));
111 printf("\r\n takeover on cpu%d (%x, %lx) ", index,
115 startCpu(cpu, (int)(unsigned long)slaveLoop, index);
117 startCpu(cpu, (int)(unsigned long)slaveLoopNoTakeover,
119 slaveMask |= 0x1 << index;
121 while (delay-- && slaveQuitt)
130 printf("\r\n takeover on master cpu ");
139 memcpy((void*)TAKEOVERBASEADDRESS, &boot_rom_bin_start, &boot_rom_bin_end - &boot_rom_bin_start);
140 flush_cache((void *)TAKEOVERBASEADDRESS, &boot_rom_bin_end - &boot_rom_bin_start);
145 unsigned long shifter = 0x1 << index;
146 if (shifter & slaveMask) {
150 slaveMask &= ~shifter;
155 asm volatile(" mtctr %0 ; bctr " : : "r" (TAKEOVERBASEADDRESS+0x180) );
159 callback(int argc, char *argv[])
161 /* Dummy, only for takeover */