MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pci_pir_parse

Function pci_pir_parse

freebsd/i386/pci/pci_pir.c:380–461  ·  view source on GitHub ↗

* Parse $PIR to enumerate link devices and attempt to determine their * initial state. This could perhaps be cleaner if we had drivers for the * various interrupt routers as they could read the initial IRQ for each * link. */

Source from the content-addressed store, hash-verified

378 * link.
379 */
380static void
381pci_pir_parse(void)
382{
383 char tunable_buffer[64];
384 struct pci_link *pci_link;
385 int i, irq;
386
387 /* Only parse once. */
388 if (pir_parsed)
389 return;
390 pir_parsed = 1;
391
392 /* Enumerate link devices. */
393 TAILQ_INIT(&pci_links);
394 pci_pir_walk_table(pci_pir_create_links, NULL);
395 if (bootverbose) {
396 printf("$PIR: Links after initial probe:\n");
397 pci_pir_dump_links();
398 }
399
400 /*
401 * Check to see if the BIOS has already routed any of the links by
402 * checking each device connected to each link to see if it has a
403 * valid IRQ.
404 */
405 pci_pir_walk_table(pci_pir_initial_irqs, NULL);
406 if (bootverbose) {
407 printf("$PIR: Links after initial IRQ discovery:\n");
408 pci_pir_dump_links();
409 }
410
411 /*
412 * Allow the user to override the IRQ for a given link device. We
413 * allow invalid IRQs to be specified but warn about them. An IRQ
414 * of 255 or 0 clears any preset IRQ.
415 */
416 i = 0;
417 TAILQ_FOREACH(pci_link, &pci_links, pl_links) {
418 snprintf(tunable_buffer, sizeof(tunable_buffer),
419 "hw.pci.link.%#x.irq", pci_link->pl_id);
420 if (getenv_int(tunable_buffer, &irq) == 0)
421 continue;
422 if (irq == 0)
423 irq = PCI_INVALID_IRQ;
424 if (irq != PCI_INVALID_IRQ &&
425 !pci_pir_valid_irq(pci_link, irq) && bootverbose)
426 printf(
427 "$PIR: Warning, IRQ %d for link %#x is not listed as valid\n",
428 irq, pci_link->pl_id);
429 pci_link->pl_routed = 0;
430 pci_link->pl_irq = irq;
431 i = 1;
432 }
433 if (bootverbose && i) {
434 printf("$PIR: Links after tunable overrides:\n");
435 pci_pir_dump_links();
436 }
437

Callers 1

pir_attachFunction · 0.85

Calls 7

pci_pir_walk_tableFunction · 0.85
pci_pir_dump_linksFunction · 0.85
snprintfFunction · 0.85
pci_pir_valid_irqFunction · 0.85
pci_print_irqmaskFunction · 0.85
printfFunction · 0.50
getenv_intFunction · 0.50

Tested by

no test coverage detected