[U-Boot] [PATCH v0 6/7] x86: Misc PCI touchups
Graeme Russ
graeme.russ at gmail.com
Sat Nov 5 03:21:50 CET 2011
Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
---
arch/x86/cpu/sc520/sc520_pci.c | 4 +---
arch/x86/include/asm/pci.h | 2 +-
arch/x86/lib/pci_type1.c | 10 +++++++---
drivers/pci/pci.c | 4 ++--
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/arch/x86/cpu/sc520/sc520_pci.c b/arch/x86/cpu/sc520/sc520_pci.c
index e26793a..01b13e9 100644
--- a/arch/x86/cpu/sc520/sc520_pci.c
+++ b/arch/x86/cpu/sc520/sc520_pci.c
@@ -126,9 +126,7 @@ void pci_sc520_init(struct pci_controller *hose)
hose->last_busno = 0xff;
hose->region_count = pci_set_regions(hose);
- pci_setup_type1(hose,
- SC520_REG_ADDR,
- SC520_REG_DATA);
+ pci_setup_type1(hose);
pci_register_hose(hose);
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 85f60d7..4acd76f 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -26,7 +26,7 @@
#ifndef _PCI_I386_H_
#define _PCI_I386_H_ 1
-void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data);
+void pci_setup_type1(struct pci_controller* hose);
int pci_enable_legacy_video_ports(struct pci_controller* hose);
int pci_shadow_rom(pci_dev_t dev, unsigned char *dest);
void pci_remove_rom_window(struct pci_controller* hose, u32 addr);
diff --git a/arch/x86/lib/pci_type1.c b/arch/x86/lib/pci_type1.c
index da1d356..2df4bf8 100644
--- a/arch/x86/lib/pci_type1.c
+++ b/arch/x86/lib/pci_type1.c
@@ -51,7 +51,11 @@ TYPE1_PCI_OP(write, byte, u8, outb, 3)
TYPE1_PCI_OP(write, word, u16, outw, 2)
TYPE1_PCI_OP(write, dword, u32, outl, 0)
-void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
+/* bus mapping constants (used for PCI core initialization) */ /* bus mapping constants */
+#define PCI_REG_ADDR 0x00000cf8
+#define PCI_REG_DATA 0x00000cfc
+
+void pci_setup_type1(struct pci_controller* hose)
{
pci_set_ops(hose,
type1_read_config_byte,
@@ -61,6 +65,6 @@ void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
type1_write_config_word,
type1_write_config_dword);
- hose->cfg_addr = (unsigned int *) cfg_addr;
- hose->cfg_data = (unsigned char *) cfg_data;
+ hose->cfg_addr = (unsigned int *)PCI_REG_ADDR;
+ hose->cfg_data = (unsigned char *)PCI_REG_DATA;
}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5f1f128..7adb0c9 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -280,7 +280,7 @@ int __pci_hose_phys_to_bus (struct pci_controller *hose,
bus_addr = phys_addr - res->phys_start + res->bus_start;
if (bus_addr >= res->bus_start &&
- bus_addr < res->bus_start + res->size) {
+ bus_addr < (res->bus_start + res->size - 1)) {
*ba = bus_addr;
return 0;
}
@@ -337,7 +337,7 @@ int __pci_hose_bus_to_phys (struct pci_controller *hose,
continue;
if (bus_addr >= res->bus_start &&
- bus_addr < res->bus_start + res->size) {
+ bus_addr < (res->bus_start + res->size - 1)) {
*pa = (bus_addr - res->bus_start + res->phys_start);
return 0;
}
--
1.7.5.2.317.g391b14
More information about the U-Boot
mailing list