diff options
author | nyan <nyan@FreeBSD.org> | 2003-09-23 09:25:38 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2003-09-23 09:25:38 +0000 |
commit | 5ff63b94e08d5106843d8df7bb1d213200cd203c (patch) | |
tree | 81235bda429271091a4b5cf67aef8cd0cb60242b /sys/dev/uart | |
parent | de10d50d42dd5a6ffddcbbc32f349f76080e03bc (diff) | |
download | FreeBSD-src-5ff63b94e08d5106843d8df7bb1d213200cd203c.zip FreeBSD-src-5ff63b94e08d5106843d8df7bb1d213200cd203c.tar.gz |
- Keep the base address in struct uart_bas for sab82532 and z8530 modules.
- Remove buggy uart_cpu_busaddr() function.
Diffstat (limited to 'sys/dev/uart')
-rw-r--r-- | sys/dev/uart/uart.h | 1 | ||||
-rw-r--r-- | sys/dev/uart/uart_core.c | 1 | ||||
-rw-r--r-- | sys/dev/uart/uart_cpu.h | 1 | ||||
-rw-r--r-- | sys/dev/uart/uart_cpu_alpha.c | 9 | ||||
-rw-r--r-- | sys/dev/uart/uart_cpu_amd64.c | 8 | ||||
-rw-r--r-- | sys/dev/uart/uart_cpu_i386.c | 8 | ||||
-rw-r--r-- | sys/dev/uart/uart_cpu_ia64.c | 16 | ||||
-rw-r--r-- | sys/dev/uart/uart_cpu_pc98.c | 8 | ||||
-rw-r--r-- | sys/dev/uart/uart_cpu_sparc64.c | 8 | ||||
-rw-r--r-- | sys/dev/uart/uart_dev_sab82532.c | 4 | ||||
-rw-r--r-- | sys/dev/uart/uart_dev_z8530.c | 4 |
11 files changed, 17 insertions, 51 deletions
diff --git a/sys/dev/uart/uart.h b/sys/dev/uart/uart.h index 1ea90c0..ba17e89 100644 --- a/sys/dev/uart/uart.h +++ b/sys/dev/uart/uart.h @@ -36,6 +36,7 @@ * other timing related computations. */ struct uart_bas { + bus_addr_t iobase; bus_space_tag_t bst; bus_space_handle_t bsh; u_int regshft; diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index 5889211..77e4604 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -267,6 +267,7 @@ uart_bus_probe(device_t dev, int regshft, int rclk, int rid) * accordingly. In general, you don't want to permanently disrupt * console I/O. */ + sc->sc_bas.iobase = rman_get_start(sc->sc_rres); sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); sc->sc_bas.regshft = regshft; diff --git a/sys/dev/uart/uart_cpu.h b/sys/dev/uart/uart_cpu.h index e60ce57..f124aa7 100644 --- a/sys/dev/uart/uart_cpu.h +++ b/sys/dev/uart/uart_cpu.h @@ -67,7 +67,6 @@ struct uart_devinfo { void *cookie; /* Type dependent use. */ }; -bus_addr_t uart_cpu_busaddr(struct uart_bas *); int uart_cpu_eqres(struct uart_bas *, struct uart_bas *); int uart_cpu_getdev(int, struct uart_devinfo *); diff --git a/sys/dev/uart/uart_cpu_alpha.c b/sys/dev/uart/uart_cpu_alpha.c index 40d2bf1..bfb663e 100644 --- a/sys/dev/uart/uart_cpu_alpha.c +++ b/sys/dev/uart/uart_cpu_alpha.c @@ -39,13 +39,6 @@ __FBSDID("$FreeBSD$"); #include <dev/uart/uart.h> #include <dev/uart/uart_cpu.h> -bus_addr_t -uart_cpu_busaddr(struct uart_bas *bas) -{ - - return (bas->bsh); -} - int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { @@ -65,6 +58,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (ENXIO); boothowto |= RB_SERIAL; di->ops = uart_ns8250_ops; + di->bas.iobase = 0x3f8; di->bas.bst = busspace_isa_io; if (bus_space_map(di->bas.bst, 0x3f8, 8, 0, &di->bas.bsh) != 0) return (ENXIO); @@ -102,6 +96,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) * only have ns8250 and successors on alpha. */ di->ops = uart_ns8250_ops; + di->bas.iobase = ivar; di->bas.bst = busspace_isa_io; if (bus_space_map(di->bas.bst, ivar, 8, 0, &di->bas.bsh) != 0) return (ENXIO); diff --git a/sys/dev/uart/uart_cpu_amd64.c b/sys/dev/uart/uart_cpu_amd64.c index d52e3bc..ff8aa27 100644 --- a/sys/dev/uart/uart_cpu_amd64.c +++ b/sys/dev/uart/uart_cpu_amd64.c @@ -36,13 +36,6 @@ __FBSDID("$FreeBSD$"); #include <dev/uart/uart.h> #include <dev/uart/uart_cpu.h> -bus_addr_t -uart_cpu_busaddr(struct uart_bas *bas) -{ - - return (bas->bsh); -} - int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { @@ -82,6 +75,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) * ns8250 and successors on i386. */ di->ops = uart_ns8250_ops; + di->bas.iobase = ivar; di->bas.bst = AMD64_BUS_SPACE_IO; if (bus_space_map(di->bas.bst, ivar, 8, 0, &di->bas.bsh) != 0) return (ENXIO); diff --git a/sys/dev/uart/uart_cpu_i386.c b/sys/dev/uart/uart_cpu_i386.c index da25405..1da3026 100644 --- a/sys/dev/uart/uart_cpu_i386.c +++ b/sys/dev/uart/uart_cpu_i386.c @@ -36,13 +36,6 @@ __FBSDID("$FreeBSD$"); #include <dev/uart/uart.h> #include <dev/uart/uart_cpu.h> -bus_addr_t -uart_cpu_busaddr(struct uart_bas *bas) -{ - - return (bas->bsh); -} - int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { @@ -82,6 +75,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) * ns8250 and successors on i386. */ di->ops = uart_ns8250_ops; + di->bas.iobase = ivar; di->bas.bst = I386_BUS_SPACE_IO; if (bus_space_map(di->bas.bst, ivar, 8, 0, &di->bas.bsh) != 0) return (ENXIO); diff --git a/sys/dev/uart/uart_cpu_ia64.c b/sys/dev/uart/uart_cpu_ia64.c index 9340ae5..d5b773f 100644 --- a/sys/dev/uart/uart_cpu_ia64.c +++ b/sys/dev/uart/uart_cpu_ia64.c @@ -44,13 +44,6 @@ static int dig64_to_uart_parity[] = { UART_PARITY_ODD, UART_PARITY_MARK, UART_PARITY_SPACE }; -bus_addr_t -uart_cpu_busaddr(struct uart_bas *bas) -{ - - return (bas->bsh); -} - int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { @@ -82,13 +75,13 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) continue; di->ops = uart_ns8250_ops; + di->bas.iobase = (ent->address.addr_high << 32) + + ent->address.addr_low; di->bas.bst = IA64_BUS_SPACE_IO; di->bas.bst = (ent->address.addr_space == 0) ? IA64_BUS_SPACE_MEM : IA64_BUS_SPACE_IO; - if (bus_space_map(di->bas.bst, - (ent->address.addr_high << 32) + - ent->address.addr_low, - 8, 0, &di->bas.bsh) != 0) + if (bus_space_map(di->bas.bst, di->bas.iobase, 8, 0, + &di->bas.bsh) != 0) return (ENXIO); di->bas.regshft = 0; di->bas.rclk = ent->pclock << 4; @@ -131,6 +124,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) * ns8250 and successors on i386. */ di->ops = uart_ns8250_ops; + di->bas.iobase = ivar; di->bas.bst = IA64_BUS_SPACE_IO; if (bus_space_map(di->bas.bst, ivar, 8, 0, &di->bas.bsh) != 0) return (ENXIO); diff --git a/sys/dev/uart/uart_cpu_pc98.c b/sys/dev/uart/uart_cpu_pc98.c index cb10806..7a0f6da 100644 --- a/sys/dev/uart/uart_cpu_pc98.c +++ b/sys/dev/uart/uart_cpu_pc98.c @@ -36,13 +36,6 @@ __FBSDID("$FreeBSD$"); #include <dev/uart/uart.h> #include <dev/uart/uart_cpu.h> -bus_addr_t -uart_cpu_busaddr(struct uart_bas *bas) -{ - - return (bas->bsh->bsh_base); -} - int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { @@ -87,6 +80,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) di->ops = uart_ns8250_ops; else di->ops = uart_i8251_ops; + di->bas.iobase = ivar; di->bas.bst = I386_BUS_SPACE_IO; if (bus_space_map(di->bas.bst, ivar, 8, 0, &di->bas.bsh) != 0) return (ENXIO); diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c index 15591a8..5b8b1c6 100644 --- a/sys/dev/uart/uart_cpu_sparc64.c +++ b/sys/dev/uart/uart_cpu_sparc64.c @@ -58,13 +58,6 @@ uart_cpu_channel(char *dev) return (alias[len - 1] - 'a'); } -bus_addr_t -uart_cpu_busaddr(struct uart_bas *bas) -{ - - return (bas->bsh); -} - int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { @@ -143,6 +136,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (ENXIO); /* Fill in the device info. */ + di->bas.iobase = addr; di->bas.bst = &bst_store[devtype]; di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst); diff --git a/sys/dev/uart/uart_dev_sab82532.c b/sys/dev/uart/uart_dev_sab82532.c index ec1c9f5..b9e781f 100644 --- a/sys/dev/uart/uart_dev_sab82532.c +++ b/sys/dev/uart/uart_dev_sab82532.c @@ -42,8 +42,8 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_RCLK 29491200 -#define IS_CHANNEL_A(bas) ((uart_cpu_busaddr(bas) & 0x40) == 0x00) -#define IS_CHANNEL_B(bas) ((uart_cpu_busaddr(bas) & 0x40) == 0x40) +#define IS_CHANNEL_A(bas) (((bas)->iobase & 0x40) == 0x00) +#define IS_CHANNEL_B(bas) (((bas)->iobase & 0x40) == 0x40) /* * NOTE: To allow us to read the baudrate divisor from the chip, we diff --git a/sys/dev/uart/uart_dev_z8530.c b/sys/dev/uart/uart_dev_z8530.c index eda35b8..30d8ed8 100644 --- a/sys/dev/uart/uart_dev_z8530.c +++ b/sys/dev/uart/uart_dev_z8530.c @@ -42,8 +42,8 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_RCLK 307200 -#define IS_CHANNEL_A(bas) ((uart_cpu_busaddr(bas) & 7) != 0) -#define IS_CHANNEL_B(bas) ((uart_cpu_busaddr(bas) & 7) == 0) +#define IS_CHANNEL_A(bas) (((bas)->iobase & 7) != 0) +#define IS_CHANNEL_B(bas) (((bas)->iobase & 7) == 0) /* Multiplexed I/O. */ static __inline void |