提交 ef7e64c8 编写于 作者: T Tianli Xiong 提交者: Hongchen Zhang

LoongArch: Fixed some pcie card not scanning properly

LoongArch inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6BWFP

--------------------------------

Fix some pcie card not scanning properly when
bus number is inconsistent during firmware and
kernel scan phases.
Signed-off-by: Nliuyun <liuyun@loongson.cn>
Signed-off-by: NTianli Xiong <xiongtianli@loongson.cn>
Change-Id: Iac9c07463569ca08da93ab0fa279b1880206e816
上级 60c8da76
......@@ -216,6 +216,36 @@ static void __iomem *pci_loongson_map_bus(struct pci_bus *bus,
return NULL;
}
static int pci_loongson_config_read(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{
void __iomem *addr;
addr = bus->ops->map_bus(bus, devfn, where);
if (!addr) {
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND;
}
if (size == 1)
*val = readb(addr);
else if (size == 2)
*val = readw(addr);
else
*val = readl(addr);
/*
* fix some pcie card not scanning properly when bus number is
* inconsistent during firmware and kernel scan phases.
*/
if (*val == 0x0 && where == PCI_VENDOR_ID) {
writel(*val, addr);
*val = readl(addr);
}
return PCIBIOS_SUCCESSFUL;
}
#ifdef CONFIG_OF
static int loongson_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
......@@ -239,7 +269,7 @@ static int loongson_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
/* LS2K/LS7A accept 8/16/32-bit PCI config operations */
static struct pci_ops loongson_pci_ops = {
.map_bus = pci_loongson_map_bus,
.read = pci_generic_config_read,
.read = pci_loongson_config_read,
.write = pci_generic_config_write,
};
......@@ -366,7 +396,7 @@ const struct pci_ecam_ops loongson_pci_ecam_ops = {
.init = loongson_pci_ecam_init,
.pci_ops = {
.map_bus = pci_loongson_map_bus,
.read = pci_generic_config_read,
.read = pci_loongson_config_read,
.write = pci_generic_config_write,
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册