It turned out that using some Open Firmware routines causes the system freeze after calling OF_quiesce(). This is why setting color palette crash the system for some Power Mac G5 models, like PowerMac11,2. Therefore, stop using color-palette and backlight callbacks for genfb(4) in this case. Also, postpone OF_quiesce() after rascons_init_rasops(), and initialize color palette there if OF is going to be quiesced and color depth is 8. Now, color palette for wscons is initialized correctly for PowerMac11,2.diff -r1.19 -r1.20 src/sys/arch/macppc/include/autoconf.h
(rin)
--- src/sys/arch/macppc/include/autoconf.h 2019/01/08 07:46:10 1.19
+++ src/sys/arch/macppc/include/autoconf.h 2020/07/07 02:33:54 1.20
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: autoconf.h,v 1.19 2019/01/08 07:46:10 mrg Exp $ */ | 1 | /* $NetBSD: autoconf.h,v 1.20 2020/07/07 02:33:54 rin Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (C) 1998 Internet Research Institute, Inc. | 4 | * Copyright (C) 1998 Internet Research Institute, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -72,16 +72,17 @@ void copy_disp_props(device_t, int, prop | @@ -72,16 +72,17 @@ void copy_disp_props(device_t, int, prop | |||
72 | void init_interrupt(void); | 72 | void init_interrupt(void); | |
73 | 73 | |||
74 | /* these are in dev/akbd.c */ | 74 | /* these are in dev/akbd.c */ | |
75 | int kbd_intr(void *); | 75 | int kbd_intr(void *); | |
76 | int akbd_cnattach(void); | 76 | int akbd_cnattach(void); | |
77 | int adbkbd_cnattach(void); | 77 | int adbkbd_cnattach(void); | |
78 | 78 | |||
79 | /* these are in dev/ofb.c */ | 79 | /* these are in dev/ofb.c */ | |
80 | int ofb_is_console(void); | 80 | int ofb_is_console(void); | |
81 | int rascons_cnattach(void); | 81 | int rascons_cnattach(void); | |
82 | 82 | |||
83 | extern int console_node; | 83 | extern int console_node; | |
84 | extern int console_instance; | 84 | extern int console_instance; | |
85 | extern int ofw_quiesce; | |||
85 | extern char model_name[64]; | 86 | extern char model_name[64]; | |
86 | 87 | |||
87 | #endif /* _MACHINE_AUTOCONF_H_ */ | 88 | #endif /* _MACHINE_AUTOCONF_H_ */ |
--- src/sys/arch/macppc/macppc/machdep.c 2019/01/28 02:25:01 1.169
+++ src/sys/arch/macppc/macppc/machdep.c 2020/07/07 02:33:54 1.170
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: machdep.c,v 1.169 2019/01/28 02:25:01 sevan Exp $ */ | 1 | /* $NetBSD: machdep.c,v 1.170 2020/07/07 02:33:54 rin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
5 | * Copyright (C) 1995, 1996 TooLs GmbH. | 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -22,27 +22,27 @@ | @@ -22,27 +22,27 @@ | |||
22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.169 2019/01/28 02:25:01 sevan Exp $"); | 35 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.170 2020/07/07 02:33:54 rin Exp $"); | |
36 | 36 | |||
37 | #include "opt_compat_netbsd.h" | 37 | #include "opt_compat_netbsd.h" | |
38 | #include "opt_ddb.h" | 38 | #include "opt_ddb.h" | |
39 | #include "opt_kgdb.h" | 39 | #include "opt_kgdb.h" | |
40 | #include "opt_altivec.h" | 40 | #include "opt_altivec.h" | |
41 | #include "opt_multiprocessor.h" | 41 | #include "opt_multiprocessor.h" | |
42 | #include "adb.h" | 42 | #include "adb.h" | |
43 | #include "zsc.h" | 43 | #include "zsc.h" | |
44 | 44 | |||
45 | #include <sys/param.h> | 45 | #include <sys/param.h> | |
46 | #include <sys/buf.h> | 46 | #include <sys/buf.h> | |
47 | #include <sys/boot_flag.h> | 47 | #include <sys/boot_flag.h> | |
48 | #include <sys/bus.h> | 48 | #include <sys/bus.h> | |
@@ -267,31 +267,28 @@ void | @@ -267,31 +267,28 @@ void | |||
267 | callback(void *p) | 267 | callback(void *p) | |
268 | { | 268 | { | |
269 | panic("callback"); /* for now XXX */ | 269 | panic("callback"); /* for now XXX */ | |
270 | } | 270 | } | |
271 | #endif | 271 | #endif | |
272 | 272 | |||
273 | void | 273 | void | |
274 | copy_disp_props(device_t dev, int node, prop_dictionary_t dict) | 274 | copy_disp_props(device_t dev, int node, prop_dictionary_t dict) | |
275 | { | 275 | { | |
276 | char name[32]; | 276 | char name[32]; | |
277 | uint32_t temp; | 277 | uint32_t temp; | |
278 | uint64_t cmap_cb, backlight_cb, brightness_cb; | 278 | uint64_t cmap_cb, backlight_cb, brightness_cb; | |
279 | int have_backlight = 0; | 279 | int have_backlight = 0; | |
280 | #ifdef PMAC_G5 | |||
281 | int have_palette = 0; | |||
282 | #else | |||
283 | int have_palette = 1; | 280 | int have_palette = 1; | |
284 | #endif | 281 | ||
285 | if (node != console_node) { | 282 | if (node != console_node) { | |
286 | /* | 283 | /* | |
287 | * see if any child matches since OF attaches nodes for | 284 | * see if any child matches since OF attaches nodes for | |
288 | * each head and /chosen/stdout points to the head | 285 | * each head and /chosen/stdout points to the head | |
289 | * rather than the device itself in this case | 286 | * rather than the device itself in this case | |
290 | */ | 287 | */ | |
291 | int sub; | 288 | int sub; | |
292 | 289 | |||
293 | sub = OF_child(node); | 290 | sub = OF_child(node); | |
294 | while ((sub != 0) && (sub != console_node)) { | 291 | while ((sub != 0) && (sub != console_node)) { | |
295 | sub = OF_peer(sub); | 292 | sub = OF_peer(sub); | |
296 | } | 293 | } | |
297 | if (sub != console_node) | 294 | if (sub != console_node) | |
@@ -339,41 +336,54 @@ copy_disp_props(device_t dev, int node, | @@ -339,41 +336,54 @@ copy_disp_props(device_t dev, int node, | |||
339 | } | 336 | } | |
340 | } | 337 | } | |
341 | add_model_specifics(dict); | 338 | add_model_specifics(dict); | |
342 | 339 | |||
343 | temp = 0; | 340 | temp = 0; | |
344 | if (OF_getprop(node, "ATY,RefCLK", &temp, sizeof(temp)) != 4) { | 341 | if (OF_getprop(node, "ATY,RefCLK", &temp, sizeof(temp)) != 4) { | |
345 | 342 | |||
346 | OF_getprop(OF_parent(node), "ATY,RefCLK", &temp, | 343 | OF_getprop(OF_parent(node), "ATY,RefCLK", &temp, | |
347 | sizeof(temp)); | 344 | sizeof(temp)); | |
348 | } | 345 | } | |
349 | if (temp != 0) | 346 | if (temp != 0) | |
350 | prop_dictionary_set_uint32(dict, "refclk", temp / 10); | 347 | prop_dictionary_set_uint32(dict, "refclk", temp / 10); | |
351 | 348 | |||
349 | if (have_palette && ofw_quiesce) { | |||
350 | aprint_debug( | |||
351 | "OFW has been quiesced - disabling palette callback\n"); | |||
352 | have_palette = 0; | |||
353 | } | |||
354 | ||||
352 | if (have_palette) { | 355 | if (have_palette) { | |
353 | gfb_cb.gcc_cookie = (void *)console_instance; | 356 | gfb_cb.gcc_cookie = (void *)console_instance; | |
354 | gfb_cb.gcc_set_mapreg = of_set_palette; | 357 | gfb_cb.gcc_set_mapreg = of_set_palette; | |
355 | cmap_cb = (uint64_t)(uintptr_t)&gfb_cb; | 358 | cmap_cb = (uint64_t)(uintptr_t)&gfb_cb; | |
356 | prop_dictionary_set_uint64(dict, "cmap_callback", cmap_cb); | 359 | prop_dictionary_set_uint64(dict, "cmap_callback", cmap_cb); | |
357 | } | 360 | } | |
358 | 361 | |||
359 | /* now let's look for backlight control */ | 362 | /* now let's look for backlight control */ | |
360 | have_backlight = 0; | 363 | have_backlight = 0; | |
361 | if (OF_getprop(node, "backlight-control", &temp, sizeof(temp)) == 4) { | 364 | if (OF_getprop(node, "backlight-control", &temp, sizeof(temp)) == 4) { | |
362 | have_backlight = 1; | 365 | have_backlight = 1; | |
363 | } else if (OF_getprop(OF_parent(node), "backlight-control", &temp, | 366 | } else if (OF_getprop(OF_parent(node), "backlight-control", &temp, | |
364 | sizeof(temp)) == 4) { | 367 | sizeof(temp)) == 4) { | |
365 | have_backlight = 1; | 368 | have_backlight = 1; | |
366 | } | 369 | } | |
370 | ||||
371 | if (have_backlight && ofw_quiesce) { | |||
372 | aprint_debug( | |||
373 | "OFW has been quiesced - disabling backlight callbacks\n"); | |||
374 | have_palette = 0; | |||
375 | } | |||
376 | ||||
367 | if (have_backlight) { | 377 | if (have_backlight) { | |
368 | 378 | |||
369 | gpc_backlight.gpc_cookie = (void *)console_instance; | 379 | gpc_backlight.gpc_cookie = (void *)console_instance; | |
370 | gpc_backlight.gpc_set_parameter = of_set_backlight; | 380 | gpc_backlight.gpc_set_parameter = of_set_backlight; | |
371 | gpc_backlight.gpc_get_parameter = of_get_backlight; | 381 | gpc_backlight.gpc_get_parameter = of_get_backlight; | |
372 | gpc_backlight.gpc_upd_parameter = NULL; | 382 | gpc_backlight.gpc_upd_parameter = NULL; | |
373 | backlight_cb = (uint64_t)(uintptr_t)&gpc_backlight; | 383 | backlight_cb = (uint64_t)(uintptr_t)&gpc_backlight; | |
374 | prop_dictionary_set_uint64(dict, "backlight_callback", | 384 | prop_dictionary_set_uint64(dict, "backlight_callback", | |
375 | backlight_cb); | 385 | backlight_cb); | |
376 | 386 | |||
377 | gpc_brightness.gpc_cookie = (void *)console_instance; | 387 | gpc_brightness.gpc_cookie = (void *)console_instance; | |
378 | gpc_brightness.gpc_set_parameter = of_set_brightness; | 388 | gpc_brightness.gpc_set_parameter = of_set_brightness; | |
379 | gpc_brightness.gpc_get_parameter = of_get_brightness; | 389 | gpc_brightness.gpc_get_parameter = of_get_brightness; |
--- src/sys/arch/ofppc/include/autoconf.h 2019/01/08 07:46:10 1.16
+++ src/sys/arch/ofppc/include/autoconf.h 2020/07/07 02:33:54 1.17
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: autoconf.h,v 1.16 2019/01/08 07:46:10 mrg Exp $ */ | 1 | /* $NetBSD: autoconf.h,v 1.17 2020/07/07 02:33:54 rin Exp $ */ | |
2 | 2 | |||
3 | #ifndef _OFPPC_AUTOCONF_H_ | 3 | #ifndef _OFPPC_AUTOCONF_H_ | |
4 | #define _OFPPC_AUTOCONF_H_ | 4 | #define _OFPPC_AUTOCONF_H_ | |
5 | 5 | |||
6 | #include <sys/bus.h> | 6 | #include <sys/bus.h> | |
7 | 7 | |||
8 | #include <prop/proplib.h> | 8 | #include <prop/proplib.h> | |
9 | 9 | |||
10 | struct confargs { | 10 | struct confargs { | |
11 | const char *ca_name; | 11 | const char *ca_name; | |
12 | u_int ca_node; | 12 | u_int ca_node; | |
13 | int ca_nreg; | 13 | int ca_nreg; | |
14 | u_int *ca_reg; | 14 | u_int *ca_reg; | |
@@ -22,26 +22,27 @@ struct confargs { | @@ -22,26 +22,27 @@ struct confargs { | |||
22 | struct pciio_info { | 22 | struct pciio_info { | |
23 | uint32_t start; | 23 | uint32_t start; | |
24 | uint32_t limit; | 24 | uint32_t limit; | |
25 | }; | 25 | }; | |
26 | 26 | |||
27 | /* to support machines with more than 4 busses, change the below */ | 27 | /* to support machines with more than 4 busses, change the below */ | |
28 | #define MAX_PCI_BUSSES 4 | 28 | #define MAX_PCI_BUSSES 4 | |
29 | struct model_data { | 29 | struct model_data { | |
30 | int ranges_offset; | 30 | int ranges_offset; | |
31 | struct pciio_info pciiodata[MAX_PCI_BUSSES]; | 31 | struct pciio_info pciiodata[MAX_PCI_BUSSES]; | |
32 | }; | 32 | }; | |
33 | 33 | |||
34 | extern int console_node; | 34 | extern int console_node; | |
35 | extern int ofw_quiesce; /* XXX not used at the moment */ | |||
35 | extern char model_name[64]; | 36 | extern char model_name[64]; | |
36 | 37 | |||
37 | #ifdef _KERNEL | 38 | #ifdef _KERNEL | |
38 | void initppc(u_int, u_int, char *); | 39 | void initppc(u_int, u_int, char *); | |
39 | void model_init(void); | 40 | void model_init(void); | |
40 | void strayintr(int); | 41 | void strayintr(int); | |
41 | void dumpsys(void); | 42 | void dumpsys(void); | |
42 | 43 | |||
43 | void inittodr(time_t); | 44 | void inittodr(time_t); | |
44 | void resettodr(void); | 45 | void resettodr(void); | |
45 | void cpu_initclocks(void); | 46 | void cpu_initclocks(void); | |
46 | void decr_intr(struct clockframe *); | 47 | void decr_intr(struct clockframe *); | |
47 | void setstatclockrate(int); | 48 | void setstatclockrate(int); |
--- src/sys/arch/powerpc/oea/ofw_rascons.c 2020/07/07 02:10:20 1.15
+++ src/sys/arch/powerpc/oea/ofw_rascons.c 2020/07/07 02:33:54 1.16
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ofw_rascons.c,v 1.15 2020/07/07 02:10:20 rin Exp $ */ | 1 | /* $NetBSD: ofw_rascons.c,v 1.16 2020/07/07 02:33:54 rin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1995, 1996 Carnegie-Mellon University. | 4 | * Copyright (c) 1995, 1996 Carnegie-Mellon University. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Author: Chris G. Demetriou | 7 | * Author: Chris G. Demetriou | |
8 | * | 8 | * | |
9 | * Permission to use, copy, modify and distribute this software and | 9 | * Permission to use, copy, modify and distribute this software and | |
10 | * its documentation is hereby granted, provided that both the copyright | 10 | * its documentation is hereby granted, provided that both the copyright | |
11 | * notice and this permission notice appear in all copies of the | 11 | * notice and this permission notice appear in all copies of the | |
12 | * software, derivative works or modified versions, and any portions | 12 | * software, derivative works or modified versions, and any portions | |
13 | * thereof, and that both notices appear in supporting documentation. | 13 | * thereof, and that both notices appear in supporting documentation. | |
14 | * | 14 | * | |
@@ -18,27 +18,27 @@ | @@ -18,27 +18,27 @@ | |||
18 | * | 18 | * | |
19 | * Carnegie Mellon requests users of this software to return to | 19 | * Carnegie Mellon requests users of this software to return to | |
20 | * | 20 | * | |
21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | 21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
22 | * School of Computer Science | 22 | * School of Computer Science | |
23 | * Carnegie Mellon University | 23 | * Carnegie Mellon University | |
24 | * Pittsburgh PA 15213-3890 | 24 | * Pittsburgh PA 15213-3890 | |
25 | * | 25 | * | |
26 | * any improvements or extensions that they make and grant Carnegie the | 26 | * any improvements or extensions that they make and grant Carnegie the | |
27 | * rights to redistribute these changes. | 27 | * rights to redistribute these changes. | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | #include <sys/cdefs.h> | 30 | #include <sys/cdefs.h> | |
31 | __KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.15 2020/07/07 02:10:20 rin Exp $"); | 31 | __KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.16 2020/07/07 02:33:54 rin Exp $"); | |
32 | 32 | |||
33 | #include "wsdisplay.h" | 33 | #include "wsdisplay.h" | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/buf.h> | 36 | #include <sys/buf.h> | |
37 | #include <sys/bus.h> | 37 | #include <sys/bus.h> | |
38 | #include <sys/conf.h> | 38 | #include <sys/conf.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/ioctl.h> | 40 | #include <sys/ioctl.h> | |
41 | #include <sys/kernel.h> | 41 | #include <sys/kernel.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | 43 | |||
44 | #include <dev/ofw/openfirm.h> | 44 | #include <dev/ofw/openfirm.h> | |
@@ -276,22 +276,34 @@ rascons_init_rasops(int node, struct ras | @@ -276,22 +276,34 @@ rascons_init_rasops(int node, struct ras | |||
276 | char buffer[128]; | 276 | char buffer[128]; | |
277 | snprintf(buffer, 128, "bits %08x c %d w %d -> %d %d\n", | 277 | snprintf(buffer, 128, "bits %08x c %d w %d -> %d %d\n", | |
278 | (uint32_t)ri->ri_bits, cols, width, ri->ri_xorigin, ri->ri_yorigin); | 278 | (uint32_t)ri->ri_bits, cols, width, ri->ri_xorigin, ri->ri_yorigin); | |
279 | OF_write(console_instance, buffer, strlen(buffer)); | 279 | OF_write(console_instance, buffer, strlen(buffer)); | |
280 | #endif | 280 | #endif | |
281 | } else { | 281 | } else { | |
282 | /* use as much of the screen as the font permits */ | 282 | /* use as much of the screen as the font permits */ | |
283 | rasops_init(ri, height/8, width/8); | 283 | rasops_init(ri, height/8, width/8); | |
284 | ri->ri_caps = WSSCREEN_WSCOLORS; | 284 | ri->ri_caps = WSSCREEN_WSCOLORS; | |
285 | rasops_reconfig(ri, height / ri->ri_font->fontheight, | 285 | rasops_reconfig(ri, height / ri->ri_font->fontheight, | |
286 | width / ri->ri_font->fontwidth); | 286 | width / ri->ri_font->fontwidth); | |
287 | } | 287 | } | |
288 | 288 | |||
289 | if (depth == 8 && ofw_quiesce) { | |||
290 | /* | |||
291 | * Open Firmware will be quiesced. This is last chance to | |||
292 | * set color palette via ``color!'' method. | |||
293 | */ | |||
294 | for (int i = 0; i < 256; i++) { | |||
295 | OF_call_method_1("color!", console_instance, 4, | |||
296 | rasops_cmap[3 * i], rasops_cmap[3 * i + 1], | |||
297 | rasops_cmap[3 * i + 2], i); | |||
298 | } | |||
299 | } | |||
300 | ||||
289 | return true; | 301 | return true; | |
290 | } | 302 | } | |
291 | #else /* NWSDISPLAY > 0 */ | 303 | #else /* NWSDISPLAY > 0 */ | |
292 | int | 304 | int | |
293 | rascons_cnattach(void) | 305 | rascons_cnattach(void) | |
294 | { | 306 | { | |
295 | return -1; | 307 | return -1; | |
296 | } | 308 | } | |
297 | #endif | 309 | #endif |
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c 2020/07/06 10:59:37 1.49
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c 2020/07/07 02:33:54 1.50
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ofwoea_machdep.c,v 1.49 2020/07/06 10:59:37 rin Exp $ */ | 1 | /* $NetBSD: ofwoea_machdep.c,v 1.50 2020/07/07 02:33:54 rin Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Tim Rightnour | 8 | * by Tim Rightnour | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.49 2020/07/06 10:59:37 rin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.50 2020/07/07 02:33:54 rin Exp $"); | |
34 | 34 | |||
35 | #include "ksyms.h" | 35 | #include "ksyms.h" | |
36 | #include "wsdisplay.h" | 36 | #include "wsdisplay.h" | |
37 | 37 | |||
38 | #ifdef _KERNEL_OPT | 38 | #ifdef _KERNEL_OPT | |
39 | #include "opt_ddb.h" | 39 | #include "opt_ddb.h" | |
40 | #include "opt_kgdb.h" | 40 | #include "opt_kgdb.h" | |
41 | #include "opt_modular.h" | 41 | #include "opt_modular.h" | |
42 | #include "opt_multiprocessor.h" | 42 | #include "opt_multiprocessor.h" | |
43 | #include "opt_oea.h" | 43 | #include "opt_oea.h" | |
44 | #include "opt_ofwoea.h" | 44 | #include "opt_ofwoea.h" | |
45 | #include "opt_ppcarch.h" | 45 | #include "opt_ppcarch.h" | |
46 | #endif | 46 | #endif | |
@@ -116,26 +116,28 @@ char model_name[64]; | @@ -116,26 +116,28 @@ char model_name[64]; | |||
116 | void *startsym, *endsym; | 116 | void *startsym, *endsym; | |
117 | #endif | 117 | #endif | |
118 | 118 | |||
119 | #if PPC_OEA601 | 119 | #if PPC_OEA601 | |
120 | #define TIMEBASE_FREQ (1000000000) /* RTC register */ | 120 | #define TIMEBASE_FREQ (1000000000) /* RTC register */ | |
121 | #endif | 121 | #endif | |
122 | 122 | |||
123 | #ifdef TIMEBASE_FREQ | 123 | #ifdef TIMEBASE_FREQ | |
124 | u_int timebase_freq = TIMEBASE_FREQ; | 124 | u_int timebase_freq = TIMEBASE_FREQ; | |
125 | #else | 125 | #else | |
126 | u_int timebase_freq = 0; | 126 | u_int timebase_freq = 0; | |
127 | #endif | 127 | #endif | |
128 | 128 | |||
129 | int ofw_quiesce; | |||
130 | ||||
129 | extern int ofwmsr; | 131 | extern int ofwmsr; | |
130 | extern int chosen; | 132 | extern int chosen; | |
131 | extern uint32_t ticks_per_sec; | 133 | extern uint32_t ticks_per_sec; | |
132 | extern uint32_t ns_per_tick; | 134 | extern uint32_t ns_per_tick; | |
133 | extern uint32_t ticks_per_intr; | 135 | extern uint32_t ticks_per_intr; | |
134 | 136 | |||
135 | static int save_ofmap(struct ofw_translations *, int); | 137 | static int save_ofmap(struct ofw_translations *, int); | |
136 | static void restore_ofmap(struct ofw_translations *, int); | 138 | static void restore_ofmap(struct ofw_translations *, int); | |
137 | static void set_timebase(void); | 139 | static void set_timebase(void); | |
138 | 140 | |||
139 | extern void cpu_spinstart(u_int); | 141 | extern void cpu_spinstart(u_int); | |
140 | extern volatile u_int cpu_spinstart_ack; | 142 | extern volatile u_int cpu_spinstart_ack; | |
141 | 143 | |||
@@ -166,41 +168,44 @@ ofwoea_initppc(u_int startkernel, u_int | @@ -166,41 +168,44 @@ ofwoea_initppc(u_int startkernel, u_int | |||
166 | /* get model name and perform model-specific actions */ | 168 | /* get model name and perform model-specific actions */ | |
167 | memset(model_name, 0, sizeof(model_name)); | 169 | memset(model_name, 0, sizeof(model_name)); | |
168 | node = OF_finddevice("/"); | 170 | node = OF_finddevice("/"); | |
169 | if (node != -1) { | 171 | if (node != -1) { | |
170 | l = OF_getprop(node, "model", model_name, sizeof(model_name)); | 172 | l = OF_getprop(node, "model", model_name, sizeof(model_name)); | |
171 | if (l == -1) | 173 | if (l == -1) | |
172 | OF_getprop(node, "name", model_name, | 174 | OF_getprop(node, "name", model_name, | |
173 | sizeof(model_name)); | 175 | sizeof(model_name)); | |
174 | model_init(); | 176 | model_init(); | |
175 | } | 177 | } | |
176 | 178 | |||
177 | if (strncmp(model_name, "PowerMac11,2", 12) == 0 || | 179 | if (strncmp(model_name, "PowerMac11,2", 12) == 0 || | |
178 | strncmp(model_name, "PowerMac12,1", 12) == 0) | 180 | strncmp(model_name, "PowerMac12,1", 12) == 0) | |
179 | OF_quiesce(); | 181 | ofw_quiesce = 1; | |
180 | 182 | |||
181 | /* switch CPUs to full speed */ | 183 | /* switch CPUs to full speed */ | |
182 | if (strncmp(model_name, "PowerMac7,", 10) == 0) { | 184 | if (strncmp(model_name, "PowerMac7,", 10) == 0) { | |
183 | int clock_ih = OF_open("/u3/i2c/i2c-hwclock"); | 185 | int clock_ih = OF_open("/u3/i2c/i2c-hwclock"); | |
184 | if (clock_ih != 0) { | 186 | if (clock_ih != 0) { | |
185 | OF_call_method_1("slew-high", clock_ih, 0); | 187 | OF_call_method_1("slew-high", clock_ih, 0); | |
186 | } | 188 | } | |
187 | } | 189 | } | |
188 | 190 | |||
189 | /* Initialize bus_space */ | 191 | /* Initialize bus_space */ | |
190 | ofwoea_bus_space_init(); | 192 | ofwoea_bus_space_init(); | |
191 | 193 | |||
192 | ofwoea_consinit(); | 194 | ofwoea_consinit(); | |
193 | 195 | |||
196 | if (ofw_quiesce) | |||
197 | OF_quiesce(); | |||
198 | ||||
194 | #if defined(MULTIPROCESSOR) && defined(ofppc) | 199 | #if defined(MULTIPROCESSOR) && defined(ofppc) | |
195 | for (i=1; i < CPU_MAXNUM; i++) { | 200 | for (i=1; i < CPU_MAXNUM; i++) { | |
196 | snprintf(cpupath, sizeof(cpupath), "/cpus/@%x", i); | 201 | snprintf(cpupath, sizeof(cpupath), "/cpus/@%x", i); | |
197 | node = OF_finddevice(cpupath); | 202 | node = OF_finddevice(cpupath); | |
198 | if (node <= 0) | 203 | if (node <= 0) | |
199 | continue; | 204 | continue; | |
200 | aprint_verbose("Starting up CPU %d %s\n", i, cpupath); | 205 | aprint_verbose("Starting up CPU %d %s\n", i, cpupath); | |
201 | OF_start_cpu(node, (u_int)cpu_spinstart, i); | 206 | OF_start_cpu(node, (u_int)cpu_spinstart, i); | |
202 | for (l=0; l < 100000000; l++) { | 207 | for (l=0; l < 100000000; l++) { | |
203 | if (cpu_spinstart_ack == i) { | 208 | if (cpu_spinstart_ack == i) { | |
204 | aprint_verbose("CPU %d spun up.\n", i); | 209 | aprint_verbose("CPU %d spun up.\n", i); | |
205 | break; | 210 | break; | |
206 | } | 211 | } |