diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-13 19:04:54 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-13 19:04:54 -0400 |
commit | cc2fa3fa320d5f40a12713c104bbe5d3da4636e4 (patch) | |
tree | 342445a784c566116505ab8c9e7a24803a6e70c4 | |
parent | 10c480933d0ad2ea27630cbaa723a5d33dbece00 (diff) | |
parent | a0dee2ed0cdc666b5622f1fc74979355a6b36850 (diff) |
Merge branch 'topic/alex-vfio-prep' into next
* topic/alex-vfio-prep:
PCI: misc pci_reg additions
PCI: create common pcibios_err_to_errno
PCI: export pci_user functions for use by other drivers
PCI: add ACS validation utility
PCI: add PCI DMA source ID quirk
-rw-r--r-- | drivers/pci/access.c | 6 | ||||
-rw-r--r-- | drivers/pci/pci.c | 69 | ||||
-rw-r--r-- | drivers/pci/pci.h | 7 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 84 | ||||
-rw-r--r-- | drivers/xen/xen-pciback/conf_space.c | 6 | ||||
-rw-r--r-- | include/linux/pci.h | 52 | ||||
-rw-r--r-- | include/linux/pci_regs.h | 113 |
7 files changed, 312 insertions, 25 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 2a581642c237..ba91a7e17519 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -162,7 +162,8 @@ int pci_user_read_config_##size \ | |||
162 | if (ret > 0) \ | 162 | if (ret > 0) \ |
163 | ret = -EINVAL; \ | 163 | ret = -EINVAL; \ |
164 | return ret; \ | 164 | return ret; \ |
165 | } | 165 | } \ |
166 | EXPORT_SYMBOL_GPL(pci_user_read_config_##size); | ||
166 | 167 | ||
167 | /* Returns 0 on success, negative values indicate error. */ | 168 | /* Returns 0 on success, negative values indicate error. */ |
168 | #define PCI_USER_WRITE_CONFIG(size,type) \ | 169 | #define PCI_USER_WRITE_CONFIG(size,type) \ |
@@ -181,7 +182,8 @@ int pci_user_write_config_##size \ | |||
181 | if (ret > 0) \ | 182 | if (ret > 0) \ |
182 | ret = -EINVAL; \ | 183 | ret = -EINVAL; \ |
183 | return ret; \ | 184 | return ret; \ |
184 | } | 185 | } \ |
186 | EXPORT_SYMBOL_GPL(pci_user_write_config_##size); | ||
185 | 187 | ||
186 | PCI_USER_READ_CONFIG(byte, u8) | 188 | PCI_USER_READ_CONFIG(byte, u8) |
187 | PCI_USER_READ_CONFIG(word, u16) | 189 | PCI_USER_READ_CONFIG(word, u16) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a23b071798f6..b743a9afb4dd 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2293,6 +2293,75 @@ void pci_enable_acs(struct pci_dev *dev) | |||
2293 | } | 2293 | } |
2294 | 2294 | ||
2295 | /** | 2295 | /** |
2296 | * pci_acs_enabled - test ACS against required flags for a given device | ||
2297 | * @pdev: device to test | ||
2298 | * @acs_flags: required PCI ACS flags | ||
2299 | * | ||
2300 | * Return true if the device supports the provided flags. Automatically | ||
2301 | * filters out flags that are not implemented on multifunction devices. | ||
2302 | */ | ||
2303 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags) | ||
2304 | { | ||
2305 | int pos, ret; | ||
2306 | u16 ctrl; | ||
2307 | |||
2308 | ret = pci_dev_specific_acs_enabled(pdev, acs_flags); | ||
2309 | if (ret >= 0) | ||
2310 | return ret > 0; | ||
2311 | |||
2312 | if (!pci_is_pcie(pdev)) | ||
2313 | return false; | ||
2314 | |||
2315 | /* Filter out flags not applicable to multifunction */ | ||
2316 | if (pdev->multifunction) | ||
2317 | acs_flags &= (PCI_ACS_RR | PCI_ACS_CR | | ||
2318 | PCI_ACS_EC | PCI_ACS_DT); | ||
2319 | |||
2320 | if (pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM || | ||
2321 | pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT || | ||
2322 | pdev->multifunction) { | ||
2323 | pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ACS); | ||
2324 | if (!pos) | ||
2325 | return false; | ||
2326 | |||
2327 | pci_read_config_word(pdev, pos + PCI_ACS_CTRL, &ctrl); | ||
2328 | if ((ctrl & acs_flags) != acs_flags) | ||
2329 | return false; | ||
2330 | } | ||
2331 | |||
2332 | return true; | ||
2333 | } | ||
2334 | |||
2335 | /** | ||
2336 | * pci_acs_path_enable - test ACS flags from start to end in a hierarchy | ||
2337 | * @start: starting downstream device | ||
2338 | * @end: ending upstream device or NULL to search to the root bus | ||
2339 | * @acs_flags: required flags | ||
2340 | * | ||
2341 | * Walk up a device tree from start to end testing PCI ACS support. If | ||
2342 | * any step along the way does not support the required flags, return false. | ||
2343 | */ | ||
2344 | bool pci_acs_path_enabled(struct pci_dev *start, | ||
2345 | struct pci_dev *end, u16 acs_flags) | ||
2346 | { | ||
2347 | struct pci_dev *pdev, *parent = start; | ||
2348 | |||
2349 | do { | ||
2350 | pdev = parent; | ||
2351 | |||
2352 | if (!pci_acs_enabled(pdev, acs_flags)) | ||
2353 | return false; | ||
2354 | |||
2355 | if (pci_is_root_bus(pdev->bus)) | ||
2356 | return (end == NULL); | ||
2357 | |||
2358 | parent = pdev->bus->self; | ||
2359 | } while (pdev != end); | ||
2360 | |||
2361 | return true; | ||
2362 | } | ||
2363 | |||
2364 | /** | ||
2296 | * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge | 2365 | * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge |
2297 | * @dev: the PCI device | 2366 | * @dev: the PCI device |
2298 | * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTD, 4=INTD) | 2367 | * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTD, 4=INTD) |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 1c56ea8110b1..4884d77d33b6 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -86,13 +86,6 @@ static inline bool pci_is_bridge(struct pci_dev *pci_dev) | |||
86 | return !!(pci_dev->subordinate); | 86 | return !!(pci_dev->subordinate); |
87 | } | 87 | } |
88 | 88 | ||
89 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | ||
90 | extern int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | ||
91 | extern int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | ||
92 | extern int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | ||
93 | extern int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | ||
94 | extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | ||
95 | |||
96 | struct pci_vpd_ops { | 89 | struct pci_vpd_ops { |
97 | ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf); | 90 | ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf); |
98 | ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); | 91 | ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 2a7521677541..27e2c8f4ec73 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -3179,3 +3179,87 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe) | |||
3179 | 3179 | ||
3180 | return -ENOTTY; | 3180 | return -ENOTTY; |
3181 | } | 3181 | } |
3182 | |||
3183 | static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev) | ||
3184 | { | ||
3185 | if (!PCI_FUNC(dev->devfn)) | ||
3186 | return pci_dev_get(dev); | ||
3187 | |||
3188 | return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); | ||
3189 | } | ||
3190 | |||
3191 | static const struct pci_dev_dma_source { | ||
3192 | u16 vendor; | ||
3193 | u16 device; | ||
3194 | struct pci_dev *(*dma_source)(struct pci_dev *dev); | ||
3195 | } pci_dev_dma_source[] = { | ||
3196 | /* | ||
3197 | * https://bugzilla.redhat.com/show_bug.cgi?id=605888 | ||
3198 | * | ||
3199 | * Some Ricoh devices use the function 0 source ID for DMA on | ||
3200 | * other functions of a multifunction device. The DMA devices | ||
3201 | * is therefore function 0, which will have implications of the | ||
3202 | * iommu grouping of these devices. | ||
3203 | */ | ||
3204 | { PCI_VENDOR_ID_RICOH, 0xe822, pci_func_0_dma_source }, | ||
3205 | { PCI_VENDOR_ID_RICOH, 0xe230, pci_func_0_dma_source }, | ||
3206 | { PCI_VENDOR_ID_RICOH, 0xe832, pci_func_0_dma_source }, | ||
3207 | { PCI_VENDOR_ID_RICOH, 0xe476, pci_func_0_dma_source }, | ||
3208 | { 0 } | ||
3209 | }; | ||
3210 | |||
3211 | /* | ||
3212 | * IOMMUs with isolation capabilities need to be programmed with the | ||
3213 | * correct source ID of a device. In most cases, the source ID matches | ||
3214 | * the device doing the DMA, but sometimes hardware is broken and will | ||
3215 | * tag the DMA as being sourced from a different device. This function | ||
3216 | * allows that translation. Note that the reference count of the | ||
3217 | * returned device is incremented on all paths. | ||
3218 | */ | ||
3219 | struct pci_dev *pci_get_dma_source(struct pci_dev *dev) | ||
3220 | { | ||
3221 | const struct pci_dev_dma_source *i; | ||
3222 | |||
3223 | for (i = pci_dev_dma_source; i->dma_source; i++) { | ||
3224 | if ((i->vendor == dev->vendor || | ||
3225 | i->vendor == (u16)PCI_ANY_ID) && | ||
3226 | (i->device == dev->device || | ||
3227 | i->device == (u16)PCI_ANY_ID)) | ||
3228 | return i->dma_source(dev); | ||
3229 | } | ||
3230 | |||
3231 | return pci_dev_get(dev); | ||
3232 | } | ||
3233 | |||
3234 | static const struct pci_dev_acs_enabled { | ||
3235 | u16 vendor; | ||
3236 | u16 device; | ||
3237 | int (*acs_enabled)(struct pci_dev *dev, u16 acs_flags); | ||
3238 | } pci_dev_acs_enabled[] = { | ||
3239 | { 0 } | ||
3240 | }; | ||
3241 | |||
3242 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags) | ||
3243 | { | ||
3244 | const struct pci_dev_acs_enabled *i; | ||
3245 | int ret; | ||
3246 | |||
3247 | /* | ||
3248 | * Allow devices that do not expose standard PCIe ACS capabilities | ||
3249 | * or control to indicate their support here. Multi-function express | ||
3250 | * devices which do not allow internal peer-to-peer between functions, | ||
3251 | * but do not implement PCIe ACS may wish to return true here. | ||
3252 | */ | ||
3253 | for (i = pci_dev_acs_enabled; i->acs_enabled; i++) { | ||
3254 | if ((i->vendor == dev->vendor || | ||
3255 | i->vendor == (u16)PCI_ANY_ID) && | ||
3256 | (i->device == dev->device || | ||
3257 | i->device == (u16)PCI_ANY_ID)) { | ||
3258 | ret = i->acs_enabled(dev, acs_flags); | ||
3259 | if (ret >= 0) | ||
3260 | return ret; | ||
3261 | } | ||
3262 | } | ||
3263 | |||
3264 | return -ENOTTY; | ||
3265 | } | ||
diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c index 30d7be026c18..46ae0f9f02ad 100644 --- a/drivers/xen/xen-pciback/conf_space.c +++ b/drivers/xen/xen-pciback/conf_space.c | |||
@@ -124,7 +124,7 @@ static inline u32 merge_value(u32 val, u32 new_val, u32 new_val_mask, | |||
124 | return val; | 124 | return val; |
125 | } | 125 | } |
126 | 126 | ||
127 | static int pcibios_err_to_errno(int err) | 127 | static int xen_pcibios_err_to_errno(int err) |
128 | { | 128 | { |
129 | switch (err) { | 129 | switch (err) { |
130 | case PCIBIOS_SUCCESSFUL: | 130 | case PCIBIOS_SUCCESSFUL: |
@@ -202,7 +202,7 @@ out: | |||
202 | pci_name(dev), size, offset, value); | 202 | pci_name(dev), size, offset, value); |
203 | 203 | ||
204 | *ret_val = value; | 204 | *ret_val = value; |
205 | return pcibios_err_to_errno(err); | 205 | return xen_pcibios_err_to_errno(err); |
206 | } | 206 | } |
207 | 207 | ||
208 | int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) | 208 | int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) |
@@ -290,7 +290,7 @@ int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) | |||
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | return pcibios_err_to_errno(err); | 293 | return xen_pcibios_err_to_errno(err); |
294 | } | 294 | } |
295 | 295 | ||
296 | void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev) | 296 | void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 27da5ce46282..35884f279bb8 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -475,6 +475,32 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; | |||
475 | #define PCIBIOS_SET_FAILED 0x88 | 475 | #define PCIBIOS_SET_FAILED 0x88 |
476 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 | 476 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 |
477 | 477 | ||
478 | /* | ||
479 | * Translate above to generic errno for passing back through non-pci. | ||
480 | */ | ||
481 | static inline int pcibios_err_to_errno(int err) | ||
482 | { | ||
483 | if (err <= PCIBIOS_SUCCESSFUL) | ||
484 | return err; /* Assume already errno */ | ||
485 | |||
486 | switch (err) { | ||
487 | case PCIBIOS_FUNC_NOT_SUPPORTED: | ||
488 | return -ENOENT; | ||
489 | case PCIBIOS_BAD_VENDOR_ID: | ||
490 | return -EINVAL; | ||
491 | case PCIBIOS_DEVICE_NOT_FOUND: | ||
492 | return -ENODEV; | ||
493 | case PCIBIOS_BAD_REGISTER_NUMBER: | ||
494 | return -EFAULT; | ||
495 | case PCIBIOS_SET_FAILED: | ||
496 | return -EIO; | ||
497 | case PCIBIOS_BUFFER_TOO_SMALL: | ||
498 | return -ENOSPC; | ||
499 | } | ||
500 | |||
501 | return -ENOTTY; | ||
502 | } | ||
503 | |||
478 | /* Low-level architecture-dependent routines */ | 504 | /* Low-level architecture-dependent routines */ |
479 | 505 | ||
480 | struct pci_ops { | 506 | struct pci_ops { |
@@ -779,6 +805,14 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where, | |||
779 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | 805 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
780 | } | 806 | } |
781 | 807 | ||
808 | /* user-space driven config access */ | ||
809 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | ||
810 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | ||
811 | int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | ||
812 | int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | ||
813 | int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | ||
814 | int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | ||
815 | |||
782 | int __must_check pci_enable_device(struct pci_dev *dev); | 816 | int __must_check pci_enable_device(struct pci_dev *dev); |
783 | int __must_check pci_enable_device_io(struct pci_dev *dev); | 817 | int __must_check pci_enable_device_io(struct pci_dev *dev); |
784 | int __must_check pci_enable_device_mem(struct pci_dev *dev); | 818 | int __must_check pci_enable_device_mem(struct pci_dev *dev); |
@@ -1334,6 +1368,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
1334 | static inline int pci_domain_nr(struct pci_bus *bus) | 1368 | static inline int pci_domain_nr(struct pci_bus *bus) |
1335 | { return 0; } | 1369 | { return 0; } |
1336 | 1370 | ||
1371 | static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) | ||
1372 | { return NULL; } | ||
1373 | |||
1337 | #define dev_is_pci(d) (false) | 1374 | #define dev_is_pci(d) (false) |
1338 | #define dev_is_pf(d) (false) | 1375 | #define dev_is_pf(d) (false) |
1339 | #define dev_num_vf(d) (0) | 1376 | #define dev_num_vf(d) (0) |
@@ -1488,9 +1525,20 @@ enum pci_fixup_pass { | |||
1488 | 1525 | ||
1489 | #ifdef CONFIG_PCI_QUIRKS | 1526 | #ifdef CONFIG_PCI_QUIRKS |
1490 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1527 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
1528 | struct pci_dev *pci_get_dma_source(struct pci_dev *dev); | ||
1529 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); | ||
1491 | #else | 1530 | #else |
1492 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | 1531 | static inline void pci_fixup_device(enum pci_fixup_pass pass, |
1493 | struct pci_dev *dev) {} | 1532 | struct pci_dev *dev) {} |
1533 | static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev) | ||
1534 | { | ||
1535 | return pci_dev_get(dev); | ||
1536 | } | ||
1537 | static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, | ||
1538 | u16 acs_flags) | ||
1539 | { | ||
1540 | return -ENOTTY; | ||
1541 | } | ||
1494 | #endif | 1542 | #endif |
1495 | 1543 | ||
1496 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 1544 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |
@@ -1593,7 +1641,9 @@ static inline bool pci_is_pcie(struct pci_dev *dev) | |||
1593 | } | 1641 | } |
1594 | 1642 | ||
1595 | void pci_request_acs(void); | 1643 | void pci_request_acs(void); |
1596 | 1644 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); | |
1645 | bool pci_acs_path_enabled(struct pci_dev *start, | ||
1646 | struct pci_dev *end, u16 acs_flags); | ||
1597 | 1647 | ||
1598 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ | 1648 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ |
1599 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) | 1649 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 4b608f543412..526d2c4bc3a6 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -26,6 +26,7 @@ | |||
26 | * Under PCI, each device has 256 bytes of configuration address space, | 26 | * Under PCI, each device has 256 bytes of configuration address space, |
27 | * of which the first 64 bytes are standardized as follows: | 27 | * of which the first 64 bytes are standardized as follows: |
28 | */ | 28 | */ |
29 | #define PCI_STD_HEADER_SIZEOF 64 | ||
29 | #define PCI_VENDOR_ID 0x00 /* 16 bits */ | 30 | #define PCI_VENDOR_ID 0x00 /* 16 bits */ |
30 | #define PCI_DEVICE_ID 0x02 /* 16 bits */ | 31 | #define PCI_DEVICE_ID 0x02 /* 16 bits */ |
31 | #define PCI_COMMAND 0x04 /* 16 bits */ | 32 | #define PCI_COMMAND 0x04 /* 16 bits */ |
@@ -209,9 +210,12 @@ | |||
209 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ | 210 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ |
210 | #define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ | 211 | #define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ |
211 | #define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ | 212 | #define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ |
213 | #define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */ | ||
212 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ | 214 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ |
213 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ | 215 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ |
216 | #define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */ | ||
214 | #define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ | 217 | #define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ |
218 | #define PCI_CAP_ID_MAX PCI_CAP_ID_AF | ||
215 | #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ | 219 | #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ |
216 | #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ | 220 | #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ |
217 | #define PCI_CAP_SIZEOF 4 | 221 | #define PCI_CAP_SIZEOF 4 |
@@ -276,6 +280,7 @@ | |||
276 | #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ | 280 | #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ |
277 | #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ | 281 | #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ |
278 | #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ | 282 | #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ |
283 | #define PCI_CAP_VPD_SIZEOF 8 | ||
279 | 284 | ||
280 | /* Slot Identification */ | 285 | /* Slot Identification */ |
281 | 286 | ||
@@ -297,8 +302,10 @@ | |||
297 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ | 302 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ |
298 | #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ | 303 | #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ |
299 | #define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */ | 304 | #define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */ |
305 | #define PCI_MSI_PENDING_32 16 /* Pending intrs for 32-bit devices */ | ||
300 | #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ | 306 | #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ |
301 | #define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ | 307 | #define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ |
308 | #define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ | ||
302 | 309 | ||
303 | /* MSI-X registers */ | 310 | /* MSI-X registers */ |
304 | #define PCI_MSIX_FLAGS 2 | 311 | #define PCI_MSIX_FLAGS 2 |
@@ -308,6 +315,7 @@ | |||
308 | #define PCI_MSIX_TABLE 4 | 315 | #define PCI_MSIX_TABLE 4 |
309 | #define PCI_MSIX_PBA 8 | 316 | #define PCI_MSIX_PBA 8 |
310 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) | 317 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) |
318 | #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ | ||
311 | 319 | ||
312 | /* MSI-X entry's format */ | 320 | /* MSI-X entry's format */ |
313 | #define PCI_MSIX_ENTRY_SIZE 16 | 321 | #define PCI_MSIX_ENTRY_SIZE 16 |
@@ -338,6 +346,7 @@ | |||
338 | #define PCI_AF_CTRL_FLR 0x01 | 346 | #define PCI_AF_CTRL_FLR 0x01 |
339 | #define PCI_AF_STATUS 5 | 347 | #define PCI_AF_STATUS 5 |
340 | #define PCI_AF_STATUS_TP 0x01 | 348 | #define PCI_AF_STATUS_TP 0x01 |
349 | #define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */ | ||
341 | 350 | ||
342 | /* PCI-X registers */ | 351 | /* PCI-X registers */ |
343 | 352 | ||
@@ -374,6 +383,10 @@ | |||
374 | #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ | 383 | #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ |
375 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ | 384 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ |
376 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ | 385 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ |
386 | #define PCI_X_ECC_CSR 8 /* ECC control and status */ | ||
387 | #define PCI_CAP_PCIX_SIZEOF_V0 8 /* size of registers for Version 0 */ | ||
388 | #define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */ | ||
389 | #define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */ | ||
377 | 390 | ||
378 | /* PCI Bridge Subsystem ID registers */ | 391 | /* PCI Bridge Subsystem ID registers */ |
379 | 392 | ||
@@ -462,6 +475,7 @@ | |||
462 | #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ | 475 | #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ |
463 | #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ | 476 | #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ |
464 | #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ | 477 | #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ |
478 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V1 20 /* v1 endpoints end here */ | ||
465 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | 479 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ |
466 | #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ | 480 | #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ |
467 | #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ | 481 | #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ |
@@ -521,6 +535,7 @@ | |||
521 | #define PCI_EXP_OBFF_MSGA_EN 0x2000 /* OBFF enable with Message type A */ | 535 | #define PCI_EXP_OBFF_MSGA_EN 0x2000 /* OBFF enable with Message type A */ |
522 | #define PCI_EXP_OBFF_MSGB_EN 0x4000 /* OBFF enable with Message type B */ | 536 | #define PCI_EXP_OBFF_MSGB_EN 0x4000 /* OBFF enable with Message type B */ |
523 | #define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ | 537 | #define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ |
538 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints end here */ | ||
524 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ | 539 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ |
525 | #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ | 540 | #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ |
526 | 541 | ||
@@ -529,23 +544,43 @@ | |||
529 | #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) | 544 | #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) |
530 | #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) | 545 | #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) |
531 | 546 | ||
532 | #define PCI_EXT_CAP_ID_ERR 1 | 547 | #define PCI_EXT_CAP_ID_ERR 0x01 /* Advanced Error Reporting */ |
533 | #define PCI_EXT_CAP_ID_VC 2 | 548 | #define PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel Capability */ |
534 | #define PCI_EXT_CAP_ID_DSN 3 | 549 | #define PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */ |
535 | #define PCI_EXT_CAP_ID_PWR 4 | 550 | #define PCI_EXT_CAP_ID_PWR 0x04 /* Power Budgeting */ |
536 | #define PCI_EXT_CAP_ID_VNDR 11 | 551 | #define PCI_EXT_CAP_ID_RCLD 0x05 /* Root Complex Link Declaration */ |
537 | #define PCI_EXT_CAP_ID_ACS 13 | 552 | #define PCI_EXT_CAP_ID_RCILC 0x06 /* Root Complex Internal Link Control */ |
538 | #define PCI_EXT_CAP_ID_ARI 14 | 553 | #define PCI_EXT_CAP_ID_RCEC 0x07 /* Root Complex Event Collector */ |
539 | #define PCI_EXT_CAP_ID_ATS 15 | 554 | #define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */ |
540 | #define PCI_EXT_CAP_ID_SRIOV 16 | 555 | #define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */ |
541 | #define PCI_EXT_CAP_ID_PRI 19 | 556 | #define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */ |
542 | #define PCI_EXT_CAP_ID_LTR 24 | 557 | #define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor Specific */ |
543 | #define PCI_EXT_CAP_ID_PASID 27 | 558 | #define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */ |
559 | #define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */ | ||
560 | #define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */ | ||
561 | #define PCI_EXT_CAP_ID_ATS 0x0F /* Address Translation Services */ | ||
562 | #define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ | ||
563 | #define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */ | ||
564 | #define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */ | ||
565 | #define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */ | ||
566 | #define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* reserved for AMD */ | ||
567 | #define PCI_EXT_CAP_ID_REBAR 0x15 /* resizable BAR */ | ||
568 | #define PCI_EXT_CAP_ID_DPA 0x16 /* dynamic power alloc */ | ||
569 | #define PCI_EXT_CAP_ID_TPH 0x17 /* TPH request */ | ||
570 | #define PCI_EXT_CAP_ID_LTR 0x18 /* latency tolerance reporting */ | ||
571 | #define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe */ | ||
572 | #define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */ | ||
573 | #define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */ | ||
574 | #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PASID | ||
575 | |||
576 | #define PCI_EXT_CAP_DSN_SIZEOF 12 | ||
577 | #define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40 | ||
544 | 578 | ||
545 | /* Advanced Error Reporting */ | 579 | /* Advanced Error Reporting */ |
546 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ | 580 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ |
547 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ | 581 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ |
548 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ | 582 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ |
583 | #define PCI_ERR_UNC_SURPDN 0x00000020 /* Surprise Down */ | ||
549 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ | 584 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ |
550 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ | 585 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ |
551 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ | 586 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ |
@@ -555,6 +590,11 @@ | |||
555 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ | 590 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ |
556 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ | 591 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ |
557 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ | 592 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ |
593 | #define PCI_ERR_UNC_ACSV 0x00200000 /* ACS Violation */ | ||
594 | #define PCI_ERR_UNC_INTN 0x00400000 /* internal error */ | ||
595 | #define PCI_ERR_UNC_MCBTLP 0x00800000 /* MC blocked TLP */ | ||
596 | #define PCI_ERR_UNC_ATOMEG 0x01000000 /* Atomic egress blocked */ | ||
597 | #define PCI_ERR_UNC_TLPPRE 0x02000000 /* TLP prefix blocked */ | ||
558 | #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ | 598 | #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ |
559 | /* Same bits as above */ | 599 | /* Same bits as above */ |
560 | #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ | 600 | #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ |
@@ -565,6 +605,9 @@ | |||
565 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ | 605 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ |
566 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ | 606 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ |
567 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ | 607 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ |
608 | #define PCI_ERR_COR_ADV_NFAT 0x00002000 /* Advisory Non-Fatal */ | ||
609 | #define PCI_ERR_COR_INTERNAL 0x00004000 /* Corrected Internal */ | ||
610 | #define PCI_ERR_COR_LOG_OVER 0x00008000 /* Header Log Overflow */ | ||
568 | #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ | 611 | #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ |
569 | /* Same bits as above */ | 612 | /* Same bits as above */ |
570 | #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ | 613 | #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ |
@@ -596,12 +639,18 @@ | |||
596 | 639 | ||
597 | /* Virtual Channel */ | 640 | /* Virtual Channel */ |
598 | #define PCI_VC_PORT_REG1 4 | 641 | #define PCI_VC_PORT_REG1 4 |
642 | #define PCI_VC_REG1_EVCC 0x7 /* extended vc count */ | ||
599 | #define PCI_VC_PORT_REG2 8 | 643 | #define PCI_VC_PORT_REG2 8 |
644 | #define PCI_VC_REG2_32_PHASE 0x2 | ||
645 | #define PCI_VC_REG2_64_PHASE 0x4 | ||
646 | #define PCI_VC_REG2_128_PHASE 0x8 | ||
600 | #define PCI_VC_PORT_CTRL 12 | 647 | #define PCI_VC_PORT_CTRL 12 |
601 | #define PCI_VC_PORT_STATUS 14 | 648 | #define PCI_VC_PORT_STATUS 14 |
602 | #define PCI_VC_RES_CAP 16 | 649 | #define PCI_VC_RES_CAP 16 |
603 | #define PCI_VC_RES_CTRL 20 | 650 | #define PCI_VC_RES_CTRL 20 |
604 | #define PCI_VC_RES_STATUS 26 | 651 | #define PCI_VC_RES_STATUS 26 |
652 | #define PCI_CAP_VC_BASE_SIZEOF 0x10 | ||
653 | #define PCI_CAP_VC_PER_VC_SIZEOF 0x0C | ||
605 | 654 | ||
606 | /* Power Budgeting */ | 655 | /* Power Budgeting */ |
607 | #define PCI_PWR_DSR 4 /* Data Select Register */ | 656 | #define PCI_PWR_DSR 4 /* Data Select Register */ |
@@ -614,6 +663,7 @@ | |||
614 | #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ | 663 | #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ |
615 | #define PCI_PWR_CAP 12 /* Capability */ | 664 | #define PCI_PWR_CAP 12 /* Capability */ |
616 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ | 665 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ |
666 | #define PCI_EXT_CAP_PWR_SIZEOF 16 | ||
617 | 667 | ||
618 | /* | 668 | /* |
619 | * Hypertransport sub capability types | 669 | * Hypertransport sub capability types |
@@ -646,6 +696,8 @@ | |||
646 | #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ | 696 | #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ |
647 | #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ | 697 | #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ |
648 | #define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ | 698 | #define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ |
699 | #define HT_CAP_SIZEOF_LONG 28 /* slave & primary */ | ||
700 | #define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */ | ||
649 | 701 | ||
650 | /* Alternative Routing-ID Interpretation */ | 702 | /* Alternative Routing-ID Interpretation */ |
651 | #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ | 703 | #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ |
@@ -656,6 +708,7 @@ | |||
656 | #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ | 708 | #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ |
657 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ | 709 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ |
658 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ | 710 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ |
711 | #define PCI_EXT_CAP_ARI_SIZEOF 8 | ||
659 | 712 | ||
660 | /* Address Translation Service */ | 713 | /* Address Translation Service */ |
661 | #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ | 714 | #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ |
@@ -665,6 +718,7 @@ | |||
665 | #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ | 718 | #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ |
666 | #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ | 719 | #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ |
667 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ | 720 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ |
721 | #define PCI_EXT_CAP_ATS_SIZEOF 8 | ||
668 | 722 | ||
669 | /* Page Request Interface */ | 723 | /* Page Request Interface */ |
670 | #define PCI_PRI_CTRL 0x04 /* PRI control register */ | 724 | #define PCI_PRI_CTRL 0x04 /* PRI control register */ |
@@ -676,6 +730,7 @@ | |||
676 | #define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */ | 730 | #define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */ |
677 | #define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */ | 731 | #define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */ |
678 | #define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ | 732 | #define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ |
733 | #define PCI_EXT_CAP_PRI_SIZEOF 16 | ||
679 | 734 | ||
680 | /* PASID capability */ | 735 | /* PASID capability */ |
681 | #define PCI_PASID_CAP 0x04 /* PASID feature register */ | 736 | #define PCI_PASID_CAP 0x04 /* PASID feature register */ |
@@ -685,6 +740,7 @@ | |||
685 | #define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ | 740 | #define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ |
686 | #define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ | 741 | #define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ |
687 | #define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */ | 742 | #define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */ |
743 | #define PCI_EXT_CAP_PASID_SIZEOF 8 | ||
688 | 744 | ||
689 | /* Single Root I/O Virtualization */ | 745 | /* Single Root I/O Virtualization */ |
690 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ | 746 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ |
@@ -716,12 +772,14 @@ | |||
716 | #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ | 772 | #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ |
717 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ | 773 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ |
718 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ | 774 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ |
775 | #define PCI_EXT_CAP_SRIOV_SIZEOF 64 | ||
719 | 776 | ||
720 | #define PCI_LTR_MAX_SNOOP_LAT 0x4 | 777 | #define PCI_LTR_MAX_SNOOP_LAT 0x4 |
721 | #define PCI_LTR_MAX_NOSNOOP_LAT 0x6 | 778 | #define PCI_LTR_MAX_NOSNOOP_LAT 0x6 |
722 | #define PCI_LTR_VALUE_MASK 0x000003ff | 779 | #define PCI_LTR_VALUE_MASK 0x000003ff |
723 | #define PCI_LTR_SCALE_MASK 0x00001c00 | 780 | #define PCI_LTR_SCALE_MASK 0x00001c00 |
724 | #define PCI_LTR_SCALE_SHIFT 10 | 781 | #define PCI_LTR_SCALE_SHIFT 10 |
782 | #define PCI_EXT_CAP_LTR_SIZEOF 8 | ||
725 | 783 | ||
726 | /* Access Control Service */ | 784 | /* Access Control Service */ |
727 | #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ | 785 | #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ |
@@ -732,7 +790,38 @@ | |||
732 | #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ | 790 | #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ |
733 | #define PCI_ACS_EC 0x20 /* P2P Egress Control */ | 791 | #define PCI_ACS_EC 0x20 /* P2P Egress Control */ |
734 | #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ | 792 | #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ |
793 | #define PCI_ACS_EGRESS_BITS 0x05 /* ACS Egress Control Vector Size */ | ||
735 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ | 794 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ |
736 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ | 795 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ |
737 | 796 | ||
797 | #define PCI_VSEC_HDR 4 /* extended cap - vendor specific */ | ||
798 | #define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */ | ||
799 | |||
800 | /* sata capability */ | ||
801 | #define PCI_SATA_REGS 4 /* SATA REGs specifier */ | ||
802 | #define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */ | ||
803 | #define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */ | ||
804 | #define PCI_SATA_SIZEOF_SHORT 8 | ||
805 | #define PCI_SATA_SIZEOF_LONG 16 | ||
806 | |||
807 | /* resizable BARs */ | ||
808 | #define PCI_REBAR_CTRL 8 /* control register */ | ||
809 | #define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */ | ||
810 | #define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */ | ||
811 | |||
812 | /* dynamic power allocation */ | ||
813 | #define PCI_DPA_CAP 4 /* capability register */ | ||
814 | #define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */ | ||
815 | #define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */ | ||
816 | |||
817 | /* TPH Requester */ | ||
818 | #define PCI_TPH_CAP 4 /* capability register */ | ||
819 | #define PCI_TPH_CAP_LOC_MASK 0x600 /* location mask */ | ||
820 | #define PCI_TPH_LOC_NONE 0x000 /* no location */ | ||
821 | #define PCI_TPH_LOC_CAP 0x200 /* in capability */ | ||
822 | #define PCI_TPH_LOC_MSIX 0x400 /* in MSI-X */ | ||
823 | #define PCI_TPH_CAP_ST_MASK 0x07FF0000 /* st table mask */ | ||
824 | #define PCI_TPH_CAP_ST_SHIFT 16 /* st table shift */ | ||
825 | #define PCI_TPH_BASE_SIZEOF 12 /* size with no st table */ | ||
826 | |||
738 | #endif /* LINUX_PCI_REGS_H */ | 827 | #endif /* LINUX_PCI_REGS_H */ |