/* * cpu_initclocks: * * Initialize the clock and get them going. */ void cpu_initclocks(void) { u_int oldirqstate; #if 0 if (hz < 50 || COUNTS_PER_SEC % hz) { printf("Cannot get %d Hz clock; using 100 Hz\n", hz); hz = 100; } #endif /* * We only have one timer available; stathz and profhz are * always left as 0 (the upper-layer clock code deals with * this situation). */ if (stathz != 0) printf("Cannot get %d Hz statclock\n", stathz); stathz = 0; if (profhz != 0) printf("Cannot get %d Hz profclock\n", profhz); profhz = 0; /* Report the clock frequency. */ aprint_normal("clock: hz=%d stathz=%d profhz=%d\n", hz, stathz, profhz); oldirqstate = disable_interrupts(I32_bit); /* Hook up the clock interrupt handler. */ clock_ih = becc_intr_establish(ICU_TIMERA, IPL_CLOCK, clockhandler, NULL); if (clock_ih == NULL) panic("cpu_initclocks: unable to register timer interrupt"); /* Set up the new clock parameters. */ /* Stop timer, clear interrupt */ BECC_CSR_WRITE(BECC_TSCRA, TSCRx_TIF); counts_per_hz = COUNTS_PER_SEC / hz; /* Set the timer preload value. */ BECC_CSR_WRITE(BECC_TPRA, counts_per_hz - 1); /* ...and start it in motion. */ BECC_CSR_WRITE(BECC_TSCRA, TSCRx_TE | TSCRx_CM); #ifdef __HAVE_FAST_SOFTINTS /* register soft interrupt handler as well */ becc_intr_establish(ICU_SOFT, IPL_SOFTCLOCK, becc_softint, NULL); #endif restore_interrupts(oldirqstate); tc_init(&becc_timecounter); }
void * becc_pci_intr_establish(void *v, pci_intr_handle_t ih, int ipl, int (*func)(void *), void *arg) { return (becc_intr_establish(ih, ipl, func, arg)); }