[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bsd-nomads:15377] Re: CASIO FIVAMPC-206 get



下川です.

At Sat, 07 Apr 2001 23:28:47 +0900,
Tamotsu HATTORI wrote:
> 公開準備が出来ましたのでお知らせします.
> 以下のURLをご参照ください.
> 
>   http://home.att.ne.jp/delta/athlete/longrun.html
> 
> ご意見よろしくお願いします.

FreeBSD-5.0-current on VAIO PCG-C1VJ で使わせていただきました.
気づいたところでは,

(1) module の unload/reload ができない.
(2) devfs で, /dev/longrun0 ではなく /dev/longrun1 ができる.
(3) current では cdevsw の最後がちょっと違う.
(4) source tree につっこむには indent を変えたほうが良いかも..

などがありました. (2)に関連してですが,
static struct longrun_softc *lr[NLONGRUN];
と宣言していながら,
   unit = NLONGRUN;
   scp  = lr[unit];
のように access するのは配列の範囲を越えているので, まずいと思います.
(unit = 0 とすべき)
ただし, lr という配列は, 実質使われていないので, 
ここらへんはざっくり削ってみみました.

ところで, longrun のことは良くしらないのですが, この driver がなくても
default では, pefermance mode で動いていて, CPU clock は 適時切り替っ
ていると考えて良いのでしょうか?
(PCG-C1VJ だと 初めに getmode すると, Current mode: performance mode
と出てきます)

/\ Hidetoshi Shimokawa
\/  simokawa@sat.t.u-tokyo.ac.jp
PGP public key: http://www.sat.t.u-tokyo.ac.jp/~simokawa/pgp.html

--- longrun.c.orig	Wed Apr 11 12:47:02 2001
+++ longrun.c	Wed Apr 11 13:42:21 2001
@@ -64,7 +64,9 @@
 	/* dump */     nodump,
 	/* psize */    nopsize,
 	/* flags */    0,
+#if __FreeBSD_version < 500000
 	/* bmaj */     -1
+#endif
  };
  
 /* 
@@ -93,6 +95,7 @@
 #endif
 } ;
 
+#if 0
 static struct longrun_softc *lr[NLONGRUN];
 
 /* 
@@ -108,6 +111,7 @@
 #else	/* DIAGNOSTIC */
 #define	CHECKUNIT_DIAG(RETVAL)
 #endif 	/* DIAGNOSTIC */
+#endif
 
 static void cpuid(u_int ax, u_int *p);
 static u_int get_longrun_mode(void);
@@ -129,36 +133,56 @@
 
 static int longrunattach(void)
 {
+#if 0
   int unit;
 
   unit = NLONGRUN;
-  make_dev(&longrun_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "longrun%d", unit);
+#endif
+  make_dev(&longrun_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "longrun0");
   return 0;
 }
 
 static int longrun_modevent(module_t mod, int type, void *data)
 {
-  longrunprobe();
-  longrunattach();
-  return 0;
+  switch(type) {
+  case MOD_LOAD:
+    longrunprobe();
+    longrunattach();
+    return 0;
+  case MOD_UNLOAD:
+    destroy_dev(makedev(longrun_cdevsw.d_maj, 0));
+    return 0;
+  case MOD_SHUTDOWN:
+    return 0;
+  default:
+    return EOPNOTSUPP;
+  }
 }
 
 static int longrunioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
 {
+#if 0
   int unit;
+#endif
   int retval = ENXIO;
   u_long eflags;
+#if 0
   struct longrun_softc *scp;
+#endif
   struct longrun_ioctl *lrio;
   
   eflags = read_eflags();
   disable_intr();
   
+#if 0
   unit = NLONGRUN;
   scp  = lr[unit];
+#endif
   lrio = (struct longrun_ioctl *)data;
   
+#if 0
   CHECKUNIT(ENXIO);
+#endif
   
   if(strcmp(cpu_vendor,"GenuineTMx86")==0) {
     switch (cmd) {
@@ -186,9 +210,11 @@
 static  int
 longrunopen(dev_t dev, int oflags, int devtype, struct proc *p)
 {
+#if 0
   int unit = NLONGRUN;
   struct longrun_softc *scp  = lr[unit];
   CHECKUNIT(ENXIO);
+#endif
   
   /* 
    * Do processing
@@ -202,7 +228,9 @@
 static  int
 longrunclose(dev_t dev, int fflag, int devtype, struct proc *p)
 {
+#if 0
   CHECKUNIT_DIAG(ENXIO);
+#endif
   
   /* 
    * Do processing