1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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.
This commit is contained in:
Stefan Eßer 1999-01-19 23:29:20 +00:00
parent cc133fa302
commit 441e39d74a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42867
5 changed files with 19 additions and 14 deletions

View File

@ -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.c,v 1.91 1998/11/09 08:08:06 peter Exp $
* $Id: pci.c,v 1.92 1999/01/12 01:44:42 eivind Exp $
*
*/
@ -190,6 +190,7 @@ pci_readmaps(pcicfgregs *cfg, int maxmaps)
testval = pci_cfgread(cfg, reg, 4);
pci_cfgwrite(cfg, reg, base, 4);
map[j].reg = reg;
map[j].base = pci_mapbase(base);
map[j].type = pci_maptype(base);
map[j].ln2size = pci_mapsize(testval);

View File

@ -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: pcivar.h,v 1.23 1998/12/14 05:47:29 dillon Exp $
* $Id: pcivar.h,v 1.24 1999/01/13 04:59:19 bde Exp $
*
*/
@ -66,7 +66,7 @@ typedef struct {
#define PCI_MAPPORT 0x04 /* port map */
u_int8_t ln2size;
u_int8_t ln2range;
/* u_int8_t dummy;*/
u_int8_t reg; /* offset of map register in config space */
} pcimap;
/* config header information common to all header types */

View File

@ -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.c,v 1.91 1998/11/09 08:08:06 peter Exp $
* $Id: pci.c,v 1.92 1999/01/12 01:44:42 eivind Exp $
*
*/
@ -190,6 +190,7 @@ pci_readmaps(pcicfgregs *cfg, int maxmaps)
testval = pci_cfgread(cfg, reg, 4);
pci_cfgwrite(cfg, reg, base, 4);
map[j].reg = reg;
map[j].base = pci_mapbase(base);
map[j].type = pci_maptype(base);
map[j].ln2size = pci_mapsize(testval);

View File

@ -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

View File

@ -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: pcivar.h,v 1.23 1998/12/14 05:47:29 dillon Exp $
* $Id: pcivar.h,v 1.24 1999/01/13 04:59:19 bde Exp $
*
*/
@ -66,7 +66,7 @@ typedef struct {
#define PCI_MAPPORT 0x04 /* port map */
u_int8_t ln2size;
u_int8_t ln2range;
/* u_int8_t dummy;*/
u_int8_t reg; /* offset of map register in config space */
} pcimap;
/* config header information common to all header types */