Fix Support for 43P-140

Jochen Kunz <[email protected]>
Newsgroups gmane.os.netbsd.ports.prep
Message-ID <[email protected]>
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
===================================================================
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 = pci_conf_read(&pc, tag, 0x10);
 		if ((address & PCI_MAPREG_TYPE_MASK) == PCI_MAPREG_TYPE_MEM) {
 			address &= PCI_MAPREG_MEM_ADDR_MASK;
-			baseaddr = (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 
+			 * 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 = (unsigned char *) mapiodev(
+				    PREP_BUS_SPACE_MEM | address, 0x40000);
+			else
+				baseaddr = (unsigned char *)
+				    (PREP_BUS_SPACE_MEM | address);
 		}
 	}
 #endif
Index: machdep.c
===================================================================
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();
 
-	/*
-	 * external interrupt handler install
-	 */
-	(*platform->init_intr)();
-
         /*
 	 * Set the page size.
 	 */
@@ -253,6 +248,11 @@
 	prep_intr_reg = (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)();
+
 
 	/*
 	 * Do common startup.
-- 


tschüß,
       Jochen

Homepage: http://www.unixag-kl.fh-kl.de/~jkunz/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.