Module Name:    src
Committed By:   tsutsui
Date:           Mon Sep 23 16:41:57 UTC 2013

Modified Files:
        src/sys/arch/alpha/alpha: cpuconf.c
        src/sys/arch/alpha/pci: tsc.c tsp_dma.c tsreg.h tsvar.h

Log Message:
Add support for AlphaStation DS15.

Ported from OpenBSD via PR port-alpha/48148 by nullnilaki.
Note support for the secondary PCI bus still needs more improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/cpuconf.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/tsp_dma.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/pci/tsreg.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/alpha/pci/tsvar.h

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/alpha/alpha/cpuconf.c
diff -u src/sys/arch/alpha/alpha/cpuconf.c:1.35 src/sys/arch/alpha/alpha/cpuconf.c:1.36
--- src/sys/arch/alpha/alpha/cpuconf.c:1.35	Mon Feb  6 02:14:10 2012
+++ src/sys/arch/alpha/alpha/cpuconf.c	Mon Sep 23 16:41:56 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuconf.c,v 1.35 2012/02/06 02:14:10 matt Exp $ */
+/* $NetBSD: cpuconf.c,v 1.36 2013/09/23 16:41:56 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpuconf.c,v 1.35 2012/02/06 02:14:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpuconf.c,v 1.36 2013/09/23 16:41:56 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -233,6 +233,7 @@ static const struct cpuinit cpuinit[] = 
 	cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
 	cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
 	cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
+	cpu_init(ST_DEC_TITAN, dec_6600_init, "DEC_6600"), 
 	cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"),
 };
 static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0]));

Index: src/sys/arch/alpha/pci/tsc.c
diff -u src/sys/arch/alpha/pci/tsc.c:1.19 src/sys/arch/alpha/pci/tsc.c:1.20
--- src/sys/arch/alpha/pci/tsc.c:1.19	Tue May 17 17:34:47 2011
+++ src/sys/arch/alpha/pci/tsc.c	Mon Sep 23 16:41:57 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: tsc.c,v 1.19 2011/05/17 17:34:47 dyoung Exp $ */
+/* $NetBSD: tsc.c,v 1.20 2013/09/23 16:41:57 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.19 2011/05/17 17:34:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.20 2013/09/23 16:41:57 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -66,7 +66,7 @@ CFATTACH_DECL_NEW(tsc, 0, tscmatch, tsca
 
 extern struct cfdriver tsc_cd;
 
-struct tsp_config tsp_configuration[2];
+struct tsp_config tsp_configuration[4];
 
 static int tscprint(void *, const char *pnp);
 
@@ -91,9 +91,13 @@ tscmatch(device_t parent, cfdata_t match
 {
 	struct mainbus_attach_args *ma = aux;
 
-	return cputype == ST_DEC_6600
-	    && strcmp(ma->ma_name, tsc_cd.cd_name) == 0
-	    && !tscfound;
+	switch (cputype) {
+	case ST_DEC_6600:
+	case ST_DEC_TITAN:
+		return strcmp(ma->ma_name, tsc_cd.cd_name) == 0 && !tscfound;
+	default:
+		return 0;
+	}
 }
 
 static void
@@ -104,15 +108,16 @@ tscattach(device_t parent, device_t self
 	uint64_t csc, aar;
 	struct tsp_attach_args tsp;
 	struct mainbus_attach_args *ma = aux;
+	int titan = cputype == ST_DEC_TITAN;
 
 	tscfound = 1;
 
 	csc = LDQP(TS_C_CSC);
 
 	nbus = 1 + (CSC_BC(csc) >= 2);
-	printf(": 21272 Core Logic Chipset, Cchip rev %d\n"
+	printf(": 2127%c Core Logic Chipset, Cchip rev %d\n"
 		"%s%d: %c Dchips, %d memory bus%s of %d bytes\n",
-		(int)MISC_REV(LDQP(TS_C_MISC)),
+		titan ? '4' : '2', (int)MISC_REV(LDQP(TS_C_MISC)),
 		ma->ma_name, ma->ma_slot, "2448"[CSC_BC(csc)],
 		nbus, nbus > 1 ? "es" : "", 16 + 16 * ((csc & CSC_AW) != 0));
 	printf("%s%d: arrays present: ", ma->ma_name, ma->ma_slot);
@@ -125,11 +130,21 @@ tscattach(device_t parent, device_t self
 
 	memset(&tsp, 0, sizeof tsp);
 	tsp.tsp_name = "tsp";
-	config_found(self, &tsp, NULL);
+	tsp.tsp_slot = 0; 
+	
+	config_found(self, &tsp, tscprint);
+	if (titan) {
+		tsp.tsp_slot += 2;
+		config_found(self, &tsp, tscprint);
+	}
 
-	if(LDQP(TS_C_CSC) & CSC_P1P) {
-		++tsp.tsp_slot;
+	if (csc & CSC_P1P) {
+		tsp.tsp_slot = 1;
 		config_found(self, &tsp, tscprint);
+		if (titan) {
+			tsp.tsp_slot += 2;
+			config_found(self, &tsp, tscprint);
+		}
 	}
 }
 
@@ -150,8 +165,13 @@ tspmatch(device_t parent, cfdata_t match
 {
 	struct tsp_attach_args *t = aux;
 
-	return  cputype == ST_DEC_6600
-	    && strcmp(t->tsp_name, tsp_cd.cd_name) == 0;
+	switch (cputype) {
+	case ST_DEC_6600:
+	case ST_DEC_TITAN:
+		return strcmp(t->tsp_name, tsp_cd.cd_name) == 0;
+	default:
+		return 0;
+	}
 }
 
 static void
@@ -193,12 +213,24 @@ tsp_init(int mallocsafe, int n)
 	/* n:	 Pchip number */
 {
 	struct tsp_config *pcp;
+	int titan = cputype == ST_DEC_TITAN;
 
-	KASSERT((n | 1) == 1);
+	KASSERT(n >= 0 && n < __arraycount(tsp_configuration));
 	pcp = &tsp_configuration[n];
 	pcp->pc_pslot = n;
 	pcp->pc_iobase = TS_Pn(n, 0);
-	pcp->pc_csr = S_PAGE(TS_Pn(n, P_CSRBASE));
+	pcp->pc_csr = S_PAGE(TS_Pn(n & 1, P_CSRBASE));
+	if (n & 2) {
+		/* `A' port of PA Chip */
+		pcp->pc_csr++;
+	}
+	if (titan) {
+		/* same address on G and A ports */
+		pcp->pc_tlbia = &pcp->pc_csr->port.g.tsp_tlbia.tsg_r;
+	} else {
+		pcp->pc_tlbia = &pcp->pc_csr->port.p.tsp_tlbia.tsg_r;
+	}
+
 	if (!pcp->pc_initted) {
 		tsp_bus_io_init(&pcp->pc_iot, pcp);
 		tsp_bus_mem_init(&pcp->pc_memt, pcp);

Index: src/sys/arch/alpha/pci/tsp_dma.c
diff -u src/sys/arch/alpha/pci/tsp_dma.c:1.12 src/sys/arch/alpha/pci/tsp_dma.c:1.13
--- src/sys/arch/alpha/pci/tsp_dma.c:1.12	Mon Feb  6 02:14:15 2012
+++ src/sys/arch/alpha/pci/tsp_dma.c	Mon Sep 23 16:41:57 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: tsp_dma.c,v 1.12 2012/02/06 02:14:15 matt Exp $ */
+/* $NetBSD: tsp_dma.c,v 1.13 2013/09/23 16:41:57 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 1.12 2012/02/06 02:14:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 1.13 2013/09/23 16:41:57 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,10 +118,10 @@ tsp_dma_init(struct tsp_config *pcp)
 	static struct map_expected {
 		uint32_t base, mask, enables;
 	} premap[4] = {
-		{ 0x800000, 		   0x700000, WSBA_ENA | WSBA_SG },
-		{ 0x80000000 | WSBA_ENA, 0x3ff00000, WSBA_ENA           },
-		{ 0, 0 },
-		{ 0, 0 }
+		{ 0x00800000, 0x00700000, WSBA_ENA | WSBA_SG },
+		{ 0x80000000, 0x3ff00000, WSBA_ENA           },
+		{ 0, 0, 0 },
+		{ 0, 0, 0 }
 	};
 
 	alpha_mb();
@@ -207,6 +207,14 @@ tsp_dma_init(struct tsp_config *pcp)
 	alpha_mb();
 
 	/*
+	 * Enable window 1 in direct mode.
+	 */
+	alpha_mb();
+	pccsr->tsp_wsba[1].tsg_r =
+	    (pccsr->tsp_wsba[1].tsg_r & ~WSBA_SG) | WSBA_ENA;
+	alpha_mb();
+
+	/*
 	 * Check windows for sanity, especially if we later decide to
 	 * use the firmware's initialization in some cases.
 	 */
@@ -354,6 +362,6 @@ tsp_tlb_invalidate(struct tsp_config *pc
 {
 
 	alpha_mb();
-	pcp->pc_csr->tsp_tlbia.tsg_r = 0;
+	*pcp->pc_tlbia = 0;
 	alpha_mb();
 }

Index: src/sys/arch/alpha/pci/tsreg.h
diff -u src/sys/arch/alpha/pci/tsreg.h:1.5 src/sys/arch/alpha/pci/tsreg.h:1.6
--- src/sys/arch/alpha/pci/tsreg.h:1.5	Mon Feb  6 02:14:15 2012
+++ src/sys/arch/alpha/pci/tsreg.h	Mon Sep 23 16:41:57 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: tsreg.h,v 1.5 2012/02/06 02:14:15 matt Exp $ */
+/* $NetBSD: tsreg.h,v 1.6 2013/09/23 16:41:57 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -186,7 +186,7 @@
  */
 
 #define	P_CSRBASE	 0x001##8000##0000UL
-#define	P_PCI_MEM	 0
+#define	P_PCI_MEM	 0x800##0000##0000UL
 #define	P_PCI_IO	 0x001##fc00##0000UL
 #define	P_PCI_CONFIG	 0x001##fe00##0000UL
 
@@ -209,15 +209,7 @@ typedef struct _ts_gr {
 /*
  * Tsunami Pchip
  */
-struct	ts_pchip {
-	TS_GR	tsp_wsba[4];	/* Window Space Base Address */
-
-	TS_GR	tsp_wsm[4];	/* Window Space Mask */
-
-	TS_GR	tsp_tba[4];	/* Translated Base Address */
-
-	TS_GR	tsp_pctl;	/* Pchip Control */
-	TS_GR	tsp_plat;	/* Pchip Latency */
+struct	ts_pport {
 	TS_GR	tsp_resA;
 	TS_GR	tsp_error;	/* Pchip Error */
 
@@ -232,6 +224,56 @@ struct	ts_pchip {
 	TS_GR	tsp_resC;
 
 	TS_GR	tsp_resD_K[8];
+};
+
+struct	ts_gport {
+	TS_GR	tsp_resA[2];
+	TS_GR	tsp_serror;
+	TS_GR	tsp_serrmask;
+	TS_GR	tsp_serrset;
+	TS_GR	tsp_resB;
+	TS_GR	tsp_gperrmask;
+	TS_GR	tsp_gperren;
+	TS_GR	tsp_gperrset;
+	TS_GR	tsp_resC;
+	TS_GR	tsp_tlbiv;
+	TS_GR	tsp_tlbia;
+	TS_GR	tsp_resD[2];
+	TS_GR	tsp_sctl;
+	TS_GR	tsp_resE[3];
+};
+
+struct	ts_aport {
+	TS_GR	tsp_resA[2];
+	TS_GR	tsp_agperror;
+	TS_GR	tsp_agperrmask;
+	TS_GR	tsp_agperrset;
+	TS_GR	tsp_agplastwr;
+	TS_GR	tsp_aperror;
+	TS_GR	tsp_aperrmask;
+	TS_GR	tsp_aperrset;
+	TS_GR	tsp_resB;
+	TS_GR	tsp_tlbiv;
+	TS_GR	tsp_tlbia;
+	TS_GR	tsp_resC[6];
+};
+
+struct	ts_pchip {
+	TS_GR	tsp_wsba[4];	/* Window Space Base Address */
+
+	TS_GR	tsp_wsm[4];	/* Window Space Mask */
+
+	TS_GR	tsp_tba[4];	/* Translated Base Address */
+
+	TS_GR	tsp_pctl;	/* Pchip Control */
+	TS_GR	tsp_plat;	/* Pchip Latency */
+
+	union {
+		struct ts_pport	p;
+		struct ts_gport	g;
+		struct ts_aport	a;
+	} port;
 
 	TS_GR	tsp_sprts;	/* ??? */
+	TS_GR   tsp_res[31];
 };

Index: src/sys/arch/alpha/pci/tsvar.h
diff -u src/sys/arch/alpha/pci/tsvar.h:1.10 src/sys/arch/alpha/pci/tsvar.h:1.11
--- src/sys/arch/alpha/pci/tsvar.h:1.10	Mon Feb  6 02:14:15 2012
+++ src/sys/arch/alpha/pci/tsvar.h	Mon Sep 23 16:41:57 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: tsvar.h,v 1.10 2012/02/06 02:14:15 matt Exp $ */
+/* $NetBSD: tsvar.h,v 1.11 2013/09/23 16:41:57 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -44,6 +44,7 @@ struct tsp_config {
 	int	pc_initted;		/* Initialized */
 	uint64_t pc_iobase;		/* All Pchip space starts here */
 	struct	ts_pchip *pc_csr;	/* Pchip CSR space starts here */
+	volatile uint64_t *pc_tlbia;  	/* Pchip TLBIA register address */ 
 
 	struct	alpha_bus_space pc_iot, pc_memt;
 	struct	alpha_pci_chipset pc_pc;

Reply via email to