If the region size turns out to be 0, return an error. This is what will

happen if we try to use a mapping register that's not actually defined.
This commit is contained in:
mycroft 1997-09-23 23:08:47 +00:00
parent 966e96d880
commit 3e5cee3ce5

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_map.c,v 1.1 1997/08/30 06:46:58 mycroft Exp $ */
/* $NetBSD: pci_map.c,v 1.2 1997/09/23 23:08:47 mycroft Exp $ */
/*
* Copyright (c) 1994, 1997 Charles M. Hannum. All rights reserved.
@ -83,6 +83,11 @@ pci_io_find(pc, tag, reg, type, basep, sizep, flagsp)
return (1);
}
if (PCI_MAPREG_IO_SIZE(mask) == 0) {
printf("pci_io_find: void region\n");
return (1);
}
if (basep != 0)
*basep = PCI_MAPREG_IO_ADDR(address);
if (sizep != 0)
@ -137,6 +142,11 @@ pci_mem_find(pc, tag, reg, type, basep, sizep, flagsp)
return (1);
}
if (PCI_MAPREG_MEM_SIZE(mask) == 0) {
printf("pci_mem_find: void region\n");
return (1);
}
switch (PCI_MAPREG_MEM_TYPE(address)) {
case PCI_MAPREG_MEM_TYPE_32BIT:
case PCI_MAPREG_MEM_TYPE_32BIT_1M: