diff options
author | se <se@FreeBSD.org> | 1999-01-19 23:29:20 +0000 |
---|---|---|
committer | se <se@FreeBSD.org> | 1999-01-19 23:29:20 +0000 |
commit | 2142e794d720c024a10ed406c58af94d4dd0ab6b (patch) | |
tree | 7fe02de1c4a8aa39ce6e7823fa18def84b54a456 /sys/pci/pci_compat.c | |
parent | 1b9be3b5a8aed57d7ee12ba5025079529ea33d28 (diff) | |
download | FreeBSD-src-2142e794d720c024a10ed406c58af94d4dd0ab6b.zip FreeBSD-src-2142e794d720c024a10ed406c58af94d4dd0ab6b.tar.gz |
Fix problem with zero valued map registers followed by valid map entries.
The previous code just ignored the invalid map register, but this gave
surprising results because of the way pci_map_port() associated the map
register offset supplied with a map entry in the map array.
Diffstat (limited to 'sys/pci/pci_compat.c')
-rw-r--r-- | sys/pci/pci_compat.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/pci/pci_compat.c b/sys/pci/pci_compat.c index 5ea0d5e..9f4c612 100644 --- a/sys/pci/pci_compat.c +++ b/sys/pci/pci_compat.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci_compat.c,v 1.18 1999/01/13 04:59:19 bde Exp $ + * $Id: pci_compat.c,v 1.19 1999/01/14 06:22:10 jdp Exp $ * */ @@ -59,13 +59,16 @@ static int pci_mapno(pcicfgregs *cfg, int reg) { - int map = -1; - if ((reg & 0x03) == 0) { - map = (reg -0x10) / 4; - if (map < 0 || map >= cfg->nummaps) - map = -1; - } - return (map); + int i, nummaps; + pcimap *map; + + nummaps = cfg->nummaps; + map = cfg->map; + + for (i = 0; i < nummaps; i++) + if (map[i].reg == reg) + return (i); + return (-1); } static int |