summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include/pci.h
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2019-11-25 16:42:56 +0100
committerPatrick Georgi <pgeorgi@google.com>2020-02-05 21:48:36 +0000
commitc34ebab4108965c824de4e1271c3f15598567fc5 (patch)
tree1a2a7e5edc0348fc2796f4fcc33f8c3ccb86f642 /payloads/libpayload/include/pci.h
parentc294fe792c5be9b265236d41b381ee9e15d1d41e (diff)
libpayload: Make pci and endian handling -Wconversion safe
Change-Id: Ibd1b179d647f105579bd74b071344668ca0a41ef Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37202 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/include/pci.h')
-rw-r--r--payloads/libpayload/include/pci.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/payloads/libpayload/include/pci.h b/payloads/libpayload/include/pci.h
index ff07d5c94d..a1bac4ab60 100644
--- a/payloads/libpayload/include/pci.h
+++ b/payloads/libpayload/include/pci.h
@@ -91,11 +91,11 @@ typedef u32 pcidev_t;
#define HEADER_TYPE_CARDBUS 2
#define HEADER_TYPE_MULTIFUNCTION 0x80
-#define PCI_ADDR(_bus, _dev, _fn, _reg) \
-(0x80000000 | (_bus << 16) | (_dev << 11) | (_fn << 8) | (_reg & ~3))
+#define PCI_DEV(_bus, _dev, _fn) (0x80000000 | \
+(uint32_t)(_bus << 16) | (uint32_t)(_dev << 11) | (uint32_t)(_fn << 8))
-#define PCI_DEV(_bus, _dev, _fn) \
-(0x80000000 | (_bus << 16) | (_dev << 11) | (_fn << 8))
+#define PCI_ADDR(_bus, _dev, _fn, _reg) \
+(PCI_DEV(_bus, _dev, _fn) | (uint8_t)(_reg & ~3))
#define PCI_BUS(_d) ((_d >> 16) & 0xff)
#define PCI_SLOT(_d) ((_d >> 11) & 0x1f)