Deleted Added
full compact
uart_cpu_sparc64.c (200926) uart_cpu_sparc64.c (206451)
1/*-
2 * Copyright (c) 2003, 2004 Marcel Moolenaar
3 * Copyright (c) 2004 - 2006 Marius Strobl <marius@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, 2004 Marcel Moolenaar
3 * Copyright (c) 2004 - 2006 Marius Strobl <marius@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/uart/uart_cpu_sparc64.c 200926 2009-12-23 22:31:43Z marius $");
29__FBSDID("$FreeBSD: head/sys/dev/uart/uart_cpu_sparc64.c 206451 2010-04-10 11:52:12Z marius $");
30
31#include <sys/param.h>
32#include <sys/systm.h>
33
34#include <machine/bus.h>
35#include <machine/bus_private.h>
36
37#include <dev/ofw/openfirm.h>

--- 90 unchanged lines hidden (view full) ---

128 snprintf(dev, devsz, "ttya");
129 }
130 if (input != output)
131 return (-1);
132 if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1)
133 return (-1);
134 if (strcmp(buf, "serial") != 0)
135 return (-1);
30
31#include <sys/param.h>
32#include <sys/systm.h>
33
34#include <machine/bus.h>
35#include <machine/bus_private.h>
36
37#include <dev/ofw/openfirm.h>

--- 90 unchanged lines hidden (view full) ---

128 snprintf(dev, devsz, "ttya");
129 }
130 if (input != output)
131 return (-1);
132 if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1)
133 return (-1);
134 if (strcmp(buf, "serial") != 0)
135 return (-1);
136 /* For a Serengeti console device point to the bootbus controller. */
137 if (OF_getprop(input, "name", buf, sizeof(buf)) > 0 &&
138 !strcmp(buf, "sgcn")) {
139 if ((chosen = OF_finddevice("/chosen")) == -1)
140 return (-1);
141 if (OF_getprop(chosen, "iosram", &input, sizeof(input)) == -1)
142 return (-1);
143 }
136 return (input);
137}
138
139/*
140 * Get the package handle of the UART that's selected as the debug port.
141 * Since there's no place for this in the OF, we use the kernel environment
142 * variable "hw.uart.dbgport". Note however that the variable is not a
143 * list of attributes. It's single device name or alias, as known by

--- 109 unchanged lines hidden (view full) ---

253 range = uart_getrange(class) << di->bas.regshft;
254 addr += range - range * (di->bas.chan - 1);
255 } else if (!strcmp(buf, "lom-console") || !strcmp(buf, "su") ||
256 !strcmp(buf, "su_pnp") || !strcmp(compat, "rsc-console") ||
257 !strcmp(compat, "su") || !strcmp(compat, "su16550") ||
258 !strcmp(compat, "su16552")) {
259 class = &uart_ns8250_class;
260 di->bas.chan = 0;
144 return (input);
145}
146
147/*
148 * Get the package handle of the UART that's selected as the debug port.
149 * Since there's no place for this in the OF, we use the kernel environment
150 * variable "hw.uart.dbgport". Note however that the variable is not a
151 * list of attributes. It's single device name or alias, as known by

--- 109 unchanged lines hidden (view full) ---

261 range = uart_getrange(class) << di->bas.regshft;
262 addr += range - range * (di->bas.chan - 1);
263 } else if (!strcmp(buf, "lom-console") || !strcmp(buf, "su") ||
264 !strcmp(buf, "su_pnp") || !strcmp(compat, "rsc-console") ||
265 !strcmp(compat, "su") || !strcmp(compat, "su16550") ||
266 !strcmp(compat, "su16552")) {
267 class = &uart_ns8250_class;
268 di->bas.chan = 0;
269 } else if (!strcmp(compat, "sgsbbc")) {
270 class = &uart_sbbc_class;
271 di->bas.chan = 0;
261 }
262 if (class == NULL)
263 return (ENXIO);
264
265 /* Fill in the device info. */
266 di->ops = uart_getops(class);
267 di->bas.bst = &bst_store[devtype];
268 di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst);

--- 25 unchanged lines hidden ---
272 }
273 if (class == NULL)
274 return (ENXIO);
275
276 /* Fill in the device info. */
277 di->ops = uart_getops(class);
278 di->bas.bst = &bst_store[devtype];
279 di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst);

--- 25 unchanged lines hidden ---