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

Re: [Xen-devel] [RFC 14/29] xen/arm: Retrieve timer interrupts from the device tree



On Mon, 2013-04-29 at 00:01 +0100, Julien Grall wrote:

> +/* List of timer's IRQ */
> +enum ppi_nr
> +{
> +    PHYS_SECURE_PPI,
> +    PHYS_NONSECURE_PPI,
> +    VIRT_PPI,
> +    HYP_PPI,
> +    MAX_TIMER_PPI,
> +};
> +
> +static struct dt_irq timer_irq[MAX_TIMER_PPI];
> +
>  /*static inline*/ s_time_t ticks_to_ns(uint64_t ticks)
>  {
>      return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz);
> @@ -90,6 +103,28 @@ static uint32_t calibrate_timer(void)
>  /* Set up the timer on the boot CPU */
>  int __init init_xen_time(void)
>  {
> +    struct dt_device_node *dev;
> +    int res;
> +    unsigned int i;
> +
> +    dev = dt_find_compatible_node(NULL, NULL, "arm,armv7-timer");
> +    if ( !dev )
> +        panic("Unable to find a compatible timer in the device tree\n");
> +
> +    dt_device_set_used_by(dev, DT_USED_BY_XEN);
> +
> +    /* Retrieve all IRQs for the timer */
> +    for ( i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ )
> +    {
> +        res = dt_device_get_irq(dev, i, &timer_irq[i]);

If you expect the PPI nrs to have specific values you should declare
them as such in the enum.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.