diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-07-03 03:19:48 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-03 03:19:48 -0400 |
commit | ab13446616118dc61c00ea50cc49919400717dd0 (patch) | |
tree | 3758a9db2938e354ea77629330551d7be8236ccd /arch/powerpc | |
parent | 4ce631e7a229a0e073078a197ed37d437cabcde0 (diff) |
[POWERPC] Fix various offb and BootX-related issues
This patch fixes various issues with offb (the default fbdev used on
powerpc when no proper fbdev is supported). It was broken when using
BootX under some circumstances and would fail to properly get the
framebuffer base address in others.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/btext.c | 20 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/bootx_init.c | 29 |
3 files changed, 43 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index a6920919d68e..f4e5e14ee2b6 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c | |||
@@ -111,7 +111,7 @@ void __init btext_setup_display(int width, int height, int depth, int pitch, | |||
111 | logicalDisplayBase = (unsigned char *)address; | 111 | logicalDisplayBase = (unsigned char *)address; |
112 | dispDeviceBase = (unsigned char *)address; | 112 | dispDeviceBase = (unsigned char *)address; |
113 | dispDeviceRowBytes = pitch; | 113 | dispDeviceRowBytes = pitch; |
114 | dispDeviceDepth = depth; | 114 | dispDeviceDepth = depth == 15 ? 16 : depth; |
115 | dispDeviceRect[0] = dispDeviceRect[1] = 0; | 115 | dispDeviceRect[0] = dispDeviceRect[1] = 0; |
116 | dispDeviceRect[2] = width; | 116 | dispDeviceRect[2] = width; |
117 | dispDeviceRect[3] = height; | 117 | dispDeviceRect[3] = height; |
@@ -160,20 +160,28 @@ int btext_initialize(struct device_node *np) | |||
160 | unsigned long address = 0; | 160 | unsigned long address = 0; |
161 | u32 *prop; | 161 | u32 *prop; |
162 | 162 | ||
163 | prop = (u32 *)get_property(np, "width", NULL); | 163 | prop = (u32 *)get_property(np, "linux,bootx-width", NULL); |
164 | if (prop == NULL) | ||
165 | prop = (u32 *)get_property(np, "width", NULL); | ||
164 | if (prop == NULL) | 166 | if (prop == NULL) |
165 | return -EINVAL; | 167 | return -EINVAL; |
166 | width = *prop; | 168 | width = *prop; |
167 | prop = (u32 *)get_property(np, "height", NULL); | 169 | prop = (u32 *)get_property(np, "linux,bootx-height", NULL); |
170 | if (prop == NULL) | ||
171 | prop = (u32 *)get_property(np, "height", NULL); | ||
168 | if (prop == NULL) | 172 | if (prop == NULL) |
169 | return -EINVAL; | 173 | return -EINVAL; |
170 | height = *prop; | 174 | height = *prop; |
171 | prop = (u32 *)get_property(np, "depth", NULL); | 175 | prop = (u32 *)get_property(np, "linux,bootx-depth", NULL); |
176 | if (prop == NULL) | ||
177 | prop = (u32 *)get_property(np, "depth", NULL); | ||
172 | if (prop == NULL) | 178 | if (prop == NULL) |
173 | return -EINVAL; | 179 | return -EINVAL; |
174 | depth = *prop; | 180 | depth = *prop; |
175 | pitch = width * ((depth + 7) / 8); | 181 | pitch = width * ((depth + 7) / 8); |
176 | prop = (u32 *)get_property(np, "linebytes", NULL); | 182 | prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL); |
183 | if (prop == NULL) | ||
184 | prop = (u32 *)get_property(np, "linebytes", NULL); | ||
177 | if (prop) | 185 | if (prop) |
178 | pitch = *prop; | 186 | pitch = *prop; |
179 | if (pitch == 1) | 187 | if (pitch == 1) |
@@ -194,7 +202,7 @@ int btext_initialize(struct device_node *np) | |||
194 | g_max_loc_Y = height / 16; | 202 | g_max_loc_Y = height / 16; |
195 | dispDeviceBase = (unsigned char *)address; | 203 | dispDeviceBase = (unsigned char *)address; |
196 | dispDeviceRowBytes = pitch; | 204 | dispDeviceRowBytes = pitch; |
197 | dispDeviceDepth = depth; | 205 | dispDeviceDepth = depth == 15 ? 16 : depth; |
198 | dispDeviceRect[0] = dispDeviceRect[1] = 0; | 206 | dispDeviceRect[0] = dispDeviceRect[1] = 0; |
199 | dispDeviceRect[2] = width; | 207 | dispDeviceRect[2] = width; |
200 | dispDeviceRect[3] = height; | 208 | dispDeviceRect[3] = height; |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index ba7cd50d820d..0c21de39c161 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -51,7 +51,6 @@ | |||
51 | 51 | ||
52 | extern void bootx_init(unsigned long r4, unsigned long phys); | 52 | extern void bootx_init(unsigned long r4, unsigned long phys); |
53 | 53 | ||
54 | boot_infos_t *boot_infos; | ||
55 | struct ide_machdep_calls ppc_ide_md; | 54 | struct ide_machdep_calls ppc_ide_md; |
56 | 55 | ||
57 | int boot_cpuid; | 56 | int boot_cpuid; |
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c index cb257aeb91f6..5685ad9e88e8 100644 --- a/arch/powerpc/platforms/powermac/bootx_init.c +++ b/arch/powerpc/platforms/powermac/bootx_init.c | |||
@@ -181,8 +181,25 @@ static void __init bootx_add_chosen_props(unsigned long base, | |||
181 | static void __init bootx_add_display_props(unsigned long base, | 181 | static void __init bootx_add_display_props(unsigned long base, |
182 | unsigned long *mem_end) | 182 | unsigned long *mem_end) |
183 | { | 183 | { |
184 | boot_infos_t *bi = bootx_info; | ||
185 | u32 tmp; | ||
186 | |||
184 | bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end); | 187 | bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end); |
185 | bootx_dt_add_prop("linux,opened", NULL, 0, mem_end); | 188 | bootx_dt_add_prop("linux,opened", NULL, 0, mem_end); |
189 | tmp = bi->dispDeviceDepth; | ||
190 | bootx_dt_add_prop("linux,bootx-depth", &tmp, 4, mem_end); | ||
191 | tmp = bi->dispDeviceRect[2] - bi->dispDeviceRect[0]; | ||
192 | bootx_dt_add_prop("linux,bootx-width", &tmp, 4, mem_end); | ||
193 | tmp = bi->dispDeviceRect[3] - bi->dispDeviceRect[1]; | ||
194 | bootx_dt_add_prop("linux,bootx-height", &tmp, 4, mem_end); | ||
195 | tmp = bi->dispDeviceRowBytes; | ||
196 | bootx_dt_add_prop("linux,bootx-linebytes", &tmp, 4, mem_end); | ||
197 | tmp = (u32)bi->dispDeviceBase; | ||
198 | if (tmp == 0) | ||
199 | tmp = (u32)bi->logicalDisplayBase; | ||
200 | tmp += bi->dispDeviceRect[1] * bi->dispDeviceRowBytes; | ||
201 | tmp += bi->dispDeviceRect[0] * ((bi->dispDeviceDepth + 7) / 8); | ||
202 | bootx_dt_add_prop("linux,bootx-addr", &tmp, 4, mem_end); | ||
186 | } | 203 | } |
187 | 204 | ||
188 | static void __init bootx_dt_add_string(char *s, unsigned long *mem_end) | 205 | static void __init bootx_dt_add_string(char *s, unsigned long *mem_end) |
@@ -222,6 +239,11 @@ static void __init bootx_scan_dt_build_strings(unsigned long base, | |||
222 | DBG(" detected display ! adding properties names !\n"); | 239 | DBG(" detected display ! adding properties names !\n"); |
223 | bootx_dt_add_string("linux,boot-display", mem_end); | 240 | bootx_dt_add_string("linux,boot-display", mem_end); |
224 | bootx_dt_add_string("linux,opened", mem_end); | 241 | bootx_dt_add_string("linux,opened", mem_end); |
242 | bootx_dt_add_string("linux,bootx-depth", mem_end); | ||
243 | bootx_dt_add_string("linux,bootx-width", mem_end); | ||
244 | bootx_dt_add_string("linux,bootx-height", mem_end); | ||
245 | bootx_dt_add_string("linux,bootx-linebytes", mem_end); | ||
246 | bootx_dt_add_string("linux,bootx-addr", mem_end); | ||
225 | strncpy(bootx_disp_path, namep, 255); | 247 | strncpy(bootx_disp_path, namep, 255); |
226 | } | 248 | } |
227 | 249 | ||
@@ -443,7 +465,14 @@ void __init bootx_init(unsigned long r3, unsigned long r4) | |||
443 | if (!BOOT_INFO_IS_V2_COMPATIBLE(bi)) | 465 | if (!BOOT_INFO_IS_V2_COMPATIBLE(bi)) |
444 | bi->logicalDisplayBase = bi->dispDeviceBase; | 466 | bi->logicalDisplayBase = bi->dispDeviceBase; |
445 | 467 | ||
468 | /* Fixup depth 16 -> 15 as that's what MacOS calls 16bpp */ | ||
469 | if (bi->dispDeviceDepth == 16) | ||
470 | bi->dispDeviceDepth = 15; | ||
471 | |||
446 | #ifdef CONFIG_BOOTX_TEXT | 472 | #ifdef CONFIG_BOOTX_TEXT |
473 | ptr = (unsigned long)bi->logicalDisplayBase; | ||
474 | ptr += bi->dispDeviceRect[1] * bi->dispDeviceRowBytes; | ||
475 | ptr += bi->dispDeviceRect[0] * ((bi->dispDeviceDepth + 7) / 8); | ||
447 | btext_setup_display(bi->dispDeviceRect[2] - bi->dispDeviceRect[0], | 476 | btext_setup_display(bi->dispDeviceRect[2] - bi->dispDeviceRect[0], |
448 | bi->dispDeviceRect[3] - bi->dispDeviceRect[1], | 477 | bi->dispDeviceRect[3] - bi->dispDeviceRect[1], |
449 | bi->dispDeviceDepth, bi->dispDeviceRowBytes, | 478 | bi->dispDeviceDepth, bi->dispDeviceRowBytes, |