| 126 | #endif /* CFE */ |
| 127 | |
| 128 | int |
| 129 | uart_cpu_getdev(int devtype, struct uart_devinfo *di) |
| 130 | { |
| 131 | int ivar; |
| 132 | |
| 133 | uart_bus_space_io = NULL; |
| 134 | uart_bus_space_mem = mips_bus_space_generic; |
| 135 | |
| 136 | #ifdef CFE |
| 137 | /* Check the CFE environment */ |
| 138 | if (uart_getenv_cfe(devtype, di) == 0) |
| 139 | return (0); |
| 140 | #endif /* CFE */ |
| 141 | |
| 142 | /* Check the kernel environment. */ |
| 143 | if (uart_getenv(devtype, di, chipc_uart_class) == 0) |
| 144 | return (0); |
| 145 | |
| 146 | /* Scan the device hints for the first matching device */ |
| 147 | for (u_int i = 0; i < CHIPC_UART_MAX; i++) { |
| 148 | if (resource_int_value("uart", i, "flags", &ivar)) |
| 149 | continue; |
| 150 | |
| 151 | /* Check usability */ |
| 152 | if (devtype == UART_DEV_CONSOLE && !UART_FLAGS_CONSOLE(ivar)) |
| 153 | continue; |
| 154 | |
| 155 | if (devtype == UART_DEV_DBGPORT && !UART_FLAGS_DBGPORT(ivar)) |
| 156 | continue; |
| 157 | |
| 158 | if (resource_int_value("uart", i, "disabled", &ivar) == 0 && |
| 159 | ivar == 0) |
| 160 | continue; |
| 161 | |
| 162 | /* Found */ |
| 163 | if (resource_int_value("uart", i, "baud", &ivar) != 0) |
| 164 | ivar = CHIPC_UART_BAUDRATE; |
| 165 | |
| 166 | return (uart_cpu_init(di, i, ivar)); |
| 167 | } |
| 168 | |
| 169 | /* Default to uart0/115200 */ |
| 170 | return (uart_cpu_init(di, 0, CHIPC_UART_BAUDRATE)); |
| 171 | } |
nothing calls this directly
no test coverage detected