Lines Matching refs:hc

207 		struct hpet_channel *hc = hpet_base.channels + i;
210 hd.hd_irq[i] = hc->irq;
212 switch (hc->mode) {
215 hc->mode = HPET_MODE_DEVICE;
219 hpet_reserve_timer(&hd, hc->num);
232 struct hpet_channel *hc = hpet_base.channels + i;
235 if (hc->mode == HPET_MODE_UNUSED) {
236 hc->mode = HPET_MODE_DEVICE;
398 static void hpet_init_clockevent(struct hpet_channel *hc, unsigned int rating)
400 struct clock_event_device *evt = &hc->evt;
403 evt->irq = hc->irq;
404 evt->name = hc->name;
405 evt->cpumask = cpumask_of(hc->cpu);
411 if (hc->boot_cfg & HPET_TN_PERIODIC) {
417 static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc)
423 hc->cpu = boot_cpu_data.cpu_index;
424 strscpy(hc->name, "hpet", sizeof(hc->name));
425 hpet_init_clockevent(hc, 50);
427 hc->evt.tick_resume = hpet_clkevt_legacy_resume;
457 hc->evt.features |= CLOCK_EVT_FEAT_PERIODIC;
458 hc->evt.set_state_periodic = hpet_clkevt_set_state_periodic;
463 clockevents_config_and_register(&hc->evt, hpet_freq,
465 global_clock_event = &hc->evt;
475 struct hpet_channel *hc = irq_data_get_irq_handler_data(data);
478 cfg = hpet_readl(HPET_Tn_CFG(hc->num));
480 hpet_writel(cfg, HPET_Tn_CFG(hc->num));
485 struct hpet_channel *hc = irq_data_get_irq_handler_data(data);
488 cfg = hpet_readl(HPET_Tn_CFG(hc->num));
490 hpet_writel(cfg, HPET_Tn_CFG(hc->num));
493 static void hpet_msi_write(struct hpet_channel *hc, struct msi_msg *msg)
495 hpet_writel(msg->data, HPET_Tn_ROUTE(hc->num));
496 hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hc->num) + 4);
595 static int hpet_assign_irq(struct irq_domain *domain, struct hpet_channel *hc,
602 info.data = hc;
611 struct hpet_channel *hc = clockevent_to_channel(evt);
612 struct irq_data *data = irq_get_irq_data(hc->irq);
617 hpet_msi_write(hc, &msg);
624 struct hpet_channel *hc = data;
625 struct clock_event_device *evt = &hc->evt;
628 pr_info("Spurious interrupt HPET channel %d\n", hc->num);
636 static int hpet_setup_msi_irq(struct hpet_channel *hc)
638 if (request_irq(hc->irq, hpet_msi_interrupt_handler,
640 hc->name, hc))
643 disable_irq(hc->irq);
644 irq_set_affinity(hc->irq, cpumask_of(hc->cpu));
645 enable_irq(hc->irq);
647 pr_debug("%s irq %u for MSI\n", hc->name, hc->irq);
653 static void init_one_hpet_msi_clockevent(struct hpet_channel *hc, int cpu)
655 struct clock_event_device *evt = &hc->evt;
657 hc->cpu = cpu;
658 per_cpu(cpu_hpet_channel, cpu) = hc;
659 hpet_setup_msi_irq(hc);
661 hpet_init_clockevent(hc, 110);
673 struct hpet_channel *hc = hpet_base.channels + i;
675 if (hc->mode != HPET_MODE_CLOCKEVT || hc->in_use)
677 hc->in_use = 1;
678 return hc;
685 struct hpet_channel *hc = hpet_get_unused_clockevent();
687 if (hc)
688 init_one_hpet_msi_clockevent(hc, cpu);
694 struct hpet_channel *hc = per_cpu(cpu_hpet_channel, cpu);
696 if (!hc)
698 free_irq(hc->irq, hc);
699 hc->in_use = 0;
721 struct hpet_channel *hc = hpet_base.channels + i;
724 if (hc->mode != HPET_MODE_UNUSED)
728 if (!(hc->boot_cfg & HPET_TN_FSB_CAP))
731 sprintf(hc->name, "hpet%d", i);
733 irq = hpet_assign_irq(hpet_domain, hc, hc->num);
737 hc->irq = irq;
738 hc->mode = HPET_MODE_CLOCKEVT;
1004 struct hpet_channel *hc;
1050 hc = kcalloc(channels, sizeof(*hc), GFP_KERNEL);
1051 if (!hc) {
1055 hpet_base.channels = hc;
1067 for (i = 0; i < channels; i++, hc++) {
1068 hc->num = i;
1071 hc->boot_cfg = cfg;
1073 hc->irq = irq;