[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OpenBlockSS
清原です
反応がすごく遅くなりましたが、、、
# subscribe していなかったのですが、年末に偶然読んで気づきました。
# 年末に読んだとしてもおそすぎですが。
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Date: Fri, 26 Dec 2003 20:53:35 +0900
> (1)マシン依存の consinit() を指す関数ポインタ (consinit_machdep() とか)
> を evbppc_machdep.c あたりに用意する
> (2)マシン個別の初期化関数(obs405/machdep.c:initppc()とか)内で
> (1)の関数ポインタに各ボード別の consinit 関数
> (例えば consinit_explora()とか)を設定する
> (3)evbppc 共通の consinit() 関数は evbppc_machdep.c の中に置いて
> 上記の (*consinit_machdep)() を呼ぶだけにする
> (4)今の {walnut,opb405}/consinit.c の consinit() で
> 行っている処理は com_opb_cnattach() かなんかに名前を変えて
> arch/powerpc/ibm4xx/dev/com_opb.c の中に入れてしまう
> (周波数指定は清原さんのパッチのように com_freq の変数に直して、
> com_freq の値も各ボード依存初期化部で設定する)
> (5)各マシン依存の (*consinit_machdep)() ではそれぞれに応じた処理を書く。
> walnut や obp405 のように com_obp しかないマシン用には
> 上記の com_opb_cnattach() を呼ぶだけの関数をどこかに用意して
> それを共用すればよい。
をやってみました。
現状はとりあえず obs405 用のみですが、walnut, explora, ev64260 について
もパッチにしてしまう方がいいですよね?
あと、一点問題がありました。
walnut, obs405 には consinit.c に kgdb_port_init() というのが #ifdef KGDB
で書かれているのですが、これってどうしましょう?
私は恥ずかしながら、kgdb など使用した事がないのでよく分かっていませんが、
あきらかに opb 依存のコードになっているようです。しかしこれ、ちゃんと動く
コードなのでしょうか? みたところ OPENBLOCKS266 にも WALNUT にも options
KGDB など見当たらない気がします。
# やっぱり消しちゃうのはまずいですかね。。。
--
kiyohara
Index: arch/evbppc/evbppc/evbppc_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/evbppc/evbppc_machdep.c,v
retrieving revision 1.4
diff -c -r1.4 evbppc_machdep.c
*** arch/evbppc/evbppc/evbppc_machdep.c 2003/07/25 11:44:19 1.4
--- arch/evbppc/evbppc/evbppc_machdep.c 2004/01/12 04:58:26
***************
*** 79,85 ****
--- 79,88 ----
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/pmap.h>
+ #include <machine/autoconf.h>
+ #include <powerpc/ibm4xx/dev/opbvar.h>
+
int fake_mapiodev = 1;
/*
***************
*** 115,118 ****
--- 118,139 ----
}
pmap_update(pmap_kernel());
return (void *)(va + off);
+ }
+
+ /*
+ * consinit:
+ * initialize the system console.
+ * XXX - shouldn't deal with this initted thing, but then,
+ * it shouldn't be called from initppc either.
+ */
+ void
+ consinit()
+ {
+ (*consinit_machdep)();
+ }
+
+ void
+ generic_cnattach(int conspeed, int com_freq, int comcnmode)
+ {
+ com_opb_cnattach(conspeed, com_freq, comcnmode);
}
Index: arch/evbppc/obs405/consinit.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/obs405/consinit.c,v
retrieving revision 1.1
diff -c -r1.1 consinit.c
*** arch/evbppc/obs405/consinit.c 2003/09/23 14:45:14 1.1
--- arch/evbppc/obs405/consinit.c 2004/01/12 04:58:26
***************
*** 34,61 ****
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/bus.h>
- #include <powerpc/ibm4xx/ibm405gp.h>
- #include <powerpc/ibm4xx/dev/opbvar.h>
-
- #include "com.h"
- #if (NCOM > 0)
- #include <sys/termios.h>
#include <dev/ic/comreg.h>
- #include <dev/ic/comvar.h>
- #endif
- #include <dev/cons.h>
-
- #ifndef CONSDEVNAME
- #define CONSDEVNAME "com"
- #endif
-
- #if (NCOM > 0)
- #ifndef CONADDR
- #define CONADDR IBM405GP_UART0_BASE
- #endif
#ifndef CONSPEED
#define CONSPEED B9600 /* */
// #define CONSPEED B115200 /* 9600 is too slow for my taste */
--- 34,46 ----
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+ #include <sys/termios.h>
#include <machine/bus.h>
+ #include <machine/autoconf.h>
+ #include <machine/obs405.h>
#include <dev/ic/comreg.h>
#ifndef CONSPEED
#define CONSPEED B9600 /* */
// #define CONSPEED B115200 /* 9600 is too slow for my taste */
***************
*** 63,70 ****
#ifndef CONMODE
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
#endif
- int comcnmode = CONMODE;
- #endif /* NCOM */
#ifdef KGDB
#ifndef KGDB_DEVNAME
--- 48,53 ----
***************
*** 92,127 ****
#endif /* KGDB */
- /*
- * consinit:
- * initialize the system console.
- * XXX - shouldn't deal with this initted thing, but then,
- * it shouldn't be called from initppc either.
- */
void
! consinit(void)
{
! static int initted = 0;
! #if (NCOM > 0)
! bus_space_tag_t tag;
! #endif
! if (initted)
! return;
! initted = 1;
!
! #if (NCOM > 0)
! /* We *know* the com-console attaches to opb */
! tag = opb_get_bus_space_tag();
!
! if (comcnattach(tag, CONADDR, CONSPEED, COM_FREQ*4,
! COM_TYPE_NORMAL, comcnmode))
! panic("can't init serial console @%x", CONADDR);
! else
! return;
! #endif
! panic("console device missing -- serial console not in kernel");
! /* Of course, this is moot if there is no console... */
}
#ifdef KGDB
--- 75,86 ----
#endif /* KGDB */
void
! consinit_obs405(void)
{
! com_freq = COM_FREQ * 4;
! generic_cnattach(CONSPEED, com_freq, CONMODE);
}
#ifdef KGDB
***************
*** 131,137 ****
#if (NCOM > 0)
if(!strcmp(kgdb_devname, "com")) {
bus_space_tag_t tag = opb_get_bus_space_tag();
! com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ * 4,
COM_TYPE_NORMAL, comkgdbmode);
}
#endif
--- 90,96 ----
#if (NCOM > 0)
if(!strcmp(kgdb_devname, "com")) {
bus_space_tag_t tag = opb_get_bus_space_tag();
! com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, com_freq,
COM_TYPE_NORMAL, comkgdbmode);
}
#endif
Index: arch/evbppc/obs405/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/obs405/machdep.c,v
retrieving revision 1.1
diff -c -r1.1 machdep.c
*** arch/evbppc/obs405/machdep.c 2003/09/23 14:45:14 1.1
--- arch/evbppc/obs405/machdep.c 2004/01/12 04:58:26
***************
*** 100,105 ****
--- 100,107 ----
#include <machine/bus.h>
#include <machine/trap.h>
#include <machine/powerpc.h>
+ #include <machine/autoconf.h>
+ #include <machine/obs405.h>
#include <powerpc/spr.h>
#include <powerpc/ibm4xx/dcr405gp.h>
***************
*** 129,134 ****
--- 131,137 ----
ibm4xx_init_board_data(info_block, startkernel);
+ consinit_machdep = consinit_obs405;
ibm4xx_init((void (*)(void))ext_intr);
/*
Index: arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c,v
retrieving revision 1.1
diff -c -r1.1 ibm4xxgpx_autoconf.c
*** arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 2003/09/24 11:47:02 1.1
--- arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c 2004/01/12 04:58:34
***************
*** 46,51 ****
--- 46,52 ----
struct device *booted_device;
int booted_partition;
+ int com_freq;
/*
* List of port-specific devices to attach to the processor local bus.
***************
*** 101,110 ****
if (strcmp(dev->dv_cfdata->cf_name, "com") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
/* Set the frequency of the on-chip UART. */
- int freq = COM_FREQ * 6;
-
if (prop_set(dev_propdb, dev, "frequency",
! &freq, sizeof(freq), PROP_INT, 0) != 0)
printf("WARNING: unable to set frequency "
"property for %s\n", dev->dv_xname);
return;
--- 102,109 ----
if (strcmp(dev->dv_cfdata->cf_name, "com") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
/* Set the frequency of the on-chip UART. */
if (prop_set(dev_propdb, dev, "frequency",
! &com_freq, sizeof(com_freq), PROP_INT, 0) != 0)
printf("WARNING: unable to set frequency "
"property for %s\n", dev->dv_xname);
return;
Index: arch/powerpc/ibm4xx/dev/com_opb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/dev/com_opb.c,v
retrieving revision 1.11
diff -c -r1.11 com_opb.c
*** arch/powerpc/ibm4xx/dev/com_opb.c 2003/07/15 02:54:44 1.11
--- arch/powerpc/ibm4xx/dev/com_opb.c 2004/01/12 04:58:34
***************
*** 47,57 ****
--- 47,71 ----
#include <machine/cpu.h>
+ #include <powerpc/ibm4xx/ibm405gp.h>
#include <powerpc/ibm4xx/dev/opbvar.h>
+ #include <dev/cons.h>
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
+ #include "com.h"
+
+ #ifndef CONSDEVNAME
+ #define CONSDEVNAME "com"
+ #endif
+
+ #if (NCOM > 0)
+ #ifndef CONADDR
+ #define CONADDR IBM405GP_UART0_BASE
+ #endif
+ #endif /* NCOM */
+
struct com_opb_softc {
struct com_softc sc_com;
void *sc_ih;
***************
*** 62,67 ****
--- 76,107 ----
CFATTACH_DECL(com_opb, sizeof(struct com_opb_softc),
com_opb_probe, com_opb_attach, NULL, NULL);
+
+ void
+ com_opb_cnattach(int conspeed, int com_freq, int comcnmode)
+ {
+ static int initted = 0;
+ #if (NCOM > 0)
+ bus_space_tag_t tag;
+ #endif
+
+ if (initted)
+ return;
+ initted = 1;
+
+ #if (NCOM > 0)
+ /* We *know* the com-console attaches to opb */
+ tag = opb_get_bus_space_tag();
+
+ if (comcnattach(
+ tag, CONADDR, conspeed, com_freq, COM_TYPE_NORMAL, comcnmode))
+ panic("can't init serial console @%x", CONADDR);
+ else
+ return;
+ #endif
+ panic("console device missing -- serial console not in kernel");
+ /* Of course, this is moot if there is no console... */
+ }
int
com_opb_probe(struct device *parent, struct cfdata *cf, void *aux)
Index: arch/powerpc/ibm4xx/dev/opbvar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/dev/opbvar.h,v
retrieving revision 1.2
diff -c -r1.2 opbvar.h
*** arch/powerpc/ibm4xx/dev/opbvar.h 2003/07/25 10:12:44 1.2
--- arch/powerpc/ibm4xx/dev/opbvar.h 2004/01/12 04:58:34
***************
*** 47,49 ****
--- 47,51 ----
/* For use before opb_attach() is called */
extern bus_space_tag_t opb_get_bus_space_tag(void);
+
+ void com_opb_cnattach(int, int, int);
/* $NetBSD$ */
/*
* Copyright (c) 2003
* KIYOHARA Takashi. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _EVBPPC_AUTOCONF_H_
#define _EVBPPC_AUTOCONF_H_
void (*consinit_machdep) __P((void));
void generic_cnattach(int, int, int);
extern int com_freq;
#endif /* _EVBARM_AUTOCONF_H_ */
/* $NetBSD$ */
/*
* Copyright (c) 2003
* KIYOHARA Takashi. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _OBS405_H
#define _OBS405_H
void consinit_obs405(void);
#endif /* _OBS405_H */