platform_pci.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _XEN_PLATFORM_PCI_H
  2. #define _XEN_PLATFORM_PCI_H
  3. #define XEN_IOPORT_MAGIC_VAL 0x49d2
  4. #define XEN_IOPORT_LINUX_PRODNUM 0x0003
  5. #define XEN_IOPORT_LINUX_DRVVER 0x0001
  6. #define XEN_IOPORT_BASE 0x10
  7. #define XEN_IOPORT_PLATFLAGS (XEN_IOPORT_BASE + 0) /* 1 byte access (R/W) */
  8. #define XEN_IOPORT_MAGIC (XEN_IOPORT_BASE + 0) /* 2 byte access (R) */
  9. #define XEN_IOPORT_UNPLUG (XEN_IOPORT_BASE + 0) /* 2 byte access (W) */
  10. #define XEN_IOPORT_DRVVER (XEN_IOPORT_BASE + 0) /* 4 byte access (W) */
  11. #define XEN_IOPORT_SYSLOG (XEN_IOPORT_BASE + 2) /* 1 byte access (W) */
  12. #define XEN_IOPORT_PROTOVER (XEN_IOPORT_BASE + 2) /* 1 byte access (R) */
  13. #define XEN_IOPORT_PRODNUM (XEN_IOPORT_BASE + 2) /* 2 byte access (W) */
  14. #define XEN_UNPLUG_ALL_IDE_DISKS (1<<0)
  15. #define XEN_UNPLUG_ALL_NICS (1<<1)
  16. #define XEN_UNPLUG_AUX_IDE_DISKS (1<<2)
  17. #define XEN_UNPLUG_ALL (XEN_UNPLUG_ALL_IDE_DISKS|\
  18. XEN_UNPLUG_ALL_NICS|\
  19. XEN_UNPLUG_AUX_IDE_DISKS)
  20. #define XEN_UNPLUG_UNNECESSARY (1<<16)
  21. #define XEN_UNPLUG_NEVER (1<<17)
  22. static inline int xen_must_unplug_nics(void) {
  23. #if (defined(CONFIG_XEN_NETDEV_FRONTEND) || \
  24. defined(CONFIG_XEN_NETDEV_FRONTEND_MODULE)) && \
  25. (defined(CONFIG_XEN_PLATFORM_PCI) || \
  26. defined(CONFIG_XEN_PLATFORM_PCI_MODULE))
  27. return 1;
  28. #else
  29. return 0;
  30. #endif
  31. }
  32. static inline int xen_must_unplug_disks(void) {
  33. #if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \
  34. defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \
  35. (defined(CONFIG_XEN_PLATFORM_PCI) || \
  36. defined(CONFIG_XEN_PLATFORM_PCI_MODULE))
  37. return 1;
  38. #else
  39. return 0;
  40. #endif
  41. }
  42. extern int xen_platform_pci_unplug;
  43. #endif /* _XEN_PLATFORM_PCI_H */