diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 213 |
1 files changed, 189 insertions, 24 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 65f8a8f9d3e5..cd5809a5963e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -187,6 +187,33 @@ enum pci_bus_flags { | |||
187 | PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, | 187 | PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, |
188 | }; | 188 | }; |
189 | 189 | ||
190 | /* Based on the PCI Hotplug Spec, but some values are made up by us */ | ||
191 | enum pci_bus_speed { | ||
192 | PCI_SPEED_33MHz = 0x00, | ||
193 | PCI_SPEED_66MHz = 0x01, | ||
194 | PCI_SPEED_66MHz_PCIX = 0x02, | ||
195 | PCI_SPEED_100MHz_PCIX = 0x03, | ||
196 | PCI_SPEED_133MHz_PCIX = 0x04, | ||
197 | PCI_SPEED_66MHz_PCIX_ECC = 0x05, | ||
198 | PCI_SPEED_100MHz_PCIX_ECC = 0x06, | ||
199 | PCI_SPEED_133MHz_PCIX_ECC = 0x07, | ||
200 | PCI_SPEED_66MHz_PCIX_266 = 0x09, | ||
201 | PCI_SPEED_100MHz_PCIX_266 = 0x0a, | ||
202 | PCI_SPEED_133MHz_PCIX_266 = 0x0b, | ||
203 | AGP_UNKNOWN = 0x0c, | ||
204 | AGP_1X = 0x0d, | ||
205 | AGP_2X = 0x0e, | ||
206 | AGP_4X = 0x0f, | ||
207 | AGP_8X = 0x10, | ||
208 | PCI_SPEED_66MHz_PCIX_533 = 0x11, | ||
209 | PCI_SPEED_100MHz_PCIX_533 = 0x12, | ||
210 | PCI_SPEED_133MHz_PCIX_533 = 0x13, | ||
211 | PCIE_SPEED_2_5GT = 0x14, | ||
212 | PCIE_SPEED_5_0GT = 0x15, | ||
213 | PCIE_SPEED_8_0GT = 0x16, | ||
214 | PCI_SPEED_UNKNOWN = 0xff, | ||
215 | }; | ||
216 | |||
190 | struct pci_cap_saved_state { | 217 | struct pci_cap_saved_state { |
191 | struct hlist_node next; | 218 | struct hlist_node next; |
192 | char cap_nr; | 219 | char cap_nr; |
@@ -239,6 +266,7 @@ struct pci_dev { | |||
239 | configuration space */ | 266 | configuration space */ |
240 | unsigned int pme_support:5; /* Bitmask of states from which PME# | 267 | unsigned int pme_support:5; /* Bitmask of states from which PME# |
241 | can be generated */ | 268 | can be generated */ |
269 | unsigned int pme_interrupt:1; | ||
242 | unsigned int d1_support:1; /* Low power state D1 is supported */ | 270 | unsigned int d1_support:1; /* Low power state D1 is supported */ |
243 | unsigned int d2_support:1; /* Low power state D2 is supported */ | 271 | unsigned int d2_support:1; /* Low power state D2 is supported */ |
244 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ | 272 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ |
@@ -275,7 +303,8 @@ struct pci_dev { | |||
275 | unsigned int msix_enabled:1; | 303 | unsigned int msix_enabled:1; |
276 | unsigned int ari_enabled:1; /* ARI forwarding */ | 304 | unsigned int ari_enabled:1; /* ARI forwarding */ |
277 | unsigned int is_managed:1; | 305 | unsigned int is_managed:1; |
278 | unsigned int is_pcie:1; | 306 | unsigned int is_pcie:1; /* Obsolete. Will be removed. |
307 | Use pci_is_pcie() instead */ | ||
279 | unsigned int needs_freset:1; /* Dev requires fundamental reset */ | 308 | unsigned int needs_freset:1; /* Dev requires fundamental reset */ |
280 | unsigned int state_saved:1; | 309 | unsigned int state_saved:1; |
281 | unsigned int is_physfn:1; | 310 | unsigned int is_physfn:1; |
@@ -335,9 +364,26 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev, | |||
335 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); | 364 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); |
336 | } | 365 | } |
337 | 366 | ||
338 | #ifndef PCI_BUS_NUM_RESOURCES | 367 | /* |
339 | #define PCI_BUS_NUM_RESOURCES 16 | 368 | * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond |
340 | #endif | 369 | * to P2P or CardBus bridge windows) go in a table. Additional ones (for |
370 | * buses below host bridges or subtractive decode bridges) go in the list. | ||
371 | * Use pci_bus_for_each_resource() to iterate through all the resources. | ||
372 | */ | ||
373 | |||
374 | /* | ||
375 | * PCI_SUBTRACTIVE_DECODE means the bridge forwards the window implicitly | ||
376 | * and there's no way to program the bridge with the details of the window. | ||
377 | * This does not apply to ACPI _CRS windows, even with the _DEC subtractive- | ||
378 | * decode bit set, because they are explicit and can be programmed with _SRS. | ||
379 | */ | ||
380 | #define PCI_SUBTRACTIVE_DECODE 0x1 | ||
381 | |||
382 | struct pci_bus_resource { | ||
383 | struct list_head list; | ||
384 | struct resource *res; | ||
385 | unsigned int flags; | ||
386 | }; | ||
341 | 387 | ||
342 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ | 388 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ |
343 | 389 | ||
@@ -348,8 +394,8 @@ struct pci_bus { | |||
348 | struct list_head devices; /* list of devices on this bus */ | 394 | struct list_head devices; /* list of devices on this bus */ |
349 | struct pci_dev *self; /* bridge device as seen by parent */ | 395 | struct pci_dev *self; /* bridge device as seen by parent */ |
350 | struct list_head slots; /* list of slots on this bus */ | 396 | struct list_head slots; /* list of slots on this bus */ |
351 | struct resource *resource[PCI_BUS_NUM_RESOURCES]; | 397 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; |
352 | /* address space routed to this bus */ | 398 | struct list_head resources; /* address space routed to this bus */ |
353 | 399 | ||
354 | struct pci_ops *ops; /* configuration access functions */ | 400 | struct pci_ops *ops; /* configuration access functions */ |
355 | void *sysdata; /* hook for sys-specific extension */ | 401 | void *sysdata; /* hook for sys-specific extension */ |
@@ -359,6 +405,8 @@ struct pci_bus { | |||
359 | unsigned char primary; /* number of primary bridge */ | 405 | unsigned char primary; /* number of primary bridge */ |
360 | unsigned char secondary; /* number of secondary bridge */ | 406 | unsigned char secondary; /* number of secondary bridge */ |
361 | unsigned char subordinate; /* max number of subordinate buses */ | 407 | unsigned char subordinate; /* max number of subordinate buses */ |
408 | unsigned char max_bus_speed; /* enum pci_bus_speed */ | ||
409 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ | ||
362 | 410 | ||
363 | char name[48]; | 411 | char name[48]; |
364 | 412 | ||
@@ -563,7 +611,8 @@ int __must_check pcibios_enable_device(struct pci_dev *, int mask); | |||
563 | char *pcibios_setup(char *str); | 611 | char *pcibios_setup(char *str); |
564 | 612 | ||
565 | /* Used only when drivers/pci/setup.c is used */ | 613 | /* Used only when drivers/pci/setup.c is used */ |
566 | void pcibios_align_resource(void *, struct resource *, resource_size_t, | 614 | resource_size_t pcibios_align_resource(void *, const struct resource *, |
615 | resource_size_t, | ||
567 | resource_size_t); | 616 | resource_size_t); |
568 | void pcibios_update_irq(struct pci_dev *, int irq); | 617 | void pcibios_update_irq(struct pci_dev *, int irq); |
569 | 618 | ||
@@ -589,6 +638,7 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus, | |||
589 | struct pci_ops *ops, void *sysdata); | 638 | struct pci_ops *ops, void *sysdata); |
590 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 639 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
591 | int busnr); | 640 | int busnr); |
641 | void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); | ||
592 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | 642 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, |
593 | const char *name, | 643 | const char *name, |
594 | struct hotplug_slot *hotplug); | 644 | struct hotplug_slot *hotplug); |
@@ -612,15 +662,12 @@ extern void pci_remove_bus_device(struct pci_dev *dev); | |||
612 | extern void pci_stop_bus_device(struct pci_dev *dev); | 662 | extern void pci_stop_bus_device(struct pci_dev *dev); |
613 | void pci_setup_cardbus(struct pci_bus *bus); | 663 | void pci_setup_cardbus(struct pci_bus *bus); |
614 | extern void pci_sort_breadthfirst(void); | 664 | extern void pci_sort_breadthfirst(void); |
665 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) | ||
666 | #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) | ||
667 | #define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) | ||
615 | 668 | ||
616 | /* Generic PCI functions exported to card drivers */ | 669 | /* Generic PCI functions exported to card drivers */ |
617 | 670 | ||
618 | #ifdef CONFIG_PCI_LEGACY | ||
619 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, | ||
620 | unsigned int device, | ||
621 | struct pci_dev *from); | ||
622 | #endif /* CONFIG_PCI_LEGACY */ | ||
623 | |||
624 | enum pci_lost_interrupt_reason { | 671 | enum pci_lost_interrupt_reason { |
625 | PCI_LOST_IRQ_NO_INFORMATION = 0, | 672 | PCI_LOST_IRQ_NO_INFORMATION = 0, |
626 | PCI_LOST_IRQ_DISABLE_MSI, | 673 | PCI_LOST_IRQ_DISABLE_MSI, |
@@ -752,11 +799,19 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | |||
752 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 799 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
753 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | 800 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); |
754 | void pci_pme_active(struct pci_dev *dev, bool enable); | 801 | void pci_pme_active(struct pci_dev *dev, bool enable); |
755 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable); | 802 | int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
803 | bool runtime, bool enable); | ||
756 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); | 804 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); |
757 | pci_power_t pci_target_state(struct pci_dev *dev); | 805 | pci_power_t pci_target_state(struct pci_dev *dev); |
758 | int pci_prepare_to_sleep(struct pci_dev *dev); | 806 | int pci_prepare_to_sleep(struct pci_dev *dev); |
759 | int pci_back_from_sleep(struct pci_dev *dev); | 807 | int pci_back_from_sleep(struct pci_dev *dev); |
808 | bool pci_dev_run_wake(struct pci_dev *dev); | ||
809 | |||
810 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | ||
811 | bool enable) | ||
812 | { | ||
813 | return __pci_enable_wake(dev, state, false, enable); | ||
814 | } | ||
760 | 815 | ||
761 | /* For use by arch with custom probe code */ | 816 | /* For use by arch with custom probe code */ |
762 | void set_pcie_port_type(struct pci_dev *pdev); | 817 | void set_pcie_port_type(struct pci_dev *pdev); |
@@ -778,6 +833,7 @@ void pci_bus_assign_resources(const struct pci_bus *bus); | |||
778 | void pci_bus_size_bridges(struct pci_bus *bus); | 833 | void pci_bus_size_bridges(struct pci_bus *bus); |
779 | int pci_claim_resource(struct pci_dev *, int); | 834 | int pci_claim_resource(struct pci_dev *, int); |
780 | void pci_assign_unassigned_resources(void); | 835 | void pci_assign_unassigned_resources(void); |
836 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); | ||
781 | void pdev_enable_device(struct pci_dev *); | 837 | void pdev_enable_device(struct pci_dev *); |
782 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); | 838 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); |
783 | int pci_enable_resources(struct pci_dev *, int mask); | 839 | int pci_enable_resources(struct pci_dev *, int mask); |
@@ -795,12 +851,23 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *); | |||
795 | void pci_release_selected_regions(struct pci_dev *, int); | 851 | void pci_release_selected_regions(struct pci_dev *, int); |
796 | 852 | ||
797 | /* drivers/pci/bus.c */ | 853 | /* drivers/pci/bus.c */ |
854 | void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); | ||
855 | struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); | ||
856 | void pci_bus_remove_resources(struct pci_bus *bus); | ||
857 | |||
858 | #define pci_bus_for_each_resource(bus, res, i) \ | ||
859 | for (i = 0; \ | ||
860 | (res = pci_bus_resource_n(bus, i)) || i < PCI_BRIDGE_RESOURCE_NUM; \ | ||
861 | i++) | ||
862 | |||
798 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, | 863 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, |
799 | struct resource *res, resource_size_t size, | 864 | struct resource *res, resource_size_t size, |
800 | resource_size_t align, resource_size_t min, | 865 | resource_size_t align, resource_size_t min, |
801 | unsigned int type_mask, | 866 | unsigned int type_mask, |
802 | void (*alignf)(void *, struct resource *, | 867 | resource_size_t (*alignf)(void *, |
803 | resource_size_t, resource_size_t), | 868 | const struct resource *, |
869 | resource_size_t, | ||
870 | resource_size_t), | ||
804 | void *alignf_data); | 871 | void *alignf_data); |
805 | void pci_enable_bridges(struct pci_bus *bus); | 872 | void pci_enable_bridges(struct pci_bus *bus); |
806 | 873 | ||
@@ -961,6 +1028,11 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
961 | } | 1028 | } |
962 | #endif /* CONFIG_PCI_DOMAINS */ | 1029 | #endif /* CONFIG_PCI_DOMAINS */ |
963 | 1030 | ||
1031 | /* some architectures require additional setup to direct VGA traffic */ | ||
1032 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, | ||
1033 | unsigned int command_bits, bool change_bridge); | ||
1034 | extern void pci_register_set_vga_state(arch_set_vga_state_t func); | ||
1035 | |||
964 | #else /* CONFIG_PCI is not enabled */ | 1036 | #else /* CONFIG_PCI is not enabled */ |
965 | 1037 | ||
966 | /* | 1038 | /* |
@@ -979,13 +1051,6 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
979 | _PCI_NOP_ALL(read, *) | 1051 | _PCI_NOP_ALL(read, *) |
980 | _PCI_NOP_ALL(write,) | 1052 | _PCI_NOP_ALL(write,) |
981 | 1053 | ||
982 | static inline struct pci_dev *pci_find_device(unsigned int vendor, | ||
983 | unsigned int device, | ||
984 | struct pci_dev *from) | ||
985 | { | ||
986 | return NULL; | ||
987 | } | ||
988 | |||
989 | static inline struct pci_dev *pci_get_device(unsigned int vendor, | 1054 | static inline struct pci_dev *pci_get_device(unsigned int vendor, |
990 | unsigned int device, | 1055 | unsigned int device, |
991 | struct pci_dev *from) | 1056 | struct pci_dev *from) |
@@ -1135,6 +1200,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
1135 | unsigned int devfn) | 1200 | unsigned int devfn) |
1136 | { return NULL; } | 1201 | { return NULL; } |
1137 | 1202 | ||
1203 | #define dev_is_pci(d) (false) | ||
1204 | #define dev_is_pf(d) (false) | ||
1205 | #define dev_num_vf(d) (0) | ||
1138 | #endif /* CONFIG_PCI */ | 1206 | #endif /* CONFIG_PCI */ |
1139 | 1207 | ||
1140 | /* Include architecture-dependent settings and functions */ | 1208 | /* Include architecture-dependent settings and functions */ |
@@ -1243,8 +1311,12 @@ enum pci_fixup_pass { | |||
1243 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1311 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
1244 | suspend##vendor##device##hook, vendor, device, hook) | 1312 | suspend##vendor##device##hook, vendor, device, hook) |
1245 | 1313 | ||
1246 | 1314 | #ifdef CONFIG_PCI_QUIRKS | |
1247 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1315 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
1316 | #else | ||
1317 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | ||
1318 | struct pci_dev *dev) {} | ||
1319 | #endif | ||
1248 | 1320 | ||
1249 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 1321 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |
1250 | void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); | 1322 | void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); |
@@ -1292,6 +1364,7 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); | |||
1292 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | 1364 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); |
1293 | extern void pci_disable_sriov(struct pci_dev *dev); | 1365 | extern void pci_disable_sriov(struct pci_dev *dev); |
1294 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); | 1366 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); |
1367 | extern int pci_num_vf(struct pci_dev *dev); | ||
1295 | #else | 1368 | #else |
1296 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 1369 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
1297 | { | 1370 | { |
@@ -1304,6 +1377,10 @@ static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev) | |||
1304 | { | 1377 | { |
1305 | return IRQ_NONE; | 1378 | return IRQ_NONE; |
1306 | } | 1379 | } |
1380 | static inline int pci_num_vf(struct pci_dev *dev) | ||
1381 | { | ||
1382 | return 0; | ||
1383 | } | ||
1307 | #endif | 1384 | #endif |
1308 | 1385 | ||
1309 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) | 1386 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) |
@@ -1340,5 +1417,93 @@ static inline bool pci_is_pcie(struct pci_dev *dev) | |||
1340 | 1417 | ||
1341 | void pci_request_acs(void); | 1418 | void pci_request_acs(void); |
1342 | 1419 | ||
1420 | |||
1421 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ | ||
1422 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) | ||
1423 | |||
1424 | /* Large Resource Data Type Tag Item Names */ | ||
1425 | #define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */ | ||
1426 | #define PCI_VPD_LTIN_RO_DATA 0x10 /* Read-Only Data */ | ||
1427 | #define PCI_VPD_LTIN_RW_DATA 0x11 /* Read-Write Data */ | ||
1428 | |||
1429 | #define PCI_VPD_LRDT_ID_STRING PCI_VPD_LRDT_ID(PCI_VPD_LTIN_ID_STRING) | ||
1430 | #define PCI_VPD_LRDT_RO_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA) | ||
1431 | #define PCI_VPD_LRDT_RW_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA) | ||
1432 | |||
1433 | /* Small Resource Data Type Tag Item Names */ | ||
1434 | #define PCI_VPD_STIN_END 0x78 /* End */ | ||
1435 | |||
1436 | #define PCI_VPD_SRDT_END PCI_VPD_STIN_END | ||
1437 | |||
1438 | #define PCI_VPD_SRDT_TIN_MASK 0x78 | ||
1439 | #define PCI_VPD_SRDT_LEN_MASK 0x07 | ||
1440 | |||
1441 | #define PCI_VPD_LRDT_TAG_SIZE 3 | ||
1442 | #define PCI_VPD_SRDT_TAG_SIZE 1 | ||
1443 | |||
1444 | #define PCI_VPD_INFO_FLD_HDR_SIZE 3 | ||
1445 | |||
1446 | #define PCI_VPD_RO_KEYWORD_PARTNO "PN" | ||
1447 | #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" | ||
1448 | #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" | ||
1449 | |||
1450 | /** | ||
1451 | * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length | ||
1452 | * @lrdt: Pointer to the beginning of the Large Resource Data Type tag | ||
1453 | * | ||
1454 | * Returns the extracted Large Resource Data Type length. | ||
1455 | */ | ||
1456 | static inline u16 pci_vpd_lrdt_size(const u8 *lrdt) | ||
1457 | { | ||
1458 | return (u16)lrdt[1] + ((u16)lrdt[2] << 8); | ||
1459 | } | ||
1460 | |||
1461 | /** | ||
1462 | * pci_vpd_srdt_size - Extracts the Small Resource Data Type length | ||
1463 | * @lrdt: Pointer to the beginning of the Small Resource Data Type tag | ||
1464 | * | ||
1465 | * Returns the extracted Small Resource Data Type length. | ||
1466 | */ | ||
1467 | static inline u8 pci_vpd_srdt_size(const u8 *srdt) | ||
1468 | { | ||
1469 | return (*srdt) & PCI_VPD_SRDT_LEN_MASK; | ||
1470 | } | ||
1471 | |||
1472 | /** | ||
1473 | * pci_vpd_info_field_size - Extracts the information field length | ||
1474 | * @lrdt: Pointer to the beginning of an information field header | ||
1475 | * | ||
1476 | * Returns the extracted information field length. | ||
1477 | */ | ||
1478 | static inline u8 pci_vpd_info_field_size(const u8 *info_field) | ||
1479 | { | ||
1480 | return info_field[2]; | ||
1481 | } | ||
1482 | |||
1483 | /** | ||
1484 | * pci_vpd_find_tag - Locates the Resource Data Type tag provided | ||
1485 | * @buf: Pointer to buffered vpd data | ||
1486 | * @off: The offset into the buffer at which to begin the search | ||
1487 | * @len: The length of the vpd buffer | ||
1488 | * @rdt: The Resource Data Type to search for | ||
1489 | * | ||
1490 | * Returns the index where the Resource Data Type was found or | ||
1491 | * -ENOENT otherwise. | ||
1492 | */ | ||
1493 | int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt); | ||
1494 | |||
1495 | /** | ||
1496 | * pci_vpd_find_info_keyword - Locates an information field keyword in the VPD | ||
1497 | * @buf: Pointer to buffered vpd data | ||
1498 | * @off: The offset into the buffer at which to begin the search | ||
1499 | * @len: The length of the buffer area, relative to off, in which to search | ||
1500 | * @kw: The keyword to search for | ||
1501 | * | ||
1502 | * Returns the index where the information field keyword was found or | ||
1503 | * -ENOENT otherwise. | ||
1504 | */ | ||
1505 | int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, | ||
1506 | unsigned int len, const char *kw); | ||
1507 | |||
1343 | #endif /* __KERNEL__ */ | 1508 | #endif /* __KERNEL__ */ |
1344 | #endif /* LINUX_PCI_H */ | 1509 | #endif /* LINUX_PCI_H */ |