Module Name: src
Committed By: cliff
Date: Tue May 18 19:51:43 UTC 2010
Modified Files:
src/sys/arch/evbmips/conf [matt-nb5-mips64]: XLSATX
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_com.c
Log Message:
configure com1 and make it attach correctly
note that config loc 'mult' is assumed to be 4, and so no need to specify
To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/evbmips/conf/XLSATX
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/rmi/rmixl_com.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/evbmips/conf/XLSATX
diff -u src/sys/arch/evbmips/conf/XLSATX:1.1.2.9 src/sys/arch/evbmips/conf/XLSATX:1.1.2.10
--- src/sys/arch/evbmips/conf/XLSATX:1.1.2.9 Tue May 11 21:08:01 2010
+++ src/sys/arch/evbmips/conf/XLSATX Tue May 18 19:51:43 2010
@@ -1,8 +1,8 @@
-# $NetBSD: XLSATX,v 1.1.2.9 2010/05/11 21:08:01 matt Exp $
+# $NetBSD: XLSATX,v 1.1.2.10 2010/05/18 19:51:43 cliff Exp $
include "arch/evbmips/conf/std.rmixl"
-#ident "XLSATX-$Revision: 1.1.2.9 $"
+#ident "XLSATX-$Revision: 1.1.2.10 $"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -141,7 +141,8 @@
cpucore* at cpunode? core ?
cpu* at cpucore? thread ?
obio0 at cpunode?
-com0 at obio0 addr 0x14000 mult 4 intr 9
+com0 at obio0 addr 0x14000 intr 9
+com1 at obio0 addr 0x15000 intr 10
options COM_REGMAP
rmixl_pcix0 at obio0
pci* at rmixl_pcix0
Index: src/sys/arch/mips/rmi/rmixl_com.c
diff -u src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.12 src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.13
--- src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.12 Mon Apr 12 22:42:07 2010
+++ src/sys/arch/mips/rmi/rmixl_com.c Tue May 18 19:51:43 2010
@@ -1,4 +1,4 @@
-/* $Id: rmixl_com.c,v 1.1.2.12 2010/04/12 22:42:07 cliff Exp $ */
+/* $Id: rmixl_com.c,v 1.1.2.13 2010/05/18 19:51:43 cliff Exp $ */
/*-
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
* Copyright (c) 2006 Garrett D'Amore.
@@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rmixl_com.c,v 1.1.2.12 2010/04/12 22:42:07 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_com.c,v 1.1.2.13 2010/05/18 19:51:43 cliff Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -126,6 +126,18 @@
#include "opt_com.h"
+/* span of UART regs in bytes */
+#define RMIXL_IO_DEV_UART_SIZE (COM_NPORTS * sizeof(uint32_t))
+
+#define RMIXL_COM_INIT_REGS(regs, bst, ioh, addr) \
+ do { \
+ memset(®s, 0, sizeof(regs)); \
+ COM_INIT_REGS(regs, bst, ioh, addr); \
+ regs.cr_nports = RMIXL_IO_DEV_UART_SIZE; \
+ rmixl_com_initmap(®s); \
+ } while (0)
+
+
struct rmixl_com_softc {
struct com_softc sc_com;
};
@@ -226,6 +238,7 @@
{
struct obio_attach_args *obio = aux;
bus_space_tag_t bst;
+ bus_space_handle_t ioh;
bus_addr_t addr;
bus_size_t size;
struct com_regs regs;
@@ -233,23 +246,19 @@
bst = obio->obio_eb_bst;
addr = obio->obio_addr;
- size = obio->obio_size;
+ size = (bus_size_t)RMIXL_IO_DEV_UART_SIZE;
if (com_is_console(bst, addr, ®s.cr_ioh))
return 1;
- if (bus_space_map(bst, addr, size, 0, ®s.cr_ioh))
+ if (bus_space_map(bst, addr, size, 0, &ioh))
return 0; /* FAIL */
- memset(®s, 0, sizeof(regs));
- regs.cr_iot = bst;
- regs.cr_iobase = addr;
- regs.cr_nports = size;
- rmixl_com_initmap(®s);
+ RMIXL_COM_INIT_REGS(regs, bst, ioh, addr);
rv = com_probe_subr(®s);
- bus_space_unmap(bst, regs.cr_ioh, size);
+ bus_space_unmap(bst, ioh, size);
return rv;
}
@@ -270,7 +279,7 @@
bst = obio->obio_eb_bst;
addr = obio->obio_addr;
- size = obio->obio_size;
+ size = (bus_size_t)RMIXL_IO_DEV_UART_SIZE;
if (!com_is_console(bst, addr, &ioh)
&& bus_space_map(bst, addr, size, 0, &ioh) != 0) {
@@ -278,10 +287,7 @@
return;
}
- memset(&sc->sc_regs, 0, sizeof(sc->sc_regs));
- COM_INIT_REGS(sc->sc_regs, bst, ioh, addr);
- sc->sc_regs.cr_nports = size;
- rmixl_com_initmap(&sc->sc_regs);
+ RMIXL_COM_INIT_REGS(sc->sc_regs, bst, ioh, addr);
com_attach_subr(sc);
@@ -301,7 +307,7 @@
* map the 4 byte register stride
*/
sz = sizeof(regsp->cr_map) / sizeof(regsp->cr_map[0]);
- for (i = 0; i < 16; i++)
+ for (i = 0; i < sz; i++)
regsp->cr_map[i] = com_std_map[i] * 4;
}
@@ -310,17 +316,11 @@
int type, tcflag_t mode)
{
bus_space_tag_t bst;
- bus_size_t sz;
struct com_regs regs;
bst = (bus_space_tag_t)&rmixl_configuration.rc_obio_eb_memt;
- sz = COM_NPORTS * sizeof(uint32_t); /* span of UART regs in bytes */
- memset(®s, 0, sizeof(regs));
- rmixl_com_initmap(®s);
- regs.cr_iot = bst;
- regs.cr_iobase = addr;
- regs.cr_nports = sz;
+ RMIXL_COM_INIT_REGS(regs, bst, 0, addr);
comcnattach1(®s, speed, freq, type, mode);
}