Deleted Added
full compact
dpt_scsi.c (163896) dpt_scsi.c (166091)
1/*-
2 * Copyright (c) 1997 by Simon Shapiro
3 * All Rights Reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
1/*-
2 * Copyright (c) 1997 by Simon Shapiro
3 * All Rights Reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ident "$FreeBSD: head/sys/dev/dpt/dpt_scsi.c 163896 2006-11-02 00:54:38Z mjacob $"
30#ident "$FreeBSD: head/sys/dev/dpt/dpt_scsi.c 166091 2007-01-18 13:33:36Z marius $"
31#include <sys/cdefs.h>
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/dpt/dpt_scsi.c 163896 2006-11-02 00:54:38Z mjacob $");
32__FBSDID("$FreeBSD: head/sys/dev/dpt/dpt_scsi.c 166091 2007-01-18 13:33:36Z marius $");
33
34/*
35 * dpt_scsi.c: SCSI dependant code for the DPT driver
36 *
37 * credits: Assisted by Mike Neuffer in the early low level DPT code
38 * Thanx to Mark Salyzyn of DPT for his assistance.
39 * Special thanx to Justin Gibbs for invaluable help in
40 * making this driver look and work like a FreeBSD component.

--- 4 unchanged lines hidden (view full) ---

45 * * Add driver-level RAID-0. This will allow interoperability with
46 * NiceTry, M$-Doze, Win-Dog, Slowlaris, etc., in recognizing RAID
47 * arrays that span controllers (Wow!).
48 */
49
50#define _DPT_C_
51
52#include "opt_dpt.h"
33
34/*
35 * dpt_scsi.c: SCSI dependant code for the DPT driver
36 *
37 * credits: Assisted by Mike Neuffer in the early low level DPT code
38 * Thanx to Mark Salyzyn of DPT for his assistance.
39 * Special thanx to Justin Gibbs for invaluable help in
40 * making this driver look and work like a FreeBSD component.

--- 4 unchanged lines hidden (view full) ---

45 * * Add driver-level RAID-0. This will allow interoperability with
46 * NiceTry, M$-Doze, Win-Dog, Slowlaris, etc., in recognizing RAID
47 * arrays that span controllers (Wow!).
48 */
49
50#define _DPT_C_
51
52#include "opt_dpt.h"
53#include "opt_eisa.h"
54
53#include <sys/param.h>
54#include <sys/systm.h>
55#include <sys/eventhandler.h>
56#include <sys/malloc.h>
57#include <sys/kernel.h>
58
59#include <sys/bus.h>
60

--- 40 unchanged lines hidden (view full) ---

101
102/* Definitions for our use of the SIM private CCB area */
103#define ccb_dccb_ptr spriv_ptr0
104#define ccb_dpt_ptr spriv_ptr1
105
106/* ================= Private Inline Function declarations ===================*/
107static __inline int dpt_just_reset(dpt_softc_t * dpt);
108static __inline int dpt_raid_busy(dpt_softc_t * dpt);
55#include <sys/param.h>
56#include <sys/systm.h>
57#include <sys/eventhandler.h>
58#include <sys/malloc.h>
59#include <sys/kernel.h>
60
61#include <sys/bus.h>
62

--- 40 unchanged lines hidden (view full) ---

103
104/* Definitions for our use of the SIM private CCB area */
105#define ccb_dccb_ptr spriv_ptr0
106#define ccb_dpt_ptr spriv_ptr1
107
108/* ================= Private Inline Function declarations ===================*/
109static __inline int dpt_just_reset(dpt_softc_t * dpt);
110static __inline int dpt_raid_busy(dpt_softc_t * dpt);
111#ifdef DEV_EISA
109static __inline int dpt_pio_wait (u_int32_t, u_int, u_int, u_int);
112static __inline int dpt_pio_wait (u_int32_t, u_int, u_int, u_int);
113#endif
110static __inline int dpt_wait(dpt_softc_t *dpt, u_int bits,
111 u_int state);
112static __inline struct dpt_ccb* dptgetccb(struct dpt_softc *dpt);
113static __inline void dptfreeccb(struct dpt_softc *dpt,
114 struct dpt_ccb *dccb);
115static __inline bus_addr_t dptccbvtop(struct dpt_softc *dpt,
116 struct dpt_ccb *dccb);
117

--- 58 unchanged lines hidden (view full) ---

176 if ((dpt_inb(dpt, 0) == 'D')
177 && (dpt_inb(dpt, 1) == 'P')
178 && (dpt_inb(dpt, 2) == 'T'))
179 return (1);
180 else
181 return (0);
182}
183
114static __inline int dpt_wait(dpt_softc_t *dpt, u_int bits,
115 u_int state);
116static __inline struct dpt_ccb* dptgetccb(struct dpt_softc *dpt);
117static __inline void dptfreeccb(struct dpt_softc *dpt,
118 struct dpt_ccb *dccb);
119static __inline bus_addr_t dptccbvtop(struct dpt_softc *dpt,
120 struct dpt_ccb *dccb);
121

--- 58 unchanged lines hidden (view full) ---

180 if ((dpt_inb(dpt, 0) == 'D')
181 && (dpt_inb(dpt, 1) == 'P')
182 && (dpt_inb(dpt, 2) == 'T'))
183 return (1);
184 else
185 return (0);
186}
187
188#ifdef DEV_EISA
184static __inline int
185dpt_pio_wait (u_int32_t base, u_int reg, u_int bits, u_int state)
186{
187 int i;
188 u_int c;
189
190 for (i = 0; i < 20000; i++) { /* wait 20ms for not busy */
191 c = inb(base + reg) & bits;
192 if (!(c == state))
193 return (0);
194 else
195 DELAY(50);
196 }
197 return (-1);
198}
189static __inline int
190dpt_pio_wait (u_int32_t base, u_int reg, u_int bits, u_int state)
191{
192 int i;
193 u_int c;
194
195 for (i = 0; i < 20000; i++) { /* wait 20ms for not busy */
196 c = inb(base + reg) & bits;
197 if (!(c == state))
198 return (0);
199 else
200 DELAY(50);
201 }
202 return (-1);
203}
204#endif
199
200static __inline int
201dpt_wait(dpt_softc_t *dpt, u_int bits, u_int state)
202{
203 int i;
204 u_int c;
205
206 for (i = 0; i < 20000; i++) { /* wait 20ms for not busy */

--- 174 unchanged lines hidden (view full) ---

381 physaddr += (dpt->sgsize * sizeof(dpt_sg_t));
382 dpt->dpt_ccb_busend += sizeof(*next_ccb);
383 next_ccb++;
384 dpt->total_dccbs++;
385 }
386 return (i);
387}
388
205
206static __inline int
207dpt_wait(dpt_softc_t *dpt, u_int bits, u_int state)
208{
209 int i;
210 u_int c;
211
212 for (i = 0; i < 20000; i++) { /* wait 20ms for not busy */

--- 174 unchanged lines hidden (view full) ---

387 physaddr += (dpt->sgsize * sizeof(dpt_sg_t));
388 dpt->dpt_ccb_busend += sizeof(*next_ccb);
389 next_ccb++;
390 dpt->total_dccbs++;
391 }
392 return (i);
393}
394
395#ifdef DEV_EISA
389dpt_conf_t *
390dpt_pio_get_conf (u_int32_t base)
391{
392 static dpt_conf_t * conf;
393 u_int16_t * p;
394 int i;
395
396 /*

--- 76 unchanged lines hidden (view full) ---

473 while (inb(base + HA_RSTATUS) & HA_SDRQ) {
474 inw(base + HA_RDATA);
475 }
476
477 return (conf);
478 }
479 return (NULL);
480}
396dpt_conf_t *
397dpt_pio_get_conf (u_int32_t base)
398{
399 static dpt_conf_t * conf;
400 u_int16_t * p;
401 int i;
402
403 /*

--- 76 unchanged lines hidden (view full) ---

480 while (inb(base + HA_RSTATUS) & HA_SDRQ) {
481 inw(base + HA_RDATA);
482 }
483
484 return (conf);
485 }
486 return (NULL);
487}
488#endif
481
482/*
483 * Read a configuration page into the supplied dpt_cont_t buffer.
484 */
485static int
486dpt_get_conf(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr,
487 u_int size, u_int page, u_int target, int extent)
488{

--- 2245 unchanged lines hidden ---
489
490/*
491 * Read a configuration page into the supplied dpt_cont_t buffer.
492 */
493static int
494dpt_get_conf(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr,
495 u_int size, u_int page, u_int target, int extent)
496{

--- 2245 unchanged lines hidden ---