Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc2e113b authored by Ilya Yanok's avatar Ilya Yanok Committed by Josh Boyer
Browse files

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: default avatarIlya Yanok <yanok@emcraft.com>
Acked-by: default avatarStefan Roese <sr@denx.de>
Signed-off-by: default avatarJosh Boyer <jwboyer@linux.vnet.ibm.com>
parent 38d56f16
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -30,14 +30,12 @@
#include <asm/machdep.h>
#include <asm/machdep.h>
#include <asm/dcr.h>
#include <asm/dcr.h>
#include <asm/dcr-regs.h>
#include <asm/dcr-regs.h>
#include <mm/mmu_decl.h>


#include "ppc4xx_pci.h"
#include "ppc4xx_pci.h"


static int dma_offset_set;
static int dma_offset_set;


/* Move that to a useable header */
extern unsigned long total_memory;

#define U64_TO_U32_LOW(val)	((u32)((val) & 0x00000000ffffffffULL))
#define U64_TO_U32_LOW(val)	((u32)((val) & 0x00000000ffffffffULL))
#define U64_TO_U32_HIGH(val)	((u32)((val) >> 32))
#define U64_TO_U32_HIGH(val)	((u32)((val) >> 32))


@@ -105,7 +103,8 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,


	/* Default */
	/* Default */
	res->start = 0;
	res->start = 0;
	res->end = size = 0x80000000;
	size = 0x80000000;
	res->end = size - 1;
	res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
	res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;


	/* Get dma-ranges property */
	/* Get dma-ranges property */
@@ -167,13 +166,13 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
	 */
	 */
	if (size < total_memory) {
	if (size < total_memory) {
		printk(KERN_ERR "%s: dma-ranges too small "
		printk(KERN_ERR "%s: dma-ranges too small "
		       "(size=%llx total_memory=%lx)\n",
		       "(size=%llx total_memory=%llx)\n",
		       hose->dn->full_name, size, total_memory);
		       hose->dn->full_name, size, (u64)total_memory);
		return -ENXIO;
		return -ENXIO;
	}
	}


	/* Check we are a power of 2 size and that base is a multiple of size*/
	/* Check we are a power of 2 size and that base is a multiple of size*/
	if (!is_power_of_2(size) ||
	if ((size & (size - 1)) != 0  ||
	    (res->start & (size - 1)) != 0) {
	    (res->start & (size - 1)) != 0) {
		printk(KERN_ERR "%s: dma-ranges unaligned\n",
		printk(KERN_ERR "%s: dma-ranges unaligned\n",
		       hose->dn->full_name);
		       hose->dn->full_name);