init_qtime()

Initialize the qtime data structure in the system page.

Synopsis:

#include "board_startup.h"
				
void init_qtime (void)

Arguments:

None.

Description:

This function initializes the system page's qtime data structure. Initializations this function performs can include:

For many x86 platforms, the generic function works. For ARM platforms, board-specific functions are often required.

Examples:

The following example is a init_qtime() function for the fictitious ARM DK Elsinore Ghost 8 board:

#include "elsinore_startup.h"

extern unsigned armv7gt_cntfrq;
extern unsigned armv7gt_irq;

void
init_qtime_ghost8()
{
    struct qtime_entry  qtime;

    if (fdt_qtime(&qtime) == 0) {
        armv7gt_cntfrq = qtime.cycles_per_sec;
        armv7gt_irq    = qtime.intr;
    }

    init_qtime_v7gt();
}

The following example is a generic init_qtime() function x86 boards:

#include "startup.h"

/* By default we continue to use the 8254 timer as the system clock. However,
 * if the 'use_hpet_timer' flag is set we use the higher resolution HPET0 as
 * the system clock.
 * Startups have 2 choices for accomplishing that. They can set the
 * 'use_hpet_timer' flag in their main() and continue to call init_qtime(), or
 * they can call init_qtime_hpet() directly. Continuing to call init_qtime()
 * provides for a fallback to the 8254. startup-x86 uses the 'use_hpet_timer'
 * flag so that the startup specific -z option will revert to using the 8254.
*/
unsigned use_hpet_timer = 0;

void init_qtime()
{
	struct qtime_entry *qtime = alloc_qtime();	// ensure this is done once

	if (!use_hpet_timer || (init_qtime_hpet(qtime) != 0)) {
		init_qtime_8254(qtime);
	}
}