1931 struct fdcntlr *fcp = fjp->fj_fdc;
1932 int unit = fjp->fj_unit & 3;
1933 int old_mstate;
1934 int rval = 0;
1935 uchar_t motorbit;
1936
1937 ASSERT(MUTEX_HELD(&fcp->c_dorlock));
1938 old_mstate = fcp->c_mtrstate[unit];
1939 encode(motor_onbits, unit, &motorbit);
1940
1941 switch (input) {
1942 case FMI_TIMER: /* timer expired */
1943 fcp->c_motort[unit] = 0;
1944 switch (old_mstate) {
1945 case FMS_START:
1946 case FMS_DELAY:
1947 fcp->c_mtrstate[unit] = FMS_ON;
1948 break;
1949 case FMS_KILLST:
1950 fcp->c_motort[unit] = timeout(fdmotort, (void *)fjp,
1951 drv_usectohz(1000000));
1952 fcp->c_mtrstate[unit] = FMS_IDLE;
1953 break;
1954 case FMS_IDLE:
1955 fcp->c_digout &= ~motorbit;
1956 outb(fcp->c_regbase + FCR_DOR, fcp->c_digout);
1957 fcp->c_mtrstate[unit] = FMS_OFF;
1958 fjp->fj_flags &= ~FUNIT_3DMODE;
1959 break;
1960 case 86:
1961 rval = -1;
1962 break;
1963 case FMS_OFF:
1964 case FMS_ON:
1965 default:
1966 rval = -2;
1967 }
1968 break;
1969
1970 case FMI_STARTCMD: /* start command */
1971 switch (old_mstate) {
|
1931 struct fdcntlr *fcp = fjp->fj_fdc;
1932 int unit = fjp->fj_unit & 3;
1933 int old_mstate;
1934 int rval = 0;
1935 uchar_t motorbit;
1936
1937 ASSERT(MUTEX_HELD(&fcp->c_dorlock));
1938 old_mstate = fcp->c_mtrstate[unit];
1939 encode(motor_onbits, unit, &motorbit);
1940
1941 switch (input) {
1942 case FMI_TIMER: /* timer expired */
1943 fcp->c_motort[unit] = 0;
1944 switch (old_mstate) {
1945 case FMS_START:
1946 case FMS_DELAY:
1947 fcp->c_mtrstate[unit] = FMS_ON;
1948 break;
1949 case FMS_KILLST:
1950 fcp->c_motort[unit] = timeout(fdmotort, (void *)fjp,
1951 drv_sectohz(1));
1952 fcp->c_mtrstate[unit] = FMS_IDLE;
1953 break;
1954 case FMS_IDLE:
1955 fcp->c_digout &= ~motorbit;
1956 outb(fcp->c_regbase + FCR_DOR, fcp->c_digout);
1957 fcp->c_mtrstate[unit] = FMS_OFF;
1958 fjp->fj_flags &= ~FUNIT_3DMODE;
1959 break;
1960 case 86:
1961 rval = -1;
1962 break;
1963 case FMS_OFF:
1964 case FMS_ON:
1965 default:
1966 rval = -2;
1967 }
1968 break;
1969
1970 case FMI_STARTCMD: /* start command */
1971 switch (old_mstate) {
|