hd64570var.h revision 1.1 1 1.1 explorer /* $Id: hd64570var.h,v 1.1 1998/07/26 03:26:57 explorer Exp $ */
2 1.1 explorer
3 1.1 explorer /*
4 1.1 explorer * Copyright (c) 1998 Vixie Enterprises
5 1.1 explorer * All rights reserved.
6 1.1 explorer *
7 1.1 explorer * Redistribution and use in source and binary forms, with or without
8 1.1 explorer * modification, are permitted provided that the following conditions
9 1.1 explorer * are met:
10 1.1 explorer *
11 1.1 explorer * 1. Redistributions of source code must retain the above copyright
12 1.1 explorer * notice, this list of conditions and the following disclaimer.
13 1.1 explorer * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 explorer * notice, this list of conditions and the following disclaimer in the
15 1.1 explorer * documentation and/or other materials provided with the distribution.
16 1.1 explorer * 3. Neither the name of Vixie Enterprises nor the names
17 1.1 explorer * of its contributors may be used to endorse or promote products derived
18 1.1 explorer * from this software without specific prior written permission.
19 1.1 explorer *
20 1.1 explorer * THIS SOFTWARE IS PROVIDED BY VIXIE ENTERPRISES AND
21 1.1 explorer * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22 1.1 explorer * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 1.1 explorer * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 1.1 explorer * DISCLAIMED. IN NO EVENT SHALL VIXIE ENTERPRISES OR
25 1.1 explorer * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 1.1 explorer * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 1.1 explorer * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 1.1 explorer * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 1.1 explorer * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 1.1 explorer * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 1.1 explorer * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.1 explorer * SUCH DAMAGE.
33 1.1 explorer *
34 1.1 explorer * This software has been written for Vixie Enterprises by Michael Graff
35 1.1 explorer * <explorer (at) flame.org>. To learn more about Vixie Enterprises, see
36 1.1 explorer * ``http://www.vix.com''.
37 1.1 explorer */
38 1.1 explorer
39 1.1 explorer #ifndef _HD64570VAR_H_
40 1.1 explorer #define _HD64570VAR_H_
41 1.1 explorer
42 1.1 explorer #include "bpfilter.h"
43 1.1 explorer
44 1.1 explorer #define SCA_USE_FASTQ /* use a split queue, one for fast traffic */
45 1.1 explorer
46 1.1 explorer struct sca_softc;
47 1.1 explorer typedef struct sca_port sca_port_t;
48 1.1 explorer typedef struct sca_desc sca_desc_t;
49 1.1 explorer
50 1.1 explorer /*
51 1.1 explorer * device DMA descriptor
52 1.1 explorer */
53 1.1 explorer struct sca_desc {
54 1.1 explorer u_int16_t cp; /* chain pointer */
55 1.1 explorer u_int16_t bp; /* buffer pointer (low bits) */
56 1.1 explorer u_int8_t bpb; /* buffer pointer (high bits) */
57 1.1 explorer u_int8_t unused0;
58 1.1 explorer u_int16_t len; /* total length */
59 1.1 explorer u_int8_t stat; /* status */
60 1.1 explorer u_int8_t unused1;
61 1.1 explorer };
62 1.1 explorer #define SCA_DESC_EOT 0x01
63 1.1 explorer #define SCA_DESC_CRC 0x04
64 1.1 explorer #define SCA_DESC_OVRN 0x08
65 1.1 explorer #define SCA_DESC_RESD 0x10
66 1.1 explorer #define SCA_DESC_ABORT 0x20
67 1.1 explorer #define SCA_DESC_SHRTFRM 0x40
68 1.1 explorer #define SCA_DESC_EOM 0x80
69 1.1 explorer #define SCA_DESC_ERRORS 0x7C
70 1.1 explorer
71 1.1 explorer /*
72 1.1 explorer * softc structure for each port
73 1.1 explorer */
74 1.1 explorer struct sca_port {
75 1.1 explorer u_int msci_off; /* offset for msci address for this port */
76 1.1 explorer u_int dmac_off; /* offset of dmac address for this port */
77 1.1 explorer
78 1.1 explorer u_int sp_port;
79 1.1 explorer
80 1.1 explorer /*
81 1.1 explorer * CISCO keepalive stuff
82 1.1 explorer */
83 1.1 explorer u_int32_t cka_lasttx;
84 1.1 explorer u_int32_t cka_lastrx;
85 1.1 explorer
86 1.1 explorer /*
87 1.1 explorer * start of each important bit of information for transmit and
88 1.1 explorer * receive buffers.
89 1.1 explorer */
90 1.1 explorer u_int32_t txdesc_p;
91 1.1 explorer sca_desc_t *txdesc;
92 1.1 explorer u_int32_t txbuf_p;
93 1.1 explorer u_int8_t *txbuf;
94 1.1 explorer volatile u_int txcur; /* last descriptor in chain */
95 1.1 explorer volatile u_int txinuse; /* descriptors in use */
96 1.1 explorer volatile u_int txstart; /* start descriptor */
97 1.1 explorer
98 1.1 explorer u_int32_t rxdesc_p;
99 1.1 explorer sca_desc_t *rxdesc;
100 1.1 explorer u_int32_t rxbuf_p;
101 1.1 explorer u_int8_t *rxbuf;
102 1.1 explorer u_int rxstart; /* index of first descriptor */
103 1.1 explorer u_int rxend; /* index of last descriptor */
104 1.1 explorer
105 1.1 explorer struct ifnet sp_if; /* the network information */
106 1.1 explorer struct ifqueue linkq; /* link-level packets are high prio */
107 1.1 explorer #ifdef SCA_USE_FASTQ
108 1.1 explorer struct ifqueue fastq; /* interactive packets */
109 1.1 explorer #endif
110 1.1 explorer
111 1.1 explorer #if NBPFILTER > 0
112 1.1 explorer caddr_t sp_bpf; /* hook for BPF */
113 1.1 explorer #endif
114 1.1 explorer
115 1.1 explorer struct sca_softc *sca; /* pointer to parent */
116 1.1 explorer };
117 1.1 explorer
118 1.1 explorer /*
119 1.1 explorer * softc structure for the chip itself
120 1.1 explorer */
121 1.1 explorer struct sca_softc {
122 1.1 explorer struct device *parent; /* our parent device, or NULL */
123 1.1 explorer int sc_numports; /* number of ports present */
124 1.1 explorer
125 1.1 explorer /*
126 1.1 explorer * a callback into the parent, since the SCA chip has no control
127 1.1 explorer * over DTR, we have to make a callback into the parent, which
128 1.1 explorer * might know about DTR.
129 1.1 explorer *
130 1.1 explorer * If the function pointer is NULL, no callback is specified.
131 1.1 explorer */
132 1.1 explorer void (*dtr_callback) __P((void *aux, int port, int state));
133 1.1 explorer void *dtr_aux;
134 1.1 explorer
135 1.1 explorer sca_port_t sc_ports[2];
136 1.1 explorer bus_space_handle_t sc_ioh;
137 1.1 explorer bus_space_tag_t sc_iot;
138 1.1 explorer
139 1.1 explorer bus_dma_tag_t sc_dmat; /* bus dma tag */
140 1.1 explorer bus_dmamap_t sc_dmam; /* bus dma map */
141 1.1 explorer bus_dma_segment_t sc_seg; /* bus dma segment allocated */
142 1.1 explorer caddr_t sc_dma_addr; /* kva address of segment */
143 1.1 explorer u_long sc_allocsize; /* size of region */
144 1.1 explorer };
145 1.1 explorer
146 1.1 explorer
147 1.1 explorer int sca_init(struct sca_softc *, u_int);
148 1.1 explorer void sca_port_attach(struct sca_softc *, u_int);
149 1.1 explorer int sca_hardintr(struct sca_softc *);
150 1.1 explorer void sca_shutdown(struct sca_softc *);
151 1.1 explorer
152 1.1 explorer #endif /* _HD64570VAR_H_ */
153