| 82 | } |
| 83 | |
| 84 | static int |
| 85 | obio_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 | |
| 122 | static struct resource * |
| 123 | obio_alloc_resource(device_t bus, device_t child, int type, int *rid, |
nothing calls this directly
no test coverage detected