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

Function obio_attach

freebsd/mips/cavium/obio.c:84–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84static int
85obio_attach(device_t dev)
86{
87 struct obio_softc *sc = device_get_softc(dev);
88
89 sc->oba_st = mips_bus_space_generic;
90 /*
91 * XXX
92 * Here and elsewhere using RBR as a base address because it kind of
93 * is, but that feels pretty sloppy. Should consider adding a define
94 * that's more semantic, at least.
95 */
96 sc->oba_addr = CVMX_MIO_UARTX_RBR(0);
97 sc->oba_size = 0x10000;
98 sc->oba_rman.rm_type = RMAN_ARRAY;
99 sc->oba_rman.rm_descr = "OBIO I/O";
100 if (rman_init(&sc->oba_rman) != 0 ||
101 rman_manage_region(&sc->oba_rman,
102 sc->oba_addr, sc->oba_addr + sc->oba_size) != 0)
103 panic("obio_attach: failed to set up I/O rman");
104 sc->oba_irq_rman.rm_type = RMAN_ARRAY;
105 sc->oba_irq_rman.rm_descr = "OBIO IRQ";
106
107 /*
108 * This module is intended for UART purposes only and
109 * manages IRQs for UART0 and UART1.
110 */
111 if (rman_init(&sc->oba_irq_rman) != 0 ||
112 rman_manage_region(&sc->oba_irq_rman, OCTEON_IRQ_UART0, OCTEON_IRQ_UART1) != 0)
113 panic("obio_attach: failed to set up IRQ rman");
114
115 device_add_child(dev, "uart", 1); /* Setup Uart-1 first. */
116 device_add_child(dev, "uart", 0); /* Uart-0 next. So it is first in console list */
117 bus_generic_probe(dev);
118 bus_generic_attach(dev);
119 return (0);
120}
121
122static struct resource *
123obio_alloc_resource(device_t bus, device_t child, int type, int *rid,

Callers

nothing calls this directly

Calls 8

device_get_softcFunction · 0.85
CVMX_MIO_UARTX_RBRFunction · 0.85
rman_initFunction · 0.85
rman_manage_regionFunction · 0.85
device_add_childFunction · 0.85
bus_generic_probeFunction · 0.85
bus_generic_attachFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected