Kernel: store ARM frclock info in one structure
This change serves to reduce the clutter inside the top-level kerninfo structure, and allows other ARM-specific values to be added on the kernel page in one place. Change-Id: I36a6aada9dbd1230b25014728be675d389088667
This commit is contained in:
parent
d91f738bd8
commit
26f5c8f84b
8 changed files with 28 additions and 13 deletions
|
@ -184,6 +184,12 @@ struct k_randomness {
|
|||
} bin[RANDOM_SOURCES];
|
||||
};
|
||||
|
||||
/* ARM free-running timer information. */
|
||||
struct arm_frclock {
|
||||
u64_t hz; /* tcrr frequency */
|
||||
u32_t tcrr; /* tcrr address */
|
||||
};
|
||||
|
||||
struct minix_kerninfo {
|
||||
/* Binaries will depend on the offsets etc. in this
|
||||
* structure, so it can't be changed willy-nilly. In
|
||||
|
@ -193,7 +199,7 @@ struct minix_kerninfo {
|
|||
u32_t kerninfo_magic;
|
||||
u32_t minix_feature_flags; /* features in minix kernel */
|
||||
u32_t ki_flags; /* what is present in this struct */
|
||||
u32_t minix_frclock_tcrr; /* NOT userland ABI */
|
||||
u32_t flags_unused2;
|
||||
u32_t flags_unused3;
|
||||
u32_t flags_unused4;
|
||||
struct kinfo *kinfo;
|
||||
|
@ -201,7 +207,8 @@ struct minix_kerninfo {
|
|||
struct kmessages *kmessages; /* NOT userland ABI */
|
||||
struct loadinfo *loadinfo; /* NOT userland ABI */
|
||||
struct minix_ipcvecs *minix_ipcvecs;
|
||||
u64_t minix_arm_frclock_hz; /* minix_frclock_tcrr frequency !ABI */
|
||||
u32_t reserved;
|
||||
struct arm_frclock *arm_frclock; /* NOT userland ABI */
|
||||
volatile struct kclockinfo *kclockinfo; /* NOT userland ABI */
|
||||
} __packed;
|
||||
|
||||
|
|
|
@ -160,12 +160,11 @@ kern_phys_fr_user_mapped(vir_bytes id, phys_bytes address)
|
|||
/* the only thing we need to do at this stage is to set the address */
|
||||
/* in the kerninfo struct */
|
||||
if (BOARD_IS_BBXM(machine.board_id)) {
|
||||
minix_kerninfo.minix_frclock_tcrr = address + OMAP3_TIMER_TCRR;
|
||||
minix_kerninfo.minix_arm_frclock_hz = 1625000;
|
||||
arm_frclock.tcrr = address + OMAP3_TIMER_TCRR;
|
||||
arm_frclock.hz = 1625000;
|
||||
} else if (BOARD_IS_BB(machine.board_id)) {
|
||||
minix_kerninfo.minix_frclock_tcrr =
|
||||
address + AM335X_TIMER_TCRR;
|
||||
minix_kerninfo.minix_arm_frclock_hz = 1500000;
|
||||
arm_frclock.tcrr = address + AM335X_TIMER_TCRR;
|
||||
arm_frclock.hz = 1500000;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -714,6 +714,7 @@ int arch_phys_map_reply(const int index, const vir_bytes addr)
|
|||
ASSIGN(machine);
|
||||
ASSIGN(kmessages);
|
||||
ASSIGN(loadinfo);
|
||||
ASSIGN(arm_frclock);
|
||||
ASSIGN(kclockinfo);
|
||||
|
||||
/* adjust the pointers of the functions and the struct
|
||||
|
|
|
@ -879,6 +879,7 @@ int arch_phys_map_reply(const int index, const vir_bytes addr)
|
|||
ASSIGN(machine);
|
||||
ASSIGN(kmessages);
|
||||
ASSIGN(loadinfo);
|
||||
ASSIGN(arm_frclock); /* eh, why not. */
|
||||
ASSIGN(kclockinfo);
|
||||
|
||||
/* select the right set of IPC routines to map into processes */
|
||||
|
|
|
@ -23,6 +23,7 @@ extern struct kinfo kinfo; /* kernel information for users */
|
|||
extern struct machine machine; /* machine information for users */
|
||||
extern struct kmessages kmessages; /* diagnostic messages in kernel */
|
||||
extern struct loadinfo loadinfo; /* status of load average */
|
||||
extern struct arm_frclock arm_frclock; /* ARM free-running timer info */
|
||||
extern struct kclockinfo kclockinfo; /* clock information */
|
||||
extern struct minix_kerninfo minix_kerninfo;
|
||||
|
||||
|
|
|
@ -436,6 +436,9 @@ void cstart()
|
|||
strlcpy(kinfo.release, OS_RELEASE, sizeof(kinfo.release));
|
||||
strlcpy(kinfo.version, OS_VERSION, sizeof(kinfo.version));
|
||||
|
||||
/* Initialize various user-mapped structures. */
|
||||
memset(&arm_frclock, 0, sizeof(arm_frclock));
|
||||
|
||||
#ifdef USE_APIC
|
||||
value = env_get("no_apic");
|
||||
if(value)
|
||||
|
|
|
@ -8,4 +8,6 @@ struct kinfo kinfo __section(".usermapped"); /* kernel information for users */
|
|||
struct machine machine __section(".usermapped"); /* machine information for users */
|
||||
struct kmessages kmessages __section(".usermapped"); /* diagnostic messages in kernel */
|
||||
struct loadinfo loadinfo __section(".usermapped"); /* status of load average */
|
||||
struct arm_frclock arm_frclock __section(".usermapped");
|
||||
/* ARM free running timer information */
|
||||
struct kclockinfo kclockinfo __section(".usermapped"); /* clock information */
|
||||
|
|
|
@ -26,8 +26,9 @@ micro_delay(u32_t micros)
|
|||
|
||||
/* Start of delay. */
|
||||
read_frclock_64(&start);
|
||||
assert(minix_kerninfo->minix_arm_frclock_hz);
|
||||
delta_end = (minix_kerninfo->minix_arm_frclock_hz * micros) / MICROHZ;
|
||||
assert(minix_kerninfo->arm_frclock);
|
||||
assert(minix_kerninfo->arm_frclock->hz);
|
||||
delta_end = (minix_kerninfo->arm_frclock->hz * micros) / MICROHZ;
|
||||
|
||||
/* If we have to wait for at least one HZ tick, use the regular
|
||||
* tickdelay first. Round downwards on purpose, so the average
|
||||
|
@ -50,7 +51,7 @@ micro_delay(u32_t micros)
|
|||
u32_t frclock_64_to_micros(u64_t tsc)
|
||||
{
|
||||
return (u32_t)
|
||||
(tsc / (get_minix_kerninfo()->minix_arm_frclock_hz / MICROHZ));
|
||||
(tsc / (get_minix_kerninfo()->arm_frclock->hz / MICROHZ));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -59,10 +60,10 @@ read_frclock(u32_t *frclk)
|
|||
struct minix_kerninfo *minix_kerninfo = get_minix_kerninfo();
|
||||
|
||||
assert(frclk);
|
||||
assert(minix_kerninfo->minix_frclock_tcrr);
|
||||
assert(minix_kerninfo->minix_arm_frclock_hz);
|
||||
assert(minix_kerninfo->arm_frclock);
|
||||
assert(minix_kerninfo->arm_frclock->tcrr);
|
||||
*frclk = *(volatile u32_t *)((u8_t *)
|
||||
minix_kerninfo->minix_frclock_tcrr);
|
||||
minix_kerninfo->arm_frclock->tcrr);
|
||||
}
|
||||
|
||||
u32_t
|
||||
|
|
Loading…
Reference in a new issue