]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/xen/archxen.c
ether8169: support rtl8402 variant
[plan9front.git] / sys / src / 9 / xen / archxen.c
1 #include "u.h"
2 #include "../port/lib.h"
3 #include "mem.h"
4 #include "dat.h"
5 #include "fns.h"
6 #include "io.h"
7
8 static int
9 identify(void)
10 {
11         m->havepge = 0;
12         return 0;
13 }
14
15 static void
16 intrinit(void)
17 {
18         ulong machs;
19         int i, ncpu;
20         char *cp;
21         char node[32];
22         char buf[32];
23
24         if((cp = getconf("*nomp")) != nil && strtol(cp, 0, 0) != 0)
25                 return;
26         ncpu = MAX_VIRT_CPUS;
27         if (cp = getconf("*ncpu")) {
28                 ncpu = strtol(cp, 0, 0);
29                 if (ncpu < 1)
30                         ncpu = 1;
31         }
32         machs = 1;
33         for (i = 1; i < ncpu; i++) {
34                 sprint(node, "cpu/%d/availability", i);
35                 if (xenstore_read(node, buf, sizeof buf) <= 0)
36                         break;
37                 print("%s: %s\n", node, buf);
38                 if (strcmp(buf, "online") == 0) {
39                         machs |= 1<<i;
40                         conf.nmach++;
41                 }
42         }
43         if (conf.nmach > 1) {
44                 print("Sorry, SMP not supported yet: 1 of %lud CPUs startd\n", conf.nmach);
45                 conf.nmach = 1;
46         }
47 }
48
49 static void
50 shutdown(void)
51 {
52         HYPERVISOR_shutdown(1);
53 }
54
55 extern int      xenintrassign(Vctl *v);
56 extern void     xentimerinit(void);
57 extern void     xentimerenable(void);
58 extern uvlong   xentimerread(uvlong*);
59 extern void     xentimerset(uvlong);
60
61 PCArch archxen = {
62 .id=            "Xen",  
63 .ident=         identify,
64 .reset=         shutdown,
65 .intrinit=      intrinit,
66 .intrassign=    xenintrassign,
67 .clockinit=     xentimerinit,
68 .clockenable=   xentimerenable,
69 .fastclock=     xentimerread,
70 .timerset=      xentimerset,
71 };
72
73 /*
74  * Placeholders to satisfy external references in devarch.c
75  */
76 ulong   getcr4(void)    { return 0; }
77 void    putcr4(ulong)   {}
78 int     inb(int)        { return 0; }
79 ushort  ins(int)        { return 0; }
80 ulong   inl(int)        { return 0; }
81 void    outb(int, int)  {}
82 void    outs(int, ushort)       {}
83 void    outl(int, ulong)        {}
84
85 int     mtrrprint(char*, long) { return 0; }
86 char*   mtrr(uvlong, uvlong, char *) { return nil; }
87 void    mtrrsync(void) {}