]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/bcm/dat.h
ether8169: support rtl8402 variant
[plan9front.git] / sys / src / 9 / bcm / dat.h
index cb860a6fae7a5daad34b6ff3db0e031ca548944f..dec4e58609e615b8583b8c317b1e87f1a5dd5361 100644 (file)
@@ -15,18 +15,19 @@ enum {
 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;
@@ -56,14 +57,14 @@ struct Label
        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;
@@ -78,9 +79,12 @@ struct FPsave
        uintptr pc;             /* of failed fp instr. */
 };
 
-/*
- * FPsave.fpstate
- */
+struct PFPU
+{
+       int     fpstate;
+       FPsave  fpsave[1];
+};
+
 enum
 {
        FPinit,
@@ -95,7 +99,7 @@ enum
 struct Confmem
 {
        uintptr base;
-       usize   npage;
+       ulong   npage;
        uintptr limit;
        uintptr kbase;
        uintptr klimit;
@@ -107,7 +111,7 @@ struct Conf
        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 */
@@ -119,13 +123,6 @@ struct Conf
        int     monitor;        /* flag */
 };
 
-/*
- *  things saved in the Proc structure during a notify
- */
-struct Notsave {
-       int     emptiness;
-};
-
 /*
  *  MMU stuff in Mach.
  */
@@ -153,42 +150,17 @@ struct 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;
@@ -209,7 +181,7 @@ struct Mach
        u32int  smon[5];                /* probably not needed */
        u32int  ssys[5];
 
-       int     stack[1];
+       uintptr stack[1];
 };
 
 /*
@@ -218,21 +190,18 @@ struct Mach
 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 */
-       int     ispanic;                /* shutdown in response to a panic */
 }active;
 
 extern register Mach* m;                       /* R10 */
 extern register Proc* up;                      /* R9 */
 extern uintptr kseg0;
 extern Mach* machaddr[MAXMACH];
-extern ulong memsize;
 extern int normalprint;
 
 /*
@@ -285,3 +254,29 @@ struct DevConf
        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,
+};