Skip to contentSkip to conversation

mips: implement to access the KSEG0/1 memory range in map_physmem

PATCH Superseded Wills Wang 2 participants 3 messages Jan 4, 2016 – Jan 5, 2016 MIPS

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Wills Wang

author
#0 lore raw

PATCH v6 1/10 mips: implement to access the KSEG0/1 memory range in map_physmem

U-boot just use the no MMU virtual address segment(KSEG0/1), this patch enable access the uncached memory range(KSEG1) by flag "MAP_NOCACHE", other flag for KSEG0 access.

---

Changes in v6:
- Remove useless "else"

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/mips/include/asm/io.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/mips/include/asm/io.h +4 -2
index a7ab087..77353e5 100644
@@ -485,7 +485,7 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-#define MAP_NOCACHE	(0)
+#define MAP_NOCACHE	(1)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
 #define MAP_WRTHROUGH	(0)
@@ -493,7 +493,9 @@ static inline void sync(void)
 static inline void *
 map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
 {
-	return (void *)paddr;
+	if (flags)
+		return (void *)KSEG1ADDR(paddr);
+	return (void *)KSEG0ADDR(paddr);
 }
 
 /*
Signature · 1 line
1.9.1
#1 lore raw

PATCH v6 1/10 mips: implement to access the KSEG0/1 memory range in map_physmem

Hi Wills,

Quoted 33 lines · Wills Wang

U-boot just use the no MMU virtual address segment(KSEG0/1), this patch enable access the uncached memory range(KSEG1) by flag "MAP_NOCACHE", other flag for KSEG0 access.

---

Changes in v6:
- Remove useless "else"

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

  arch/mips/include/asm/io.h | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
arch/mips/include/asm/io.h +1 -1
index a7ab087..77353e5 100644
@@ -485,7 +485,7 @@ static inline void sync(void)
   * that can be used to access the memory range with the caching
   * properties specified by "flags".
   */
-#define MAP_NOCACHE	(0)
+#define MAP_NOCACHE	(1)
  #define MAP_WRCOMBINE	(0)
  #define MAP_WRBACK	(0)
  #define MAP_WRTHROUGH	(0)

arch/mips/include/asm/io.h static inline void sync(void) · line 501

Quoted 10 lines
arch/mips/include/asm/io.h +3 -1
@@ -493,7 +493,9 @@ static inline void sync(void)
  static inline void *
  map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
  {
-	return (void *)paddr;
+	if (flags)
+		return (void *)KSEG1ADDR(paddr);
+	return (void *)KSEG0ADDR(paddr);
  }
 
  /*

But Daniel has suggested CKSEG1ADDR() instead. :)

Best regards,
Thomas

author
#2 lore raw

PATCH v6 1/10 mips: implement to access the KSEG0/1 memory range in map_physmem

Quoted 44 lines · Thomas Chou

Hi Wills,

Quoted 41 lines · Wills Wang

U-boot just use the no MMU virtual address segment(KSEG0/1), this patch enable access the uncached memory range(KSEG1) by flag "MAP_NOCACHE", other flag for KSEG0 access.

---

Changes in v6:
- Remove useless "else"

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

  arch/mips/include/asm/io.h | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
arch/mips/include/asm/io.h +4 -2
index a7ab087..77353e5 100644
@@ -485,7 +485,7 @@ static inline void sync(void)
   * that can be used to access the memory range with the caching
   * properties specified by "flags".
   */
-#define MAP_NOCACHE    (0)
+#define MAP_NOCACHE    (1)
  #define MAP_WRCOMBINE    (0)
  #define MAP_WRBACK    (0)
  #define MAP_WRTHROUGH    (0)
@@ -493,7 +493,9 @@ static inline void sync(void)
  static inline void *
  map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
  {
-    return (void *)paddr;
+    if (flags)
+        return (void *)KSEG1ADDR(paddr);
+    return (void *)KSEG0ADDR(paddr);
  }
 
Quoted 5 lines

arch/mips/include/asm/io.h static inline void sync(void) · line 501

Quoted 2 lines
arch/mips/include/asm/io.h +0 -0
  /*

But Daniel has suggested CKSEG1ADDR() instead. :)

I'm so sorry, i missed Daniel's email.
I will correct in the next patch.
Thomas, thank you for reminding me, or i lost an important information.

Quoted 2 lines

Best regards,
Thomas

Signature · 2 lines
Best Regards
Wills