Deleted Added
sdiff udiff text old ( 40749 ) new ( 41048 )
full compact
1/*
2 * Generic driver for the BusLogic MultiMaster SCSI host adapters
3 * Product specific probe and attach routines can be found in:
4 * i386/isa/bt_isa.c BT-54X, BT-445 cards
5 * i386/eisa/bt_eisa.c BT-74x, BT-75x cards
6 * pci/bt_pci.c BT-946, BT-948, BT-956, BT-958 cards
7 *
8 * Copyright (c) 1998 Justin T. Gibbs.

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

24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $Id: bt.c,v 1.7 1998/10/15 23:46:28 gibbs Exp $
33 */
34
35 /*
36 * Special thanks to Leonard N. Zubkoff for writing such a complete and
37 * well documented Mylex/BusLogic MultiMaster driver for Linux. Support
38 * in this driver for the wide range of MultiMaster controllers and
39 * firmware revisions, with their otherwise undocumented quirks, would not
40 * have been possible without his efforts.

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

176/*
177 * XXX
178 * Do our own re-probe protection until a configuration
179 * manager can do it for us. This ensures that we don't
180 * reprobe a card already found by the EISA or PCI probes.
181 */
182struct bt_isa_port bt_isa_ports[] =
183{
184 { 0x330, 0 },
185 { 0x334, 0 },
186 { 0x230, 0 },
187 { 0x234, 0 },
188 { 0x130, 0 },
189 { 0x134, 0 }
190};
191
192/* Exported functions */
193struct bt_softc *
194bt_alloc(int unit, bus_space_tag_t tag, bus_space_handle_t bsh)
195{
196 struct bt_softc *bt;
197
198 if (unit != BT_TEMP_UNIT) {
199 if (unit >= NBT) {

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

809 return (name);
810}
811
812int
813bt_check_probed_iop(u_int ioport)
814{
815 u_int i;
816
817 for (i=0; i < BT_NUM_ISAPORTS; i++) {
818 if (bt_isa_ports[i].addr == ioport) {
819 if (bt_isa_ports[i].probed != 0)
820 return (1);
821 else {
822 return (0);
823 }
824 }
825 }
826 return (1);
827}
828
829u_int
830bt_fetch_isa_iop(isa_compat_io_t port)
831{
832 return (bt_isa_ports[port].addr);
833}
834
835void
836bt_mark_probed_bio(isa_compat_io_t port)
837{
838 if (port < BIO_DISABLED)
839 bt_isa_ports[port].probed = 1;
840}
841
842void
843bt_mark_probed_iop(u_int ioport)
844{
845 u_int i;
846
847 for (i = 0; i < BT_NUM_ISAPORTS; i++) {
848 if (ioport == bt_isa_ports[i].addr) {
849 bt_isa_ports[i].probed = 1;
850 break;
851 }
852 }
853}
854
855static void
856btallocccbs(struct bt_softc *bt)
857{
858 struct bt_ccb *next_ccb;
859 struct sg_map_node *sg_map;
860 bus_addr_t physaddr;
861 bt_sg_t *segs;
862 int newcount;

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

919 LIST_REMOVE(&bccb->ccb->ccb_h, sim_links.le);
920 if (bt->resource_shortage != 0
921 && (bccb->ccb->ccb_h.status & CAM_RELEASE_SIMQ) == 0) {
922 bccb->ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
923 bt->resource_shortage = FALSE;
924 }
925 bccb->flags = BCCB_FREE;
926 SLIST_INSERT_HEAD(&bt->free_bt_ccbs, bccb, links);
927 splx(s);
928}
929
930static __inline struct bt_ccb*
931btgetccb(struct bt_softc *bt)
932{
933 struct bt_ccb* bccb;
934 int s;
935
936 s = splcam();
937 if ((bccb = SLIST_FIRST(&bt->free_bt_ccbs)) != NULL) {
938 SLIST_REMOVE_HEAD(&bt->free_bt_ccbs, links);
939 } else if (bt->num_ccbs < bt->max_ccbs) {
940 btallocccbs(bt);
941 bccb = SLIST_FIRST(&bt->free_bt_ccbs);
942 if (bccb == NULL)
943 printf("%s: Can't malloc BCCB\n", bt_name(bt));
944 else
945 SLIST_REMOVE_HEAD(&bt->free_bt_ccbs, links);
946 }
947 splx(s);
948
949 return (bccb);
950}
951
952static void
953btaction(struct cam_sim *sim, union ccb *ccb)

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

1342 LIST_INSERT_HEAD(&bt->pending_ccbs, &ccb->ccb_h, sim_links.le);
1343
1344 ccb->ccb_h.timeout_ch =
1345 timeout(bttimeout, (caddr_t)bccb,
1346 (ccb->ccb_h.timeout * hz) / 1000);
1347
1348 /* Tell the adapter about this command */
1349 bt->cur_outbox->ccb_addr = btccbvtop(bt, bccb);
1350 if (bt->cur_outbox->action_code != BMBO_FREE)
1351 panic("%s: Too few mailboxes or to many ccbs???", bt_name(bt));
1352 bt->cur_outbox->action_code = BMBO_START;
1353 bt_outb(bt, COMMAND_REG, BOP_START_MBOX);
1354 btnextoutbox(bt);
1355 splx(s);
1356}
1357
1358void
1359bt_intr(void *arg)

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

1464 bt_name(bt));
1465 break;
1466 case BMBI_NOT_FOUND:
1467 printf("%s: btdone - CCB Abort failed to find CCB\n",
1468 bt_name(bt));
1469 break;
1470 case BMBI_ABORT:
1471 case BMBI_ERROR:
1472#if 0
1473 printf("bt: ccb %x - error %x occured. btstat = %x, sdstat = %x\n",
1474 bccb, comp_code, bccb->hccb.btstat, bccb->hccb.sdstat);
1475#endif
1476 /* An error occured */
1477 switch(bccb->hccb.btstat) {
1478 case BTSTAT_DATARUN_ERROR:
1479 if (bccb->hccb.data_len <= 0) {
1480 csio->ccb_h.status = CAM_DATA_RUN_ERR;
1481 break;
1482 }
1483 /* FALLTHROUGH */
1484 case BTSTAT_NOERROR:
1485 case BTSTAT_LINKED_CMD_COMPLETE:
1486 case BTSTAT_LINKED_CMD_FLAG_COMPLETE:
1487 case BTSTAT_DATAUNDERUN_ERROR:

--- 691 unchanged lines hidden ---