public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "bibo,mao" <bibo.mao@gmail.com>
To: Yinghai Lu <Yinghai.Lu@Sun.COM>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <ak@suse.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86_64: change early_ioremap to static
Date: Fri, 01 Jun 2007 19:38:09 +0800	[thread overview]
Message-ID: <46600521.8050005@gmail.com> (raw)
In-Reply-To: <200705311143.32171.yinghai.lu@sun.com>

hi yinghai,
   early_ioremap is useful for early firmware access such as efi
memory map table which does not reside at low memory address. efi patch
patch will use this function, initial efi patch has posted.

thanks
bibo,mao

Yinghai Lu wrote:
> [PATCH] x86_64: change early_ioremap to static
> 
> only dmi_scan_machine==>dmi_present==>dmi_table==>dmi_ioremap uses
> early_ioremap outside of mm/init.c
> dmi_scan_machine is called after init_memory_mappings, and could use
> ioremap instead.
> 
> Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
> 
> diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
> index 1336da8..8e3d14c 100644
> --- a/arch/x86_64/mm/init.c
> +++ b/arch/x86_64/mm/init.c
> @@ -174,37 +174,7 @@ __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
>  
>  unsigned long __meminitdata table_start, table_end;
>  
> -static __meminit void *alloc_low_page(unsigned long *phys)
> -{ 
> -	unsigned long pfn = table_end++;
> -	void *adr;
> -
> -	if (after_bootmem) {
> -		adr = (void *)get_zeroed_page(GFP_ATOMIC);
> -		*phys = __pa(adr);
> -		return adr;
> -	}
> -
> -	if (pfn >= end_pfn) 
> -		panic("alloc_low_page: ran out of memory"); 
> -
> -	adr = early_ioremap(pfn * PAGE_SIZE, PAGE_SIZE);
> -	memset(adr, 0, PAGE_SIZE);
> -	*phys  = pfn * PAGE_SIZE;
> -	return adr;
> -}
> -
> -static __meminit void unmap_low_page(void *adr)
> -{ 
> -
> -	if (after_bootmem)
> -		return;
> -
> -	early_iounmap(adr, PAGE_SIZE);
> -} 
> -
> -/* Must run before zap_low_mappings */
> -__meminit void *early_ioremap(unsigned long addr, unsigned long size)
> +static __meminit void *early_ioremap(unsigned long addr, unsigned long size)
>  {
>  	unsigned long vaddr;
>  	pmd_t *pmd, *last_pmd;
> @@ -233,7 +203,7 @@ __meminit void *early_ioremap(unsigned long addr, unsigned long size)
>  }
>  
>  /* To avoid virtual aliases later */
> -__meminit void early_iounmap(void *addr, unsigned long size)
> +static __meminit void early_iounmap(void *addr, unsigned long size)
>  {
>  	unsigned long vaddr;
>  	pmd_t *pmd;
> @@ -247,6 +217,35 @@ __meminit void early_iounmap(void *addr, unsigned long size)
>  	__flush_tlb();
>  }
>  
> +static __meminit void *alloc_low_page(unsigned long *phys)
> +{
> +	unsigned long pfn = table_end++;
> +	void *adr;
> +
> +	if (after_bootmem) {
> +		adr = (void *)get_zeroed_page(GFP_ATOMIC);
> +		*phys = __pa(adr);
> +		return adr;
> +	}
> +
> +	if (pfn >= end_pfn)
> +		panic("alloc_low_page: ran out of memory");
> +
> +	adr = early_ioremap(pfn * PAGE_SIZE, PAGE_SIZE);
> +	memset(adr, 0, PAGE_SIZE);
> +	*phys  = pfn * PAGE_SIZE;
> +	return adr;
> +}
> +
> +static __meminit void unmap_low_page(void *adr)
> +{
> +
> +	if (after_bootmem)
> +		return;
> +
> +	early_iounmap(adr, PAGE_SIZE);
> +}
> +
>  static void __meminit
>  phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
>  {
> diff --git a/include/asm-x86_64/dmi.h b/include/asm-x86_64/dmi.h
> index 93b2b15..fc7b576 100644
> --- a/include/asm-x86_64/dmi.h
> +++ b/include/asm-x86_64/dmi.h
> @@ -3,15 +3,12 @@
>  
>  #include <asm/io.h>
>  
> -extern void *dmi_ioremap(unsigned long addr, unsigned long size);
> -extern void dmi_iounmap(void *addr, unsigned long size);
> -
>  #define DMI_MAX_DATA 2048
>  
>  extern int dmi_alloc_index;
>  extern char dmi_alloc_data[DMI_MAX_DATA];
>  
> -/* This is so early that there is no good way to allocate dynamic memory. 
> +/* This is so early that there is no good way to allocate dynamic memory.
>     Allocate data in an BSS array. */
>  static inline void *dmi_alloc(unsigned len)
>  {
> @@ -21,7 +18,7 @@ static inline void *dmi_alloc(unsigned len)
>  	return dmi_alloc_data + idx;
>  }
>  
> -#define dmi_ioremap early_ioremap
> -#define dmi_iounmap early_iounmap
> +#define dmi_ioremap ioremap
> +#define dmi_iounmap(x,l) iounmap(x)
>  
>  #endif
> diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
> index de2cd9a..0898bdc 100644
> --- a/include/asm-x86_64/io.h
> +++ b/include/asm-x86_64/io.h
> @@ -134,9 +134,6 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
>  	return __ioremap(offset, size, 0);
>  }
>  
> -extern void *early_ioremap(unsigned long addr, unsigned long size);
> -extern void early_iounmap(void *addr, unsigned long size);
> -
>  /*
>   * This one maps high address device memory and turns off caching for that area.
>   * it's useful if some control registers are in such an area and write combining
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


      reply	other threads:[~2007-06-01 11:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 18:43 [PATCH] x86_64: change early_ioremap to static Yinghai Lu
2007-06-01 11:38 ` bibo,mao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46600521.8050005@gmail.com \
    --to=bibo.mao@gmail.com \
    --cc=Yinghai.Lu@Sun.COM \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox