1 /* $OpenBSD: hilvar.h,v 1.10 2006/11/05 14:39:32 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 /*
30 * Copyright (c) 1988 University of Utah.
31 * Copyright (c) 1990, 1993
32 * The Regents of the University of California. All rights reserved.
33 *
34 * This code is derived from software contributed to Berkeley by
35 * the Systems Programming Group of the University of Utah Computer
36 * Science Department.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 *
62 * from: Utah $Hdr: hilvar.h 1.3 92/01/21$
63 *
64 * @(#)hilvar.h 8.1 (Berkeley) 6/10/93
65 */
66
67 #define NHILD 8 /* 7 actual + loop pseudo (dev 0) */
68
69 struct hildev_softc;
70
71 struct hil_softc {
72 struct device sc_dev;
73 bus_space_handle_t sc_bsh;
74 bus_space_tag_t sc_bst;
75 int *sc_console; /* console path set to hil */
76
77 struct proc *sc_thread; /* event handling thread */
78
79 int sc_cmddone;
80 int sc_cmdending;
81 u_int sc_actdev; /* current input device */
82 u_int sc_cmddev; /* device to perform command on */
83 u_int8_t sc_pollbuf[HILBUFSIZE]; /* interrupt time input buf */
84 u_int8_t sc_cmdbuf[HILBUFSIZE];
85 u_int8_t *sc_pollbp; /* pointer into sc_pollbuf */
86 u_int8_t *sc_cmdbp; /* pointer into sc_cmdbuf */
87
88 int sc_status; /* initialization status */
89 #define HIL_STATUS_BUSY 0x00
90 #define HIL_STATUS_READY 0x01
91 int sc_pending; /* reconfiguration events in progress */
92 #define HIL_PENDING_RECONFIG 0x01
93 #define HIL_PENDING_UNPLUGGED 0x02
94 u_int sc_maxdev; /* number of devices on loop */
95 struct hildev_softc *sc_devices[NHILD]; /* interrupt dispatcher */
96 };
97
98 #ifdef _KERNEL
99
100 int send_hil_cmd(struct hil_softc *, u_int, u_int8_t *, u_int, u_int8_t *);
101 int send_hildev_cmd(struct hildev_softc *, u_int, u_int8_t *, u_int *);
102 void hil_set_poll(struct hil_softc *, int);
103 int hil_poll_data(struct hildev_softc *, u_int8_t *, u_int8_t *);
104
105 void hil_attach(struct hil_softc *, int *);
106 void hil_attach_deferred(void *);
107 int hil_intr(void *);
108 int hildevprint(void *, const char *);
109
110 #endif /* _KERNEL */