13 #include <linux/kexec.h>
17 #include <linux/errno.h>
18 #include <linux/kernel.h>
22 #include <asm/current.h>
23 #include <asm/machdep.h>
24 #include <asm/cacheflush.h>
27 #include <asm/sections.h>
30 #include <asm/hw_breakpoint.h>
35 unsigned long begin,
end;
38 const unsigned long *basep;
39 const unsigned int *sizep;
41 if (!
ppc_md.hpte_clear_all)
49 for (i = 0; i < image->nr_segments; i++)
50 if (image->segment[i].mem <
__pa(
_end))
67 for (i = 0; i < image->nr_segments; i++) {
68 begin = image->segment[
i].mem;
69 end = begin + image->segment[
i].memsz;
71 if ((begin < high) && (end > low))
77 for_each_node_by_type(node,
"pci") {
84 high = low + (*sizep);
86 for (i = 0; i < image->nr_segments; i++) {
87 begin = image->segment[
i].mem;
88 end = begin + image->segment[
i].memsz;
90 if ((begin < high) && (end > low))
98 #define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
116 for (entry = ind; !(entry & IND_DONE); entry = *ptr++) {
120 case IND_DESTINATION:
123 case IND_INDIRECTION:
139 memcpy(ranges, image->segment,
sizeof(ranges));
155 (
unsigned long)
__va(ranges[i].mem + ranges[i].
memsz));
160 static int kexec_all_irq_disabled = 0;
162 static void kexec_smp_down(
void *
arg)
166 get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
167 while(kexec_all_irq_disabled == 0)
170 hw_breakpoint_disable();
175 if (
ppc_md.kexec_cpu_down)
176 ppc_md.kexec_cpu_down(0, 1);
182 static void kexec_prepare_cpus_wait(
int wait_state)
184 int my_cpu,
i, notified=-1;
186 hw_breakpoint_disable();
206 while (
paca[i].kexec_state < wait_state) {
210 "(physical %d) to enter %i state\n",
211 i,
paca[i].hw_cpu_id, wait_state);
229 static void wake_offline_cpus(
void)
242 static void kexec_prepare_cpus(
void)
248 get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
250 kexec_prepare_cpus_wait(KEXEC_STATE_IRQS_OFF);
252 kexec_all_irq_disabled = 1;
255 if (
ppc_md.kexec_cpu_down)
256 ppc_md.kexec_cpu_down(0, 0);
262 kexec_prepare_cpus_wait(KEXEC_STATE_REAL_MODE);
269 static void kexec_prepare_cpus(
void)
281 if (
ppc_md.kexec_cpu_down)
282 ppc_md.kexec_cpu_down(0, 0);
328 kexec_prepare_cpus();
330 pr_debug(
"kexec: Starting switchover sequence.\n");
336 kexec_stack.thread_info.flags = 0;
362 static unsigned long htab_base;
364 static struct property htab_base_prop = {
365 .name =
"linux,htab-base",
366 .length =
sizeof(
unsigned long),
370 static struct property htab_size_prop = {
371 .name =
"linux,htab-size",
372 .length =
sizeof(
unsigned long),
376 static int __init export_htab_values(
void)