source: gpfs_3.1_ker2.6.20/lpp/mmfs/src/gpl-linux/arch-gpl.h @ 16

Last change on this file since 16 was 16, checked in by rock, 16 years ago
File size: 4.2 KB
Line 
1/***************************************************************************
2 *
3 * Copyright (C) 2001 International Business Machines
4 * All rights reserved.
5 *
6 * This file is part of the GPFS mmfslinux kernel module.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 *  1. Redistributions of source code must retain the above copyright notice,
13 *     this list of conditions and the following disclaimer.
14 *  2. Redistributions in binary form must reproduce the above copyright
15 *     notice, this list of conditions and the following disclaimer in the
16 *     documentation and/or other materials provided with the distribution.
17 *  3. The name of the author may not be used to endorse or promote products
18 *     derived from this software without specific prior written
19 *     permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *************************************************************************** */
33/* @(#)87       1.26  src/avs/fs/mmfs/ts/kernext/gpl-linux/arch-gpl.h, mmfs, avs_rgpfs24, rgpfs240610b 5/10/05 16:55:12 */
34#ifndef _h_arch_gpl
35#define _h_arch_gpl
36
37#define LEVEL_1 // uncomment to get privilege level 1 where the storage is
38                // NOT accessible by all users ???
39
40#if defined(GPFS_ARCH_IA64) || defined(GPFS_ARCH_PPC64) \
41      || defined(GPFS_ARCH_X86_64)
42#define PGD_OFFSET(mm, page) pgd_offset_k(page)
43#else
44#define PGD_OFFSET(mm, page) pgd_offset(mm, page)
45#endif
46
47#ifdef GPFS_ARCH_IA64
48/* In the kernel's mapped region we have a full 43 bit space available and
49   completely ignore the region number (since we know its in region number 5).*/
50#ifdef LEVEL_1
51#define PRIVILEGE_FLAGS _PAGE_PL_1           // privilege level 1
52#else
53#define PRIVILEGE_FLAGS _PAGE_PL_3           // privilege level 3(user)
54#endif
55#else   //GPFS_ARCH_I386
56#define PRIVILEGE_FLAGS _PAGE_USER
57#endif
58
59int kxSaveThreadInfo(int pid, void* reg);
60#ifdef GPFS_ARCH_IA64
61int set_privilege_level(unsigned long progLevel);
62int get_privilege_level();
63#else
64#define set_privilege_level(_a) 0
65#define get_privilege_level(_a) 0
66#endif
67
68#if LINUX_KERNEL_VERSION >= 2050000
69#include <asm/tlbflush.h>
70#endif
71
72/* General macros for flushing tlb entries */
73#if defined(GPFS_ARCH_POWER) || defined(GPFS_ARCH_PPC64) \
74      || defined(GPFS_ARCH_X86_64)
75#define FLUSH_TLB_PAGE(V,A)            NOOP //???
76#define FLUSH_TLB_RANGE(M,S,E)         NOOP //???
77#endif
78#ifdef GPFS_ARCH_I386
79#define FLUSH_TLB_PAGE(V,A)            flush_tlb_page(V,A)
80/* Temporary workaround for running i386 Linux distros on EM64T or x86-64
81   architecture; we need to flush the tlb on all cpus in this case
82   in a rather convoluted manner (vfree) after changing the protection bits.
83   This will go away with the use of pointer swizzling on ia32
84   in the near future. */
85#define FLUSH_TLB_RANGE(M,S,E) \
86        {   void *_tptr; \
87            _tptr = vmalloc(PAGE_SIZE); \
88            vfree(_tptr); \
89        }
90#define FLUSH_TLB_ALL()
91#endif /* GPFS_ARCH_I386 */
92
93#if defined(GPFS_ARCH_IA64)
94#define FLUSH_TLB_PAGE(V,A)            flush_tlb_page(V,A)
95#if LINUX_KERNEL_VERSION >= 2060500
96/* flush_tlb_range now uses vma struct instead of mm struct. */
97#define FLUSH_TLB_RANGE(M,S,E) \
98        { struct vm_area_struct vma; \
99          vma.vm_mm = M; \
100          flush_tlb_range(&vma,S,E); \
101        }
102#else
103#define FLUSH_TLB_RANGE(M,S,E)         flush_tlb_range(M,S,E)
104#endif /* LINUX_KERNEL_VERSION >= 2060500 */
105#define FLUSH_TLB_ALL()                flush_tlb_all()
106#endif /* GPFS_ARCH_IA64 */
107
108#endif /* _h_arch_gpl */
Note: See TracBrowser for help on using the repository browser.