Module Name:    src
Committed By:   kiyohara
Date:           Thu Mar 18 14:04:07 UTC 2010

Modified Files:
        src/sys/arch/evbppc/obs405: obs266_autoconf.c
        src/sys/arch/evbppc/virtex: autoconf.c virtex_start.S
        src/sys/arch/evbppc/walnut: autoconf.c machdep.c walnut_start.S

Log Message:
Support PowerPC 405EX/EXr.
  1. Add some new source and header files.
     (MAL(split) and RGMII(new) relations for EMAC)
  2. Create dcr4xx.h.  Its moved from dcr405gp.h.  Also remove dcr405xx.h.
  3. intr.c supports MULTIUIC with virtual-irq.  likes to oea.
     support 32-virq/128-hwirq.
  4. multiple emac support.
  5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
  6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbppc/obs405/obs266_autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbppc/virtex/autoconf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbppc/virtex/virtex_start.S
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbppc/walnut/autoconf.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/evbppc/walnut/machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbppc/walnut/walnut_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbppc/obs405/obs266_autoconf.c
diff -u src/sys/arch/evbppc/obs405/obs266_autoconf.c:1.4 src/sys/arch/evbppc/obs405/obs266_autoconf.c:1.5
--- src/sys/arch/evbppc/obs405/obs266_autoconf.c:1.4	Sat Oct  7 14:59:53 2006
+++ src/sys/arch/evbppc/obs405/obs266_autoconf.c	Thu Mar 18 14:04:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: obs266_autoconf.c,v 1.4 2006/10/07 14:59:53 tsutsui Exp $	*/
+/*	$NetBSD: obs266_autoconf.c,v 1.5 2010/03/18 14:04:07 kiyohara Exp $	*/
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,14 +33,17 @@
  * DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.4 2006/10/07 14:59:53 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.5 2010/03/18 14:04:07 kiyohara Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
 
 #include <machine/obs266.h>
 
-#include <powerpc/ibm4xx/dcr405gp.h>
+#include <powerpc/ibm4xx/cpu.h>
+#include <powerpc/ibm4xx/dcr4xx.h>
+
+#include <dev/ic/comreg.h>
 
 
 /*

Index: src/sys/arch/evbppc/virtex/autoconf.c
diff -u src/sys/arch/evbppc/virtex/autoconf.c:1.1 src/sys/arch/evbppc/virtex/autoconf.c:1.2
--- src/sys/arch/evbppc/virtex/autoconf.c:1.1	Sat Dec  2 22:18:47 2006
+++ src/sys/arch/evbppc/virtex/autoconf.c	Thu Mar 18 14:04:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.1 2006/12/02 22:18:47 freza Exp $ */
+/*	$NetBSD: autoconf.c,v 1.2 2010/03/18 14:04:07 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2006 Jachym Holecek
@@ -61,21 +61,21 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2006/12/02 22:18:47 freza Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2010/03/18 14:04:07 kiyohara Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
 #include <sys/device.h>
 #include <sys/systm.h>
 
-#include <powerpc/ibm4xx/dcr405gp.h>
+#include <powerpc/ibm4xx/spr.h>
 #include <powerpc/ibm4xx/dev/plbvar.h>
 
 
 /* List of port-specific devices to attach to the processor local bus. */
 static const struct plb_dev local_plb_devs [] = {
-	{ "xcvbus" },
-	{ NULL }
+	{ XILVIRTEX, "xcvbus" },
+	{ 0, NULL }
 };
 
 /*

Index: src/sys/arch/evbppc/virtex/virtex_start.S
diff -u src/sys/arch/evbppc/virtex/virtex_start.S:1.5 src/sys/arch/evbppc/virtex/virtex_start.S:1.6
--- src/sys/arch/evbppc/virtex/virtex_start.S:1.5	Thu Feb 25 23:33:44 2010
+++ src/sys/arch/evbppc/virtex/virtex_start.S	Thu Mar 18 14:04:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtex_start.S,v 1.5 2010/02/25 23:33:44 matt Exp $ */
+/*	$NetBSD: virtex_start.S,v 1.6 2010/03/18 14:04:07 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2006 Jachym Holecek
@@ -55,7 +55,7 @@
 
 #include <powerpc/spr.h>
 #include <powerpc/ibm4xx/spr.h>
-#include <powerpc/ibm4xx/dcr405gp.h>
+#include <powerpc/ibm4xx/dcr4xx.h>
 #include <powerpc/ibm4xx/pmap.h>
 
 

Index: src/sys/arch/evbppc/walnut/autoconf.c
diff -u src/sys/arch/evbppc/walnut/autoconf.c:1.17 src/sys/arch/evbppc/walnut/autoconf.c:1.18
--- src/sys/arch/evbppc/walnut/autoconf.c:1.17	Thu Feb 22 05:27:47 2007
+++ src/sys/arch/evbppc/walnut/autoconf.c	Thu Mar 18 14:04:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.17 2007/02/22 05:27:47 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.18 2010/03/18 14:04:07 kiyohara Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.17 2007/02/22 05:27:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18 2010/03/18 14:04:07 kiyohara Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -41,15 +41,16 @@
 
 #include <dev/ic/comreg.h>	/* For COM_FREQ */
 
-#include <powerpc/ibm4xx/dcr405gp.h>
+#include <powerpc/ibm4xx/dcr4xx.h>
 #include <powerpc/ibm4xx/dev/plbvar.h>
+#include <powerpc/ibm4xx/spr.h>
 
 /*
  * List of port-specific devices to attach to the processor local bus.
  */
 static const struct plb_dev local_plb_devs [] = {
-	{ "pbus", },
-	{ NULL }
+	{ IBM405GP, "pbus", },
+	{ 0, NULL }
 };
 
 /*

Index: src/sys/arch/evbppc/walnut/machdep.c
diff -u src/sys/arch/evbppc/walnut/machdep.c:1.45 src/sys/arch/evbppc/walnut/machdep.c:1.46
--- src/sys/arch/evbppc/walnut/machdep.c:1.45	Thu Feb 25 23:33:44 2010
+++ src/sys/arch/evbppc/walnut/machdep.c	Thu Mar 18 14:04:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.45 2010/02/25 23:33:44 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.46 2010/03/18 14:04:07 kiyohara Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.45 2010/02/25 23:33:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.46 2010/03/18 14:04:07 kiyohara Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -104,9 +104,11 @@
 
 #include <powerpc/spr.h>
 #include <powerpc/ibm4xx/spr.h>
-#include <powerpc/ibm4xx/dcr405gp.h>
+#include <powerpc/ibm4xx/dcr4xx.h>
 
 #include <dev/cons.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pciconf.h>
 
 #include "ksyms.h"
 
@@ -175,7 +177,7 @@
 	struct cpu_info * const ci = curcpu();
 
 	/* Disable all external interrupts */
-	mtdcr(DCR_UIC0_ER, 0);
+	mtdcr(DCR_UIC0_BASE + DCR_UIC_ER, 0);
 
         /* Initialize cache info for memcpy, etc. */
         cpu_probe_cache();
@@ -188,7 +190,7 @@
 	physmemr[0].start = 0;
 	physmemr[0].size = board_data.mem_size & ~PGOFSET;
 	/* Lower memory reserved by eval board BIOS */
-	availmemr[0].start = startkernel; 
+	availmemr[0].start = startkernel;
 	availmemr[0].size = board_data.mem_size - availmemr[0].start;
 
 	/* Linear map kernel memory */
@@ -244,11 +246,11 @@
 			memcpy((void *)EXC_DTMISS, &tlbdmiss4xx,
 				(size_t)&tlbdm4size);
 			break;
-		/* 
-		 * EXC_PIT, EXC_FIT, EXC_WDOG handlers 
-		 * are spaced by 0x10 bytes only.. 
+		/*
+		 * EXC_PIT, EXC_FIT, EXC_WDOG handlers
+		 * are spaced by 0x10 bytes only..
 		 */
-		case EXC_PIT:	
+		case EXC_PIT:
 			memcpy((void *)EXC_PIT, &pitfitwdog,
 				(size_t)&pitfitwdogsize);
 			break;
@@ -257,7 +259,7 @@
 				(size_t)&debugsize);
 			break;
 		case EXC_DTMISS|EXC_ALI:
-                        /* PPC405GP Rev D errata item 51 */	
+                        /* PPC405GP Rev D errata item 51 */
 			memcpy((void *)(EXC_DTMISS|EXC_ALI), &errata51handler,
 				(size_t)&errata51size);
 			break;
@@ -290,7 +292,7 @@
 	 * Now enable translation (and machine checks/recoverable interrupts).
 	 */
 	__asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0; isync"
-		      : : "r"(0), "K"(PSL_IR|PSL_DR)); 
+		      : : "r"(0), "K"(PSL_IR|PSL_DR));
 	/* XXXX PSL_ME - With ME set kernel gets stuck... */
 
 	uvm_setpagesize();
@@ -550,3 +552,70 @@
 	*mem = physmemr;
 	*avail = availmemr;
 }
+
+
+int
+pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
+{
+
+	/*
+	 * Bus number is irrelevant.  Configuration Mechanism 1 is in
+	 * use, can have devices 0-32 (i.e. the `normal' range).
+	 */
+	return 5;
+}
+
+int
+pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
+{
+	int pin = pa->pa_intrpin;
+	int dev = pa->pa_device;
+
+	if (pin == 0)
+		/* No IRQ used. */
+		goto bad;
+
+	if (pin > 4) {
+		printf("pci_intr_map: bad interrupt pin %d\n", pin);
+		goto bad;
+	}
+
+	/*
+	 * We need to map the interrupt pin to the interrupt bit in the UIC
+	 * associated with it.  This is highly machine-dependent.
+	 */
+	switch(dev) {
+	case 1:
+	case 2:
+	case 3:
+	case 4:
+		*ihp = 27 + dev;
+		break;
+	default:
+		printf("Hmm.. PCI device %d should not exist on this board\n",
+			dev);
+		goto bad;
+	}
+	return 0;
+
+bad:
+	*ihp = -1;
+	return 1;
+}
+
+void
+pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int pin,
+		   int swiz, int *iline)
+{
+
+	if (bus == 0)
+		switch(dev) {
+		case 1:
+		case 2:
+		case 3:
+		case 4:
+			*iline = 31 - dev;
+		}
+	else
+		*iline = 20 + ((swiz + dev + 1) & 3);
+}

Index: src/sys/arch/evbppc/walnut/walnut_start.S
diff -u src/sys/arch/evbppc/walnut/walnut_start.S:1.18 src/sys/arch/evbppc/walnut/walnut_start.S:1.19
--- src/sys/arch/evbppc/walnut/walnut_start.S:1.18	Thu Feb 25 23:33:44 2010
+++ src/sys/arch/evbppc/walnut/walnut_start.S	Thu Mar 18 14:04:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: walnut_start.S,v 1.18 2010/02/25 23:33:44 matt Exp $	*/
+/*	$NetBSD: walnut_start.S,v 1.19 2010/03/18 14:04:07 kiyohara Exp $	*/
 /*	$OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $	*/
 
 /*
@@ -89,7 +89,7 @@
 
 #include <powerpc/spr.h>
 #include <powerpc/ibm4xx/spr.h>
-#include <powerpc/ibm4xx/dcr405gp.h>
+#include <powerpc/ibm4xx/dcr4xx.h>
 #include <powerpc/ibm4xx/pmap.h>
 
 /* Function pointer for requesting board_config_data from openbios*/

Reply via email to