diff options
author | Edward O'Callaghan <eocallaghan@alterapraxis.com> | 2014-07-09 04:55:16 +1000 |
---|---|---|
committer | Edward O'Callaghan <eocallaghan@alterapraxis.com> | 2014-07-19 11:57:06 +0200 |
commit | c2956e7752213f9eae5064e63d16afa84b7cc23f (patch) | |
tree | ae4d6921ee68467704038728e5e89eebd71d644e | |
parent | b666793925a1fa175f9b6cc12bec051a3a31d23b (diff) |
device/pci_early.c: Mixes up variants of a typedefs to 'u32'
Unfortunately coreboot has to deal with ROMCC's short comings which has
lead to a little bit of confusion due to typedefs. Essentially, coreboot
defines four typedefs:
* 'typedef struct device * device_t' in ramstage not in SIMPLE_DEVICE mode
* 'typedef u32 device_t' in romstage or when SIMPLE_DEVICE is defined
* 'typedef u32 pnp_devfn_t'
* 'typedef u32 pci_devfn_t'
Some early functions make use of 'device_t' over 'pci_devfn_t' and since
the C type-checker does not enforce typedefs to the same type 'u32'
these are never noticed. Fix these so that 'device_t' does not conflict
in romstage for later work. We later plan to have 'pnp_devfn_t' and
'pci_devfn_t' as the only variants of 'u32' and 'device_t' to be a
struct pointer type exclusively.
Change-Id: I948801f5be968a934798f1bad7722649758cd4d3
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-on: http://review.coreboot.org/6225
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
-rw-r--r-- | src/device/pci_early.c | 7 | ||||
-rw-r--r-- | src/include/device/pci.h | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/device/pci_early.c b/src/device/pci_early.c index e31287e8bf..e690211c43 100644 --- a/src/device/pci_early.c +++ b/src/device/pci_early.c @@ -25,8 +25,7 @@ #include <delay.h> #ifdef __PRE_RAM__ - -unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last) +unsigned pci_find_next_capability(pci_devfn_t dev, unsigned cap, unsigned last) { unsigned pos = 0; u16 status; @@ -69,11 +68,11 @@ unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last) return 0; } -unsigned pci_find_capability(device_t dev, unsigned cap) +unsigned pci_find_capability(pci_devfn_t dev, unsigned cap) { return pci_find_next_capability(dev, cap, 0); } -#endif +#endif /* __PRE_RAM__ */ #if CONFIG_EARLY_PCI_BRIDGE diff --git a/src/include/device/pci.h b/src/include/device/pci.h index 81759706aa..0670da4822 100644 --- a/src/include/device/pci.h +++ b/src/include/device/pci.h @@ -102,8 +102,14 @@ static inline const struct pci_operations *ops_pci(device_t dev) #endif /* ! __SIMPLE_DEVICE__ */ +#ifdef __PRE_RAM__ +unsigned pci_find_next_capability(pci_devfn_t dev, unsigned cap, unsigned last); +unsigned pci_find_capability(pci_devfn_t dev, unsigned cap); +#else /* !__PRE_RAM__ */ unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last); unsigned pci_find_capability(device_t dev, unsigned cap); +#endif /* __PRE_RAM__ */ + void pci_early_bridge_init(void); int pci_early_device_probe(u8 bus, u8 dev, u32 mmio_base); |