Home | History | Annotate | Line # | Download | only in vr
vrkiu.c revision 1.28
      1  1.28     enami /*	$NetBSD: vrkiu.c,v 1.28 2001/06/11 06:11:01 enami Exp $	*/
      2   1.1  takemura 
      3   1.1  takemura /*-
      4   1.2  takemura  * Copyright (c) 1999 SASAKI Takesi All rights reserved.
      5  1.25  takemura  * Copyright (c) 1999,2000 TAKEMRUA, Shin All rights reserved.
      6   1.1  takemura  * Copyright (c) 1999 PocketBSD Project. All rights reserved.
      7   1.1  takemura  *
      8   1.1  takemura  * Redistribution and use in source and binary forms, with or without
      9   1.1  takemura  * modification, are permitted provided that the following conditions
     10   1.1  takemura  * are met:
     11   1.1  takemura  * 1. Redistributions of source code must retain the above copyright
     12   1.1  takemura  *    notice, this list of conditions and the following disclaimer.
     13   1.1  takemura  * 2. Redistributions in binary form must reproduce the above copyright
     14   1.1  takemura  *    notice, this list of conditions and the following disclaimer in the
     15   1.1  takemura  *    documentation and/or other materials provided with the distribution.
     16   1.1  takemura  * 3. All advertising materials mentioning features or use of this software
     17   1.1  takemura  *    must display the following acknowledgement:
     18   1.1  takemura  *	This product includes software developed by the PocketBSD project
     19   1.1  takemura  *	and its contributors.
     20   1.1  takemura  * 4. Neither the name of the project nor the names of its contributors
     21   1.1  takemura  *    may be used to endorse or promote products derived from this software
     22   1.1  takemura  *    without specific prior written permission.
     23   1.1  takemura  *
     24   1.1  takemura  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25   1.1  takemura  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26   1.1  takemura  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27   1.1  takemura  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28   1.1  takemura  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29   1.1  takemura  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30   1.1  takemura  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31   1.1  takemura  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32   1.1  takemura  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33   1.1  takemura  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34   1.1  takemura  * SUCH DAMAGE.
     35   1.1  takemura  *
     36   1.1  takemura  */
     37   1.1  takemura 
     38   1.1  takemura #include <sys/param.h>
     39   1.1  takemura #include <sys/tty.h>
     40   1.1  takemura #include <sys/systm.h>
     41   1.1  takemura #include <sys/device.h>
     42   1.1  takemura #include <sys/conf.h>
     43   1.1  takemura #include <sys/kernel.h>
     44   1.1  takemura #include <sys/proc.h>
     45   1.1  takemura 
     46   1.1  takemura #include <machine/intr.h>
     47   1.1  takemura #include <machine/cpu.h>
     48   1.1  takemura #include <machine/bus.h>
     49   1.1  takemura #include <machine/platid.h>
     50   1.5      shin #include <machine/platid_mask.h>
     51   1.1  takemura 
     52  1.28     enami #include <dev/hpc/hpckbdvar.h>
     53  1.28     enami 
     54   1.1  takemura #include <hpcmips/vr/vr.h>
     55   1.1  takemura #include <hpcmips/vr/vripvar.h>
     56  1.28     enami #include <hpcmips/vr/vrkiureg.h>
     57   1.1  takemura #include <hpcmips/vr/vrkiuvar.h>
     58   1.1  takemura #include <hpcmips/vr/icureg.h>
     59   1.1  takemura 
     60  1.21  takemura #include "opt_wsdisplay_compat.h"
     61  1.21  takemura #include "opt_pckbd_layout.h"
     62   1.2  takemura #include <dev/wscons/wsconsio.h>
     63   1.2  takemura #include <dev/wscons/wskbdvar.h>
     64   1.2  takemura #include <dev/wscons/wsksymdef.h>
     65   1.2  takemura #include <dev/wscons/wsksymvar.h>
     66   1.2  takemura #include <dev/pckbc/wskbdmap_mfii.h>
     67  1.21  takemura #ifdef WSDISPLAY_COMPAT_RAWKBD
     68  1.26       uch #include <dev/hpc/pckbd_encode.h>
     69  1.21  takemura #endif
     70   1.2  takemura 
     71  1.21  takemura #define VRKIUDEBUG
     72   1.1  takemura #ifdef VRKIUDEBUG
     73   1.1  takemura int vrkiu_debug = 0;
     74   1.1  takemura #define DPRINTF(arg) if (vrkiu_debug) printf arg;
     75   1.1  takemura #else
     76   1.1  takemura #define	DPRINTF(arg)
     77   1.1  takemura #endif
     78   1.2  takemura 
     79   1.2  takemura /*
     80   1.2  takemura  * function prototypes
     81   1.2  takemura  */
     82   1.1  takemura static int vrkiumatch __P((struct device *, struct cfdata *, void *));
     83   1.1  takemura static void vrkiuattach __P((struct device *, struct device *, void *));
     84   1.1  takemura 
     85   1.2  takemura int vrkiu_intr __P((void *));
     86   1.2  takemura 
     87   1.2  takemura static int vrkiu_init(struct vrkiu_chip*, bus_space_tag_t, bus_space_handle_t);
     88   1.2  takemura static void vrkiu_write __P((struct vrkiu_chip *, int, unsigned short));
     89   1.2  takemura static unsigned short vrkiu_read __P((struct vrkiu_chip *, int));
     90   1.2  takemura static int vrkiu_is_console(bus_space_tag_t, bus_space_handle_t);
     91  1.25  takemura static void vrkiu_scan __P((struct vrkiu_chip *));
     92  1.24      shin static int countbits(int);
     93  1.24      shin static void eliminate_phantom_keys(struct vrkiu_chip*, unsigned short *);
     94  1.25  takemura static int vrkiu_poll __P((void*));
     95  1.25  takemura static int vrkiu_input_establish __P((void*, struct hpckbd_if*));
     96   1.1  takemura 
     97   1.2  takemura /*
     98   1.2  takemura  * global/static data
     99   1.2  takemura  */
    100   1.1  takemura struct cfattach vrkiu_ca = {
    101   1.1  takemura 	sizeof(struct vrkiu_softc), vrkiumatch, vrkiuattach
    102   1.1  takemura };
    103   1.1  takemura 
    104   1.2  takemura struct vrkiu_chip *vrkiu_consdata = NULL;
    105   1.1  takemura 
    106   1.2  takemura /*
    107   1.2  takemura  * utilities
    108   1.2  takemura  */
    109   1.2  takemura static inline void
    110   1.2  takemura vrkiu_write(chip, port, val)
    111   1.2  takemura 	struct vrkiu_chip *chip;
    112   1.2  takemura 	int port;
    113   1.2  takemura 	unsigned short val;
    114   1.2  takemura {
    115   1.2  takemura 	bus_space_write_2(chip->kc_iot, chip->kc_ioh, port, val);
    116   1.2  takemura }
    117   1.1  takemura 
    118   1.2  takemura static inline unsigned short
    119   1.2  takemura vrkiu_read(chip, port)
    120   1.2  takemura 	struct vrkiu_chip *chip;
    121   1.2  takemura 	int port;
    122   1.2  takemura {
    123   1.2  takemura 	return bus_space_read_2(chip->kc_iot, chip->kc_ioh, port);
    124   1.2  takemura }
    125   1.1  takemura 
    126   1.2  takemura static inline int
    127   1.2  takemura vrkiu_is_console(iot, ioh)
    128   1.2  takemura 	bus_space_tag_t iot;
    129   1.2  takemura 	bus_space_handle_t ioh;
    130   1.2  takemura {
    131   1.2  takemura 	if (vrkiu_consdata &&
    132   1.2  takemura 	    vrkiu_consdata->kc_iot == iot &&
    133   1.2  takemura 	    vrkiu_consdata->kc_ioh == ioh) {
    134   1.2  takemura 		return 1;
    135   1.2  takemura 	} else {
    136   1.2  takemura 		return 0;
    137   1.2  takemura 	}
    138   1.2  takemura }
    139   1.2  takemura 
    140   1.2  takemura /*
    141   1.2  takemura  * initialize device
    142   1.2  takemura  */
    143   1.2  takemura static int
    144   1.2  takemura vrkiu_init(chip, iot, ioh)
    145   1.2  takemura 	struct vrkiu_chip* chip;
    146   1.2  takemura 	bus_space_tag_t iot;
    147   1.2  takemura 	bus_space_handle_t ioh;
    148   1.2  takemura {
    149   1.2  takemura 	memset(chip, 0, sizeof(struct vrkiu_chip));
    150   1.2  takemura 	chip->kc_iot = iot;
    151   1.2  takemura 	chip->kc_ioh = ioh;
    152  1.25  takemura 	chip->kc_enabled = 0;
    153  1.25  takemura 
    154  1.25  takemura 	chip->kc_if.hii_ctx		= chip;
    155  1.25  takemura 	chip->kc_if.hii_establish	= vrkiu_input_establish;
    156  1.25  takemura 	chip->kc_if.hii_poll		= vrkiu_poll;
    157   1.1  takemura 
    158   1.2  takemura 	/* set KIU */
    159   1.2  takemura 	vrkiu_write(chip, KIURST, 1);   /* reset */
    160   1.2  takemura 	vrkiu_write(chip, KIUSCANLINE, 0); /* 96keys */
    161   1.2  takemura 	vrkiu_write(chip, KIUWKS, 0x18a4); /* XXX: scan timing! */
    162   1.2  takemura 	vrkiu_write(chip, KIUWKI, 450);
    163   1.2  takemura 	vrkiu_write(chip, KIUSCANREP, 0x8023);
    164   1.2  takemura 				/* KEYEN | STPREP = 2 | ATSTP | ATSCAN */
    165  1.25  takemura 
    166   1.2  takemura 	return 0;
    167   1.2  takemura }
    168   1.1  takemura 
    169   1.2  takemura /*
    170   1.2  takemura  * probe
    171   1.2  takemura  */
    172   1.1  takemura static int
    173   1.1  takemura vrkiumatch(parent, cf, aux)
    174   1.1  takemura 	struct device *parent;
    175   1.1  takemura 	struct cfdata *cf;
    176   1.1  takemura 	void *aux;
    177   1.1  takemura {
    178   1.2  takemura 	return 1;
    179   1.1  takemura }
    180   1.1  takemura 
    181   1.2  takemura /*
    182   1.2  takemura  * attach
    183   1.2  takemura  */
    184   1.1  takemura static void
    185   1.1  takemura vrkiuattach(parent, self, aux)
    186   1.1  takemura 	struct device *parent;
    187   1.1  takemura 	struct device *self;
    188   1.1  takemura 	void *aux;
    189   1.1  takemura {
    190   1.1  takemura 	struct vrkiu_softc *sc = (struct vrkiu_softc *)self;
    191   1.1  takemura 	struct vrip_attach_args *va = aux;
    192  1.25  takemura 	struct hpckbd_attach_args haa;
    193   1.2  takemura 	int isconsole;
    194   1.1  takemura 
    195   1.1  takemura 	bus_space_tag_t iot = va->va_iot;
    196   1.1  takemura 	bus_space_handle_t ioh;
    197   1.1  takemura 
    198   1.1  takemura 	if (bus_space_map(iot, va->va_addr, 1, 0, &ioh)) {
    199   1.1  takemura 		printf(": can't map bus space\n");
    200   1.1  takemura 		return;
    201   1.1  takemura 	}
    202   1.1  takemura 
    203   1.2  takemura 	isconsole = vrkiu_is_console(iot, ioh);
    204   1.2  takemura 	if (isconsole) {
    205   1.2  takemura 		sc->sc_chip = vrkiu_consdata;
    206   1.2  takemura 	} else {
    207   1.2  takemura 		sc->sc_chip = &sc->sc_chip_body;
    208   1.2  takemura 		vrkiu_init(sc->sc_chip, iot, ioh);
    209   1.2  takemura 	}
    210   1.2  takemura 	sc->sc_chip->kc_sc = sc;
    211   1.1  takemura 
    212   1.1  takemura 	if (!(sc->sc_handler =
    213   1.1  takemura 	      vrip_intr_establish(va->va_vc, va->va_intr, IPL_TTY,
    214   1.1  takemura 				  vrkiu_intr, sc))) {
    215   1.1  takemura 		printf (": can't map interrupt line.\n");
    216   1.1  takemura 		return;
    217   1.1  takemura 	}
    218   1.1  takemura 	/* Level2 register setting */
    219   1.1  takemura 	vrip_intr_setmask2(va->va_vc, sc->sc_handler, KIUINT_KDATRDY, 1);
    220   1.1  takemura 
    221   1.1  takemura 	printf("\n");
    222   1.2  takemura 
    223  1.25  takemura 	/* attach hpckbd */
    224  1.25  takemura 	haa.haa_ic = &sc->sc_chip->kc_if;
    225  1.25  takemura 	config_found(self, &haa, hpckbd_print);
    226   1.1  takemura }
    227   1.1  takemura 
    228   1.1  takemura int
    229   1.1  takemura vrkiu_intr(arg)
    230   1.1  takemura 	void *arg;
    231   1.1  takemura {
    232   1.1  takemura         struct vrkiu_softc *sc = arg;
    233   1.2  takemura 
    234   1.1  takemura 	/* When key scan finisshed, this entry is called. */
    235  1.25  takemura #if 0
    236  1.25  takemura 	DPRINTF(("vrkiu_intr: intr=%x scan=%x\n",
    237  1.25  takemura 		 vrkiu_read(sc->sc_chip, KIUINT) & 7,
    238  1.25  takemura 		 vrkiu_read(sc->sc_chip, KIUSCANS) & KIUSCANS_SSTAT_MASK));
    239  1.25  takemura #endif
    240   1.2  takemura 
    241   1.4  takemura 	/*
    242   1.4  takemura 	 * First, we must clear the interrupt register because
    243  1.25  takemura 	 * vrkiu_scan() may takes long time if a bitmap screen
    244   1.4  takemura 	 * scrolls up and it makes us to miss some key release
    245   1.4  takemura 	 * event.
    246   1.4  takemura 	 */
    247   1.4  takemura 	vrkiu_write(sc->sc_chip, KIUINT, 0x7); /* Clear all interrupt */
    248   1.1  takemura 
    249  1.25  takemura #if 1
    250  1.25  takemura 	/* just return if kiu is scanning keyboard. */
    251  1.25  takemura 	if ((vrkiu_read(sc->sc_chip, KIUSCANS) & KIUSCANS_SSTAT_MASK) ==
    252  1.25  takemura 	       KIUSCANS_SSTAT_SCANNING)
    253  1.25  takemura 		return (0);
    254  1.25  takemura #endif
    255  1.25  takemura 	vrkiu_scan(sc->sc_chip);
    256  1.25  takemura 
    257  1.25  takemura 	return (0);
    258   1.1  takemura }
    259   1.1  takemura 
    260  1.12  takemura static int
    261  1.24      shin countbits(d)
    262  1.24      shin 	int d;
    263  1.24      shin {
    264  1.24      shin 	int i, n;
    265  1.24      shin 
    266  1.24      shin 	for (i = 0, n = 0; i < NBBY; i++)
    267  1.24      shin 		if (d & (1 << i))
    268  1.24      shin 			n++;
    269  1.24      shin 	return n;
    270  1.24      shin }
    271  1.24      shin 
    272  1.24      shin static void
    273  1.24      shin eliminate_phantom_keys(chip, scandata)
    274  1.24      shin 	struct vrkiu_chip* chip;
    275  1.24      shin 	unsigned short *scandata;
    276  1.24      shin {
    277  1.25  takemura 	unsigned char inkey[KIU_NSCANLINE], *prevkey, *reskey;
    278  1.25  takemura 	int i, j;
    279  1.25  takemura #ifdef VRKIUDEBUG
    280  1.25  takemura 	int modified = 0;
    281  1.25  takemura 	static int prevmod = 0;
    282  1.25  takemura #endif
    283  1.24      shin 
    284  1.25  takemura 	reskey = (unsigned char *)scandata;
    285  1.25  takemura 	for (i = 0; i < KIU_NSCANLINE; i++)
    286  1.25  takemura 		inkey[i] = reskey[i];
    287  1.25  takemura 	prevkey = (unsigned char *)chip->kc_scandata;
    288  1.25  takemura 
    289  1.25  takemura 	for (i = 0; i < KIU_NSCANLINE; i++) {
    290  1.25  takemura 	    if (countbits(inkey[i]) > 1) {
    291  1.25  takemura 		for (j = 0; j < KIU_NSCANLINE; j++) {
    292  1.25  takemura 		    if (i != j && (inkey[i] & inkey[j])) {
    293  1.25  takemura #ifdef VRKIUDEBUG
    294  1.25  takemura 			    modified = 1;
    295  1.25  takemura 			    if (!prevmod) {
    296  1.25  takemura 				DPRINTF(("vrkiu_scan: %x:%02x->%02x",
    297  1.25  takemura 					 i, inkey[i], prevkey[i]));
    298  1.25  takemura 				DPRINTF(("  %x:%02x->%02x\n",
    299  1.25  takemura 					 j, inkey[j], prevkey[j]));
    300  1.25  takemura 			    }
    301  1.25  takemura #endif
    302  1.25  takemura 			    reskey[i] = prevkey[i];
    303  1.25  takemura 			    reskey[j] = prevkey[j];
    304  1.25  takemura 		    }
    305  1.24      shin 		}
    306  1.25  takemura 	    }
    307  1.24      shin 	}
    308  1.25  takemura #ifdef VRKIUDEBUG
    309  1.25  takemura 	prevmod = modified;
    310  1.25  takemura #endif
    311  1.24      shin }
    312  1.24      shin 
    313  1.25  takemura static void
    314  1.25  takemura vrkiu_scan(chip)
    315   1.2  takemura 	struct vrkiu_chip* chip;
    316   1.1  takemura {
    317   1.2  takemura 	int i, j, modified, mask;
    318   1.2  takemura 	unsigned short scandata[KIU_NSCANLINE/2];
    319   1.1  takemura 
    320  1.25  takemura 	if (!chip->kc_enabled)
    321  1.25  takemura 		return;
    322  1.25  takemura 
    323   1.1  takemura 	for (i = 0; i < KIU_NSCANLINE / 2; i++) {
    324   1.2  takemura 		scandata[i] = vrkiu_read(chip, KIUDATP + i * 2);
    325   1.1  takemura 	}
    326  1.24      shin 	eliminate_phantom_keys(chip, scandata);
    327   1.1  takemura 
    328   1.2  takemura 	for (i = 0; i < KIU_NSCANLINE / 2; i++) {
    329   1.2  takemura 		modified = scandata[i] ^ chip->kc_scandata[i];
    330  1.16   mycroft 		chip->kc_scandata[i] = scandata[i];
    331   1.2  takemura 		mask = 1;
    332   1.3     enami 		for (j = 0; j < 16; j++, mask <<= 1) {
    333  1.16   mycroft 			/*
    334  1.16   mycroft 			 * Simultaneous keypresses are resolved by registering
    335  1.16   mycroft 			 * the one with the lowest bit index first.
    336  1.16   mycroft 			 */
    337   1.2  takemura 			if (modified & mask) {
    338  1.25  takemura 				int key = i * 16 + j;
    339  1.25  takemura 				DPRINTF(("vrkiu_scan: %s(%d,%d)\n",
    340  1.25  takemura 					 (scandata[i] & mask) ? "down" : "up",
    341  1.25  takemura 					 i, j));
    342  1.25  takemura 				hpckbd_input(chip->kc_hpckbd,
    343  1.25  takemura 					     (scandata[i] & mask), key);
    344   1.1  takemura 			}
    345   1.1  takemura 		}
    346   1.1  takemura 	}
    347   1.1  takemura }
    348   1.1  takemura 
    349  1.23  takemura /* called from bicons.c */
    350   1.1  takemura int
    351   1.1  takemura vrkiu_getc()
    352   1.1  takemura {
    353  1.23  takemura 	static int flag = 1;
    354  1.23  takemura 
    355  1.12  takemura 	/*
    356  1.12  takemura 	 * XXX, currently
    357  1.12  takemura 	 */
    358  1.23  takemura 	if (flag) {
    359  1.23  takemura 		flag = 0;
    360  1.23  takemura 		printf("%s(%d): vrkiu_getc() is not implemented\n",
    361  1.23  takemura 		       __FILE__, __LINE__);
    362  1.23  takemura 	}
    363  1.12  takemura 	return 0;
    364   1.1  takemura }
    365   1.1  takemura 
    366  1.25  takemura /*
    367  1.25  takemura  * hpckbd interface routines
    368  1.25  takemura  */
    369   1.2  takemura int
    370  1.25  takemura vrkiu_input_establish(ic, kbdif)
    371  1.25  takemura 	void *ic;
    372  1.25  takemura 	struct hpckbd_if *kbdif;
    373  1.25  takemura {
    374  1.25  takemura 	struct vrkiu_chip *kc = ic;
    375  1.25  takemura 
    376  1.25  takemura 	/* save hpckbd interface */
    377  1.25  takemura 	kc->kc_hpckbd = kbdif;
    378  1.25  takemura 
    379  1.25  takemura 	kc->kc_enabled = 1;
    380   1.2  takemura 
    381  1.25  takemura 	return 0;
    382   1.2  takemura }
    383   1.2  takemura 
    384  1.25  takemura int
    385  1.25  takemura vrkiu_poll(ic)
    386  1.25  takemura 	void *ic;
    387   1.2  takemura {
    388  1.25  takemura 	struct vrkiu_chip *kc = ic;
    389   1.2  takemura 
    390  1.25  takemura #if 1
    391  1.25  takemura 	/* wait until kiu completes keyboard scan. */
    392  1.25  takemura 	while ((vrkiu_read(kc, KIUSCANS) & KIUSCANS_SSTAT_MASK) ==
    393  1.25  takemura 	       KIUSCANS_SSTAT_SCANNING)
    394  1.25  takemura 		/* wait until kiu completes keyboard scan */;
    395  1.25  takemura #endif
    396   1.2  takemura 
    397  1.25  takemura 	vrkiu_scan(kc);
    398   1.2  takemura 
    399  1.25  takemura 	return 0;
    400   1.2  takemura }
    401   1.2  takemura 
    402   1.2  takemura /*
    403  1.25  takemura  * console support routine
    404   1.2  takemura  */
    405   1.2  takemura int
    406   1.2  takemura vrkiu_cnattach(iot, iobase)
    407   1.2  takemura 	bus_space_tag_t iot;
    408   1.2  takemura 	int iobase;
    409   1.2  takemura {
    410   1.2  takemura 	static struct vrkiu_chip vrkiu_consdata_body;
    411   1.2  takemura 	bus_space_handle_t ioh;
    412   1.2  takemura 
    413   1.2  takemura 	if (vrkiu_consdata) {
    414   1.2  takemura 		panic("vrkiu is already attached as the console");
    415   1.2  takemura 	}
    416   1.2  takemura 	if (bus_space_map(iot, iobase, 1, 0, &ioh)) {
    417   1.2  takemura 		printf("%s(%d): can't map bus space\n", __FILE__, __LINE__);
    418   1.2  takemura 		return -1;
    419   1.2  takemura 	}
    420   1.2  takemura 
    421   1.2  takemura 	if (vrkiu_init(&vrkiu_consdata_body, iot, ioh) != 0) {
    422   1.2  takemura 		DPRINTF(("%s(%d): vrkiu_init() failed\n", __FILE__, __LINE__));
    423   1.2  takemura 		return -1;
    424   1.2  takemura 	}
    425   1.2  takemura 	vrkiu_consdata = &vrkiu_consdata_body;
    426   1.2  takemura 
    427  1.25  takemura 	hpckbd_cnattach(&vrkiu_consdata_body.kc_if);
    428   1.2  takemura 
    429   1.2  takemura 	return (0);
    430   1.2  takemura }
    431