[U-Boot] [PATCH 1/2] pci: Rename PCI_REGION_MEMORY to PCI_REGION_SYS_MEMORY for clarity

The PCI_REGION_MEMORY and PCI_REGION_MEM are a bit to similar and can be confusing when reading the code.
Rename PCI_REGION_MEMORY to PCI_REGION_SYS_MEMORY to clarify its used for system memory mapping purposes.
Signed-off-by: Kumar Gala galak@kernel.crashing.org --- board/MAI/AmigaOneG3SE/articiaS_pci.c | 2 +- board/ads5121/pci.c | 2 +- board/amirix/ap1000/pci.c | 2 +- board/armltd/integratorap/integratorap.c | 2 +- board/dave/common/pci.c | 2 +- board/eltec/bab7xx/pci.c | 2 +- board/eltec/elppc/pci.c | 2 +- board/esd/common/pci.c | 2 +- board/freescale/mpc832xemds/pci.c | 2 +- board/freescale/mpc8349itx/pci.c | 4 ++-- board/freescale/mpc8360emds/pci.c | 2 +- board/pcippc2/cpc710_pci.c | 4 ++-- board/ppmc7xx/pci.c | 2 +- board/sbc8349/pci.c | 4 ++-- board/sbc8548/sbc8548.c | 2 +- board/tb0229/vr4131-pci.c | 2 +- board/tqc/tqm834x/pci.c | 2 +- common/fdt_support.c | 4 ++-- cpu/i386/sc520.c | 2 +- cpu/mcf5445x/pci.c | 2 +- cpu/mcf547x_8x/pci.c | 2 +- cpu/mpc5xxx/pci_mpc5200.c | 2 +- cpu/mpc8220/pci.c | 2 +- cpu/mpc824x/pci.c | 2 +- cpu/mpc8260/pci.c | 4 ++-- cpu/mpc83xx/pci.c | 2 +- cpu/mpc83xx/pcie.c | 4 ++-- cpu/ppc4xx/4xx_pci.c | 4 ++-- drivers/pci/fsl_pci_init.c | 10 +++++----- drivers/pci/pci_ixp.c | 2 +- drivers/pci/tsi108_pci.c | 2 +- include/pci.h | 2 +- 32 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/board/MAI/AmigaOneG3SE/articiaS_pci.c b/board/MAI/AmigaOneG3SE/articiaS_pci.c index 45b8195..371f67f 100644 --- a/board/MAI/AmigaOneG3SE/articiaS_pci.c +++ b/board/MAI/AmigaOneG3SE/articiaS_pci.c @@ -313,7 +313,7 @@ void articiaS_pci_init (void) ARTICIAS_SYS_BUS, ARTICIAS_SYS_PHYS, ARTICIAS_SYS_MAXSIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(articiaS_hose.regions + 1, diff --git a/board/ads5121/pci.c b/board/ads5121/pci.c index b747e81..806c428 100644 --- a/board/ads5121/pci.c +++ b/board/ads5121/pci.c @@ -153,7 +153,7 @@ pci_init_board(void) CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, gd->ram_size, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 4;
diff --git a/board/amirix/ap1000/pci.c b/board/amirix/ap1000/pci.c index a9b3fd8..5fbcd37 100644 --- a/board/amirix/ap1000/pci.c +++ b/board/amirix/ap1000/pci.c @@ -294,7 +294,7 @@ void pci_init_board (void) pci_set_region (hose->regions + 0, AP1000_SYS_MEM_START, AP1000_SYS_MEM_START, AP1000_SYS_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI Memory space */ pci_set_region (hose->regions + 1, diff --git a/board/armltd/integratorap/integratorap.c b/board/armltd/integratorap/integratorap.c index ddacabb..9631967 100644 --- a/board/armltd/integratorap/integratorap.c +++ b/board/armltd/integratorap/integratorap.c @@ -428,7 +428,7 @@ void pci_init_board (void) /* System memory space */ pci_set_region (hose->regions + 0, 0x00000000, 0x40000000, 0x01000000, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI Memory - config space */ pci_set_region (hose->regions + 1, diff --git a/board/dave/common/pci.c b/board/dave/common/pci.c index ec0d761..ddfbea9 100644 --- a/board/dave/common/pci.c +++ b/board/dave/common/pci.c @@ -179,7 +179,7 @@ void pci_init(void) /* System memory space */ pci_set_region(hose->regions + 0, 0x00000000, 0x00000000, 0x01000000, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI Memory space */ pci_set_region(hose->regions + 1, diff --git a/board/eltec/bab7xx/pci.c b/board/eltec/bab7xx/pci.c index 46e5a8b..38dd498 100644 --- a/board/eltec/bab7xx/pci.c +++ b/board/eltec/bab7xx/pci.c @@ -50,7 +50,7 @@ void pci_init_board(void) * so we need (CONFIG_SYS_PCI_MEMORY_SIZE-1) */ CONFIG_SYS_PCI_MEMORY_SIZE-1, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(hose->regions + 1, diff --git a/board/eltec/elppc/pci.c b/board/eltec/elppc/pci.c index bf133b7..2948531 100644 --- a/board/eltec/elppc/pci.c +++ b/board/eltec/elppc/pci.c @@ -45,7 +45,7 @@ void pci_init_board(void) CONFIG_SYS_PCI_MEMORY_BUS, CONFIG_SYS_PCI_MEMORY_PHYS, CONFIG_SYS_PCI_MEMORY_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(hose->regions + 1, diff --git a/board/esd/common/pci.c b/board/esd/common/pci.c index dcb764c..83f8103 100644 --- a/board/esd/common/pci.c +++ b/board/esd/common/pci.c @@ -179,7 +179,7 @@ void pci_init_board(void) /* System memory space */ pci_set_region(hose->regions + 0, 0x00000000, 0x00000000, 0x01000000, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI Memory space */ pci_set_region(hose->regions + 1, diff --git a/board/freescale/mpc832xemds/pci.c b/board/freescale/mpc832xemds/pci.c index 2a48dd2..212fb52 100644 --- a/board/freescale/mpc832xemds/pci.c +++ b/board/freescale/mpc832xemds/pci.c @@ -228,7 +228,7 @@ void pci_init_board(void) CONFIG_SYS_PCI_SLV_MEM_LOCAL, CONFIG_SYS_PCI_SLV_MEM_BUS, CONFIG_SYS_PCI_SLV_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose[0].region_count = 4;
diff --git a/board/freescale/mpc8349itx/pci.c b/board/freescale/mpc8349itx/pci.c index fd2c172..8da7117 100644 --- a/board/freescale/mpc8349itx/pci.c +++ b/board/freescale/mpc8349itx/pci.c @@ -210,7 +210,7 @@ void pci_init_board(void) pci_set_region(hose->regions + 3, CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, - gd->ram_size, PCI_REGION_MEM | PCI_REGION_MEMORY); + gd->ram_size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 4;
@@ -301,7 +301,7 @@ void pci_init_board(void) pci_set_region(hose->regions + 3, CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, - gd->ram_size, PCI_REGION_MEM | PCI_REGION_MEMORY); + gd->ram_size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 4;
diff --git a/board/freescale/mpc8360emds/pci.c b/board/freescale/mpc8360emds/pci.c index 935aca2..7ac35dc 100644 --- a/board/freescale/mpc8360emds/pci.c +++ b/board/freescale/mpc8360emds/pci.c @@ -228,7 +228,7 @@ void pci_init_board(void) CONFIG_SYS_PCI_SLV_MEM_LOCAL, CONFIG_SYS_PCI_SLV_MEM_BUS, CONFIG_SYS_PCI_SLV_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose[0].region_count = 4;
diff --git a/board/pcippc2/cpc710_pci.c b/board/pcippc2/cpc710_pci.c index bed8aea..ccd18e1 100644 --- a/board/pcippc2/cpc710_pci.c +++ b/board/pcippc2/cpc710_pci.c @@ -215,7 +215,7 @@ void cpc710_pci_init (void) PCI_MEMORY_BUS, PCI_MEMORY_PHYS, PCI_MEMORY_MAXSIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(local_hose.regions + 1, @@ -265,7 +265,7 @@ void cpc710_pci_init (void) PCI_MEMORY_BUS, PCI_MEMORY_PHYS, PCI_MEMORY_MAXSIZE, - PCI_REGION_MEMORY); + PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(cpci_hose.regions + 1, diff --git a/board/ppmc7xx/pci.c b/board/ppmc7xx/pci.c index bf133b7..2948531 100644 --- a/board/ppmc7xx/pci.c +++ b/board/ppmc7xx/pci.c @@ -45,7 +45,7 @@ void pci_init_board(void) CONFIG_SYS_PCI_MEMORY_BUS, CONFIG_SYS_PCI_MEMORY_PHYS, CONFIG_SYS_PCI_MEMORY_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(hose->regions + 1, diff --git a/board/sbc8349/pci.c b/board/sbc8349/pci.c index 9022c55..ac5f30b 100644 --- a/board/sbc8349/pci.c +++ b/board/sbc8349/pci.c @@ -197,7 +197,7 @@ pci_init_board(void) CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, gd->ram_size, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 4;
@@ -293,7 +293,7 @@ pci_init_board(void) CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, gd->ram_size, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 4;
diff --git a/board/sbc8548/sbc8548.c b/board/sbc8548/sbc8548.c index 519b0f7..a779420 100644 --- a/board/sbc8548/sbc8548.c +++ b/board/sbc8548/sbc8548.c @@ -470,7 +470,7 @@ pci_init_board(void) CONFIG_SYS_PCI_MEMORY_BUS, CONFIG_SYS_PCI_MEMORY_PHYS, CONFIG_SYS_PCI_MEMORY_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* outbound memory */ pci_set_region(r++, diff --git a/board/tb0229/vr4131-pci.c b/board/tb0229/vr4131-pci.c index 4c91923..6ff4293 100644 --- a/board/tb0229/vr4131-pci.c +++ b/board/tb0229/vr4131-pci.c @@ -235,7 +235,7 @@ void init_vr4131_pci (struct pci_controller *hose) pci_set_region (hose->regions + 3, 0x00000000, 0x80000000, - 0x04000000, PCI_REGION_MEM | PCI_REGION_MEMORY); + 0x04000000, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 4;
diff --git a/board/tqc/tqm834x/pci.c b/board/tqc/tqm834x/pci.c index 0eedf4a..cb2cb8d 100644 --- a/board/tqc/tqm834x/pci.c +++ b/board/tqc/tqm834x/pci.c @@ -181,7 +181,7 @@ pci_init_board(void) CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, CONFIG_PCI_SYS_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 3;
diff --git a/common/fdt_support.c b/common/fdt_support.c index a79bc08..b54f886 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -646,8 +646,8 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose) { for (r = 0; r < hose->region_count; r++) { u64 bus_start, phys_start, size;
- /* skip if !PCI_REGION_MEMORY */ - if (!(hose->regions[r].flags & PCI_REGION_MEMORY)) + /* skip if !PCI_REGION_SYS_MEMORY */ + if (!(hose->regions[r].flags & PCI_REGION_SYS_MEMORY)) continue;
bus_start = (u64)hose->regions[r].bus_start; diff --git a/cpu/i386/sc520.c b/cpu/i386/sc520.c index 12e8f38..b958f8d 100644 --- a/cpu/i386/sc520.c +++ b/cpu/i386/sc520.c @@ -341,7 +341,7 @@ void pci_sc520_init(struct pci_controller *hose) SC520_PCI_MEMORY_BUS, SC520_PCI_MEMORY_PHYS, SC520_PCI_MEMORY_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(hose->regions + 1, diff --git a/cpu/mcf5445x/pci.c b/cpu/mcf5445x/pci.c index c4a3b05..7f9784c 100644 --- a/cpu/mcf5445x/pci.c +++ b/cpu/mcf5445x/pci.c @@ -146,7 +146,7 @@ void pci_mcf5445x_init(struct pci_controller *hose)
pci_set_region(hose->regions + 2, CONFIG_SYS_PCI_SYS_MEM_BUS, CONFIG_SYS_PCI_SYS_MEM_PHYS, CONFIG_SYS_PCI_SYS_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 3;
diff --git a/cpu/mcf547x_8x/pci.c b/cpu/mcf547x_8x/pci.c index f5c2536..f867dc1 100644 --- a/cpu/mcf547x_8x/pci.c +++ b/cpu/mcf547x_8x/pci.c @@ -149,7 +149,7 @@ void pci_mcf547x_8x_init(struct pci_controller *hose)
pci_set_region(hose->regions + 2, CONFIG_SYS_PCI_SYS_MEM_BUS, CONFIG_SYS_PCI_SYS_MEM_PHYS, CONFIG_SYS_PCI_SYS_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 3;
diff --git a/cpu/mpc5xxx/pci_mpc5200.c b/cpu/mpc5xxx/pci_mpc5200.c index a3251ab..225738a 100644 --- a/cpu/mpc5xxx/pci_mpc5200.c +++ b/cpu/mpc5xxx/pci_mpc5200.c @@ -93,7 +93,7 @@ void pci_mpc5xxx_init (struct pci_controller *hose) CONFIG_PCI_MEMORY_BUS, CONFIG_PCI_MEMORY_PHYS, CONFIG_PCI_MEMORY_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(hose->regions + 1, diff --git a/cpu/mpc8220/pci.c b/cpu/mpc8220/pci.c index a78a828..7ef43b7 100644 --- a/cpu/mpc8220/pci.c +++ b/cpu/mpc8220/pci.c @@ -165,7 +165,7 @@ pci_mpc8220_init(struct pci_controller *hose) CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, CONFIG_PCI_SYS_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
hose->region_count = 3;
diff --git a/cpu/mpc824x/pci.c b/cpu/mpc824x/pci.c index 7e3c4c3..cf9cf41 100644 --- a/cpu/mpc824x/pci.c +++ b/cpu/mpc824x/pci.c @@ -34,7 +34,7 @@ void pci_mpc824x_init (struct pci_controller *hose) CHRP_PCI_MEMORY_BUS, CHRP_PCI_MEMORY_PHYS, CHRP_PCI_MEMORY_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region(hose->regions + 1, diff --git a/cpu/mpc8260/pci.c b/cpu/mpc8260/pci.c index 378d6c5..f1e9bb4 100644 --- a/cpu/mpc8260/pci.c +++ b/cpu/mpc8260/pci.c @@ -410,12 +410,12 @@ void pci_mpc8250_init (struct pci_controller *hose) pci_set_region (hose->regions + 0, PCI_SLV_MEM_BUS, PCI_SLV_MEM_LOCAL, - gd->ram_size, PCI_REGION_MEM | PCI_REGION_MEMORY); + gd->ram_size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); #else pci_set_region (hose->regions + 0, CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_BASE, - 0x4000000, PCI_REGION_MEM | PCI_REGION_MEMORY); + 0x4000000, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); #endif
/* PCI memory space */ diff --git a/cpu/mpc83xx/pci.c b/cpu/mpc83xx/pci.c index e9965d7..5fe8964 100644 --- a/cpu/mpc83xx/pci.c +++ b/cpu/mpc83xx/pci.c @@ -89,7 +89,7 @@ static void pci_init_bus(int bus, struct pci_region *reg) hose->regions[i].bus_start = 0; hose->regions[i].phys_start = 0; hose->regions[i].size = gd->ram_size; - hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_MEMORY; + hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_SYS_MEMORY;
hose->first_busno = 0; hose->last_busno = 0xff; diff --git a/cpu/mpc83xx/pcie.c b/cpu/mpc83xx/pcie.c index 02150ba..12b5f69 100644 --- a/cpu/mpc83xx/pcie.c +++ b/cpu/mpc83xx/pcie.c @@ -109,13 +109,13 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg, hose->regions[i].bus_start = 0; hose->regions[i].phys_start = 0; hose->regions[i].size = gd->ram_size; - hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_MEMORY; + hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_SYS_MEMORY;
i = hose->region_count++; hose->regions[i].bus_start = CONFIG_SYS_IMMR; hose->regions[i].phys_start = CONFIG_SYS_IMMR; hose->regions[i].size = 0x100000; - hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_MEMORY; + hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_SYS_MEMORY;
hose->first_busno = max_bus; hose->last_busno = 0xff; diff --git a/cpu/ppc4xx/4xx_pci.c b/cpu/ppc4xx/4xx_pci.c index e8871fc..54ed901 100644 --- a/cpu/ppc4xx/4xx_pci.c +++ b/cpu/ppc4xx/4xx_pci.c @@ -179,7 +179,7 @@ void pci_405gp_init(struct pci_controller *hose) ptmpcila[i], ptmla[i], ~(ptmms[i] & 0xfffff000) + 1, PCI_REGION_MEM | - PCI_REGION_MEMORY); + PCI_REGION_SYS_MEMORY); }
/* PCI memory spaces */ @@ -504,7 +504,7 @@ int pci_440_init (struct pci_controller *hose) CONFIG_PCI_SYS_MEM_BUS, CONFIG_PCI_SYS_MEM_PHYS, CONFIG_PCI_SYS_MEM_SIZE, - PCI_REGION_MEM | PCI_REGION_MEMORY ); + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY ); #endif
hose->region_count = reg_num; diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index db68f26..20b2dcc 100644 --- a/drivers/pci/fsl_pci_init.c +++ b/drivers/pci/fsl_pci_init.c @@ -72,7 +72,7 @@ int fsl_pci_setup_inbound_windows(struct pci_region *r) debug ("R0 bus_start: %llx phys_start: %llx size: %llx\n", (u64)bus_start, (u64)phys_start, (u64)pci_sz); pci_set_region(r++, bus_start, phys_start, pci_sz, - PCI_REGION_MEM | PCI_REGION_MEMORY | + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY | PCI_REGION_PREFETCH);
sz -= pci_sz; @@ -84,7 +84,7 @@ int fsl_pci_setup_inbound_windows(struct pci_region *r) debug ("R1 bus_start: %llx phys_start: %llx size: %llx\n", (u64)bus_start, (u64)phys_start, (u64)pci_sz); pci_set_region(r++, bus_start, phys_start, pci_sz, - PCI_REGION_MEM | PCI_REGION_MEMORY | + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY | PCI_REGION_PREFETCH); sz -= pci_sz; bus_start += pci_sz; @@ -108,7 +108,7 @@ int fsl_pci_setup_inbound_windows(struct pci_region *r) CONFIG_SYS_PCI64_MEMORY_BUS, CONFIG_SYS_PCI_MEMORY_PHYS, pci_sz, - PCI_REGION_MEM | PCI_REGION_MEMORY | + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY | PCI_REGION_PREFETCH); #else pci_sz = 1ull << __ilog2_u64(sz); @@ -116,7 +116,7 @@ int fsl_pci_setup_inbound_windows(struct pci_region *r) debug ("R2 bus_start: %llx phys_start: %llx size: %llx\n", (u64)bus_start, (u64)phys_start, (u64)pci_sz); pci_set_region(r++, bus_start, phys_start, pci_sz, - PCI_REGION_MEM | PCI_REGION_MEMORY | + PCI_REGION_MEM | PCI_REGION_SYS_MEMORY | PCI_REGION_PREFETCH); sz -= pci_sz; bus_start += pci_sz; @@ -157,7 +157,7 @@ void fsl_pci_init(struct pci_controller *hose)
for (r=0; r<hose->region_count; r++) { u32 sz = (__ilog2_u64((u64)hose->regions[r].size) - 1); - if (hose->regions[r].flags & PCI_REGION_MEMORY) { /* inbound */ + if (hose->regions[r].flags & PCI_REGION_SYS_MEMORY) { /* inbound */ u32 flag = PIWAR_EN | PIWAR_LOCAL | PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP; pi->pitar = (hose->regions[r].phys_start >> 12); diff --git a/drivers/pci/pci_ixp.c b/drivers/pci/pci_ixp.c index aae3d3d..3b303b4 100644 --- a/drivers/pci/pci_ixp.c +++ b/drivers/pci/pci_ixp.c @@ -240,7 +240,7 @@ void pci_ixp_init (struct pci_controller *hose) /* System memory space */ pci_set_region (hose->regions + 0, PCI_MEMORY_BUS, - PCI_MEMORY_PHY, PCI_MEMORY_SIZE, PCI_REGION_MEMORY); + PCI_MEMORY_PHY, PCI_MEMORY_SIZE, PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region (hose->regions + 1, diff --git a/drivers/pci/tsi108_pci.c b/drivers/pci/tsi108_pci.c index d153fc6..627e8a0 100644 --- a/drivers/pci/tsi108_pci.c +++ b/drivers/pci/tsi108_pci.c @@ -131,7 +131,7 @@ void pci_init_board (void) pci_set_region (hose->regions + 0, CONFIG_SYS_PCI_MEMORY_BUS, CONFIG_SYS_PCI_MEMORY_PHYS, - CONFIG_SYS_PCI_MEMORY_SIZE, PCI_REGION_MEM | PCI_REGION_MEMORY); + CONFIG_SYS_PCI_MEMORY_SIZE, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
/* PCI memory space */ pci_set_region (hose->regions + 1, diff --git a/include/pci.h b/include/pci.h index 072273b..35ff1e9 100644 --- a/include/pci.h +++ b/include/pci.h @@ -334,7 +334,7 @@ struct pci_region { #define PCI_REGION_TYPE 0x00000001 #define PCI_REGION_PREFETCH 0x00000008 /* prefetchable PCI memory */
-#define PCI_REGION_MEMORY 0x00000100 /* System memory */ +#define PCI_REGION_SYS_MEMORY 0x00000100 /* System memory */ #define PCI_REGION_RO 0x00000200 /* Read-only memory */
extern __inline__ void pci_set_region(struct pci_region *reg,

When we search for an address match in pci_hose_{phys_to_bus,bus_to_phys} we should give preference to memory regions that aren't system memory.
Its possible that we have over mapped system memory in the regions and we want to avoid depending on the order of the regions.
Signed-off-by: Kumar Gala galak@kernel.crashing.org --- drivers/pci/pci.c | 102 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 78 insertions(+), 24 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e2b05d8..06b56b0 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -218,67 +218,121 @@ pci_dev_t pci_find_device(unsigned int vendor, unsigned int device, int index) * */
-pci_addr_t pci_hose_phys_to_bus (struct pci_controller *hose, - phys_addr_t phys_addr, - unsigned long flags) +int __pci_hose_phys_to_bus (struct pci_controller *hose, + phys_addr_t phys_addr, + unsigned long flags, + unsigned long skip_mask, + pci_addr_t *ba) { struct pci_region *res; pci_addr_t bus_addr; int i;
- if (!hose) { - printf ("pci_hose_phys_to_bus: %s\n", "invalid hose"); - goto Done; - } - for (i = 0; i < hose->region_count; i++) { res = &hose->regions[i];
if (((res->flags ^ flags) & PCI_REGION_TYPE) != 0) continue;
+ if (res->flags & skip_mask) + continue; + bus_addr = phys_addr - res->phys_start + res->bus_start;
if (bus_addr >= res->bus_start && bus_addr < res->bus_start + res->size) { - return bus_addr; + *ba = bus_addr; + return 0; } }
- printf ("pci_hose_phys_to_bus: %s\n", "invalid physical address"); - -Done: - return 0; + return 1; }
-phys_addr_t pci_hose_bus_to_phys(struct pci_controller* hose, - pci_addr_t bus_addr, - unsigned long flags) +pci_addr_t pci_hose_phys_to_bus (struct pci_controller *hose, + phys_addr_t phys_addr, + unsigned long flags) { - struct pci_region *res; - int i; + pci_addr_t bus_addr = 0; + int ret;
if (!hose) { - printf ("pci_hose_bus_to_phys: %s\n", "invalid hose"); - goto Done; + puts ("pci_hose_phys_to_bus: invalid hose\n"); + return bus_addr; + } + + /* if PCI_REGION_MEM is set we do a two pass search with preference + * on matches that don't have PCI_REGION_SYS_MEMORY set */ + if ((flags & PCI_REGION_MEM) == PCI_REGION_MEM) { + ret = __pci_hose_phys_to_bus(hose, phys_addr, + flags, PCI_REGION_SYS_MEMORY, &bus_addr); + if (!ret) + return bus_addr; }
+ ret = __pci_hose_phys_to_bus(hose, phys_addr, flags, 0, &bus_addr); + + if (ret) + puts ("pci_hose_phys_to_bus: invalid physical address\n"); + + return bus_addr; +} + +int __pci_hose_bus_to_phys (struct pci_controller *hose, + pci_addr_t bus_addr, + unsigned long flags, + unsigned long skip_mask, + phys_addr_t *pa) +{ + struct pci_region *res; + int i; + for (i = 0; i < hose->region_count; i++) { res = &hose->regions[i];
if (((res->flags ^ flags) & PCI_REGION_TYPE) != 0) continue;
+ if (res->flags & skip_mask) + continue; + if (bus_addr >= res->bus_start && bus_addr < res->bus_start + res->size) { - return bus_addr - res->bus_start + res->phys_start; + *pa = (bus_addr - res->bus_start + res->phys_start); + return 0; } }
- printf ("pci_hose_bus_to_phys: %s\n", "invalid physical address"); + return 1; +}
-Done: - return 0; +phys_addr_t pci_hose_bus_to_phys(struct pci_controller* hose, + pci_addr_t bus_addr, + unsigned long flags) +{ + phys_addr_t phys_addr = 0; + int ret; + + if (!hose) { + puts ("pci_hose_bus_to_phys: invalid hose\n"); + return phys_addr; + } + + /* if PCI_REGION_MEM is set we do a two pass search with preference + * on matches that don't have PCI_REGION_SYS_MEMORY set */ + if ((flags & PCI_REGION_MEM) == PCI_REGION_MEM) { + ret = __pci_hose_bus_to_phys(hose, bus_addr, + flags, PCI_REGION_SYS_MEMORY, &phys_addr); + if (!ret) + return phys_addr; + } + + ret = __pci_hose_bus_to_phys(hose, bus_addr, flags, 0, &phys_addr); + + if (ret) + puts ("pci_hose_bus_to_phys: invalid physical address\n"); + + return phys_addr; }
/*

Dear Kumar Gala,
In message 1233935372-28001-2-git-send-email-galak@kernel.crashing.org you wrote:
When we search for an address match in pci_hose_{phys_to_bus,bus_to_phys} we should give preference to memory regions that aren't system memory.
Its possible that we have over mapped system memory in the regions and we want to avoid depending on the order of the regions.
Signed-off-by: Kumar Gala galak@kernel.crashing.org
drivers/pci/pci.c | 102 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 78 insertions(+), 24 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Dear Kumar Gala,
In message 1233935372-28001-1-git-send-email-galak@kernel.crashing.org you wrote:
The PCI_REGION_MEMORY and PCI_REGION_MEM are a bit to similar and can be confusing when reading the code.
Rename PCI_REGION_MEMORY to PCI_REGION_SYS_MEMORY to clarify its used for system memory mapping purposes.
Signed-off-by: Kumar Gala galak@kernel.crashing.org
board/MAI/AmigaOneG3SE/articiaS_pci.c | 2 +- board/ads5121/pci.c | 2 +- board/amirix/ap1000/pci.c | 2 +- board/armltd/integratorap/integratorap.c | 2 +- board/dave/common/pci.c | 2 +- board/eltec/bab7xx/pci.c | 2 +- board/eltec/elppc/pci.c | 2 +- board/esd/common/pci.c | 2 +- board/freescale/mpc832xemds/pci.c | 2 +- board/freescale/mpc8349itx/pci.c | 4 ++-- board/freescale/mpc8360emds/pci.c | 2 +- board/pcippc2/cpc710_pci.c | 4 ++-- board/ppmc7xx/pci.c | 2 +- board/sbc8349/pci.c | 4 ++-- board/sbc8548/sbc8548.c | 2 +- board/tb0229/vr4131-pci.c | 2 +- board/tqc/tqm834x/pci.c | 2 +- common/fdt_support.c | 4 ++-- cpu/i386/sc520.c | 2 +- cpu/mcf5445x/pci.c | 2 +- cpu/mcf547x_8x/pci.c | 2 +- cpu/mpc5xxx/pci_mpc5200.c | 2 +- cpu/mpc8220/pci.c | 2 +- cpu/mpc824x/pci.c | 2 +- cpu/mpc8260/pci.c | 4 ++-- cpu/mpc83xx/pci.c | 2 +- cpu/mpc83xx/pcie.c | 4 ++-- cpu/ppc4xx/4xx_pci.c | 4 ++-- drivers/pci/fsl_pci_init.c | 10 +++++----- drivers/pci/pci_ixp.c | 2 +- drivers/pci/tsi108_pci.c | 2 +- include/pci.h | 2 +- 32 files changed, 43 insertions(+), 43 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
participants (2)
-
Kumar Gala
-
Wolfgang Denk