aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Yanok <yanok@emcraft.com>2008-09-01 03:53:22 -0400
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2008-09-02 08:31:10 -0400
commitcc2e113b4bbd415d53d8bb87a446cde6b7ce8acc (patch)
treef55b955cf25703e604e3104dec04ec7c5ed9c1ea
parent38d56f1677130004497835a776feb84f068ce22a (diff)
powerpc/4xx: Necessary fixes to PCI for 4GB RAM size
The declaration of total_memory removed. Now including <mm/mmu_decl.h> instead. Since total_memory is a phys_addr_t which is 64-bit on 44x and is_power_of_2() works with u32 so I just inlined (size & (size-1)) != 0 instead. Also this patch fixes default initialization: res->end should be 0x7fffffff not 0x80000000. Signed-off-by: Ilya Yanok <yanok@emcraft.com> Acked-by: Stefan Roese <sr@denx.de> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index d5c345dbb89d..5da8a44ea2f6 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -30,14 +30,12 @@
30#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/dcr.h> 31#include <asm/dcr.h>
32#include <asm/dcr-regs.h> 32#include <asm/dcr-regs.h>
33#include <mm/mmu_decl.h>
33 34
34#include "ppc4xx_pci.h" 35#include "ppc4xx_pci.h"
35 36
36static int dma_offset_set; 37static int dma_offset_set;
37 38
38/* Move that to a useable header */
39extern unsigned long total_memory;
40
41#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL)) 39#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
42#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32)) 40#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
43 41
@@ -105,7 +103,8 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
105 103
106 /* Default */ 104 /* Default */
107 res->start = 0; 105 res->start = 0;
108 res->end = size = 0x80000000; 106 size = 0x80000000;
107 res->end = size - 1;
109 res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; 108 res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
110 109
111 /* Get dma-ranges property */ 110 /* Get dma-ranges property */
@@ -167,13 +166,13 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
167 */ 166 */
168 if (size < total_memory) { 167 if (size < total_memory) {
169 printk(KERN_ERR "%s: dma-ranges too small " 168 printk(KERN_ERR "%s: dma-ranges too small "
170 "(size=%llx total_memory=%lx)\n", 169 "(size=%llx total_memory=%llx)\n",
171 hose->dn->full_name, size, total_memory); 170 hose->dn->full_name, size, (u64)total_memory);
172 return -ENXIO; 171 return -ENXIO;
173 } 172 }
174 173
175 /* Check we are a power of 2 size and that base is a multiple of size*/ 174 /* Check we are a power of 2 size and that base is a multiple of size*/
176 if (!is_power_of_2(size) || 175 if ((size & (size - 1)) != 0 ||
177 (res->start & (size - 1)) != 0) { 176 (res->start & (size - 1)) != 0) {
178 printk(KERN_ERR "%s: dma-ranges unaligned\n", 177 printk(KERN_ERR "%s: dma-ranges unaligned\n",
179 hose->dn->full_name); 178 hose->dn->full_name);