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

Function elcr_probe

freebsd/x86/isa/elcr.c:64–89  ·  view source on GitHub ↗

* Check to see if we have what looks like a valid ELCR. We do this by * verifying that IRQs 0, 1, 2, and 13 are all edge triggered. */

Source from the content-addressed store, hash-verified

62 * verifying that IRQs 0, 1, 2, and 13 are all edge triggered.
63 */
64int
65elcr_probe(void)
66{
67 int i;
68
69 elcr_status = inb(ELCR_PORT) | inb(ELCR_PORT + 1) << 8;
70 if ((elcr_status & (ELCR_MASK(0) | ELCR_MASK(1) | ELCR_MASK(2) |
71 ELCR_MASK(8) | ELCR_MASK(13))) != 0)
72 return (ENXIO);
73 if (bootverbose) {
74 printf("ELCR Found. ISA IRQs programmed as:\n");
75 for (i = 0; i < 16; i++)
76 printf(" %2d", i);
77 printf("\n");
78 for (i = 0; i < 16; i++)
79 if (elcr_status & ELCR_MASK(i))
80 printf(" L");
81 else
82 printf(" E");
83 printf("\n");
84 }
85 if (resource_disabled("elcr", 0))
86 return (ENXIO);
87 elcr_found = 1;
88 return (0);
89}
90
91/*
92 * Returns 1 for level trigger, 0 for edge.

Callers 2

init386Function · 0.85
hammer_timeFunction · 0.85

Calls 3

resource_disabledFunction · 0.85
inbFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected