Allow one to access the cached values for CMDREG, CACHELNSZ, MINGNT,

MAXLAT and LATTIMER.

Improve error message when a bogus RID type is requested for a bar.
This commit is contained in:
Warner Losh 2005-09-11 03:22:03 +00:00
parent 7014a50853
commit 6de560ab92
2 changed files with 33 additions and 6 deletions

View File

@ -1521,6 +1521,21 @@ pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
case PCI_IVAR_FUNCTION:
*result = cfg->func;
break;
case PCI_IVAR_CMDREG:
*result = cfg->cmdreg;
break;
case PCI_IVAR_CACHELNSZ:
*result = cfg->cachelnsz;
break;
case PCI_IVAR_MINGNT:
*result = cfg->mingnt;
break;
case PCI_IVAR_MAXLAT:
*result = cfg->maxlat;
break;
case PCI_IVAR_LATTIMER:
*result = cfg->lattimer;
break;
default:
return (ENOENT);
}
@ -1638,17 +1653,19 @@ pci_alloc_map(device_t dev, device_t child, int type, int *rid,
if (pci_maptype(testval) & PCI_MAPMEM) {
if (type != SYS_RES_MEMORY) {
if (bootverbose)
device_printf(child,
"rid %#x is memory, requested %d\n",
*rid, type);
device_printf(dev,
"child %s requested type %d for rid %#x,"
" but the BAR says it is an memio\n",
device_get_nameunit(child), type, *rid);
goto out;
}
} else {
if (type != SYS_RES_IOPORT) {
if (bootverbose)
device_printf(child,
"rid %#x is ioport, requested %d\n",
*rid, type);
device_printf(dev,
"child %s requested type %d for rid %#x,"
" but the BAR says it is an ioport\n",
device_get_nameunit(child), type, *rid);
goto out;
}
}

View File

@ -192,6 +192,11 @@ enum pci_device_ivars {
PCI_IVAR_SLOT,
PCI_IVAR_FUNCTION,
PCI_IVAR_ETHADDR,
PCI_IVAR_CMDREG,
PCI_IVAR_CACHELNSZ,
PCI_IVAR_MINGNT,
PCI_IVAR_MAXLAT,
PCI_IVAR_LATTIMER,
};
/*
@ -215,6 +220,11 @@ PCI_ACCESSOR(bus, BUS, uint8_t)
PCI_ACCESSOR(slot, SLOT, uint8_t)
PCI_ACCESSOR(function, FUNCTION, uint8_t)
PCI_ACCESSOR(ether, ETHADDR, uint8_t *)
PCI_ACCESSOR(cmdreg, CMDREG, uint8_t)
PCI_ACCESSOR(cachelnsz, CACHELNSZ, uint8_t)
PCI_ACCESSOR(mingnt, MINGNT, uint8_t)
PCI_ACCESSOR(maxlat, MAXLAT, uint8_t)
PCI_ACCESSOR(lattimer, LATTIMER, uint8_t)
#undef PCI_ACCESSOR