Subject: Fix Support for 43P-140
To: None <port-prep@NetBSD.org>
From: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
List: port-prep
Date: 01/24/2005 18:25:58
Hi.

Support for the 43P-140 is curretly broken. One problem (in bus_space(9)
breaking (e)siop(4)) is already fixed by Matt Thomas and a pull-up
request has been submitted. Thanks to Matt.

The other problem is that the OpenPIC in the -140 may end up not mapped
into KVA causeing a fatal trap early in bootup, depending on where the
firmware located this PCI device. The patch below fixes this problem. It
requires a change to the sequence of initialisation calls, so it may
break somthing else. I had a look at the sequence and it should make no
difference. I tested this patch successfully on -current and the
release-2 branch on a 43P-140 and a 43P-100. So I will commit this patch
in a few days and request a pull-up to the release-2 branch if nobody is
concerned about it. (Portmaster?)

I build patched installation and generic kernels. They are available at:
ftp://ftp.netbsd.org/ftp/pub/NetBSD/arch/prep/snapshot/release-2-0_20050119=
/installation/floppy/
If you want to install NetBSD 2.0 on a 43P-140 or if you have a
(e)siop(4) (NCR/Symbios 53C825A or later) SCSI adapter you will need
this to get NetBSD instaled and running. If everything goes OK this
fixes will be included in 2.0.1 / 2.1 so this will be removed once
2.0.1 / 2.1 is out.

Index: ibm_7043_140.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/prep/prep/ibm_7043_140.c,v
retrieving revision 1.3
diff -u -u -r1.3 ibm_7043_140.c
--- ibm_7043_140.c	13 Jan 2005 23:57:04 -0000	1.3
+++ ibm_7043_140.c	20 Jan 2005 19:37:49 -0000
@@ -99,7 +100,21 @@
 		address =3D pci_conf_read(&pc, tag, 0x10);
 		if ((address & PCI_MAPREG_TYPE_MASK) =3D=3D PCI_MAPREG_TYPE_MEM) {
 			address &=3D PCI_MAPREG_MEM_ADDR_MASK;
-			baseaddr =3D (unsigned char *)(PREP_BUS_SPACE_MEM | address);
+			/*
+			 * PReP PCI memory space is from 0xc0000000 to
+			 * 0xffffffff but machdep.c maps only 0xc0000000 to
+			 * 0xcfffffff of PCI memory space. So look if the=20
+			 * address offset is bigger then 0xfffffff. If it is
+			 * we are outside the already mapped region and we need
+			 * to add an additional mapping for the OpenPIC.
+			 * The OpenPIC register window is always 256kB.
+			 */
+			if (address > 0xfffffff)
+				baseaddr =3D (unsigned char *) mapiodev(
+				    PREP_BUS_SPACE_MEM | address, 0x40000);
+			else
+				baseaddr =3D (unsigned char *)
+				    (PREP_BUS_SPACE_MEM | address);
 		}
 	}
 #endif
Index: machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/prep/prep/machdep.c,v
retrieving revision 1.51
diff -u -u -r1.51 machdep.c
--- machdep.c	20 Oct 2003 00:12:10 -0000	1.51
+++ machdep.c	20 Jan 2005 19:37:49 -0000
@@ -207,11 +207,6 @@
 	 */
 	consinit();
=20
-	/*
-	 * external interrupt handler install
-	 */
-	(*platform->init_intr)();
-
         /*
 	 * Set the page size.
 	 */
@@ -253,6 +248,11 @@
 	prep_intr_reg =3D (vaddr_t) mapiodev(PREP_INTR_REG, PAGE_SIZE);
 	if (!prep_intr_reg)
 		panic("startup: no room for interrupt register");
+	/*
+	 * external interrupt handler install
+	 */
+	(*platform->init_intr)();
+
=20
 	/*
 	 * Do common startup.
--=20


tsch=FC=DF,
       Jochen

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