return(-1);
}
+ /*
+ * Deal with the case where the CPU # passed in is past the
+ * value specified in cpus=n in boot-args.
+ */
+ if (cpu >= real_ncpus) {
+ enabled = ml_set_interrupts_enabled(FALSE);
+ lcpu = cpu_to_lcpu(cpu);
+ if (lcpu != NULL) {
+ core = lcpu->core;
+ pkg = core->package;
+
+ if (lcpu->primary) {
+ pkg->flags |= X86PKG_FL_HAS_HPET;
+ }
+ }
+
+ ml_set_interrupts_enabled(enabled);
+ return(0);
+ }
+
rc = (*hpet_req)(ml_get_apicid(cpu), hpet_arg, &hpetReq);
if (rc != 0) {
return(rc);
DBG(" CVT: HPET to BUS = %08X.%08X\n",
(uint32_t)(hpet2bus >> 32), (uint32_t)hpet2bus);
- /* Make sure the counter is off in the HPET configuration flags */
- uint64_t hpetcon = ((hpetReg_t *)hpetArea)->GEN_CONF;
- hpetcon = hpetcon & ~1;
- ((hpetReg_t *)hpetArea)->GEN_CONF = hpetcon;
-
- /*
- * Convert current TSC to HPET value,
- * set it, and start it ticking.
- */
- uint64_t currtsc = rdtsc64();
- uint64_t tscInHPET = tmrCvt(currtsc, tsc2hpet);
- ((hpetReg_t *)hpetArea)->MAIN_CNT = tscInHPET;
- hpetcon = hpetcon | 1;
- ((hpetReg_t *)hpetArea)->GEN_CONF = hpetcon;
- kprintf("HPET started: TSC = %08X.%08X, HPET = %08X.%08X\n",
- (uint32_t)(currtsc >> 32), (uint32_t)currtsc,
- (uint32_t)(tscInHPET >> 32), (uint32_t)tscInHPET);
-
#if MACH_KDB
db_display_hpet((hpetReg_t *)hpetArea); /* (BRINGUP) */
#endif
info->hpet2tsc = hpet2tsc;
info->bus2hpet = bus2hpet;
info->hpet2bus = hpet2bus;
- info->rcbaArea = rcbaArea;
- info->rcbaAreap = rcbaAreap;
+ /*
+ * XXX
+ * We're repurposing the rcbaArea so we can use the HPET.
+ * Eventually we'll rename this correctly.
+ */
+ info->rcbaArea = hpetArea;
+ info->rcbaAreap = hpetAreap;
}