From 5e4e9f8b768b5c6a28b9b320e5262e67db343b1a Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 28 Jun 2006 20:09:16 +0000 Subject: cleanup dmesg logging for iommu goo, make it follow the standard form --- sys/arch/sparc64/dev/iommu.c | 18 +++++++++--------- sys/arch/sparc64/dev/psycho.c | 40 ++++++++++++++++++++-------------------- sys/arch/sparc64/dev/sbus.c | 3 ++- sys/arch/sparc64/dev/schizo.c | 6 ++++-- 4 files changed, 35 insertions(+), 32 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c index 60558c52c01..3ffa4930f2f 100644 --- a/sys/arch/sparc64/dev/iommu.c +++ b/sys/arch/sparc64/dev/iommu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iommu.c,v 1.38 2005/06/07 20:40:01 kurt Exp $ */ +/* $OpenBSD: iommu.c,v 1.39 2006/06/28 20:09:15 deraadt Exp $ */ /* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */ /* @@ -65,7 +65,7 @@ #define IDB_XXX 0x10 #define IDB_PRINT_MAP 0x20 #define IDB_BREAK 0x40 -int iommudebug = 0x0; +int iommudebug = IDB_INFO; #define DPRINTF(l, s) do { if (iommudebug & l) printf s; } while (0) #else #define DPRINTF(l, s) @@ -208,21 +208,21 @@ iommu_init(char *name, struct iommu_state *is, int tsbsize, u_int32_t iovabase) } #endif - /* - * now actually start up the IOMMU - */ - iommu_reset(is); - /* * Now all the hardware's working we need to allocate a dvma map. */ - printf("DVMA map: %x to %x\n", is->is_dvmabase, is->is_dvmaend); - printf("IOTDB: %llx to %llx\n", + printf("dvma map %x-%x, ", is->is_dvmabase, is->is_dvmaend - 1); + printf("iotdb %llx-%llx", (unsigned long long)is->is_ptsb, (unsigned long long)(is->is_ptsb + size)); is->is_dvmamap = extent_create(name, is->is_dvmabase, is->is_dvmaend - PAGE_SIZE, M_DEVBUF, 0, 0, EX_NOWAIT); + + /* + * now actually start up the IOMMU + */ + iommu_reset(is); } /* diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index 53c24be1878..c5124faef8a 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psycho.c,v 1.44 2006/06/27 21:22:14 kettenis Exp $ */ +/* $OpenBSD: psycho.c,v 1.45 2006/06/28 20:09:15 deraadt Exp $ */ /* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */ /* @@ -229,8 +229,6 @@ psycho_attach(struct device *parent, struct device *self, void *aux) int psycho_br[2], n; struct psycho_type *ptype; - printf("\n"); - sc->sc_node = ma->ma_node; sc->sc_bustag = ma->ma_bustag; sc->sc_dmatag = ma->ma_dmatag; @@ -303,7 +301,7 @@ psycho_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_mode == PSYCHO_MODE_PSYCHO) sc->sc_ign = PSYCHO_GCSR_IGN(csr) << 6; - printf("%s: impl %d, version %d: ign %x ", ptype->p_name, + printf(": %s, impl %d, version %d, ign %x\n", ptype->p_name, PSYCHO_GCSR_IMPL(csr), PSYCHO_GCSR_VERS(csr), sc->sc_ign); /* @@ -360,8 +358,8 @@ psycho_attach(struct device *parent, struct device *self, void *aux) pba.pba_bus = psycho_br[0]; pba.pba_bridgetag = NULL; - printf("bus range %u to %u", psycho_br[0], psycho_br[1]); - printf("; PCI bus %d", psycho_br[0]); + printf("%s: bus range %u-%u, PCI bus %d", sc->sc_dev.dv_xname, + psycho_br[0], psycho_br[1], psycho_br[0]); pp->pp_pcictl = sc->sc_pcictl; @@ -378,8 +376,6 @@ psycho_attach(struct device *parent, struct device *self, void *aux) /* setup the rest of the psycho pbm */ pba.pba_pc = pp->pp_pc; - printf("\n"); - /* * And finally, if we're a sabre or the first of a pair of psycho's to * arrive here, start up the IOMMU and get a config space tag. @@ -480,7 +476,9 @@ psycho_attach(struct device *parent, struct device *self, void *aux) /* Point out iommu at the strbuf_ctl. */ sc->sc_is->is_sb[0] = &pp->pp_sb; + printf(", "); psycho_iommu_init(sc, 2); + printf("\n"); sc->sc_configtag = psycho_alloc_config_tag(sc->sc_psycho_this); if (bus_space_map(sc->sc_configtag, @@ -520,6 +518,14 @@ psycho_attach(struct device *parent, struct device *self, void *aux) /* Point out iommu at the strbuf_ctl. */ sc->sc_is->is_sb[1] = &pp->pp_sb; + printf(", "); + printf("dvma map %x-%x, ", sc->sc_is->is_dvmabase, + sc->sc_is->is_dvmaend); + printf("iotdb %llx-%llx", + (unsigned long long)sc->sc_is->is_ptsb, + (unsigned long long)(sc->sc_is->is_ptsb + + (PAGE_SIZE << sc->sc_is->is_tsbsize))); + printf("\n"); iommu_reset(sc->sc_is); } @@ -797,11 +803,10 @@ psycho_wakeup(void *arg) void psycho_iommu_init(struct psycho_softc *sc, int tsbsize) { - char *name; struct iommu_state *is = sc->sc_is; + int *vdma = NULL, nitem; u_int32_t iobase = -1; - int *vdma = NULL; - int nitem; + char *name; /* punch in our copies */ is->is_bustag = sc->sc_bustag; @@ -810,15 +815,11 @@ psycho_iommu_init(struct psycho_softc *sc, int tsbsize) &is->is_iommu); /* - * Separate the men from the boys. Get the `virtual-dma' - * property for sabre and use that to make sure the damn - * iommu works. - * - * We could query the `#virtual-dma-size-cells' and - * `#virtual-dma-addr-cells' and DTRT, but I'm lazy. + * Separate the men from the boys. If it has a `virtual-dma' + * property, use it. */ if (!getprop(sc->sc_node, "virtual-dma", sizeof(vdma), &nitem, - (void **)&vdma)) { + (void **)&vdma)) { /* Damn. Gotta use these values. */ iobase = vdma[0]; #define TSBCASE(x) case 1 << ((x) + 23): tsbsize = (x); break @@ -832,8 +833,7 @@ psycho_iommu_init(struct psycho_softc *sc, int tsbsize) #undef TSBCASE DPRINTF(PDB_CONF, ("psycho_iommu_init: iobase=0x%x\n", iobase)); free(vdma, M_DEVBUF); - } - else { + } else { DPRINTF(PDB_CONF, ("psycho_iommu_init: getprop failed, " "iobase=0x%x\n", iobase)); } diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c index 3866dc7da20..33eedf40d71 100644 --- a/sys/arch/sparc64/dev/sbus.c +++ b/sys/arch/sparc64/dev/sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbus.c,v 1.25 2006/06/27 20:20:48 jason Exp $ */ +/* $OpenBSD: sbus.c,v 1.26 2006/06/28 20:09:15 deraadt Exp $ */ /* $NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp $ */ /*- @@ -352,6 +352,7 @@ sbus_mb_attach(struct device *parent, struct device *self, void *aux) panic("couldn't malloc iommu name"); snprintf(name, 32, "%s dvma", sc->sc_dev.dv_xname); + printf("%s: ", sc->sc_dev.dv_xname); iommu_init(name, &sc->sc_is, 0, -1); /* Enable the over temp intr */ diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c index 34671b78643..3ea692361f0 100644 --- a/sys/arch/sparc64/dev/schizo.c +++ b/sys/arch/sparc64/dev/schizo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: schizo.c,v 1.30 2006/06/28 20:07:51 deraadt Exp $ */ +/* $OpenBSD: schizo.c,v 1.31 2006/06/28 20:09:15 deraadt Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -191,7 +191,9 @@ schizo_init(struct schizo_softc *sc, int busa) panic("schizo: unable to create PBM handle"); } + printf("%s: ", sc->sc_dv.dv_xname); schizo_init_iommu(sc, pbm); + printf("\n"); match = schizo_read(sc, busa ? SCZ_PCIA_IO_MATCH : SCZ_PCIB_IO_MATCH); pbm->sp_confpaddr = match & ~0x8000000000000000UL; @@ -571,7 +573,7 @@ _schizo_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t offset, DPRINTF(SDB_BUSMAP, (" cspace %d", ss)); if (t->parent == 0 || t->parent->sparc_bus_map == 0) { - printf("\n_psycho_bus_map: invalid parent"); + printf("\n_schizo_bus_map: invalid parent"); return (EINVAL); } -- cgit v1.2.3