Deleted Added
full compact
uart_cpu_sparc64.c (133738) uart_cpu_sparc64.c (137819)
1/*
2 * Copyright (c) 2003, 2004 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, 2004 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 133738 2004-08-15 02:17:20Z marius $");
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_cpu_sparc64.c 137819 2004-11-17 14:44:10Z marius $");
29
29
30#include "opt_isa.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34
35#include <machine/bus.h>
36#include <machine/bus_private.h>
30#include <sys/param.h>
31#include <sys/systm.h>
32
33#include <machine/bus.h>
34#include <machine/bus_private.h>
37#include <machine/resource.h>
38
35
39#include <dev/ofw/ofw_bus.h>
40#include <dev/ofw/openfirm.h>
41#include <machine/ofw_machdep.h>
42
36#include <dev/ofw/openfirm.h>
37#include <machine/ofw_machdep.h>
38
43#include <isa/isavar.h>
44
45#include <dev/uart/uart.h>
39#include <dev/uart/uart.h>
46#include <dev/uart/uart_bus.h>
47#include <dev/uart/uart_cpu.h>
48
40#include <dev/uart/uart_cpu.h>
41
49#include <sparc64/pci/ofw_pci.h>
50#include <sparc64/isa/ofw_isa.h>
51
52bus_space_tag_t uart_bus_space_io;
53bus_space_tag_t uart_bus_space_mem;
54
55static struct bus_space_tag bst_store[3];
56
57static int
58uart_cpu_channel(char *dev)
59{

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

247 di->parity = (par == 'n') ? UART_PARITY_NONE :
248 (par == 'o') ? UART_PARITY_ODD : UART_PARITY_EVEN;
249 return (0);
250}
251
252void
253uart_cpu_identify(driver_t *driver, device_t parent)
254{
42bus_space_tag_t uart_bus_space_io;
43bus_space_tag_t uart_bus_space_mem;
44
45static struct bus_space_tag bst_store[3];
46
47static int
48uart_cpu_channel(char *dev)
49{

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

237 di->parity = (par == 'n') ? UART_PARITY_NONE :
238 (par == 'o') ? UART_PARITY_ODD : UART_PARITY_EVEN;
239 return (0);
240}
241
242void
243uart_cpu_identify(driver_t *driver, device_t parent)
244{
255#ifdef DEV_ISA
256 char buf[32];
257 struct isa_regs reg;
258 device_t child;
259 phandle_t node;
260 ofw_isa_intr_t intr;
261#endif
262
245
263#ifdef DEV_ISA
264 if (strcmp(device_get_name(parent), "isa") == 0) {
265 if ((node = ofw_bus_get_node(device_get_parent(parent))) == 0)
266 return;
267 for (node = OF_child(node); node != 0; node = OF_peer(node)) {
268 if (OF_getprop(node, "name", buf, sizeof(buf)) == -1)
269 continue;
270 if (strcmp(buf, "serial") != 0)
271 continue;
272 if ((OF_getprop(node, "reg", &reg,
273 sizeof(reg)) == -1) ||
274 (OF_getprop(node, "interrupts", &intr,
275 sizeof(intr)) == -1))
276 continue;
277 if ((child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE,
278 uart_driver_name, -1)) == NULL)
279 return;
280 bus_set_resource(child, SYS_RES_IOPORT, 0,
281 ISA_REG_PHYS(&reg), reg.size);
282 bus_set_resource(child, SYS_RES_IRQ, 0, intr, 1);
283 }
284 }
285#endif
286}
246}