[BACK]Return to hilid.c CVS log [TXT][DIR] Up to [local] / sys / dev / hil

Annotation of sys/dev/hil/hilid.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: hilid.c,v 1.4 2005/01/09 23:49:36 miod Exp $  */
                      2: /*
                      3:  * Copyright (c) 2003, Miodrag Vallat.
                      4:  * All rights reserved.
                      5:  *
                      6:  * Redistribution and use in source and binary forms, with or without
                      7:  * modification, are permitted provided that the following conditions
                      8:  * are met:
                      9:  * 1. Redistributions of source code must retain the above copyright
                     10:  *    notice, this list of conditions and the following disclaimer.
                     11:  * 2. Redistributions in binary form must reproduce the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer in the
                     13:  *    documentation and/or other materials provided with the distribution.
                     14:  *
                     15:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     16:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
                     17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
                     18:  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
                     19:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
                     20:  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
                     21:  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     22:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
                     23:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
                     24:  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     25:  * POSSIBILITY OF SUCH DAMAGE.
                     26:  *
                     27:  */
                     28:
                     29: #include <sys/param.h>
                     30: #include <sys/systm.h>
                     31: #include <sys/device.h>
                     32: #include <sys/ioctl.h>
                     33:
                     34: #include <machine/autoconf.h>
                     35: #include <machine/bus.h>
                     36: #include <machine/cpu.h>
                     37:
                     38: #include <dev/hil/hilreg.h>
                     39: #include <dev/hil/hilvar.h>
                     40: #include <dev/hil/hildevs.h>
                     41:
                     42: struct hilid_softc {
                     43:        struct hildev_softc sc_hildev;
                     44:
                     45:        u_int8_t        sc_id[16];
                     46: };
                     47:
                     48: int    hilidprobe(struct device *, void *, void *);
                     49: void   hilidattach(struct device *, struct device *, void *);
                     50: int    hiliddetach(struct device *, int);
                     51:
                     52: struct cfdriver hilid_cd = {
                     53:        NULL, "hilid", DV_DULL
                     54: };
                     55:
                     56: struct cfattach hilid_ca = {
                     57:        sizeof(struct hilid_softc), hilidprobe, hilidattach, hiliddetach,
                     58: };
                     59:
                     60: int
                     61: hilidprobe(struct device *parent, void *match, void *aux)
                     62: {
                     63:        struct hil_attach_args *ha = aux;
                     64:
                     65:        if (ha->ha_type != HIL_DEVICE_IDMODULE)
                     66:                return (0);
                     67:
                     68:        return (1);
                     69: }
                     70:
                     71: void
                     72: hilidattach(struct device *parent, struct device *self, void *aux)
                     73: {
                     74:        struct hilid_softc *sc = (void *)self;
                     75:        struct hil_attach_args *ha = aux;
                     76:        u_int i, len;
                     77:
                     78:        sc->hd_code = ha->ha_code;
                     79:        sc->hd_type = ha->ha_type;
                     80:        sc->hd_infolen = ha->ha_infolen;
                     81:        bcopy(ha->ha_info, sc->hd_info, ha->ha_infolen);
                     82:        sc->hd_fn = NULL;
                     83:
                     84:        printf("\n");
                     85:
                     86:        bzero(sc->sc_id, sizeof(sc->sc_id));
                     87:        len = sizeof(sc->sc_id);
                     88:        printf("%s: security code", self->dv_xname);
                     89:
                     90:        if (send_hildev_cmd((struct hildev_softc *)sc,
                     91:            HIL_SECURITY, sc->sc_id, &len) == 0) {
                     92:                for (i = 0; i < sizeof(sc->sc_id); i++)
                     93:                        printf(" %02x", sc->sc_id[i]);
                     94:                printf("\n");
                     95:        } else
                     96:                printf(" unavailable\n");
                     97: }
                     98:
                     99: int
                    100: hiliddetach(struct device *self, int flags)
                    101: {
                    102:        return (0);
                    103: }

CVSweb