lguest_bus.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _ASM_LGUEST_DEVICE_H
  2. #define _ASM_LGUEST_DEVICE_H
  3. /* Everything you need to know about lguest devices. */
  4. #include <linux/device.h>
  5. #include <linux/lguest.h>
  6. #include <linux/lguest_launcher.h>
  7. struct lguest_device {
  8. /* Unique busid, and index into lguest_page->devices[] */
  9. unsigned int index;
  10. struct device dev;
  11. /* Driver can hang data off here. */
  12. void *private;
  13. };
  14. /*D:380 Since interrupt numbers are arbitrary, we use a convention: each device
  15. * can use the interrupt number corresponding to its index. The +1 is because
  16. * interrupt 0 is not usable (it's actually the timer interrupt). */
  17. static inline int lgdev_irq(const struct lguest_device *dev)
  18. {
  19. return dev->index + 1;
  20. }
  21. /*:*/
  22. /* dma args must not be vmalloced! */
  23. void lguest_send_dma(unsigned long key, struct lguest_dma *dma);
  24. int lguest_bind_dma(unsigned long key, struct lguest_dma *dmas,
  25. unsigned int num, u8 irq);
  26. void lguest_unbind_dma(unsigned long key, struct lguest_dma *dmas);
  27. /* Map the virtual device space */
  28. void *lguest_map(unsigned long phys_addr, unsigned long pages);
  29. void lguest_unmap(void *);
  30. struct lguest_driver {
  31. const char *name;
  32. struct module *owner;
  33. u16 device_type;
  34. int (*probe)(struct lguest_device *dev);
  35. void (*remove)(struct lguest_device *dev);
  36. struct device_driver drv;
  37. };
  38. extern int register_lguest_driver(struct lguest_driver *drv);
  39. extern void unregister_lguest_driver(struct lguest_driver *drv);
  40. extern struct lguest_device_desc *lguest_devices; /* Just past max_pfn */
  41. #endif /* _ASM_LGUEST_DEVICE_H */