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

Commit 2f47f447 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Paul Mundt
Browse files

sh: Support fixed 32-bit PMB mappings from bootloader.



This provides a method for supporting fixed PMB mappings inherited from
the bootloader, as an alternative to the dynamic PMB mapping currently
used by the kernel. In the future these methods will be combined.

P1/P2 area is handled like a regular 29-bit physical address, and local
bus device are assigned P3 area addresses.

Signed-off-by: default avatarYoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent a29b99ec
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -33,20 +33,24 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
$(obj)/compressed/vmlinux: FORCE
	$(Q)$(MAKE) $(build)=$(obj)/compressed $@

ifeq ($(CONFIG_32BIT),y)
KERNEL_LOAD	:= $(shell /bin/bash -c 'printf "0x%08x" \
		     $$[$(CONFIG_PAGE_OFFSET)  + \
			$(CONFIG_ZERO_PAGE_OFFSET)]')
else
KERNEL_MEMORY := 0x00000000
ifeq ($(CONFIG_PMB_FIXED),y)
KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
		     $$[$(CONFIG_MEMORY_START) & 0x1fffffff]')
endif
ifeq ($(CONFIG_29BIT),y)
KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
		     $$[$(CONFIG_MEMORY_START)]')
endif

KERNEL_LOAD	:= $(shell /bin/bash -c 'printf "0x%08x" \
		     $$[$(CONFIG_PAGE_OFFSET)  + \
			$(CONFIG_MEMORY_START) + \
			$(KERNEL_MEMORY) + \
			$(CONFIG_ZERO_PAGE_OFFSET)]')
endif

KERNEL_ENTRY	:= $(shell /bin/bash -c 'printf "0x%08x" \
		     $$[$(CONFIG_PAGE_OFFSET)  + \
			$(CONFIG_MEMORY_START) + \
			$(KERNEL_MEMORY) + \
			$(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')

quiet_cmd_uimage = UIMAGE  $@
+2 −2
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@
/* Returns the physical address of a PnSEG (n=1,2) address   */
#define PHYSADDR(a)	(((unsigned long)(a)) & 0x1fffffff)

#ifdef CONFIG_29BIT
#if defined(CONFIG_29BIT) || defined(CONFIG_PMB_FIXED)
/*
 * Map an address to a certain privileged segment
 */
@@ -43,7 +43,7 @@
	((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))
#define P4SEGADDR(a)	\
	((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))
#endif /* 29BIT */
#endif /* 29BIT || PMB_FIXED */
#endif /* P1SEG */

/* Check if an address can be reached in 29 bits */
+2 −2
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ extern void onchip_unmap(unsigned long vaddr);
static inline void __iomem *
__ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
{
#ifdef CONFIG_SUPERH32
#if defined(CONFIG_SUPERH32) && !defined(CONFIG_PMB_FIXED)
	unsigned long last_addr = offset + size - 1;
#endif
	void __iomem *ret;
@@ -247,7 +247,7 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
	if (ret)
		return ret;

#ifdef CONFIG_SUPERH32
#if defined(CONFIG_SUPERH32) && !defined(CONFIG_PMB_FIXED)
	/*
	 * For P1 and P2 space this is trivial, as everything is already
	 * mapped. Uncached access for P1 addresses are done through P2.
+6 −1
Original line number Diff line number Diff line
@@ -129,7 +129,12 @@ typedef struct page *pgtable_t;
 * is not visible (it is part of the PMB mapping) and so needs to be
 * added or subtracted as required.
 */
#ifdef CONFIG_32BIT
#if defined(CONFIG_PMB_FIXED)
/* phys = virt - PAGE_OFFSET - (__MEMORY_START & 0xe0000000) */
#define PMB_OFFSET	(PAGE_OFFSET - PXSEG(__MEMORY_START))
#define __pa(x)	((unsigned long)(x) - PMB_OFFSET)
#define __va(x)	((void *)((unsigned long)(x) + PMB_OFFSET))
#elif defined(CONFIG_32BIT)
#define __pa(x)	((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
#define __va(x)	((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
#else
+4 −1
Original line number Diff line number Diff line
@@ -15,7 +15,10 @@ OUTPUT_ARCH(sh)
ENTRY(_start)
SECTIONS
{
#ifdef CONFIG_32BIT
#ifdef CONFIG_PMB_FIXED
	. = CONFIG_PAGE_OFFSET + (CONFIG_MEMORY_START & 0x1fffffff) +
	    CONFIG_ZERO_PAGE_OFFSET;
#elif defined(CONFIG_32BIT)
	. = CONFIG_PAGE_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
#else
	. = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + CONFIG_ZERO_PAGE_OFFSET;
Loading