diff options
Diffstat (limited to 'include/asm-s390')
-rw-r--r-- | include/asm-s390/atomic.h | 12 | ||||
-rw-r--r-- | include/asm-s390/bitops.h | 4 | ||||
-rw-r--r-- | include/asm-s390/debug.h | 16 | ||||
-rw-r--r-- | include/asm-s390/ebcdic.h | 2 | ||||
-rw-r--r-- | include/asm-s390/elf.h | 1 | ||||
-rw-r--r-- | include/asm-s390/io.h | 8 | ||||
-rw-r--r-- | include/asm-s390/lowcore.h | 2 | ||||
-rw-r--r-- | include/asm-s390/mmu_context.h | 2 | ||||
-rw-r--r-- | include/asm-s390/pgtable.h | 69 | ||||
-rw-r--r-- | include/asm-s390/ptrace.h | 2 | ||||
-rw-r--r-- | include/asm-s390/rwsem.h | 5 | ||||
-rw-r--r-- | include/asm-s390/semaphore.h | 3 | ||||
-rw-r--r-- | include/asm-s390/setup.h | 50 | ||||
-rw-r--r-- | include/asm-s390/sigcontext.h | 2 | ||||
-rw-r--r-- | include/asm-s390/signal.h | 2 | ||||
-rw-r--r-- | include/asm-s390/sigp.h | 6 | ||||
-rw-r--r-- | include/asm-s390/smp.h | 2 | ||||
-rw-r--r-- | include/asm-s390/uaccess.h | 28 | ||||
-rw-r--r-- | include/asm-s390/unistd.h | 1 | ||||
-rw-r--r-- | include/asm-s390/vtoc.h | 505 |
20 files changed, 306 insertions, 416 deletions
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h index 9d86ba6f12d0..b3bd4f679f72 100644 --- a/include/asm-s390/atomic.h +++ b/include/asm-s390/atomic.h | |||
@@ -198,6 +198,18 @@ atomic_compare_and_swap(int expected_oldval,int new_val,atomic_t *v) | |||
198 | return retval; | 198 | return retval; |
199 | } | 199 | } |
200 | 200 | ||
201 | #define atomic_cmpxchg(v, o, n) (atomic_compare_and_swap((o), (n), &((v)->counter))) | ||
202 | |||
203 | #define atomic_add_unless(v, a, u) \ | ||
204 | ({ \ | ||
205 | int c, old; \ | ||
206 | c = atomic_read(v); \ | ||
207 | while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ | ||
208 | c = old; \ | ||
209 | c != (u); \ | ||
210 | }) | ||
211 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | ||
212 | |||
201 | #define smp_mb__before_atomic_dec() smp_mb() | 213 | #define smp_mb__before_atomic_dec() smp_mb() |
202 | #define smp_mb__after_atomic_dec() smp_mb() | 214 | #define smp_mb__after_atomic_dec() smp_mb() |
203 | #define smp_mb__before_atomic_inc() smp_mb() | 215 | #define smp_mb__before_atomic_inc() smp_mb() |
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index 8651524217fd..b07c578b22ea 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h | |||
@@ -518,8 +518,8 @@ static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr | |||
518 | 518 | ||
519 | static inline int | 519 | static inline int |
520 | __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { | 520 | __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { |
521 | return (((volatile char *) addr) | 521 | return ((((volatile char *) addr) |
522 | [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7))); | 522 | [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7)))) != 0; |
523 | } | 523 | } |
524 | 524 | ||
525 | #define test_bit(nr,addr) \ | 525 | #define test_bit(nr,addr) \ |
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h index 7127030ae162..23450ed4b571 100644 --- a/include/asm-s390/debug.h +++ b/include/asm-s390/debug.h | |||
@@ -129,7 +129,7 @@ void debug_set_level(debug_info_t* id, int new_level); | |||
129 | 129 | ||
130 | void debug_stop_all(void); | 130 | void debug_stop_all(void); |
131 | 131 | ||
132 | extern inline debug_entry_t* | 132 | static inline debug_entry_t* |
133 | debug_event(debug_info_t* id, int level, void* data, int length) | 133 | debug_event(debug_info_t* id, int level, void* data, int length) |
134 | { | 134 | { |
135 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 135 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
@@ -137,7 +137,7 @@ debug_event(debug_info_t* id, int level, void* data, int length) | |||
137 | return debug_event_common(id,level,data,length); | 137 | return debug_event_common(id,level,data,length); |
138 | } | 138 | } |
139 | 139 | ||
140 | extern inline debug_entry_t* | 140 | static inline debug_entry_t* |
141 | debug_int_event(debug_info_t* id, int level, unsigned int tag) | 141 | debug_int_event(debug_info_t* id, int level, unsigned int tag) |
142 | { | 142 | { |
143 | unsigned int t=tag; | 143 | unsigned int t=tag; |
@@ -146,7 +146,7 @@ debug_int_event(debug_info_t* id, int level, unsigned int tag) | |||
146 | return debug_event_common(id,level,&t,sizeof(unsigned int)); | 146 | return debug_event_common(id,level,&t,sizeof(unsigned int)); |
147 | } | 147 | } |
148 | 148 | ||
149 | extern inline debug_entry_t * | 149 | static inline debug_entry_t * |
150 | debug_long_event (debug_info_t* id, int level, unsigned long tag) | 150 | debug_long_event (debug_info_t* id, int level, unsigned long tag) |
151 | { | 151 | { |
152 | unsigned long t=tag; | 152 | unsigned long t=tag; |
@@ -155,7 +155,7 @@ debug_long_event (debug_info_t* id, int level, unsigned long tag) | |||
155 | return debug_event_common(id,level,&t,sizeof(unsigned long)); | 155 | return debug_event_common(id,level,&t,sizeof(unsigned long)); |
156 | } | 156 | } |
157 | 157 | ||
158 | extern inline debug_entry_t* | 158 | static inline debug_entry_t* |
159 | debug_text_event(debug_info_t* id, int level, const char* txt) | 159 | debug_text_event(debug_info_t* id, int level, const char* txt) |
160 | { | 160 | { |
161 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 161 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
@@ -168,7 +168,7 @@ debug_sprintf_event(debug_info_t* id,int level,char *string,...) | |||
168 | __attribute__ ((format(printf, 3, 4))); | 168 | __attribute__ ((format(printf, 3, 4))); |
169 | 169 | ||
170 | 170 | ||
171 | extern inline debug_entry_t* | 171 | static inline debug_entry_t* |
172 | debug_exception(debug_info_t* id, int level, void* data, int length) | 172 | debug_exception(debug_info_t* id, int level, void* data, int length) |
173 | { | 173 | { |
174 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 174 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
@@ -176,7 +176,7 @@ debug_exception(debug_info_t* id, int level, void* data, int length) | |||
176 | return debug_exception_common(id,level,data,length); | 176 | return debug_exception_common(id,level,data,length); |
177 | } | 177 | } |
178 | 178 | ||
179 | extern inline debug_entry_t* | 179 | static inline debug_entry_t* |
180 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) | 180 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) |
181 | { | 181 | { |
182 | unsigned int t=tag; | 182 | unsigned int t=tag; |
@@ -185,7 +185,7 @@ debug_int_exception(debug_info_t* id, int level, unsigned int tag) | |||
185 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); | 185 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); |
186 | } | 186 | } |
187 | 187 | ||
188 | extern inline debug_entry_t * | 188 | static inline debug_entry_t * |
189 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) | 189 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) |
190 | { | 190 | { |
191 | unsigned long t=tag; | 191 | unsigned long t=tag; |
@@ -194,7 +194,7 @@ debug_long_exception (debug_info_t* id, int level, unsigned long tag) | |||
194 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); | 194 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); |
195 | } | 195 | } |
196 | 196 | ||
197 | extern inline debug_entry_t* | 197 | static inline debug_entry_t* |
198 | debug_text_exception(debug_info_t* id, int level, const char* txt) | 198 | debug_text_exception(debug_info_t* id, int level, const char* txt) |
199 | { | 199 | { |
200 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) | 200 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h index 20e81e885821..4cbc336e4d60 100644 --- a/include/asm-s390/ebcdic.h +++ b/include/asm-s390/ebcdic.h | |||
@@ -21,7 +21,7 @@ extern __u8 _ebcasc[]; /* EBCDIC -> ASCII conversion table */ | |||
21 | extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ | 21 | extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ |
22 | extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ | 22 | extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ |
23 | 23 | ||
24 | extern __inline__ void | 24 | static inline void |
25 | codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) | 25 | codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) |
26 | { | 26 | { |
27 | if (nr-- <= 0) | 27 | if (nr-- <= 0) |
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h index 3b8bd46832a1..372d51cccd53 100644 --- a/include/asm-s390/elf.h +++ b/include/asm-s390/elf.h | |||
@@ -96,6 +96,7 @@ | |||
96 | * ELF register definitions.. | 96 | * ELF register definitions.. |
97 | */ | 97 | */ |
98 | 98 | ||
99 | #include <linux/sched.h> /* for task_struct */ | ||
99 | #include <asm/ptrace.h> | 100 | #include <asm/ptrace.h> |
100 | #include <asm/user.h> | 101 | #include <asm/user.h> |
101 | #include <asm/system.h> /* for save_access_regs */ | 102 | #include <asm/system.h> /* for save_access_regs */ |
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h index 8188fdc9884f..71f55eb2350a 100644 --- a/include/asm-s390/io.h +++ b/include/asm-s390/io.h | |||
@@ -24,7 +24,7 @@ | |||
24 | * Change virtual addresses to physical addresses and vv. | 24 | * Change virtual addresses to physical addresses and vv. |
25 | * These are pretty trivial | 25 | * These are pretty trivial |
26 | */ | 26 | */ |
27 | extern inline unsigned long virt_to_phys(volatile void * address) | 27 | static inline unsigned long virt_to_phys(volatile void * address) |
28 | { | 28 | { |
29 | unsigned long real_address; | 29 | unsigned long real_address; |
30 | __asm__ ( | 30 | __asm__ ( |
@@ -42,7 +42,7 @@ extern inline unsigned long virt_to_phys(volatile void * address) | |||
42 | return real_address; | 42 | return real_address; |
43 | } | 43 | } |
44 | 44 | ||
45 | extern inline void * phys_to_virt(unsigned long address) | 45 | static inline void * phys_to_virt(unsigned long address) |
46 | { | 46 | { |
47 | return __io_virt(address); | 47 | return __io_virt(address); |
48 | } | 48 | } |
@@ -54,7 +54,7 @@ extern inline void * phys_to_virt(unsigned long address) | |||
54 | 54 | ||
55 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); | 55 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); |
56 | 56 | ||
57 | extern inline void * ioremap (unsigned long offset, unsigned long size) | 57 | static inline void * ioremap (unsigned long offset, unsigned long size) |
58 | { | 58 | { |
59 | return __ioremap(offset, size, 0); | 59 | return __ioremap(offset, size, 0); |
60 | } | 60 | } |
@@ -64,7 +64,7 @@ extern inline void * ioremap (unsigned long offset, unsigned long size) | |||
64 | * it's useful if some control registers are in such an area and write combining | 64 | * it's useful if some control registers are in such an area and write combining |
65 | * or read caching is not desirable: | 65 | * or read caching is not desirable: |
66 | */ | 66 | */ |
67 | extern inline void * ioremap_nocache (unsigned long offset, unsigned long size) | 67 | static inline void * ioremap_nocache (unsigned long offset, unsigned long size) |
68 | { | 68 | { |
69 | return __ioremap(offset, size, 0); | 69 | return __ioremap(offset, size, 0); |
70 | } | 70 | } |
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index c6f51c9ce3ff..db0606c1abd4 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
@@ -346,7 +346,7 @@ struct _lowcore | |||
346 | #define S390_lowcore (*((struct _lowcore *) 0)) | 346 | #define S390_lowcore (*((struct _lowcore *) 0)) |
347 | extern struct _lowcore *lowcore_ptr[]; | 347 | extern struct _lowcore *lowcore_ptr[]; |
348 | 348 | ||
349 | extern __inline__ void set_prefix(__u32 address) | 349 | static inline void set_prefix(__u32 address) |
350 | { | 350 | { |
351 | __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); | 351 | __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); |
352 | } | 352 | } |
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h index 3a3bb3f2dad5..bcf24a873874 100644 --- a/include/asm-s390/mmu_context.h +++ b/include/asm-s390/mmu_context.h | |||
@@ -44,7 +44,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
44 | 44 | ||
45 | #define deactivate_mm(tsk,mm) do { } while (0) | 45 | #define deactivate_mm(tsk,mm) do { } while (0) |
46 | 46 | ||
47 | extern inline void activate_mm(struct mm_struct *prev, | 47 | static inline void activate_mm(struct mm_struct *prev, |
48 | struct mm_struct *next) | 48 | struct mm_struct *next) |
49 | { | 49 | { |
50 | switch_mm(prev, next, current); | 50 | switch_mm(prev, next, current); |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index df94f89038cc..859b5e969826 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/threads.h> | 36 | #include <linux/threads.h> |
37 | 37 | ||
38 | struct vm_area_struct; /* forward declaration (include/linux/mm.h) */ | 38 | struct vm_area_struct; /* forward declaration (include/linux/mm.h) */ |
39 | struct mm_struct; | ||
39 | 40 | ||
40 | extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); | 41 | extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); |
41 | extern void paging_init(void); | 42 | extern void paging_init(void); |
@@ -318,7 +319,7 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
318 | * within a page table are directly modified. Thus, the following | 319 | * within a page table are directly modified. Thus, the following |
319 | * hook is made available. | 320 | * hook is made available. |
320 | */ | 321 | */ |
321 | extern inline void set_pte(pte_t *pteptr, pte_t pteval) | 322 | static inline void set_pte(pte_t *pteptr, pte_t pteval) |
322 | { | 323 | { |
323 | *pteptr = pteval; | 324 | *pteptr = pteval; |
324 | } | 325 | } |
@@ -329,63 +330,63 @@ extern inline void set_pte(pte_t *pteptr, pte_t pteval) | |||
329 | */ | 330 | */ |
330 | #ifndef __s390x__ | 331 | #ifndef __s390x__ |
331 | 332 | ||
332 | extern inline int pgd_present(pgd_t pgd) { return 1; } | 333 | static inline int pgd_present(pgd_t pgd) { return 1; } |
333 | extern inline int pgd_none(pgd_t pgd) { return 0; } | 334 | static inline int pgd_none(pgd_t pgd) { return 0; } |
334 | extern inline int pgd_bad(pgd_t pgd) { return 0; } | 335 | static inline int pgd_bad(pgd_t pgd) { return 0; } |
335 | 336 | ||
336 | extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } | 337 | static inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } |
337 | extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } | 338 | static inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } |
338 | extern inline int pmd_bad(pmd_t pmd) | 339 | static inline int pmd_bad(pmd_t pmd) |
339 | { | 340 | { |
340 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE; | 341 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE; |
341 | } | 342 | } |
342 | 343 | ||
343 | #else /* __s390x__ */ | 344 | #else /* __s390x__ */ |
344 | 345 | ||
345 | extern inline int pgd_present(pgd_t pgd) | 346 | static inline int pgd_present(pgd_t pgd) |
346 | { | 347 | { |
347 | return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; | 348 | return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; |
348 | } | 349 | } |
349 | 350 | ||
350 | extern inline int pgd_none(pgd_t pgd) | 351 | static inline int pgd_none(pgd_t pgd) |
351 | { | 352 | { |
352 | return pgd_val(pgd) & _PGD_ENTRY_INV; | 353 | return pgd_val(pgd) & _PGD_ENTRY_INV; |
353 | } | 354 | } |
354 | 355 | ||
355 | extern inline int pgd_bad(pgd_t pgd) | 356 | static inline int pgd_bad(pgd_t pgd) |
356 | { | 357 | { |
357 | return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; | 358 | return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; |
358 | } | 359 | } |
359 | 360 | ||
360 | extern inline int pmd_present(pmd_t pmd) | 361 | static inline int pmd_present(pmd_t pmd) |
361 | { | 362 | { |
362 | return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; | 363 | return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; |
363 | } | 364 | } |
364 | 365 | ||
365 | extern inline int pmd_none(pmd_t pmd) | 366 | static inline int pmd_none(pmd_t pmd) |
366 | { | 367 | { |
367 | return pmd_val(pmd) & _PMD_ENTRY_INV; | 368 | return pmd_val(pmd) & _PMD_ENTRY_INV; |
368 | } | 369 | } |
369 | 370 | ||
370 | extern inline int pmd_bad(pmd_t pmd) | 371 | static inline int pmd_bad(pmd_t pmd) |
371 | { | 372 | { |
372 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; | 373 | return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; |
373 | } | 374 | } |
374 | 375 | ||
375 | #endif /* __s390x__ */ | 376 | #endif /* __s390x__ */ |
376 | 377 | ||
377 | extern inline int pte_none(pte_t pte) | 378 | static inline int pte_none(pte_t pte) |
378 | { | 379 | { |
379 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; | 380 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; |
380 | } | 381 | } |
381 | 382 | ||
382 | extern inline int pte_present(pte_t pte) | 383 | static inline int pte_present(pte_t pte) |
383 | { | 384 | { |
384 | return !(pte_val(pte) & _PAGE_INVALID) || | 385 | return !(pte_val(pte) & _PAGE_INVALID) || |
385 | (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; | 386 | (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; |
386 | } | 387 | } |
387 | 388 | ||
388 | extern inline int pte_file(pte_t pte) | 389 | static inline int pte_file(pte_t pte) |
389 | { | 390 | { |
390 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; | 391 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; |
391 | } | 392 | } |
@@ -396,12 +397,12 @@ extern inline int pte_file(pte_t pte) | |||
396 | * query functions pte_write/pte_dirty/pte_young only work if | 397 | * query functions pte_write/pte_dirty/pte_young only work if |
397 | * pte_present() is true. Undefined behaviour if not.. | 398 | * pte_present() is true. Undefined behaviour if not.. |
398 | */ | 399 | */ |
399 | extern inline int pte_write(pte_t pte) | 400 | static inline int pte_write(pte_t pte) |
400 | { | 401 | { |
401 | return (pte_val(pte) & _PAGE_RO) == 0; | 402 | return (pte_val(pte) & _PAGE_RO) == 0; |
402 | } | 403 | } |
403 | 404 | ||
404 | extern inline int pte_dirty(pte_t pte) | 405 | static inline int pte_dirty(pte_t pte) |
405 | { | 406 | { |
406 | /* A pte is neither clean nor dirty on s/390. The dirty bit | 407 | /* A pte is neither clean nor dirty on s/390. The dirty bit |
407 | * is in the storage key. See page_test_and_clear_dirty for | 408 | * is in the storage key. See page_test_and_clear_dirty for |
@@ -410,7 +411,7 @@ extern inline int pte_dirty(pte_t pte) | |||
410 | return 0; | 411 | return 0; |
411 | } | 412 | } |
412 | 413 | ||
413 | extern inline int pte_young(pte_t pte) | 414 | static inline int pte_young(pte_t pte) |
414 | { | 415 | { |
415 | /* A pte is neither young nor old on s/390. The young bit | 416 | /* A pte is neither young nor old on s/390. The young bit |
416 | * is in the storage key. See page_test_and_clear_young for | 417 | * is in the storage key. See page_test_and_clear_young for |
@@ -419,7 +420,7 @@ extern inline int pte_young(pte_t pte) | |||
419 | return 0; | 420 | return 0; |
420 | } | 421 | } |
421 | 422 | ||
422 | extern inline int pte_read(pte_t pte) | 423 | static inline int pte_read(pte_t pte) |
423 | { | 424 | { |
424 | /* All pages are readable since we don't use the fetch | 425 | /* All pages are readable since we don't use the fetch |
425 | * protection bit in the storage key. | 426 | * protection bit in the storage key. |
@@ -433,9 +434,9 @@ extern inline int pte_read(pte_t pte) | |||
433 | 434 | ||
434 | #ifndef __s390x__ | 435 | #ifndef __s390x__ |
435 | 436 | ||
436 | extern inline void pgd_clear(pgd_t * pgdp) { } | 437 | static inline void pgd_clear(pgd_t * pgdp) { } |
437 | 438 | ||
438 | extern inline void pmd_clear(pmd_t * pmdp) | 439 | static inline void pmd_clear(pmd_t * pmdp) |
439 | { | 440 | { |
440 | pmd_val(pmdp[0]) = _PAGE_TABLE_INV; | 441 | pmd_val(pmdp[0]) = _PAGE_TABLE_INV; |
441 | pmd_val(pmdp[1]) = _PAGE_TABLE_INV; | 442 | pmd_val(pmdp[1]) = _PAGE_TABLE_INV; |
@@ -445,12 +446,12 @@ extern inline void pmd_clear(pmd_t * pmdp) | |||
445 | 446 | ||
446 | #else /* __s390x__ */ | 447 | #else /* __s390x__ */ |
447 | 448 | ||
448 | extern inline void pgd_clear(pgd_t * pgdp) | 449 | static inline void pgd_clear(pgd_t * pgdp) |
449 | { | 450 | { |
450 | pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; | 451 | pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; |
451 | } | 452 | } |
452 | 453 | ||
453 | extern inline void pmd_clear(pmd_t * pmdp) | 454 | static inline void pmd_clear(pmd_t * pmdp) |
454 | { | 455 | { |
455 | pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; | 456 | pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; |
456 | pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; | 457 | pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; |
@@ -458,7 +459,7 @@ extern inline void pmd_clear(pmd_t * pmdp) | |||
458 | 459 | ||
459 | #endif /* __s390x__ */ | 460 | #endif /* __s390x__ */ |
460 | 461 | ||
461 | extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 462 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
462 | { | 463 | { |
463 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; | 464 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; |
464 | } | 465 | } |
@@ -467,14 +468,14 @@ extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt | |||
467 | * The following pte modification functions only work if | 468 | * The following pte modification functions only work if |
468 | * pte_present() is true. Undefined behaviour if not.. | 469 | * pte_present() is true. Undefined behaviour if not.. |
469 | */ | 470 | */ |
470 | extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 471 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
471 | { | 472 | { |
472 | pte_val(pte) &= PAGE_MASK; | 473 | pte_val(pte) &= PAGE_MASK; |
473 | pte_val(pte) |= pgprot_val(newprot); | 474 | pte_val(pte) |= pgprot_val(newprot); |
474 | return pte; | 475 | return pte; |
475 | } | 476 | } |
476 | 477 | ||
477 | extern inline pte_t pte_wrprotect(pte_t pte) | 478 | static inline pte_t pte_wrprotect(pte_t pte) |
478 | { | 479 | { |
479 | /* Do not clobber _PAGE_INVALID_NONE pages! */ | 480 | /* Do not clobber _PAGE_INVALID_NONE pages! */ |
480 | if (!(pte_val(pte) & _PAGE_INVALID)) | 481 | if (!(pte_val(pte) & _PAGE_INVALID)) |
@@ -482,13 +483,13 @@ extern inline pte_t pte_wrprotect(pte_t pte) | |||
482 | return pte; | 483 | return pte; |
483 | } | 484 | } |
484 | 485 | ||
485 | extern inline pte_t pte_mkwrite(pte_t pte) | 486 | static inline pte_t pte_mkwrite(pte_t pte) |
486 | { | 487 | { |
487 | pte_val(pte) &= ~_PAGE_RO; | 488 | pte_val(pte) &= ~_PAGE_RO; |
488 | return pte; | 489 | return pte; |
489 | } | 490 | } |
490 | 491 | ||
491 | extern inline pte_t pte_mkclean(pte_t pte) | 492 | static inline pte_t pte_mkclean(pte_t pte) |
492 | { | 493 | { |
493 | /* The only user of pte_mkclean is the fork() code. | 494 | /* The only user of pte_mkclean is the fork() code. |
494 | We must *not* clear the *physical* page dirty bit | 495 | We must *not* clear the *physical* page dirty bit |
@@ -497,7 +498,7 @@ extern inline pte_t pte_mkclean(pte_t pte) | |||
497 | return pte; | 498 | return pte; |
498 | } | 499 | } |
499 | 500 | ||
500 | extern inline pte_t pte_mkdirty(pte_t pte) | 501 | static inline pte_t pte_mkdirty(pte_t pte) |
501 | { | 502 | { |
502 | /* We do not explicitly set the dirty bit because the | 503 | /* We do not explicitly set the dirty bit because the |
503 | * sske instruction is slow. It is faster to let the | 504 | * sske instruction is slow. It is faster to let the |
@@ -506,7 +507,7 @@ extern inline pte_t pte_mkdirty(pte_t pte) | |||
506 | return pte; | 507 | return pte; |
507 | } | 508 | } |
508 | 509 | ||
509 | extern inline pte_t pte_mkold(pte_t pte) | 510 | static inline pte_t pte_mkold(pte_t pte) |
510 | { | 511 | { |
511 | /* S/390 doesn't keep its dirty/referenced bit in the pte. | 512 | /* S/390 doesn't keep its dirty/referenced bit in the pte. |
512 | * There is no point in clearing the real referenced bit. | 513 | * There is no point in clearing the real referenced bit. |
@@ -514,7 +515,7 @@ extern inline pte_t pte_mkold(pte_t pte) | |||
514 | return pte; | 515 | return pte; |
515 | } | 516 | } |
516 | 517 | ||
517 | extern inline pte_t pte_mkyoung(pte_t pte) | 518 | static inline pte_t pte_mkyoung(pte_t pte) |
518 | { | 519 | { |
519 | /* S/390 doesn't keep its dirty/referenced bit in the pte. | 520 | /* S/390 doesn't keep its dirty/referenced bit in the pte. |
520 | * There is no point in setting the real referenced bit. | 521 | * There is no point in setting the real referenced bit. |
@@ -694,7 +695,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) | |||
694 | #ifndef __s390x__ | 695 | #ifndef __s390x__ |
695 | 696 | ||
696 | /* Find an entry in the second-level page table.. */ | 697 | /* Find an entry in the second-level page table.. */ |
697 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | 698 | static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) |
698 | { | 699 | { |
699 | return (pmd_t *) dir; | 700 | return (pmd_t *) dir; |
700 | } | 701 | } |
@@ -757,7 +758,7 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
757 | #else | 758 | #else |
758 | #define __SWP_OFFSET_MASK (~0UL >> 11) | 759 | #define __SWP_OFFSET_MASK (~0UL >> 11) |
759 | #endif | 760 | #endif |
760 | extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | 761 | static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) |
761 | { | 762 | { |
762 | pte_t pte; | 763 | pte_t pte; |
763 | offset &= __SWP_OFFSET_MASK; | 764 | offset &= __SWP_OFFSET_MASK; |
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index fc7c96edc697..a949cc077cc7 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h | |||
@@ -468,6 +468,8 @@ struct user_regs_struct | |||
468 | }; | 468 | }; |
469 | 469 | ||
470 | #ifdef __KERNEL__ | 470 | #ifdef __KERNEL__ |
471 | #define __ARCH_SYS_PTRACE 1 | ||
472 | |||
471 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) | 473 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) |
472 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) | 474 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) |
473 | #define profile_pc(regs) instruction_pointer(regs) | 475 | #define profile_pc(regs) instruction_pointer(regs) |
diff --git a/include/asm-s390/rwsem.h b/include/asm-s390/rwsem.h index 8c0cebbfc034..0422a085dd56 100644 --- a/include/asm-s390/rwsem.h +++ b/include/asm-s390/rwsem.h | |||
@@ -351,5 +351,10 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) | |||
351 | return new; | 351 | return new; |
352 | } | 352 | } |
353 | 353 | ||
354 | static inline int rwsem_is_locked(struct rw_semaphore *sem) | ||
355 | { | ||
356 | return (sem->count != 0); | ||
357 | } | ||
358 | |||
354 | #endif /* __KERNEL__ */ | 359 | #endif /* __KERNEL__ */ |
355 | #endif /* _S390_RWSEM_H */ | 360 | #endif /* _S390_RWSEM_H */ |
diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h index 873def6f363a..702cf436698c 100644 --- a/include/asm-s390/semaphore.h +++ b/include/asm-s390/semaphore.h | |||
@@ -29,9 +29,6 @@ struct semaphore { | |||
29 | #define __SEMAPHORE_INITIALIZER(name,count) \ | 29 | #define __SEMAPHORE_INITIALIZER(name,count) \ |
30 | { ATOMIC_INIT(count), __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) } | 30 | { ATOMIC_INIT(count), __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) } |
31 | 31 | ||
32 | #define __MUTEX_INITIALIZER(name) \ | ||
33 | __SEMAPHORE_INITIALIZER(name,1) | ||
34 | |||
35 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ | 32 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ |
36 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | 33 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) |
37 | 34 | ||
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h index 0d51c484c2ea..348a88137445 100644 --- a/include/asm-s390/setup.h +++ b/include/asm-s390/setup.h | |||
@@ -8,11 +8,14 @@ | |||
8 | #ifndef _ASM_S390_SETUP_H | 8 | #ifndef _ASM_S390_SETUP_H |
9 | #define _ASM_S390_SETUP_H | 9 | #define _ASM_S390_SETUP_H |
10 | 10 | ||
11 | #include <asm/types.h> | ||
12 | |||
11 | #define PARMAREA 0x10400 | 13 | #define PARMAREA 0x10400 |
12 | #define COMMAND_LINE_SIZE 896 | 14 | #define COMMAND_LINE_SIZE 896 |
13 | #define RAMDISK_ORIGIN 0x800000 | 15 | #define RAMDISK_ORIGIN 0x800000 |
14 | #define RAMDISK_SIZE 0x800000 | 16 | #define RAMDISK_SIZE 0x800000 |
15 | #define MEMORY_CHUNKS 16 /* max 0x7fff */ | 17 | #define MEMORY_CHUNKS 16 /* max 0x7fff */ |
18 | #define IPL_PARMBLOCK_ORIGIN 0x2000 | ||
16 | 19 | ||
17 | #ifndef __ASSEMBLY__ | 20 | #ifndef __ASSEMBLY__ |
18 | 21 | ||
@@ -64,6 +67,53 @@ extern unsigned int console_irq; | |||
64 | #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) | 67 | #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) |
65 | #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) | 68 | #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) |
66 | 69 | ||
70 | struct ipl_list_header { | ||
71 | u32 length; | ||
72 | u8 reserved[3]; | ||
73 | u8 version; | ||
74 | } __attribute__((packed)); | ||
75 | |||
76 | struct ipl_block_fcp { | ||
77 | u32 length; | ||
78 | u8 pbt; | ||
79 | u8 reserved1[322-1]; | ||
80 | u16 devno; | ||
81 | u8 reserved2[4]; | ||
82 | u64 wwpn; | ||
83 | u64 lun; | ||
84 | u32 bootprog; | ||
85 | u8 reserved3[12]; | ||
86 | u64 br_lba; | ||
87 | u32 scp_data_len; | ||
88 | u8 reserved4[260]; | ||
89 | u8 scp_data[]; | ||
90 | } __attribute__((packed)); | ||
91 | |||
92 | struct ipl_parameter_block { | ||
93 | union { | ||
94 | u32 length; | ||
95 | struct ipl_list_header header; | ||
96 | } hdr; | ||
97 | struct ipl_block_fcp fcp; | ||
98 | } __attribute__((packed)); | ||
99 | |||
100 | #define IPL_MAX_SUPPORTED_VERSION (0) | ||
101 | |||
102 | #define IPL_TYPE_FCP (0) | ||
103 | |||
104 | /* | ||
105 | * IPL validity flags and parameters as detected in head.S | ||
106 | */ | ||
107 | extern u32 ipl_parameter_flags; | ||
108 | extern u16 ipl_devno; | ||
109 | |||
110 | #define IPL_DEVNO_VALID (ipl_parameter_flags & 1) | ||
111 | #define IPL_PARMBLOCK_VALID (ipl_parameter_flags & 2) | ||
112 | |||
113 | #define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ | ||
114 | IPL_PARMBLOCK_ORIGIN) | ||
115 | #define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.length) | ||
116 | |||
67 | #else | 117 | #else |
68 | 118 | ||
69 | #ifndef __s390x__ | 119 | #ifndef __s390x__ |
diff --git a/include/asm-s390/sigcontext.h b/include/asm-s390/sigcontext.h index d57bc0cebdce..803545351dd8 100644 --- a/include/asm-s390/sigcontext.h +++ b/include/asm-s390/sigcontext.h | |||
@@ -61,7 +61,7 @@ typedef struct | |||
61 | struct sigcontext | 61 | struct sigcontext |
62 | { | 62 | { |
63 | unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS]; | 63 | unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS]; |
64 | _sigregs *sregs; | 64 | _sigregs __user *sregs; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | 67 | ||
diff --git a/include/asm-s390/signal.h b/include/asm-s390/signal.h index 3d6e11c6c1fd..7084626de215 100644 --- a/include/asm-s390/signal.h +++ b/include/asm-s390/signal.h | |||
@@ -165,7 +165,7 @@ struct sigaction { | |||
165 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
166 | 166 | ||
167 | typedef struct sigaltstack { | 167 | typedef struct sigaltstack { |
168 | void *ss_sp; | 168 | void __user *ss_sp; |
169 | int ss_flags; | 169 | int ss_flags; |
170 | size_t ss_size; | 170 | size_t ss_size; |
171 | } stack_t; | 171 | } stack_t; |
diff --git a/include/asm-s390/sigp.h b/include/asm-s390/sigp.h index 3979bc3858e2..fc56458aff66 100644 --- a/include/asm-s390/sigp.h +++ b/include/asm-s390/sigp.h | |||
@@ -67,7 +67,7 @@ typedef enum | |||
67 | /* | 67 | /* |
68 | * Signal processor | 68 | * Signal processor |
69 | */ | 69 | */ |
70 | extern __inline__ sigp_ccode | 70 | static inline sigp_ccode |
71 | signal_processor(__u16 cpu_addr, sigp_order_code order_code) | 71 | signal_processor(__u16 cpu_addr, sigp_order_code order_code) |
72 | { | 72 | { |
73 | sigp_ccode ccode; | 73 | sigp_ccode ccode; |
@@ -86,7 +86,7 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code) | |||
86 | /* | 86 | /* |
87 | * Signal processor with parameter | 87 | * Signal processor with parameter |
88 | */ | 88 | */ |
89 | extern __inline__ sigp_ccode | 89 | static inline sigp_ccode |
90 | signal_processor_p(__u32 parameter, __u16 cpu_addr, | 90 | signal_processor_p(__u32 parameter, __u16 cpu_addr, |
91 | sigp_order_code order_code) | 91 | sigp_order_code order_code) |
92 | { | 92 | { |
@@ -107,7 +107,7 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr, | |||
107 | /* | 107 | /* |
108 | * Signal processor with parameter and return status | 108 | * Signal processor with parameter and return status |
109 | */ | 109 | */ |
110 | extern __inline__ sigp_ccode | 110 | static inline sigp_ccode |
111 | signal_processor_ps(__u32 *statusptr, __u32 parameter, | 111 | signal_processor_ps(__u32 *statusptr, __u32 parameter, |
112 | __u16 cpu_addr, sigp_order_code order_code) | 112 | __u16 cpu_addr, sigp_order_code order_code) |
113 | { | 113 | { |
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index dd50e57a928f..a2ae7628bbaa 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h | |||
@@ -52,7 +52,7 @@ extern int smp_call_function_on(void (*func) (void *info), void *info, | |||
52 | extern int smp_get_cpu(cpumask_t cpu_map); | 52 | extern int smp_get_cpu(cpumask_t cpu_map); |
53 | extern void smp_put_cpu(int cpu); | 53 | extern void smp_put_cpu(int cpu); |
54 | 54 | ||
55 | extern __inline__ __u16 hard_smp_processor_id(void) | 55 | static inline __u16 hard_smp_processor_id(void) |
56 | { | 56 | { |
57 | __u16 cpu_address; | 57 | __u16 cpu_address; |
58 | 58 | ||
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h index 38a5cf8ab9e3..10a619da4761 100644 --- a/include/asm-s390/uaccess.h +++ b/include/asm-s390/uaccess.h | |||
@@ -200,21 +200,37 @@ extern int __put_user_bad(void) __attribute__((noreturn)); | |||
200 | 200 | ||
201 | #define __get_user(x, ptr) \ | 201 | #define __get_user(x, ptr) \ |
202 | ({ \ | 202 | ({ \ |
203 | __typeof__(*(ptr)) __x; \ | ||
204 | int __gu_err; \ | 203 | int __gu_err; \ |
205 | __chk_user_ptr(ptr); \ | 204 | __chk_user_ptr(ptr); \ |
206 | switch (sizeof(*(ptr))) { \ | 205 | switch (sizeof(*(ptr))) { \ |
207 | case 1: \ | 206 | case 1: { \ |
208 | case 2: \ | 207 | unsigned char __x; \ |
209 | case 4: \ | 208 | __get_user_asm(__x, ptr, __gu_err); \ |
210 | case 8: \ | 209 | (x) = (__typeof__(*(ptr))) __x; \ |
210 | break; \ | ||
211 | }; \ | ||
212 | case 2: { \ | ||
213 | unsigned short __x; \ | ||
214 | __get_user_asm(__x, ptr, __gu_err); \ | ||
215 | (x) = (__typeof__(*(ptr))) __x; \ | ||
216 | break; \ | ||
217 | }; \ | ||
218 | case 4: { \ | ||
219 | unsigned int __x; \ | ||
220 | __get_user_asm(__x, ptr, __gu_err); \ | ||
221 | (x) = (__typeof__(*(ptr))) __x; \ | ||
222 | break; \ | ||
223 | }; \ | ||
224 | case 8: { \ | ||
225 | unsigned long long __x; \ | ||
211 | __get_user_asm(__x, ptr, __gu_err); \ | 226 | __get_user_asm(__x, ptr, __gu_err); \ |
227 | (x) = (__typeof__(*(ptr))) __x; \ | ||
212 | break; \ | 228 | break; \ |
229 | }; \ | ||
213 | default: \ | 230 | default: \ |
214 | __get_user_bad(); \ | 231 | __get_user_bad(); \ |
215 | break; \ | 232 | break; \ |
216 | } \ | 233 | } \ |
217 | (x) = __x; \ | ||
218 | __gu_err; \ | 234 | __gu_err; \ |
219 | }) | 235 | }) |
220 | 236 | ||
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index 221e965da924..f97d92691f17 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -590,7 +590,6 @@ asmlinkage long sys_clone(struct pt_regs regs); | |||
590 | asmlinkage long sys_fork(struct pt_regs regs); | 590 | asmlinkage long sys_fork(struct pt_regs regs); |
591 | asmlinkage long sys_vfork(struct pt_regs regs); | 591 | asmlinkage long sys_vfork(struct pt_regs regs); |
592 | asmlinkage long sys_pipe(unsigned long __user *fildes); | 592 | asmlinkage long sys_pipe(unsigned long __user *fildes); |
593 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data); | ||
594 | struct sigaction; | 593 | struct sigaction; |
595 | asmlinkage long sys_rt_sigaction(int sig, | 594 | asmlinkage long sys_rt_sigaction(int sig, |
596 | const struct sigaction __user *act, | 595 | const struct sigaction __user *act, |
diff --git a/include/asm-s390/vtoc.h b/include/asm-s390/vtoc.h index a14e34e80b88..41d369f38b0e 100644 --- a/include/asm-s390/vtoc.h +++ b/include/asm-s390/vtoc.h | |||
@@ -1,372 +1,179 @@ | |||
1 | #ifndef __KERNEL__ | 1 | /* |
2 | #include <string.h> | 2 | * include/asm-s390/vtoc.h |
3 | #include <stdlib.h> | 3 | * |
4 | #include <stdio.h> | 4 | * This file contains volume label definitions for DASD devices. |
5 | #include <errno.h> | 5 | * |
6 | #include <ctype.h> | 6 | * (C) Copyright IBM Corp. 2005 |
7 | #include <time.h> | 7 | * |
8 | #include <fcntl.h> | 8 | * Author(s): Volker Sameske <sameske@de.ibm.com> |
9 | #include <unistd.h> | 9 | * |
10 | */ | ||
11 | |||
12 | #ifndef _ASM_S390_VTOC_H | ||
13 | #define _ASM_S390_VTOC_H | ||
10 | 14 | ||
11 | #include <sys/stat.h> | ||
12 | #include <sys/ioctl.h> | ||
13 | |||
14 | #include <linux/fs.h> | ||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/hdreg.h> | ||
17 | #include <asm/dasd.h> | ||
18 | #endif | ||
19 | |||
20 | |||
21 | #define LINE_LENGTH 80 | ||
22 | #define VTOC_START_CC 0x0 | ||
23 | #define VTOC_START_HH 0x1 | ||
24 | #define FIRST_USABLE_CYL 1 | ||
25 | #define FIRST_USABLE_TRK 2 | ||
26 | |||
27 | #define DASD_3380_TYPE 13148 | ||
28 | #define DASD_3390_TYPE 13200 | ||
29 | #define DASD_9345_TYPE 37701 | ||
30 | |||
31 | #define DASD_3380_VALUE 0xbb60 | ||
32 | #define DASD_3390_VALUE 0xe5a2 | ||
33 | #define DASD_9345_VALUE 0xbc98 | ||
34 | |||
35 | #define VOLSER_LENGTH 6 | ||
36 | #define BIG_DISK_SIZE 0x10000 | ||
37 | |||
38 | #define VTOC_ERROR "VTOC error:" | ||
39 | |||
40 | 16 | ||
41 | typedef struct ttr | 17 | struct vtoc_ttr |
42 | { | 18 | { |
43 | __u16 tt; | 19 | __u16 tt; |
44 | __u8 r; | 20 | __u8 r; |
45 | } __attribute__ ((packed)) ttr_t; | 21 | } __attribute__ ((packed)); |
46 | 22 | ||
47 | typedef struct cchhb | 23 | struct vtoc_cchhb |
48 | { | 24 | { |
49 | __u16 cc; | 25 | __u16 cc; |
50 | __u16 hh; | 26 | __u16 hh; |
51 | __u8 b; | 27 | __u8 b; |
52 | } __attribute__ ((packed)) cchhb_t; | 28 | } __attribute__ ((packed)); |
53 | 29 | ||
54 | typedef struct cchh | 30 | struct vtoc_cchh |
55 | { | 31 | { |
56 | __u16 cc; | 32 | __u16 cc; |
57 | __u16 hh; | 33 | __u16 hh; |
58 | } __attribute__ ((packed)) cchh_t; | 34 | } __attribute__ ((packed)); |
59 | 35 | ||
60 | typedef struct labeldate | 36 | struct vtoc_labeldate |
61 | { | 37 | { |
62 | __u8 year; | 38 | __u8 year; |
63 | __u16 day; | 39 | __u16 day; |
64 | } __attribute__ ((packed)) labeldate_t; | 40 | } __attribute__ ((packed)); |
65 | 41 | ||
66 | 42 | struct vtoc_volume_label | |
67 | typedef struct volume_label | ||
68 | { | 43 | { |
69 | char volkey[4]; /* volume key = volume label */ | 44 | char volkey[4]; /* volume key = volume label */ |
70 | char vollbl[4]; /* volume label */ | 45 | char vollbl[4]; /* volume label */ |
71 | char volid[6]; /* volume identifier */ | 46 | char volid[6]; /* volume identifier */ |
72 | __u8 security; /* security byte */ | 47 | __u8 security; /* security byte */ |
73 | cchhb_t vtoc; /* VTOC address */ | 48 | struct vtoc_cchhb vtoc; /* VTOC address */ |
74 | char res1[5]; /* reserved */ | 49 | char res1[5]; /* reserved */ |
75 | char cisize[4]; /* CI-size for FBA,... */ | 50 | char cisize[4]; /* CI-size for FBA,... */ |
76 | /* ...blanks for CKD */ | 51 | /* ...blanks for CKD */ |
77 | char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */ | 52 | char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */ |
78 | char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ | 53 | char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ |
79 | char res2[4]; /* reserved */ | 54 | char res2[4]; /* reserved */ |
80 | char lvtoc[14]; /* owner code for LVTOC */ | 55 | char lvtoc[14]; /* owner code for LVTOC */ |
81 | char res3[29]; /* reserved */ | 56 | char res3[29]; /* reserved */ |
82 | } __attribute__ ((packed)) volume_label_t; | 57 | } __attribute__ ((packed)); |
83 | 58 | ||
84 | 59 | struct vtoc_extent | |
85 | typedef struct extent | ||
86 | { | 60 | { |
87 | __u8 typeind; /* extent type indicator */ | 61 | __u8 typeind; /* extent type indicator */ |
88 | __u8 seqno; /* extent sequence number */ | 62 | __u8 seqno; /* extent sequence number */ |
89 | cchh_t llimit; /* starting point of this extent */ | 63 | struct vtoc_cchh llimit; /* starting point of this extent */ |
90 | cchh_t ulimit; /* ending point of this extent */ | 64 | struct vtoc_cchh ulimit; /* ending point of this extent */ |
91 | } __attribute__ ((packed)) extent_t; | 65 | } __attribute__ ((packed)); |
92 | |||
93 | 66 | ||
94 | typedef struct dev_const | 67 | struct vtoc_dev_const |
95 | { | 68 | { |
96 | __u16 DS4DSCYL; /* number of logical cyls */ | 69 | __u16 DS4DSCYL; /* number of logical cyls */ |
97 | __u16 DS4DSTRK; /* number of tracks in a logical cylinder */ | 70 | __u16 DS4DSTRK; /* number of tracks in a logical cylinder */ |
98 | __u16 DS4DEVTK; /* device track length */ | 71 | __u16 DS4DEVTK; /* device track length */ |
99 | __u8 DS4DEVI; /* non-last keyed record overhead */ | 72 | __u8 DS4DEVI; /* non-last keyed record overhead */ |
100 | __u8 DS4DEVL; /* last keyed record overhead */ | 73 | __u8 DS4DEVL; /* last keyed record overhead */ |
101 | __u8 DS4DEVK; /* non-keyed record overhead differential */ | 74 | __u8 DS4DEVK; /* non-keyed record overhead differential */ |
102 | __u8 DS4DEVFG; /* flag byte */ | 75 | __u8 DS4DEVFG; /* flag byte */ |
103 | __u16 DS4DEVTL; /* device tolerance */ | 76 | __u16 DS4DEVTL; /* device tolerance */ |
104 | __u8 DS4DEVDT; /* number of DSCB's per track */ | 77 | __u8 DS4DEVDT; /* number of DSCB's per track */ |
105 | __u8 DS4DEVDB; /* number of directory blocks per track */ | 78 | __u8 DS4DEVDB; /* number of directory blocks per track */ |
106 | } __attribute__ ((packed)) dev_const_t; | 79 | } __attribute__ ((packed)); |
107 | 80 | ||
108 | 81 | struct vtoc_format1_label | |
109 | typedef struct format1_label | ||
110 | { | 82 | { |
111 | char DS1DSNAM[44]; /* data set name */ | 83 | char DS1DSNAM[44]; /* data set name */ |
112 | __u8 DS1FMTID; /* format identifier */ | 84 | __u8 DS1FMTID; /* format identifier */ |
113 | char DS1DSSN[6]; /* data set serial number */ | 85 | char DS1DSSN[6]; /* data set serial number */ |
114 | __u16 DS1VOLSQ; /* volume sequence number */ | 86 | __u16 DS1VOLSQ; /* volume sequence number */ |
115 | labeldate_t DS1CREDT; /* creation date: ydd */ | 87 | struct vtoc_labeldate DS1CREDT; /* creation date: ydd */ |
116 | labeldate_t DS1EXPDT; /* expiration date */ | 88 | struct vtoc_labeldate DS1EXPDT; /* expiration date */ |
117 | __u8 DS1NOEPV; /* number of extents on volume */ | 89 | __u8 DS1NOEPV; /* number of extents on volume */ |
118 | __u8 DS1NOBDB; /* no. of bytes used in last direction blk */ | 90 | __u8 DS1NOBDB; /* no. of bytes used in last direction blk */ |
119 | __u8 DS1FLAG1; /* flag 1 */ | 91 | __u8 DS1FLAG1; /* flag 1 */ |
120 | char DS1SYSCD[13]; /* system code */ | 92 | char DS1SYSCD[13]; /* system code */ |
121 | labeldate_t DS1REFD; /* date last referenced */ | 93 | struct vtoc_labeldate DS1REFD; /* date last referenced */ |
122 | __u8 DS1SMSFG; /* system managed storage indicators */ | 94 | __u8 DS1SMSFG; /* system managed storage indicators */ |
123 | __u8 DS1SCXTF; /* sec. space extension flag byte */ | 95 | __u8 DS1SCXTF; /* sec. space extension flag byte */ |
124 | __u16 DS1SCXTV; /* secondary space extension value */ | 96 | __u16 DS1SCXTV; /* secondary space extension value */ |
125 | __u8 DS1DSRG1; /* data set organisation byte 1 */ | 97 | __u8 DS1DSRG1; /* data set organisation byte 1 */ |
126 | __u8 DS1DSRG2; /* data set organisation byte 2 */ | 98 | __u8 DS1DSRG2; /* data set organisation byte 2 */ |
127 | __u8 DS1RECFM; /* record format */ | 99 | __u8 DS1RECFM; /* record format */ |
128 | __u8 DS1OPTCD; /* option code */ | 100 | __u8 DS1OPTCD; /* option code */ |
129 | __u16 DS1BLKL; /* block length */ | 101 | __u16 DS1BLKL; /* block length */ |
130 | __u16 DS1LRECL; /* record length */ | 102 | __u16 DS1LRECL; /* record length */ |
131 | __u8 DS1KEYL; /* key length */ | 103 | __u8 DS1KEYL; /* key length */ |
132 | __u16 DS1RKP; /* relative key position */ | 104 | __u16 DS1RKP; /* relative key position */ |
133 | __u8 DS1DSIND; /* data set indicators */ | 105 | __u8 DS1DSIND; /* data set indicators */ |
134 | __u8 DS1SCAL1; /* secondary allocation flag byte */ | 106 | __u8 DS1SCAL1; /* secondary allocation flag byte */ |
135 | char DS1SCAL3[3]; /* secondary allocation quantity */ | 107 | char DS1SCAL3[3]; /* secondary allocation quantity */ |
136 | ttr_t DS1LSTAR; /* last used track and block on track */ | 108 | struct vtoc_ttr DS1LSTAR; /* last used track and block on track */ |
137 | __u16 DS1TRBAL; /* space remaining on last used track */ | 109 | __u16 DS1TRBAL; /* space remaining on last used track */ |
138 | __u16 res1; /* reserved */ | 110 | __u16 res1; /* reserved */ |
139 | extent_t DS1EXT1; /* first extent description */ | 111 | struct vtoc_extent DS1EXT1; /* first extent description */ |
140 | extent_t DS1EXT2; /* second extent description */ | 112 | struct vtoc_extent DS1EXT2; /* second extent description */ |
141 | extent_t DS1EXT3; /* third extent description */ | 113 | struct vtoc_extent DS1EXT3; /* third extent description */ |
142 | cchhb_t DS1PTRDS; /* possible pointer to f2 or f3 DSCB */ | 114 | struct vtoc_cchhb DS1PTRDS; /* possible pointer to f2 or f3 DSCB */ |
143 | } __attribute__ ((packed)) format1_label_t; | 115 | } __attribute__ ((packed)); |
144 | 116 | ||
145 | 117 | struct vtoc_format4_label | |
146 | typedef struct format4_label | ||
147 | { | 118 | { |
148 | char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */ | 119 | char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */ |
149 | __u8 DS4IDFMT; /* format identifier */ | 120 | __u8 DS4IDFMT; /* format identifier */ |
150 | cchhb_t DS4HPCHR; /* highest address of a format 1 DSCB */ | 121 | struct vtoc_cchhb DS4HPCHR; /* highest address of a format 1 DSCB */ |
151 | __u16 DS4DSREC; /* number of available DSCB's */ | 122 | __u16 DS4DSREC; /* number of available DSCB's */ |
152 | cchh_t DS4HCCHH; /* CCHH of next available alternate track */ | 123 | struct vtoc_cchh DS4HCCHH; /* CCHH of next available alternate track */ |
153 | __u16 DS4NOATK; /* number of remaining alternate tracks */ | 124 | __u16 DS4NOATK; /* number of remaining alternate tracks */ |
154 | __u8 DS4VTOCI; /* VTOC indicators */ | 125 | __u8 DS4VTOCI; /* VTOC indicators */ |
155 | __u8 DS4NOEXT; /* number of extents in VTOC */ | 126 | __u8 DS4NOEXT; /* number of extents in VTOC */ |
156 | __u8 DS4SMSFG; /* system managed storage indicators */ | 127 | __u8 DS4SMSFG; /* system managed storage indicators */ |
157 | __u8 DS4DEVAC; /* number of alternate cylinders. | 128 | __u8 DS4DEVAC; /* number of alternate cylinders. |
158 | Subtract from first two bytes of | 129 | * Subtract from first two bytes of |
159 | DS4DEVSZ to get number of usable | 130 | * DS4DEVSZ to get number of usable |
160 | cylinders. can be zero. valid | 131 | * cylinders. can be zero. valid |
161 | only if DS4DEVAV on. */ | 132 | * only if DS4DEVAV on. */ |
162 | dev_const_t DS4DEVCT; /* device constants */ | 133 | struct vtoc_dev_const DS4DEVCT; /* device constants */ |
163 | char DS4AMTIM[8]; /* VSAM time stamp */ | 134 | char DS4AMTIM[8]; /* VSAM time stamp */ |
164 | char DS4AMCAT[3]; /* VSAM catalog indicator */ | 135 | char DS4AMCAT[3]; /* VSAM catalog indicator */ |
165 | char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */ | 136 | char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */ |
166 | char res1[5]; /* reserved */ | 137 | char res1[5]; /* reserved */ |
167 | char DS4F6PTR[5]; /* pointer to first format 6 DSCB */ | 138 | char DS4F6PTR[5]; /* pointer to first format 6 DSCB */ |
168 | extent_t DS4VTOCE; /* VTOC extent description */ | 139 | struct vtoc_extent DS4VTOCE; /* VTOC extent description */ |
169 | char res2[10]; /* reserved */ | 140 | char res2[10]; /* reserved */ |
170 | __u8 DS4EFLVL; /* extended free-space management level */ | 141 | __u8 DS4EFLVL; /* extended free-space management level */ |
171 | cchhb_t DS4EFPTR; /* pointer to extended free-space info */ | 142 | struct vtoc_cchhb DS4EFPTR; /* pointer to extended free-space info */ |
172 | char res3[9]; /* reserved */ | 143 | char res3[9]; /* reserved */ |
173 | } __attribute__ ((packed)) format4_label_t; | 144 | } __attribute__ ((packed)); |
174 | 145 | ||
175 | 146 | struct vtoc_ds5ext | |
176 | typedef struct ds5ext | ||
177 | { | 147 | { |
178 | __u16 t; /* RTA of the first track of free extent */ | 148 | __u16 t; /* RTA of the first track of free extent */ |
179 | __u16 fc; /* number of whole cylinders in free ext. */ | 149 | __u16 fc; /* number of whole cylinders in free ext. */ |
180 | __u8 ft; /* number of remaining free tracks */ | 150 | __u8 ft; /* number of remaining free tracks */ |
181 | } __attribute__ ((packed)) ds5ext_t; | 151 | } __attribute__ ((packed)); |
182 | |||
183 | 152 | ||
184 | typedef struct format5_label | 153 | struct vtoc_format5_label |
185 | { | 154 | { |
186 | char DS5KEYID[4]; /* key identifier */ | 155 | char DS5KEYID[4]; /* key identifier */ |
187 | ds5ext_t DS5AVEXT; /* first available (free-space) extent. */ | 156 | struct vtoc_ds5ext DS5AVEXT; /* first available (free-space) extent. */ |
188 | ds5ext_t DS5EXTAV[7]; /* seven available extents */ | 157 | struct vtoc_ds5ext DS5EXTAV[7]; /* seven available extents */ |
189 | __u8 DS5FMTID; /* format identifier */ | 158 | __u8 DS5FMTID; /* format identifier */ |
190 | ds5ext_t DS5MAVET[18]; /* eighteen available extents */ | 159 | struct vtoc_ds5ext DS5MAVET[18]; /* eighteen available extents */ |
191 | cchhb_t DS5PTRDS; /* pointer to next format5 DSCB */ | 160 | struct vtoc_cchhb DS5PTRDS; /* pointer to next format5 DSCB */ |
192 | } __attribute__ ((packed)) format5_label_t; | 161 | } __attribute__ ((packed)); |
193 | 162 | ||
194 | 163 | struct vtoc_ds7ext | |
195 | typedef struct ds7ext | ||
196 | { | 164 | { |
197 | __u32 a; /* starting RTA value */ | 165 | __u32 a; /* starting RTA value */ |
198 | __u32 b; /* ending RTA value + 1 */ | 166 | __u32 b; /* ending RTA value + 1 */ |
199 | } __attribute__ ((packed)) ds7ext_t; | 167 | } __attribute__ ((packed)); |
200 | 168 | ||
201 | 169 | struct vtoc_format7_label | |
202 | typedef struct format7_label | ||
203 | { | 170 | { |
204 | char DS7KEYID[4]; /* key identifier */ | 171 | char DS7KEYID[4]; /* key identifier */ |
205 | ds7ext_t DS7EXTNT[5]; /* space for 5 extent descriptions */ | 172 | struct vtoc_ds7ext DS7EXTNT[5]; /* space for 5 extent descriptions */ |
206 | __u8 DS7FMTID; /* format identifier */ | 173 | __u8 DS7FMTID; /* format identifier */ |
207 | ds7ext_t DS7ADEXT[11]; /* space for 11 extent descriptions */ | 174 | struct vtoc_ds7ext DS7ADEXT[11]; /* space for 11 extent descriptions */ |
208 | char res1[2]; /* reserved */ | 175 | char res1[2]; /* reserved */ |
209 | cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ | 176 | struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */ |
210 | } __attribute__ ((packed)) format7_label_t; | 177 | } __attribute__ ((packed)); |
211 | 178 | ||
212 | 179 | #endif /* _ASM_S390_VTOC_H */ | |
213 | char * vtoc_ebcdic_enc ( | ||
214 | unsigned char source[LINE_LENGTH], | ||
215 | unsigned char target[LINE_LENGTH], | ||
216 | int l); | ||
217 | char * vtoc_ebcdic_dec ( | ||
218 | unsigned char source[LINE_LENGTH], | ||
219 | unsigned char target[LINE_LENGTH], | ||
220 | int l); | ||
221 | void vtoc_set_extent ( | ||
222 | extent_t * ext, | ||
223 | __u8 typeind, | ||
224 | __u8 seqno, | ||
225 | cchh_t * lower, | ||
226 | cchh_t * upper); | ||
227 | void vtoc_set_cchh ( | ||
228 | cchh_t * addr, | ||
229 | __u16 cc, | ||
230 | __u16 hh); | ||
231 | void vtoc_set_cchhb ( | ||
232 | cchhb_t * addr, | ||
233 | __u16 cc, | ||
234 | __u16 hh, | ||
235 | __u8 b); | ||
236 | void vtoc_set_date ( | ||
237 | labeldate_t * d, | ||
238 | __u8 year, | ||
239 | __u16 day); | ||
240 | |||
241 | void vtoc_volume_label_init ( | ||
242 | volume_label_t *vlabel); | ||
243 | |||
244 | int vtoc_read_volume_label ( | ||
245 | char * device, | ||
246 | unsigned long vlabel_start, | ||
247 | volume_label_t * vlabel); | ||
248 | |||
249 | int vtoc_write_volume_label ( | ||
250 | char *device, | ||
251 | unsigned long vlabel_start, | ||
252 | volume_label_t *vlabel); | ||
253 | |||
254 | void vtoc_volume_label_set_volser ( | ||
255 | volume_label_t *vlabel, | ||
256 | char *volser); | ||
257 | |||
258 | char *vtoc_volume_label_get_volser ( | ||
259 | volume_label_t *vlabel, | ||
260 | char *volser); | ||
261 | |||
262 | void vtoc_volume_label_set_key ( | ||
263 | volume_label_t *vlabel, | ||
264 | char *key); | ||
265 | |||
266 | void vtoc_volume_label_set_label ( | ||
267 | volume_label_t *vlabel, | ||
268 | char *lbl); | ||
269 | |||
270 | char *vtoc_volume_label_get_label ( | ||
271 | volume_label_t *vlabel, | ||
272 | char *lbl); | ||
273 | |||
274 | void vtoc_read_label ( | ||
275 | char *device, | ||
276 | unsigned long position, | ||
277 | format1_label_t *f1, | ||
278 | format4_label_t *f4, | ||
279 | format5_label_t *f5, | ||
280 | format7_label_t *f7); | ||
281 | |||
282 | void vtoc_write_label ( | ||
283 | char *device, | ||
284 | unsigned long position, | ||
285 | format1_label_t *f1, | ||
286 | format4_label_t *f4, | ||
287 | format5_label_t *f5, | ||
288 | format7_label_t *f7); | ||
289 | |||
290 | |||
291 | void vtoc_init_format1_label ( | ||
292 | char *volid, | ||
293 | unsigned int blksize, | ||
294 | extent_t *part_extent, | ||
295 | format1_label_t *f1); | ||
296 | |||
297 | |||
298 | void vtoc_init_format4_label ( | ||
299 | format4_label_t *f4lbl, | ||
300 | unsigned int usable_partitions, | ||
301 | unsigned int cylinders, | ||
302 | unsigned int tracks, | ||
303 | unsigned int blocks, | ||
304 | unsigned int blksize, | ||
305 | __u16 dev_type); | ||
306 | |||
307 | void vtoc_update_format4_label ( | ||
308 | format4_label_t *f4, | ||
309 | cchhb_t *highest_f1, | ||
310 | __u16 unused_update); | ||
311 | |||
312 | |||
313 | void vtoc_init_format5_label ( | ||
314 | format5_label_t *f5); | ||
315 | |||
316 | void vtoc_update_format5_label_add ( | ||
317 | format5_label_t *f5, | ||
318 | int verbose, | ||
319 | int cyl, | ||
320 | int trk, | ||
321 | __u16 a, | ||
322 | __u16 b, | ||
323 | __u8 c); | ||
324 | |||
325 | void vtoc_update_format5_label_del ( | ||
326 | format5_label_t *f5, | ||
327 | int verbose, | ||
328 | int cyl, | ||
329 | int trk, | ||
330 | __u16 a, | ||
331 | __u16 b, | ||
332 | __u8 c); | ||
333 | |||
334 | |||
335 | void vtoc_init_format7_label ( | ||
336 | format7_label_t *f7); | ||
337 | |||
338 | void vtoc_update_format7_label_add ( | ||
339 | format7_label_t *f7, | ||
340 | int verbose, | ||
341 | __u32 a, | ||
342 | __u32 b); | ||
343 | |||
344 | void vtoc_update_format7_label_del ( | ||
345 | format7_label_t *f7, | ||
346 | int verbose, | ||
347 | __u32 a, | ||
348 | __u32 b); | ||
349 | |||
350 | |||
351 | void vtoc_set_freespace( | ||
352 | format4_label_t *f4, | ||
353 | format5_label_t *f5, | ||
354 | format7_label_t *f7, | ||
355 | char ch, | ||
356 | int verbose, | ||
357 | __u32 start, | ||
358 | __u32 stop, | ||
359 | int cyl, | ||
360 | int trk); | ||
361 | |||
362 | |||
363 | |||
364 | |||
365 | |||
366 | |||
367 | |||
368 | |||
369 | |||
370 | |||
371 | |||
372 | |||