OSDN Git Service

Merge branch 'pci/msi' into next
[uclinux-h8/linux.git] / drivers / pci / host / pcie-designware.c
index 1c59e4e..f727445 100644 (file)
@@ -343,9 +343,8 @@ static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,
        struct msi_msg msg;
        struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata);
 
-       pci_read_config_word(pdev, desc->msi_attrib.pos+PCI_MSI_FLAGS,
-                               &msg_ctr);
-       msgvec = (msg_ctr&PCI_MSI_FLAGS_QSIZE) >> 4;
+       pci_read_config_word(pdev, pdev->msi_cap + PCI_MSI_FLAGS, &msg_ctr);
+       msgvec = (msg_ctr & PCI_MSI_FLAGS_QSIZE) >> 4;
        if (msgvec == 0)
                msgvec = (msg_ctr & PCI_MSI_FLAGS_QMASK) >> 1;
        if (msgvec > 5)
@@ -361,12 +360,17 @@ static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,
         */
        desc->msi_attrib.multiple = msgvec;
 
-       if (pp->ops->get_msi_data)
-               msg.address_lo = pp->ops->get_msi_data(pp);
+       if (pp->ops->get_msi_addr)
+               msg.address_lo = pp->ops->get_msi_addr(pp);
        else
                msg.address_lo = virt_to_phys((void *)pp->msi_data);
        msg.address_hi = 0x0;
-       msg.data = pos;
+
+       if (pp->ops->get_msi_data)
+               msg.data = pp->ops->get_msi_data(pp, pos);
+       else
+               msg.data = pos;
+
        write_msi_msg(irq, &msg);
 
        return 0;
@@ -454,7 +458,7 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
                        pp->io.end = min_t(resource_size_t,
                                           IO_SPACE_LIMIT,
                                           range.pci_addr + range.size
-                                          + global_io_offset);
+                                          + global_io_offset - 1);
                        pp->io_size = resource_size(&pp->io);
                        pp->io_bus_addr = range.pci_addr;
                        pp->io_base = range.cpu_addr;
@@ -510,7 +514,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
        pp->mem_base = pp->mem.start;
 
        if (!pp->va_cfg0_base) {
-               pp->cfg0_base = pp->cfg.start;
                pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base,
                                                pp->cfg0_size);
                if (!pp->va_cfg0_base) {
@@ -520,7 +523,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
        }
 
        if (!pp->va_cfg1_base) {
-               pp->cfg1_base = pp->cfg.start + pp->cfg0_size;
                pp->va_cfg1_base = devm_ioremap(pp->dev, pp->cfg1_base,
                                                pp->cfg1_size);
                if (!pp->va_cfg1_base) {