uart_bus_puc.c (119815) | uart_bus_puc.c (120452) |
---|---|
1/*- 2 * Copyright (c) 2002 JF Hay. All rights reserved. 3 * Copyright (c) 2001 M. Warner Losh. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002 JF Hay. All rights reserved. 3 * Copyright (c) 2001 M. Warner Losh. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/dev/uart/uart_bus_puc.c 119815 2003-09-06 23:13:47Z marcel $"); | 27__FBSDID("$FreeBSD: head/sys/dev/uart/uart_bus_puc.c 120452 2003-09-26 05:14:56Z marcel $"); |
28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/bus.h> 32#include <sys/conf.h> 33#include <sys/kernel.h> 34#include <sys/module.h> 35#include <machine/bus.h> --- 22 unchanged lines hidden (view full) --- 58 sizeof(struct uart_softc), 59}; 60 61static int 62uart_puc_probe(device_t dev) 63{ 64 device_t parent; 65 struct uart_softc *sc; | 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/bus.h> 32#include <sys/conf.h> 33#include <sys/kernel.h> 34#include <sys/module.h> 35#include <machine/bus.h> --- 22 unchanged lines hidden (view full) --- 58 sizeof(struct uart_softc), 59}; 60 61static int 62uart_puc_probe(device_t dev) 63{ 64 device_t parent; 65 struct uart_softc *sc; |
66 uintptr_t rclk, regshft, type; | 66 uintptr_t port, rclk, regshft, type; |
67 68 parent = device_get_parent(dev); 69 sc = device_get_softc(dev); 70 71 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_SUBTYPE, &type)) 72 return (ENXIO); 73 switch (type) { 74 case PUC_PORT_UART_NS8250: 75 sc->sc_class = &uart_ns8250_class; | 67 68 parent = device_get_parent(dev); 69 sc = device_get_softc(dev); 70 71 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_SUBTYPE, &type)) 72 return (ENXIO); 73 switch (type) { 74 case PUC_PORT_UART_NS8250: 75 sc->sc_class = &uart_ns8250_class; |
76 port = 0; |
|
76 break; 77 case PUC_PORT_UART_SAB82532: 78 sc->sc_class = &uart_sab82532_class; | 77 break; 78 case PUC_PORT_UART_SAB82532: 79 sc->sc_class = &uart_sab82532_class; |
80 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_PORT, &port)) 81 port = 0; |
|
79 break; 80 case PUC_PORT_UART_Z8530: 81 sc->sc_class = &uart_z8530_class; | 82 break; 83 case PUC_PORT_UART_Z8530: 84 sc->sc_class = &uart_z8530_class; |
85 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_PORT, &port)) 86 port = 0; |
|
82 break; 83 default: 84 return (ENXIO); 85 } 86 87 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_FREQ, &rclk)) 88 rclk = 0; 89 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_REGSHFT, ®shft)) 90 regshft = 0; | 87 break; 88 default: 89 return (ENXIO); 90 } 91 92 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_FREQ, &rclk)) 93 rclk = 0; 94 if (BUS_READ_IVAR(parent, dev, PUC_IVAR_REGSHFT, ®shft)) 95 regshft = 0; |
91 return (uart_bus_probe(dev, regshft, rclk, 0)); | 96 return (uart_bus_probe(dev, regshft, rclk, 0, port)); |
92} 93 94DRIVER_MODULE(uart, puc, uart_puc_driver, uart_devclass, 0, 0); | 97} 98 99DRIVER_MODULE(uart, puc, uart_puc_driver, uart_devclass, 0, 0); |