changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/9/bcm64/dat.h

revision 7199: ba62683c0e2d
child 7235: b1dc95374307
     1.1new file mode 100644
     1.2--- /dev/null
     1.3+++ b/sys/src/9/bcm64/dat.h
     1.4@@ -0,0 +1,272 @@
     1.5+/*
     1.6+ * Time.
     1.7+ *
     1.8+ * HZ should divide 1000 evenly, ideally.
     1.9+ * 100, 125, 200, 250 and 333 are okay.
    1.10+ */
    1.11+#define	HZ		100			/* clock frequency */
    1.12+#define	MS2HZ		(1000/HZ)		/* millisec per clock tick */
    1.13+#define	TK2SEC(t)	((t)/HZ)		/* ticks to seconds */
    1.14+
    1.15+enum {
    1.16+	Mhz	= 1000 * 1000,
    1.17+};
    1.18+
    1.19+typedef struct Conf	Conf;
    1.20+typedef struct Confmem	Confmem;
    1.21+typedef struct FPsave	FPsave;
    1.22+typedef struct PFPU	PFPU;
    1.23+typedef struct ISAConf	ISAConf;
    1.24+typedef struct Label	Label;
    1.25+typedef struct Lock	Lock;
    1.26+typedef struct Memcache	Memcache;
    1.27+typedef struct MMMU	MMMU;
    1.28+typedef struct Mach	Mach;
    1.29+typedef struct Page	Page;
    1.30+typedef struct PhysUart	PhysUart;
    1.31+typedef struct PMMU	PMMU;
    1.32+typedef struct Proc	Proc;
    1.33+typedef u64int		PTE;
    1.34+typedef struct Soc	Soc;
    1.35+typedef struct Uart	Uart;
    1.36+typedef struct Ureg	Ureg;
    1.37+typedef uvlong		Tval;
    1.38+typedef void		KMap;
    1.39+
    1.40+#pragma incomplete Ureg
    1.41+
    1.42+#define MAXSYSARG	5	/* for mount(fd, mpt, flag, arg, srv) */
    1.43+
    1.44+/*
    1.45+ *  parameters for sysproc.c
    1.46+ */
    1.47+#define AOUT_MAGIC	(R_MAGIC)
    1.48+
    1.49+struct Lock
    1.50+{
    1.51+	ulong	key;
    1.52+	u32int	sr;
    1.53+	uintptr	pc;
    1.54+	Proc*	p;
    1.55+	Mach*	m;
    1.56+	int	isilock;
    1.57+};
    1.58+
    1.59+struct Label
    1.60+{
    1.61+	uintptr	sp;
    1.62+	uintptr	pc;
    1.63+};
    1.64+
    1.65+struct FPsave
    1.66+{
    1.67+	uvlong	regs[32][2];
    1.68+
    1.69+	ulong	control;
    1.70+	ulong	status;
    1.71+};
    1.72+
    1.73+struct PFPU
    1.74+{
    1.75+	FPsave	fpsave[1];
    1.76+
    1.77+	int	fpstate;
    1.78+};
    1.79+
    1.80+enum
    1.81+{
    1.82+	FPinit,
    1.83+	FPactive,
    1.84+	FPinactive,
    1.85+
    1.86+	/* bits or'd with the state */
    1.87+	FPillegal= 0x100,
    1.88+};
    1.89+
    1.90+struct Confmem
    1.91+{
    1.92+	uintptr	base;
    1.93+	usize	npage;
    1.94+	uintptr	limit;
    1.95+	uintptr	kbase;
    1.96+	uintptr	klimit;
    1.97+};
    1.98+
    1.99+struct Conf
   1.100+{
   1.101+	ulong	nmach;		/* processors */
   1.102+	ulong	nproc;		/* processes */
   1.103+	Confmem	mem[1];		/* physical memory */
   1.104+	ulong	npage;		/* total physical pages of memory */
   1.105+	usize	upages;		/* user page pool */
   1.106+	ulong	copymode;	/* 0 is copy on write, 1 is copy on reference */
   1.107+	ulong	ialloc;		/* max interrupt time allocation in bytes */
   1.108+	ulong	pipeqsize;	/* size in bytes of pipe queues */
   1.109+	ulong	nimage;		/* number of page cache image headers */
   1.110+	ulong	nswap;		/* number of swap pages */
   1.111+	int	nswppo;		/* max # of pageouts per segment pass */
   1.112+	ulong	hz;		/* processor cycle freq */
   1.113+	ulong	mhz;
   1.114+	int	monitor;	/* flag */
   1.115+};
   1.116+
   1.117+/*
   1.118+ *  MMU stuff in Mach.
   1.119+ */
   1.120+struct MMMU
   1.121+{
   1.122+	PTE*	mmul1;		/* l1 for this processor */
   1.123+};
   1.124+
   1.125+/*
   1.126+ *  MMU stuff in proc
   1.127+ */
   1.128+#define NCOLOR	1		/* 1 level cache, don't worry about VCE's */
   1.129+
   1.130+struct PMMU
   1.131+{
   1.132+	Page*	mmul1;
   1.133+	Page*	mmul1tail;
   1.134+
   1.135+	Page*	mmul2;
   1.136+	Page*	mmul2tail;
   1.137+
   1.138+	Page*	mmufree;
   1.139+
   1.140+	int	asid;
   1.141+
   1.142+	uintptr	tpidr;
   1.143+};
   1.144+
   1.145+#include "../port/portdat.h"
   1.146+
   1.147+struct Mach
   1.148+{
   1.149+	int	machno;			/* physical id of processor */
   1.150+	uintptr	splpc;			/* pc of last caller to splhi */
   1.151+
   1.152+	Proc*	proc;			/* current process */
   1.153+
   1.154+	MMMU;
   1.155+	int	flushmmu;		/* flush current proc mmu state */
   1.156+
   1.157+	ulong	ticks;			/* of the clock since boot time */
   1.158+	Label	sched;			/* scheduler wakeup */
   1.159+	Lock	alarmlock;		/* access to alarm list */
   1.160+	void*	alarm;			/* alarms bound to this clock */
   1.161+
   1.162+	Proc*	readied;		/* for runproc */
   1.163+	ulong	schedticks;		/* next forced context switch */
   1.164+
   1.165+	int	cputype;
   1.166+	ulong	delayloop;
   1.167+
   1.168+	/* stats */
   1.169+	int	tlbfault;
   1.170+	int	tlbpurge;
   1.171+	int	pfault;
   1.172+	int	cs;
   1.173+	int	syscall;
   1.174+	int	load;
   1.175+	int	intr;
   1.176+	uvlong	fastclock;		/* last sampled value */
   1.177+	uvlong	inidle;			/* time spent in idlehands() */
   1.178+	ulong	spuriousintr;
   1.179+	int	lastintr;
   1.180+	int	ilockdepth;
   1.181+	Perf	perf;			/* performance counters */
   1.182+
   1.183+	int	cpumhz;
   1.184+	uvlong	cpuhz;			/* speed of cpu */
   1.185+	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */
   1.186+
   1.187+	int	stack[1];
   1.188+};
   1.189+
   1.190+struct
   1.191+{
   1.192+	char	machs[MAXMACH];		/* active CPUs */
   1.193+	int	exiting;		/* shutdown */
   1.194+}active;
   1.195+
   1.196+#define MACHP(n)	((Mach*)MACHADDR(n))
   1.197+
   1.198+extern register Mach* m;			/* R27 */
   1.199+extern register Proc* up;			/* R26 */
   1.200+extern int normalprint;
   1.201+extern ulong memsize;
   1.202+
   1.203+/*
   1.204+ *  a parsed plan9.ini line
   1.205+ */
   1.206+#define NISAOPT		8
   1.207+
   1.208+struct ISAConf {
   1.209+	char	*type;
   1.210+	ulong	port;
   1.211+	int	irq;
   1.212+	ulong	dma;
   1.213+	ulong	mem;
   1.214+	ulong	size;
   1.215+	ulong	freq;
   1.216+
   1.217+	int	nopt;
   1.218+	char	*opt[NISAOPT];
   1.219+};
   1.220+
   1.221+/*
   1.222+ * Horrid. But the alternative is 'defined'.
   1.223+ */
   1.224+#ifdef _DBGC_
   1.225+#define DBGFLG		(dbgflg[_DBGC_])
   1.226+#else
   1.227+#define DBGFLG		(0)
   1.228+#endif /* _DBGC_ */
   1.229+
   1.230+int vflag;
   1.231+extern char dbgflg[256];
   1.232+
   1.233+#define dbgprint	print		/* for now */
   1.234+
   1.235+/*
   1.236+ *  hardware info about a device
   1.237+ */
   1.238+typedef struct {
   1.239+	ulong	port;
   1.240+	int	size;
   1.241+} Devport;
   1.242+
   1.243+struct DevConf
   1.244+{
   1.245+	ulong	intnum;			/* interrupt number */
   1.246+	char	*type;			/* card type, malloced */
   1.247+	int	nports;			/* Number of ports */
   1.248+	Devport	*ports;			/* The ports themselves */
   1.249+};
   1.250+
   1.251+struct Soc {			/* SoC dependent configuration */
   1.252+	ulong	dramsize;
   1.253+	uintptr	physio;
   1.254+	uintptr	busdram;
   1.255+	uintptr	busio;
   1.256+	uintptr	armlocal;
   1.257+	u32int	l1ptedramattrs;
   1.258+	u32int	l2ptedramattrs;
   1.259+};
   1.260+extern Soc soc;
   1.261+
   1.262+#define BUSUNKNOWN -1
   1.263+
   1.264+/*
   1.265+ * GPIO
   1.266+ */
   1.267+enum {
   1.268+	Input	= 0x0,
   1.269+	Output	= 0x1,
   1.270+	Alt0	= 0x4,
   1.271+	Alt1	= 0x5,
   1.272+	Alt2	= 0x6,
   1.273+	Alt3	= 0x7,
   1.274+	Alt4	= 0x3,
   1.275+	Alt5	= 0x2,
   1.276+};