From e6085b4b12de95651a198c865cff163b5dbdc8e7 Mon Sep 17 00:00:00 2001 From: scw Date: Wed, 26 Nov 2003 14:27:15 +0000 Subject: [PATCH] A couple of fixes inspired by a recent port-mvme68k post: - Fix the display of VME master ranges such that the address modifier is shown correctly. - Apply vr_mask to the start/end VME master addresses, and adjust the local start address to compensate. --- sys/dev/mvme/mvmebus.c | 8 ++++---- sys/dev/mvme/vme_two.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/dev/mvme/mvmebus.c b/sys/dev/mvme/mvmebus.c index c8d28bdbc87d..1804bf2ff9ea 100644 --- a/sys/dev/mvme/mvmebus.c +++ b/sys/dev/mvme/mvmebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mvmebus.c,v 1.5 2003/10/28 18:21:49 matt Exp $ */ +/* $NetBSD: mvmebus.c,v 1.6 2003/11/26 14:27:15 scw Exp $ */ /*- * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.5 2003/10/28 18:21:49 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.6 2003/11/26 14:27:15 scw Exp $"); #include #include @@ -915,8 +915,8 @@ mvmebus_mod_string(addr, len, am, ds) static const char *mode[] = {"BLT64)", "DATA)", "PROG)", "BLT32)"}; static const char *dsiz[] = {"(", "(D8,", "(D16,", "(D16-D8,", "(D32,", "(D32,D8,", "(D32-D16,", "(D32-D8,"}; - static const char *adrfmt[] = { "A32:%08x-%08x ", "A16:%04x-%04x ", - "A24:%06x-%06x ", "USR:%08x-%08x " }; + static const char *adrfmt[] = { "A32:%08x-%08x ", "USR:%08x-%08x ", + "A16:%04x-%04x ", "A24:%06x-%06x " }; static char mstring[40]; sprintf(mstring, diff --git a/sys/dev/mvme/vme_two.c b/sys/dev/mvme/vme_two.c index 23ad273cdb37..c098fe0ee6ff 100644 --- a/sys/dev/mvme/vme_two.c +++ b/sys/dev/mvme/vme_two.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_two.c,v 1.2 2003/07/14 15:47:21 lukem Exp $ */ +/* $NetBSD: vme_two.c,v 1.3 2003/11/26 14:27:15 scw Exp $ */ /*- * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme_two.c,v 1.2 2003/07/14 15:47:21 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_two.c,v 1.3 2003/11/26 14:27:15 scw Exp $"); #include "vmetwo.h" @@ -235,8 +235,11 @@ vmetwo_master_range(sc, range, vr) reg = vme2_lcsr_read(sc, VME2LCSR_MASTER_ADDRESS(range)); start = (reg & VME2_MAST_ADDRESS_START_MASK); start <<= VME2_MAST_ADDRESS_START_SHIFT; + vr->vr_locstart = start & ~vr->vr_mask; end = (reg & VME2_MAST_ADDRESS_END_MASK); end <<= VME2_MAST_ADDRESS_END_SHIFT; + end |= 0xffffu; + end += 1; /* * Local->VMEbus map '4' has optional translation bits, so @@ -245,8 +248,6 @@ vmetwo_master_range(sc, range, vr) if (range == 3 && (reg = vme2_lcsr_read(sc, VME2LCSR_MAST4_TRANS))!=0) { uint32_t addr, sel, len = end - start; - vr->vr_locstart = start; - reg = vme2_lcsr_read(sc, VME2LCSR_MAST4_TRANS); reg &= VME2_MAST4_TRANS_SELECT_MASK; sel = reg << VME2_MAST4_TRANS_SELECT_SHIFT; @@ -258,8 +259,7 @@ vmetwo_master_range(sc, range, vr) start = (addr & sel) | (start & (~sel)); end = start + len; vr->vr_mask &= len - 1; - } else - vr->vr_locstart = 0; + } /* XXX Deal with overlap of onboard RAM address space */ /* XXX Then again, 167-Bug warns about this at setup time ... */ @@ -267,8 +267,8 @@ vmetwo_master_range(sc, range, vr) /* * Fixup the addresses this range corresponds to */ - vr->vr_vmestart = start; - vr->vr_vmeend = end - 1; + vr->vr_vmestart = start & vr->vr_mask; + vr->vr_vmeend = (end - 1) & vr->vr_mask; } void