Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 - properly map the schizo interrupt registe...
details: https://anonhg.NetBSD.org/src/rev/eca20267fbbd
branches: trunk
changeset: 751502:eca20267fbbd
user: mrg <mrg%NetBSD.org@localhost>
date: Sat Feb 06 00:23:30 2010 +0000
description:
- properly map the schizo interrupt registers, so we can use the normal
virtual mappings to access them.
- with the above fxied, kill SCHIZO_BUS_SPACE_BROKEN, and introduce
an options CHEETAH for now, that disables the SPITFIRE code in locore.
- merge schizo_init() into schizo_attach() and clean up the softc a bit.
with this we are only one more step away from GENERIC booting on USIII
machines.
diffstat:
sys/arch/sparc64/conf/SCHIZO | 6 +-
sys/arch/sparc64/dev/schizo.c | 61 +++++++++++++++++++++-----------------
sys/arch/sparc64/dev/schizovar.h | 9 +++-
sys/arch/sparc64/sparc64/locore.s | 10 +----
4 files changed, 45 insertions(+), 41 deletions(-)
diffs (258 lines):
diff -r 3b6221ff10f8 -r eca20267fbbd sys/arch/sparc64/conf/SCHIZO
--- a/sys/arch/sparc64/conf/SCHIZO Fri Feb 05 22:07:51 2010 +0000
+++ b/sys/arch/sparc64/conf/SCHIZO Sat Feb 06 00:23:30 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: SCHIZO,v 1.4 2010/01/28 06:04:23 mrg Exp $
+# $NetBSD: SCHIZO,v 1.5 2010/02/06 00:23:30 mrg Exp $
#
# GENERIC with schizo support enabled, with the annoying schizo interupt
# option
@@ -7,9 +7,9 @@
include "arch/sparc64/conf/GENERIC.MP"
#include "arch/sparc64/conf/GENERIC"
-#ident "SCHIZO.$Revision: 1.4 $"
+#ident "SCHIZO.$Revision: 1.5 $"
-options SCHIZO_BUS_SPACE_BROKEN
+options CHEETAH
makeoptions DEBUG="-g"
options DEBUG
diff -r 3b6221ff10f8 -r eca20267fbbd sys/arch/sparc64/dev/schizo.c
--- a/sys/arch/sparc64/dev/schizo.c Fri Feb 05 22:07:51 2010 +0000
+++ b/sys/arch/sparc64/dev/schizo.c Sat Feb 06 00:23:30 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: schizo.c,v 1.12 2010/01/06 05:55:01 mrg Exp $ */
+/* $NetBSD: schizo.c,v 1.13 2010/02/06 00:23:30 mrg Exp $ */
/* $OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $ */
/*
@@ -72,7 +72,6 @@
CFATTACH_DECL(schizo, sizeof(struct schizo_softc),
schizo_match, schizo_attach, NULL, NULL);
-void schizo_init(struct schizo_softc *);
void schizo_init_iommu(struct schizo_softc *, struct schizo_pbm *);
void schizo_set_intr(struct schizo_softc *, struct schizo_pbm *, int,
@@ -136,7 +135,10 @@
{
struct schizo_softc *sc = (struct schizo_softc *)self;
struct mainbus_attach_args *ma = aux;
- uint64_t eccctrl;
+ struct schizo_pbm *pbm;
+ struct pcibus_attach_args pba;
+ uint64_t reg, eccctrl;
+ int *busranges = NULL, nranges;
char *str;
printf(": addr %lx", ma->ma_reg[0].ur_paddr);
@@ -147,10 +149,8 @@
sc->sc_node = ma->ma_node;
sc->sc_dmat = ma->ma_dmatag;
sc->sc_bustag = ma->ma_bustag;
- sc->sc_ctrl = ma->ma_reg[1].ur_paddr - 0x10000UL;
- sc->sc_reg0 = ma->ma_reg[0];
- if (bus_space_map(sc->sc_bustag, sc->sc_ctrl,
+ if (bus_space_map(sc->sc_bustag, ma->ma_reg[1].ur_paddr - 0x10000UL,
sizeof(struct schizo_regs), 0,
&sc->sc_ctrlh)) {
printf(": failed to map registers\n");
@@ -166,17 +166,6 @@
SCZ_ECCCTRL_CE_INTEN;
schizo_write(sc, SCZ_ECCCTRL, eccctrl);
- schizo_init(sc);
-}
-
-void
-schizo_init(struct schizo_softc *sc)
-{
- struct schizo_pbm *pbm;
- struct pcibus_attach_args pba;
- int *busranges = NULL, nranges;
- u_int64_t /*match,*/ reg;
-
pbm = malloc(sizeof(*pbm), M_DEVBUF, M_NOWAIT | M_ZERO);
if (pbm == NULL)
panic("schizo: can't alloc schizo pbm");
@@ -184,11 +173,21 @@
pbm->sp_sc = sc;
pbm->sp_regt = sc->sc_bustag;
- if ((sc->sc_reg0.ur_paddr & 0x00700000) == 0x00600000)
+ if ((ma->ma_reg[0].ur_paddr & 0x00700000) == 0x00600000)
pbm->sp_bus_a = 1;
else
pbm->sp_bus_a = 0;
+ /*
+ * Map interrupt registers
+ */
+ if (bus_space_map(sc->sc_bustag, ma->ma_reg[0].ur_paddr,
+ ma->ma_reg[0].ur_len,
+ BUS_SPACE_MAP_LINEAR, &pbm->sp_intrh)) {
+ printf(": failed to interrupt map registers\n");
+ return;
+ }
+
if (prom_getprop(sc->sc_node, "ranges", sizeof(struct schizo_range),
&pbm->sp_nrange, (void **)&pbm->sp_range))
panic("schizo: can't get ranges");
@@ -382,6 +381,9 @@
vaddr_t va;
char *name;
+ if (prom_getproplen(sc->sc_node, "no-streaming-cache") < 0) {
+ }
+
va = (vaddr_t)pbm->sp_flush[0x40];
/* punch in our copies */
@@ -483,6 +485,7 @@
{
struct intrhand *ih;
u_int64_t mapoff, clroff;
+ uintptr_t intrregs;
DPRINTF(SDB_INTR, ("%s: ino %x ign %x fn %p arg %p", __func__,
ino, sc->sc_ign, handler, arg));
@@ -498,8 +501,9 @@
if (ih == NULL)
return;
ih->ih_arg = arg;
- ih->ih_map = (uint64_t *)((char *)sc->sc_reg0.ur_paddr + mapoff);
- ih->ih_clr = (uint64_t *)((char *)sc->sc_reg0.ur_paddr + clroff);
+ intrregs = (uintptr_t)bus_space_vaddr(pbm->sp_regt, pbm->sp_intrh);
+ ih->ih_map = (uint64_t *)(intrregs + mapoff);
+ ih->ih_clr = (uint64_t *)(intrregs + clroff);
ih->ih_fun = handler;
ih->ih_pil = (1<<ipl);
ih->ih_number = INTVEC(schizo_pbm_read(pbm, mapoff));
@@ -708,9 +712,9 @@
int (*handler)(void *), void *arg, void (*fastvec)(void) /* ignored */)
{
struct schizo_pbm *pbm = t->cookie;
- struct schizo_softc *sc = pbm->sp_sc;
struct intrhand *ih = NULL;
uint64_t mapoff, clroff;
+ uintptr_t intrregs;
volatile uint64_t *intrmapptr = NULL, *intrclrptr = NULL;
int ino;
long vec;
@@ -738,11 +742,12 @@
DPRINTF(SDB_INTR, ("%s: intr %x: %p mapoff %lx clroff %lx\n",
__func__, ino, intrlev[ino], mapoff, clroff));
- intrmapptr = (uint64_t *)((char *)sc->sc_reg0.ur_paddr + mapoff);
- intrclrptr = (uint64_t *)((char *)sc->sc_reg0.ur_paddr + clroff);
+ intrregs = (uintptr_t)bus_space_vaddr(pbm->sp_regt, pbm->sp_intrh);
+ intrmapptr = (uint64_t *)(intrregs + mapoff);
+ intrclrptr = (uint64_t *)(intrregs + clroff);
if (INTIGN(vec) == 0)
- ino |= schizo_pbm_read(pbm, mapoff) & INTMAP_IGN;
+ ino |= schizo_pbm_readintr(pbm, mapoff) & INTMAP_IGN;
else
ino |= vec & INTMAP_IGN;
@@ -769,22 +774,22 @@
if (intrmapptr) {
u_int64_t imap;
- imap = schizo_pbm_read(pbm, mapoff);
+ imap = schizo_pbm_readintr(pbm, mapoff);
DPRINTF(SDB_INTR, ("; read intrmap = %016qx",
(unsigned long long)imap));
imap |= INTMAP_V;
DPRINTF(SDB_INTR, ("; addr of intrmapptr = %p", intrmapptr));
DPRINTF(SDB_INTR, ("; writing intrmap = %016qx\n",
(unsigned long long)imap));
- schizo_pbm_write(pbm, mapoff, imap);
- imap = schizo_pbm_read(pbm, mapoff);
+ schizo_pbm_writeintr(pbm, mapoff, imap);
+ imap = schizo_pbm_readintr(pbm, mapoff);
DPRINTF(SDB_INTR, ("; reread intrmap = %016qx",
(unsigned long long)imap));
ih->ih_number |= imap & INTMAP_INR;
}
if (intrclrptr) {
/* set state to IDLE */
- schizo_pbm_write(pbm, clroff, 0);
+ schizo_pbm_writeintr(pbm, clroff, 0);
}
return (ih);
diff -r 3b6221ff10f8 -r eca20267fbbd sys/arch/sparc64/dev/schizovar.h
--- a/sys/arch/sparc64/dev/schizovar.h Fri Feb 05 22:07:51 2010 +0000
+++ b/sys/arch/sparc64/dev/schizovar.h Sat Feb 06 00:23:30 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: schizovar.h,v 1.3 2008/12/13 08:07:23 mrg Exp $ */
+/* $NetBSD: schizovar.h,v 1.4 2010/02/06 00:23:30 mrg Exp $ */
/* $OpenBSD: schizovar.h,v 1.10 2007/01/14 16:19:49 kettenis Exp $ */
/*
@@ -40,6 +40,7 @@
bus_space_tag_t sp_iot;
bus_space_tag_t sp_regt;
bus_space_handle_t sp_regh;
+ bus_space_handle_t sp_intrh;
bus_space_tag_t sp_cfgt;
bus_space_handle_t sp_cfgh;
bus_dma_tag_t sp_dmat;
@@ -57,10 +58,8 @@
int sc_ign;
bus_dma_tag_t sc_dmat;
bus_space_tag_t sc_bustag;
- bus_addr_t sc_ctrl;
bus_space_handle_t sc_ctrlh;
bus_space_handle_t sc_confh;
- struct upa_reg sc_reg0;
int sc_busa;
int sc_tomatillo;
@@ -74,6 +73,10 @@
bus_space_read_8((pbm)->sp_regt, (pbm)->sp_regh, (r))
#define schizo_pbm_write(pbm,r,v) \
bus_space_write_8((pbm)->sp_regt, (pbm)->sp_regh, (r), (v))
+#define schizo_pbm_readintr(pbm,r) \
+ bus_space_read_8((pbm)->sp_regt, (pbm)->sp_intrh, (r))
+#define schizo_pbm_writeintr(pbm,r,v) \
+ bus_space_write_8((pbm)->sp_regt, (pbm)->sp_intrh, (r), (v))
#define schizo_cfg_read(pbm,r) \
bus_space_read_4((pbm)->sp_cfgt, (pbm)->sp_cfgh, (r))
#define schizo_cfg_write(pbm,r,v) \
diff -r 3b6221ff10f8 -r eca20267fbbd sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Fri Feb 05 22:07:51 2010 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Sat Feb 06 00:23:30 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.310 2010/02/02 04:28:56 mrg Exp $ */
+/* $NetBSD: locore.s,v 1.311 2010/02/06 00:23:30 mrg Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath
@@ -55,8 +55,8 @@
* @(#)locore.s 8.4 (Berkeley) 12/10/93
*/
-#ifndef SCHIZO_BUS_SPACE_BROKEN /* Need phys access for USIII so far */
-#define SPITFIRE /* Cheetah (USIII) */
+#ifndef CHEETAH
+#define SPITFIRE
#endif
#undef PARANOID /* Extremely expensive consistency checks */
#undef NO_VCACHE /* Map w/D$ disabled */
@@ -3946,11 +3946,7 @@
brz,pn %l1, 0f
add %l5, %o0, %l5
-#ifdef SCHIZO_BUS_SPACE_BROKEN
- stxa %g0, [%l1] ASI_PHYS_NON_CACHED ! Clear intr source
-#else
stx %g0, [%l1] ! Clear intr source
-#endif
membar #Sync ! Should not be needed
0:
cmp %l7, -1
Home |
Main Index |
Thread Index |
Old Index