0001
0002 #ifndef _XEN_PLATFORM_PCI_H
0003 #define _XEN_PLATFORM_PCI_H
0004
0005 #define XEN_IOPORT_MAGIC_VAL 0x49d2
0006 #define XEN_IOPORT_LINUX_PRODNUM 0x0003
0007 #define XEN_IOPORT_LINUX_DRVVER 0x0001
0008
0009 #define XEN_IOPORT_BASE 0x10
0010
0011 #define XEN_IOPORT_PLATFLAGS (XEN_IOPORT_BASE + 0)
0012 #define XEN_IOPORT_MAGIC (XEN_IOPORT_BASE + 0)
0013 #define XEN_IOPORT_UNPLUG (XEN_IOPORT_BASE + 0)
0014 #define XEN_IOPORT_DRVVER (XEN_IOPORT_BASE + 0)
0015
0016 #define XEN_IOPORT_SYSLOG (XEN_IOPORT_BASE + 2)
0017 #define XEN_IOPORT_PROTOVER (XEN_IOPORT_BASE + 2)
0018 #define XEN_IOPORT_PRODNUM (XEN_IOPORT_BASE + 2)
0019
0020 #define XEN_UNPLUG_ALL_IDE_DISKS (1<<0)
0021 #define XEN_UNPLUG_ALL_NICS (1<<1)
0022 #define XEN_UNPLUG_AUX_IDE_DISKS (1<<2)
0023 #define XEN_UNPLUG_ALL (XEN_UNPLUG_ALL_IDE_DISKS|\
0024 XEN_UNPLUG_ALL_NICS|\
0025 XEN_UNPLUG_AUX_IDE_DISKS)
0026
0027 #define XEN_UNPLUG_UNNECESSARY (1<<16)
0028 #define XEN_UNPLUG_NEVER (1<<17)
0029
0030 static inline int xen_must_unplug_nics(void) {
0031 #if (defined(CONFIG_XEN_NETDEV_FRONTEND) || \
0032 defined(CONFIG_XEN_NETDEV_FRONTEND_MODULE)) && \
0033 defined(CONFIG_XEN_PVHVM)
0034 return 1;
0035 #else
0036 return 0;
0037 #endif
0038 }
0039
0040 static inline int xen_must_unplug_disks(void) {
0041 #if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \
0042 defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \
0043 defined(CONFIG_XEN_PVHVM)
0044 return 1;
0045 #else
0046 return 0;
0047 #endif
0048 }
0049
0050 #if defined(CONFIG_XEN_PVHVM)
0051 extern bool xen_has_pv_devices(void);
0052 extern bool xen_has_pv_disk_devices(void);
0053 extern bool xen_has_pv_nic_devices(void);
0054 extern bool xen_has_pv_and_legacy_disk_devices(void);
0055 #else
0056 static inline bool xen_has_pv_devices(void)
0057 {
0058 return IS_ENABLED(CONFIG_XEN);
0059 }
0060 static inline bool xen_has_pv_disk_devices(void)
0061 {
0062 return IS_ENABLED(CONFIG_XEN);
0063 }
0064 static inline bool xen_has_pv_nic_devices(void)
0065 {
0066 return IS_ENABLED(CONFIG_XEN);
0067 }
0068 static inline bool xen_has_pv_and_legacy_disk_devices(void)
0069 {
0070 return false;
0071 }
0072 #endif
0073 #endif