Skip to content

Commit

Permalink
vme_tsi148: Fix PCI address mapping assumption
Browse files Browse the repository at this point in the history
Previously, tsi148_master_set() assumed the address contained in its
PCI bus resource represented the actual PCI bus address. This is a fine
assumption on some platforms. However, on platforms that don't use a
1:1 (CPU:PCI) mapping this results in the tsi148 driver configuring an
invalid master window translation.

This patch updates the vme_tsi148 driver to first convert the address
contained in the PCI bus resource into a PCI bus address before using
it.

[asierra: account for pcibios_resource_to_bus() prototype change]
Signed-off-by: Joe Schultz <jschultz@xes-inc.com>
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Joe Schultz authored and Greg Kroah-Hartman committed Apr 16, 2014
1 parent 098ced8 commit 226572b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/vme/bridges/vme_tsi148.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,11 +910,15 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled,
unsigned long long pci_bound, vme_offset, pci_base;
struct vme_bridge *tsi148_bridge;
struct tsi148_driver *bridge;
struct pci_bus_region region;
struct pci_dev *pdev;

tsi148_bridge = image->parent;

bridge = tsi148_bridge->driver_priv;

pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev);

/* Verify input data */
if (vme_base & 0xFFFF) {
dev_err(tsi148_bridge->parent, "Invalid VME Window "
Expand Down Expand Up @@ -949,7 +953,9 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled,
pci_bound = 0;
vme_offset = 0;
} else {
pci_base = (unsigned long long)image->bus_resource.start;
pcibios_resource_to_bus(pdev->bus, &region,
&image->bus_resource);
pci_base = region.start;

/*
* Bound address is a valid address for the window, adjust
Expand Down

0 comments on commit 226572b

Please sign in to comment.