lguest_launcher.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef _ASM_LGUEST_USER
  2. #define _ASM_LGUEST_USER
  3. /* Everything the "lguest" userspace program needs to know. */
  4. /* They can register up to 32 arrays of lguest_dma. */
  5. #define LGUEST_MAX_DMA 32
  6. /* At most we can dma 16 lguest_dma in one op. */
  7. #define LGUEST_MAX_DMA_SECTIONS 16
  8. /* How many devices? Assume each one wants up to two dma arrays per device. */
  9. #define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2)
  10. struct lguest_dma
  11. {
  12. /* 0 if free to be used, filled by hypervisor. */
  13. u32 used_len;
  14. unsigned long addr[LGUEST_MAX_DMA_SECTIONS];
  15. u16 len[LGUEST_MAX_DMA_SECTIONS];
  16. };
  17. struct lguest_block_page
  18. {
  19. /* 0 is a read, 1 is a write. */
  20. int type;
  21. u32 sector; /* Offset in device = sector * 512. */
  22. u32 bytes; /* Length expected to be read/written in bytes */
  23. /* 0 = pending, 1 = done, 2 = done, error */
  24. int result;
  25. u32 num_sectors; /* Disk length = num_sectors * 512 */
  26. };
  27. /* There is a shared page of these. */
  28. struct lguest_net
  29. {
  30. /* Simply the mac address (with multicast bit meaning promisc). */
  31. unsigned char mac[6];
  32. };
  33. /* Where the Host expects the Guest to SEND_DMA console output to. */
  34. #define LGUEST_CONSOLE_DMA_KEY 0
  35. /* We have a page of these descriptors in the lguest_device page. */
  36. struct lguest_device_desc {
  37. u16 type;
  38. #define LGUEST_DEVICE_T_CONSOLE 1
  39. #define LGUEST_DEVICE_T_NET 2
  40. #define LGUEST_DEVICE_T_BLOCK 3
  41. u16 features;
  42. #define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */
  43. #define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */
  44. u16 status;
  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. u16 num_pages;
  53. u32 pfn;
  54. };
  55. /* Write command first word is a request. */
  56. enum lguest_req
  57. {
  58. LHREQ_INITIALIZE, /* + pfnlimit, pgdir, start, pageoffset */
  59. LHREQ_GETDMA, /* + addr (returns &lguest_dma, irq in ->used_len) */
  60. LHREQ_IRQ, /* + irq */
  61. LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */
  62. };
  63. #endif /* _ASM_LGUEST_USER */