Several device drivers read their Device Serial Number from the PCIe extended config space. Introduce a new helper function, pci_get_dsn(). This function reads the eight bytes of the DSN and returns them as a u64. If the capability does not exist for the device, the function returns 0.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -1052,6 +1052,8 @@ int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); · 1051 unmodified lines | ||
| 1052 | 1052 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); |
| 1053 | 1053 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
| 1054 | 1054 | |
| 1055 | +u64 pci_get_dsn(struct pci_dev *dev); | |
| 1056 | + | |
| 1055 | 1057 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, |
| 1056 | 1058 | struct pci_dev *from); |
| 1057 | 1059 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
| @@ -1707,6 +1709,9 @@ static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, · 649 unmodified lines | ||
| 1707 | 1709 | static inline int pci_find_ext_capability(struct pci_dev *dev, int cap) |
| 1708 | 1710 | { return 0; } |
| 1709 | 1711 | |
| 1712 | +static inline u64 pci_get_dsn(struct pci_dev *dev) | |
| 1713 | +{ return 0; } | |
| 1714 | + | |
| 1710 | 1715 | /* Power management related routines */ |
| 1711 | 1716 | static inline int pci_save_state(struct pci_dev *dev) { return 0; } |
| 1712 | 1717 | static inline void pci_restore_state(struct pci_dev *dev) { } |