Author: blueswirl Date: 2010-01-22 19:50:54 +0100 (Fri, 22 Jan 2010) New Revision: 667
Modified: trunk/openbios-devel/include/sparc64/pci.h Log: Sparc64: use correct PCI probe mechanism
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/include/sparc64/pci.h =================================================================== --- trunk/openbios-devel/include/sparc64/pci.h 2010-01-16 10:35:58 UTC (rev 666) +++ trunk/openbios-devel/include/sparc64/pci.h 2010-01-22 18:50:54 UTC (rev 667) @@ -12,55 +12,53 @@ /* PCI Configuration Mechanism #1 */
#define PCI_ADDR(bus, dev, fn) \ - ((pci_addr) (arch->cfg_base \ - | (uint32_t) (bus) << 16 \ + (((pci_addr) (uint32_t) (bus) << 16 \ | (uint32_t) (dev) << 11 \ | (uint32_t) (fn) << 8))
-#define PCI_BUS(pcidev) ((uint8_t) ((pcidev) >> 16)) +#define PCI_BUS(pcidev) ((uint8_t) ((pcidev) >> 16) & 0xff) #define PCI_DEV(pcidev) ((uint8_t) ((pcidev) >> 11) & 0x1f) #define PCI_FN(pcidev) ((uint8_t) ((pcidev) >> 8) & 7)
+#define PCI_CONFIG(dev) (arch->cfg_addr \ + + (unsigned long)PCI_ADDR(PCI_BUS(dev), \ + PCI_DEV(dev), \ + PCI_FN(dev))) + static inline uint8_t pci_config_read8(pci_addr dev, uint8_t reg) { uint8_t res; - out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3)); - res = in_8((unsigned char*)(arch->cfg_data + (reg & 3))); + res = in_8((unsigned char*)(PCI_CONFIG(dev) + reg)); return res; }
static inline uint16_t pci_config_read16(pci_addr dev, uint8_t reg) { uint16_t res; - out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3)); - res = in_le16((unsigned short*)(arch->cfg_data + (reg & 2))); + res = in_le16((uint16_t *)(PCI_CONFIG(dev) + reg)); return res; }
static inline uint32_t pci_config_read32(pci_addr dev, uint8_t reg) { uint32_t res; - out_le32((unsigned *)arch->cfg_addr, dev | reg); - res = in_le32((unsigned *)(arch->cfg_data + reg)); + res = in_le32((uint32_t *)(PCI_CONFIG(dev) + reg)); return res; }
static inline void pci_config_write8(pci_addr dev, uint8_t reg, uint8_t val) { - out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3)); - out_8((unsigned char*)(arch->cfg_data + (reg & 3)), val); + out_8((unsigned char*)(PCI_CONFIG(dev) + reg), val); }
static inline void pci_config_write16(pci_addr dev, uint8_t reg, uint16_t val) { - out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3)); - out_le16((unsigned short *)(arch->cfg_data + (reg & 2)), val); + out_le16((uint16_t *)(PCI_CONFIG(dev) + reg), val); }
static inline void pci_config_write32(pci_addr dev, uint8_t reg, uint32_t val) { - out_le32((unsigned *)arch->cfg_addr, dev | reg); - out_le32((unsigned *)(arch->cfg_data + reg), val); + out_le32((uint32_t *)(PCI_CONFIG(dev) + reg), val); } #else /* !PCI_CONFIG_1 */ #error PCI Configuration Mechanism is not specified or implemented