Skip to content

Commit

Permalink
arm64: Remove asm/pgtable-*level-types.h files
Browse files Browse the repository at this point in the history
The macros and typedefs in these files are already duplicated, so just
use a single pgtable-types.h file with the corresponding #ifdefs.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Jungseok Lee <jungseoklee85@gmail.com>
  • Loading branch information
Catalin Marinas committed Jul 23, 2014
1 parent 6b4fee2 commit 0f17402
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 161 deletions.
8 changes: 1 addition & 7 deletions arch/arm64/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@

#ifndef __ASSEMBLY__

#if CONFIG_ARM64_PGTABLE_LEVELS == 2
#include <asm/pgtable-2level-types.h>
#elif CONFIG_ARM64_PGTABLE_LEVELS == 3
#include <asm/pgtable-3level-types.h>
#else
#include <asm/pgtable-4level-types.h>
#endif
#include <asm/pgtable-types.h>

extern void __cpu_clear_user_page(void *p, unsigned long user);
extern void __cpu_copy_user_page(void *to, const void *from,
Expand Down
62 changes: 0 additions & 62 deletions arch/arm64/include/asm/pgtable-2level-types.h

This file was deleted.

68 changes: 0 additions & 68 deletions arch/arm64/include/asm/pgtable-3level-types.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/*
* This program is free software; you can redistribute it and/or modify
* Page table types definitions.
*
* Copyright (C) 2014 ARM Ltd.
* Author: Catalin Marinas <catalin.marinas@arm.com>
*
* 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.
*
Expand All @@ -11,8 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASM_PGTABLE_4LEVEL_TYPES_H
#define __ASM_PGTABLE_4LEVEL_TYPES_H

#ifndef __ASM_PGTABLE_TYPES_H
#define __ASM_PGTABLE_TYPES_H

#include <asm/types.h>

Expand All @@ -29,43 +35,61 @@ typedef u64 pgdval_t;
* These are used to make use of C type-checking..
*/
typedef struct { pteval_t pte; } pte_t;
typedef struct { pmdval_t pmd; } pmd_t;
typedef struct { pudval_t pud; } pud_t;
typedef struct { pgdval_t pgd; } pgd_t;
typedef struct { pteval_t pgprot; } pgprot_t;

#define pte_val(x) ((x).pte)
#define pmd_val(x) ((x).pmd)
#define pud_val(x) ((x).pud)
#define pgd_val(x) ((x).pgd)
#define pgprot_val(x) ((x).pgprot)

#define __pte(x) ((pte_t) { (x) } )

#if CONFIG_ARM64_PGTABLE_LEVELS > 2
typedef struct { pmdval_t pmd; } pmd_t;
#define pmd_val(x) ((x).pmd)
#define __pmd(x) ((pmd_t) { (x) } )
#endif

#if CONFIG_ARM64_PGTABLE_LEVELS > 3
typedef struct { pudval_t pud; } pud_t;
#define pud_val(x) ((x).pud)
#define __pud(x) ((pud_t) { (x) } )
#endif

typedef struct { pgdval_t pgd; } pgd_t;
#define pgd_val(x) ((x).pgd)
#define __pgd(x) ((pgd_t) { (x) } )

typedef struct { pteval_t pgprot; } pgprot_t;
#define pgprot_val(x) ((x).pgprot)
#define __pgprot(x) ((pgprot_t) { (x) } )

#else /* !STRICT_MM_TYPECHECKS */

typedef pteval_t pte_t;
typedef pmdval_t pmd_t;
typedef pudval_t pud_t;
typedef pgdval_t pgd_t;
typedef pteval_t pgprot_t;

#define pte_val(x) (x)
#define pmd_val(x) (x)
#define pud_val(x) (x)
#define pgd_val(x) (x)
#define pgprot_val(x) (x)

#define __pte(x) (x)

#if CONFIG_ARM64_PGTABLE_LEVELS > 2
typedef pmdval_t pmd_t;
#define pmd_val(x) (x)
#define __pmd(x) (x)
#endif

#if CONFIG_ARM64_PGTABLE_LEVELS > 3
typedef pudval_t pud_t;
#define pud_val(x) (x)
#define __pud(x) (x)
#endif

typedef pgdval_t pgd_t;
#define pgd_val(x) (x)
#define __pgd(x) (x)

typedef pteval_t pgprot_t;
#define pgprot_val(x) (x)
#define __pgprot(x) (x)

#endif /* STRICT_MM_TYPECHECKS */

#endif /* __ASM_PGTABLE_4LEVEL_TYPES_H */
#if CONFIG_ARM64_PGTABLE_LEVELS == 2
#include <asm-generic/pgtable-nopmd.h>
#elif CONFIG_ARM64_PGTABLE_LEVELS == 3
#include <asm-generic/pgtable-nopud.h>
#endif

#endif /* __ASM_PGTABLE_TYPES_H */

0 comments on commit 0f17402

Please sign in to comment.