aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-06-18 15:48:18 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-06-18 17:39:53 -0400
commit06f5013aa8eb5895ced2c71d13f5114103605555 (patch)
tree893dbbfc9eb6967b7a39fe51e3500338311531ee /arch
parent7bfd124d6dae7d394e73753300594a81a022fe7d (diff)
x86: convert almost generic headers to asm-generic version
In x86, mman.h, module.h, scatterlist.h, types.h and ucontext.h can use the asm-generic version by just defining the x86 specific parts locally and falling back on the generic code for the common bits. This patch illustrates the differences between the x86 and asm-generic versions by changing a file that is initially identical to the x86 version to one that is identical to the asm-generic version. Signed-off-by: Arnd Bergmann <arnd@arndb.de> LKML-Reference: <cover.1245354003.git.arnd@arndb.de> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/generic-mman.h8
-rw-r--r--arch/x86/include/asm/generic-module.h92
-rw-r--r--arch/x86/include/asm/generic-scatterlist.h34
-rw-r--r--arch/x86/include/asm/generic-types.h32
-rw-r--r--arch/x86/include/asm/generic-ucontext.h12
-rw-r--r--arch/x86/include/asm/mman.h14
-rw-r--r--arch/x86/include/asm/module.h13
-rw-r--r--arch/x86/include/asm/scatterlist.h27
-rw-r--r--arch/x86/include/asm/types.h12
-rw-r--r--arch/x86/include/asm/ucontext.h8
10 files changed, 73 insertions, 179 deletions
diff --git a/arch/x86/include/asm/generic-mman.h b/arch/x86/include/asm/generic-mman.h
index 751af2550ed9..7cab4de2bca6 100644
--- a/arch/x86/include/asm/generic-mman.h
+++ b/arch/x86/include/asm/generic-mman.h
@@ -1,10 +1,8 @@
1#ifndef _ASM_X86_MMAN_H 1#ifndef __ASM_GENERIC_MMAN_H
2#define _ASM_X86_MMAN_H 2#define __ASM_GENERIC_MMAN_H
3 3
4#include <asm-generic/mman-common.h> 4#include <asm-generic/mman-common.h>
5 5
6#define MAP_32BIT 0x40 /* only give out 32bit addresses */
7
8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
9#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
10#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
@@ -17,4 +15,4 @@
17#define MCL_CURRENT 1 /* lock all current mappings */ 15#define MCL_CURRENT 1 /* lock all current mappings */
18#define MCL_FUTURE 2 /* lock all future mappings */ 16#define MCL_FUTURE 2 /* lock all future mappings */
19 17
20#endif /* _ASM_X86_MMAN_H */ 18#endif /* __ASM_GENERIC_MMAN_H */
diff --git a/arch/x86/include/asm/generic-module.h b/arch/x86/include/asm/generic-module.h
index 47d62743c4d5..ed5b44de4c91 100644
--- a/arch/x86/include/asm/generic-module.h
+++ b/arch/x86/include/asm/generic-module.h
@@ -1,80 +1,22 @@
1#ifndef _ASM_X86_MODULE_H 1#ifndef __ASM_GENERIC_MODULE_H
2#define _ASM_X86_MODULE_H 2#define __ASM_GENERIC_MODULE_H
3 3
4/* x86_32/64 are simple */ 4/*
5struct mod_arch_specific {}; 5 * Many architectures just need a simple module
6 * loader without arch specific data.
7 */
8struct mod_arch_specific
9{
10};
6 11
7#ifdef CONFIG_X86_32 12#ifdef CONFIG_64BIT
8# define Elf_Shdr Elf32_Shdr 13#define Elf_Shdr Elf64_Shdr
9# define Elf_Sym Elf32_Sym 14#define Elf_Sym Elf64_Sym
10# define Elf_Ehdr Elf32_Ehdr 15#define Elf_Ehdr Elf64_Ehdr
11#else 16#else
12# define Elf_Shdr Elf64_Shdr 17#define Elf_Shdr Elf32_Shdr
13# define Elf_Sym Elf64_Sym 18#define Elf_Sym Elf32_Sym
14# define Elf_Ehdr Elf64_Ehdr 19#define Elf_Ehdr Elf32_Ehdr
15#endif 20#endif
16 21
17#ifdef CONFIG_X86_64 22#endif /* __ASM_GENERIC_MODULE_H */
18/* X86_64 does not define MODULE_PROC_FAMILY */
19#elif defined CONFIG_M386
20#define MODULE_PROC_FAMILY "386 "
21#elif defined CONFIG_M486
22#define MODULE_PROC_FAMILY "486 "
23#elif defined CONFIG_M586
24#define MODULE_PROC_FAMILY "586 "
25#elif defined CONFIG_M586TSC
26#define MODULE_PROC_FAMILY "586TSC "
27#elif defined CONFIG_M586MMX
28#define MODULE_PROC_FAMILY "586MMX "
29#elif defined CONFIG_MCORE2
30#define MODULE_PROC_FAMILY "CORE2 "
31#elif defined CONFIG_M686
32#define MODULE_PROC_FAMILY "686 "
33#elif defined CONFIG_MPENTIUMII
34#define MODULE_PROC_FAMILY "PENTIUMII "
35#elif defined CONFIG_MPENTIUMIII
36#define MODULE_PROC_FAMILY "PENTIUMIII "
37#elif defined CONFIG_MPENTIUMM
38#define MODULE_PROC_FAMILY "PENTIUMM "
39#elif defined CONFIG_MPENTIUM4
40#define MODULE_PROC_FAMILY "PENTIUM4 "
41#elif defined CONFIG_MK6
42#define MODULE_PROC_FAMILY "K6 "
43#elif defined CONFIG_MK7
44#define MODULE_PROC_FAMILY "K7 "
45#elif defined CONFIG_MK8
46#define MODULE_PROC_FAMILY "K8 "
47#elif defined CONFIG_X86_ELAN
48#define MODULE_PROC_FAMILY "ELAN "
49#elif defined CONFIG_MCRUSOE
50#define MODULE_PROC_FAMILY "CRUSOE "
51#elif defined CONFIG_MEFFICEON
52#define MODULE_PROC_FAMILY "EFFICEON "
53#elif defined CONFIG_MWINCHIPC6
54#define MODULE_PROC_FAMILY "WINCHIPC6 "
55#elif defined CONFIG_MWINCHIP3D
56#define MODULE_PROC_FAMILY "WINCHIP3D "
57#elif defined CONFIG_MCYRIXIII
58#define MODULE_PROC_FAMILY "CYRIXIII "
59#elif defined CONFIG_MVIAC3_2
60#define MODULE_PROC_FAMILY "VIAC3-2 "
61#elif defined CONFIG_MVIAC7
62#define MODULE_PROC_FAMILY "VIAC7 "
63#elif defined CONFIG_MGEODEGX1
64#define MODULE_PROC_FAMILY "GEODEGX1 "
65#elif defined CONFIG_MGEODE_LX
66#define MODULE_PROC_FAMILY "GEODE "
67#else
68#error unknown processor family
69#endif
70
71#ifdef CONFIG_X86_32
72# ifdef CONFIG_4KSTACKS
73# define MODULE_STACKSIZE "4KSTACKS "
74# else
75# define MODULE_STACKSIZE ""
76# endif
77# define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE
78#endif
79
80#endif /* _ASM_X86_MODULE_H */
diff --git a/arch/x86/include/asm/generic-scatterlist.h b/arch/x86/include/asm/generic-scatterlist.h
index 263d397d2eef..8b9454496a7c 100644
--- a/arch/x86/include/asm/generic-scatterlist.h
+++ b/arch/x86/include/asm/generic-scatterlist.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_X86_SCATTERLIST_H 1#ifndef __ASM_GENERIC_SCATTERLIST_H
2#define _ASM_X86_SCATTERLIST_H 2#define __ASM_GENERIC_SCATTERLIST_H
3 3
4#include <asm/types.h> 4#include <linux/types.h>
5 5
6struct scatterlist { 6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG 7#ifdef CONFIG_DEBUG_SG
@@ -14,20 +14,30 @@ struct scatterlist {
14 unsigned int dma_length; 14 unsigned int dma_length;
15}; 15};
16 16
17#define ARCH_HAS_SG_CHAIN
18#define ISA_DMA_THRESHOLD (0x00ffffff)
19
20/* 17/*
21 * These macros should be used after a pci_map_sg call has been done 18 * These macros should be used after a dma_map_sg call has been done
22 * to get bus addresses of each of the SG entries and their lengths. 19 * to get bus addresses of each of the SG entries and their lengths.
23 * You should only work with the number of sg entries pci_map_sg 20 * You should only work with the number of sg entries pci_map_sg
24 * returns. 21 * returns, or alternatively stop on the first sg_dma_len(sg) which
22 * is 0.
25 */ 23 */
26#define sg_dma_address(sg) ((sg)->dma_address) 24#define sg_dma_address(sg) ((sg)->dma_address)
27#ifdef CONFIG_X86_32 25#ifndef sg_dma_len
28# define sg_dma_len(sg) ((sg)->length) 26/*
27 * Normally, you have an iommu on 64 bit machines, but not on 32 bit
28 * machines. Architectures that are differnt should override this.
29 */
30#if __BITS_PER_LONG == 64
31#define sg_dma_len(sg) ((sg)->dma_length)
29#else 32#else
30# define sg_dma_len(sg) ((sg)->dma_length) 33#define sg_dma_len(sg) ((sg)->length)
34#endif /* 64 bit */
35#endif /* sg_dma_len */
36
37#ifndef ISA_DMA_THRESHOLD
38#define ISA_DMA_THRESHOLD (~0UL)
31#endif 39#endif
32 40
33#endif /* _ASM_X86_SCATTERLIST_H */ 41#define ARCH_HAS_SG_CHAIN
42
43#endif /* __ASM_GENERIC_SCATTERLIST_H */
diff --git a/arch/x86/include/asm/generic-types.h b/arch/x86/include/asm/generic-types.h
index 09b97745772f..fba7d33ca3f2 100644
--- a/arch/x86/include/asm/generic-types.h
+++ b/arch/x86/include/asm/generic-types.h
@@ -1,6 +1,9 @@
1#ifndef _ASM_X86_TYPES_H 1#ifndef _ASM_GENERIC_TYPES_H
2#define _ASM_X86_TYPES_H 2#define _ASM_GENERIC_TYPES_H
3 3/*
4 * int-ll64 is used practically everywhere now,
5 * so use it as a reasonable default.
6 */
4#include <asm-generic/int-ll64.h> 7#include <asm-generic/int-ll64.h>
5 8
6#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
@@ -13,18 +16,27 @@ typedef unsigned short umode_t;
13 * These aren't exported outside the kernel to avoid name space clashes 16 * These aren't exported outside the kernel to avoid name space clashes
14 */ 17 */
15#ifdef __KERNEL__ 18#ifdef __KERNEL__
16
17#ifndef __ASSEMBLY__ 19#ifndef __ASSEMBLY__
18 20/*
19typedef u64 dma64_addr_t; 21 * DMA addresses may be very different from physical addresses
20#if defined(CONFIG_X86_64) || defined(CONFIG_HIGHMEM64G) 22 * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit
21/* DMA addresses come in 32-bit and 64-bit flavours. */ 23 * systems, while sparc64 uses 32 bit DMA addresses for 64 bit
24 * physical addresses.
25 * This default defines dma_addr_t to have the same size as
26 * phys_addr_t, which is the most common way.
27 * Do not define the dma64_addr_t type, which never really
28 * worked.
29 */
30#ifndef dma_addr_t
31#ifdef CONFIG_PHYS_ADDR_T_64BIT
22typedef u64 dma_addr_t; 32typedef u64 dma_addr_t;
23#else 33#else
24typedef u32 dma_addr_t; 34typedef u32 dma_addr_t;
25#endif 35#endif /* CONFIG_PHYS_ADDR_T_64BIT */
36#endif /* dma_addr_t */
26 37
27#endif /* __ASSEMBLY__ */ 38#endif /* __ASSEMBLY__ */
39
28#endif /* __KERNEL__ */ 40#endif /* __KERNEL__ */
29 41
30#endif /* _ASM_X86_TYPES_H */ 42#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/arch/x86/include/asm/generic-ucontext.h b/arch/x86/include/asm/generic-ucontext.h
index 87324cf439d9..ad77343e8a9a 100644
--- a/arch/x86/include/asm/generic-ucontext.h
+++ b/arch/x86/include/asm/generic-ucontext.h
@@ -1,11 +1,5 @@
1#ifndef _ASM_X86_UCONTEXT_H 1#ifndef __ASM_GENERIC_UCONTEXT_H
2#define _ASM_X86_UCONTEXT_H 2#define __ASM_GENERIC_UCONTEXT_H
3
4#define UC_FP_XSTATE 0x1 /* indicates the presence of extended state
5 * information in the memory layout pointed
6 * by the fpstate pointer in the ucontext's
7 * sigcontext struct (uc_mcontext).
8 */
9 3
10struct ucontext { 4struct ucontext {
11 unsigned long uc_flags; 5 unsigned long uc_flags;
@@ -15,4 +9,4 @@ struct ucontext {
15 sigset_t uc_sigmask; /* mask last for extensibility */ 9 sigset_t uc_sigmask; /* mask last for extensibility */
16}; 10};
17 11
18#endif /* _ASM_X86_UCONTEXT_H */ 12#endif /* __ASM_GENERIC_UCONTEXT_H */
diff --git a/arch/x86/include/asm/mman.h b/arch/x86/include/asm/mman.h
index 751af2550ed9..063d8c9e4d60 100644
--- a/arch/x86/include/asm/mman.h
+++ b/arch/x86/include/asm/mman.h
@@ -1,20 +1,8 @@
1#ifndef _ASM_X86_MMAN_H 1#ifndef _ASM_X86_MMAN_H
2#define _ASM_X86_MMAN_H 2#define _ASM_X86_MMAN_H
3 3
4#include <asm-generic/mman-common.h>
5
6#define MAP_32BIT 0x40 /* only give out 32bit addresses */ 4#define MAP_32BIT 0x40 /* only give out 32bit addresses */
7 5
8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#include <asm/generic-mman.h>
9#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
10#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
11#define MAP_LOCKED 0x2000 /* pages are locked */
12#define MAP_NORESERVE 0x4000 /* don't check for reservations */
13#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
14#define MAP_NONBLOCK 0x10000 /* do not block on IO */
15#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
16
17#define MCL_CURRENT 1 /* lock all current mappings */
18#define MCL_FUTURE 2 /* lock all future mappings */
19 7
20#endif /* _ASM_X86_MMAN_H */ 8#endif /* _ASM_X86_MMAN_H */
diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h
index 47d62743c4d5..4a7a192910d0 100644
--- a/arch/x86/include/asm/module.h
+++ b/arch/x86/include/asm/module.h
@@ -1,18 +1,7 @@
1#ifndef _ASM_X86_MODULE_H 1#ifndef _ASM_X86_MODULE_H
2#define _ASM_X86_MODULE_H 2#define _ASM_X86_MODULE_H
3 3
4/* x86_32/64 are simple */ 4#include <asm/generic-module.h>
5struct mod_arch_specific {};
6
7#ifdef CONFIG_X86_32
8# define Elf_Shdr Elf32_Shdr
9# define Elf_Sym Elf32_Sym
10# define Elf_Ehdr Elf32_Ehdr
11#else
12# define Elf_Shdr Elf64_Shdr
13# define Elf_Sym Elf64_Sym
14# define Elf_Ehdr Elf64_Ehdr
15#endif
16 5
17#ifdef CONFIG_X86_64 6#ifdef CONFIG_X86_64
18/* X86_64 does not define MODULE_PROC_FAMILY */ 7/* X86_64 does not define MODULE_PROC_FAMILY */
diff --git a/arch/x86/include/asm/scatterlist.h b/arch/x86/include/asm/scatterlist.h
index 263d397d2eef..2097d686471d 100644
--- a/arch/x86/include/asm/scatterlist.h
+++ b/arch/x86/include/asm/scatterlist.h
@@ -1,33 +1,8 @@
1#ifndef _ASM_X86_SCATTERLIST_H 1#ifndef _ASM_X86_SCATTERLIST_H
2#define _ASM_X86_SCATTERLIST_H 2#define _ASM_X86_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 unsigned int length;
13 dma_addr_t dma_address;
14 unsigned int dma_length;
15};
16
17#define ARCH_HAS_SG_CHAIN
18#define ISA_DMA_THRESHOLD (0x00ffffff) 4#define ISA_DMA_THRESHOLD (0x00ffffff)
19 5
20/* 6#include <asm/generic-scatterlist.h>
21 * These macros should be used after a pci_map_sg call has been done
22 * to get bus addresses of each of the SG entries and their lengths.
23 * You should only work with the number of sg entries pci_map_sg
24 * returns.
25 */
26#define sg_dma_address(sg) ((sg)->dma_address)
27#ifdef CONFIG_X86_32
28# define sg_dma_len(sg) ((sg)->length)
29#else
30# define sg_dma_len(sg) ((sg)->dma_length)
31#endif
32 7
33#endif /* _ASM_X86_SCATTERLIST_H */ 8#endif /* _ASM_X86_SCATTERLIST_H */
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 09b97745772f..f2fe528e9682 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -1,19 +1,11 @@
1#ifndef _ASM_X86_TYPES_H 1#ifndef _ASM_X86_TYPES_H
2#define _ASM_X86_TYPES_H 2#define _ASM_X86_TYPES_H
3 3
4#include <asm-generic/int-ll64.h> 4#define dma_addr_t dma_addr_t
5 5
6#ifndef __ASSEMBLY__ 6#include <asm/generic-types.h>
7
8typedef unsigned short umode_t;
9 7
10#endif /* __ASSEMBLY__ */
11
12/*
13 * These aren't exported outside the kernel to avoid name space clashes
14 */
15#ifdef __KERNEL__ 8#ifdef __KERNEL__
16
17#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
18 10
19typedef u64 dma64_addr_t; 11typedef u64 dma64_addr_t;
diff --git a/arch/x86/include/asm/ucontext.h b/arch/x86/include/asm/ucontext.h
index 87324cf439d9..7cfc436f86da 100644
--- a/arch/x86/include/asm/ucontext.h
+++ b/arch/x86/include/asm/ucontext.h
@@ -7,12 +7,6 @@
7 * sigcontext struct (uc_mcontext). 7 * sigcontext struct (uc_mcontext).
8 */ 8 */
9 9
10struct ucontext { 10#include <asm/generic-ucontext.h>
11 unsigned long uc_flags;
12 struct ucontext *uc_link;
13 stack_t uc_stack;
14 struct sigcontext uc_mcontext;
15 sigset_t uc_sigmask; /* mask last for extensibility */
16};
17 11
18#endif /* _ASM_X86_UCONTEXT_H */ 12#endif /* _ASM_X86_UCONTEXT_H */