]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'pci/vc' into next
authorBjorn Helgaas <bhelgaas@google.com>
Wed, 18 Dec 2013 21:04:35 +0000 (14:04 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 18 Dec 2013 21:04:35 +0000 (14:04 -0700)
* pci/vc:
  PCI: Rename PCI_VC_PORT_REG1/2 to PCI_VC_PORT_CAP1/2
  PCI: Add Virtual Channel to save/restore support
  PCI: Add support for save/restore of extended capabilities
  PCI: Add pci_wait_for_pending() (refactor pci_wait_for_pending_transaction())

1  2 
include/linux/pci.h
include/uapi/linux/pci_regs.h

diff --combined include/linux/pci.h
index eb8078aeadc89b4b460dfe0c0f998c56bfe2f442,ef34ad76532c2df9bb6e921f136ba16abf536f25..f16fb1f01317953f54a35fabc2fd8f47cfd051f3
@@@ -224,7 -224,8 +224,8 @@@ enum pci_bus_speed 
  };
  
  struct pci_cap_saved_data {
-       char cap_nr;
+       u16 cap_nr;
+       bool cap_extended;
        unsigned int size;
        u32 data[0];
  };
@@@ -938,6 -939,7 +939,7 @@@ bool pci_check_and_unmask_intx(struct p
  void pci_msi_off(struct pci_dev *dev);
  int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
  int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
+ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask);
  int pci_wait_for_pending_transaction(struct pci_dev *dev);
  int pcix_get_max_mmrbc(struct pci_dev *dev);
  int pcix_get_mmrbc(struct pci_dev *dev);
@@@ -976,6 -978,12 +978,12 @@@ struct pci_saved_state *pci_store_saved
  int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state);
  int pci_load_and_free_saved_state(struct pci_dev *dev,
                                  struct pci_saved_state **state);
+ struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap);
+ struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev,
+                                                  u16 cap);
+ int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size);
+ int pci_add_ext_cap_save_buffer(struct pci_dev *dev,
+                               u16 cap, unsigned int size);
  int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
  int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
  pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
@@@ -997,6 -1005,11 +1005,11 @@@ static inline int pci_enable_wake(struc
        return __pci_enable_wake(dev, state, false, enable);
  }
  
+ /* PCI Virtual Channel */
+ int pci_save_vc_state(struct pci_dev *dev);
+ void pci_restore_vc_state(struct pci_dev *dev);
+ void pci_allocate_vc_save_buffers(struct pci_dev *dev);
  #define PCI_EXP_IDO_REQUEST   (1<<0)
  #define PCI_EXP_IDO_COMPLETION        (1<<1)
  void pci_enable_ido(struct pci_dev *dev, unsigned long type);
@@@ -1567,65 -1580,65 +1580,65 @@@ enum pci_fixup_pass 
  /* Anonymous variables would be nice... */
  #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class,       \
                                  class_shift, hook)                    \
 -      static const struct pci_fixup __pci_fixup_##name __used         \
 +      static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used       \
        __attribute__((__section__(#section), aligned((sizeof(void *)))))    \
                = { vendor, device, class, class_shift, hook };
  
  #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class,          \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early,                     \
 -              vendor##device##hook, vendor, device, class, class_shift, hook)
 +              hook, vendor, device, class, class_shift, hook)
  #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class,         \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header,                    \
 -              vendor##device##hook, vendor, device, class, class_shift, hook)
 +              hook, vendor, device, class, class_shift, hook)
  #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class,          \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final,                     \
 -              vendor##device##hook, vendor, device, class, class_shift, hook)
 +              hook, vendor, device, class, class_shift, hook)
  #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class,         \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable,                    \
 -              vendor##device##hook, vendor, device, class, class_shift, hook)
 +              hook, vendor, device, class, class_shift, hook)
  #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class,         \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume,                    \
 -              resume##vendor##device##hook, vendor, device, class,    \
 +              resume##hook, vendor, device, class,    \
                class_shift, hook)
  #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class,   \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early,              \
 -              resume_early##vendor##device##hook, vendor, device,     \
 +              resume_early##hook, vendor, device,     \
                class, class_shift, hook)
  #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class,                \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend,                   \
 -              suspend##vendor##device##hook, vendor, device, class,   \
 +              suspend##hook, vendor, device, class,   \
                class_shift, hook)
  
  #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook)                 \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early,                     \
 -              vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
 +              hook, vendor, device, PCI_ANY_ID, 0, hook)
  #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook)                        \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header,                    \
 -              vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
 +              hook, vendor, device, PCI_ANY_ID, 0, hook)
  #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook)                 \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final,                     \
 -              vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
 +              hook, vendor, device, PCI_ANY_ID, 0, hook)
  #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook)                        \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable,                    \
 -              vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
 +              hook, vendor, device, PCI_ANY_ID, 0, hook)
  #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook)                        \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume,                    \
 -              resume##vendor##device##hook, vendor, device,           \
 +              resume##hook, vendor, device,           \
                PCI_ANY_ID, 0, hook)
  #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook)          \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early,              \
 -              resume_early##vendor##device##hook, vendor, device,     \
 +              resume_early##hook, vendor, device,     \
                PCI_ANY_ID, 0, hook)
  #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook)                       \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend,                   \
 -              suspend##vendor##device##hook, vendor, device,          \
 +              suspend##hook, vendor, device,          \
                PCI_ANY_ID, 0, hook)
  
  #ifdef CONFIG_PCI_QUIRKS
index 6d03ba42ab230cd360e4ec38220397bdd5119197,d0160cc83fcf5f83b7d3af430494d3248758f6e2..ab6b4e7f66574a1edd7ca3f46ca8488bea43ae0f
  #define  PCI_EXP_SLTCTL_CCIE  0x0010  /* Command Completed Interrupt Enable */
  #define  PCI_EXP_SLTCTL_HPIE  0x0020  /* Hot-Plug Interrupt Enable */
  #define  PCI_EXP_SLTCTL_AIC   0x00c0  /* Attention Indicator Control */
 +#define  PCI_EXP_SLTCTL_ATTN_IND_ON    0x0040 /* Attention Indicator on */
 +#define  PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */
 +#define  PCI_EXP_SLTCTL_ATTN_IND_OFF   0x00c0 /* Attention Indicator off */
  #define  PCI_EXP_SLTCTL_PIC   0x0300  /* Power Indicator Control */
 +#define  PCI_EXP_SLTCTL_PWR_IND_ON     0x0100 /* Power Indicator on */
 +#define  PCI_EXP_SLTCTL_PWR_IND_BLINK  0x0200 /* Power Indicator blinking */
 +#define  PCI_EXP_SLTCTL_PWR_IND_OFF    0x0300 /* Power Indicator off */
  #define  PCI_EXP_SLTCTL_PCC   0x0400  /* Power Controller Control */
 +#define  PCI_EXP_SLTCTL_PWR_ON         0x0000 /* Power On */
 +#define  PCI_EXP_SLTCTL_PWR_OFF        0x0400 /* Power Off */
  #define  PCI_EXP_SLTCTL_EIC   0x0800  /* Electromechanical Interlock Control */
  #define  PCI_EXP_SLTCTL_DLLSCE        0x1000  /* Data Link Layer State Changed Enable */
  #define PCI_EXP_SLTSTA                26      /* Slot Status */
  #define PCI_ERR_ROOT_ERR_SRC  52      /* Error Source Identification */
  
  /* Virtual Channel */
- #define PCI_VC_PORT_REG1      4
- #define  PCI_VC_REG1_EVCC     0x7     /* extended VC count */
- #define PCI_VC_PORT_REG2      8
- #define  PCI_VC_REG2_32_PHASE 0x2
- #define  PCI_VC_REG2_64_PHASE 0x4
- #define  PCI_VC_REG2_128_PHASE        0x8
+ #define PCI_VC_PORT_CAP1      4
+ #define  PCI_VC_CAP1_EVCC     0x00000007      /* extended VC count */
+ #define  PCI_VC_CAP1_LPEVCC   0x00000070      /* low prio extended VC count */
+ #define  PCI_VC_CAP1_ARB_SIZE 0x00000c00
+ #define PCI_VC_PORT_CAP2      8
+ #define  PCI_VC_CAP2_32_PHASE         0x00000002
+ #define  PCI_VC_CAP2_64_PHASE         0x00000004
+ #define  PCI_VC_CAP2_128_PHASE                0x00000008
+ #define  PCI_VC_CAP2_ARB_OFF          0xff000000
  #define PCI_VC_PORT_CTRL      12
+ #define  PCI_VC_PORT_CTRL_LOAD_TABLE  0x00000001
  #define PCI_VC_PORT_STATUS    14
+ #define  PCI_VC_PORT_STATUS_TABLE     0x00000001
  #define PCI_VC_RES_CAP                16
+ #define  PCI_VC_RES_CAP_32_PHASE      0x00000002
+ #define  PCI_VC_RES_CAP_64_PHASE      0x00000004
+ #define  PCI_VC_RES_CAP_128_PHASE     0x00000008
+ #define  PCI_VC_RES_CAP_128_PHASE_TB  0x00000010
+ #define  PCI_VC_RES_CAP_256_PHASE     0x00000020
+ #define  PCI_VC_RES_CAP_ARB_OFF               0xff000000
  #define PCI_VC_RES_CTRL               20
+ #define  PCI_VC_RES_CTRL_LOAD_TABLE   0x00010000
+ #define  PCI_VC_RES_CTRL_ARB_SELECT   0x000e0000
+ #define  PCI_VC_RES_CTRL_ID           0x07000000
+ #define  PCI_VC_RES_CTRL_ENABLE               0x80000000
  #define PCI_VC_RES_STATUS     26
+ #define  PCI_VC_RES_STATUS_TABLE      0x00000001
+ #define  PCI_VC_RES_STATUS_NEGO               0x00000002
  #define PCI_CAP_VC_BASE_SIZEOF                0x10
  #define PCI_CAP_VC_PER_VC_SIZEOF      0x0C