diff options
Diffstat (limited to 'arch/powerpc/kernel/head_64.S')
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 84856bee33a5..69489bd3210c 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -97,6 +97,12 @@ __secondary_hold_spinloop: | |||
97 | __secondary_hold_acknowledge: | 97 | __secondary_hold_acknowledge: |
98 | .llong 0x0 | 98 | .llong 0x0 |
99 | 99 | ||
100 | /* This flag is set by purgatory if we should be a kdump kernel. */ | ||
101 | /* Do not move this variable as purgatory knows about it. */ | ||
102 | .globl __kdump_flag | ||
103 | __kdump_flag: | ||
104 | .llong 0x0 | ||
105 | |||
100 | #ifdef CONFIG_PPC_ISERIES | 106 | #ifdef CONFIG_PPC_ISERIES |
101 | /* | 107 | /* |
102 | * At offset 0x20, there is a pointer to iSeries LPAR data. | 108 | * At offset 0x20, there is a pointer to iSeries LPAR data. |
@@ -1384,7 +1390,13 @@ _STATIC(__after_prom_start) | |||
1384 | /* process relocations for the final address of the kernel */ | 1390 | /* process relocations for the final address of the kernel */ |
1385 | lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */ | 1391 | lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */ |
1386 | sldi r25,r25,32 | 1392 | sldi r25,r25,32 |
1387 | mr r3,r25 | 1393 | #ifdef CONFIG_CRASH_DUMP |
1394 | ld r7,__kdump_flag-_stext(r26) | ||
1395 | cmpldi cr0,r7,1 /* kdump kernel ? - stay where we are */ | ||
1396 | bne 1f | ||
1397 | add r25,r25,r26 | ||
1398 | #endif | ||
1399 | 1: mr r3,r25 | ||
1388 | bl .relocate | 1400 | bl .relocate |
1389 | #endif | 1401 | #endif |
1390 | 1402 | ||
@@ -1398,11 +1410,26 @@ _STATIC(__after_prom_start) | |||
1398 | li r3,0 /* target addr */ | 1410 | li r3,0 /* target addr */ |
1399 | mr. r4,r26 /* In some cases the loader may */ | 1411 | mr. r4,r26 /* In some cases the loader may */ |
1400 | beq 9f /* have already put us at zero */ | 1412 | beq 9f /* have already put us at zero */ |
1401 | lis r5,(copy_to_here - _stext)@ha | ||
1402 | addi r5,r5,(copy_to_here - _stext)@l /* # bytes of memory to copy */ | ||
1403 | li r6,0x100 /* Start offset, the first 0x100 */ | 1413 | li r6,0x100 /* Start offset, the first 0x100 */ |
1404 | /* bytes were copied earlier. */ | 1414 | /* bytes were copied earlier. */ |
1405 | 1415 | ||
1416 | #ifdef CONFIG_CRASH_DUMP | ||
1417 | /* | ||
1418 | * Check if the kernel has to be running as relocatable kernel based on the | ||
1419 | * variable __kdump_flag, if it is set the kernel is treated as relocatable | ||
1420 | * kernel, otherwise it will be moved to PHYSICAL_START | ||
1421 | */ | ||
1422 | ld r7,__kdump_flag-_stext(r26) | ||
1423 | cmpldi cr0,r7,1 | ||
1424 | bne 3f | ||
1425 | |||
1426 | li r5,__end_interrupts - _stext /* just copy interrupts */ | ||
1427 | b 5f | ||
1428 | 3: | ||
1429 | #endif | ||
1430 | lis r5,(copy_to_here - _stext)@ha | ||
1431 | addi r5,r5,(copy_to_here - _stext)@l /* # bytes of memory to copy */ | ||
1432 | |||
1406 | bl .copy_and_flush /* copy the first n bytes */ | 1433 | bl .copy_and_flush /* copy the first n bytes */ |
1407 | /* this includes the code being */ | 1434 | /* this includes the code being */ |
1408 | /* executed here. */ | 1435 | /* executed here. */ |
@@ -1411,15 +1438,15 @@ _STATIC(__after_prom_start) | |||
1411 | mtctr r8 | 1438 | mtctr r8 |
1412 | bctr | 1439 | bctr |
1413 | 1440 | ||
1441 | p_end: .llong _end - _stext | ||
1442 | |||
1414 | 4: /* Now copy the rest of the kernel up to _end */ | 1443 | 4: /* Now copy the rest of the kernel up to _end */ |
1415 | addis r5,r26,(p_end - _stext)@ha | 1444 | addis r5,r26,(p_end - _stext)@ha |
1416 | ld r5,(p_end - _stext)@l(r5) /* get _end */ | 1445 | ld r5,(p_end - _stext)@l(r5) /* get _end */ |
1417 | bl .copy_and_flush /* copy the rest */ | 1446 | 5: bl .copy_and_flush /* copy the rest */ |
1418 | 1447 | ||
1419 | 9: b .start_here_multiplatform | 1448 | 9: b .start_here_multiplatform |
1420 | 1449 | ||
1421 | p_end: .llong _end - _stext | ||
1422 | |||
1423 | /* | 1450 | /* |
1424 | * Copy routine used to copy the kernel to start at physical address 0 | 1451 | * Copy routine used to copy the kernel to start at physical address 0 |
1425 | * and flush and invalidate the caches as needed. | 1452 | * and flush and invalidate the caches as needed. |