Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/shark/ofw - Adapt to vga_common_attach() API changes.



details:   https://anonhg.NetBSD.org/src/rev/a6486043059f
branches:  trunk
changeset: 572631:a6486043059f
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jan 09 15:29:27 2005 +0000

description:
- Adapt to vga_common_attach() API changes.
- Add more VGA initialization code to vga_ofbus_cnattach() from pccons.c.
- Export vga_ofbus_cnattach() prototype for consinit() ops.

diffstat:

 sys/arch/shark/ofw/vga_ofbus.c    |  42 +++++++++++++++++++++++++++++++-------
 sys/arch/shark/ofw/vga_ofbusvar.h |  30 +++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 8 deletions(-)

diffs (108 lines):

diff -r 06374c3d78a3 -r a6486043059f sys/arch/shark/ofw/vga_ofbus.c
--- a/sys/arch/shark/ofw/vga_ofbus.c    Sun Jan 09 15:26:19 2005 +0000
+++ b/sys/arch/shark/ofw/vga_ofbus.c    Sun Jan 09 15:29:27 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vga_ofbus.c,v 1.5 2003/07/15 03:36:02 lukem Exp $ */
+/* $NetBSD: vga_ofbus.c,v 1.6 2005/01/09 15:29:27 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga_ofbus.c,v 1.5 2003/07/15 03:36:02 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga_ofbus.c,v 1.6 2005/01/09 15:29:27 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,9 +47,8 @@
 #include <dev/wscons/wsdisplayvar.h>
 
 #include <dev/ofw/openfirm.h>
-#if 0
-#include <dnard/ofw/vga_ofisavar.h>
-#endif
+
+#include <shark/ofw/vga_ofbusvar.h>
 
 struct vga_ofbus_softc {
        struct vga_softc sc_vga;
@@ -91,13 +90,40 @@
        osc->sc_phandle = oba->oba_phandle;
 
        vga_common_attach(sc, &isa_io_bs_tag, &isa_mem_bs_tag,
-           WSDISPLAY_TYPE_ISAVGA, NULL);
+           WSDISPLAY_TYPE_ISAVGA, 0, NULL);
 }
 
 int
-vga_ofbus_cnattach(int phandle, bus_space_tag_t iot, bus_space_tag_t memt)
+vga_ofbus_cnattach(bus_space_tag_t iot, bus_space_tag_t memt)
 {
-       if (OF_call_method("text-mode3", phandle, 0, 0) != 0) {
+       int chosen_phandle;
+       int stdout_ihandle, stdout_phandle;
+       char buf[128];
+
+       stdout_phandle = 0;
+
+       /*
+        * Find out whether the firmware's chosen stdout is
+        * a display.  If so, use the existing ihandle so the firmware
+        * doesn't become Unhappy.  If not, just open it.
+        */
+       if ((chosen_phandle = OF_finddevice("/chosen")) == -1 ||
+           OF_getprop(chosen_phandle, "stdout", &stdout_ihandle, 
+           sizeof(stdout_ihandle)) != sizeof(stdout_ihandle)) {
+               return 0;
+       }
+       stdout_ihandle = of_decode_int((unsigned char *)&stdout_ihandle);
+       if ((stdout_phandle = OF_instance_to_package(stdout_ihandle)) == -1 ||
+           OF_getprop(stdout_phandle, "device_type", buf, sizeof(buf)) <= 0) {
+               return 0;
+       }
+
+       if (strcmp(buf, "display") != 0) {
+               /* The display is not stdout device. */
+               return 0;
+       }
+               
+       if (OF_call_method("text-mode3", stdout_ihandle, 0, 0) != 0) {
                printf("vga_ofbus_match: text-mode3 method invocation on VGA "
                       "screen device failed\n");
        }
diff -r 06374c3d78a3 -r a6486043059f sys/arch/shark/ofw/vga_ofbusvar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/shark/ofw/vga_ofbusvar.h Sun Jan 09 15:29:27 2005 +0000
@@ -0,0 +1,30 @@
+/* $NetBSD: vga_ofbusvar.h,v 1.1 2005/01/09 15:29:27 tsutsui Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ * 
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution%CS.CMU.EDU@localhost
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+int vga_ofbus_cnattach(bus_space_tag_t, bus_space_tag_t);



Home | Main Index | Thread Index | Old Index