Lines Matching refs:csb
1101 /* condition variable for the csb */
2569 struct fdcsb *csb;
2639 csb = &fdc->c_csb;
2640 csb->csb_unit = (uchar_t)unit;
2642 /* copy cmd bytes into csb */
2644 csb->csb_cmds[i] = fdr.fdr_cmd[i];
2645 csb->csb_ncmds = (uchar_t)fdr.fdr_cnum;
2647 csb->csb_maxretry = 0; /* let the application deal with errors */
2648 csb->csb_retrys = 0;
2660 csb->csb_cmds[2] = csb->csb_cmds[2] & 0xFE;
2662 csb->csb_cmds[2] = csb->csb_cmds[2] | 0x1;
2664 csb->csb_opflags = CSB_OFNORESULTS;
2665 csb->csb_nrslts = 0;
2670 csb->csb_cmds[1] = csb->csb_cmds[1] | (unit & DRV_MASK);
2671 csb->csb_opflags = CSB_OFIMMEDIATE;
2672 csb->csb_nrslts = 1;
2678 csb->csb_cmds[1] = csb->csb_cmds[1] | (unit & DRV_MASK);
2679 csb->csb_opflags = CSB_OFSEEKOPS + CSB_OFTIMEIT;
2680 csb->csb_nrslts = 2;
2688 csb->csb_cmds[1] = csb->csb_cmds[1] | (unit & DRV_MASK);
2689 csb->csb_opflags = CSB_OFXFEROPS + CSB_OFTIMEIT;
2690 csb->csb_nrslts = NRBRW;
2757 csb->csb_cmds[1] = csb->csb_cmds[1] | (unit & DRV_MASK);
2759 csb->csb_cmds[1] |= IPS;
2760 csb->csb_opflags = CSB_OFXFEROPS + CSB_OFTIMEIT;
2761 csb->csb_nrslts = NRBRW;
2770 if ((csb->csb_opflags & CSB_OFXFEROPS) && (fdr.fdr_nbytes == 0)) {
2775 csb->csb_opflags |= CSB_OFRAWIOCTL;
2835 csb->csb_addr = fa;
2836 csb->csb_len = fc;
2838 csb->csb_addr = 0;
2839 csb->csb_len = 0;
2842 csb->csb_addr = fa;
2843 csb->csb_len = fc;
2847 (C, "cmd: %x %x %x %x %x %x %x %x %x %x\n", csb->csb_cmds[0],
2848 csb->csb_cmds[1], csb->csb_cmds[2], csb->csb_cmds[3],
2849 csb->csb_cmds[4], csb->csb_cmds[5], csb->csb_cmds[6],
2850 csb->csb_cmds[7], csb->csb_cmds[8], csb->csb_cmds[9]));
2853 csb->csb_ncmds, csb->csb_opflags, (void *)csb->csb_addr,
2854 csb->csb_len));
2864 if ((csb->csb_opflags & CSB_OFNORESULTS) ||
2865 (csb->csb_opflags & CSB_OFIMMEDIATE)) {
2873 (C, "rslt: %x %x %x %x %x %x %x %x %x %x\n", csb->csb_rslt[0],
2874 csb->csb_rslt[1], csb->csb_rslt[2], csb->csb_rslt[3],
2875 csb->csb_rslt[4], csb->csb_rslt[5], csb->csb_rslt[6],
2876 csb->csb_rslt[7], csb->csb_rslt[8], csb->csb_rslt[9]));
2901 for (i = 0; (int)i <= (int)csb->csb_nrslts; i++)
2902 fdr.fdr_result[i] = csb->csb_rslt[i];
2949 struct fdcsb *csb;
2966 csb = &fdc->c_csb;
2970 /* setup common things in csb */
2971 csb->csb_unit = (uchar_t)unit;
2985 csb->csb_nrslts = NRBRW;
2986 csb->csb_opflags = CSB_OFXFEROPS | CSB_OFTIMEIT;
2988 csb->csb_cmds[0] = FDRAW_FORMAT;
2990 csb->csb_cmds[0] |= MFM;
2991 csb->csb_cmds[1] = (hd << 2) | (unit & 0x03);
2992 csb->csb_cmds[2] = ch->fdc_medium ? 3 : 2;
2993 csb->csb_cmds[3] = ch->fdc_secptrack;
2994 csb->csb_cmds[4] = GPLF;
2995 csb->csb_cmds[5] = FDATA;
2996 csb->csb_ncmds = 6;
2997 csb->csb_maxretry = rwretry;
2998 csb->csb_retrys = 0;
3008 csb->csb_len = (uint_t)4 * ch->fdc_secptrack;
3016 cmdresult = ddi_dma_mem_alloc(fdc->c_dmahandle, csb->csb_len,
3027 if (fdstart_dma(fdc, fd, csb->csb_len) != 0) {
3036 csb->csb_len = (uint_t)4 * ch->fdc_secptrack + 16;
3037 fd = kmem_zalloc(csb->csb_len, KM_SLEEP);
3041 csb->csb_addr = (caddr_t)fd;
3051 if (csb->csb_cmdstat)
3058 kmem_free((caddr_t)fmthdrs, csb->csb_len);
3085 struct fdcsb *csb;
3148 * Get the csb and initialize the values that are the same
3151 fdgetcsb(fdc); /* get csb (maybe wait for it) */
3152 csb = &fdc->c_csb;
3153 csb->csb_unit = unit; /* floppy unit number */
3172 csb->csb_cmds[0] = SK | FDRAW_RDCMD | MFM;
3174 csb->csb_cmds[0] = MT | SK | FDRAW_RDCMD | MFM;
3177 csb->csb_cmds[0] = FDRAW_WRCMD | MFM;
3179 csb->csb_cmds[0] = MT | FDRAW_WRCMD | MFM;
3189 csb->csb_cmds[5] = ch->fdc_medium ? 3 : 2; /* sector size */
3190 csb->csb_cmds[6] = ch->fdc_secptrack; /* EOT-# of sectors/trk */
3191 csb->csb_cmds[7] = GPLN; /* GPL - gap 3 size code */
3192 csb->csb_cmds[8] = SSSDTL; /* DTL - be 0xFF if N != 0 */
3194 csb->csb_ncmds = NCBRW; /* number of command bytes */
3195 csb->csb_nrslts = NRBRW; /* number of result bytes */
3201 csb->csb_opflags = CSB_OFXFEROPS | CSB_OFTIMEIT;
3300 csb->csb_cmds[1] = (head << 2) | unit;
3302 csb->csb_cmds[1] |= IPS;
3304 csb->csb_cmds[2] = cyl; /* C - cylinder address */
3305 csb->csb_cmds[3] = head; /* H - head number */
3306 csb->csb_cmds[4] = sect; /* R - sector number */
3308 csb->csb_cmds[6] = sect +
3311 csb->csb_len = tlen;
3313 csb->csb_addr = temp_addr;
3315 csb->csb_addr = addr;
3318 csb->csb_maxretry = rwretry;
3319 csb->csb_retrys = 0;
3327 csb->csb_addr = fdc->dma_buf;
3329 if (csb->csb_read != CSB_READ) {
3335 if (fdstart_dma(fdc, csb->csb_addr,
3379 (csb->csb_read == CSB_READ)) {
3581 * controller and then we do whatever else the csb says -
3601 struct fdcsb *csb;
3611 csb = &fdc->c_csb;
3612 unit = csb->csb_unit;
3619 fdcmds[csb->csb_cmds[0] & 0x1f].cmdname));
3670 switch (csb->csb_cmds[0] & 0x1f) {
3692 csb->csb_raddr = 0;
3693 csb->csb_rlen = 0;
3694 if (csb->csb_opflags & CSB_OFSEEKOPS) {
3695 csb->csb_opmode = 2;
3696 } else if (csb->csb_opflags & CSB_OFIMMEDIATE) {
3697 csb->csb_opmode = 0;
3699 csb->csb_opmode = 1; /* normal data xfer commands */
3700 csb->csb_raddr = csb->csb_addr;
3701 csb->csb_rlen = csb->csb_len;
3704 bzero((caddr_t)csb->csb_rslt, 10);
3705 csb->csb_status = 0;
3706 csb->csb_cmdstat = 0;
3754 csb->csb_cmdstat = 1; /* XXX TBD ERRS NYD for now */
3761 for (i = 0; i < (int)csb->csb_ncmds; i++) {
3771 csb->csb_cmdstat = 1;
3777 Set_Fifo(fdc, csb->csb_cmds[i]);
3780 (C, "fdexec: sent 0x%x, Msr 0x%x\n", csb->csb_cmds[i],
3790 if (csb->csb_opflags & CSB_OFTIMEIT) {
3799 if (csb->csb_opflags & CSB_OFNORESULTS) {
3818 csb->csb_cmdstat = 1;
3832 * the csb
3834 if (csb->csb_opflags & CSB_OFIMMEDIATE) {
3836 csb->csb_nrslts = 0;
3845 csb->csb_rslt[csb->csb_nrslts++] =
3850 * csb->csb_nrslts));
3855 Msr(fdc), csb->csb_nrslts));
3857 csb->csb_status = 2;
3890 ((csb->csb_rslt[0] & IC_SR0) == 0x40) &&
3891 (csb->csb_rslt[1] & EN_SR1))
3892 csb->csb_rslt[0] &= ~IC_SR0;
3901 if (((csb->csb_rslt[0] & IC_SR0) || (fdc->c_csb.csb_dcsr_rslt) ||
3902 (csb->csb_status)) &&
3903 ((csb->csb_cmds[0] != FDRAW_SENSE_DRV) &&
3904 (csb->csb_cmds[0] != DUMPREG))) {
3922 /* ASSUMES that cmd is still intact in csb */
4002 struct fdcsb *csb;
4005 csb = &fdc->c_csb;
4011 csb->csb_rslt[1] |= TO_SR1;
4013 (C, "fd%d: %s timed out\n", csb->csb_unit,
4014 fdcmds[csb->csb_cmds[0] & 0x1f].cmdname));
4016 /* use private csb */
4035 fdc->c_csb = savecsb; /* restore original csb */
4041 if (csb->csb_rslt[1] & DE_SR1) {
4044 if (csb->csb_rslt[1] & OR_SR1) {
4047 if (csb->csb_rslt[1] & (ND_SR1+MA_SR1)) {
4050 if (csb->csb_rslt[1] & TO_SR1) {
4059 if (csb->csb_opflags & CSB_OFRAWIOCTL) {
4068 if (csb->csb_dcsr_rslt == 1) {
4077 if (csb->csb_dma_rslt == 1) {
4079 (C, "fd%d: DMA interface error\n", csb->csb_unit));
4089 csb->csb_retrys++;
4090 if (csb->csb_retrys > csb->csb_maxretry) {
4093 0, fdcmds[csb->csb_cmds[0] & 0x1f].cmdname,
4094 csb->csb_rslt[0], csb->csb_rslt[1], csb->csb_rslt[2]));
4095 if (csb->csb_rslt[1] & NW_SR1) {
4099 if (csb->csb_rslt[1] & DE_SR1) {
4104 if (csb->csb_rslt[1] & OR_SR1) {
4111 if (csb->csb_retrys <= rwretry)
4118 if (csb->csb_rslt[1] & (ND_SR1+MA_SR1)) {
4123 if (csb->csb_rslt[1] & TO_SR1) {
4128 csb->csb_cmdstat = 1; /* failed - give up */
4132 if (csb->csb_opflags & CSB_OFSEEKOPS) {
4135 (C, "fd%d: %s error : st0 0x%x\n", csb->csb_unit,
4136 fdcmds[csb->csb_cmds[0] & 0x1f].cmdname,
4137 csb->csb_rslt[0]));
4139 if (csb->csb_opflags & CSB_OFXFEROPS) {
4143 csb->csb_unit, fdcmds[csb->csb_cmds[0] & 0x1f].cmdname,
4144 csb->csb_rslt[0], csb->csb_rslt[1], csb->csb_rslt[2]));
4562 * somebody's waiting on finish of fdctlr/csb,
4573 * FDCFLG_BUSY is NOT cleared, NOR is the csb given
4574 * back; the operation just finished can look at the csb
4602 struct fdcsb *csb;
4604 csb = &fdc->c_csb;
4606 csb->csb_opmode));
4610 if (csb->csb_opmode != 4) {
4622 csb->csb_opmode = 0;
4636 * somebody's waiting on finish of fdctlr/csb, wake them
4642 * FDCFLG_BUSY is NOT cleared, NOR is the csb given back; so
4643 * the operation just finished can look at the csb
4648 csb->csb_rslt[0], csb->csb_rslt[1], csb->csb_rslt[2]));
4665 struct fdcsb *csb;
4682 csb = &fdc->c_csb;
4688 old_opmode = csb->csb_opmode;
4691 (C, "fd%d: timeout, opmode:%d\n", csb->csb_unit, old_opmode));
4693 csb->csb_opmode = 4;
4697 fdcmds[csb->csb_cmds[0] & 0x1f].cmdname));
4699 csb->csb_status = CSB_CMDTO;
4713 * wait until the csb is free
4729 * return csb
4760 * ASSUMES: that it already owns the csb/fdctlr!
4767 struct fdcsb *csb;
4860 csb = &fdc->c_csb;
4862 /* setup common things in csb */
4863 csb->csb_unit = fdc->c_un->un_unit_no;
4864 csb->csb_nrslts = 0;
4865 csb->csb_opflags = CSB_OFNORESULTS;
4866 csb->csb_maxretry = 0;
4867 csb->csb_retrys = 0;
4869 csb->csb_read = CSB_NULL;
4872 /* csb->unit is don't care */
4873 csb->csb_cmds[0] = FDRAW_SPECIFY;
4874 csb->csb_cmds[1] = fdspec[0]; /* step rate, head unload time */
4876 csb->csb_cmds[2] = SPEC_DMA_MODE;
4878 csb->csb_cmds[2] = fdspec[1]; /* head load time, DMA mode */
4880 csb->csb_ncmds = 3;
4887 /* csb->unit is don't care */
4888 csb->csb_cmds[0] = CONFIGURE;
4889 csb->csb_cmds[1] = fdconf[0]; /* motor info, motor delays */
4890 csb->csb_cmds[2] = fdconf[1]; /* enaimplsk, disapoll, fifothru */
4891 csb->csb_cmds[3] = fdconf[2]; /* track precomp */
4892 csb->csb_ncmds = 4;
4894 csb->csb_read = CSB_NULL;
4896 csb->csb_retrys = 0;
4926 struct fdcsb *csb;
4935 csb = &fdc->c_csb;
4936 csb->csb_unit = (uchar_t)unit;
4937 csb->csb_cmds[1] = unit & 0x03;
4940 csb->csb_cmds[0] = FDRAW_REZERO;
4941 csb->csb_ncmds = 2;
4943 csb->csb_cmds[0] = FDRAW_SEEK;
4944 csb->csb_cmds[2] = (uchar_t)arg;
4945 csb->csb_ncmds = 3;
4947 csb->csb_nrslts = 2; /* 2 for SENSE INTERRUPTS */
4948 csb->csb_opflags = CSB_OFSEEKOPS | CSB_OFTIMEIT;
4953 csb->csb_maxretry = skretry;
4954 csb->csb_retrys = 0;
4969 if ((csb->csb_rslt[0] & IC_SR0) || csb->csb_cmdstat)
4986 struct fdcsb *csb;
4990 csb = &fdc->c_csb;
4992 /* setup common things in csb */
4993 csb->csb_unit = (uchar_t)unit;
4994 csb->csb_opflags = CSB_OFIMMEDIATE;
4995 csb->csb_cmds[0] = FDRAW_SENSE_DRV;
4997 csb->csb_cmds[1] = MOT | (unit & 0x03);
4998 csb->csb_ncmds = 2;
4999 csb->csb_nrslts = 1;
5000 csb->csb_maxretry = skretry;
5001 csb->csb_retrys = 0;
5007 (C, "fdsensedrv: result 0x%x", csb->csb_rslt[0]));
5009 return (csb->csb_rslt[0]); /* return status byte 3 */
5023 struct fdcsb *csb;
5033 * save old csb
5036 csb = &fdc->c_csb;
5038 bzero((caddr_t)csb, sizeof (*csb));
5060 /* "restore" old csb, check change state */
5073 if (fdsense_chng(fdc, csb->csb_unit)) {
5443 struct fdcsb *csb;
5472 csb = &fdc->c_csb;
5479 csb->csb_cmds[0] = SK + FDRAW_RDCMD;
5481 csb->csb_cmds[0] = MT + SK + FDRAW_RDCMD;
5487 csb->csb_cmds[0] = FDRAW_WRCMD;
5489 csb->csb_cmds[0] = MT + FDRAW_WRCMD;
5498 csb->csb_cmds[0] |= MFM;
5499 csb->csb_cmds[1] = (uchar_t)(unit | ((head & 0x1) << 2));
5501 csb->csb_cmds[1] |= IPS;
5502 csb->csb_cmds[2] = (uchar_t)cyl;
5503 csb->csb_cmds[3] = (uchar_t)head;
5504 csb->csb_cmds[4] = (uchar_t)sector;
5505 csb->csb_cmds[5] = ch->fdc_medium ? 3 : 2; /* sector size code */
5510 csb->csb_cmds[6] = sector + (len / ch->fdc_sec_size) - 1;
5512 csb->csb_cmds[6] =
5514 csb->csb_len = len;
5515 csb->csb_cmds[7] = GPLN;
5516 csb->csb_cmds[8] = SSSDTL;
5517 csb->csb_ncmds = NCBRW;
5518 csb->csb_len = len;
5519 csb->csb_maxretry = 2;
5520 csb->csb_retrys = 0;
5521 bzero(csb->csb_rslt, NRBRW);
5522 csb->csb_nrslts = NRBRW;
5523 csb->csb_opflags = CSB_OFXFEROPS | CSB_OFTIMEIT;
5567 csb->csb_addr = dma_addr;
5570 csb->csb_addr = bufp;
5599 if (csb->csb_cmdstat)