Subject: Re: NOTICE: major changes to ofppc incoming
To: None <port-ofppc@NetBSD.org>
From: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
List: port-ofppc
Date: 07/03/2007 23:54:07
--Multipart_Tue__3_Jul_2007_23_54_07_+0200_RwE_zXXoyZDAVzGn
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Mon, 2 Jul 2007 17:34:45 +0200
Jochen Kunz <jkunz@unixag-kl.fh-kl.de> wrote:

> Also: Making the console independent from bus_space(9) eases debugging
> of bus_space(9). ;-)
[...]
> I hope to get some time to have a look at this tonight.
Looks good. I now have a working ofcons on the EFIKA and the Motorola
PowerStack II. But it still fails on the RS/6000 43P-150. Maybe a
firmware issue. I attached a patch for the ofcons to your enjoyment.

EFIKA:
root addr=3D192.168.1.2 path=3D/nfsroot/NetBSD/ofppc
2744816+223736 [162560+157678]=3D0x3232a4
 start=3D0x100000


Hallo Welt!

found a map reclen=3D6 cur=3D0
found a map reclen=3D6 cur=3D0
[ Kernel symbol table missing! ]
panic: call to null-ptr from 0x348bcc
Stopped at      0x318e38:       lwz     r0, r1, 0x14
db>=20

PowerStack II:
root addr=3D192.168.1.2 path=3D/nfsroot/NetBSD/ofppc
2744816+223736 [162560+157678]=3D0x3232a4
 start=3D0x100000


Hallo Welt!

found a map reclen=3D6 cur=3D0
found a map reclen=3D6 cur=3D0
panic: Could not map ISA IO
Illegal instruction
--=20


tsch=FC=DF,
       Jochen

Homepage: http://www.unixag-kl.fh-kl.de/~jkunz/


--Multipart_Tue__3_Jul_2007_23_54_07_+0200_RwE_zXXoyZDAVzGn
Content-Type: text/plain; name=ofppc.diff
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=ofppc.diff

Index: conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/ofppc/conf/GENERIC,v
retrieving revision 1.97.16.2
diff -u -r1.97.16.2 GENERIC
--- conf/GENERIC	26 Jun 2007 18:13:13 -0000	1.97.16.2
+++ conf/GENERIC	3 Jul 2007 21:39:12 -0000
@@ -166,8 +166,11 @@
 mainbus*	at root
 
 # Generic OpenFirmware bus support
-#ofbus*		at mainbus?
-#ofbus*		at ofbus?
+ofbus*		at mainbus?
+ofbus*		at ofbus?
+# Generic OpenFirmware console support
+ofcons*		at ofbus?
+
 
 # CPUs
 cpu*		at mainbus?
Index: conf/files.ofppc
===================================================================
RCS file: /cvsroot/src/sys/arch/ofppc/conf/files.ofppc,v
retrieving revision 1.26.10.2
diff -u -r1.26.10.2 files.ofppc
--- conf/files.ofppc	21 Jun 2007 18:49:37 -0000	1.26.10.2
+++ conf/files.ofppc	3 Jul 2007 21:39:12 -0000
@@ -76,7 +76,7 @@
 include "dev/wsfb/files.wsfb"
 
 define mainbus {}
-device mainbus: mainbus
+device mainbus: mainbus, ofbus
 attach mainbus at root
 file	arch/ofppc/ofppc/mainbus.c		mainbus
 
Index: ofppc/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ofppc/ofppc/machdep.c,v
retrieving revision 1.91.10.1
diff -u -r1.91.10.1 machdep.c
--- ofppc/machdep.c	21 Jun 2007 18:49:47 -0000	1.91.10.1
+++ ofppc/machdep.c	3 Jul 2007 21:39:13 -0000
@@ -48,6 +48,7 @@
 #include <uvm/uvm_extern.h>
 
 #include <dev/ofw/openfirm.h>
+#include <dev/cons.h>
 
 #include <machine/autoconf.h>
 #include <machine/pmap.h>
@@ -59,14 +60,19 @@
 #include <powerpc/oea/bat.h>
 #include <powerpc/ofw_cons.h>
 
+
 struct pmap ofw_pmap;
 char bootpath[256];
 
 void ofwppc_batinit(void);
+void	ofppc_bootstrap_console(void);
 
 void
 initppc(u_int startkernel, u_int endkernel, char *args)
 {
+	/* Initialize the bootstrap console. */
+	ofppc_bootstrap_console();
+	printf( "\n\nHallo Welt!\n\n");
 	ofwoea_initppc(startkernel, endkernel, args);
 	map_isa_ioregs();
 }
@@ -77,11 +83,13 @@
 	oea_startup(NULL);
 }
 
+/*
 void
 consinit(void)
 {
 	ofwoea_consinit();
 }
+*/
 
 void
 dumpsys(void)
@@ -135,3 +143,108 @@
 		*ap1 = 0;
 	ppc_boot(str);
 }
+
+
+
+
+
+/*	$NetBSD: machdep.c,v 1.91 2007/03/10 14:15:48 jmmv Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996 Wolfgang Solfrank.
+ * Copyright (C) 1995, 1996 TooLs GmbH.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+
+
+void
+consinit()
+{
+
+	(*cn_tab->cn_probe)(cn_tab);
+}
+
+void	ofcons_cnprobe(struct consdev *);
+int	ofppc_cngetc(dev_t);
+void	ofppc_cnputc(dev_t, int);
+
+struct consdev ofppc_bootcons = {
+	ofcons_cnprobe, NULL, ofppc_cngetc, ofppc_cnputc, nullcnpollc, NULL,
+	    NULL, NULL, makedev(0,0), 1,
+};
+
+int	ofppc_stdin_ihandle, ofppc_stdout_ihandle;
+int	ofppc_stdin_phandle, ofppc_stdout_phandle;
+
+void
+ofppc_bootstrap_console(void)
+{
+	int chosen;
+	char data[4];
+
+	chosen = OF_finddevice("/chosen");
+
+	if (OF_getprop(chosen, "stdin", data, sizeof(data)) != sizeof(int))
+		goto nocons;
+	ofppc_stdin_ihandle = of_decode_int(data);
+	ofppc_stdin_phandle = OF_instance_to_package(ofppc_stdin_ihandle);
+
+	if (OF_getprop(chosen, "stdout", data, sizeof(data)) != sizeof(int))
+		goto nocons;
+	ofppc_stdout_ihandle = of_decode_int(data);
+	ofppc_stdout_phandle = OF_instance_to_package(ofppc_stdout_ihandle);
+
+	cn_tab = &ofppc_bootcons;
+
+ nocons:
+	return;
+}
+
+int
+ofppc_cngetc(dev_t dev)
+{
+	u_char ch = '\0';
+	int l;
+
+	while ((l = OF_read(ofppc_stdin_ihandle, &ch, 1)) != 1)
+		if (l != -2 && l != 0)
+			return (-1);
+
+	return (ch);
+}
+
+void
+ofppc_cnputc(dev_t dev, int c)
+{
+	char ch = c;
+
+	OF_write(ofppc_stdout_ihandle, &ch, 1);
+}
+

--Multipart_Tue__3_Jul_2007_23_54_07_+0200_RwE_zXXoyZDAVzGn--