~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/s390/include/asm/page.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
 */
91
91
 
92
92
typedef struct { unsigned long pgprot; } pgprot_t;
 
93
typedef struct { unsigned long pgste; } pgste_t;
93
94
typedef struct { unsigned long pte; } pte_t;
94
95
typedef struct { unsigned long pmd; } pmd_t;
95
96
typedef struct { unsigned long pud; } pud_t;
97
98
typedef pte_t *pgtable_t;
98
99
 
99
100
#define pgprot_val(x)   ((x).pgprot)
 
101
#define pgste_val(x)    ((x).pgste)
100
102
#define pte_val(x)      ((x).pte)
101
103
#define pmd_val(x)      ((x).pmd)
102
104
#define pud_val(x)      ((x).pud)
103
105
#define pgd_val(x)      ((x).pgd)
104
106
 
 
107
#define __pgste(x)      ((pgste_t) { (x) } )
105
108
#define __pte(x)        ((pte_t) { (x) } )
106
109
#define __pmd(x)        ((pmd_t) { (x) } )
 
110
#define __pud(x)        ((pud_t) { (x) } )
107
111
#define __pgd(x)        ((pgd_t) { (x) } )
108
112
#define __pgprot(x)     ((pgprot_t) { (x) } )
109
113
 
110
 
static inline void
111
 
page_set_storage_key(unsigned long addr, unsigned int skey, int mapped)
 
114
static inline void page_set_storage_key(unsigned long addr,
 
115
                                        unsigned char skey, int mapped)
112
116
{
113
117
        if (!mapped)
114
118
                asm volatile(".insn rrf,0xb22b0000,%0,%1,8,0"
117
121
                asm volatile("sske %0,%1" : : "d" (skey), "a" (addr));
118
122
}
119
123
 
120
 
static inline unsigned int
121
 
page_get_storage_key(unsigned long addr)
 
124
static inline unsigned char page_get_storage_key(unsigned long addr)
122
125
{
123
 
        unsigned int skey;
 
126
        unsigned char skey;
124
127
 
125
 
        asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0));
 
128
        asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr));
126
129
        return skey;
127
130
}
128
131
 
 
132
static inline int page_reset_referenced(unsigned long addr)
 
133
{
 
134
        unsigned int ipm;
 
135
 
 
136
        asm volatile(
 
137
                "       rrbe    0,%1\n"
 
138
                "       ipm     %0\n"
 
139
                : "=d" (ipm) : "a" (addr) : "cc");
 
140
        return !!(ipm & 0x20000000);
 
141
}
 
142
 
 
143
/* Bits int the storage key */
 
144
#define _PAGE_CHANGED           0x02    /* HW changed bit               */
 
145
#define _PAGE_REFERENCED        0x04    /* HW referenced bit            */
 
146
#define _PAGE_FP_BIT            0x08    /* HW fetch protection bit      */
 
147
#define _PAGE_ACC_BITS          0xf0    /* HW access control bits       */
 
148
 
 
149
/*
 
150
 * Test and clear dirty bit in storage key.
 
151
 * We can't clear the changed bit atomically. This is a potential
 
152
 * race against modification of the referenced bit. This function
 
153
 * should therefore only be called if it is not mapped in any
 
154
 * address space.
 
155
 */
 
156
#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
 
157
static inline int page_test_and_clear_dirty(unsigned long pfn, int mapped)
 
158
{
 
159
        unsigned char skey;
 
160
 
 
161
        skey = page_get_storage_key(pfn << PAGE_SHIFT);
 
162
        if (!(skey & _PAGE_CHANGED))
 
163
                return 0;
 
164
        page_set_storage_key(pfn << PAGE_SHIFT, skey & ~_PAGE_CHANGED, mapped);
 
165
        return 1;
 
166
}
 
167
 
 
168
/*
 
169
 * Test and clear referenced bit in storage key.
 
170
 */
 
171
#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
 
172
static inline int page_test_and_clear_young(unsigned long pfn)
 
173
{
 
174
        return page_reset_referenced(pfn << PAGE_SHIFT);
 
175
}
 
176
 
129
177
struct page;
130
178
void arch_free_page(struct page *page, int order);
131
179
void arch_alloc_page(struct page *page, int order);