uart_cpu_sparc64.c (120378) | uart_cpu_sparc64.c (120452) |
---|---|
1/* 2 * Copyright (c) 2003 Marcel Moolenaar 3 * 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 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2003 Marcel Moolenaar 3 * 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 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_cpu_sparc64.c 120378 2003-09-23 09:25:38Z nyan $"); | 28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_cpu_sparc64.c 120452 2003-09-26 05:14:56Z marcel $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32 33#include <machine/bus.h> 34#include <machine/bus_private.h> 35 36#include <dev/ofw/openfirm.h> --- 13 unchanged lines hidden (view full) --- 50 51 strcpy(alias, dev); 52 if ((aliases = OF_finddevice("/aliases")) != -1) 53 OF_getprop(aliases, dev, alias, sizeof(alias)); 54 len = strlen(alias); 55 if (len < 2 || alias[len - 2] != ':' || alias[len - 1] < 'a' || 56 alias[len - 1] > 'b') 57 return (0); | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32 33#include <machine/bus.h> 34#include <machine/bus_private.h> 35 36#include <dev/ofw/openfirm.h> --- 13 unchanged lines hidden (view full) --- 50 51 strcpy(alias, dev); 52 if ((aliases = OF_finddevice("/aliases")) != -1) 53 OF_getprop(aliases, dev, alias, sizeof(alias)); 54 len = strlen(alias); 55 if (len < 2 || alias[len - 2] != ':' || alias[len - 1] < 'a' || 56 alias[len - 1] > 'b') 57 return (0); |
58 return (alias[len - 1] - 'a'); | 58 return (alias[len - 1] - 'a' + 1); |
59} 60 61int 62uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) 63{ 64 65 return ((b1->bsh == b2->bsh) ? 1 : 0); 66} 67 68int 69uart_cpu_getdev(int devtype, struct uart_devinfo *di) 70{ 71 char buf[32], dev[32], compat[32]; 72 phandle_t input, options, output; 73 bus_addr_t addr; | 59} 60 61int 62uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) 63{ 64 65 return ((b1->bsh == b2->bsh) ? 1 : 0); 66} 67 68int 69uart_cpu_getdev(int devtype, struct uart_devinfo *di) 70{ 71 char buf[32], dev[32], compat[32]; 72 phandle_t input, options, output; 73 bus_addr_t addr; |
74 int baud, bits, ch, error, space, stop; | 74 int baud, bits, error, space, stop; |
75 char flag, par; 76 77 /* 78 * Get the address of the UART that is selected as the console, if 79 * the console is an UART of course. Note that we enforce that both 80 * stdin and stdout are selected. For weird configurations, use 81 * ofw_console(4). 82 * Note that the currently active console (ie /chosen/stdout and --- 35 unchanged lines hidden (view full) --- 118 if (OF_getprop(input, "name", buf, sizeof(buf)) == -1) 119 return (ENXIO); 120 if (OF_getprop(input, "compatible", compat, sizeof(compat)) == -1) 121 compat[0] = '\0'; 122 di->bas.regshft = 0; 123 di->bas.rclk = 0; 124 if (!strcmp(buf, "se")) { 125 di->ops = uart_sab82532_ops; | 75 char flag, par; 76 77 /* 78 * Get the address of the UART that is selected as the console, if 79 * the console is an UART of course. Note that we enforce that both 80 * stdin and stdout are selected. For weird configurations, use 81 * ofw_console(4). 82 * Note that the currently active console (ie /chosen/stdout and --- 35 unchanged lines hidden (view full) --- 118 if (OF_getprop(input, "name", buf, sizeof(buf)) == -1) 119 return (ENXIO); 120 if (OF_getprop(input, "compatible", compat, sizeof(compat)) == -1) 121 compat[0] = '\0'; 122 di->bas.regshft = 0; 123 di->bas.rclk = 0; 124 if (!strcmp(buf, "se")) { 125 di->ops = uart_sab82532_ops; |
126 addr += 64 * uart_cpu_channel(dev); | 126 di->bas.chan = uart_cpu_channel(dev); 127 addr += 64 * (di->bas.chan - 1); |
127 } else if (!strcmp(buf, "zs")) { 128 di->ops = uart_z8530_ops; | 128 } else if (!strcmp(buf, "zs")) { 129 di->ops = uart_z8530_ops; |
130 di->bas.chan = uart_cpu_channel(dev); |
|
129 di->bas.regshft = 1; | 131 di->bas.regshft = 1; |
130 ch = uart_cpu_channel(dev); 131 addr += 4 - 4 * ch; | 132 addr += 4 - 4 * (di->bas.chan - 1); |
132 } else if (!strcmp(buf, "su") || !strcmp(buf, "su_pnp") || | 133 } else if (!strcmp(buf, "su") || !strcmp(buf, "su_pnp") || |
133 !strcmp(compat, "su") || !strcmp(compat, "su16550")) | 134 !strcmp(compat, "su") || !strcmp(compat, "su16550")) { |
134 di->ops = uart_ns8250_ops; | 135 di->ops = uart_ns8250_ops; |
135 else | 136 di->bas.chan = 0; 137 } else |
136 return (ENXIO); 137 138 /* Fill in the device info. */ | 138 return (ENXIO); 139 140 /* Fill in the device info. */ |
139 di->bas.iobase = addr; | |
140 di->bas.bst = &bst_store[devtype]; 141 di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst); 142 143 /* Get the line settings. */ 144 di->baudrate = 9600; 145 di->databits = 8; 146 di->stopbits = 1; 147 di->parity = UART_PARITY_NONE; --- 13 unchanged lines hidden --- | 141 di->bas.bst = &bst_store[devtype]; 142 di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst); 143 144 /* Get the line settings. */ 145 di->baudrate = 9600; 146 di->databits = 8; 147 di->stopbits = 1; 148 di->parity = UART_PARITY_NONE; --- 13 unchanged lines hidden --- |