1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-01 12:19:28 +00:00

Check the environment for system devices before using the FDT.

This allows overriding the FDT, and allows specifying a debug
port.
This commit is contained in:
Marcel Moolenaar 2011-01-17 23:34:36 +00:00
parent bc35e60ec0
commit 3470949a74
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217520

View File

@ -140,6 +140,15 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
u_long start, size;
int err;
uart_bus_space_mem = fdtbus_bs_tag;
uart_bus_space_io = NULL;
/* Allow overriding the FDT uning the environment. */
class = &uart_ns8250_class;
err = uart_getenv(devtype, di, class);
if (!err)
return (0);
if (devtype != UART_DEV_CONSOLE)
return (ENXIO);
@ -183,18 +192,12 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->databits = 8;
di->stopbits = 1;
di->parity = UART_PARITY_NONE;
di->bas.bst = fdtbus_bs_tag;
di->bas.bst = uart_bus_space_mem;
err = fdt_regsize(node, &start, &size);
if (err)
return (ENXIO);
start += fdt_immr_va;
uart_bus_space_mem = fdtbus_bs_tag;
uart_bus_space_io = NULL;
if (bus_space_map(di->bas.bst, start, size, 0, &di->bas.bsh) != 0)
return (ENXIO);
return (0);
return (bus_space_map(di->bas.bst, start, size, 0, &di->bas.bsh));
}