Minor formatting changes. Also, elimiante a couple of unused variables.

This commit is contained in:
Warner Losh 2009-06-14 07:01:22 +00:00
parent c839424d34
commit 72bd8c62f6
2 changed files with 37 additions and 30 deletions

View File

@ -53,22 +53,28 @@ __FBSDID("$FreeBSD$");
#include <dev/uart/uart_bus.h>
#include <dev/uart/uart_cpu.h>
/*
* XXXMIPS:
*/
#include <mips/octeon1/octeonreg.h>
#include "uart_if.h"
extern struct uart_class uart_oct16550_class;
static int uart_octeon_probe(device_t dev);
static void octeon_uart_identify(driver_t *drv, device_t parent);
static void octeon_uart_identify(driver_t * drv, device_t parent);
extern struct uart_class octeon_uart_class;
static device_method_t uart_octeon_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, uart_octeon_probe),
DEVMETHOD(device_attach, uart_bus_attach),
DEVMETHOD(device_detach, uart_bus_detach),
DEVMETHOD(device_identify, octeon_uart_identify),
{ 0, 0 }
DEVMETHOD(device_probe, uart_octeon_probe),
DEVMETHOD(device_attach, uart_bus_attach),
DEVMETHOD(device_detach, uart_bus_detach),
DEVMETHOD(device_identify, octeon_uart_identify),
{0, 0}
};
static driver_t uart_octeon_driver = {
@ -77,35 +83,36 @@ static driver_t uart_octeon_driver = {
sizeof(struct uart_softc),
};
extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
static int
uart_octeon_probe (device_t dev)
extern
SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
static int
uart_octeon_probe(device_t dev)
{
struct uart_softc *sc;
int unit;
int unit;
/*
* Note that both tty0 & tty1 are viable consoles. We add child devices
* such that ttyu0 ends up front of queue.
*/
unit = device_get_unit(dev);
unit = device_get_unit(dev);
sc = device_get_softc(dev);
sc->sc_sysdev = NULL;
sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs);
bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
if (!unit) {
sc->sc_sysdev->bas.bst = 0;
sc->sc_sysdev->bas.bsh = OCTEON_UART0ADR;
}
sc->sc_sysdev = NULL;
sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs);
bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
if (!unit) {
sc->sc_sysdev->bas.bst = 0;
sc->sc_sysdev->bas.bsh = OCTEON_UART0ADR;
}
sc->sc_class = &uart_oct16550_class;
sc->sc_bas.bst = 0;
sc->sc_bas.bsh = unit ? OCTEON_UART1ADR : OCTEON_UART0ADR;
sc->sc_bas.regshft = 0x3;
return (uart_bus_probe(dev, sc->sc_bas.regshft, 0, 0, unit));
return (uart_bus_probe(dev, sc->sc_bas.regshft, 0, 0, unit));
}
static void
octeon_uart_identify (driver_t *drv, device_t parent)
octeon_uart_identify(driver_t * drv, device_t parent)
{
BUS_ADD_CHILD(parent, 0, "uart", 0);
}
@ -113,4 +120,3 @@ octeon_uart_identify (driver_t *drv, device_t parent)
DRIVER_MODULE(uart, obio, uart_octeon_driver, uart_devclass, 0, 0);

View File

@ -50,9 +50,7 @@ __FBSDID("$FreeBSD$");
#include <mips/octeon1/octeonreg.h>
bus_space_tag_t uart_bus_space_io;
bus_space_tag_t uart_bus_space_mem;
extern struct uart_class uart_oct16550_class;
extern struct uart_ops octeon_usart_ops;
extern struct bus_space octeon_bs_tag;
@ -66,18 +64,21 @@ uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
int
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
{
di->ops = uart_getops(&uart_oct16550_class);
di->bas.chan = 0;
struct uart_class *class;
class = &uart_oct16550_class;
di->ops = uart_getops(class);
di->bas.bst = 0;
di->bas.regshft = 3; /* Each UART reg is 8 byte addresss apart. 1 << 3 */
di->bas.chan = 0;
di->bas.regshft = 3; /* Each UART reg is 8 byte addresss apart. 1
* << 3 */
di->bas.rclk = 0;
di->baudrate = 115200;
di->databits = 8;
di->stopbits = 1;
di->parity = UART_PARITY_NONE;
uart_bus_space_io = MIPS_PHYS_TO_KSEG1(OCTEON_UART0ADR);
uart_bus_space_mem = MIPS_PHYS_TO_KSEG1(OCTEON_UART0ADR);
di->bas.bsh = OCTEON_UART0ADR;
di->bas.bsh = OCTEON_UART0ADR;
uart_getenv(devtype, di, class);
return (0);
}