xref: /minix/minix/kernel/glo.h (revision 0a6a1f1d)
1 #ifndef GLO_H
2 #define GLO_H
3 
4 /* Global variables used in the kernel. This file contains the declarations;
5  * storage space for the variables is allocated in table.c, because EXTERN is
6  * defined as extern unless the _TABLE definition is seen. We rely on the
7  * compiler's default initialization (0) for several global variables.
8  */
9 #ifdef _TABLE
10 #undef EXTERN
11 #define EXTERN
12 #endif
13 
14 #include <minix/config.h>
15 #include <minix/ipcconst.h>
16 #include <machine/archtypes.h>
17 #include "archconst.h"
18 #include "config.h"
19 #include "debug.h"
20 
21 /* Kernel information structures. This groups vital kernel information. */
22 extern struct kinfo kinfo;		  /* kernel information for services */
23 extern struct machine machine;		  /* machine info for services */
24 extern struct kmessages kmessages;  	  /* diagnostic messages in kernel */
25 extern struct loadinfo loadinfo;	  /* status of load average */
26 extern struct kuserinfo kuserinfo;	  /* kernel information for users */
27 extern struct arm_frclock arm_frclock;	  /* ARM free-running timer info */
28 extern struct kclockinfo kclockinfo;	  /* clock information */
29 extern struct minix_kerninfo minix_kerninfo;
30 
31 EXTERN struct k_randomness krandom; 	/* gather kernel random information */
32 
33 EXTERN vir_bytes minix_kerninfo_user;
34 
35 #define kmess kmessages
36 #define kloadinfo loadinfo
37 
38 #define system_hz (kclockinfo.hz)		/* HZ value (alias) */
39 
40 /* Process scheduling information and the kernel reentry count. */
41 EXTERN struct proc *vmrequest;  /* first process on vmrequest queue */
42 EXTERN unsigned lost_ticks;	/* clock ticks counted outside clock task */
43 EXTERN char *ipc_call_names[IPCNO_HIGHEST+1]; /* human-readable call names */
44 EXTERN struct proc *kbill_kcall; /* process that made kernel call */
45 EXTERN struct proc *kbill_ipc; /* process that invoked ipc */
46 
47 /* Interrupt related variables. */
48 EXTERN irq_hook_t irq_hooks[NR_IRQ_HOOKS];	/* hooks for general use */
49 EXTERN int irq_actids[NR_IRQ_VECTORS];		/* IRQ ID bits active */
50 EXTERN int irq_use;				/* map of all in-use irq's */
51 
52 /* Miscellaneous. */
53 EXTERN int verboseboot;			/* verbose boot, init'ed in cstart */
54 
55 #if DEBUG_TRACE
56 EXTERN int verboseflags;
57 #endif
58 
59 #ifdef USE_APIC
60 EXTERN int config_no_apic; /* optionally turn off apic */
61 EXTERN int config_apic_timer_x; /* apic timer slowdown factor */
62 #endif
63 
64 EXTERN u64_t cpu_hz[CONFIG_MAX_CPUS];
65 
66 #define cpu_set_freq(cpu, freq)	do {cpu_hz[cpu] = freq;} while (0)
67 #define cpu_get_freq(cpu)	cpu_hz[cpu]
68 
69 #ifdef CONFIG_SMP
70 EXTERN int config_no_smp; /* optionally turn off SMP */
71 #endif
72 
73 /* VM */
74 EXTERN int vm_running;
75 EXTERN int catch_pagefaults;
76 EXTERN int kernel_may_alloc;
77 
78 /* Variables that are initialized elsewhere are just extern here. */
79 extern struct boot_image image[NR_BOOT_PROCS]; 	/* system image processes */
80 
81 EXTERN volatile int serial_debug_active;
82 
83 EXTERN struct cpu_info cpu_info[CONFIG_MAX_CPUS];
84 
85 /* BKL stats */
86 EXTERN u64_t kernel_ticks[CONFIG_MAX_CPUS];
87 EXTERN u64_t bkl_ticks[CONFIG_MAX_CPUS];
88 EXTERN unsigned bkl_tries[CONFIG_MAX_CPUS];
89 EXTERN unsigned bkl_succ[CONFIG_MAX_CPUS];
90 
91 /* Feature flags */
92 EXTERN int minix_feature_flags;
93 
94 #endif /* GLO_H */
95