Lines Matching +full:hot +full:- +full:swap
1 /*-
4 * SPDX-License-Identifier: BSD-3-Clause
6 * Copyright (c) 1994-2001 Justin T. Gibbs.
7 * Copyright (c) 2000-2001 Adaptec Inc.
21 * 3. Neither the names of the above-listed copyright holders nor the names
65 if ((ahc->features & AHC_ULTRA2) != 0)
71 * Returns non-zero status if the sequencer is stopped.
89 ahc_outb(ahc, HCNTRL, ahc->pause);
115 ahc_outb(ahc, HCNTRL, ahc->unpause);
129 if ((ahc->flags & AHC_SCB_BTT) == 0)
130 ahc->untagged_queue_lock++;
142 if ((ahc->flags & AHC_SCB_BTT) == 0) {
143 ahc->untagged_queue_lock--;
144 if (ahc->untagged_queue_lock == 0)
171 sg_index = (sg_busaddr - scb->sg_list_phys)/sizeof(struct ahc_dma_seg);
175 return (&scb->sg_list[sg_index]);
184 sg_index = sg - &scb->sg_list[1];
186 return (scb->sg_list_phys + (sg_index * sizeof(*scb->sg_list)));
192 return (ahc->scb_data->hscb_busaddr
199 aic_dmamap_sync(ahc, ahc->scb_data->hscb_dmat,
200 ahc->scb_data->hscb_dmamap,
201 /*offset*/(scb->hscb - ahc->hscbs) * sizeof(*scb->hscb),
202 /*len*/sizeof(*scb->hscb), op);
208 if (scb->sg_count == 0)
211 aic_dmamap_sync(ahc, ahc->scb_data->sg_dmat, scb->sg_map->sg_dmamap,
212 /*offset*/(scb->sg_list - scb->sg_map->sg_vaddr)
214 /*len*/sizeof(struct ahc_dma_seg) * scb->sg_count, op);
220 return (((uint8_t *)&ahc->targetcmds[index]) - (uint8_t *)ahc->targetcmds);
229 return (ahc->name);
275 sgptr = aic_le32toh(scb->hscb->sgptr);
296 *tstate = ahc->enabled_targets[our_id];
297 return (&(*tstate)->transinfo[remote_id]);
365 if ((scb = SLIST_FIRST(&ahc->scb_data->free_scbs)) == NULL) {
368 scb = SLIST_FIRST(&ahc->scb_data->free_scbs);
372 SLIST_REMOVE_HEAD(&ahc->scb_data->free_scbs, links.sle);
384 hscb = scb->hscb;
386 ahc->scb_data->scbindex[hscb->tag] = NULL;
387 scb->flags = SCB_FLAG_NONE;
388 hscb->control = 0;
390 SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs, scb, links.sle);
401 scb = ahc->scb_data->scbindex[tag];
418 * SCB to download is saved off in ahc->next_queued_scb.
421 * the sequencer knows about, swap HSCB pointers and
426 q_hscb = ahc->next_queued_scb->hscb;
427 saved_tag = q_hscb->tag;
428 memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb));
429 if ((scb->flags & SCB_CDB32_PTR) != 0) {
430 q_hscb->shared_data.cdb_ptr =
431 aic_htole32(ahc_hscb_busaddr(ahc, q_hscb->tag)
434 q_hscb->tag = saved_tag;
435 q_hscb->next = scb->hscb->tag;
437 /* Now swap HSCB pointers. */
438 ahc->next_queued_scb->hscb = scb->hscb;
439 scb->hscb = q_hscb;
442 ahc->scb_data->scbindex[scb->hscb->tag] = scb;
453 if (scb->hscb->tag == SCB_LIST_NULL
454 || scb->hscb->next == SCB_LIST_NULL)
456 scb->hscb->tag, scb->hscb->next);
461 scb->hscb->lun &= LID;
463 scb->hscb->lun |= SCB_XFERLEN_ODD;
468 ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag;
477 if ((ahc->features & AHC_QUEUE_REGS) != 0) {
478 ahc_outb(ahc, HNSCB_QOFF, ahc->qinfifonext);
480 if ((ahc->features & AHC_AUTOPAUSE) == 0)
482 ahc_outb(ahc, KERNEL_QINPOS, ahc->qinfifonext);
483 if ((ahc->features & AHC_AUTOPAUSE) == 0)
493 offset = scb - ahc->scb_data->scbarray;
494 return (&ahc->scb_data->sense[offset]);
502 offset = scb - ahc->scb_data->scbarray;
503 return (ahc->scb_data->sense_busaddr
516 aic_dmamap_sync(ahc, ahc->shared_data_dmat, ahc->shared_data_dmamap,
524 if ((ahc->flags & AHC_TARGETROLE) != 0) {
525 aic_dmamap_sync(ahc, ahc->shared_data_dmat,
526 ahc->shared_data_dmamap,
536 * into our in-core command complete fifos.
546 aic_dmamap_sync(ahc, ahc->shared_data_dmat, ahc->shared_data_dmamap,
547 /*offset*/ahc->qoutfifonext, /*len*/1,
549 if (ahc->qoutfifo[ahc->qoutfifonext] != SCB_LIST_NULL)
552 if ((ahc->flags & AHC_TARGETROLE) != 0
553 && (ahc->flags & AHC_TQINFIFO_BLOCKED) == 0) {
554 aic_dmamap_sync(ahc, ahc->shared_data_dmat,
555 ahc->shared_data_dmamap,
556 ahc_targetcmd_offset(ahc, ahc->tqinfifofnext),
559 if (ahc->targetcmds[ahc->tqinfifonext].cmd_valid != 0)
574 if ((ahc->pause & INTEN) == 0) {
577 * and may be disabled for re-entrancy reasons,
585 * infer the cause of the interrupt by checking our in-core
589 if ((ahc->flags & (AHC_ALL_INTERRUPTS|AHC_EDGE_INTERRUPT)) == 0
598 if (ahc->unsolicited_ints > 500) {
599 ahc->unsolicited_ints = 0;
600 if ((ahc->chip & AHC_PCI) != 0
602 ahc->bus_intr(ahc);
605 ahc->unsolicited_ints++;
608 ahc->unsolicited_ints = 0;
624 if ((ahc->flags & AHC_TARGETROLE) != 0)
633 if (intstat == 0xFF && (ahc->features & AHC_REMOVABLE) != 0) {
634 /* Hot eject. Do nothing */