platform_pci.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_PVHVM)
  26. return 1;
  27. #else
  28. return 0;
  29. #endif
  30. }
  31. static inline int xen_must_unplug_disks(void) {
  32. #if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \
  33. defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \
  34. defined(CONFIG_XEN_PVHVM)
  35. return 1;
  36. #else
  37. return 0;
  38. #endif
  39. }
  40. #if defined(CONFIG_XEN_PVHVM)
  41. extern bool xen_has_pv_devices(void);
  42. extern bool xen_has_pv_disk_devices(void);
  43. extern bool xen_has_pv_nic_devices(void);
  44. extern bool xen_has_pv_and_legacy_disk_devices(void);
  45. #else
  46. static inline bool xen_has_pv_devices(void)
  47. {
  48. return IS_ENABLED(CONFIG_XEN);
  49. }
  50. static inline bool xen_has_pv_disk_devices(void)
  51. {
  52. return IS_ENABLED(CONFIG_XEN);
  53. }
  54. static inline bool xen_has_pv_nic_devices(void)
  55. {
  56. return IS_ENABLED(CONFIG_XEN);
  57. }
  58. static inline bool xen_has_pv_and_legacy_disk_devices(void)
  59. {
  60. return false;
  61. }
  62. #endif
  63. #endif /* _XEN_PLATFORM_PCI_H */