public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()
@ 2008-12-13 23:20 Kumar Gala
  2008-12-13 23:20 ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Kumar Gala
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Kumar Gala @ 2008-12-13 23:20 UTC (permalink / raw)
  To: u-boot

virt_to_phys() returns the physical address given a virtual.  In most cases
this will just the input value as the vast majority of systems run in a 1:1
mode.

However in systems that are not running this way it should report the
physical address or ~0 if no mapping exists for the given virtual address.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---

* No change, just reposting as part of the sequence

- k

 include/asm-arm/io.h        |    5 +++++
 include/asm-avr32/io.h      |    5 +++++
 include/asm-blackfin/io.h   |    5 +++++
 include/asm-i386/io.h       |    5 +++++
 include/asm-m68k/io.h       |    5 +++++
 include/asm-microblaze/io.h |    5 +++++
 include/asm-mips/io.h       |    2 +-
 include/asm-nios/io.h       |    5 +++++
 include/asm-nios2/io.h      |    5 +++++
 include/asm-ppc/io.h        |    5 +++++
 include/asm-sh/io.h         |    5 +++++
 include/asm-sparc/io.h      |    5 +++++
 12 files changed, 56 insertions(+), 1 deletions(-)

diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index f4ae307..fec3a7e 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -57,6 +57,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 /*
  * Generic virtual read/write.  Note that we don't support half-word
  * read/writes.  We define __arch_*[bl] here, and leave __arch_*w
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index 06e52b1..d22cd35 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -125,4 +125,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long len)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif /* __ASM_AVR32_IO_H */
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index da58914..6806494 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -64,6 +64,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 /*
  * These are for ISA/PCI shared memory _only_ and should never be used
  * on any other type of memory, including Zorro memory. They are meant to
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 2c57140..9b757d4 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -229,4 +229,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 1fccc12..50ea087 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -251,4 +251,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif				/* __ASM_M68K_IO_H__ */
diff --git a/include/asm-microblaze/io.h b/include/asm-microblaze/io.h
index 8804724..7e190d1 100644
--- a/include/asm-microblaze/io.h
+++ b/include/asm-microblaze/io.h
@@ -155,4 +155,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif /* __MICROBLAZE_IO_H__ */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 3a0f33f..031186d 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -118,7 +118,7 @@ static inline void set_io_port_base(unsigned long base)
  * Change virtual addresses to physical addresses and vv.
  * These are trivial on the 1:1 Linux/MIPS mapping
  */
-extern inline unsigned long virt_to_phys(volatile void * address)
+extern inline phys_addr_t virt_to_phys(void * address)
 {
 	return CPHYSADDR(address);
 }
diff --git a/include/asm-nios/io.h b/include/asm-nios/io.h
index 8b78806..899682c 100644
--- a/include/asm-nios/io.h
+++ b/include/asm-nios/io.h
@@ -133,4 +133,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif /* __ASM_NIOS_IO_H_ */
diff --git a/include/asm-nios2/io.h b/include/asm-nios2/io.h
index 2f1ec26..01d11ef 100644
--- a/include/asm-nios2/io.h
+++ b/include/asm-nios2/io.h
@@ -53,6 +53,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 extern unsigned char inb (unsigned char *port);
 extern unsigned short inw (unsigned short *port);
 extern unsigned inl (unsigned port);
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index c349681..c00de45 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -298,4 +298,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index adc3f81..ca598a6 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -261,5 +261,10 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* __ASM_SH_IO_H */
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index 5f8d05c..0c5d86c 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -90,4 +90,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+	return (phys_addr_t)(vaddr);
+}
+
 #endif
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 2/4] Introduce addr_map library
  2008-12-13 23:20 [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys() Kumar Gala
@ 2008-12-13 23:20 ` Kumar Gala
  2008-12-13 23:20   ` [U-Boot] [PATCH v4 3/4] 85xx: Add support to populate addr map based on TLB settings Kumar Gala
  2008-12-15 21:07   ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Wolfgang Denk
  2008-12-15 21:04 ` [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys() Wolfgang Denk
  2008-12-17 15:47 ` Haavard Skinnemoen
  2 siblings, 2 replies; 15+ messages in thread
From: Kumar Gala @ 2008-12-13 23:20 UTC (permalink / raw)
  To: u-boot

Add a library that helps in translating between virtual and physical
addresses.  This library can be useful as a simple means to implement
map_physmem() and virt_to_phys() for platforms that need functionality
beyond the simple 1:1 mapping.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
* Folded in Becky's phys_size_t changes

 include/addr_map.h     |   29 +++++++++++++++++
 lib_generic/Makefile   |    1 +
 lib_generic/addr_map.c |   81 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+), 0 deletions(-)
 create mode 100644 include/addr_map.h
 create mode 100644 lib_generic/addr_map.c

diff --git a/include/addr_map.h b/include/addr_map.h
new file mode 100644
index 0000000..d55f5f6
--- /dev/null
+++ b/include/addr_map.h
@@ -0,0 +1,29 @@
+#ifndef __ADDR_MAP_H
+#define __ADDR_MAP_H
+
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * Version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/types.h>
+
+extern phys_addr_t addrmap_virt_to_phys(void *vaddr);
+extern unsigned long addrmap_phys_to_virt(phys_addr_t paddr);
+extern void addrmap_set_entry(unsigned long vaddr, phys_addr_t paddr,
+				phys_size_t size, int idx);
+
+#endif
diff --git a/lib_generic/Makefile b/lib_generic/Makefile
index d62c39b..3f04022 100644
--- a/lib_generic/Makefile
+++ b/lib_generic/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libgeneric.a
 
+COBJS-$(CONFIG_ADDR_MAP) += addr_map.o
 COBJS-y += bzlib.o
 COBJS-y += bzlib_crctable.o
 COBJS-y += bzlib_decompress.o
diff --git a/lib_generic/addr_map.c b/lib_generic/addr_map.c
new file mode 100644
index 0000000..ff8532c
--- /dev/null
+++ b/lib_generic/addr_map.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * Version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <addr_map.h>
+
+static struct {
+	phys_addr_t paddr;
+	phys_size_t size;
+	unsigned long vaddr;
+} address_map[CONFIG_SYS_NUM_ADDR_MAP];
+
+phys_addr_t addrmap_virt_to_phys(void * vaddr)
+{
+	int i;
+
+	for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++) {
+		u64 base, upper, addr;
+
+		if (address_map[i].size == 0)
+			continue;
+
+		addr = (u64)((u32)vaddr);
+		base = (u64)(address_map[i].vaddr);
+		upper = (u64)(address_map[i].size) + base - 1;
+
+		if (addr >= base && addr <= upper) {
+			return addr - address_map[i].vaddr + address_map[i].paddr;
+		}
+	}
+
+	return (phys_addr_t)(~0);
+}
+
+unsigned long addrmap_phys_to_virt(phys_addr_t paddr)
+{
+	int i;
+
+	for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++) {
+		u64 base, upper, addr;
+
+		if (address_map[i].size == 0)
+			continue;
+
+		addr = (u64)paddr;
+		base = (u64)(address_map[i].paddr);
+		upper = (u64)(address_map[i].size) + base - 1;
+
+		if (addr >= base && addr <= upper) {
+			return paddr - address_map[i].paddr + address_map[i].vaddr;
+		}
+	}
+
+	return (unsigned long)(~0);
+}
+
+void addrmap_set_entry(unsigned long vaddr, phys_addr_t paddr,
+			phys_size_t size, int idx)
+{
+	if (idx > CONFIG_SYS_NUM_ADDR_MAP)
+		return;
+
+	address_map[idx].vaddr = vaddr;
+	address_map[idx].paddr = paddr;
+	address_map[idx].size  = size;
+}
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 3/4] 85xx: Add support to populate addr map based on TLB settings
  2008-12-13 23:20 ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Kumar Gala
@ 2008-12-13 23:20   ` Kumar Gala
  2008-12-13 23:20     ` [U-Boot] [PATCH v4 4/4] ppc: Use addrmap in virt_to_phys and map_physmem Kumar Gala
  2008-12-15 21:07   ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Wolfgang Denk
  1 sibling, 1 reply; 15+ messages in thread
From: Kumar Gala @ 2008-12-13 23:20 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
* Folded in Becky's phys_size_t changes

 cpu/mpc85xx/tlb.c     |   34 ++++++++++++++++++++++++++++++++++
 include/asm-ppc/mmu.h |    3 +++
 lib_ppc/board.c       |    8 ++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/cpu/mpc85xx/tlb.c b/cpu/mpc85xx/tlb.c
index a2d16ae..5b5f791 100644
--- a/cpu/mpc85xx/tlb.c
+++ b/cpu/mpc85xx/tlb.c
@@ -26,6 +26,11 @@
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
+#ifdef CONFIG_ADDR_MAP
+#include <addr_map.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
 
 void set_tlb(u8 tlb, u32 epn, u64 rpn,
 	     u8 perms, u8 wimge,
@@ -47,6 +52,11 @@ void set_tlb(u8 tlb, u32 epn, u64 rpn,
 	mtspr(MAS7, _mas7);
 #endif
 	asm volatile("isync;msync;tlbwe;isync");
+
+#ifdef CONFIG_ADDR_MAP
+	if ((tlb == 1) && (gd->flags & GD_FLG_RELOC))
+		addrmap_set_entry(epn, rpn, (1UL << ((tsize * 2) + 10)), esel);
+#endif
 }
 
 void disable_tlb(u8 esel)
@@ -67,6 +77,11 @@ void disable_tlb(u8 esel)
 	mtspr(MAS7, _mas7);
 #endif
 	asm volatile("isync;msync;tlbwe;isync");
+
+#ifdef CONFIG_ADDR_MAP
+	if (gd->flags & GD_FLG_RELOC)
+		addrmap_set_entry(0, 0, 0, esel);
+#endif
 }
 
 void invalidate_tlb(u8 tlb)
@@ -91,6 +106,25 @@ void init_tlbs(void)
 	return ;
 }
 
+#ifdef CONFIG_ADDR_MAP
+void init_addr_map(void)
+{
+	int i;
+
+	for (i = 0; i < num_tlb_entries; i++) {
+		if (tlb_table[i].tlb == 0)
+			continue;
+
+		addrmap_set_entry(tlb_table[i].epn,
+			tlb_table[i].rpn,
+			(1UL << ((tlb_table[i].tsize * 2) + 10)),
+			tlb_table[i].esel);
+	}
+
+	return ;
+}
+#endif
+
 unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg)
 {
 	unsigned int tlb_size;
diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
index 8975e6c..6d942d0 100644
--- a/include/asm-ppc/mmu.h
+++ b/include/asm-ppc/mmu.h
@@ -431,6 +431,9 @@ extern void set_tlb(u8 tlb, u32 epn, u64 rpn,
 extern void disable_tlb(u8 esel);
 extern void invalidate_tlb(u8 tlb);
 extern void init_tlbs(void);
+#ifdef CONFIG_ADDR_MAP
+extern void init_addr_map(void);
+#endif
 extern unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg);
 
 #define SET_TLB_ENTRY(_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, _iprot) \
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 289a32a..61c29b5 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -75,6 +75,10 @@
 #include <keyboard.h>
 #endif
 
+#ifdef CONFIG_ADDR_MAP
+#include <asm/mmu.h>
+#endif
+
 #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
 extern int update_flash_size (int flash_size);
 #endif
@@ -694,6 +698,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	 */
 	trap_init (dest_addr);
 
+#if defined(CONFIG_ADDR_MAP) && defined(CONFIG_E500)
+	init_addr_map();
+#endif
+
 #if defined(CONFIG_BOARD_EARLY_INIT_R)
 	board_early_init_r ();
 #endif
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 4/4] ppc: Use addrmap in virt_to_phys and map_physmem.
  2008-12-13 23:20   ` [U-Boot] [PATCH v4 3/4] 85xx: Add support to populate addr map based on TLB settings Kumar Gala
@ 2008-12-13 23:20     ` Kumar Gala
  0 siblings, 0 replies; 15+ messages in thread
From: Kumar Gala @ 2008-12-13 23:20 UTC (permalink / raw)
  To: u-boot

If we have addr map support enabled use the mapping functions to
implement virt_to_phys() and map_physmem().

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
* No change, just reposting as part of the sequence

 include/asm-ppc/io.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index c00de45..a8003ef 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -10,6 +10,10 @@
 #include <linux/config.h>
 #include <asm/byteorder.h>
 
+#ifdef CONFIG_ADDR_MAP
+#include <addr_map.h>
+#endif
+
 #define SIO_CONFIG_RA   0x398
 #define SIO_CONFIG_RD   0x399
 
@@ -287,7 +291,11 @@ extern inline void out_be32(volatile unsigned __iomem *addr, int val)
 static inline void *
 map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
 {
+#ifdef CONFIG_ADDR_MAP
+	return (void *)(addrmap_phys_to_virt(paddr));
+#else
 	return (void *)((unsigned long)paddr);
+#endif
 }
 
 /*
@@ -300,7 +308,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 static inline phys_addr_t virt_to_phys(void * vaddr)
 {
+#ifdef CONFIG_ADDR_MAP
+	return addrmap_virt_to_phys(vaddr);
+#else
 	return (phys_addr_t)(vaddr);
+#endif
 }
 
 #endif
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()
  2008-12-13 23:20 [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys() Kumar Gala
  2008-12-13 23:20 ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Kumar Gala
@ 2008-12-15 21:04 ` Wolfgang Denk
  2008-12-17 15:47 ` Haavard Skinnemoen
  2 siblings, 0 replies; 15+ messages in thread
From: Wolfgang Denk @ 2008-12-15 21:04 UTC (permalink / raw)
  To: u-boot

Dear Kumar Gala,

In message <1229210430-4522-1-git-send-email-galak@kernel.crashing.org> you wrote:
> virt_to_phys() returns the physical address given a virtual.  In most cases
> this will just the input value as the vast majority of systems run in a 1:1
> mode.
> 
> However in systems that are not running this way it should report the
> physical address or ~0 if no mapping exists for the given virtual address.
> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
> 
> * No change, just reposting as part of the sequence
> 
> - k
> 
>  include/asm-arm/io.h        |    5 +++++
>  include/asm-avr32/io.h      |    5 +++++
>  include/asm-blackfin/io.h   |    5 +++++
>  include/asm-i386/io.h       |    5 +++++
>  include/asm-m68k/io.h       |    5 +++++
>  include/asm-microblaze/io.h |    5 +++++
>  include/asm-mips/io.h       |    2 +-
>  include/asm-nios/io.h       |    5 +++++
>  include/asm-nios2/io.h      |    5 +++++
>  include/asm-ppc/io.h        |    5 +++++
>  include/asm-sh/io.h         |    5 +++++
>  include/asm-sparc/io.h      |    5 +++++
>  12 files changed, 56 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When you say "I wrote a program that crashed  Windows",  people  just
stare  at you blankly and say "Hey, I got those with the system, *for
free*".        - Linus Torvalds in <3itc77$9lj@ninurta.fer.uni-lj.si>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 2/4] Introduce addr_map library
  2008-12-13 23:20 ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Kumar Gala
  2008-12-13 23:20   ` [U-Boot] [PATCH v4 3/4] 85xx: Add support to populate addr map based on TLB settings Kumar Gala
@ 2008-12-15 21:07   ` Wolfgang Denk
  2008-12-15 21:12     ` Kumar Gala
  1 sibling, 1 reply; 15+ messages in thread
From: Wolfgang Denk @ 2008-12-15 21:07 UTC (permalink / raw)
  To: u-boot

Dear Kumar Gala,

In message <1229210430-4522-2-git-send-email-galak@kernel.crashing.org> you wrote:
> Add a library that helps in translating between virtual and physical
> addresses.  This library can be useful as a simple means to implement
> map_physmem() and virt_to_phys() for platforms that need functionality
> beyond the simple 1:1 mapping.
> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
> * Folded in Becky's phys_size_t changes
> 
>  include/addr_map.h     |   29 +++++++++++++++++
>  lib_generic/Makefile   |    1 +
>  lib_generic/addr_map.c |   81 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 111 insertions(+), 0 deletions(-)
>  create mode 100644 include/addr_map.h
>  create mode 100644 lib_generic/addr_map.c

Applied, thanks.

As discussed, I'll be leaving patches 3/4 and 4/4 of this series for
Andy to pick them up.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The joys of love made her human and the  agonies  of  love  destroyed
her.
	-- Spock, "Requiem for Methuselah", stardate 5842.8

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 2/4] Introduce addr_map library
  2008-12-15 21:07   ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Wolfgang Denk
@ 2008-12-15 21:12     ` Kumar Gala
  2008-12-16  0:46       ` Wolfgang Denk
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Gala @ 2008-12-15 21:12 UTC (permalink / raw)
  To: u-boot


On Dec 15, 2008, at 3:07 PM, Wolfgang Denk wrote:

> Dear Kumar Gala,
>
> In message <1229210430-4522-2-git-send-email- 
> galak at kernel.crashing.org> you wrote:
>> Add a library that helps in translating between virtual and physical
>> addresses.  This library can be useful as a simple means to implement
>> map_physmem() and virt_to_phys() for platforms that need  
>> functionality
>> beyond the simple 1:1 mapping.
>>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>> ---
>> * Folded in Becky's phys_size_t changes
>>
>> include/addr_map.h     |   29 +++++++++++++++++
>> lib_generic/Makefile   |    1 +
>> lib_generic/addr_map.c |   81 ++++++++++++++++++++++++++++++++++++++ 
>> ++++++++++
>> 3 files changed, 111 insertions(+), 0 deletions(-)
>> create mode 100644 include/addr_map.h
>> create mode 100644 lib_generic/addr_map.c
>
> Applied, thanks.
>
> As discussed, I'll be leaving patches 3/4 and 4/4 of this series for
> Andy to pick them up.

just to be clear are you thinking for this upcoming release or the one  
following it?

- k

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 2/4] Introduce addr_map library
  2008-12-15 21:12     ` Kumar Gala
@ 2008-12-16  0:46       ` Wolfgang Denk
  2008-12-16  3:33         ` Becky Bruce
  0 siblings, 1 reply; 15+ messages in thread
From: Wolfgang Denk @ 2008-12-16  0:46 UTC (permalink / raw)
  To: u-boot

Dear Kumar,

In message <8FDAD51E-151A-43C8-BFB2-101B8277EC74@kernel.crashing.org> you wrote:
> 
> On Dec 15, 2008, at 3:07 PM, Wolfgang Denk wrote:
> 
> > Dear Kumar Gala,
> >
> > In message <1229210430-4522-2-git-send-email- 
> > galak at kernel.crashing.org> you wrote:
> >> Add a library that helps in translating between virtual and physical
> >> addresses.  This library can be useful as a simple means to implement
> >> map_physmem() and virt_to_phys() for platforms that need  
> >> functionality
> >> beyond the simple 1:1 mapping.
> >>
> >> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> >> ---
> >> * Folded in Becky's phys_size_t changes
> >>
> >> include/addr_map.h     |   29 +++++++++++++++++
> >> lib_generic/Makefile   |    1 +
> >> lib_generic/addr_map.c |   81 ++++++++++++++++++++++++++++++++++++++ 
> >> ++++++++++
> >> 3 files changed, 111 insertions(+), 0 deletions(-)
> >> create mode 100644 include/addr_map.h
> >> create mode 100644 lib_generic/addr_map.c
> >
> > Applied, thanks.

I'm afraid your patch causes problems on the Katmai board:

Configuring for katmai board...
In file included from 44x_spd_ddr2.c:46:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from display_options.c:27:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from 4xx_pcie.c:32:
/home/wd/git/u-boot/work/include/asm-ppc/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm-ppc/io.h:303: warning: cast from pointer to integer of different size
In file included from bat_rw.c:28:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from commproc.c:29:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from denali_data_eye.c:38:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from denali_spd_ddr2.c:45:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from ecc.c:44:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from i2c.c:33:
/home/wd/git/u-boot/work/include/asm-ppc/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm-ppc/io.h:303: warning: cast from pointer to integer of different size
In file included from iop480_uart.c:27:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from tlb.c:30:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from 4xx_uart.c:47:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from gpio.c:26:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from miiphy.c:39:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from systemace.c:45:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from cfi_flash.c:39:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from eepro100.c:28:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from pci.c:35:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from 4xx_enet.c:84:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from pci_indirect.c:17:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from cmd_pcmcia.c:60:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from cmd_pci.c:35:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from memsize.c:30:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
In file included from katmai.c:32:
/home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
/home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from pointer to integer of different size
   text    data     bss     dec     hex filename
 268208   15484  127736  411428   64724 ./u-boot


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In matrimony, to hesitate is sometimes to be saved."        - Butler

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 2/4] Introduce addr_map library
  2008-12-16  0:46       ` Wolfgang Denk
@ 2008-12-16  3:33         ` Becky Bruce
  2008-12-16 15:55           ` Wolfgang Denk
  0 siblings, 1 reply; 15+ messages in thread
From: Becky Bruce @ 2008-12-16  3:33 UTC (permalink / raw)
  To: u-boot

On Dec 15, 2008, at 6:46 PM, Wolfgang Denk wrote:

> Dear Kumar,
>
> In message <8FDAD51E-151A-43C8- 
> BFB2-101B8277EC74 at kernel.crashing.org> you wrote:
>>
>> On Dec 15, 2008, at 3:07 PM, Wolfgang Denk wrote:
>>
>>> Dear Kumar Gala,
>>>
>>> In message <1229210430-4522-2-git-send-email-
>>> galak at kernel.crashing.org> you wrote:
>>>> Add a library that helps in translating between virtual and  
>>>> physical
>>>> addresses.  This library can be useful as a simple means to  
>>>> implement
>>>> map_physmem() and virt_to_phys() for platforms that need
>>>> functionality
>>>> beyond the simple 1:1 mapping.
>>>>
>>>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>>>> ---
>>>> * Folded in Becky's phys_size_t changes
>>>>
>>>> include/addr_map.h     |   29 +++++++++++++++++
>>>> lib_generic/Makefile   |    1 +
>>>> lib_generic/addr_map.c |   81 ++++++++++++++++++++++++++++++++++++ 
>>>> ++
>>>> ++++++++++
>>>> 3 files changed, 111 insertions(+), 0 deletions(-)
>>>> create mode 100644 include/addr_map.h
>>>> create mode 100644 lib_generic/addr_map.c
>>>
>>> Applied, thanks.
>
> I'm afraid your patch causes problems on the Katmai board:
>
> Configuring for katmai board...
> In file included from 44x_spd_ddr2.c:46:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size

There was a patch in my series that fixed this:

[PATCH 01/11] powerpc: fix io.h build warning with CONFIG_PHYS_64BIT

That really needs to become part of Kumar's series since katmai has  
64bit enabled.

-Becky

>
> In file included from display_options.c:27:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from 4xx_pcie.c:32:
> /home/wd/git/u-boot/work/include/asm-ppc/io.h: In function  
> 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm-ppc/io.h:303: warning: cast  
> from pointer to integer of different size
> In file included from bat_rw.c:28:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from commproc.c:29:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from denali_data_eye.c:38:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from denali_spd_ddr2.c:45:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from ecc.c:44:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from i2c.c:33:
> /home/wd/git/u-boot/work/include/asm-ppc/io.h: In function  
> 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm-ppc/io.h:303: warning: cast  
> from pointer to integer of different size
> In file included from iop480_uart.c:27:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from tlb.c:30:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from 4xx_uart.c:47:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from gpio.c:26:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from miiphy.c:39:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from systemace.c:45:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from cfi_flash.c:39:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from eepro100.c:28:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from pci.c:35:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from 4xx_enet.c:84:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from pci_indirect.c:17:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from cmd_pcmcia.c:60:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from cmd_pci.c:35:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from memsize.c:30:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
> In file included from katmai.c:32:
> /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> pointer to integer of different size
>   text    data     bss     dec     hex filename
> 268208   15484  127736  411428   64724 ./u-boot
>
>
> Best regards,
>
> Wolfgang Denk
>
> -- 
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> "In matrimony, to hesitate is sometimes to be saved."        - Butler
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 2/4] Introduce addr_map library
  2008-12-16  3:33         ` Becky Bruce
@ 2008-12-16 15:55           ` Wolfgang Denk
  0 siblings, 0 replies; 15+ messages in thread
From: Wolfgang Denk @ 2008-12-16 15:55 UTC (permalink / raw)
  To: u-boot

Dear Becky,

In message <6389DD2F-9A4E-4CAA-A1FE-8049391400A4@kernel.crashing.org> you wrote:
> 
...
> > Configuring for katmai board...
> > In file included from 44x_spd_ddr2.c:46:
> > /home/wd/git/u-boot/work/include/asm/io.h: In function 'virt_to_phys':
> > /home/wd/git/u-boot/work/include/asm/io.h:303: warning: cast from  
> > pointer to integer of different size
> 
> There was a patch in my series that fixed this:
> 
> [PATCH 01/11] powerpc: fix io.h build warning with CONFIG_PHYS_64BIT
> 
> That really needs to become part of Kumar's series since katmai has  
> 64bit enabled.

Thanks for the pointer. I'll pick up that patch now directly.


Hm...

Applying: powerpc: fix io.h build warning with CONFIG_PHYS_64BIT
error: patch failed: include/asm-ppc/io.h:311
error: include/asm-ppc/io.h: patch does not apply
fatal: sha1 information is lacking or useless (include/asm-ppc/io.h).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001.


Hm... manually applied.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Violence in reality is quite different from theory.
	-- Spock, "The Cloud Minders", stardate 5818.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()
  2008-12-13 23:20 [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys() Kumar Gala
  2008-12-13 23:20 ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Kumar Gala
  2008-12-15 21:04 ` [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys() Wolfgang Denk
@ 2008-12-17 15:47 ` Haavard Skinnemoen
  2008-12-17 15:55   ` Kumar Gala
  2 siblings, 1 reply; 15+ messages in thread
From: Haavard Skinnemoen @ 2008-12-17 15:47 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
> diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
> index 06e52b1..d22cd35 100644
> --- a/include/asm-avr32/io.h
> +++ b/include/asm-avr32/io.h
> @@ -125,4 +125,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long len)
>  
>  }
>  
> +static inline phys_addr_t virt_to_phys(void * vaddr)
> +{
> +	return (phys_addr_t)(vaddr);
> +}
> +

avr32 has already got one of those, so this breaks the build.

I'm going to apply the patch below to my 'fixes' branch if it looks ok
to you.

Haavard

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()
  2008-12-17 15:47 ` Haavard Skinnemoen
@ 2008-12-17 15:55   ` Kumar Gala
  2008-12-17 16:00     ` Haavard Skinnemoen
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Gala @ 2008-12-17 15:55 UTC (permalink / raw)
  To: u-boot


On Dec 17, 2008, at 9:47 AM, Haavard Skinnemoen wrote:

> Kumar Gala wrote:
>> diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
>> index 06e52b1..d22cd35 100644
>> --- a/include/asm-avr32/io.h
>> +++ b/include/asm-avr32/io.h
>> @@ -125,4 +125,9 @@ static inline void unmap_physmem(void *vaddr,  
>> unsigned long len)
>>
>> }
>>
>> +static inline phys_addr_t virt_to_phys(void * vaddr)
>> +{
>> +	return (phys_addr_t)(vaddr);
>> +}
>> +
>
> avr32 has already got one of those, so this breaks the build.
>
> I'm going to apply the patch below to my 'fixes' branch if it looks ok
> to you.

sorry about that.

>
>
> Haavard
>
> From 92c78a3bbcb2ce508b4bf1c4a1e0940406a024bb Mon Sep 17 00:00:00 2001
> From: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
> Date: Wed, 17 Dec 2008 16:43:18 +0100
> Subject: [PATCH] avr32: Remove second definition of virt_to_phys()
>
> The second definition introduced by 65e43a1063 conflicts with the
> existing one.
>
> Also, convert the existing definition to use phys_addr_t. The volatile
> qualifier is still needed due to brain damage elsewhere.
>
> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
> ---
> include/asm-avr32/io.h |    9 ++-------
> 1 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
> index d22cd35..50967ac 100644
> --- a/include/asm-avr32/io.h
> +++ b/include/asm-avr32/io.h
> @@ -76,12 +76,12 @@ extern void __readwrite_bug(const char *fn);
> #include <asm/addrspace.h>
>
> /* virt_to_phys will only work when address is in P1 or P2 */
> -static __inline__ unsigned long virt_to_phys(volatile void *address)
> +static inline phys_addr_t virt_to_phys(volatile void *address)
> {

Is the volatile really needed?

>
> 	return PHYSADDR(address);
> }
>
> -static __inline__ void * phys_to_virt(unsigned long address)
> +static inline void *phys_to_virt(phys_addr_t address)
> {
> 	return (void *)P1SEGADDR(address);
> }
> @@ -125,9 +125,4 @@ static inline void unmap_physmem(void *vaddr,  
> unsigned long len)
>
> }
>
> -static inline phys_addr_t virt_to_phys(void * vaddr)
> -{
> -	return (phys_addr_t)(vaddr);
> -}
> -
> #endif /* __ASM_AVR32_IO_H */
> -- 
> 1.5.6.3

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()
  2008-12-17 15:55   ` Kumar Gala
@ 2008-12-17 16:00     ` Haavard Skinnemoen
  2008-12-17 16:04       ` Kumar Gala
  0 siblings, 1 reply; 15+ messages in thread
From: Haavard Skinnemoen @ 2008-12-17 16:00 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
> > /* virt_to_phys will only work when address is in P1 or P2 */
> > -static __inline__ unsigned long virt_to_phys(volatile void *address)
> > +static inline phys_addr_t virt_to_phys(volatile void *address)
> > {  
> 
> Is the volatile really needed?

The problem is that the 'packet' parameter to struct eth_device.send()
is volatile, and it propagates into this function. So if I remove the
volatile, I have to either add ugly casts elsewhere or change the
eth_device API...

I have no idea why the network subsystem feels the need to enforce the
use of volatile in all drivers, though...

Haavard

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()
  2008-12-17 16:00     ` Haavard Skinnemoen
@ 2008-12-17 16:04       ` Kumar Gala
  2008-12-17 16:22         ` Haavard Skinnemoen
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Gala @ 2008-12-17 16:04 UTC (permalink / raw)
  To: u-boot


On Dec 17, 2008, at 10:00 AM, Haavard Skinnemoen wrote:

> Kumar Gala wrote:
>>> /* virt_to_phys will only work when address is in P1 or P2 */
>>> -static __inline__ unsigned long virt_to_phys(volatile void  
>>> *address)
>>> +static inline phys_addr_t virt_to_phys(volatile void *address)
>>> {
>>
>> Is the volatile really needed?
>
> The problem is that the 'packet' parameter to struct eth_device.send()
> is volatile, and it propagates into this function. So if I remove the
> volatile, I have to either add ugly casts elsewhere or change the
> eth_device API...
>
> I have no idea why the network subsystem feels the need to enforce the
> use of volatile in all drivers, though...

Lets go w/volatile for now and worry about this post v2009.01

- k

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()
  2008-12-17 16:04       ` Kumar Gala
@ 2008-12-17 16:22         ` Haavard Skinnemoen
  0 siblings, 0 replies; 15+ messages in thread
From: Haavard Skinnemoen @ 2008-12-17 16:22 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
> Lets go w/volatile for now and worry about this post v2009.01

Sounds good to me.

Haavard

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-12-17 16:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-13 23:20 [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys() Kumar Gala
2008-12-13 23:20 ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Kumar Gala
2008-12-13 23:20   ` [U-Boot] [PATCH v4 3/4] 85xx: Add support to populate addr map based on TLB settings Kumar Gala
2008-12-13 23:20     ` [U-Boot] [PATCH v4 4/4] ppc: Use addrmap in virt_to_phys and map_physmem Kumar Gala
2008-12-15 21:07   ` [U-Boot] [PATCH v4 2/4] Introduce addr_map library Wolfgang Denk
2008-12-15 21:12     ` Kumar Gala
2008-12-16  0:46       ` Wolfgang Denk
2008-12-16  3:33         ` Becky Bruce
2008-12-16 15:55           ` Wolfgang Denk
2008-12-15 21:04 ` [U-Boot] [PATCH v4 1/4] Introduce virt_to_phys() Wolfgang Denk
2008-12-17 15:47 ` Haavard Skinnemoen
2008-12-17 15:55   ` Kumar Gala
2008-12-17 16:00     ` Haavard Skinnemoen
2008-12-17 16:04       ` Kumar Gala
2008-12-17 16:22         ` Haavard Skinnemoen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox