* [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size
@ 2008-08-22 7:43 Ilya Yanok
2008-08-28 13:28 ` Josh Boyer
0 siblings, 1 reply; 6+ messages in thread
From: Ilya Yanok @ 2008-08-22 7:43 UTC (permalink / raw)
To: linuxppc-dev; +Cc: sr, wd, Ilya Yanok
1. total_memory should be phys_addr_t not unsigned long
2. 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>
---
arch/powerpc/sysdev/ppc4xx_pci.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index e1c7df9..645b2c9 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -36,7 +36,7 @@
static int dma_offset_set;
/* Move that to a useable header */
-extern unsigned long total_memory;
+extern phys_addr_t total_memory;
#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
@@ -105,7 +105,8 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
/* Default */
res->start = 0;
- res->end = size = 0x80000000;
+ size = 0x80000000;
+ res->end = size - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
/* Get dma-ranges property */
@@ -167,13 +168,13 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
*/
if (size < total_memory) {
printk(KERN_ERR "%s: dma-ranges too small "
- "(size=%llx total_memory=%lx)\n",
- hose->dn->full_name, size, total_memory);
+ "(size=%llx total_memory=%llx)\n",
+ hose->dn->full_name, size, (u64)total_memory);
return -ENXIO;
}
/* 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) {
printk(KERN_ERR "%s: dma-ranges unaligned\n",
hose->dn->full_name);
--
1.5.6.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size
2008-08-22 7:43 [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size Ilya Yanok
@ 2008-08-28 13:28 ` Josh Boyer
2008-08-28 14:18 ` Stefan Roese
2008-09-01 0:19 ` Benjamin Herrenschmidt
0 siblings, 2 replies; 6+ messages in thread
From: Josh Boyer @ 2008-08-28 13:28 UTC (permalink / raw)
To: Ilya Yanok, benh; +Cc: linuxppc-dev, sr, wd, Ilya Yanok
On Fri, 22 Aug 2008 11:43:35 +0400
Ilya Yanok <yanok@emcraft.com> wrote:
> 1. total_memory should be phys_addr_t not unsigned long
> 2. 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>
Ben, any comments here? Looks right to me.
josh
> ---
> arch/powerpc/sysdev/ppc4xx_pci.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
> index e1c7df9..645b2c9 100644
> --- a/arch/powerpc/sysdev/ppc4xx_pci.c
> +++ b/arch/powerpc/sysdev/ppc4xx_pci.c
> @@ -36,7 +36,7 @@
> static int dma_offset_set;
>
> /* Move that to a useable header */
> -extern unsigned long total_memory;
> +extern phys_addr_t total_memory;
>
> #define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
> #define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
> @@ -105,7 +105,8 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
>
> /* Default */
> res->start = 0;
> - res->end = size = 0x80000000;
> + size = 0x80000000;
> + res->end = size - 1;
> res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
>
> /* Get dma-ranges property */
> @@ -167,13 +168,13 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
> */
> if (size < total_memory) {
> printk(KERN_ERR "%s: dma-ranges too small "
> - "(size=%llx total_memory=%lx)\n",
> - hose->dn->full_name, size, total_memory);
> + "(size=%llx total_memory=%llx)\n",
> + hose->dn->full_name, size, (u64)total_memory);
> return -ENXIO;
> }
>
> /* 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) {
> printk(KERN_ERR "%s: dma-ranges unaligned\n",
> hose->dn->full_name);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size
2008-08-28 13:28 ` Josh Boyer
@ 2008-08-28 14:18 ` Stefan Roese
2008-09-01 0:19 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Roese @ 2008-08-28 14:18 UTC (permalink / raw)
To: linuxppc-dev; +Cc: wd, Ilya Yanok
On Thursday 28 August 2008, Josh Boyer wrote:
> > 1. total_memory should be phys_addr_t not unsigned long
> > 2. 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>
>
> Ben, any comments here? Looks right to me.
Looks good to me too. So:
Acked-by: Stefan Roese <sr@denx.de>
Best regards,
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size
2008-08-28 13:28 ` Josh Boyer
2008-08-28 14:18 ` Stefan Roese
@ 2008-09-01 0:19 ` Benjamin Herrenschmidt
2008-09-01 7:31 ` Ilya Yanok
1 sibling, 1 reply; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2008-09-01 0:19 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev, sr, wd, Ilya Yanok
On Thu, 2008-08-28 at 09:28 -0400, Josh Boyer wrote:
> On Fri, 22 Aug 2008 11:43:35 +0400
> Ilya Yanok <yanok@emcraft.com> wrote:
>
> > 1. total_memory should be phys_addr_t not unsigned long
> > 2. 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>
>
> Ben, any comments here? Looks right to me.
Just one minor comment... The patch should do what I failed to do
before, which is to move total_memory declaration to a header :-)
Cheers,
Ben.
> josh
>
> > ---
> > arch/powerpc/sysdev/ppc4xx_pci.c | 11 ++++++-----
> > 1 files changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
> > index e1c7df9..645b2c9 100644
> > --- a/arch/powerpc/sysdev/ppc4xx_pci.c
> > +++ b/arch/powerpc/sysdev/ppc4xx_pci.c
> > @@ -36,7 +36,7 @@
> > static int dma_offset_set;
> >
> > /* Move that to a useable header */
> > -extern unsigned long total_memory;
> > +extern phys_addr_t total_memory;
> >
> > #define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
> > #define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
> > @@ -105,7 +105,8 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
> >
> > /* Default */
> > res->start = 0;
> > - res->end = size = 0x80000000;
> > + size = 0x80000000;
> > + res->end = size - 1;
> > res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
> >
> > /* Get dma-ranges property */
> > @@ -167,13 +168,13 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
> > */
> > if (size < total_memory) {
> > printk(KERN_ERR "%s: dma-ranges too small "
> > - "(size=%llx total_memory=%lx)\n",
> > - hose->dn->full_name, size, total_memory);
> > + "(size=%llx total_memory=%llx)\n",
> > + hose->dn->full_name, size, (u64)total_memory);
> > return -ENXIO;
> > }
> >
> > /* 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) {
> > printk(KERN_ERR "%s: dma-ranges unaligned\n",
> > hose->dn->full_name);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size
2008-09-01 0:19 ` Benjamin Herrenschmidt
@ 2008-09-01 7:31 ` Ilya Yanok
2008-09-01 7:53 ` [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size (updated) Ilya Yanok
0 siblings, 1 reply; 6+ messages in thread
From: Ilya Yanok @ 2008-09-01 7:31 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, sr, wd
Benjamin Herrenschmidt wrote:
>>> 1. total_memory should be phys_addr_t not unsigned long
>>> 2. 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>
>>>
>> Ben, any comments here? Looks right to me.
>>
>
> Just one minor comment... The patch should do what I failed to do
> before, which is to move total_memory declaration to a header :-)
>
Hm... looks like we already have this declaration in
arch/powerpc/mm/mmu_decl.h... I'll send modified patch soon.
Regards, Ilya.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size (updated)
2008-09-01 7:31 ` Ilya Yanok
@ 2008-09-01 7:53 ` Ilya Yanok
0 siblings, 0 replies; 6+ messages in thread
From: Ilya Yanok @ 2008-09-01 7:53 UTC (permalink / raw)
To: linuxppc-dev, benh; +Cc: sr, wd, Ilya Yanok
1. declaration of total_memory removed. Now including <mm/mmu_decl.h>
instead.
2. 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>
---
arch/powerpc/sysdev/ppc4xx_pci.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index e1c7df9..e899716 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -30,14 +30,12 @@
#include <asm/machdep.h>
#include <asm/dcr.h>
#include <asm/dcr-regs.h>
+#include <mm/mmu_decl.h>
#include "ppc4xx_pci.h"
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_HIGH(val) ((u32)((val) >> 32))
@@ -105,7 +103,8 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
/* Default */
res->start = 0;
- res->end = size = 0x80000000;
+ size = 0x80000000;
+ res->end = size - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
/* Get dma-ranges property */
@@ -167,13 +166,13 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,
*/
if (size < total_memory) {
printk(KERN_ERR "%s: dma-ranges too small "
- "(size=%llx total_memory=%lx)\n",
- hose->dn->full_name, size, total_memory);
+ "(size=%llx total_memory=%llx)\n",
+ hose->dn->full_name, size, (u64)total_memory);
return -ENXIO;
}
/* 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) {
printk(KERN_ERR "%s: dma-ranges unaligned\n",
hose->dn->full_name);
--
1.5.6.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-09-01 7:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22 7:43 [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size Ilya Yanok
2008-08-28 13:28 ` Josh Boyer
2008-08-28 14:18 ` Stefan Roese
2008-09-01 0:19 ` Benjamin Herrenschmidt
2008-09-01 7:31 ` Ilya Yanok
2008-09-01 7:53 ` [PATCH] ppc4xx_pci: necessary fixes for 4GB RAM size (updated) Ilya Yanok
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.