arch/parisc/kernel/time.c

Source file repositories/reference/linux-study-clean/arch/parisc/kernel/time.c

File Facts

System
Linux kernel
Corpus path
arch/parisc/kernel/time.c
Extension
.c
Size
5466 bytes
Lines
236
Domain
Architecture Layer
Bucket
arch/parisc
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

device_initcall(rtc_init);
#endif

void read_persistent_clock64(struct timespec64 *ts)
{
	static struct pdc_tod tod_data;
	if (pdc_tod_read(&tod_data) == 0) {
		ts->tv_sec = tod_data.tod_sec;
		ts->tv_nsec = tod_data.tod_usec * 1000;
	} else {
		printk(KERN_ERR "Error reading tod clock\n");
	        ts->tv_sec = 0;
		ts->tv_nsec = 0;
	}
}

static u64 notrace read_cr16_sched_clock(void)
{
	return get_cycles();
}

static u64 notrace read_cr16(struct clocksource *cs)
{
	return get_cycles();
}

static struct clocksource clocksource_cr16 = {
	.name			= "cr16",
	.rating			= 300,
	.read			= read_cr16,
	.mask			= CLOCKSOURCE_MASK(BITS_PER_LONG),
	.flags			= CLOCK_SOURCE_IS_CONTINUOUS |
				  CLOCK_SOURCE_VALID_FOR_HRES,
};

/*
 * timer interrupt and sched_clock() initialization
 */

void __init time_init(void)
{
	cr16_clock_freq = 100 * PAGE0->mem_10msec;  /* Hz */
	clocktick = cr16_clock_freq / HZ;

	/* register as sched_clock source */
	sched_clock_register(read_cr16_sched_clock, BITS_PER_LONG, cr16_clock_freq);

	parisc_clockevent_init();

	/* check for free-running 64-bit platform counter */
	parisc_find_64bit_counter();

	/* register at clocksource framework */
	clocksource_register_hz(&clocksource_cr16, cr16_clock_freq);
}

Annotation

Implementation Notes