From fc4d473eed934a024117cd7db864e0176ed14fd8 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Sat, 22 Feb 2003 19:54:44 +0000 Subject: rearrange allocations and such so that this actually attaches (still panics when attaching the pcibus... Still working on it =) --- sys/arch/sparc64/dev/schizo.c | 24 ++++++++++++++++-------- sys/arch/sparc64/dev/schizovar.h | 4 ++-- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'sys') diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c index 931ebc48669..77691e871fb 100644 --- a/sys/arch/sparc64/dev/schizo.c +++ b/sys/arch/sparc64/dev/schizo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: schizo.c,v 1.9 2003/02/17 01:29:20 henric Exp $ */ +/* $OpenBSD: schizo.c,v 1.10 2003/02/22 19:54:43 jason Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -176,12 +176,6 @@ schizo_init(struct schizo_softc *sc, int busa) printf(": bus %c %d to %d\n", busa ? 'A' : 'B', busranges[0], busranges[1]); - schizo_init_iommu(sc, pbm); - - match = bus_space_read_8(sc->sc_bust, sc->sc_ctrlh, - (busa ? SCZ_PCIA_IO_MATCH : SCZ_PCIB_IO_MATCH)); - pbm->sp_confpaddr = match & ~0x8000000000000000UL; - pbm->sp_regt = sc->sc_bust; if (bus_space_subregion(pbm->sp_regt, sc->sc_ctrlh, busa ? offsetof(struct schizo_regs, pbm_a) : @@ -191,6 +185,12 @@ schizo_init(struct schizo_softc *sc, int busa) panic("schizo: unable to create PBM handle"); } + schizo_init_iommu(sc, pbm); + + match = bus_space_read_8(sc->sc_bust, sc->sc_ctrlh, + (busa ? SCZ_PCIA_IO_MATCH : SCZ_PCIB_IO_MATCH)); + pbm->sp_confpaddr = match & ~0x8000000000000000UL; + pbm->sp_memt = schizo_alloc_mem_tag(pbm); pbm->sp_iot = schizo_alloc_io_tag(pbm); pbm->sp_cfgt = schizo_alloc_config_tag(pbm); @@ -225,21 +225,28 @@ void schizo_init_iommu(struct schizo_softc *sc, struct schizo_pbm *pbm) { struct iommu_state *is = &pbm->sp_is; + vaddr_t va; char *name; + va = (vaddr_t)pbm->sp_flush[0x40]; + is->is_bustag = pbm->sp_regt; - + if (bus_space_subregion(is->is_bustag, pbm->sp_regh, offsetof(struct schizo_pbm_regs, iommu), sizeof(struct iommureg), &is->is_iommu)) { panic("schizo: unable to create iommu handle"); } + is->is_sb[0] = &pbm->sp_sb; is->is_sb[0]->sb_bustag = is->is_bustag; + is->is_sb[0]->sb_flush = (void *)(va & ~0x3f); + if (bus_space_subregion(is->is_bustag, pbm->sp_regh, offsetof(struct schizo_pbm_regs, strbuf), sizeof(struct iommu_strbuf), &is->is_sb[0]->sb_sb)) { panic("schizo: unable to create streaming buffer handle"); + is->is_sb[0]->sb_flush = 0; } #if 1 @@ -256,6 +263,7 @@ schizo_init_iommu(struct schizo_softc *sc, struct schizo_pbm *pbm) snprintf(name, 32, "%s dvma", sc->sc_dv.dv_xname); iommu_init(name, is, 128 * 1024, 0xc0000000); + iommu_reset(is); } int diff --git a/sys/arch/sparc64/dev/schizovar.h b/sys/arch/sparc64/dev/schizovar.h index d84b48d333f..d0b76338ade 100644 --- a/sys/arch/sparc64/dev/schizovar.h +++ b/sys/arch/sparc64/dev/schizovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: schizovar.h,v 1.3 2003/02/17 01:29:20 henric Exp $ */ +/* $OpenBSD: schizovar.h,v 1.4 2003/02/22 19:54:43 jason Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -53,7 +53,7 @@ struct schizo_pbm { bus_addr_t sp_confpaddr; struct iommu_state sp_is; struct strbuf_ctl sp_sb; - char pp_flush[0x80]; + char sp_flush[0x80]; }; struct schizo_softc { -- cgit v1.2.3