initial import
[ps3linux_kernel_patches_314.git] / 0260-udbg-lv1-console.patch
blobcb38ef7611e60a0404ebe29e0cbe4ebbe0771d9f
1 --- a/arch/powerpc/platforms/ps3/Kconfig 2013-02-21 13:59:28.585037559 +0100
2 +++ b/arch/powerpc/platforms/ps3/Kconfig 2013-02-21 14:01:19.724894506 +0100
3 @@ -246,4 +246,12 @@
5 If in doubt, say N here.
7 +config PS3_LV1_CONS_UDBG
8 + bool "PS3 udbg output via LV1 console"
9 + depends on PPC_PS3
10 + help
11 + Enables udbg early debugging output to LV1 console.
13 + If in doubt, say N here.
15 endmenu
16 --- a/arch/powerpc/platforms/ps3/Makefile 2013-02-21 14:02:49.992787219 +0100
17 +++ b/arch/powerpc/platforms/ps3/Makefile 2013-02-21 14:03:33.870050887 +0100
18 @@ -3,6 +3,7 @@
19 obj-y += system-bus.o
21 obj-$(CONFIG_PS3GELIC_UDBG) += gelic_udbg.o
22 +obj-$(CONFIG_PS3_LV1_CONS_UDBG) += lv1_cons_udbg.o
23 obj-$(CONFIG_SMP) += smp.o
24 obj-$(CONFIG_SPU_BASE) += spu.o
25 obj-y += device-init.o
26 --- /dev/null 2012-11-28 15:48:49.557690341 +0100
27 +++ b/arch/powerpc/platforms/ps3/lv1_cons_udbg.c 2013-02-21 14:23:49.250083391 +0100
28 @@ -0,0 +1,57 @@
29 +/*
30 + * PS3 LV1 Debug Console
31 + *
32 + * Copyright (C) 2013 glevand <geoffrey.levand@mail.ru>
33 + * All rights reserved.
34 + *
35 + * This program is free software; you can redistribute it and/or modify it
36 + * under the terms of the GNU General Public License as published
37 + * by the Free Software Foundation; version 2 of the License.
38 + *
39 + * This program is distributed in the hope that it will be useful, but
40 + * WITHOUT ANY WARRANTY; without even the implied warranty of
41 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 + * General Public License for more details.
43 + *
44 + * You should have received a copy of the GNU General Public License along
45 + * with this program; if not, write to the Free Software Foundation, Inc.,
46 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
47 + */
49 +#include <asm/io.h>
50 +#include <asm/udbg.h>
51 +#include <asm/lv1call.h>
53 +#define LV1_CONS_ID 1
54 +#define LV1_CONS_LENGTH 0xff0
56 +static int initialized = 0;
58 +static void lv1_cons_udbg_putc(char ch)
60 + u64 data, written;
61 + int ret;
63 + if (!initialized) {
64 + ret = lv1_undocumented_function_105(LV1_CONS_ID, 0, 0,
65 + LV1_CONS_LENGTH, LV1_CONS_LENGTH, 0, 0);
66 + if ((ret != 0) && (ret != -7))
67 + return;
69 + initialized = 1;
70 + }
72 + data = ch;
73 + data <<= 56;
75 + lv1_undocumented_function_107(LV1_CONS_ID, 1, data, 0, 0, 0, &written);
77 + /* flush to console buffer in LV1 */
79 + lv1_undocumented_function_109(LV1_CONS_ID);
82 +void __init udbg_init_ps3_lv1_cons(void)
84 + udbg_putc = lv1_cons_udbg_putc;
86 --- a/arch/powerpc/Kconfig.debug 2013-02-21 14:31:39.023621546 +0100
87 +++ b/arch/powerpc/Kconfig.debug 2013-02-21 14:32:47.370765998 +0100
88 @@ -248,6 +248,14 @@
89 Select this to enable early debugging for the PlayStation3 via
90 UDP broadcasts sent out through the Ethernet port.
92 +config PPC_EARLY_DEBUG_PS3_LV1_CONS
93 + bool "Early debugging through the PS3 LV1 console"
94 + depends on PPC_PS3
95 + select PS3_LV1_CONS_UDBG
96 + help
97 + Select this to enable early debugging for the PlayStation3 via
98 + LV1 debug console.
100 config PPC_EARLY_DEBUG_OPAL_RAW
101 bool "OPAL raw console"
102 depends on HVC_OPAL
103 --- a/arch/powerpc/include/asm/udbg.h 2013-02-21 14:15:53.855871374 +0100
104 +++ b/arch/powerpc/include/asm/udbg.h 2013-02-21 14:16:16.107616876 +0100
105 @@ -54,6 +54,7 @@
106 extern void __init udbg_init_wsp(void);
107 extern void __init udbg_init_ehv_bc(void);
108 extern void __init udbg_init_ps3gelic(void);
109 +extern void __init udbg_init_ps3_lv1_cons(void);
110 extern void __init udbg_init_debug_opal_raw(void);
111 extern void __init udbg_init_debug_opal_hvsi(void);
113 --- a/arch/powerpc/kernel/udbg.c 2013-02-21 14:14:28.283621378 +0100
114 +++ b/arch/powerpc/kernel/udbg.c 2013-02-21 14:15:16.431624882 +0100
115 @@ -68,6 +68,8 @@
116 udbg_init_ehv_bc();
117 #elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC)
118 udbg_init_ps3gelic();
119 +#elif defined(CONFIG_PPC_EARLY_DEBUG_PS3_LV1_CONS)
120 + udbg_init_ps3_lv1_cons();
121 #elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_RAW)
122 udbg_init_debug_opal_raw();
123 #elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI)