diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/npu2.h | 2 | ||||
-rw-r--r-- | include/pci.h | 8 | ||||
-rw-r--r-- | include/skiboot.h | 3 |
3 files changed, 8 insertions, 5 deletions
diff --git a/include/npu2.h b/include/npu2.h index 92b5898..372d1be 100644 --- a/include/npu2.h +++ b/include/npu2.h @@ -18,7 +18,7 @@ #define NPU2DEVLOG(l, p, fmt, a...) prlog(l, "NPU%d:%d:%d.%d " fmt, \ (p)->npu->phb_nvlink.opal_id, \ - ((p)->bdfn >> 8) & 0xff, \ + PCI_BUS_NUM((p)->bdfn), \ ((p)->bdfn >> 3) & 0x1f, \ (p)->bdfn & 0x7, ##a) #define NPU2DEVDBG(p, fmt, a...) NPU2DEVLOG(PR_DEBUG, p, fmt, ##a) diff --git a/include/pci.h b/include/pci.h index 18deb2f..cb33063 100644 --- a/include/pci.h +++ b/include/pci.h @@ -13,22 +13,22 @@ #define PCITRACE(_p, _bdfn, fmt, a...) \ prlog(PR_TRACE, "PHB#%04x:%02x:%02x.%x " fmt, \ (_p)->opal_id, \ - ((_bdfn) >> 8) & 0xff, \ + PCI_BUS_NUM(_bdfn), \ ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a) #define PCIDBG(_p, _bdfn, fmt, a...) \ prlog(PR_DEBUG, "PHB#%04x:%02x:%02x.%x " fmt, \ (_p)->opal_id, \ - ((_bdfn) >> 8) & 0xff, \ + PCI_BUS_NUM(_bdfn), \ ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a) #define PCINOTICE(_p, _bdfn, fmt, a...) \ prlog(PR_NOTICE, "PHB#%04x:%02x:%02x.%x " fmt, \ (_p)->opal_id, \ - ((_bdfn) >> 8) & 0xff, \ + PCI_BUS_NUM(_bdfn), \ ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a) #define PCIERR(_p, _bdfn, fmt, a...) \ prlog(PR_ERR, "PHB#%04x:%02x:%02x.%x " fmt, \ (_p)->opal_id, \ - ((_bdfn) >> 8) & 0xff, \ + PCI_BUS_NUM(_bdfn), \ ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a) struct pci_device; diff --git a/include/skiboot.h b/include/skiboot.h index e554325..4db265f 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -137,6 +137,9 @@ static inline bool is_pow2(unsigned long val) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) +/* PCI Geographical Addressing */ +#define PCI_BUS_NUM(bdfn) (((bdfn) >> 8) & 0xff) + /* Clean the stray high bit which the FSP inserts: we only have 52 bits real */ static inline u64 cleanup_addr(u64 addr) { |