bump Linux 3.18 trunk revision to 47027; bump Linux 3.18 kernel version to 3.18.21
[ps3openwrt_patches.git] / 0200-kexec-tools-add-ps3-console.patch
blobce511887165991926d0e38ab10aa6ccf086fc26c
1 --- a/purgatory/arch/ppc64/console-ppc64.c 2011-10-03 00:56:38.000000000 +0200
2 +++ b/purgatory/arch/ppc64/console-ppc64.c 2013-02-16 11:09:31.600289142 +0100
3 @@ -22,20 +22,32 @@
4 #include <purgatory.h>
5 #include "hvCall.h"
7 -extern int debug;
8 +#define CONS_ID 1
9 +#define CONS_LENGTH 0xff0
11 void putchar(int c)
13 - char buff[16];
14 - unsigned long *lbuf = (unsigned long *)buff;
15 + static int initialized = 0;
16 + unsigned long data, written;
17 + int ret;
19 - if (!debug) /* running on non pseries */
20 - return;
21 + if (!initialized) {
22 + ret = lv1_undocumented_function_105(CONS_ID, 0, 0,
23 + CONS_LENGTH, CONS_LENGTH, 0, 0);
24 + if ((ret != 0) && (ret != -7))
25 + return;
27 - if (c == '\n')
28 - putchar('\r');
29 + initialized = 1;
30 + }
32 + data = c;
33 + data <<= 56;
35 + lv1_undocumented_function_107(CONS_ID, 1, data, 0, 0, 0,
36 + &written);
38 + /* flush to console buffer in LV1 */
39 + lv1_undocumented_function_109(CONS_ID);
41 - buff[0] = c;
42 - plpar_hcall_norets(H_PUT_TERM_CHAR, 0, 1, lbuf[0], lbuf[1]);
43 return;
45 --- a/purgatory/arch/ppc64/hvCall.S 2011-10-03 00:56:38.000000000 +0200
46 +++ b/purgatory/arch/ppc64/hvCall.S 2013-02-16 11:11:41.006963337 +0100
47 @@ -13,14 +13,36 @@
48 #define HVSC .long 0x44000022
49 .text
50 .machine ppc64
51 -.globl .plpar_hcall_norets
52 -.plpar_hcall_norets:
53 - or 6,6,6 # medium low priority
54 - mfcr 0
55 - stw 0,8(1)
56 +.globl .lv1_undocumented_function_105
57 +.lv1_undocumented_function_105:
58 + mflr 0
59 + std 0, 16(1)
60 + li 11, 105
61 + HVSC
62 + ld 0, 16(1)
63 + mtlr 0
64 + blr
66 - HVSC /* invoke the hypervisor */
67 +.globl .lv1_undocumented_function_107
68 +.lv1_undocumented_function_107:
69 + mflr 0
70 + std 0, 16(1)
71 + stdu 9, -8(1)
72 + li 11, 107
73 + HVSC
74 + addi 1, 1, 8
75 + ld 11, -8(1)
76 + std 4, 0(11)
77 + ld 0, 16(1)
78 + mtlr 0
79 + blr
81 - lwz 0,8(1)
82 - mtcrf 0xff,0
83 - blr /* return r3 = status */
84 +.globl .lv1_undocumented_function_109
85 +.lv1_undocumented_function_109:
86 + mflr 0
87 + std 0, 16(1)
88 + li 11, 109
89 + HVSC
90 + ld 0, 16(1)
91 + mtlr 0
92 + blr
93 --- a/purgatory/arch/ppc64/hvCall.h 2011-10-03 00:56:38.000000000 +0200
94 +++ b/purgatory/arch/ppc64/hvCall.h 2013-02-16 11:12:31.713632953 +0100
95 @@ -1,8 +1,14 @@
96 #ifndef HVCALL_H
97 #define HVCALL_H
99 -#define H_PUT_TERM_CHAR 0x58
100 +int lv1_undocumented_function_105(unsigned long arg1,
101 + unsigned long arg2, unsigned long arg3, unsigned long arg4,
102 + unsigned long arg5, unsigned long arg6, unsigned long arg7);
104 -long plpar_hcall_norets(unsigned long opcode, ...);
105 +int lv1_undocumented_function_107(unsigned long arg1,
106 + unsigned long arg2, unsigned long arg3, unsigned long arg4,
107 + unsigned long arg5, unsigned long arg6, unsigned long *arg7);
109 +int lv1_undocumented_function_109(unsigned long arg1);
111 #endif