mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 14:10:43 +00:00
x86: Move paging functions into cpu.c
These functions really don't belong in physmem as they relate to the cpu. Move them. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
6c499abe05
commit
7bddac947d
3 changed files with 60 additions and 30 deletions
|
@ -240,3 +240,38 @@ int icache_status(void)
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void cpu_enable_paging_pae(ulong cr3)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
/* Load the page table address */
|
||||
"movl %0, %%cr3\n"
|
||||
/* Enable pae */
|
||||
"movl %%cr4, %%eax\n"
|
||||
"orl $0x00000020, %%eax\n"
|
||||
"movl %%eax, %%cr4\n"
|
||||
/* Enable paging */
|
||||
"movl %%cr0, %%eax\n"
|
||||
"orl $0x80000000, %%eax\n"
|
||||
"movl %%eax, %%cr0\n"
|
||||
:
|
||||
: "r" (cr3)
|
||||
: "eax");
|
||||
}
|
||||
|
||||
void cpu_disable_paging_pae(void)
|
||||
{
|
||||
/* Turn off paging */
|
||||
__asm__ __volatile__ (
|
||||
/* Disable paging */
|
||||
"movl %%cr0, %%eax\n"
|
||||
"andl $0x7fffffff, %%eax\n"
|
||||
"movl %%eax, %%cr0\n"
|
||||
/* Disable pae */
|
||||
"movl %%cr4, %%eax\n"
|
||||
"andl $0xffffffdf, %%eax\n"
|
||||
"movl %%eax, %%cr4\n"
|
||||
:
|
||||
:
|
||||
: "eax");
|
||||
}
|
||||
|
|
22
arch/x86/include/asm/cpu.h
Normal file
22
arch/x86/include/asm/cpu.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2014 The Chromium OS Authors.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __X86_CPU_H
|
||||
#define __X86_CPU_H
|
||||
|
||||
/**
|
||||
* cpu_enable_paging_pae() - Enable PAE-paging
|
||||
*
|
||||
* @pdpt: Value to set in cr3 (PDPT or PML4T)
|
||||
*/
|
||||
void cpu_enable_paging_pae(ulong cr3);
|
||||
|
||||
/**
|
||||
* cpu_disable_paging_pae() - Disable paging and PAE
|
||||
*/
|
||||
void cpu_disable_paging_pae(void);
|
||||
|
||||
#endif
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <common.h>
|
||||
#include <physmem.h>
|
||||
#include <asm/cpu.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
@ -112,41 +113,13 @@ static void x86_phys_enter_paging(void)
|
|||
x86_phys_map_page(page_addr, page_addr, 0);
|
||||
}
|
||||
|
||||
/* Turn on paging */
|
||||
__asm__ __volatile__(
|
||||
/* Load the page table address */
|
||||
"movl %0, %%cr3\n\t"
|
||||
/* Enable pae */
|
||||
"movl %%cr4, %%eax\n\t"
|
||||
"orl $0x00000020, %%eax\n\t"
|
||||
"movl %%eax, %%cr4\n\t"
|
||||
/* Enable paging */
|
||||
"movl %%cr0, %%eax\n\t"
|
||||
"orl $0x80000000, %%eax\n\t"
|
||||
"movl %%eax, %%cr0\n\t"
|
||||
:
|
||||
: "r" (pdpt)
|
||||
: "eax"
|
||||
);
|
||||
cpu_enable_paging_pae((ulong)pdpt);
|
||||
}
|
||||
|
||||
/* Disable paging and PAE mode. */
|
||||
static void x86_phys_exit_paging(void)
|
||||
{
|
||||
/* Turn off paging */
|
||||
__asm__ __volatile__ (
|
||||
/* Disable paging */
|
||||
"movl %%cr0, %%eax\n\t"
|
||||
"andl $0x7fffffff, %%eax\n\t"
|
||||
"movl %%eax, %%cr0\n\t"
|
||||
/* Disable pae */
|
||||
"movl %%cr4, %%eax\n\t"
|
||||
"andl $0xffffffdf, %%eax\n\t"
|
||||
"movl %%eax, %%cr4\n\t"
|
||||
:
|
||||
:
|
||||
: "eax"
|
||||
);
|
||||
cpu_disable_paging_pae();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue