* updated kollision (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / architecture / powerpc64 / package / linux / 0260-udbg-lv1-console.patch
blob6f8b8026e6835f34fbd2b48bd9bb92bec6f6f5fd
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: architecture/powerpc64/package/.../0260-udbg-lv1-console.patch
5 # Copyright (C) 2019 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 --- a/arch/powerpc/platforms/ps3/Kconfig
18 +++ b/arch/powerpc/platforms/ps3/Kconfig
19 @@ -237,4 +237,12 @@ config PS3GELIC_UDBG
21 If in doubt, say N here.
23 +config PS3_LV1_CONS_UDBG
24 + bool "PS3 udbg output via LV1 console"
25 + depends on PPC_PS3
26 + help
27 + Enables udbg early debugging output to LV1 console.
29 + If in doubt, say N here.
31 endmenu
32 --- a/arch/powerpc/platforms/ps3/Makefile
33 +++ b/arch/powerpc/platforms/ps3/Makefile
34 @@ -4,6 +4,7 @@ obj-y += interrupt.o exports.o os-area.o
35 obj-y += system-bus.o
37 obj-$(CONFIG_PS3GELIC_UDBG) += gelic_udbg.o
38 +obj-$(CONFIG_PS3_LV1_CONS_UDBG) += lv1_cons_udbg.o
39 obj-$(CONFIG_SMP) += smp.o
40 obj-$(CONFIG_SPU_BASE) += spu.o
41 obj-y += device-init.o
42 --- /dev/null
43 +++ b/arch/powerpc/platforms/ps3/lv1_cons_udbg.c
44 @@ -0,0 +1,57 @@
45 +/*
46 + * PS3 LV1 Debug Console
47 + *
48 + * Copyright (C) 2013 glevand <geoffrey.levand@mail.ru>
49 + * All rights reserved.
50 + *
51 + * This program is free software; you can redistribute it and/or modify it
52 + * under the terms of the GNU General Public License as published
53 + * by the Free Software Foundation; version 2 of the License.
54 + *
55 + * This program is distributed in the hope that it will be useful, but
56 + * WITHOUT ANY WARRANTY; without even the implied warranty of
57 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
58 + * General Public License for more details.
59 + *
60 + * You should have received a copy of the GNU General Public License along
61 + * with this program; if not, write to the Free Software Foundation, Inc.,
62 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
63 + */
65 +#include <asm/io.h>
66 +#include <asm/udbg.h>
67 +#include <asm/lv1call.h>
69 +#define LV1_CONS_ID 1
70 +#define LV1_CONS_LENGTH 0xff0
72 +static int initialized = 0;
74 +static void lv1_cons_udbg_putc(char ch)
76 + u64 data, written;
77 + int ret;
79 + if (!initialized) {
80 + ret = lv1_undocumented_function_105(LV1_CONS_ID, 0, 0,
81 + LV1_CONS_LENGTH, LV1_CONS_LENGTH, 0, 0);
82 + if ((ret != 0) && (ret != -7))
83 + return;
85 + initialized = 1;
86 + }
88 + data = ch;
89 + data <<= 56;
91 + lv1_undocumented_function_107(LV1_CONS_ID, 1, data, 0, 0, 0, &written);
93 + /* flush to console buffer in LV1 */
95 + lv1_undocumented_function_109(LV1_CONS_ID);
98 +void __init udbg_init_ps3_lv1_cons(void)
100 + udbg_putc = lv1_cons_udbg_putc;
102 --- a/arch/powerpc/Kconfig.debug
103 +++ b/arch/powerpc/Kconfig.debug
104 @@ -256,6 +256,14 @@ config PPC_EARLY_DEBUG_PS3GELIC
105 Select this to enable early debugging for the PlayStation3 via
106 UDP broadcasts sent out through the Ethernet port.
108 +config PPC_EARLY_DEBUG_PS3_LV1_CONS
109 + bool "Early debugging through the PS3 LV1 console"
110 + depends on PPC_PS3
111 + select PS3_LV1_CONS_UDBG
112 + help
113 + Select this to enable early debugging for the PlayStation3 via
114 + LV1 debug console.
116 config PPC_EARLY_DEBUG_OPAL_RAW
117 bool "OPAL raw console"
118 depends on HVC_OPAL
119 --- a/arch/powerpc/include/asm/udbg.h
120 +++ b/arch/powerpc/include/asm/udbg.h
121 @@ -51,6 +51,7 @@ extern void __init udbg_init_usbgecko(void);
122 extern void __init udbg_init_memcons(void);
123 extern void __init udbg_init_ehv_bc(void);
124 extern void __init udbg_init_ps3gelic(void);
125 +extern void __init udbg_init_ps3_lv1_cons(void);
126 extern void __init udbg_init_debug_opal_raw(void);
127 extern void __init udbg_init_debug_opal_hvsi(void);
129 --- a/arch/powerpc/kernel/udbg.c
130 +++ b/arch/powerpc/kernel/udbg.c
131 @@ -63,6 +63,8 @@ void __init udbg_early_init(void)
132 udbg_init_ehv_bc();
133 #elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC)
134 udbg_init_ps3gelic();
135 +#elif defined(CONFIG_PPC_EARLY_DEBUG_PS3_LV1_CONS)
136 + udbg_init_ps3_lv1_cons();
137 #elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_RAW)
138 udbg_init_debug_opal_raw();
139 #elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI)