typedef struct Conf Conf;
typedef struct Confmem Confmem;
typedef struct FPsave FPsave;
+typedef struct PFPU PFPU;
typedef struct ISAConf ISAConf;
typedef struct Label Label;
typedef struct Lock Lock;
typedef struct Memcache Memcache;
typedef struct MMMU MMMU;
typedef struct Mach Mach;
-typedef struct Notsave Notsave;
typedef struct Page Page;
typedef struct PhysUart PhysUart;
typedef struct PMMU PMMU;
typedef struct Proc Proc;
typedef u32int PTE;
+typedef struct Soc Soc;
typedef struct Uart Uart;
typedef struct Ureg Ureg;
typedef uvlong Tval;
uintptr pc;
};
+/*
+ * emulated or vfp3 floating point
+ */
enum {
Maxfpregs = 32, /* could be 16 or 32, see Mach.fpnregs */
Nfpctlregs = 16,
};
-/*
- * emulated or vfp3 floating point
- */
struct FPsave
{
ulong status;
uintptr pc; /* of failed fp instr. */
};
-/*
- * FPsave.fpstate
- */
+struct PFPU
+{
+ int fpstate;
+ FPsave fpsave[1];
+};
+
enum
{
FPinit,
struct Confmem
{
uintptr base;
- usize npage;
+ ulong npage;
uintptr limit;
uintptr kbase;
uintptr klimit;
ulong nproc; /* processes */
Confmem mem[1]; /* physical memory */
ulong npage; /* total physical pages of memory */
- usize upages; /* user page pool */
+ ulong upages; /* user page pool */
ulong copymode; /* 0 is copy on write, 1 is copy on reference */
ulong ialloc; /* max interrupt time allocation in bytes */
ulong pipeqsize; /* size in bytes of pipe queues */
int monitor; /* flag */
};
-/*
- * things saved in the Proc structure during a notify
- */
-struct Notsave {
- int emptiness;
-};
-
/*
* MMU stuff in Mach.
*/
{
int machno; /* physical id of processor */
uintptr splpc; /* pc of last caller to splhi */
-
- Proc* proc; /* current process */
+ Proc* proc; /* current process on this processor */
MMMU;
- int flushmmu; /* flush current proc mmu state */
-
- ulong ticks; /* of the clock since boot time */
- Label sched; /* scheduler wakeup */
- Lock alarmlock; /* access to alarm list */
- void* alarm; /* alarms bound to this clock */
+ /* end of offsets known to asm */
- Proc* readied; /* for runproc */
- ulong schedticks; /* next forced context switch */
+ PMach;
int cputype;
ulong delayloop;
-
- /* stats */
- int tlbfault;
- int tlbpurge;
- int pfault;
- int cs;
- int syscall;
- int load;
- int intr;
- uvlong fastclock; /* last sampled value */
- uvlong inidle; /* time spent in idlehands() */
- ulong spuriousintr;
- int lastintr;
- int ilockdepth;
- Perf perf; /* performance counters */
-
-
int cpumhz;
uvlong cpuhz; /* speed of cpu */
- uvlong cyclefreq; /* Frequency of user readable cycle counter */
/* vfp2 or vfp3 fpu */
int havefp;
u32int smon[5]; /* probably not needed */
u32int ssys[5];
- int stack[1];
+ uintptr stack[1];
};
/*
typedef void KMap;
#define VA(k) ((uintptr)(k))
#define kmap(p) (KMap*)((p)->pa|kseg0)
-#define kunmap(k)
+extern void kunmap(KMap*);
struct
{
- Lock;
- int machs; /* bitmap of active CPUs */
+ char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */
}active;
extern register Proc* up; /* R9 */
extern uintptr kseg0;
extern Mach* machaddr[MAXMACH];
-extern ulong memsize;
extern int normalprint;
/*
Devport *ports; /* The ports themselves */
};
+struct Soc { /* SoC dependent configuration */
+ ulong dramsize;
+ ulong iosize;
+ uintptr busdram;
+ uintptr busio;
+ uintptr physio;
+ uintptr virtio;
+ uintptr armlocal;
+ u32int l1ptedramattrs;
+ u32int l2ptedramattrs;
+};
+extern Soc soc;
+
+/*
+ * GPIO
+ */
+enum {
+ Input = 0x0,
+ Output = 0x1,
+ Alt0 = 0x4,
+ Alt1 = 0x5,
+ Alt2 = 0x6,
+ Alt3 = 0x7,
+ Alt4 = 0x3,
+ Alt5 = 0x2,
+};