[PATCH v3 5/8] pci: ensure device does ignore BAR mangling
Sebastian Hesselbarth
sebastian.hesselbarth at gmail.com
Wed Jul 30 01:39:37 PDT 2014
Disable access to PCI devices I/O and memory regions while
mangling BAR registers.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
---
Changelog:
v2->v3:
- new patch
Cc: barebox at lists.infradead.org
Cc: Antony Pavlov <antonynpavlov at gmail.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
Cc: Lucas Stach <l.stach at pengutronix.de>
Cc: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia at free-electrons.com>
---
drivers/pci/pci.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index f58e2c98f185..b64f25d13282 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -191,6 +191,10 @@ unsigned int pci_scan_bus(struct pci_bus *bus)
continue;
}
+ pci_read_config_byte(dev, PCI_COMMAND, &cmd);
+ pci_write_config_byte(dev, PCI_COMMAND,
+ cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
+
for (bar = 0; bar < 6; bar++) {
resource_size_t last_addr;
@@ -233,6 +237,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus)
bar++;
}
+ pci_write_config_byte(dev, PCI_COMMAND, cmd);
list_add_tail(&dev->bus_list, &bus->devices);
pci_register_device(dev);
}
--
2.0.0
More information about the barebox
mailing list