Skip to content

Commit

Permalink
Fix variable shadowing that caused us to map the entire range (many
Browse files Browse the repository at this point in the history
gigabytes) instead of just the amount the caller asked for.  This
resulted in a noticeable delay while attaching devices using multiple
msi-x vectors as we map and unmap the msi-x table for each vector.

ok kettenis@
  • Loading branch information
jmatthew committed Jun 25, 2020
1 parent 8077cb9 commit 5791596
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sys/arch/sparc64/dev/vpci.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: vpci.c,v 1.30 2020/06/23 01:21:29 jmatthew Exp $ */
/* $OpenBSD: vpci.c,v 1.31 2020/06/25 21:43:41 jmatthew Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org>
*
Expand Down Expand Up @@ -554,15 +554,15 @@ vpci_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t offset,

for (i = 0; i < pbm->vp_nrange; i++) {
bus_addr_t child, paddr;
bus_size_t size;
bus_size_t rsize;

if (((pbm->vp_range[i].cspace >> 24) & 0x03) != ss)
continue;
child = pbm->vp_range[i].child_lo;
child |= ((bus_addr_t)pbm->vp_range[i].child_hi) << 32;
size = pbm->vp_range[i].size_lo;
size |= ((bus_size_t)pbm->vp_range[i].size_hi) << 32;
if (offset < child || offset >= child + size)
rsize = pbm->vp_range[i].size_lo;
rsize |= ((bus_size_t)pbm->vp_range[i].size_hi) << 32;
if (offset < child || offset >= child + rsize)
continue;

paddr = pbm->vp_range[i].phys_lo;
Expand Down

0 comments on commit 5791596

Please sign in to comment.