2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 1999 Luoqi Chen.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 struct aic_transinfo {
40 struct aic_transinfo current;
41 struct aic_transinfo goal;
42 struct aic_transinfo user;
45 #define TINFO_DISC_ENB 0x01
46 #define TINFO_TAG_ENB 0x02
47 #define TINFO_SDTR_NEGO 0x04
48 #define TINFO_SDTR_SENT 0x08
52 SLIST_ENTRY(aic_scb) link;
65 #define ccb_scb_ptr spriv_ptr0
66 #define ccb_aic_ptr spriv_ptr1
68 #define SCB_ACTIVE 0x01
69 #define SCB_DISCONNECTED 0x02
70 #define SCB_DEVICE_RESET 0x04
71 #define SCB_SENSE 0x08
73 enum { AIC6260, AIC6360, AIC6370, GM82C700 };
82 struct cam_path *path;
83 TAILQ_HEAD(,ccb_hdr) pending_ccbs, nexus_ccbs;
84 SLIST_HEAD(,aic_scb) free_scbs;
85 struct aic_scb *nexus;
99 struct aic_tinfo tinfo[8];
100 struct aic_scb scbs[256];
107 #define AIC_DISC_ENABLE 0x01
108 #define AIC_DMA_ENABLE 0x02
109 #define AIC_PARITY_ENABLE 0x04
110 #define AIC_DWIO_ENABLE 0x08
111 #define AIC_RESOURCE_SHORTAGE 0x10
112 #define AIC_DROP_MSGIN 0x20
113 #define AIC_BUSFREE_OK 0x40
114 #define AIC_FAST_ENABLE 0x80
116 #define AIC_IDLE 0x00
117 #define AIC_SELECTING 0x01
118 #define AIC_RESELECTED 0x02
119 #define AIC_RECONNECTING 0x03
120 #define AIC_HASNEXUS 0x04
122 #define AIC_MSG_IDENTIFY 0x01
123 #define AIC_MSG_TAG_Q 0x02
124 #define AIC_MSG_SDTR 0x04
125 #define AIC_MSG_WDTR 0x08
126 #define AIC_MSG_MSGBUF 0x80
128 #define AIC_SYNC_PERIOD (200 / 4)
129 #define AIC_FAST_SYNC_PERIOD (100 / 4)
130 #define AIC_MIN_SYNC_PERIOD 112
131 #define AIC_SYNC_OFFSET 8
133 #define aic_inb(aic, port) \
134 bus_read_1((aic)->res, (port))
136 #define aic_outb(aic, port, value) \
137 bus_write_1((aic)->res, (port), (value))
139 #define aic_insb(aic, port, addr, count) \
140 bus_read_multi_1((aic)->res, (port), (addr), (count))
142 #define aic_outsb(aic, port, addr, count) \
143 bus_write_multi_1((aic)->res, (port), (addr), (count))
145 #define aic_insw(aic, port, addr, count) \
146 bus_read_multi_2((aic)->res, (port), (u_int16_t *)(addr), (count))
148 #define aic_outsw(aic, port, addr, count) \
149 bus_write_multi_2((aic)->res, (port), (u_int16_t *)(addr), (count))
151 #define aic_insl(aic, port, addr, count) \
152 bus_read_multi_4((aic)->res, (port), (u_int32_t *)(addr), (count))
154 #define aic_outsl(aic, port, addr, count) \
155 bus_write_multi_4((aic)->res, (port), (u_int32_t *)(addr), (count))
157 extern int aic_probe(struct aic_softc *);
158 extern int aic_attach(struct aic_softc *);
159 extern int aic_detach(struct aic_softc *);
160 extern void aic_intr(void *);