Commit | Line | Data |
---|---|---|
d7e28ffe RR |
1 | #ifndef _ASM_LGUEST_USER |
2 | #define _ASM_LGUEST_USER | |
3 | /* Everything the "lguest" userspace program needs to know. */ | |
b45d8cb0 | 4 | #include <linux/types.h> |
d7e28ffe RR |
5 | /* They can register up to 32 arrays of lguest_dma. */ |
6 | #define LGUEST_MAX_DMA 32 | |
7 | /* At most we can dma 16 lguest_dma in one op. */ | |
8 | #define LGUEST_MAX_DMA_SECTIONS 16 | |
9 | ||
10 | /* How many devices? Assume each one wants up to two dma arrays per device. */ | |
11 | #define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2) | |
12 | ||
d7e28ffe RR |
13 | /* Where the Host expects the Guest to SEND_DMA console output to. */ |
14 | #define LGUEST_CONSOLE_DMA_KEY 0 | |
15 | ||
e2c97843 RR |
16 | /*D:010 |
17 | * Drivers | |
18 | * | |
19 | * The Guest needs devices to do anything useful. Since we don't let it touch | |
20 | * real devices (think of the damage it could do!) we provide virtual devices. | |
21 | * We could emulate a PCI bus with various devices on it, but that is a fairly | |
22 | * complex burden for the Host and suboptimal for the Guest, so we have our own | |
23 | * "lguest" bus and simple drivers. | |
24 | * | |
25 | * Devices are described by an array of LGUEST_MAX_DEVICES of these structs, | |
26 | * placed by the Launcher just above the top of physical memory: | |
27 | */ | |
d7e28ffe | 28 | struct lguest_device_desc { |
e2c97843 | 29 | /* The device type: console, network, disk etc. */ |
b45d8cb0 | 30 | __u16 type; |
d7e28ffe RR |
31 | #define LGUEST_DEVICE_T_CONSOLE 1 |
32 | #define LGUEST_DEVICE_T_NET 2 | |
33 | #define LGUEST_DEVICE_T_BLOCK 3 | |
34 | ||
e2c97843 RR |
35 | /* The specific features of this device: these depends on device type |
36 | * except for LGUEST_DEVICE_F_RANDOMNESS. */ | |
b45d8cb0 | 37 | __u16 features; |
d7e28ffe RR |
38 | #define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */ |
39 | #define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */ | |
40 | ||
e2c97843 RR |
41 | /* This is how the Guest reports status of the device: the Host can set |
42 | * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only | |
43 | * ever manipulated by the Guest, and only ever set. */ | |
b45d8cb0 | 44 | __u16 status; |
d7e28ffe RR |
45 | /* 256 and above are device specific. */ |
46 | #define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */ | |
47 | #define LGUEST_DEVICE_S_DRIVER 2 /* We have found a driver */ | |
48 | #define LGUEST_DEVICE_S_DRIVER_OK 4 /* Driver says OK! */ | |
49 | #define LGUEST_DEVICE_S_REMOVED 8 /* Device has gone away. */ | |
50 | #define LGUEST_DEVICE_S_REMOVED_ACK 16 /* Driver has been told. */ | |
51 | #define LGUEST_DEVICE_S_FAILED 128 /* Something actually failed */ | |
52 | ||
e2c97843 RR |
53 | /* Each device exists somewhere in Guest physical memory, over some |
54 | * number of pages. */ | |
b45d8cb0 RR |
55 | __u16 num_pages; |
56 | __u32 pfn; | |
d7e28ffe | 57 | }; |
e2c97843 | 58 | /*:*/ |
d7e28ffe RR |
59 | |
60 | /* Write command first word is a request. */ | |
61 | enum lguest_req | |
62 | { | |
63 | LHREQ_INITIALIZE, /* + pfnlimit, pgdir, start, pageoffset */ | |
15045275 | 64 | LHREQ_GETDMA, /* No longer used */ |
d7e28ffe RR |
65 | LHREQ_IRQ, /* + irq */ |
66 | LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ | |
67 | }; | |
68 | #endif /* _ASM_LGUEST_USER */ |