diff options
author | Nick Withers <nick.withers@anu.edu.au> | 2014-11-27 17:39:36 +1100 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2014-12-23 22:40:32 -0500 |
commit | 2d5c48691453a05ffb3a264f75e71490166f819a (patch) | |
tree | 349fff13e895c9c30ca9d0ec5b51270681beba0b /c/src/lib/libbsp/powerpc/mvme5500/pci | |
parent | pc386: scan all functions of multi-function PCI devices (diff) | |
download | rtems-2d5c48691453a05ffb3a264f75e71490166f819a.tar.bz2 |
Use fixed-width C99 types for PowerPC in_be16() and co.
Also use the const qualifier on the address pointer's target in in_*()
Closes #2128
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mvme5500/pci')
-rw-r--r-- | c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c | 22 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mvme5500/pci/pci_interface.c | 12 |
2 files changed, 18 insertions, 16 deletions
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c b/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c index d3ffa1e455..8601721c03 100644 --- a/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c +++ b/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c @@ -102,7 +102,7 @@ unsigned char offset, uint8_t *val) BSP_pci[n].config_data,pciConfigPack(bus,dev,func,offset)); #endif - out_be32((volatile unsigned int *) BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); + out_be32((volatile uint32_t *) BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); *val = in_8(BSP_pci[n].pci_config_data + (offset&3)); return PCIBIOS_SUCCESSFUL; } @@ -123,8 +123,8 @@ unsigned char func, unsigned char offset, uint16_t *val) printk("addr %x, data %x, pack %x \n", config_addr, config_data,pciConfigPack(bus,dev,func,offset)); #endif - out_be32((volatile unsigned int *) BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); - *val = in_le16((volatile unsigned short *) (BSP_pci[n].pci_config_data + (offset&2))); + out_be32((volatile uint32_t *) BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); + *val = in_le16((volatile uint16_t *) (BSP_pci[n].pci_config_data + (offset&2))); return PCIBIOS_SUCCESSFUL; } @@ -141,8 +141,8 @@ unsigned char func, unsigned char offset, uint32_t *val) *val = 0xffffffff; if ((offset&3)|| (offset & ~0xff)) return PCIBIOS_BAD_REGISTER_NUMBER; - out_be32((volatile unsigned int *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); - *val = in_le32((volatile unsigned int *)BSP_pci[n].pci_config_data); + out_be32((volatile uint32_t *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); + *val = in_le32((volatile uint32_t *)BSP_pci[n].pci_config_data); return PCIBIOS_SUCCESSFUL; } @@ -157,8 +157,8 @@ static int indirect_pci_write_config_byte(unsigned char bus, unsigned char dev,u if (offset & ~0xff) return PCIBIOS_BAD_REGISTER_NUMBER; - out_be32((volatile unsigned int *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); - out_8((volatile unsigned char *) (BSP_pci[n].pci_config_data + (offset&3)), val); + out_be32((volatile uint32_t *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); + out_8((volatile uint8_t *) (BSP_pci[n].pci_config_data + (offset&3)), val); return PCIBIOS_SUCCESSFUL; } @@ -173,8 +173,8 @@ static int indirect_pci_write_config_word(unsigned char bus, unsigned char dev,u if ((offset&1)|| (offset & ~0xff)) return PCIBIOS_BAD_REGISTER_NUMBER; - out_be32((volatile unsigned int *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); - out_le16((volatile unsigned short *)(BSP_pci[n].pci_config_data + (offset&3)), val); + out_be32((volatile uint32_t *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); + out_le16((volatile uint16_t *)(BSP_pci[n].pci_config_data + (offset&3)), val); return PCIBIOS_SUCCESSFUL; } @@ -189,8 +189,8 @@ static int indirect_pci_write_config_dword(unsigned char bus,unsigned char dev,u if ((offset&3)|| (offset & ~0xff)) return PCIBIOS_BAD_REGISTER_NUMBER; - out_be32((volatile unsigned int *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); - out_le32((volatile unsigned int *)BSP_pci[n].pci_config_data, val); + out_be32((volatile uint32_t *)BSP_pci[n].pci_config_addr, pciConfigPack(bus,dev,func,offset)); + out_le32((volatile uint32_t *)BSP_pci[n].pci_config_data, val); return PCIBIOS_SUCCESSFUL; } diff --git a/c/src/lib/libbsp/powerpc/mvme5500/pci/pci_interface.c b/c/src/lib/libbsp/powerpc/mvme5500/pci/pci_interface.c index d22691b724..9f7be59151 100644 --- a/c/src/lib/libbsp/powerpc/mvme5500/pci/pci_interface.c +++ b/c/src/lib/libbsp/powerpc/mvme5500/pci/pci_interface.c @@ -23,6 +23,8 @@ #include <bsp/gtreg.h> #include <bsp/gtpcireg.h> +#include <inttypes.h> + #define PCI_DEBUG 0 #if 0 @@ -71,10 +73,10 @@ void pci_interface(void) #ifdef CPU2PCI_ORDER /* MOTLOad deafult : 0x07ff8600 */ - out_le32((volatile unsigned int *)(GT64x60_REG_BASE+CNT_SYNC_REG), 0x07fff600); + out_le32((volatile uint32_t *)(GT64x60_REG_BASE+CNT_SYNC_REG), 0x07fff600); #endif /* asserts SERR upon various detection */ - out_le32((volatile unsigned int *)(GT64x60_REG_BASE+0xc28), 0x3fffff); + out_le32((volatile uint32_t *)(GT64x60_REG_BASE+0xc28), 0x3fffff); pciAccessInit(); } @@ -83,15 +85,15 @@ void pciAccessInit(void) unsigned int PciLocal, data; for (PciLocal=0; PciLocal < 2; PciLocal++) { - data = in_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80))); + data = in_le32((volatile uint32_t *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80))); #if 0 printk("PCI%d_ACCESS_CNTL_BASE0_LOW was 0x%x\n",PciLocal,data); #endif data |= PCI_ACCCTLBASEL_VALUE; data &= ~0x300000; - out_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)), data); + out_le32((volatile uint32_t *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)), data); #if 0 - printf("PCI%d_ACCESS_CNTL_BASE0_LOW now 0x%x\n",PciLocal,in_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)))); + printf("PCI%d_ACCESS_CNTL_BASE0_LOW now 0x%" PRIx32 "\n",PciLocal,in_le32((volatile uint32_t *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)))); #endif } } |