Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Hardware interrupt list?



On 9/5/2011 10:51, Ken Hornstein wrote:
The other place to check is in the com(4) (16550 UART driver) source;
it's the only other serial device driver in the NetBSD source tree that
supports PPSAPI.

I did look at that as an example; it looks like to me you don't
need to do anything extra with the com driver to enable interrupts
for status changes (or perhaps the com driver does that all of the
time).  So I could easily believe that this is broken for people on
Sparc hardware that has the old serial port hardware.


The relevant code in z8530tty.c from zsioctl():


#ifdef PPS_SYNC
        case PPS_IOC_KCBIND:
#endif
                mutex_spin_enter(&timecounter_lock);
                error = pps_ioctl(cmd, data, &zst->zst_pps_state);
                if (zst->zst_pps_state.ppsparam.mode & PPS_CAPTUREBOTH)
                        zst->zst_ppsmask = ZSRR0_DCD;
                else
                        zst->zst_ppsmask = 0;
                mutex_spin_exit(&timecounter_lock);
                break;

        case TIOCDCDTIMESTAMP:  /* XXX old, overloaded  API used by xntpd v3 */
                if (cs->cs_rr0_pps == 0) {
                        error = EINVAL;
                        break;
                }
                mutex_spin_enter(&timecounter_lock);
#ifndef PPS_TRAILING_EDGE
                TIMESPEC_TO_TIMEVAL((struct timeval *)data,
                    &zst->zst_pps_state.ppsinfo.assert_timestamp);
#else
                TIMESPEC_TO_TIMEVAL((struct timeval *)data,
                    &zst->zst_pps_state.ppsinfo.clear_timestamp);
#endif
                mutex_spin_exit(&timecounter_lock);
                /*
                 * Now update interrupts.
                 */
                zs_maskintr(zst);
                /*
                 * If nothing is being transmitted, set up new current values,
                 * else mark them as pending.
                 */
                if (!cs->cs_heldchange) {
                        if (zst->zst_tx_busy) {
                                zst->zst_heldtbc = zst->zst_tbc;
                                zst->zst_tbc = 0;
                                cs->cs_heldchange = 1;
                        } else
                                zs_loadchannelregs(cs);
                }

                break;


So it does appear that zs_maskintr(zst) is called for a TIOCDCDTIMESTAMP but it's never called during a PPS_IOC_* request even though the zst mask is set up:

if (zst->zst_pps_state.ppsparam.mode & PPS_CAPTUREBOTH)
     zst->zst_ppsmask = ZSRR0_DCD;
else
     zst->zst_ppsmask = 0;


It' just never used. So I guess I should take my cue from TIOCDCDTIMESTAMP and call zs_maskintr(zst) immediately after mutex_spin_exit() up in the PPS_IOC code.

Home | Main Index | Thread Index | Old Index