Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci.c
Show First 20 Lines • Show All 6,238 Lines • ▼ Show 20 Lines | pcie_flr(device_t dev, u_int max_delay, bool force) | ||||
/* Wait for 100ms. */ | /* Wait for 100ms. */ | ||||
pause_sbt("pcieflr", (100 + compl_delay) * SBT_1MS, 0, C_HARDCLOCK); | pause_sbt("pcieflr", (100 + compl_delay) * SBT_1MS, 0, C_HARDCLOCK); | ||||
if (pci_read_config(dev, cap + PCIER_DEVICE_STA, 2) & | if (pci_read_config(dev, cap + PCIER_DEVICE_STA, 2) & | ||||
PCIEM_STA_TRANSACTION_PND) | PCIEM_STA_TRANSACTION_PND) | ||||
pci_printf(&dinfo->cfg, "Transactions pending after FLR!\n"); | pci_printf(&dinfo->cfg, "Transactions pending after FLR!\n"); | ||||
return (true); | return (true); | ||||
} | } | ||||
const void * | |||||
imp: This needs comments and a man page. | |||||
pci_match_device(device_t child, const void *table, size_t elt, size_t nelt) | |||||
Not Done Inline Actions"elt", "nelt" -- ltrs rn't xpensv nymr. rpokala: "elt", "nelt" -- ltrs rn't xpensv nymr. | |||||
{ | |||||
const char *ptr, *end; | |||||
const struct pci_device_table *id; | |||||
bool match; | |||||
uint16_t vendor, device, subvendor, subdevice, class, subclass, revid; | |||||
ptr = (const char *) table; | |||||
end = ptr + elt * nelt; | |||||
vendor = pci_get_vendor(child); | |||||
device = pci_get_device(child); | |||||
subvendor = pci_get_subvendor(child); | |||||
subdevice = pci_get_subdevice(child); | |||||
class = pci_get_class(child); | |||||
subclass = pci_get_subclass(child); | |||||
revid = pci_get_revid(child); | |||||
while (ptr < end) { | |||||
id = (const struct pci_device_id *)ptr; | |||||
match = true; | |||||
if (id->match_flag_vendor) | |||||
match &= vendor == id->vendor; | |||||
if (id->match_flag_device) | |||||
match &= device == id->device; | |||||
if (id->match_flag_subvendor) | |||||
match &= subvendor == id->subvendor; | |||||
if (id->match_flag_subdevice) | |||||
match &= subdevice == id->subdevice; | |||||
if (id->match_flag_class) | |||||
match &= class == id->class_id; | |||||
if (id->match_flag_subclass) | |||||
match &= subclass == id->subclass; | |||||
if (id->match_flag_revid) | |||||
match &= revid == id->revid; | |||||
if (match) | |||||
return (id); | |||||
ptr += elt; | |||||
} | |||||
return (NULL); | |||||
} |
This needs comments and a man page.