Lines Matching refs:ecb

82 					      struct ecb *ecb, union ccb *ccb);
94 static __inline struct ecb* ahbecbget(struct ahb_softc *ahb);
96 struct ecb* ecb);
98 struct ecb *ecb);
99 static __inline struct ecb* ahbecbptov(struct ahb_softc *ahb,
108 static __inline struct ecb*
111 struct ecb* ecb;
115 if ((ecb = SLIST_FIRST(&ahb->free_ecbs)) != NULL)
118 return (ecb);
122 ahbecbfree(struct ahb_softc* ahb, struct ecb* ecb)
127 ecb->state = ECB_FREE;
128 SLIST_INSERT_HEAD(&ahb->free_ecbs, ecb, links);
132 ahbecbvtop(struct ahb_softc *ahb, struct ecb *ecb)
135 + (u_int32_t)((caddr_t)ecb - (caddr_t)ahb->ecb_array));
138 static __inline struct ecb*
142 + ((struct ecb*)(uintptr_t)ecb_addr
143 - (struct ecb*)(uintptr_t)ahb->ecb_physbase));
149 return (ecb_paddr + offsetof(struct ecb, status));
155 return (ecb_paddr + offsetof(struct ecb, sense));
161 return (ecb_paddr + offsetof(struct ecb, sg_list));
262 struct ecb* next_ecb;
321 sizeof(struct ecb))
344 ahb->ecb_array, AHB_NSEG * sizeof(struct ecb),
350 bzero(ahb->ecb_array, (AHB_NECB * sizeof(struct ecb))
481 * tail of the ecb array.
490 struct ecb *ecb;
502 ecb = ahbecbget(ahb); /* Always succeeds - no outstanding commands */
503 ecb->hecb.opcode = ECBOP_READ_HA_INQDATA;
504 ecb->hecb.flag_word1 = FW1_SUPPRESS_URUN_ERR|FW1_ERR_STATUS_BLK_ONLY;
505 ecb->hecb.data_ptr = ahb->ha_inq_physbase;
506 ecb->hecb.data_len = sizeof(struct ha_inquiry_data);
507 ecb->hecb.sense_ptr = 0;
508 ecb->state = ECB_ACTIVE;
511 ahbqueuembox(ahb, ahbecbvtop(ahb, ecb),
515 for (i = 1000; ecb->state != ECB_FREE && i != 0; i--) {
531 ecb->hecb.sense_ptr = ahbsensepaddr(ahbecbvtop(ahb, ecb));
533 ahbecbfree(ahb, ecb);
595 struct ecb *pending_ecb;
598 pending_ecb = (struct ecb *)ccb_h->ccb_ecb_ptr;
638 ahbcalcresid(struct ahb_softc *ahb, struct ecb *ecb, union ccb *ccb)
640 if (ecb->status.data_overrun != 0) {
649 ccb->csio.resid = ecb->status.resid_count;
651 if ((ecb->hecb.flag_word1 & FW1_SG_ECB) != 0) {
665 num_sg = ecb->hecb.data_len / sizeof(ahb_sg_t);
668 for (sg = ecb->sg_list;
669 num_sg != 0 && sg->addr != ecb->status.resid_addr;
687 ahbprocesserror(struct ahb_softc *ahb, struct ecb *ecb, union ccb *ccb)
692 hecb = &ecb->hecb;
693 status = &ecb->status;
703 bcopy(&ecb->sense, &ccb->csio.sense_data,
715 ahbcalcresid(ahb, ecb, ccb);
784 struct ecb *ecb;
787 ecb = ahbecbptov(ahb, mbox);
789 if ((ecb->state & ECB_ACTIVE) == 0)
790 panic("ecb not active");
792 ccb = ecb->ccb;
795 callout_stop(&ecb->timer);
805 bus_dmamap_sync(ahb->buffer_dmat, ecb->dmamap, op);
806 bus_dmamap_unload(ahb->buffer_dmat, ecb->dmamap);
813 ahbprocesserror(ahb, ecb, ccb);
815 ahbecbfree(ahb, ecb);
821 ecb->hecb.opcode,
822 *((u_int16_t*)&ecb->status),
823 ecb->status.ha_status, ecb->status.resid_count);
903 struct ecb *ecb;
908 ecb = (struct ecb *)arg;
909 ccb = ecb->ccb;
922 ahbecbfree(ahb, ecb);
927 ecb_paddr = ahbecbvtop(ahb, ecb);
937 sg = ecb->sg_list;
946 ecb->hecb.flag_word1 |= FW1_SG_ECB;
947 ecb->hecb.data_ptr = ahbsgpaddr(ecb_paddr);
948 ecb->hecb.data_len = sizeof(ahb_sg_t) * nseg;
950 ecb->hecb.data_ptr = ecb->sg_list->addr;
951 ecb->hecb.data_len = ecb->sg_list->len;
955 /* ecb->hecb.flag_word2 |= FW2_DATA_DIR_IN; */
960 /* ecb->hecb.flag_word2 |= FW2_CHECK_DATA_DIR; */
962 bus_dmamap_sync(ahb->buffer_dmat, ecb->dmamap, op);
965 ecb->hecb.data_ptr = 0;
966 ecb->hecb.data_len = 0;
975 bus_dmamap_unload(ahb->buffer_dmat, ecb->dmamap);
976 ahbecbfree(ahb, ecb);
981 ecb->state = ECB_ACTIVE;
988 callout_reset_sbt(&ecb->timer, SBT_1MS * ccb->ccb_h.timeout, 0,
989 ahbtimeout, ecb, 0);
1006 struct ecb *ecb;
1011 * get an ecb to use.
1013 if ((ecb = ahbecbget(ahb)) == NULL) {
1015 panic("Failed to get an ecb");
1021 ecb->ccb = ccb;
1022 ccb->ccb_h.ccb_ecb_ptr = ecb;
1026 * Put all the arguments for the xfer in the ecb
1028 hecb = &ecb->hecb;
1050 ahbecbfree(ahb, ecb);
1061 ecb->dmamap,
1064 ecb, /*flags*/0);
1214 struct ecb *ecb;
1218 ecb = (struct ecb *)arg;
1219 ccb = ecb->ccb;
1223 printf("ECB %p - timed out\n", (void *)ecb);
1225 if ((ecb->state & ECB_ACTIVE) == 0) {
1228 (void *)ecb);
1241 if ((ecb->state & ECB_DEVICE_RESET) == 0) {
1244 if ((ecb->state & ECB_RELEASE_SIMQ) == 0) {
1246 ecb->state |= ECB_RELEASE_SIMQ;
1250 struct ecb *pending_ecb;
1252 pending_ecb = (struct ecb *)ccb_h->ccb_ecb_ptr;
1257 ahb->immed_ecb = ecb;
1272 ecb->state |= ECB_DEVICE_RESET;
1273 callout_reset(&ecb->timer, 2 * hz, ahbtimeout, ecb);
1277 } else if ((ecb->state & ECB_SCSIBUS_RESET) != 0) {
1284 ecb->state |= ECB_SCSIBUS_RESET;
1285 callout_reset(&ecb->timer, 2 * hz, ahbtimeout, ecb);