/
statedata.c
69 lines (54 loc) · 2.17 KB
/
statedata.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright 2014, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#include <config.h>
#include <api/debug.h>
#include <types.h>
#include <plat/machine.h>
#include <model/statedata.h>
#include <object/structures.h>
#include <object/tcb.h>
#include <benchmark/benchmark_track.h>
/* Collective cpu states, including both pre core architecture dependant and independent data */
SMP_STATE_DEFINE(smpStatedata_t, ksSMP[CONFIG_MAX_NUM_NODES] ALIGN(CONFIG_CACHE_LN_SZ));
/* Global count of how many cpus there are */
word_t ksNumCPUs;
/* Pointer to the head of the scheduler queue for each priority */
UP_STATE_DEFINE(tcb_queue_t, ksReadyQueues[NUM_READY_QUEUES]);
UP_STATE_DEFINE(word_t, ksReadyQueuesL1Bitmap[CONFIG_NUM_DOMAINS]);
UP_STATE_DEFINE(word_t, ksReadyQueuesL2Bitmap[CONFIG_NUM_DOMAINS][(CONFIG_NUM_PRIORITIES / wordBits) + 1]);
compile_assert(ksReadyQueuesL1BitmapBigEnough, (CONFIG_NUM_PRIORITIES / wordBits) <= wordBits)
/* Current thread TCB pointer */
UP_STATE_DEFINE(tcb_t *, ksCurThread);
/* Idle thread TCB pointer */
UP_STATE_DEFINE(tcb_t *, ksIdleThread);
/* Values of 0 and ~0 encode ResumeCurrentThread and ChooseNewThread
* respectively; other values encode SwitchToThread and must be valid
* tcb pointers */
UP_STATE_DEFINE(tcb_t *, ksSchedulerAction);
/* Units of work we have completed since the last time we checked for
* pending interrupts */
word_t ksWorkUnitsCompleted;
/* CNode containing interrupt handler endpoints */
irq_state_t intStateIRQTable[maxIRQ + 1];
cte_t *intStateIRQNode;
/* Currently active domain */
dom_t ksCurDomain;
/* Domain timeslice remaining */
word_t ksDomainTime;
/* An index into ksDomSchedule for active domain and length. */
word_t ksDomScheduleIdx;
/* Only used by lockTLBEntry */
word_t tlbLockCount = 0;
#if (defined DEBUG || defined CONFIG_BENCHMARK_TRACK_KERNEL_ENTRIES)
kernel_entry_t ksKernelEntry;
#endif /* DEBUG */
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
paddr_t ksUserLogBuffer;
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */