platform_pci.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 */