diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-28 08:29:59 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-28 08:29:59 -0400 |
commit | 185a257f2f73bcd89050ad02da5bedbc28fc43fa (patch) | |
tree | 5e32586114534ed3f2165614cba3d578f5d87307 /include | |
parent | 3f1a9aaeffd8d1cbc5ab9776c45cbd66af1c9699 (diff) | |
parent | a77c64c1a641950626181b4857abb701d8f38ccc (diff) |
Merge branch 'master' into gfs2
Diffstat (limited to 'include')
471 files changed, 12569 insertions, 4262 deletions
diff --git a/include/asm-alpha/libata-portmap.h b/include/asm-alpha/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-alpha/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h index 64d0ab98fcd8..8af56ce346ad 100644 --- a/include/asm-alpha/mmzone.h +++ b/include/asm-alpha/mmzone.h | |||
@@ -75,6 +75,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
75 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) | 75 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) |
76 | 76 | ||
77 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) | 77 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) |
78 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32)) | ||
78 | #define pte_pfn(pte) (pte_val(pte) >> 32) | 79 | #define pte_pfn(pte) (pte_val(pte) >> 32) |
79 | 80 | ||
80 | #define mk_pte(page, pgprot) \ | 81 | #define mk_pte(page, pgprot) \ |
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 93eaa58b7961..49ac9bee7ced 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h | |||
@@ -230,16 +230,17 @@ extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) | |||
230 | 230 | ||
231 | 231 | ||
232 | extern inline unsigned long | 232 | extern inline unsigned long |
233 | pmd_page_kernel(pmd_t pmd) | 233 | pmd_page_vaddr(pmd_t pmd) |
234 | { | 234 | { |
235 | return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET; | 235 | return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET; |
236 | } | 236 | } |
237 | 237 | ||
238 | #ifndef CONFIG_DISCONTIGMEM | 238 | #ifndef CONFIG_DISCONTIGMEM |
239 | #define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) | 239 | #define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) |
240 | #define pgd_page(pgd) (mem_map + ((pgd_val(pgd) & _PFN_MASK) >> 32)) | ||
240 | #endif | 241 | #endif |
241 | 242 | ||
242 | extern inline unsigned long pgd_page(pgd_t pgd) | 243 | extern inline unsigned long pgd_page_vaddr(pgd_t pgd) |
243 | { return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } | 244 | { return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } |
244 | 245 | ||
245 | extern inline int pte_none(pte_t pte) { return !pte_val(pte); } | 246 | extern inline int pte_none(pte_t pte) { return !pte_val(pte); } |
@@ -293,13 +294,13 @@ extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; retu | |||
293 | /* Find an entry in the second-level page table.. */ | 294 | /* Find an entry in the second-level page table.. */ |
294 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | 295 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) |
295 | { | 296 | { |
296 | return (pmd_t *) pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); | 297 | return (pmd_t *) pgd_page_vaddr(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); |
297 | } | 298 | } |
298 | 299 | ||
299 | /* Find an entry in the third-level page table.. */ | 300 | /* Find an entry in the third-level page table.. */ |
300 | extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) | 301 | extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) |
301 | { | 302 | { |
302 | return (pte_t *) pmd_page_kernel(*dir) | 303 | return (pte_t *) pmd_page_vaddr(*dir) |
303 | + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); | 304 | + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); |
304 | } | 305 | } |
305 | 306 | ||
diff --git a/include/asm-arm/arch-pxa/udc.h b/include/asm-arm/arch-pxa/udc.h index 30548a30c773..121cd241115d 100644 --- a/include/asm-arm/arch-pxa/udc.h +++ b/include/asm-arm/arch-pxa/udc.h | |||
@@ -12,6 +12,14 @@ struct pxa2xx_udc_mach_info { | |||
12 | void (*udc_command)(int cmd); | 12 | void (*udc_command)(int cmd); |
13 | #define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */ | 13 | #define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */ |
14 | #define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ | 14 | #define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ |
15 | |||
16 | /* Boards following the design guidelines in the developer's manual, | ||
17 | * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane | ||
18 | * VBUS IRQ and omit the methods above. Store the GPIO number | ||
19 | * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits. | ||
20 | */ | ||
21 | u16 gpio_vbus; /* high == vbus present */ | ||
22 | u16 gpio_pullup; /* high == pullup activated */ | ||
15 | }; | 23 | }; |
16 | 24 | ||
17 | extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); | 25 | extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); |
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index 8d3919c6458c..4d10d319fa34 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h | |||
@@ -224,9 +224,9 @@ extern struct page *empty_zero_page; | |||
224 | #define pte_none(pte) (!pte_val(pte)) | 224 | #define pte_none(pte) (!pte_val(pte)) |
225 | #define pte_clear(mm,addr,ptep) set_pte_at((mm),(addr),(ptep), __pte(0)) | 225 | #define pte_clear(mm,addr,ptep) set_pte_at((mm),(addr),(ptep), __pte(0)) |
226 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) | 226 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) |
227 | #define pte_offset_kernel(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 227 | #define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
228 | #define pte_offset_map(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 228 | #define pte_offset_map(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
229 | #define pte_offset_map_nested(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 229 | #define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
230 | #define pte_unmap(pte) do { } while (0) | 230 | #define pte_unmap(pte) do { } while (0) |
231 | #define pte_unmap_nested(pte) do { } while (0) | 231 | #define pte_unmap_nested(pte) do { } while (0) |
232 | 232 | ||
@@ -291,7 +291,7 @@ PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); | |||
291 | clean_pmd_entry(pmdp); \ | 291 | clean_pmd_entry(pmdp); \ |
292 | } while (0) | 292 | } while (0) |
293 | 293 | ||
294 | static inline pte_t *pmd_page_kernel(pmd_t pmd) | 294 | static inline pte_t *pmd_page_vaddr(pmd_t pmd) |
295 | { | 295 | { |
296 | unsigned long ptr; | 296 | unsigned long ptr; |
297 | 297 | ||
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 1e891f860ef3..2ab4078334bf 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h | |||
@@ -377,6 +377,7 @@ | |||
377 | #endif | 377 | #endif |
378 | 378 | ||
379 | #ifdef __KERNEL__ | 379 | #ifdef __KERNEL__ |
380 | #include <linux/err.h> | ||
380 | #include <linux/linkage.h> | 381 | #include <linux/linkage.h> |
381 | 382 | ||
382 | #define __sys2(x) #x | 383 | #define __sys2(x) #x |
@@ -396,7 +397,7 @@ | |||
396 | 397 | ||
397 | #define __syscall_return(type, res) \ | 398 | #define __syscall_return(type, res) \ |
398 | do { \ | 399 | do { \ |
399 | if ((unsigned long)(res) >= (unsigned long)(-129)) { \ | 400 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
400 | errno = -(res); \ | 401 | errno = -(res); \ |
401 | res = -1; \ | 402 | res = -1; \ |
402 | } \ | 403 | } \ |
diff --git a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h index 19ac9101a6bb..63a8881fae13 100644 --- a/include/asm-arm26/pgtable.h +++ b/include/asm-arm26/pgtable.h | |||
@@ -186,12 +186,12 @@ extern struct page *empty_zero_page; | |||
186 | * return a pointer to memory (no special alignment) | 186 | * return a pointer to memory (no special alignment) |
187 | */ | 187 | */ |
188 | #define pmd_page(pmd) ((struct page *)(pmd_val((pmd)) & ~_PMD_PRESENT)) | 188 | #define pmd_page(pmd) ((struct page *)(pmd_val((pmd)) & ~_PMD_PRESENT)) |
189 | #define pmd_page_kernel(pmd) ((pte_t *)(pmd_val((pmd)) & ~_PMD_PRESENT)) | 189 | #define pmd_page_vaddr(pmd) ((pte_t *)(pmd_val((pmd)) & ~_PMD_PRESENT)) |
190 | 190 | ||
191 | #define pte_offset_kernel(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 191 | #define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
192 | 192 | ||
193 | #define pte_offset_map(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 193 | #define pte_offset_map(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
194 | #define pte_offset_map_nested(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 194 | #define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
195 | #define pte_unmap(pte) do { } while (0) | 195 | #define pte_unmap(pte) do { } while (0) |
196 | #define pte_unmap_nested(pte) do { } while (0) | 196 | #define pte_unmap_nested(pte) do { } while (0) |
197 | 197 | ||
diff --git a/include/asm-arm26/unistd.h b/include/asm-arm26/unistd.h index 70eb6d91cfd0..c6d2436c9d34 100644 --- a/include/asm-arm26/unistd.h +++ b/include/asm-arm26/unistd.h | |||
@@ -311,6 +311,7 @@ | |||
311 | #define __ARM_NR_usr26 (__ARM_NR_BASE+3) | 311 | #define __ARM_NR_usr26 (__ARM_NR_BASE+3) |
312 | 312 | ||
313 | #ifdef __KERNEL__ | 313 | #ifdef __KERNEL__ |
314 | #include <linux/err.h> | ||
314 | #include <linux/linkage.h> | 315 | #include <linux/linkage.h> |
315 | 316 | ||
316 | #define __sys2(x) #x | 317 | #define __sys2(x) #x |
@@ -322,7 +323,7 @@ | |||
322 | 323 | ||
323 | #define __syscall_return(type, res) \ | 324 | #define __syscall_return(type, res) \ |
324 | do { \ | 325 | do { \ |
325 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | 326 | if ((unsigned long)(res) >= (unsigned long)-MAX_ERRNO) { \ |
326 | errno = -(res); \ | 327 | errno = -(res); \ |
327 | res = -1; \ | 328 | res = -1; \ |
328 | } \ | 329 | } \ |
diff --git a/include/asm-avr32/Kbuild b/include/asm-avr32/Kbuild new file mode 100644 index 000000000000..8770e73ce938 --- /dev/null +++ b/include/asm-avr32/Kbuild | |||
@@ -0,0 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | |||
3 | headers-y += cachectl.h | ||
diff --git a/include/asm-avr32/a.out.h b/include/asm-avr32/a.out.h new file mode 100644 index 000000000000..50bf6e31a143 --- /dev/null +++ b/include/asm-avr32/a.out.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef __ASM_AVR32_A_OUT_H | ||
2 | #define __ASM_AVR32_A_OUT_H | ||
3 | |||
4 | struct exec | ||
5 | { | ||
6 | unsigned long a_info; /* Use macros N_MAGIC, etc for access */ | ||
7 | unsigned a_text; /* length of text, in bytes */ | ||
8 | unsigned a_data; /* length of data, in bytes */ | ||
9 | unsigned a_bss; /* length of uninitialized data area for file, in bytes */ | ||
10 | unsigned a_syms; /* length of symbol table data in file, in bytes */ | ||
11 | unsigned a_entry; /* start address */ | ||
12 | unsigned a_trsize; /* length of relocation info for text, in bytes */ | ||
13 | unsigned a_drsize; /* length of relocation info for data, in bytes */ | ||
14 | }; | ||
15 | |||
16 | #define N_TRSIZE(a) ((a).a_trsize) | ||
17 | #define N_DRSIZE(a) ((a).a_drsize) | ||
18 | #define N_SYMSIZE(a) ((a).a_syms) | ||
19 | |||
20 | #ifdef __KERNEL__ | ||
21 | |||
22 | #define STACK_TOP TASK_SIZE | ||
23 | |||
24 | #endif | ||
25 | |||
26 | #endif /* __ASM_AVR32_A_OUT_H */ | ||
diff --git a/include/asm-avr32/addrspace.h b/include/asm-avr32/addrspace.h new file mode 100644 index 000000000000..366794858ec7 --- /dev/null +++ b/include/asm-avr32/addrspace.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Defitions for the address spaces of the AVR32 CPUs. Heavily based on | ||
3 | * include/asm-sh/addrspace.h | ||
4 | * | ||
5 | * Copyright (C) 2004-2006 Atmel Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __ASM_AVR32_ADDRSPACE_H | ||
12 | #define __ASM_AVR32_ADDRSPACE_H | ||
13 | |||
14 | #ifdef CONFIG_MMU | ||
15 | |||
16 | /* Memory segments when segmentation is enabled */ | ||
17 | #define P0SEG 0x00000000 | ||
18 | #define P1SEG 0x80000000 | ||
19 | #define P2SEG 0xa0000000 | ||
20 | #define P3SEG 0xc0000000 | ||
21 | #define P4SEG 0xe0000000 | ||
22 | |||
23 | /* Returns the privileged segment base of a given address */ | ||
24 | #define PXSEG(a) (((unsigned long)(a)) & 0xe0000000) | ||
25 | |||
26 | /* Returns the physical address of a PnSEG (n=1,2) address */ | ||
27 | #define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff) | ||
28 | |||
29 | /* | ||
30 | * Map an address to a certain privileged segment | ||
31 | */ | ||
32 | #define P1SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \ | ||
33 | | P1SEG)) | ||
34 | #define P2SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \ | ||
35 | | P2SEG)) | ||
36 | #define P3SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \ | ||
37 | | P3SEG)) | ||
38 | #define P4SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \ | ||
39 | | P4SEG)) | ||
40 | |||
41 | #endif /* CONFIG_MMU */ | ||
42 | |||
43 | #endif /* __ASM_AVR32_ADDRSPACE_H */ | ||
diff --git a/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h b/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h new file mode 100644 index 000000000000..ce1150d4438d --- /dev/null +++ b/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h | ||
3 | * | ||
4 | * Copyright (C) 2005 Ivan Kokshaysky | ||
5 | * Copyright (C) SAN People | ||
6 | * | ||
7 | * Peripheral Data Controller (PDC) registers. | ||
8 | * Based on AT91RM9200 datasheet revision E. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef AT91RM9200_PDC_H | ||
17 | #define AT91RM9200_PDC_H | ||
18 | |||
19 | #define AT91_PDC_RPR 0x100 /* Receive Pointer Register */ | ||
20 | #define AT91_PDC_RCR 0x104 /* Receive Counter Register */ | ||
21 | #define AT91_PDC_TPR 0x108 /* Transmit Pointer Register */ | ||
22 | #define AT91_PDC_TCR 0x10c /* Transmit Counter Register */ | ||
23 | #define AT91_PDC_RNPR 0x110 /* Receive Next Pointer Register */ | ||
24 | #define AT91_PDC_RNCR 0x114 /* Receive Next Counter Register */ | ||
25 | #define AT91_PDC_TNPR 0x118 /* Transmit Next Pointer Register */ | ||
26 | #define AT91_PDC_TNCR 0x11c /* Transmit Next Counter Register */ | ||
27 | |||
28 | #define AT91_PDC_PTCR 0x120 /* Transfer Control Register */ | ||
29 | #define AT91_PDC_RXTEN (1 << 0) /* Receiver Transfer Enable */ | ||
30 | #define AT91_PDC_RXTDIS (1 << 1) /* Receiver Transfer Disable */ | ||
31 | #define AT91_PDC_TXTEN (1 << 8) /* Transmitter Transfer Enable */ | ||
32 | #define AT91_PDC_TXTDIS (1 << 9) /* Transmitter Transfer Disable */ | ||
33 | |||
34 | #define AT91_PDC_PTSR 0x124 /* Transfer Status Register */ | ||
35 | |||
36 | #endif | ||
diff --git a/include/asm-avr32/arch-at32ap/at91rm9200_usart.h b/include/asm-avr32/arch-at32ap/at91rm9200_usart.h new file mode 100644 index 000000000000..79f851e31b9c --- /dev/null +++ b/include/asm-avr32/arch-at32ap/at91rm9200_usart.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * include/asm-arm/arch-at91rm9200/at91rm9200_usart.h | ||
3 | * | ||
4 | * Copyright (C) 2005 Ivan Kokshaysky | ||
5 | * Copyright (C) SAN People | ||
6 | * | ||
7 | * USART registers. | ||
8 | * Based on AT91RM9200 datasheet revision E. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef AT91RM9200_USART_H | ||
17 | #define AT91RM9200_USART_H | ||
18 | |||
19 | #define AT91_US_CR 0x00 /* Control Register */ | ||
20 | #define AT91_US_RSTRX (1 << 2) /* Reset Receiver */ | ||
21 | #define AT91_US_RSTTX (1 << 3) /* Reset Transmitter */ | ||
22 | #define AT91_US_RXEN (1 << 4) /* Receiver Enable */ | ||
23 | #define AT91_US_RXDIS (1 << 5) /* Receiver Disable */ | ||
24 | #define AT91_US_TXEN (1 << 6) /* Transmitter Enable */ | ||
25 | #define AT91_US_TXDIS (1 << 7) /* Transmitter Disable */ | ||
26 | #define AT91_US_RSTSTA (1 << 8) /* Reset Status Bits */ | ||
27 | #define AT91_US_STTBRK (1 << 9) /* Start Break */ | ||
28 | #define AT91_US_STPBRK (1 << 10) /* Stop Break */ | ||
29 | #define AT91_US_STTTO (1 << 11) /* Start Time-out */ | ||
30 | #define AT91_US_SENDA (1 << 12) /* Send Address */ | ||
31 | #define AT91_US_RSTIT (1 << 13) /* Reset Iterations */ | ||
32 | #define AT91_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */ | ||
33 | #define AT91_US_RETTO (1 << 15) /* Rearm Time-out */ | ||
34 | #define AT91_US_DTREN (1 << 16) /* Data Terminal Ready Enable */ | ||
35 | #define AT91_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable */ | ||
36 | #define AT91_US_RTSEN (1 << 18) /* Request To Send Enable */ | ||
37 | #define AT91_US_RTSDIS (1 << 19) /* Request To Send Disable */ | ||
38 | |||
39 | #define AT91_US_MR 0x04 /* Mode Register */ | ||
40 | #define AT91_US_USMODE (0xf << 0) /* Mode of the USART */ | ||
41 | #define AT91_US_USMODE_NORMAL 0 | ||
42 | #define AT91_US_USMODE_RS485 1 | ||
43 | #define AT91_US_USMODE_HWHS 2 | ||
44 | #define AT91_US_USMODE_MODEM 3 | ||
45 | #define AT91_US_USMODE_ISO7816_T0 4 | ||
46 | #define AT91_US_USMODE_ISO7816_T1 6 | ||
47 | #define AT91_US_USMODE_IRDA 8 | ||
48 | #define AT91_US_USCLKS (3 << 4) /* Clock Selection */ | ||
49 | #define AT91_US_CHRL (3 << 6) /* Character Length */ | ||
50 | #define AT91_US_CHRL_5 (0 << 6) | ||
51 | #define AT91_US_CHRL_6 (1 << 6) | ||
52 | #define AT91_US_CHRL_7 (2 << 6) | ||
53 | #define AT91_US_CHRL_8 (3 << 6) | ||
54 | #define AT91_US_SYNC (1 << 8) /* Synchronous Mode Select */ | ||
55 | #define AT91_US_PAR (7 << 9) /* Parity Type */ | ||
56 | #define AT91_US_PAR_EVEN (0 << 9) | ||
57 | #define AT91_US_PAR_ODD (1 << 9) | ||
58 | #define AT91_US_PAR_SPACE (2 << 9) | ||
59 | #define AT91_US_PAR_MARK (3 << 9) | ||
60 | #define AT91_US_PAR_NONE (4 << 9) | ||
61 | #define AT91_US_PAR_MULTI_DROP (6 << 9) | ||
62 | #define AT91_US_NBSTOP (3 << 12) /* Number of Stop Bits */ | ||
63 | #define AT91_US_NBSTOP_1 (0 << 12) | ||
64 | #define AT91_US_NBSTOP_1_5 (1 << 12) | ||
65 | #define AT91_US_NBSTOP_2 (2 << 12) | ||
66 | #define AT91_US_CHMODE (3 << 14) /* Channel Mode */ | ||
67 | #define AT91_US_CHMODE_NORMAL (0 << 14) | ||
68 | #define AT91_US_CHMODE_ECHO (1 << 14) | ||
69 | #define AT91_US_CHMODE_LOC_LOOP (2 << 14) | ||
70 | #define AT91_US_CHMODE_REM_LOOP (3 << 14) | ||
71 | #define AT91_US_MSBF (1 << 16) /* Bit Order */ | ||
72 | #define AT91_US_MODE9 (1 << 17) /* 9-bit Character Length */ | ||
73 | #define AT91_US_CLKO (1 << 18) /* Clock Output Select */ | ||
74 | #define AT91_US_OVER (1 << 19) /* Oversampling Mode */ | ||
75 | #define AT91_US_INACK (1 << 20) /* Inhibit Non Acknowledge */ | ||
76 | #define AT91_US_DSNACK (1 << 21) /* Disable Successive NACK */ | ||
77 | #define AT91_US_MAX_ITER (7 << 24) /* Max Iterations */ | ||
78 | #define AT91_US_FILTER (1 << 28) /* Infrared Receive Line Filter */ | ||
79 | |||
80 | #define AT91_US_IER 0x08 /* Interrupt Enable Register */ | ||
81 | #define AT91_US_RXRDY (1 << 0) /* Receiver Ready */ | ||
82 | #define AT91_US_TXRDY (1 << 1) /* Transmitter Ready */ | ||
83 | #define AT91_US_RXBRK (1 << 2) /* Break Received / End of Break */ | ||
84 | #define AT91_US_ENDRX (1 << 3) /* End of Receiver Transfer */ | ||
85 | #define AT91_US_ENDTX (1 << 4) /* End of Transmitter Transfer */ | ||
86 | #define AT91_US_OVRE (1 << 5) /* Overrun Error */ | ||
87 | #define AT91_US_FRAME (1 << 6) /* Framing Error */ | ||
88 | #define AT91_US_PARE (1 << 7) /* Parity Error */ | ||
89 | #define AT91_US_TIMEOUT (1 << 8) /* Receiver Time-out */ | ||
90 | #define AT91_US_TXEMPTY (1 << 9) /* Transmitter Empty */ | ||
91 | #define AT91_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */ | ||
92 | #define AT91_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */ | ||
93 | #define AT91_US_RXBUFF (1 << 12) /* Reception Buffer Full */ | ||
94 | #define AT91_US_NACK (1 << 13) /* Non Acknowledge */ | ||
95 | #define AT91_US_RIIC (1 << 16) /* Ring Indicator Input Change */ | ||
96 | #define AT91_US_DSRIC (1 << 17) /* Data Set Ready Input Change */ | ||
97 | #define AT91_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change */ | ||
98 | #define AT91_US_CTSIC (1 << 19) /* Clear to Send Input Change */ | ||
99 | #define AT91_US_RI (1 << 20) /* RI */ | ||
100 | #define AT91_US_DSR (1 << 21) /* DSR */ | ||
101 | #define AT91_US_DCD (1 << 22) /* DCD */ | ||
102 | #define AT91_US_CTS (1 << 23) /* CTS */ | ||
103 | |||
104 | #define AT91_US_IDR 0x0c /* Interrupt Disable Register */ | ||
105 | #define AT91_US_IMR 0x10 /* Interrupt Mask Register */ | ||
106 | #define AT91_US_CSR 0x14 /* Channel Status Register */ | ||
107 | #define AT91_US_RHR 0x18 /* Receiver Holding Register */ | ||
108 | #define AT91_US_THR 0x1c /* Transmitter Holding Register */ | ||
109 | |||
110 | #define AT91_US_BRGR 0x20 /* Baud Rate Generator Register */ | ||
111 | #define AT91_US_CD (0xffff << 0) /* Clock Divider */ | ||
112 | |||
113 | #define AT91_US_RTOR 0x24 /* Receiver Time-out Register */ | ||
114 | #define AT91_US_TO (0xffff << 0) /* Time-out Value */ | ||
115 | |||
116 | #define AT91_US_TTGR 0x28 /* Transmitter Timeguard Register */ | ||
117 | #define AT91_US_TG (0xff << 0) /* Timeguard Value */ | ||
118 | |||
119 | #define AT91_US_FIDI 0x40 /* FI DI Ratio Register */ | ||
120 | #define AT91_US_NER 0x44 /* Number of Errors Register */ | ||
121 | #define AT91_US_IF 0x4c /* IrDA Filter Register */ | ||
122 | |||
123 | #endif | ||
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h new file mode 100644 index 000000000000..39368e18ab20 --- /dev/null +++ b/include/asm-avr32/arch-at32ap/board.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Platform data definitions. | ||
3 | */ | ||
4 | #ifndef __ASM_ARCH_BOARD_H | ||
5 | #define __ASM_ARCH_BOARD_H | ||
6 | |||
7 | #include <linux/types.h> | ||
8 | |||
9 | /* Add basic devices: system manager, interrupt controller, portmuxes, etc. */ | ||
10 | void at32_add_system_devices(void); | ||
11 | |||
12 | #define AT91_NR_UART 4 | ||
13 | extern struct platform_device *at91_default_console_device; | ||
14 | |||
15 | struct platform_device *at32_add_device_usart(unsigned int id); | ||
16 | |||
17 | struct eth_platform_data { | ||
18 | u8 valid; | ||
19 | u8 mii_phy_addr; | ||
20 | u8 is_rmii; | ||
21 | u8 hw_addr[6]; | ||
22 | }; | ||
23 | struct platform_device * | ||
24 | at32_add_device_eth(unsigned int id, struct eth_platform_data *data); | ||
25 | |||
26 | struct platform_device *at32_add_device_spi(unsigned int id); | ||
27 | |||
28 | struct lcdc_platform_data { | ||
29 | unsigned long fbmem_start; | ||
30 | unsigned long fbmem_size; | ||
31 | }; | ||
32 | struct platform_device * | ||
33 | at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data); | ||
34 | |||
35 | #endif /* __ASM_ARCH_BOARD_H */ | ||
diff --git a/include/asm-avr32/arch-at32ap/init.h b/include/asm-avr32/arch-at32ap/init.h new file mode 100644 index 000000000000..43722634e069 --- /dev/null +++ b/include/asm-avr32/arch-at32ap/init.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * AT32AP platform initialization calls. | ||
3 | * | ||
4 | * Copyright (C) 2006 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __ASM_AVR32_AT32AP_INIT_H__ | ||
11 | #define __ASM_AVR32_AT32AP_INIT_H__ | ||
12 | |||
13 | void setup_platform(void); | ||
14 | |||
15 | /* Called by setup_platform */ | ||
16 | void at32_clock_init(void); | ||
17 | void at32_portmux_init(void); | ||
18 | |||
19 | void at32_setup_serial_console(unsigned int usart_id); | ||
20 | |||
21 | #endif /* __ASM_AVR32_AT32AP_INIT_H__ */ | ||
diff --git a/include/asm-avr32/arch-at32ap/portmux.h b/include/asm-avr32/arch-at32ap/portmux.h new file mode 100644 index 000000000000..4d50421262a1 --- /dev/null +++ b/include/asm-avr32/arch-at32ap/portmux.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * AT32 portmux interface. | ||
3 | * | ||
4 | * Copyright (C) 2006 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __ASM_AVR32_AT32_PORTMUX_H__ | ||
11 | #define __ASM_AVR32_AT32_PORTMUX_H__ | ||
12 | |||
13 | void portmux_set_func(unsigned int portmux_id, unsigned int pin_id, | ||
14 | unsigned int function_id); | ||
15 | |||
16 | #endif /* __ASM_AVR32_AT32_PORTMUX_H__ */ | ||
diff --git a/include/asm-avr32/arch-at32ap/sm.h b/include/asm-avr32/arch-at32ap/sm.h new file mode 100644 index 000000000000..265a9ead20bf --- /dev/null +++ b/include/asm-avr32/arch-at32ap/sm.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * AT32 System Manager interface. | ||
3 | * | ||
4 | * Copyright (C) 2006 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __ASM_AVR32_AT32_SM_H__ | ||
11 | #define __ASM_AVR32_AT32_SM_H__ | ||
12 | |||
13 | struct irq_chip; | ||
14 | struct platform_device; | ||
15 | |||
16 | struct at32_sm { | ||
17 | spinlock_t lock; | ||
18 | void __iomem *regs; | ||
19 | struct irq_chip *eim_chip; | ||
20 | unsigned int eim_first_irq; | ||
21 | struct platform_device *pdev; | ||
22 | }; | ||
23 | |||
24 | extern struct platform_device at32_sm_device; | ||
25 | extern struct at32_sm system_manager; | ||
26 | |||
27 | #endif /* __ASM_AVR32_AT32_SM_H__ */ | ||
diff --git a/include/asm-avr32/arch-at32ap/smc.h b/include/asm-avr32/arch-at32ap/smc.h new file mode 100644 index 000000000000..3732b328303d --- /dev/null +++ b/include/asm-avr32/arch-at32ap/smc.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Static Memory Controller for AT32 chips | ||
3 | * | ||
4 | * Copyright (C) 2006 Atmel Corporation | ||
5 | * | ||
6 | * Inspired by the OMAP2 General-Purpose Memory Controller interface | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __ARCH_AT32AP_SMC_H | ||
13 | #define __ARCH_AT32AP_SMC_H | ||
14 | |||
15 | /* | ||
16 | * All timing parameters are in nanoseconds. | ||
17 | */ | ||
18 | struct smc_config { | ||
19 | /* Delay from address valid to assertion of given strobe */ | ||
20 | u16 ncs_read_setup; | ||
21 | u16 nrd_setup; | ||
22 | u16 ncs_write_setup; | ||
23 | u16 nwe_setup; | ||
24 | |||
25 | /* Pulse length of given strobe */ | ||
26 | u16 ncs_read_pulse; | ||
27 | u16 nrd_pulse; | ||
28 | u16 ncs_write_pulse; | ||
29 | u16 nwe_pulse; | ||
30 | |||
31 | /* Total cycle length of given operation */ | ||
32 | u16 read_cycle; | ||
33 | u16 write_cycle; | ||
34 | |||
35 | /* Bus width in bytes */ | ||
36 | u8 bus_width; | ||
37 | |||
38 | /* | ||
39 | * 0: Data is sampled on rising edge of NCS | ||
40 | * 1: Data is sampled on rising edge of NRD | ||
41 | */ | ||
42 | unsigned int nrd_controlled:1; | ||
43 | |||
44 | /* | ||
45 | * 0: Data is driven on falling edge of NCS | ||
46 | * 1: Data is driven on falling edge of NWR | ||
47 | */ | ||
48 | unsigned int nwe_controlled:1; | ||
49 | |||
50 | /* | ||
51 | * 0: Byte select access type | ||
52 | * 1: Byte write access type | ||
53 | */ | ||
54 | unsigned int byte_write:1; | ||
55 | }; | ||
56 | |||
57 | extern int smc_set_configuration(int cs, const struct smc_config *config); | ||
58 | extern struct smc_config *smc_get_configuration(int cs); | ||
59 | |||
60 | #endif /* __ARCH_AT32AP_SMC_H */ | ||
diff --git a/include/asm-avr32/asm.h b/include/asm-avr32/asm.h new file mode 100644 index 000000000000..515c7618952b --- /dev/null +++ b/include/asm-avr32/asm.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_ASM_H__ | ||
9 | #define __ASM_AVR32_ASM_H__ | ||
10 | |||
11 | #include <asm/sysreg.h> | ||
12 | #include <asm/asm-offsets.h> | ||
13 | #include <asm/thread_info.h> | ||
14 | |||
15 | #define mask_interrupts ssrf SR_GM_BIT | ||
16 | #define mask_exceptions ssrf SR_EM_BIT | ||
17 | #define unmask_interrupts csrf SR_GM_BIT | ||
18 | #define unmask_exceptions csrf SR_EM_BIT | ||
19 | |||
20 | #ifdef CONFIG_FRAME_POINTER | ||
21 | .macro save_fp | ||
22 | st.w --sp, r7 | ||
23 | .endm | ||
24 | .macro restore_fp | ||
25 | ld.w r7, sp++ | ||
26 | .endm | ||
27 | .macro zero_fp | ||
28 | mov r7, 0 | ||
29 | .endm | ||
30 | #else | ||
31 | .macro save_fp | ||
32 | .endm | ||
33 | .macro restore_fp | ||
34 | .endm | ||
35 | .macro zero_fp | ||
36 | .endm | ||
37 | #endif | ||
38 | .macro get_thread_info reg | ||
39 | mov \reg, sp | ||
40 | andl \reg, ~(THREAD_SIZE - 1) & 0xffff | ||
41 | .endm | ||
42 | |||
43 | /* Save and restore registers */ | ||
44 | .macro save_min sr, tmp=lr | ||
45 | pushm lr | ||
46 | mfsr \tmp, \sr | ||
47 | zero_fp | ||
48 | st.w --sp, \tmp | ||
49 | .endm | ||
50 | |||
51 | .macro restore_min sr, tmp=lr | ||
52 | ld.w \tmp, sp++ | ||
53 | mtsr \sr, \tmp | ||
54 | popm lr | ||
55 | .endm | ||
56 | |||
57 | .macro save_half sr, tmp=lr | ||
58 | save_fp | ||
59 | pushm r8-r9,r10,r11,r12,lr | ||
60 | zero_fp | ||
61 | mfsr \tmp, \sr | ||
62 | st.w --sp, \tmp | ||
63 | .endm | ||
64 | |||
65 | .macro restore_half sr, tmp=lr | ||
66 | ld.w \tmp, sp++ | ||
67 | mtsr \sr, \tmp | ||
68 | popm r8-r9,r10,r11,r12,lr | ||
69 | restore_fp | ||
70 | .endm | ||
71 | |||
72 | .macro save_full_user sr, tmp=lr | ||
73 | stmts --sp, r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,sp,lr | ||
74 | st.w --sp, lr | ||
75 | zero_fp | ||
76 | mfsr \tmp, \sr | ||
77 | st.w --sp, \tmp | ||
78 | .endm | ||
79 | |||
80 | .macro restore_full_user sr, tmp=lr | ||
81 | ld.w \tmp, sp++ | ||
82 | mtsr \sr, \tmp | ||
83 | ld.w lr, sp++ | ||
84 | ldmts sp++, r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,sp,lr | ||
85 | .endm | ||
86 | |||
87 | /* uaccess macros */ | ||
88 | .macro branch_if_kernel scratch, label | ||
89 | get_thread_info \scratch | ||
90 | ld.w \scratch, \scratch[TI_flags] | ||
91 | bld \scratch, TIF_USERSPACE | ||
92 | brcc \label | ||
93 | .endm | ||
94 | |||
95 | .macro ret_if_privileged scratch, addr, size, ret | ||
96 | sub \scratch, \size, 1 | ||
97 | add \scratch, \addr | ||
98 | retcs \ret | ||
99 | retmi \ret | ||
100 | .endm | ||
101 | |||
102 | #endif /* __ASM_AVR32_ASM_H__ */ | ||
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h new file mode 100644 index 000000000000..e0b9c44c126c --- /dev/null +++ b/include/asm-avr32/atomic.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * Atomic operations that C can't guarantee us. Useful for | ||
3 | * resource counting etc. | ||
4 | * | ||
5 | * But use these as seldom as possible since they are slower than | ||
6 | * regular operations. | ||
7 | * | ||
8 | * Copyright (C) 2004-2006 Atmel Corporation | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | #ifndef __ASM_AVR32_ATOMIC_H | ||
15 | #define __ASM_AVR32_ATOMIC_H | ||
16 | |||
17 | #include <asm/system.h> | ||
18 | |||
19 | typedef struct { volatile int counter; } atomic_t; | ||
20 | #define ATOMIC_INIT(i) { (i) } | ||
21 | |||
22 | #define atomic_read(v) ((v)->counter) | ||
23 | #define atomic_set(v, i) (((v)->counter) = i) | ||
24 | |||
25 | /* | ||
26 | * atomic_sub_return - subtract the atomic variable | ||
27 | * @i: integer value to subtract | ||
28 | * @v: pointer of type atomic_t | ||
29 | * | ||
30 | * Atomically subtracts @i from @v. Returns the resulting value. | ||
31 | */ | ||
32 | static inline int atomic_sub_return(int i, atomic_t *v) | ||
33 | { | ||
34 | int result; | ||
35 | |||
36 | asm volatile( | ||
37 | "/* atomic_sub_return */\n" | ||
38 | "1: ssrf 5\n" | ||
39 | " ld.w %0, %2\n" | ||
40 | " sub %0, %3\n" | ||
41 | " stcond %1, %0\n" | ||
42 | " brne 1b" | ||
43 | : "=&r"(result), "=o"(v->counter) | ||
44 | : "m"(v->counter), "ir"(i) | ||
45 | : "cc"); | ||
46 | |||
47 | return result; | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * atomic_add_return - add integer to atomic variable | ||
52 | * @i: integer value to add | ||
53 | * @v: pointer of type atomic_t | ||
54 | * | ||
55 | * Atomically adds @i to @v. Returns the resulting value. | ||
56 | */ | ||
57 | static inline int atomic_add_return(int i, atomic_t *v) | ||
58 | { | ||
59 | int result; | ||
60 | |||
61 | if (__builtin_constant_p(i)) | ||
62 | result = atomic_sub_return(-i, v); | ||
63 | else | ||
64 | asm volatile( | ||
65 | "/* atomic_add_return */\n" | ||
66 | "1: ssrf 5\n" | ||
67 | " ld.w %0, %1\n" | ||
68 | " add %0, %3\n" | ||
69 | " stcond %2, %0\n" | ||
70 | " brne 1b" | ||
71 | : "=&r"(result), "=o"(v->counter) | ||
72 | : "m"(v->counter), "r"(i) | ||
73 | : "cc", "memory"); | ||
74 | |||
75 | return result; | ||
76 | } | ||
77 | |||
78 | /* | ||
79 | * atomic_sub_unless - sub unless the number is a given value | ||
80 | * @v: pointer of type atomic_t | ||
81 | * @a: the amount to add to v... | ||
82 | * @u: ...unless v is equal to u. | ||
83 | * | ||
84 | * If the atomic value v is not equal to u, this function subtracts a | ||
85 | * from v, and returns non zero. If v is equal to u then it returns | ||
86 | * zero. This is done as an atomic operation. | ||
87 | */ | ||
88 | static inline int atomic_sub_unless(atomic_t *v, int a, int u) | ||
89 | { | ||
90 | int tmp, result = 0; | ||
91 | |||
92 | asm volatile( | ||
93 | "/* atomic_sub_unless */\n" | ||
94 | "1: ssrf 5\n" | ||
95 | " ld.w %0, %3\n" | ||
96 | " cp.w %0, %5\n" | ||
97 | " breq 1f\n" | ||
98 | " sub %0, %4\n" | ||
99 | " stcond %2, %0\n" | ||
100 | " brne 1b\n" | ||
101 | " mov %1, 1\n" | ||
102 | "1:" | ||
103 | : "=&r"(tmp), "=&r"(result), "=o"(v->counter) | ||
104 | : "m"(v->counter), "ir"(a), "ir"(u) | ||
105 | : "cc", "memory"); | ||
106 | |||
107 | return result; | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * atomic_add_unless - add unless the number is a given value | ||
112 | * @v: pointer of type atomic_t | ||
113 | * @a: the amount to add to v... | ||
114 | * @u: ...unless v is equal to u. | ||
115 | * | ||
116 | * If the atomic value v is not equal to u, this function adds a to v, | ||
117 | * and returns non zero. If v is equal to u then it returns zero. This | ||
118 | * is done as an atomic operation. | ||
119 | */ | ||
120 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
121 | { | ||
122 | int tmp, result; | ||
123 | |||
124 | if (__builtin_constant_p(a)) | ||
125 | result = atomic_sub_unless(v, -a, u); | ||
126 | else { | ||
127 | result = 0; | ||
128 | asm volatile( | ||
129 | "/* atomic_add_unless */\n" | ||
130 | "1: ssrf 5\n" | ||
131 | " ld.w %0, %3\n" | ||
132 | " cp.w %0, %5\n" | ||
133 | " breq 1f\n" | ||
134 | " add %0, %4\n" | ||
135 | " stcond %2, %0\n" | ||
136 | " brne 1b\n" | ||
137 | " mov %1, 1\n" | ||
138 | "1:" | ||
139 | : "=&r"(tmp), "=&r"(result), "=o"(v->counter) | ||
140 | : "m"(v->counter), "r"(a), "ir"(u) | ||
141 | : "cc", "memory"); | ||
142 | } | ||
143 | |||
144 | return result; | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * atomic_sub_if_positive - conditionally subtract integer from atomic variable | ||
149 | * @i: integer value to subtract | ||
150 | * @v: pointer of type atomic_t | ||
151 | * | ||
152 | * Atomically test @v and subtract @i if @v is greater or equal than @i. | ||
153 | * The function returns the old value of @v minus @i. | ||
154 | */ | ||
155 | static inline int atomic_sub_if_positive(int i, atomic_t *v) | ||
156 | { | ||
157 | int result; | ||
158 | |||
159 | asm volatile( | ||
160 | "/* atomic_sub_if_positive */\n" | ||
161 | "1: ssrf 5\n" | ||
162 | " ld.w %0, %2\n" | ||
163 | " sub %0, %3\n" | ||
164 | " brlt 1f\n" | ||
165 | " stcond %1, %0\n" | ||
166 | " brne 1b\n" | ||
167 | "1:" | ||
168 | : "=&r"(result), "=o"(v->counter) | ||
169 | : "m"(v->counter), "ir"(i) | ||
170 | : "cc", "memory"); | ||
171 | |||
172 | return result; | ||
173 | } | ||
174 | |||
175 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | ||
176 | #define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) | ||
177 | |||
178 | #define atomic_sub(i, v) (void)atomic_sub_return(i, v) | ||
179 | #define atomic_add(i, v) (void)atomic_add_return(i, v) | ||
180 | #define atomic_dec(v) atomic_sub(1, (v)) | ||
181 | #define atomic_inc(v) atomic_add(1, (v)) | ||
182 | |||
183 | #define atomic_dec_return(v) atomic_sub_return(1, v) | ||
184 | #define atomic_inc_return(v) atomic_add_return(1, v) | ||
185 | |||
186 | #define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) | ||
187 | #define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) | ||
188 | #define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) | ||
189 | #define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0) | ||
190 | |||
191 | #define atomic_inc_not_zero(v) atomic_add_unless(v, 1, 0) | ||
192 | #define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) | ||
193 | |||
194 | #define smp_mb__before_atomic_dec() barrier() | ||
195 | #define smp_mb__after_atomic_dec() barrier() | ||
196 | #define smp_mb__before_atomic_inc() barrier() | ||
197 | #define smp_mb__after_atomic_inc() barrier() | ||
198 | |||
199 | #include <asm-generic/atomic.h> | ||
200 | |||
201 | #endif /* __ASM_AVR32_ATOMIC_H */ | ||
diff --git a/include/asm-avr32/auxvec.h b/include/asm-avr32/auxvec.h new file mode 100644 index 000000000000..d5dd435bf8f4 --- /dev/null +++ b/include/asm-avr32/auxvec.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __ASM_AVR32_AUXVEC_H | ||
2 | #define __ASM_AVR32_AUXVEC_H | ||
3 | |||
4 | #endif /* __ASM_AVR32_AUXVEC_H */ | ||
diff --git a/include/asm-avr32/bitops.h b/include/asm-avr32/bitops.h new file mode 100644 index 000000000000..5299f8c8e11d --- /dev/null +++ b/include/asm-avr32/bitops.h | |||
@@ -0,0 +1,296 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_BITOPS_H | ||
9 | #define __ASM_AVR32_BITOPS_H | ||
10 | |||
11 | #include <asm/byteorder.h> | ||
12 | #include <asm/system.h> | ||
13 | |||
14 | /* | ||
15 | * clear_bit() doesn't provide any barrier for the compiler | ||
16 | */ | ||
17 | #define smp_mb__before_clear_bit() barrier() | ||
18 | #define smp_mb__after_clear_bit() barrier() | ||
19 | |||
20 | /* | ||
21 | * set_bit - Atomically set a bit in memory | ||
22 | * @nr: the bit to set | ||
23 | * @addr: the address to start counting from | ||
24 | * | ||
25 | * This function is atomic and may not be reordered. See __set_bit() | ||
26 | * if you do not require the atomic guarantees. | ||
27 | * | ||
28 | * Note that @nr may be almost arbitrarily large; this function is not | ||
29 | * restricted to acting on a single-word quantity. | ||
30 | */ | ||
31 | static inline void set_bit(int nr, volatile void * addr) | ||
32 | { | ||
33 | unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG; | ||
34 | unsigned long tmp; | ||
35 | |||
36 | if (__builtin_constant_p(nr)) { | ||
37 | asm volatile( | ||
38 | "1: ssrf 5\n" | ||
39 | " ld.w %0, %2\n" | ||
40 | " sbr %0, %3\n" | ||
41 | " stcond %1, %0\n" | ||
42 | " brne 1b" | ||
43 | : "=&r"(tmp), "=o"(*p) | ||
44 | : "m"(*p), "i"(nr) | ||
45 | : "cc"); | ||
46 | } else { | ||
47 | unsigned long mask = 1UL << (nr % BITS_PER_LONG); | ||
48 | asm volatile( | ||
49 | "1: ssrf 5\n" | ||
50 | " ld.w %0, %2\n" | ||
51 | " or %0, %3\n" | ||
52 | " stcond %1, %0\n" | ||
53 | " brne 1b" | ||
54 | : "=&r"(tmp), "=o"(*p) | ||
55 | : "m"(*p), "r"(mask) | ||
56 | : "cc"); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * clear_bit - Clears a bit in memory | ||
62 | * @nr: Bit to clear | ||
63 | * @addr: Address to start counting from | ||
64 | * | ||
65 | * clear_bit() is atomic and may not be reordered. However, it does | ||
66 | * not contain a memory barrier, so if it is used for locking purposes, | ||
67 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | ||
68 | * in order to ensure changes are visible on other processors. | ||
69 | */ | ||
70 | static inline void clear_bit(int nr, volatile void * addr) | ||
71 | { | ||
72 | unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG; | ||
73 | unsigned long tmp; | ||
74 | |||
75 | if (__builtin_constant_p(nr)) { | ||
76 | asm volatile( | ||
77 | "1: ssrf 5\n" | ||
78 | " ld.w %0, %2\n" | ||
79 | " cbr %0, %3\n" | ||
80 | " stcond %1, %0\n" | ||
81 | " brne 1b" | ||
82 | : "=&r"(tmp), "=o"(*p) | ||
83 | : "m"(*p), "i"(nr) | ||
84 | : "cc"); | ||
85 | } else { | ||
86 | unsigned long mask = 1UL << (nr % BITS_PER_LONG); | ||
87 | asm volatile( | ||
88 | "1: ssrf 5\n" | ||
89 | " ld.w %0, %2\n" | ||
90 | " andn %0, %3\n" | ||
91 | " stcond %1, %0\n" | ||
92 | " brne 1b" | ||
93 | : "=&r"(tmp), "=o"(*p) | ||
94 | : "m"(*p), "r"(mask) | ||
95 | : "cc"); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * change_bit - Toggle a bit in memory | ||
101 | * @nr: Bit to change | ||
102 | * @addr: Address to start counting from | ||
103 | * | ||
104 | * change_bit() is atomic and may not be reordered. | ||
105 | * Note that @nr may be almost arbitrarily large; this function is not | ||
106 | * restricted to acting on a single-word quantity. | ||
107 | */ | ||
108 | static inline void change_bit(int nr, volatile void * addr) | ||
109 | { | ||
110 | unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG; | ||
111 | unsigned long mask = 1UL << (nr % BITS_PER_LONG); | ||
112 | unsigned long tmp; | ||
113 | |||
114 | asm volatile( | ||
115 | "1: ssrf 5\n" | ||
116 | " ld.w %0, %2\n" | ||
117 | " eor %0, %3\n" | ||
118 | " stcond %1, %0\n" | ||
119 | " brne 1b" | ||
120 | : "=&r"(tmp), "=o"(*p) | ||
121 | : "m"(*p), "r"(mask) | ||
122 | : "cc"); | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | * test_and_set_bit - Set a bit and return its old value | ||
127 | * @nr: Bit to set | ||
128 | * @addr: Address to count from | ||
129 | * | ||
130 | * This operation is atomic and cannot be reordered. | ||
131 | * It also implies a memory barrier. | ||
132 | */ | ||
133 | static inline int test_and_set_bit(int nr, volatile void * addr) | ||
134 | { | ||
135 | unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG; | ||
136 | unsigned long mask = 1UL << (nr % BITS_PER_LONG); | ||
137 | unsigned long tmp, old; | ||
138 | |||
139 | if (__builtin_constant_p(nr)) { | ||
140 | asm volatile( | ||
141 | "1: ssrf 5\n" | ||
142 | " ld.w %0, %3\n" | ||
143 | " mov %2, %0\n" | ||
144 | " sbr %0, %4\n" | ||
145 | " stcond %1, %0\n" | ||
146 | " brne 1b" | ||
147 | : "=&r"(tmp), "=o"(*p), "=&r"(old) | ||
148 | : "m"(*p), "i"(nr) | ||
149 | : "memory", "cc"); | ||
150 | } else { | ||
151 | asm volatile( | ||
152 | "1: ssrf 5\n" | ||
153 | " ld.w %2, %3\n" | ||
154 | " or %0, %2, %4\n" | ||
155 | " stcond %1, %0\n" | ||
156 | " brne 1b" | ||
157 | : "=&r"(tmp), "=o"(*p), "=&r"(old) | ||
158 | : "m"(*p), "r"(mask) | ||
159 | : "memory", "cc"); | ||
160 | } | ||
161 | |||
162 | return (old & mask) != 0; | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * test_and_clear_bit - Clear a bit and return its old value | ||
167 | * @nr: Bit to clear | ||
168 | * @addr: Address to count from | ||
169 | * | ||
170 | * This operation is atomic and cannot be reordered. | ||
171 | * It also implies a memory barrier. | ||
172 | */ | ||
173 | static inline int test_and_clear_bit(int nr, volatile void * addr) | ||
174 | { | ||
175 | unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG; | ||
176 | unsigned long mask = 1UL << (nr % BITS_PER_LONG); | ||
177 | unsigned long tmp, old; | ||
178 | |||
179 | if (__builtin_constant_p(nr)) { | ||
180 | asm volatile( | ||
181 | "1: ssrf 5\n" | ||
182 | " ld.w %0, %3\n" | ||
183 | " mov %2, %0\n" | ||
184 | " cbr %0, %4\n" | ||
185 | " stcond %1, %0\n" | ||
186 | " brne 1b" | ||
187 | : "=&r"(tmp), "=o"(*p), "=&r"(old) | ||
188 | : "m"(*p), "i"(nr) | ||
189 | : "memory", "cc"); | ||
190 | } else { | ||
191 | asm volatile( | ||
192 | "1: ssrf 5\n" | ||
193 | " ld.w %0, %3\n" | ||
194 | " mov %2, %0\n" | ||
195 | " andn %0, %4\n" | ||
196 | " stcond %1, %0\n" | ||
197 | " brne 1b" | ||
198 | : "=&r"(tmp), "=o"(*p), "=&r"(old) | ||
199 | : "m"(*p), "r"(mask) | ||
200 | : "memory", "cc"); | ||
201 | } | ||
202 | |||
203 | return (old & mask) != 0; | ||
204 | } | ||
205 | |||
206 | /* | ||
207 | * test_and_change_bit - Change a bit and return its old value | ||
208 | * @nr: Bit to change | ||
209 | * @addr: Address to count from | ||
210 | * | ||
211 | * This operation is atomic and cannot be reordered. | ||
212 | * It also implies a memory barrier. | ||
213 | */ | ||
214 | static inline int test_and_change_bit(int nr, volatile void * addr) | ||
215 | { | ||
216 | unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG; | ||
217 | unsigned long mask = 1UL << (nr % BITS_PER_LONG); | ||
218 | unsigned long tmp, old; | ||
219 | |||
220 | asm volatile( | ||
221 | "1: ssrf 5\n" | ||
222 | " ld.w %2, %3\n" | ||
223 | " eor %0, %2, %4\n" | ||
224 | " stcond %1, %0\n" | ||
225 | " brne 1b" | ||
226 | : "=&r"(tmp), "=o"(*p), "=&r"(old) | ||
227 | : "m"(*p), "r"(mask) | ||
228 | : "memory", "cc"); | ||
229 | |||
230 | return (old & mask) != 0; | ||
231 | } | ||
232 | |||
233 | #include <asm-generic/bitops/non-atomic.h> | ||
234 | |||
235 | /* Find First bit Set */ | ||
236 | static inline unsigned long __ffs(unsigned long word) | ||
237 | { | ||
238 | unsigned long result; | ||
239 | |||
240 | asm("brev %1\n\t" | ||
241 | "clz %0,%1" | ||
242 | : "=r"(result), "=&r"(word) | ||
243 | : "1"(word)); | ||
244 | return result; | ||
245 | } | ||
246 | |||
247 | /* Find First Zero */ | ||
248 | static inline unsigned long ffz(unsigned long word) | ||
249 | { | ||
250 | return __ffs(~word); | ||
251 | } | ||
252 | |||
253 | /* Find Last bit Set */ | ||
254 | static inline int fls(unsigned long word) | ||
255 | { | ||
256 | unsigned long result; | ||
257 | |||
258 | asm("clz %0,%1" : "=r"(result) : "r"(word)); | ||
259 | return 32 - result; | ||
260 | } | ||
261 | |||
262 | unsigned long find_first_zero_bit(const unsigned long *addr, | ||
263 | unsigned long size); | ||
264 | unsigned long find_next_zero_bit(const unsigned long *addr, | ||
265 | unsigned long size, | ||
266 | unsigned long offset); | ||
267 | unsigned long find_first_bit(const unsigned long *addr, | ||
268 | unsigned long size); | ||
269 | unsigned long find_next_bit(const unsigned long *addr, | ||
270 | unsigned long size, | ||
271 | unsigned long offset); | ||
272 | |||
273 | /* | ||
274 | * ffs: find first bit set. This is defined the same way as | ||
275 | * the libc and compiler builtin ffs routines, therefore | ||
276 | * differs in spirit from the above ffz (man ffs). | ||
277 | * | ||
278 | * The difference is that bit numbering starts at 1, and if no bit is set, | ||
279 | * the function returns 0. | ||
280 | */ | ||
281 | static inline int ffs(unsigned long word) | ||
282 | { | ||
283 | if(word == 0) | ||
284 | return 0; | ||
285 | return __ffs(word) + 1; | ||
286 | } | ||
287 | |||
288 | #include <asm-generic/bitops/fls64.h> | ||
289 | #include <asm-generic/bitops/sched.h> | ||
290 | #include <asm-generic/bitops/hweight.h> | ||
291 | |||
292 | #include <asm-generic/bitops/ext2-non-atomic.h> | ||
293 | #include <asm-generic/bitops/ext2-atomic.h> | ||
294 | #include <asm-generic/bitops/minix-le.h> | ||
295 | |||
296 | #endif /* __ASM_AVR32_BITOPS_H */ | ||
diff --git a/include/asm-avr32/bug.h b/include/asm-avr32/bug.h new file mode 100644 index 000000000000..521766bc9366 --- /dev/null +++ b/include/asm-avr32/bug.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_BUG_H | ||
9 | #define __ASM_AVR32_BUG_H | ||
10 | |||
11 | #ifdef CONFIG_BUG | ||
12 | |||
13 | /* | ||
14 | * According to our Chief Architect, this compact opcode is very | ||
15 | * unlikely to ever be implemented. | ||
16 | */ | ||
17 | #define AVR32_BUG_OPCODE 0x5df0 | ||
18 | |||
19 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
20 | |||
21 | #define BUG() \ | ||
22 | do { \ | ||
23 | asm volatile(".hword %0\n\t" \ | ||
24 | ".hword %1\n\t" \ | ||
25 | ".long %2" \ | ||
26 | : \ | ||
27 | : "n"(AVR32_BUG_OPCODE), \ | ||
28 | "i"(__LINE__), "X"(__FILE__)); \ | ||
29 | } while (0) | ||
30 | |||
31 | #else | ||
32 | |||
33 | #define BUG() \ | ||
34 | do { \ | ||
35 | asm volatile(".hword %0\n\t" \ | ||
36 | : : "n"(AVR32_BUG_OPCODE)); \ | ||
37 | } while (0) | ||
38 | |||
39 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | ||
40 | |||
41 | #define HAVE_ARCH_BUG | ||
42 | |||
43 | #endif /* CONFIG_BUG */ | ||
44 | |||
45 | #include <asm-generic/bug.h> | ||
46 | |||
47 | #endif /* __ASM_AVR32_BUG_H */ | ||
diff --git a/include/asm-avr32/bugs.h b/include/asm-avr32/bugs.h new file mode 100644 index 000000000000..7635e770622e --- /dev/null +++ b/include/asm-avr32/bugs.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * This is included by init/main.c to check for architecture-dependent bugs. | ||
3 | * | ||
4 | * Needs: | ||
5 | * void check_bugs(void); | ||
6 | */ | ||
7 | #ifndef __ASM_AVR32_BUGS_H | ||
8 | #define __ASM_AVR32_BUGS_H | ||
9 | |||
10 | static void __init check_bugs(void) | ||
11 | { | ||
12 | cpu_data->loops_per_jiffy = loops_per_jiffy; | ||
13 | } | ||
14 | |||
15 | #endif /* __ASM_AVR32_BUGS_H */ | ||
diff --git a/include/asm-avr32/byteorder.h b/include/asm-avr32/byteorder.h new file mode 100644 index 000000000000..402ff4125cdc --- /dev/null +++ b/include/asm-avr32/byteorder.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * AVR32 endian-conversion functions. | ||
3 | */ | ||
4 | #ifndef __ASM_AVR32_BYTEORDER_H | ||
5 | #define __ASM_AVR32_BYTEORDER_H | ||
6 | |||
7 | #include <asm/types.h> | ||
8 | #include <linux/compiler.h> | ||
9 | |||
10 | #ifdef __CHECKER__ | ||
11 | extern unsigned long __builtin_bswap_32(unsigned long x); | ||
12 | extern unsigned short __builtin_bswap_16(unsigned short x); | ||
13 | #endif | ||
14 | |||
15 | #define __arch__swab32(x) __builtin_bswap_32(x) | ||
16 | #define __arch__swab16(x) __builtin_bswap_16(x) | ||
17 | |||
18 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
19 | # define __BYTEORDER_HAS_U64__ | ||
20 | # define __SWAB_64_THRU_32__ | ||
21 | #endif | ||
22 | |||
23 | #include <linux/byteorder/big_endian.h> | ||
24 | |||
25 | #endif /* __ASM_AVR32_BYTEORDER_H */ | ||
diff --git a/include/asm-avr32/cache.h b/include/asm-avr32/cache.h new file mode 100644 index 000000000000..dabb955f3c00 --- /dev/null +++ b/include/asm-avr32/cache.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __ASM_AVR32_CACHE_H | ||
2 | #define __ASM_AVR32_CACHE_H | ||
3 | |||
4 | #define L1_CACHE_SHIFT 5 | ||
5 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
6 | |||
7 | #ifndef __ASSEMBLER__ | ||
8 | struct cache_info { | ||
9 | unsigned int ways; | ||
10 | unsigned int sets; | ||
11 | unsigned int linesz; | ||
12 | }; | ||
13 | #endif /* __ASSEMBLER */ | ||
14 | |||
15 | /* Cache operation constants */ | ||
16 | #define ICACHE_FLUSH 0x00 | ||
17 | #define ICACHE_INVALIDATE 0x01 | ||
18 | #define ICACHE_LOCK 0x02 | ||
19 | #define ICACHE_UNLOCK 0x03 | ||
20 | #define ICACHE_PREFETCH 0x04 | ||
21 | |||
22 | #define DCACHE_FLUSH 0x08 | ||
23 | #define DCACHE_LOCK 0x09 | ||
24 | #define DCACHE_UNLOCK 0x0a | ||
25 | #define DCACHE_INVALIDATE 0x0b | ||
26 | #define DCACHE_CLEAN 0x0c | ||
27 | #define DCACHE_CLEAN_INVAL 0x0d | ||
28 | |||
29 | #endif /* __ASM_AVR32_CACHE_H */ | ||
diff --git a/include/asm-avr32/cachectl.h b/include/asm-avr32/cachectl.h new file mode 100644 index 000000000000..4faf1ce60061 --- /dev/null +++ b/include/asm-avr32/cachectl.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __ASM_AVR32_CACHECTL_H | ||
2 | #define __ASM_AVR32_CACHECTL_H | ||
3 | |||
4 | /* | ||
5 | * Operations that can be performed through the cacheflush system call | ||
6 | */ | ||
7 | |||
8 | /* Clean the data cache, then invalidate the icache */ | ||
9 | #define CACHE_IFLUSH 0 | ||
10 | |||
11 | #endif /* __ASM_AVR32_CACHECTL_H */ | ||
diff --git a/include/asm-avr32/cacheflush.h b/include/asm-avr32/cacheflush.h new file mode 100644 index 000000000000..f1bf1708980e --- /dev/null +++ b/include/asm-avr32/cacheflush.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_CACHEFLUSH_H | ||
9 | #define __ASM_AVR32_CACHEFLUSH_H | ||
10 | |||
11 | /* Keep includes the same across arches. */ | ||
12 | #include <linux/mm.h> | ||
13 | |||
14 | #define CACHE_OP_ICACHE_INVALIDATE 0x01 | ||
15 | #define CACHE_OP_DCACHE_INVALIDATE 0x0b | ||
16 | #define CACHE_OP_DCACHE_CLEAN 0x0c | ||
17 | #define CACHE_OP_DCACHE_CLEAN_INVAL 0x0d | ||
18 | |||
19 | /* | ||
20 | * Invalidate any cacheline containing virtual address vaddr without | ||
21 | * writing anything back to memory. | ||
22 | * | ||
23 | * Note that this function may corrupt unrelated data structures when | ||
24 | * applied on buffers that are not cacheline aligned in both ends. | ||
25 | */ | ||
26 | static inline void invalidate_dcache_line(void *vaddr) | ||
27 | { | ||
28 | asm volatile("cache %0[0], %1" | ||
29 | : | ||
30 | : "r"(vaddr), "n"(CACHE_OP_DCACHE_INVALIDATE) | ||
31 | : "memory"); | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * Make sure any cacheline containing virtual address vaddr is written | ||
36 | * to memory. | ||
37 | */ | ||
38 | static inline void clean_dcache_line(void *vaddr) | ||
39 | { | ||
40 | asm volatile("cache %0[0], %1" | ||
41 | : | ||
42 | : "r"(vaddr), "n"(CACHE_OP_DCACHE_CLEAN) | ||
43 | : "memory"); | ||
44 | } | ||
45 | |||
46 | /* | ||
47 | * Make sure any cacheline containing virtual address vaddr is written | ||
48 | * to memory and then invalidate it. | ||
49 | */ | ||
50 | static inline void flush_dcache_line(void *vaddr) | ||
51 | { | ||
52 | asm volatile("cache %0[0], %1" | ||
53 | : | ||
54 | : "r"(vaddr), "n"(CACHE_OP_DCACHE_CLEAN_INVAL) | ||
55 | : "memory"); | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * Invalidate any instruction cacheline containing virtual address | ||
60 | * vaddr. | ||
61 | */ | ||
62 | static inline void invalidate_icache_line(void *vaddr) | ||
63 | { | ||
64 | asm volatile("cache %0[0], %1" | ||
65 | : | ||
66 | : "r"(vaddr), "n"(CACHE_OP_ICACHE_INVALIDATE) | ||
67 | : "memory"); | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | * Applies the above functions on all lines that are touched by the | ||
72 | * specified virtual address range. | ||
73 | */ | ||
74 | void invalidate_dcache_region(void *start, size_t len); | ||
75 | void clean_dcache_region(void *start, size_t len); | ||
76 | void flush_dcache_region(void *start, size_t len); | ||
77 | void invalidate_icache_region(void *start, size_t len); | ||
78 | |||
79 | /* | ||
80 | * Make sure any pending writes are completed before continuing. | ||
81 | */ | ||
82 | #define flush_write_buffer() asm volatile("sync 0" : : : "memory") | ||
83 | |||
84 | /* | ||
85 | * The following functions are called when a virtual mapping changes. | ||
86 | * We do not need to flush anything in this case. | ||
87 | */ | ||
88 | #define flush_cache_all() do { } while (0) | ||
89 | #define flush_cache_mm(mm) do { } while (0) | ||
90 | #define flush_cache_range(vma, start, end) do { } while (0) | ||
91 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | ||
92 | #define flush_cache_vmap(start, end) do { } while (0) | ||
93 | #define flush_cache_vunmap(start, end) do { } while (0) | ||
94 | |||
95 | /* | ||
96 | * I think we need to implement this one to be able to reliably | ||
97 | * execute pages from RAMDISK. However, if we implement the | ||
98 | * flush_dcache_*() functions, it might not be needed anymore. | ||
99 | * | ||
100 | * #define flush_icache_page(vma, page) do { } while (0) | ||
101 | */ | ||
102 | extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); | ||
103 | |||
104 | /* | ||
105 | * These are (I think) related to D-cache aliasing. We might need to | ||
106 | * do something here, but only for certain configurations. No such | ||
107 | * configurations exist at this time. | ||
108 | */ | ||
109 | #define flush_dcache_page(page) do { } while (0) | ||
110 | #define flush_dcache_mmap_lock(page) do { } while (0) | ||
111 | #define flush_dcache_mmap_unlock(page) do { } while (0) | ||
112 | |||
113 | /* | ||
114 | * These are for I/D cache coherency. In this case, we do need to | ||
115 | * flush with all configurations. | ||
116 | */ | ||
117 | extern void flush_icache_range(unsigned long start, unsigned long end); | ||
118 | extern void flush_icache_user_range(struct vm_area_struct *vma, | ||
119 | struct page *page, | ||
120 | unsigned long addr, int len); | ||
121 | |||
122 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) do { \ | ||
123 | memcpy(dst, src, len); \ | ||
124 | flush_icache_user_range(vma, page, vaddr, len); \ | ||
125 | } while(0) | ||
126 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
127 | memcpy(dst, src, len) | ||
128 | |||
129 | #endif /* __ASM_AVR32_CACHEFLUSH_H */ | ||
diff --git a/include/asm-avr32/checksum.h b/include/asm-avr32/checksum.h new file mode 100644 index 000000000000..41b7af09edc4 --- /dev/null +++ b/include/asm-avr32/checksum.h | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_CHECKSUM_H | ||
9 | #define __ASM_AVR32_CHECKSUM_H | ||
10 | |||
11 | /* | ||
12 | * computes the checksum of a memory block at buff, length len, | ||
13 | * and adds in "sum" (32-bit) | ||
14 | * | ||
15 | * returns a 32-bit number suitable for feeding into itself | ||
16 | * or csum_tcpudp_magic | ||
17 | * | ||
18 | * this function must be called with even lengths, except | ||
19 | * for the last fragment, which may be odd | ||
20 | * | ||
21 | * it's best to have buff aligned on a 32-bit boundary | ||
22 | */ | ||
23 | unsigned int csum_partial(const unsigned char * buff, int len, | ||
24 | unsigned int sum); | ||
25 | |||
26 | /* | ||
27 | * the same as csum_partial, but copies from src while it | ||
28 | * checksums, and handles user-space pointer exceptions correctly, when needed. | ||
29 | * | ||
30 | * here even more important to align src and dst on a 32-bit (or even | ||
31 | * better 64-bit) boundary | ||
32 | */ | ||
33 | unsigned int csum_partial_copy_generic(const char *src, char *dst, int len, | ||
34 | int sum, int *src_err_ptr, | ||
35 | int *dst_err_ptr); | ||
36 | |||
37 | /* | ||
38 | * Note: when you get a NULL pointer exception here this means someone | ||
39 | * passed in an incorrect kernel address to one of these functions. | ||
40 | * | ||
41 | * If you use these functions directly please don't forget the | ||
42 | * verify_area(). | ||
43 | */ | ||
44 | static inline | ||
45 | unsigned int csum_partial_copy_nocheck(const char *src, char *dst, | ||
46 | int len, int sum) | ||
47 | { | ||
48 | return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL); | ||
49 | } | ||
50 | |||
51 | static inline | ||
52 | unsigned int csum_partial_copy_from_user (const char __user *src, char *dst, | ||
53 | int len, int sum, int *err_ptr) | ||
54 | { | ||
55 | return csum_partial_copy_generic((const char __force *)src, dst, len, | ||
56 | sum, err_ptr, NULL); | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
61 | * which always checksum on 4 octet boundaries. | ||
62 | */ | ||
63 | static inline unsigned short ip_fast_csum(unsigned char *iph, | ||
64 | unsigned int ihl) | ||
65 | { | ||
66 | unsigned int sum, tmp; | ||
67 | |||
68 | __asm__ __volatile__( | ||
69 | " ld.w %0, %1++\n" | ||
70 | " ld.w %3, %1++\n" | ||
71 | " sub %2, 4\n" | ||
72 | " add %0, %3\n" | ||
73 | " ld.w %3, %1++\n" | ||
74 | " adc %0, %0, %3\n" | ||
75 | " ld.w %3, %1++\n" | ||
76 | " adc %0, %0, %3\n" | ||
77 | " acr %0\n" | ||
78 | "1: ld.w %3, %1++\n" | ||
79 | " add %0, %3\n" | ||
80 | " acr %0\n" | ||
81 | " sub %2, 1\n" | ||
82 | " brne 1b\n" | ||
83 | " lsl %3, %0, 16\n" | ||
84 | " andl %0, 0\n" | ||
85 | " mov %2, 0xffff\n" | ||
86 | " add %0, %3\n" | ||
87 | " adc %0, %0, %2\n" | ||
88 | " com %0\n" | ||
89 | " lsr %0, 16\n" | ||
90 | : "=r"(sum), "=r"(iph), "=r"(ihl), "=r"(tmp) | ||
91 | : "1"(iph), "2"(ihl) | ||
92 | : "memory", "cc"); | ||
93 | return sum; | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * Fold a partial checksum | ||
98 | */ | ||
99 | |||
100 | static inline unsigned int csum_fold(unsigned int sum) | ||
101 | { | ||
102 | unsigned int tmp; | ||
103 | |||
104 | asm(" bfextu %1, %0, 0, 16\n" | ||
105 | " lsr %0, 16\n" | ||
106 | " add %0, %1\n" | ||
107 | " bfextu %1, %0, 16, 16\n" | ||
108 | " add %0, %1" | ||
109 | : "=&r"(sum), "=&r"(tmp) | ||
110 | : "0"(sum)); | ||
111 | |||
112 | return ~sum; | ||
113 | } | ||
114 | |||
115 | static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, | ||
116 | unsigned long daddr, | ||
117 | unsigned short len, | ||
118 | unsigned short proto, | ||
119 | unsigned int sum) | ||
120 | { | ||
121 | asm(" add %0, %1\n" | ||
122 | " adc %0, %0, %2\n" | ||
123 | " adc %0, %0, %3\n" | ||
124 | " acr %0" | ||
125 | : "=r"(sum) | ||
126 | : "r"(daddr), "r"(saddr), "r"(ntohs(len) | (proto << 16)), | ||
127 | "0"(sum) | ||
128 | : "cc"); | ||
129 | |||
130 | return sum; | ||
131 | } | ||
132 | |||
133 | /* | ||
134 | * computes the checksum of the TCP/UDP pseudo-header | ||
135 | * returns a 16-bit checksum, already complemented | ||
136 | */ | ||
137 | static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, | ||
138 | unsigned long daddr, | ||
139 | unsigned short len, | ||
140 | unsigned short proto, | ||
141 | unsigned int sum) | ||
142 | { | ||
143 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
148 | * in icmp.c | ||
149 | */ | ||
150 | |||
151 | static inline unsigned short ip_compute_csum(unsigned char * buff, int len) | ||
152 | { | ||
153 | return csum_fold(csum_partial(buff, len, 0)); | ||
154 | } | ||
155 | |||
156 | #endif /* __ASM_AVR32_CHECKSUM_H */ | ||
diff --git a/include/asm-avr32/cputime.h b/include/asm-avr32/cputime.h new file mode 100644 index 000000000000..e87e0f81cbeb --- /dev/null +++ b/include/asm-avr32/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_CPUTIME_H | ||
2 | #define __ASM_AVR32_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_CPUTIME_H */ | ||
diff --git a/include/asm-avr32/current.h b/include/asm-avr32/current.h new file mode 100644 index 000000000000..c7b0549eab8a --- /dev/null +++ b/include/asm-avr32/current.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef __ASM_AVR32_CURRENT_H | ||
2 | #define __ASM_AVR32_CURRENT_H | ||
3 | |||
4 | #include <linux/thread_info.h> | ||
5 | |||
6 | struct task_struct; | ||
7 | |||
8 | inline static struct task_struct * get_current(void) | ||
9 | { | ||
10 | return current_thread_info()->task; | ||
11 | } | ||
12 | |||
13 | #define current get_current() | ||
14 | |||
15 | #endif /* __ASM_AVR32_CURRENT_H */ | ||
diff --git a/include/asm-avr32/delay.h b/include/asm-avr32/delay.h new file mode 100644 index 000000000000..cc3b2e3343b3 --- /dev/null +++ b/include/asm-avr32/delay.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef __ASM_AVR32_DELAY_H | ||
2 | #define __ASM_AVR32_DELAY_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 1993 Linus Torvalds | ||
6 | * | ||
7 | * Delay routines calling functions in arch/avr32/lib/delay.c | ||
8 | */ | ||
9 | |||
10 | extern void __bad_udelay(void); | ||
11 | extern void __bad_ndelay(void); | ||
12 | |||
13 | extern void __udelay(unsigned long usecs); | ||
14 | extern void __ndelay(unsigned long nsecs); | ||
15 | extern void __const_udelay(unsigned long usecs); | ||
16 | extern void __delay(unsigned long loops); | ||
17 | |||
18 | #define udelay(n) (__builtin_constant_p(n) ? \ | ||
19 | ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ | ||
20 | __udelay(n)) | ||
21 | |||
22 | #define ndelay(n) (__builtin_constant_p(n) ? \ | ||
23 | ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ | ||
24 | __ndelay(n)) | ||
25 | |||
26 | #endif /* __ASM_AVR32_DELAY_H */ | ||
diff --git a/include/asm-avr32/div64.h b/include/asm-avr32/div64.h new file mode 100644 index 000000000000..d7ddd4fdeca6 --- /dev/null +++ b/include/asm-avr32/div64.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_DIV64_H | ||
2 | #define __ASM_AVR32_DIV64_H | ||
3 | |||
4 | #include <asm-generic/div64.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_DIV64_H */ | ||
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h new file mode 100644 index 000000000000..4c40cb41cdf8 --- /dev/null +++ b/include/asm-avr32/dma-mapping.h | |||
@@ -0,0 +1,320 @@ | |||
1 | #ifndef __ASM_AVR32_DMA_MAPPING_H | ||
2 | #define __ASM_AVR32_DMA_MAPPING_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | #include <linux/device.h> | ||
6 | #include <asm/scatterlist.h> | ||
7 | #include <asm/processor.h> | ||
8 | #include <asm/cacheflush.h> | ||
9 | #include <asm/io.h> | ||
10 | |||
11 | extern void dma_cache_sync(void *vaddr, size_t size, int direction); | ||
12 | |||
13 | /* | ||
14 | * Return whether the given device DMA address mask can be supported | ||
15 | * properly. For example, if your device can only drive the low 24-bits | ||
16 | * during bus mastering, then you would pass 0x00ffffff as the mask | ||
17 | * to this function. | ||
18 | */ | ||
19 | static inline int dma_supported(struct device *dev, u64 mask) | ||
20 | { | ||
21 | /* Fix when needed. I really don't know of any limitations */ | ||
22 | return 1; | ||
23 | } | ||
24 | |||
25 | static inline int dma_set_mask(struct device *dev, u64 dma_mask) | ||
26 | { | ||
27 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | ||
28 | return -EIO; | ||
29 | |||
30 | *dev->dma_mask = dma_mask; | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * dma_alloc_coherent - allocate consistent memory for DMA | ||
36 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
37 | * @size: required memory size | ||
38 | * @handle: bus-specific DMA address | ||
39 | * | ||
40 | * Allocate some uncached, unbuffered memory for a device for | ||
41 | * performing DMA. This function allocates pages, and will | ||
42 | * return the CPU-viewed address, and sets @handle to be the | ||
43 | * device-viewed address. | ||
44 | */ | ||
45 | extern void *dma_alloc_coherent(struct device *dev, size_t size, | ||
46 | dma_addr_t *handle, gfp_t gfp); | ||
47 | |||
48 | /** | ||
49 | * dma_free_coherent - free memory allocated by dma_alloc_coherent | ||
50 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
51 | * @size: size of memory originally requested in dma_alloc_coherent | ||
52 | * @cpu_addr: CPU-view address returned from dma_alloc_coherent | ||
53 | * @handle: device-view address returned from dma_alloc_coherent | ||
54 | * | ||
55 | * Free (and unmap) a DMA buffer previously allocated by | ||
56 | * dma_alloc_coherent(). | ||
57 | * | ||
58 | * References to memory and mappings associated with cpu_addr/handle | ||
59 | * during and after this call executing are illegal. | ||
60 | */ | ||
61 | extern void dma_free_coherent(struct device *dev, size_t size, | ||
62 | void *cpu_addr, dma_addr_t handle); | ||
63 | |||
64 | /** | ||
65 | * dma_alloc_writecombine - allocate write-combining memory for DMA | ||
66 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
67 | * @size: required memory size | ||
68 | * @handle: bus-specific DMA address | ||
69 | * | ||
70 | * Allocate some uncached, buffered memory for a device for | ||
71 | * performing DMA. This function allocates pages, and will | ||
72 | * return the CPU-viewed address, and sets @handle to be the | ||
73 | * device-viewed address. | ||
74 | */ | ||
75 | extern void *dma_alloc_writecombine(struct device *dev, size_t size, | ||
76 | dma_addr_t *handle, gfp_t gfp); | ||
77 | |||
78 | /** | ||
79 | * dma_free_coherent - free memory allocated by dma_alloc_writecombine | ||
80 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
81 | * @size: size of memory originally requested in dma_alloc_writecombine | ||
82 | * @cpu_addr: CPU-view address returned from dma_alloc_writecombine | ||
83 | * @handle: device-view address returned from dma_alloc_writecombine | ||
84 | * | ||
85 | * Free (and unmap) a DMA buffer previously allocated by | ||
86 | * dma_alloc_writecombine(). | ||
87 | * | ||
88 | * References to memory and mappings associated with cpu_addr/handle | ||
89 | * during and after this call executing are illegal. | ||
90 | */ | ||
91 | extern void dma_free_writecombine(struct device *dev, size_t size, | ||
92 | void *cpu_addr, dma_addr_t handle); | ||
93 | |||
94 | /** | ||
95 | * dma_map_single - map a single buffer for streaming DMA | ||
96 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
97 | * @cpu_addr: CPU direct mapped address of buffer | ||
98 | * @size: size of buffer to map | ||
99 | * @dir: DMA transfer direction | ||
100 | * | ||
101 | * Ensure that any data held in the cache is appropriately discarded | ||
102 | * or written back. | ||
103 | * | ||
104 | * The device owns this memory once this call has completed. The CPU | ||
105 | * can regain ownership by calling dma_unmap_single() or dma_sync_single(). | ||
106 | */ | ||
107 | static inline dma_addr_t | ||
108 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, | ||
109 | enum dma_data_direction direction) | ||
110 | { | ||
111 | dma_cache_sync(cpu_addr, size, direction); | ||
112 | return virt_to_bus(cpu_addr); | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * dma_unmap_single - unmap a single buffer previously mapped | ||
117 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
118 | * @handle: DMA address of buffer | ||
119 | * @size: size of buffer to map | ||
120 | * @dir: DMA transfer direction | ||
121 | * | ||
122 | * Unmap a single streaming mode DMA translation. The handle and size | ||
123 | * must match what was provided in the previous dma_map_single() call. | ||
124 | * All other usages are undefined. | ||
125 | * | ||
126 | * After this call, reads by the CPU to the buffer are guaranteed to see | ||
127 | * whatever the device wrote there. | ||
128 | */ | ||
129 | static inline void | ||
130 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
131 | enum dma_data_direction direction) | ||
132 | { | ||
133 | |||
134 | } | ||
135 | |||
136 | /** | ||
137 | * dma_map_page - map a portion of a page for streaming DMA | ||
138 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
139 | * @page: page that buffer resides in | ||
140 | * @offset: offset into page for start of buffer | ||
141 | * @size: size of buffer to map | ||
142 | * @dir: DMA transfer direction | ||
143 | * | ||
144 | * Ensure that any data held in the cache is appropriately discarded | ||
145 | * or written back. | ||
146 | * | ||
147 | * The device owns this memory once this call has completed. The CPU | ||
148 | * can regain ownership by calling dma_unmap_page() or dma_sync_single(). | ||
149 | */ | ||
150 | static inline dma_addr_t | ||
151 | dma_map_page(struct device *dev, struct page *page, | ||
152 | unsigned long offset, size_t size, | ||
153 | enum dma_data_direction direction) | ||
154 | { | ||
155 | return dma_map_single(dev, page_address(page) + offset, | ||
156 | size, direction); | ||
157 | } | ||
158 | |||
159 | /** | ||
160 | * dma_unmap_page - unmap a buffer previously mapped through dma_map_page() | ||
161 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
162 | * @handle: DMA address of buffer | ||
163 | * @size: size of buffer to map | ||
164 | * @dir: DMA transfer direction | ||
165 | * | ||
166 | * Unmap a single streaming mode DMA translation. The handle and size | ||
167 | * must match what was provided in the previous dma_map_single() call. | ||
168 | * All other usages are undefined. | ||
169 | * | ||
170 | * After this call, reads by the CPU to the buffer are guaranteed to see | ||
171 | * whatever the device wrote there. | ||
172 | */ | ||
173 | static inline void | ||
174 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
175 | enum dma_data_direction direction) | ||
176 | { | ||
177 | dma_unmap_single(dev, dma_address, size, direction); | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * dma_map_sg - map a set of SG buffers for streaming mode DMA | ||
182 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
183 | * @sg: list of buffers | ||
184 | * @nents: number of buffers to map | ||
185 | * @dir: DMA transfer direction | ||
186 | * | ||
187 | * Map a set of buffers described by scatterlist in streaming | ||
188 | * mode for DMA. This is the scatter-gather version of the | ||
189 | * above pci_map_single interface. Here the scatter gather list | ||
190 | * elements are each tagged with the appropriate dma address | ||
191 | * and length. They are obtained via sg_dma_{address,length}(SG). | ||
192 | * | ||
193 | * NOTE: An implementation may be able to use a smaller number of | ||
194 | * DMA address/length pairs than there are SG table elements. | ||
195 | * (for example via virtual mapping capabilities) | ||
196 | * The routine returns the number of addr/length pairs actually | ||
197 | * used, at most nents. | ||
198 | * | ||
199 | * Device ownership issues as mentioned above for pci_map_single are | ||
200 | * the same here. | ||
201 | */ | ||
202 | static inline int | ||
203 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
204 | enum dma_data_direction direction) | ||
205 | { | ||
206 | int i; | ||
207 | |||
208 | for (i = 0; i < nents; i++) { | ||
209 | char *virt; | ||
210 | |||
211 | sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset; | ||
212 | virt = page_address(sg[i].page) + sg[i].offset; | ||
213 | dma_cache_sync(virt, sg[i].length, direction); | ||
214 | } | ||
215 | |||
216 | return nents; | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg | ||
221 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
222 | * @sg: list of buffers | ||
223 | * @nents: number of buffers to map | ||
224 | * @dir: DMA transfer direction | ||
225 | * | ||
226 | * Unmap a set of streaming mode DMA translations. | ||
227 | * Again, CPU read rules concerning calls here are the same as for | ||
228 | * pci_unmap_single() above. | ||
229 | */ | ||
230 | static inline void | ||
231 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
232 | enum dma_data_direction direction) | ||
233 | { | ||
234 | |||
235 | } | ||
236 | |||
237 | /** | ||
238 | * dma_sync_single_for_cpu | ||
239 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
240 | * @handle: DMA address of buffer | ||
241 | * @size: size of buffer to map | ||
242 | * @dir: DMA transfer direction | ||
243 | * | ||
244 | * Make physical memory consistent for a single streaming mode DMA | ||
245 | * translation after a transfer. | ||
246 | * | ||
247 | * If you perform a dma_map_single() but wish to interrogate the | ||
248 | * buffer using the cpu, yet do not wish to teardown the DMA mapping, | ||
249 | * you must call this function before doing so. At the next point you | ||
250 | * give the DMA address back to the card, you must first perform a | ||
251 | * dma_sync_single_for_device, and then the device again owns the | ||
252 | * buffer. | ||
253 | */ | ||
254 | static inline void | ||
255 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
256 | size_t size, enum dma_data_direction direction) | ||
257 | { | ||
258 | dma_cache_sync(bus_to_virt(dma_handle), size, direction); | ||
259 | } | ||
260 | |||
261 | static inline void | ||
262 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, | ||
263 | size_t size, enum dma_data_direction direction) | ||
264 | { | ||
265 | dma_cache_sync(bus_to_virt(dma_handle), size, direction); | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * dma_sync_sg_for_cpu | ||
270 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | ||
271 | * @sg: list of buffers | ||
272 | * @nents: number of buffers to map | ||
273 | * @dir: DMA transfer direction | ||
274 | * | ||
275 | * Make physical memory consistent for a set of streaming | ||
276 | * mode DMA translations after a transfer. | ||
277 | * | ||
278 | * The same as dma_sync_single_for_* but for a scatter-gather list, | ||
279 | * same rules and usage. | ||
280 | */ | ||
281 | static inline void | ||
282 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | ||
283 | int nents, enum dma_data_direction direction) | ||
284 | { | ||
285 | int i; | ||
286 | |||
287 | for (i = 0; i < nents; i++) { | ||
288 | dma_cache_sync(page_address(sg[i].page) + sg[i].offset, | ||
289 | sg[i].length, direction); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | static inline void | ||
294 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | ||
295 | int nents, enum dma_data_direction direction) | ||
296 | { | ||
297 | int i; | ||
298 | |||
299 | for (i = 0; i < nents; i++) { | ||
300 | dma_cache_sync(page_address(sg[i].page) + sg[i].offset, | ||
301 | sg[i].length, direction); | ||
302 | } | ||
303 | } | ||
304 | |||
305 | /* Now for the API extensions over the pci_ one */ | ||
306 | |||
307 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
308 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
309 | |||
310 | static inline int dma_is_consistent(dma_addr_t dma_addr) | ||
311 | { | ||
312 | return 1; | ||
313 | } | ||
314 | |||
315 | static inline int dma_get_cache_alignment(void) | ||
316 | { | ||
317 | return boot_cpu_data.dcache.linesz; | ||
318 | } | ||
319 | |||
320 | #endif /* __ASM_AVR32_DMA_MAPPING_H */ | ||
diff --git a/include/asm-avr32/dma.h b/include/asm-avr32/dma.h new file mode 100644 index 000000000000..9e91205590ac --- /dev/null +++ b/include/asm-avr32/dma.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __ASM_AVR32_DMA_H | ||
2 | #define __ASM_AVR32_DMA_H | ||
3 | |||
4 | /* The maximum address that we can perform a DMA transfer to on this platform. | ||
5 | * Not really applicable to AVR32, but some functions need it. */ | ||
6 | #define MAX_DMA_ADDRESS 0xffffffff | ||
7 | |||
8 | #endif /* __ASM_AVR32_DMA_H */ | ||
diff --git a/include/asm-avr32/elf.h b/include/asm-avr32/elf.h new file mode 100644 index 000000000000..d334b4994d2d --- /dev/null +++ b/include/asm-avr32/elf.h | |||
@@ -0,0 +1,110 @@ | |||
1 | #ifndef __ASM_AVR32_ELF_H | ||
2 | #define __ASM_AVR32_ELF_H | ||
3 | |||
4 | /* AVR32 relocation numbers */ | ||
5 | #define R_AVR32_NONE 0 | ||
6 | #define R_AVR32_32 1 | ||
7 | #define R_AVR32_16 2 | ||
8 | #define R_AVR32_8 3 | ||
9 | #define R_AVR32_32_PCREL 4 | ||
10 | #define R_AVR32_16_PCREL 5 | ||
11 | #define R_AVR32_8_PCREL 6 | ||
12 | #define R_AVR32_DIFF32 7 | ||
13 | #define R_AVR32_DIFF16 8 | ||
14 | #define R_AVR32_DIFF8 9 | ||
15 | #define R_AVR32_GOT32 10 | ||
16 | #define R_AVR32_GOT16 11 | ||
17 | #define R_AVR32_GOT8 12 | ||
18 | #define R_AVR32_21S 13 | ||
19 | #define R_AVR32_16U 14 | ||
20 | #define R_AVR32_16S 15 | ||
21 | #define R_AVR32_8S 16 | ||
22 | #define R_AVR32_8S_EXT 17 | ||
23 | #define R_AVR32_22H_PCREL 18 | ||
24 | #define R_AVR32_18W_PCREL 19 | ||
25 | #define R_AVR32_16B_PCREL 20 | ||
26 | #define R_AVR32_16N_PCREL 21 | ||
27 | #define R_AVR32_14UW_PCREL 22 | ||
28 | #define R_AVR32_11H_PCREL 23 | ||
29 | #define R_AVR32_10UW_PCREL 24 | ||
30 | #define R_AVR32_9H_PCREL 25 | ||
31 | #define R_AVR32_9UW_PCREL 26 | ||
32 | #define R_AVR32_HI16 27 | ||
33 | #define R_AVR32_LO16 28 | ||
34 | #define R_AVR32_GOTPC 29 | ||
35 | #define R_AVR32_GOTCALL 30 | ||
36 | #define R_AVR32_LDA_GOT 31 | ||
37 | #define R_AVR32_GOT21S 32 | ||
38 | #define R_AVR32_GOT18SW 33 | ||
39 | #define R_AVR32_GOT16S 34 | ||
40 | #define R_AVR32_GOT7UW 35 | ||
41 | #define R_AVR32_32_CPENT 36 | ||
42 | #define R_AVR32_CPCALL 37 | ||
43 | #define R_AVR32_16_CP 38 | ||
44 | #define R_AVR32_9W_CP 39 | ||
45 | #define R_AVR32_RELATIVE 40 | ||
46 | #define R_AVR32_GLOB_DAT 41 | ||
47 | #define R_AVR32_JMP_SLOT 42 | ||
48 | #define R_AVR32_ALIGN 43 | ||
49 | |||
50 | /* | ||
51 | * ELF register definitions.. | ||
52 | */ | ||
53 | |||
54 | #include <asm/ptrace.h> | ||
55 | #include <asm/user.h> | ||
56 | |||
57 | typedef unsigned long elf_greg_t; | ||
58 | |||
59 | #define ELF_NGREG (sizeof (struct pt_regs) / sizeof (elf_greg_t)) | ||
60 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
61 | |||
62 | typedef struct user_fpu_struct elf_fpregset_t; | ||
63 | |||
64 | /* | ||
65 | * This is used to ensure we don't load something for the wrong architecture. | ||
66 | */ | ||
67 | #define elf_check_arch(x) ( (x)->e_machine == EM_AVR32 ) | ||
68 | |||
69 | /* | ||
70 | * These are used to set parameters in the core dumps. | ||
71 | */ | ||
72 | #define ELF_CLASS ELFCLASS32 | ||
73 | #ifdef __LITTLE_ENDIAN__ | ||
74 | #define ELF_DATA ELFDATA2LSB | ||
75 | #else | ||
76 | #define ELF_DATA ELFDATA2MSB | ||
77 | #endif | ||
78 | #define ELF_ARCH EM_AVR32 | ||
79 | |||
80 | #define USE_ELF_CORE_DUMP | ||
81 | #define ELF_EXEC_PAGESIZE 4096 | ||
82 | |||
83 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
84 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
85 | the loader. We need to make sure that it is out of the way of the program | ||
86 | that it will "exec", and that there is sufficient room for the brk. */ | ||
87 | |||
88 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
89 | |||
90 | |||
91 | /* This yields a mask that user programs can use to figure out what | ||
92 | instruction set this CPU supports. This could be done in user space, | ||
93 | but it's not easy, and we've already done it here. */ | ||
94 | |||
95 | #define ELF_HWCAP (0) | ||
96 | |||
97 | /* This yields a string that ld.so will use to load implementation | ||
98 | specific libraries for optimization. This is more specific in | ||
99 | intent than poking at uname or /proc/cpuinfo. | ||
100 | |||
101 | For the moment, we have only optimizations for the Intel generations, | ||
102 | but that could change... */ | ||
103 | |||
104 | #define ELF_PLATFORM (NULL) | ||
105 | |||
106 | #ifdef __KERNEL__ | ||
107 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) | ||
108 | #endif | ||
109 | |||
110 | #endif /* __ASM_AVR32_ELF_H */ | ||
diff --git a/include/asm-avr32/emergency-restart.h b/include/asm-avr32/emergency-restart.h new file mode 100644 index 000000000000..3e7e014776ba --- /dev/null +++ b/include/asm-avr32/emergency-restart.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_EMERGENCY_RESTART_H | ||
2 | #define __ASM_AVR32_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_EMERGENCY_RESTART_H */ | ||
diff --git a/include/asm-avr32/errno.h b/include/asm-avr32/errno.h new file mode 100644 index 000000000000..558a7249f06d --- /dev/null +++ b/include/asm-avr32/errno.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_ERRNO_H | ||
2 | #define __ASM_AVR32_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_ERRNO_H */ | ||
diff --git a/include/asm-avr32/fcntl.h b/include/asm-avr32/fcntl.h new file mode 100644 index 000000000000..14c0c4402b11 --- /dev/null +++ b/include/asm-avr32/fcntl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_FCNTL_H | ||
2 | #define __ASM_AVR32_FCNTL_H | ||
3 | |||
4 | #include <asm-generic/fcntl.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_FCNTL_H */ | ||
diff --git a/include/asm-avr32/futex.h b/include/asm-avr32/futex.h new file mode 100644 index 000000000000..10419f14a68a --- /dev/null +++ b/include/asm-avr32/futex.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_FUTEX_H | ||
2 | #define __ASM_AVR32_FUTEX_H | ||
3 | |||
4 | #include <asm-generic/futex.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_FUTEX_H */ | ||
diff --git a/include/asm-avr32/hardirq.h b/include/asm-avr32/hardirq.h new file mode 100644 index 000000000000..267354356f60 --- /dev/null +++ b/include/asm-avr32/hardirq.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef __ASM_AVR32_HARDIRQ_H | ||
2 | #define __ASM_AVR32_HARDIRQ_H | ||
3 | |||
4 | #include <linux/threads.h> | ||
5 | #include <asm/irq.h> | ||
6 | |||
7 | #ifndef __ASSEMBLY__ | ||
8 | |||
9 | #include <linux/cache.h> | ||
10 | |||
11 | /* entry.S is sensitive to the offsets of these fields */ | ||
12 | typedef struct { | ||
13 | unsigned int __softirq_pending; | ||
14 | } ____cacheline_aligned irq_cpustat_t; | ||
15 | |||
16 | void ack_bad_irq(unsigned int irq); | ||
17 | |||
18 | /* Standard mappings for irq_cpustat_t above */ | ||
19 | #include <linux/irq_cpustat.h> | ||
20 | |||
21 | #endif /* __ASSEMBLY__ */ | ||
22 | |||
23 | #define HARDIRQ_BITS 12 | ||
24 | |||
25 | /* | ||
26 | * The hardirq mask has to be large enough to have | ||
27 | * space for potentially all IRQ sources in the system | ||
28 | * nesting on a single CPU: | ||
29 | */ | ||
30 | #if (1 << HARDIRQ_BITS) < NR_IRQS | ||
31 | # error HARDIRQ_BITS is too low! | ||
32 | #endif | ||
33 | |||
34 | #endif /* __ASM_AVR32_HARDIRQ_H */ | ||
diff --git a/include/asm-avr32/hw_irq.h b/include/asm-avr32/hw_irq.h new file mode 100644 index 000000000000..218b0a6bfd1b --- /dev/null +++ b/include/asm-avr32/hw_irq.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef __ASM_AVR32_HW_IRQ_H | ||
2 | #define __ASM_AVR32_HW_IRQ_H | ||
3 | |||
4 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) | ||
5 | { | ||
6 | /* Nothing to do */ | ||
7 | } | ||
8 | |||
9 | #endif /* __ASM_AVR32_HW_IRQ_H */ | ||
diff --git a/include/asm-avr32/intc.h b/include/asm-avr32/intc.h new file mode 100644 index 000000000000..1ac9ca75e8fd --- /dev/null +++ b/include/asm-avr32/intc.h | |||
@@ -0,0 +1,128 @@ | |||
1 | #ifndef __ASM_AVR32_INTC_H | ||
2 | #define __ASM_AVR32_INTC_H | ||
3 | |||
4 | #include <linux/sysdev.h> | ||
5 | #include <linux/interrupt.h> | ||
6 | |||
7 | struct irq_controller; | ||
8 | struct irqaction; | ||
9 | struct pt_regs; | ||
10 | |||
11 | struct platform_device; | ||
12 | |||
13 | /* Information about the internal interrupt controller */ | ||
14 | struct intc_device { | ||
15 | /* ioremapped address of configuration block */ | ||
16 | void __iomem *regs; | ||
17 | |||
18 | /* the physical device */ | ||
19 | struct platform_device *pdev; | ||
20 | |||
21 | /* Number of interrupt lines per group. */ | ||
22 | unsigned int irqs_per_group; | ||
23 | |||
24 | /* The highest group ID + 1 */ | ||
25 | unsigned int nr_groups; | ||
26 | |||
27 | /* | ||
28 | * Bitfield indicating which groups are actually in use. The | ||
29 | * size of the array is | ||
30 | * ceil(group_max / (8 * sizeof(unsigned int))). | ||
31 | */ | ||
32 | unsigned int group_mask[]; | ||
33 | }; | ||
34 | |||
35 | struct irq_controller_class { | ||
36 | /* | ||
37 | * A short name identifying this kind of controller. | ||
38 | */ | ||
39 | const char *typename; | ||
40 | /* | ||
41 | * Handle the IRQ. Must do any necessary acking and masking. | ||
42 | */ | ||
43 | irqreturn_t (*handle)(int irq, void *dev_id, struct pt_regs *regs); | ||
44 | /* | ||
45 | * Register a new IRQ handler. | ||
46 | */ | ||
47 | int (*setup)(struct irq_controller *ctrl, unsigned int irq, | ||
48 | struct irqaction *action); | ||
49 | /* | ||
50 | * Unregister a IRQ handler. | ||
51 | */ | ||
52 | void (*free)(struct irq_controller *ctrl, unsigned int irq, | ||
53 | void *dev_id); | ||
54 | /* | ||
55 | * Mask the IRQ in the interrupt controller. | ||
56 | */ | ||
57 | void (*mask)(struct irq_controller *ctrl, unsigned int irq); | ||
58 | /* | ||
59 | * Unmask the IRQ in the interrupt controller. | ||
60 | */ | ||
61 | void (*unmask)(struct irq_controller *ctrl, unsigned int irq); | ||
62 | /* | ||
63 | * Set the type of the IRQ. See below for possible types. | ||
64 | * Return -EINVAL if a given type is not supported | ||
65 | */ | ||
66 | int (*set_type)(struct irq_controller *ctrl, unsigned int irq, | ||
67 | unsigned int type); | ||
68 | /* | ||
69 | * Return the IRQ type currently set | ||
70 | */ | ||
71 | unsigned int (*get_type)(struct irq_controller *ctrl, unsigned int irq); | ||
72 | }; | ||
73 | |||
74 | struct irq_controller { | ||
75 | struct irq_controller_class *class; | ||
76 | unsigned int irq_group; | ||
77 | unsigned int first_irq; | ||
78 | unsigned int nr_irqs; | ||
79 | struct list_head list; | ||
80 | }; | ||
81 | |||
82 | struct intc_group_desc { | ||
83 | struct irq_controller *ctrl; | ||
84 | irqreturn_t (*handle)(int, void *, struct pt_regs *); | ||
85 | unsigned long flags; | ||
86 | void *dev_id; | ||
87 | const char *devname; | ||
88 | }; | ||
89 | |||
90 | /* | ||
91 | * The internal interrupt controller. Defined in board/part-specific | ||
92 | * devices.c. | ||
93 | * TODO: Should probably be defined per-cpu. | ||
94 | */ | ||
95 | extern struct intc_device intc; | ||
96 | |||
97 | extern int request_internal_irq(unsigned int irq, | ||
98 | irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
99 | unsigned long irqflags, | ||
100 | const char *devname, void *dev_id); | ||
101 | extern void free_internal_irq(unsigned int irq); | ||
102 | |||
103 | /* Only used by time_init() */ | ||
104 | extern int setup_internal_irq(unsigned int irq, struct intc_group_desc *desc); | ||
105 | |||
106 | /* | ||
107 | * Set interrupt priority for a given group. `group' can be found by | ||
108 | * using irq_to_group(irq). Priority can be from 0 (lowest) to 3 | ||
109 | * (highest). Higher-priority interrupts will preempt lower-priority | ||
110 | * interrupts (unless interrupts are masked globally). | ||
111 | * | ||
112 | * This function does not check for conflicts within a group. | ||
113 | */ | ||
114 | extern int intc_set_priority(unsigned int group, | ||
115 | unsigned int priority); | ||
116 | |||
117 | /* | ||
118 | * Returns a bitmask of pending interrupts in a group. | ||
119 | */ | ||
120 | extern unsigned long intc_get_pending(unsigned int group); | ||
121 | |||
122 | /* | ||
123 | * Register a new external interrupt controller. Returns the first | ||
124 | * external IRQ number that is assigned to the new controller. | ||
125 | */ | ||
126 | extern int intc_register_controller(struct irq_controller *ctrl); | ||
127 | |||
128 | #endif /* __ASM_AVR32_INTC_H */ | ||
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h new file mode 100644 index 000000000000..2fc8f111dce9 --- /dev/null +++ b/include/asm-avr32/io.h | |||
@@ -0,0 +1,253 @@ | |||
1 | #ifndef __ASM_AVR32_IO_H | ||
2 | #define __ASM_AVR32_IO_H | ||
3 | |||
4 | #include <linux/string.h> | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | |||
8 | #include <asm/addrspace.h> | ||
9 | #include <asm/byteorder.h> | ||
10 | |||
11 | /* virt_to_phys will only work when address is in P1 or P2 */ | ||
12 | static __inline__ unsigned long virt_to_phys(volatile void *address) | ||
13 | { | ||
14 | return PHYSADDR(address); | ||
15 | } | ||
16 | |||
17 | static __inline__ void * phys_to_virt(unsigned long address) | ||
18 | { | ||
19 | return (void *)P1SEGADDR(address); | ||
20 | } | ||
21 | |||
22 | #define cached_to_phys(addr) ((unsigned long)PHYSADDR(addr)) | ||
23 | #define uncached_to_phys(addr) ((unsigned long)PHYSADDR(addr)) | ||
24 | #define phys_to_cached(addr) ((void *)P1SEGADDR(addr)) | ||
25 | #define phys_to_uncached(addr) ((void *)P2SEGADDR(addr)) | ||
26 | |||
27 | /* | ||
28 | * Generic IO read/write. These perform native-endian accesses. Note | ||
29 | * that some architectures will want to re-define __raw_{read,write}w. | ||
30 | */ | ||
31 | extern void __raw_writesb(unsigned int addr, const void *data, int bytelen); | ||
32 | extern void __raw_writesw(unsigned int addr, const void *data, int wordlen); | ||
33 | extern void __raw_writesl(unsigned int addr, const void *data, int longlen); | ||
34 | |||
35 | extern void __raw_readsb(unsigned int addr, void *data, int bytelen); | ||
36 | extern void __raw_readsw(unsigned int addr, void *data, int wordlen); | ||
37 | extern void __raw_readsl(unsigned int addr, void *data, int longlen); | ||
38 | |||
39 | static inline void writeb(unsigned char b, volatile void __iomem *addr) | ||
40 | { | ||
41 | *(volatile unsigned char __force *)addr = b; | ||
42 | } | ||
43 | static inline void writew(unsigned short b, volatile void __iomem *addr) | ||
44 | { | ||
45 | *(volatile unsigned short __force *)addr = b; | ||
46 | } | ||
47 | static inline void writel(unsigned int b, volatile void __iomem *addr) | ||
48 | { | ||
49 | *(volatile unsigned int __force *)addr = b; | ||
50 | } | ||
51 | #define __raw_writeb writeb | ||
52 | #define __raw_writew writew | ||
53 | #define __raw_writel writel | ||
54 | |||
55 | static inline unsigned char readb(const volatile void __iomem *addr) | ||
56 | { | ||
57 | return *(const volatile unsigned char __force *)addr; | ||
58 | } | ||
59 | static inline unsigned short readw(const volatile void __iomem *addr) | ||
60 | { | ||
61 | return *(const volatile unsigned short __force *)addr; | ||
62 | } | ||
63 | static inline unsigned int readl(const volatile void __iomem *addr) | ||
64 | { | ||
65 | return *(const volatile unsigned int __force *)addr; | ||
66 | } | ||
67 | #define __raw_readb readb | ||
68 | #define __raw_readw readw | ||
69 | #define __raw_readl readl | ||
70 | |||
71 | #define writesb(p, d, l) __raw_writesb((unsigned int)p, d, l) | ||
72 | #define writesw(p, d, l) __raw_writesw((unsigned int)p, d, l) | ||
73 | #define writesl(p, d, l) __raw_writesl((unsigned int)p, d, l) | ||
74 | |||
75 | #define readsb(p, d, l) __raw_readsb((unsigned int)p, d, l) | ||
76 | #define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l) | ||
77 | #define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l) | ||
78 | |||
79 | /* | ||
80 | * These two are only here because ALSA _thinks_ it needs them... | ||
81 | */ | ||
82 | static inline void memcpy_fromio(void * to, const volatile void __iomem *from, | ||
83 | unsigned long count) | ||
84 | { | ||
85 | char *p = to; | ||
86 | while (count) { | ||
87 | count--; | ||
88 | *p = readb(from); | ||
89 | p++; | ||
90 | from++; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | static inline void memcpy_toio(volatile void __iomem *to, const void * from, | ||
95 | unsigned long count) | ||
96 | { | ||
97 | const char *p = from; | ||
98 | while (count) { | ||
99 | count--; | ||
100 | writeb(*p, to); | ||
101 | p++; | ||
102 | to++; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, | ||
107 | unsigned long count) | ||
108 | { | ||
109 | memset((void __force *)addr, val, count); | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * Bad read/write accesses... | ||
114 | */ | ||
115 | extern void __readwrite_bug(const char *fn); | ||
116 | |||
117 | #define IO_SPACE_LIMIT 0xffffffff | ||
118 | |||
119 | /* Convert I/O port address to virtual address */ | ||
120 | #define __io(p) ((void __iomem *)phys_to_uncached(p)) | ||
121 | |||
122 | /* | ||
123 | * IO port access primitives | ||
124 | * ------------------------- | ||
125 | * | ||
126 | * The AVR32 doesn't have special IO access instructions; all IO is memory | ||
127 | * mapped. Note that these are defined to perform little endian accesses | ||
128 | * only. Their primary purpose is to access PCI and ISA peripherals. | ||
129 | * | ||
130 | * Note that for a big endian machine, this implies that the following | ||
131 | * big endian mode connectivity is in place. | ||
132 | * | ||
133 | * The machine specific io.h include defines __io to translate an "IO" | ||
134 | * address to a memory address. | ||
135 | * | ||
136 | * Note that we prevent GCC re-ordering or caching values in expressions | ||
137 | * by introducing sequence points into the in*() definitions. Note that | ||
138 | * __raw_* do not guarantee this behaviour. | ||
139 | * | ||
140 | * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space. | ||
141 | */ | ||
142 | #define outb(v, p) __raw_writeb(v, __io(p)) | ||
143 | #define outw(v, p) __raw_writew(cpu_to_le16(v), __io(p)) | ||
144 | #define outl(v, p) __raw_writel(cpu_to_le32(v), __io(p)) | ||
145 | |||
146 | #define inb(p) __raw_readb(__io(p)) | ||
147 | #define inw(p) le16_to_cpu(__raw_readw(__io(p))) | ||
148 | #define inl(p) le32_to_cpu(__raw_readl(__io(p))) | ||
149 | |||
150 | static inline void __outsb(unsigned long port, void *addr, unsigned int count) | ||
151 | { | ||
152 | while (count--) { | ||
153 | outb(*(u8 *)addr, port); | ||
154 | addr++; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | static inline void __insb(unsigned long port, void *addr, unsigned int count) | ||
159 | { | ||
160 | while (count--) { | ||
161 | *(u8 *)addr = inb(port); | ||
162 | addr++; | ||
163 | } | ||
164 | } | ||
165 | |||
166 | static inline void __outsw(unsigned long port, void *addr, unsigned int count) | ||
167 | { | ||
168 | while (count--) { | ||
169 | outw(*(u16 *)addr, port); | ||
170 | addr += 2; | ||
171 | } | ||
172 | } | ||
173 | |||
174 | static inline void __insw(unsigned long port, void *addr, unsigned int count) | ||
175 | { | ||
176 | while (count--) { | ||
177 | *(u16 *)addr = inw(port); | ||
178 | addr += 2; | ||
179 | } | ||
180 | } | ||
181 | |||
182 | static inline void __outsl(unsigned long port, void *addr, unsigned int count) | ||
183 | { | ||
184 | while (count--) { | ||
185 | outl(*(u32 *)addr, port); | ||
186 | addr += 4; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | static inline void __insl(unsigned long port, void *addr, unsigned int count) | ||
191 | { | ||
192 | while (count--) { | ||
193 | *(u32 *)addr = inl(port); | ||
194 | addr += 4; | ||
195 | } | ||
196 | } | ||
197 | |||
198 | #define outsb(port, addr, count) __outsb(port, addr, count) | ||
199 | #define insb(port, addr, count) __insb(port, addr, count) | ||
200 | #define outsw(port, addr, count) __outsw(port, addr, count) | ||
201 | #define insw(port, addr, count) __insw(port, addr, count) | ||
202 | #define outsl(port, addr, count) __outsl(port, addr, count) | ||
203 | #define insl(port, addr, count) __insl(port, addr, count) | ||
204 | |||
205 | extern void __iomem *__ioremap(unsigned long offset, size_t size, | ||
206 | unsigned long flags); | ||
207 | extern void __iounmap(void __iomem *addr); | ||
208 | |||
209 | /* | ||
210 | * ioremap - map bus memory into CPU space | ||
211 | * @offset bus address of the memory | ||
212 | * @size size of the resource to map | ||
213 | * | ||
214 | * ioremap performs a platform specific sequence of operations to make | ||
215 | * bus memory CPU accessible via the readb/.../writel functions and | ||
216 | * the other mmio helpers. The returned address is not guaranteed to | ||
217 | * be usable directly as a virtual address. | ||
218 | */ | ||
219 | #define ioremap(offset, size) \ | ||
220 | __ioremap((offset), (size), 0) | ||
221 | |||
222 | #define iounmap(addr) \ | ||
223 | __iounmap(addr) | ||
224 | |||
225 | #define cached(addr) P1SEGADDR(addr) | ||
226 | #define uncached(addr) P2SEGADDR(addr) | ||
227 | |||
228 | #define virt_to_bus virt_to_phys | ||
229 | #define bus_to_virt phys_to_virt | ||
230 | #define page_to_bus page_to_phys | ||
231 | #define bus_to_page phys_to_page | ||
232 | |||
233 | #define dma_cache_wback_inv(_start, _size) \ | ||
234 | flush_dcache_region(_start, _size) | ||
235 | #define dma_cache_inv(_start, _size) \ | ||
236 | invalidate_dcache_region(_start, _size) | ||
237 | #define dma_cache_wback(_start, _size) \ | ||
238 | clean_dcache_region(_start, _size) | ||
239 | |||
240 | /* | ||
241 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
242 | * access | ||
243 | */ | ||
244 | #define xlate_dev_mem_ptr(p) __va(p) | ||
245 | |||
246 | /* | ||
247 | * Convert a virtual cached pointer to an uncached pointer | ||
248 | */ | ||
249 | #define xlate_dev_kmem_ptr(p) p | ||
250 | |||
251 | #endif /* __KERNEL__ */ | ||
252 | |||
253 | #endif /* __ASM_AVR32_IO_H */ | ||
diff --git a/include/asm-avr32/ioctl.h b/include/asm-avr32/ioctl.h new file mode 100644 index 000000000000..c8472c1398ef --- /dev/null +++ b/include/asm-avr32/ioctl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_IOCTL_H | ||
2 | #define __ASM_AVR32_IOCTL_H | ||
3 | |||
4 | #include <asm-generic/ioctl.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_IOCTL_H */ | ||
diff --git a/include/asm-avr32/ioctls.h b/include/asm-avr32/ioctls.h new file mode 100644 index 000000000000..0500426b7186 --- /dev/null +++ b/include/asm-avr32/ioctls.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef __ASM_AVR32_IOCTLS_H | ||
2 | #define __ASM_AVR32_IOCTLS_H | ||
3 | |||
4 | #include <asm/ioctl.h> | ||
5 | |||
6 | /* 0x54 is just a magic number to make these relatively unique ('T') */ | ||
7 | |||
8 | #define TCGETS 0x5401 | ||
9 | #define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */ | ||
10 | #define TCSETSW 0x5403 | ||
11 | #define TCSETSF 0x5404 | ||
12 | #define TCGETA 0x5405 | ||
13 | #define TCSETA 0x5406 | ||
14 | #define TCSETAW 0x5407 | ||
15 | #define TCSETAF 0x5408 | ||
16 | #define TCSBRK 0x5409 | ||
17 | #define TCXONC 0x540A | ||
18 | #define TCFLSH 0x540B | ||
19 | #define TIOCEXCL 0x540C | ||
20 | #define TIOCNXCL 0x540D | ||
21 | #define TIOCSCTTY 0x540E | ||
22 | #define TIOCGPGRP 0x540F | ||
23 | #define TIOCSPGRP 0x5410 | ||
24 | #define TIOCOUTQ 0x5411 | ||
25 | #define TIOCSTI 0x5412 | ||
26 | #define TIOCGWINSZ 0x5413 | ||
27 | #define TIOCSWINSZ 0x5414 | ||
28 | #define TIOCMGET 0x5415 | ||
29 | #define TIOCMBIS 0x5416 | ||
30 | #define TIOCMBIC 0x5417 | ||
31 | #define TIOCMSET 0x5418 | ||
32 | #define TIOCGSOFTCAR 0x5419 | ||
33 | #define TIOCSSOFTCAR 0x541A | ||
34 | #define FIONREAD 0x541B | ||
35 | #define TIOCINQ FIONREAD | ||
36 | #define TIOCLINUX 0x541C | ||
37 | #define TIOCCONS 0x541D | ||
38 | #define TIOCGSERIAL 0x541E | ||
39 | #define TIOCSSERIAL 0x541F | ||
40 | #define TIOCPKT 0x5420 | ||
41 | #define FIONBIO 0x5421 | ||
42 | #define TIOCNOTTY 0x5422 | ||
43 | #define TIOCSETD 0x5423 | ||
44 | #define TIOCGETD 0x5424 | ||
45 | #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ | ||
46 | /* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ | ||
47 | #define TIOCSBRK 0x5427 /* BSD compatibility */ | ||
48 | #define TIOCCBRK 0x5428 /* BSD compatibility */ | ||
49 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | ||
50 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | ||
51 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | ||
52 | |||
53 | #define FIONCLEX 0x5450 | ||
54 | #define FIOCLEX 0x5451 | ||
55 | #define FIOASYNC 0x5452 | ||
56 | #define TIOCSERCONFIG 0x5453 | ||
57 | #define TIOCSERGWILD 0x5454 | ||
58 | #define TIOCSERSWILD 0x5455 | ||
59 | #define TIOCGLCKTRMIOS 0x5456 | ||
60 | #define TIOCSLCKTRMIOS 0x5457 | ||
61 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
62 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
63 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
64 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
65 | |||
66 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | ||
67 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | ||
68 | #define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ | ||
69 | #define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ | ||
70 | #define FIOQSIZE 0x5460 | ||
71 | |||
72 | /* Used for packet mode */ | ||
73 | #define TIOCPKT_DATA 0 | ||
74 | #define TIOCPKT_FLUSHREAD 1 | ||
75 | #define TIOCPKT_FLUSHWRITE 2 | ||
76 | #define TIOCPKT_STOP 4 | ||
77 | #define TIOCPKT_START 8 | ||
78 | #define TIOCPKT_NOSTOP 16 | ||
79 | #define TIOCPKT_DOSTOP 32 | ||
80 | |||
81 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
82 | |||
83 | #endif /* __ASM_AVR32_IOCTLS_H */ | ||
diff --git a/include/asm-avr32/ipcbuf.h b/include/asm-avr32/ipcbuf.h new file mode 100644 index 000000000000..1552c9698f5e --- /dev/null +++ b/include/asm-avr32/ipcbuf.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __ASM_AVR32_IPCBUF_H | ||
2 | #define __ASM_AVR32_IPCBUF_H | ||
3 | |||
4 | /* | ||
5 | * The user_ipc_perm structure for AVR32 architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 32-bit mode_t and seq | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct ipc64_perm | ||
15 | { | ||
16 | __kernel_key_t key; | ||
17 | __kernel_uid32_t uid; | ||
18 | __kernel_gid32_t gid; | ||
19 | __kernel_uid32_t cuid; | ||
20 | __kernel_gid32_t cgid; | ||
21 | __kernel_mode_t mode; | ||
22 | unsigned short __pad1; | ||
23 | unsigned short seq; | ||
24 | unsigned short __pad2; | ||
25 | unsigned long __unused1; | ||
26 | unsigned long __unused2; | ||
27 | }; | ||
28 | |||
29 | #endif /* __ASM_AVR32_IPCBUF_H */ | ||
diff --git a/include/asm-avr32/irq.h b/include/asm-avr32/irq.h new file mode 100644 index 000000000000..f7e725707dd7 --- /dev/null +++ b/include/asm-avr32/irq.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __ASM_AVR32_IRQ_H | ||
2 | #define __ASM_AVR32_IRQ_H | ||
3 | |||
4 | #define NR_INTERNAL_IRQS 64 | ||
5 | #define NR_EXTERNAL_IRQS 64 | ||
6 | #define NR_IRQS (NR_INTERNAL_IRQS + NR_EXTERNAL_IRQS) | ||
7 | |||
8 | #define irq_canonicalize(i) (i) | ||
9 | |||
10 | #endif /* __ASM_AVR32_IOCTLS_H */ | ||
diff --git a/include/asm-avr32/irqflags.h b/include/asm-avr32/irqflags.h new file mode 100644 index 000000000000..93570daac38a --- /dev/null +++ b/include/asm-avr32/irqflags.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_IRQFLAGS_H | ||
9 | #define __ASM_AVR32_IRQFLAGS_H | ||
10 | |||
11 | #include <asm/sysreg.h> | ||
12 | |||
13 | static inline unsigned long __raw_local_save_flags(void) | ||
14 | { | ||
15 | return sysreg_read(SR); | ||
16 | } | ||
17 | |||
18 | #define raw_local_save_flags(x) \ | ||
19 | do { (x) = __raw_local_save_flags(); } while (0) | ||
20 | |||
21 | /* | ||
22 | * This will restore ALL status register flags, not only the interrupt | ||
23 | * mask flag. | ||
24 | * | ||
25 | * The empty asm statement informs the compiler of this fact while | ||
26 | * also serving as a barrier. | ||
27 | */ | ||
28 | static inline void raw_local_irq_restore(unsigned long flags) | ||
29 | { | ||
30 | sysreg_write(SR, flags); | ||
31 | asm volatile("" : : : "memory", "cc"); | ||
32 | } | ||
33 | |||
34 | static inline void raw_local_irq_disable(void) | ||
35 | { | ||
36 | asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory"); | ||
37 | } | ||
38 | |||
39 | static inline void raw_local_irq_enable(void) | ||
40 | { | ||
41 | asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory"); | ||
42 | } | ||
43 | |||
44 | static inline int raw_irqs_disabled_flags(unsigned long flags) | ||
45 | { | ||
46 | return (flags & SYSREG_BIT(GM)) != 0; | ||
47 | } | ||
48 | |||
49 | static inline int raw_irqs_disabled(void) | ||
50 | { | ||
51 | unsigned long flags = __raw_local_save_flags(); | ||
52 | |||
53 | return raw_irqs_disabled_flags(flags); | ||
54 | } | ||
55 | |||
56 | static inline unsigned long __raw_local_irq_save(void) | ||
57 | { | ||
58 | unsigned long flags = __raw_local_save_flags(); | ||
59 | |||
60 | raw_local_irq_disable(); | ||
61 | |||
62 | return flags; | ||
63 | } | ||
64 | |||
65 | #define raw_local_irq_save(flags) \ | ||
66 | do { (flags) = __raw_local_irq_save(); } while (0) | ||
67 | |||
68 | #endif /* __ASM_AVR32_IRQFLAGS_H */ | ||
diff --git a/include/asm-avr32/kdebug.h b/include/asm-avr32/kdebug.h new file mode 100644 index 000000000000..f583b643ffb2 --- /dev/null +++ b/include/asm-avr32/kdebug.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef __ASM_AVR32_KDEBUG_H | ||
2 | #define __ASM_AVR32_KDEBUG_H | ||
3 | |||
4 | #include <linux/notifier.h> | ||
5 | |||
6 | struct pt_regs; | ||
7 | |||
8 | struct die_args { | ||
9 | struct pt_regs *regs; | ||
10 | int trapnr; | ||
11 | }; | ||
12 | |||
13 | int register_die_notifier(struct notifier_block *nb); | ||
14 | int unregister_die_notifier(struct notifier_block *nb); | ||
15 | int register_page_fault_notifier(struct notifier_block *nb); | ||
16 | int unregister_page_fault_notifier(struct notifier_block *nb); | ||
17 | extern struct atomic_notifier_head avr32_die_chain; | ||
18 | |||
19 | /* Grossly misnamed. */ | ||
20 | enum die_val { | ||
21 | DIE_FAULT, | ||
22 | DIE_BREAKPOINT, | ||
23 | DIE_SSTEP, | ||
24 | DIE_PAGE_FAULT, | ||
25 | }; | ||
26 | |||
27 | static inline int notify_die(enum die_val val, struct pt_regs *regs, | ||
28 | int trap, int sig) | ||
29 | { | ||
30 | struct die_args args = { | ||
31 | .regs = regs, | ||
32 | .trapnr = trap, | ||
33 | }; | ||
34 | |||
35 | return atomic_notifier_call_chain(&avr32_die_chain, val, &args); | ||
36 | } | ||
37 | |||
38 | #endif /* __ASM_AVR32_KDEBUG_H */ | ||
diff --git a/include/asm-avr32/kmap_types.h b/include/asm-avr32/kmap_types.h new file mode 100644 index 000000000000..b7f5c6870107 --- /dev/null +++ b/include/asm-avr32/kmap_types.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef __ASM_AVR32_KMAP_TYPES_H | ||
2 | #define __ASM_AVR32_KMAP_TYPES_H | ||
3 | |||
4 | #ifdef CONFIG_DEBUG_HIGHMEM | ||
5 | # define D(n) __KM_FENCE_##n , | ||
6 | #else | ||
7 | # define D(n) | ||
8 | #endif | ||
9 | |||
10 | enum km_type { | ||
11 | D(0) KM_BOUNCE_READ, | ||
12 | D(1) KM_SKB_SUNRPC_DATA, | ||
13 | D(2) KM_SKB_DATA_SOFTIRQ, | ||
14 | D(3) KM_USER0, | ||
15 | D(4) KM_USER1, | ||
16 | D(5) KM_BIO_SRC_IRQ, | ||
17 | D(6) KM_BIO_DST_IRQ, | ||
18 | D(7) KM_PTE0, | ||
19 | D(8) KM_PTE1, | ||
20 | D(9) KM_PTE2, | ||
21 | D(10) KM_IRQ0, | ||
22 | D(11) KM_IRQ1, | ||
23 | D(12) KM_SOFTIRQ0, | ||
24 | D(13) KM_SOFTIRQ1, | ||
25 | D(14) KM_TYPE_NR | ||
26 | }; | ||
27 | |||
28 | #undef D | ||
29 | |||
30 | #endif /* __ASM_AVR32_KMAP_TYPES_H */ | ||
diff --git a/include/asm-avr32/kprobes.h b/include/asm-avr32/kprobes.h new file mode 100644 index 000000000000..09a5cbe2f896 --- /dev/null +++ b/include/asm-avr32/kprobes.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Kernel Probes (KProbes) | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Atmel Corporation | ||
5 | * Copyright (C) IBM Corporation, 2002, 2004 | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __ASM_AVR32_KPROBES_H | ||
12 | #define __ASM_AVR32_KPROBES_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | |||
16 | typedef u16 kprobe_opcode_t; | ||
17 | #define BREAKPOINT_INSTRUCTION 0xd673 /* breakpoint */ | ||
18 | #define MAX_INSN_SIZE 2 | ||
19 | |||
20 | #define ARCH_INACTIVE_KPROBE_COUNT 1 | ||
21 | |||
22 | #define arch_remove_kprobe(p) do { } while (0) | ||
23 | |||
24 | /* Architecture specific copy of original instruction */ | ||
25 | struct arch_specific_insn { | ||
26 | kprobe_opcode_t insn[MAX_INSN_SIZE]; | ||
27 | }; | ||
28 | |||
29 | extern int kprobe_exceptions_notify(struct notifier_block *self, | ||
30 | unsigned long val, void *data); | ||
31 | |||
32 | #define flush_insn_slot(p) do { } while (0) | ||
33 | |||
34 | #endif /* __ASM_AVR32_KPROBES_H */ | ||
diff --git a/include/asm-avr32/linkage.h b/include/asm-avr32/linkage.h new file mode 100644 index 000000000000..f7b285e910d4 --- /dev/null +++ b/include/asm-avr32/linkage.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | ||
2 | #define __ASM_LINKAGE_H | ||
3 | |||
4 | #define __ALIGN .balign 2 | ||
5 | #define __ALIGN_STR ".balign 2" | ||
6 | |||
7 | #endif /* __ASM_LINKAGE_H */ | ||
diff --git a/include/asm-avr32/local.h b/include/asm-avr32/local.h new file mode 100644 index 000000000000..1c1619694da3 --- /dev/null +++ b/include/asm-avr32/local.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_LOCAL_H | ||
2 | #define __ASM_AVR32_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_LOCAL_H */ | ||
diff --git a/include/asm-avr32/mach/serial_at91.h b/include/asm-avr32/mach/serial_at91.h new file mode 100644 index 000000000000..1290bb32802d --- /dev/null +++ b/include/asm-avr32/mach/serial_at91.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/mach/serial_at91.h | ||
3 | * | ||
4 | * Based on serial_sa1100.h by Nicolas Pitre | ||
5 | * | ||
6 | * Copyright (C) 2002 ATMEL Rousset | ||
7 | * | ||
8 | * Low level machine dependent UART functions. | ||
9 | */ | ||
10 | |||
11 | struct uart_port; | ||
12 | |||
13 | /* | ||
14 | * This is a temporary structure for registering these | ||
15 | * functions; it is intended to be discarded after boot. | ||
16 | */ | ||
17 | struct at91_port_fns { | ||
18 | void (*set_mctrl)(struct uart_port *, u_int); | ||
19 | u_int (*get_mctrl)(struct uart_port *); | ||
20 | void (*enable_ms)(struct uart_port *); | ||
21 | void (*pm)(struct uart_port *, u_int, u_int); | ||
22 | int (*set_wake)(struct uart_port *, u_int); | ||
23 | int (*open)(struct uart_port *); | ||
24 | void (*close)(struct uart_port *); | ||
25 | }; | ||
26 | |||
27 | #if defined(CONFIG_SERIAL_AT91) | ||
28 | void at91_register_uart_fns(struct at91_port_fns *fns); | ||
29 | #else | ||
30 | #define at91_register_uart_fns(fns) do { } while (0) | ||
31 | #endif | ||
32 | |||
33 | |||
diff --git a/include/asm-avr32/mman.h b/include/asm-avr32/mman.h new file mode 100644 index 000000000000..648f91e7187a --- /dev/null +++ b/include/asm-avr32/mman.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef __ASM_AVR32_MMAN_H__ | ||
2 | #define __ASM_AVR32_MMAN_H__ | ||
3 | |||
4 | #include <asm-generic/mman.h> | ||
5 | |||
6 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
7 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
8 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
9 | #define MAP_LOCKED 0x2000 /* pages are locked */ | ||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | ||
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ | ||
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
13 | |||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
16 | |||
17 | #endif /* __ASM_AVR32_MMAN_H__ */ | ||
diff --git a/include/asm-avr32/mmu.h b/include/asm-avr32/mmu.h new file mode 100644 index 000000000000..60c2d2650d32 --- /dev/null +++ b/include/asm-avr32/mmu.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __ASM_AVR32_MMU_H | ||
2 | #define __ASM_AVR32_MMU_H | ||
3 | |||
4 | /* Default "unsigned long" context */ | ||
5 | typedef unsigned long mm_context_t; | ||
6 | |||
7 | #define MMU_ITLB_ENTRIES 64 | ||
8 | #define MMU_DTLB_ENTRIES 64 | ||
9 | |||
10 | #endif /* __ASM_AVR32_MMU_H */ | ||
diff --git a/include/asm-avr32/mmu_context.h b/include/asm-avr32/mmu_context.h new file mode 100644 index 000000000000..31add1ae8089 --- /dev/null +++ b/include/asm-avr32/mmu_context.h | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * ASID handling taken from SH implementation. | ||
5 | * Copyright (C) 1999 Niibe Yutaka | ||
6 | * Copyright (C) 2003 Paul Mundt | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __ASM_AVR32_MMU_CONTEXT_H | ||
13 | #define __ASM_AVR32_MMU_CONTEXT_H | ||
14 | |||
15 | #include <asm/tlbflush.h> | ||
16 | #include <asm/pgalloc.h> | ||
17 | #include <asm/sysreg.h> | ||
18 | |||
19 | /* | ||
20 | * The MMU "context" consists of two things: | ||
21 | * (a) TLB cache version | ||
22 | * (b) ASID (Address Space IDentifier) | ||
23 | */ | ||
24 | #define MMU_CONTEXT_ASID_MASK 0x000000ff | ||
25 | #define MMU_CONTEXT_VERSION_MASK 0xffffff00 | ||
26 | #define MMU_CONTEXT_FIRST_VERSION 0x00000100 | ||
27 | #define NO_CONTEXT 0 | ||
28 | |||
29 | #define MMU_NO_ASID 0x100 | ||
30 | |||
31 | /* Virtual Page Number mask */ | ||
32 | #define MMU_VPN_MASK 0xfffff000 | ||
33 | |||
34 | /* Cache of MMU context last used */ | ||
35 | extern unsigned long mmu_context_cache; | ||
36 | |||
37 | /* | ||
38 | * Get MMU context if needed | ||
39 | */ | ||
40 | static inline void | ||
41 | get_mmu_context(struct mm_struct *mm) | ||
42 | { | ||
43 | unsigned long mc = mmu_context_cache; | ||
44 | |||
45 | if (((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0) | ||
46 | /* It's up to date, do nothing */ | ||
47 | return; | ||
48 | |||
49 | /* It's old, we need to get new context with new version */ | ||
50 | mc = ++mmu_context_cache; | ||
51 | if (!(mc & MMU_CONTEXT_ASID_MASK)) { | ||
52 | /* | ||
53 | * We have exhausted all ASIDs of this version. | ||
54 | * Flush the TLB and start new cycle. | ||
55 | */ | ||
56 | flush_tlb_all(); | ||
57 | /* | ||
58 | * Fix version. Note that we avoid version #0 | ||
59 | * to distinguish NO_CONTEXT. | ||
60 | */ | ||
61 | if (!mc) | ||
62 | mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; | ||
63 | } | ||
64 | mm->context = mc; | ||
65 | } | ||
66 | |||
67 | /* | ||
68 | * Initialize the context related info for a new mm_struct | ||
69 | * instance. | ||
70 | */ | ||
71 | static inline int init_new_context(struct task_struct *tsk, | ||
72 | struct mm_struct *mm) | ||
73 | { | ||
74 | mm->context = NO_CONTEXT; | ||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | /* | ||
79 | * Destroy context related info for an mm_struct that is about | ||
80 | * to be put to rest. | ||
81 | */ | ||
82 | static inline void destroy_context(struct mm_struct *mm) | ||
83 | { | ||
84 | /* Do nothing */ | ||
85 | } | ||
86 | |||
87 | static inline void set_asid(unsigned long asid) | ||
88 | { | ||
89 | /* XXX: We're destroying TLBEHI[8:31] */ | ||
90 | sysreg_write(TLBEHI, asid & MMU_CONTEXT_ASID_MASK); | ||
91 | cpu_sync_pipeline(); | ||
92 | } | ||
93 | |||
94 | static inline unsigned long get_asid(void) | ||
95 | { | ||
96 | unsigned long asid; | ||
97 | |||
98 | asid = sysreg_read(TLBEHI); | ||
99 | return asid & MMU_CONTEXT_ASID_MASK; | ||
100 | } | ||
101 | |||
102 | static inline void activate_context(struct mm_struct *mm) | ||
103 | { | ||
104 | get_mmu_context(mm); | ||
105 | set_asid(mm->context & MMU_CONTEXT_ASID_MASK); | ||
106 | } | ||
107 | |||
108 | static inline void switch_mm(struct mm_struct *prev, | ||
109 | struct mm_struct *next, | ||
110 | struct task_struct *tsk) | ||
111 | { | ||
112 | if (likely(prev != next)) { | ||
113 | unsigned long __pgdir = (unsigned long)next->pgd; | ||
114 | |||
115 | sysreg_write(PTBR, __pgdir); | ||
116 | activate_context(next); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | #define deactivate_mm(tsk,mm) do { } while(0) | ||
121 | |||
122 | #define activate_mm(prev, next) switch_mm((prev), (next), NULL) | ||
123 | |||
124 | static inline void | ||
125 | enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | |||
130 | static inline void enable_mmu(void) | ||
131 | { | ||
132 | sysreg_write(MMUCR, (SYSREG_BIT(MMUCR_S) | ||
133 | | SYSREG_BIT(E) | ||
134 | | SYSREG_BIT(MMUCR_I))); | ||
135 | nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop(); | ||
136 | |||
137 | if (mmu_context_cache == NO_CONTEXT) | ||
138 | mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; | ||
139 | |||
140 | set_asid(mmu_context_cache & MMU_CONTEXT_ASID_MASK); | ||
141 | } | ||
142 | |||
143 | static inline void disable_mmu(void) | ||
144 | { | ||
145 | sysreg_write(MMUCR, SYSREG_BIT(MMUCR_S)); | ||
146 | } | ||
147 | |||
148 | #endif /* __ASM_AVR32_MMU_CONTEXT_H */ | ||
diff --git a/include/asm-avr32/module.h b/include/asm-avr32/module.h new file mode 100644 index 000000000000..451444538a1b --- /dev/null +++ b/include/asm-avr32/module.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef __ASM_AVR32_MODULE_H | ||
2 | #define __ASM_AVR32_MODULE_H | ||
3 | |||
4 | struct mod_arch_syminfo { | ||
5 | unsigned long got_offset; | ||
6 | int got_initialized; | ||
7 | }; | ||
8 | |||
9 | struct mod_arch_specific { | ||
10 | /* Starting offset of got in the module core memory. */ | ||
11 | unsigned long got_offset; | ||
12 | /* Size of the got. */ | ||
13 | unsigned long got_size; | ||
14 | /* Number of symbols in syminfo. */ | ||
15 | int nsyms; | ||
16 | /* Additional symbol information (got offsets). */ | ||
17 | struct mod_arch_syminfo *syminfo; | ||
18 | }; | ||
19 | |||
20 | #define Elf_Shdr Elf32_Shdr | ||
21 | #define Elf_Sym Elf32_Sym | ||
22 | #define Elf_Ehdr Elf32_Ehdr | ||
23 | |||
24 | #define MODULE_PROC_FAMILY "AVR32v1" | ||
25 | |||
26 | #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | ||
27 | |||
28 | #endif /* __ASM_AVR32_MODULE_H */ | ||
diff --git a/include/asm-avr32/msgbuf.h b/include/asm-avr32/msgbuf.h new file mode 100644 index 000000000000..ac18bc4da7f7 --- /dev/null +++ b/include/asm-avr32/msgbuf.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef __ASM_AVR32_MSGBUF_H | ||
2 | #define __ASM_AVR32_MSGBUF_H | ||
3 | |||
4 | /* | ||
5 | * The msqid64_ds structure for i386 architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct msqid64_ds { | ||
15 | struct ipc64_perm msg_perm; | ||
16 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
17 | unsigned long __unused1; | ||
18 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
19 | unsigned long __unused2; | ||
20 | __kernel_time_t msg_ctime; /* last change time */ | ||
21 | unsigned long __unused3; | ||
22 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
23 | unsigned long msg_qnum; /* number of messages in queue */ | ||
24 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
25 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
26 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
27 | unsigned long __unused4; | ||
28 | unsigned long __unused5; | ||
29 | }; | ||
30 | |||
31 | #endif /* __ASM_AVR32_MSGBUF_H */ | ||
diff --git a/include/asm-avr32/mutex.h b/include/asm-avr32/mutex.h new file mode 100644 index 000000000000..458c1f7fbc18 --- /dev/null +++ b/include/asm-avr32/mutex.h | |||
@@ -0,0 +1,9 @@ | |||
1 | /* | ||
2 | * Pull in the generic implementation for the mutex fastpath. | ||
3 | * | ||
4 | * TODO: implement optimized primitives instead, or leave the generic | ||
5 | * implementation in place, or pick the atomic_xchg() based generic | ||
6 | * implementation. (see asm-generic/mutex-xchg.h for details) | ||
7 | */ | ||
8 | |||
9 | #include <asm-generic/mutex-dec.h> | ||
diff --git a/include/asm-avr32/namei.h b/include/asm-avr32/namei.h new file mode 100644 index 000000000000..f0a26de06cab --- /dev/null +++ b/include/asm-avr32/namei.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ASM_AVR32_NAMEI_H | ||
2 | #define __ASM_AVR32_NAMEI_H | ||
3 | |||
4 | /* This dummy routine may be changed to something useful */ | ||
5 | #define __emul_prefix() NULL | ||
6 | |||
7 | #endif /* __ASM_AVR32_NAMEI_H */ | ||
diff --git a/include/asm-avr32/numnodes.h b/include/asm-avr32/numnodes.h new file mode 100644 index 000000000000..0b864d7ce330 --- /dev/null +++ b/include/asm-avr32/numnodes.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ASM_AVR32_NUMNODES_H | ||
2 | #define __ASM_AVR32_NUMNODES_H | ||
3 | |||
4 | /* Max 4 nodes */ | ||
5 | #define NODES_SHIFT 2 | ||
6 | |||
7 | #endif /* __ASM_AVR32_NUMNODES_H */ | ||
diff --git a/include/asm-avr32/ocd.h b/include/asm-avr32/ocd.h new file mode 100644 index 000000000000..46f73180a127 --- /dev/null +++ b/include/asm-avr32/ocd.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * AVR32 OCD Registers | ||
3 | * | ||
4 | * Copyright (C) 2004-2006 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __ASM_AVR32_OCD_H | ||
11 | #define __ASM_AVR32_OCD_H | ||
12 | |||
13 | /* Debug Registers */ | ||
14 | #define DBGREG_DID 0 | ||
15 | #define DBGREG_DC 8 | ||
16 | #define DBGREG_DS 16 | ||
17 | #define DBGREG_RWCS 28 | ||
18 | #define DBGREG_RWA 36 | ||
19 | #define DBGREG_RWD 40 | ||
20 | #define DBGREG_WT 44 | ||
21 | #define DBGREG_DTC 52 | ||
22 | #define DBGREG_DTSA0 56 | ||
23 | #define DBGREG_DTSA1 60 | ||
24 | #define DBGREG_DTEA0 72 | ||
25 | #define DBGREG_DTEA1 76 | ||
26 | #define DBGREG_BWC0A 88 | ||
27 | #define DBGREG_BWC0B 92 | ||
28 | #define DBGREG_BWC1A 96 | ||
29 | #define DBGREG_BWC1B 100 | ||
30 | #define DBGREG_BWC2A 104 | ||
31 | #define DBGREG_BWC2B 108 | ||
32 | #define DBGREG_BWC3A 112 | ||
33 | #define DBGREG_BWC3B 116 | ||
34 | #define DBGREG_BWA0A 120 | ||
35 | #define DBGREG_BWA0B 124 | ||
36 | #define DBGREG_BWA1A 128 | ||
37 | #define DBGREG_BWA1B 132 | ||
38 | #define DBGREG_BWA2A 136 | ||
39 | #define DBGREG_BWA2B 140 | ||
40 | #define DBGREG_BWA3A 144 | ||
41 | #define DBGREG_BWA3B 148 | ||
42 | #define DBGREG_BWD3A 153 | ||
43 | #define DBGREG_BWD3B 156 | ||
44 | |||
45 | #define DBGREG_PID 284 | ||
46 | |||
47 | #define SABAH_OCD 0x01 | ||
48 | #define SABAH_ICACHE 0x02 | ||
49 | #define SABAH_MEM_CACHED 0x04 | ||
50 | #define SABAH_MEM_UNCACHED 0x05 | ||
51 | |||
52 | /* Fields in the Development Control register */ | ||
53 | #define DC_SS_BIT 8 | ||
54 | |||
55 | #define DC_SS (1 << DC_SS_BIT) | ||
56 | #define DC_DBE (1 << 13) | ||
57 | #define DC_RID (1 << 27) | ||
58 | #define DC_ORP (1 << 28) | ||
59 | #define DC_MM (1 << 29) | ||
60 | #define DC_RES (1 << 30) | ||
61 | |||
62 | /* Fields in the Development Status register */ | ||
63 | #define DS_SSS (1 << 0) | ||
64 | #define DS_SWB (1 << 1) | ||
65 | #define DS_HWB (1 << 2) | ||
66 | #define DS_BP_SHIFT 8 | ||
67 | #define DS_BP_MASK (0xff << DS_BP_SHIFT) | ||
68 | |||
69 | #define __mfdr(addr) \ | ||
70 | ({ \ | ||
71 | register unsigned long value; \ | ||
72 | asm volatile("mfdr %0, %1" : "=r"(value) : "i"(addr)); \ | ||
73 | value; \ | ||
74 | }) | ||
75 | #define __mtdr(addr, value) \ | ||
76 | asm volatile("mtdr %0, %1" : : "i"(addr), "r"(value)) | ||
77 | |||
78 | #endif /* __ASM_AVR32_OCD_H */ | ||
diff --git a/include/asm-avr32/page.h b/include/asm-avr32/page.h new file mode 100644 index 000000000000..0f630b3e9932 --- /dev/null +++ b/include/asm-avr32/page.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_PAGE_H | ||
9 | #define __ASM_AVR32_PAGE_H | ||
10 | |||
11 | #ifdef __KERNEL__ | ||
12 | |||
13 | /* PAGE_SHIFT determines the page size */ | ||
14 | #define PAGE_SHIFT 12 | ||
15 | #ifdef __ASSEMBLY__ | ||
16 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
17 | #else | ||
18 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
19 | #endif | ||
20 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
21 | #define PTE_MASK PAGE_MASK | ||
22 | |||
23 | #ifndef __ASSEMBLY__ | ||
24 | |||
25 | #include <asm/addrspace.h> | ||
26 | |||
27 | extern void clear_page(void *to); | ||
28 | extern void copy_page(void *to, void *from); | ||
29 | |||
30 | #define clear_user_page(page, vaddr, pg) clear_page(page) | ||
31 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
32 | |||
33 | /* | ||
34 | * These are used to make use of C type-checking.. | ||
35 | */ | ||
36 | typedef struct { unsigned long pte; } pte_t; | ||
37 | typedef struct { unsigned long pgd; } pgd_t; | ||
38 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
39 | |||
40 | #define pte_val(x) ((x).pte) | ||
41 | #define pgd_val(x) ((x).pgd) | ||
42 | #define pgprot_val(x) ((x).pgprot) | ||
43 | |||
44 | #define __pte(x) ((pte_t) { (x) }) | ||
45 | #define __pgd(x) ((pgd_t) { (x) }) | ||
46 | #define __pgprot(x) ((pgprot_t) { (x) }) | ||
47 | |||
48 | /* FIXME: These should be removed soon */ | ||
49 | extern unsigned long memory_start, memory_end; | ||
50 | |||
51 | /* Pure 2^n version of get_order */ | ||
52 | static inline int get_order(unsigned long size) | ||
53 | { | ||
54 | unsigned lz; | ||
55 | |||
56 | size = (size - 1) >> PAGE_SHIFT; | ||
57 | asm("clz %0, %1" : "=r"(lz) : "r"(size)); | ||
58 | return 32 - lz; | ||
59 | } | ||
60 | |||
61 | #endif /* !__ASSEMBLY__ */ | ||
62 | |||
63 | /* Align the pointer to the (next) page boundary */ | ||
64 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) | ||
65 | |||
66 | /* | ||
67 | * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff | ||
68 | * permanently to the physical addresses 0x00000000 -> 0x1fffffff when | ||
69 | * segmentation is enabled. We want to make use of this in order to | ||
70 | * minimize TLB pressure. | ||
71 | */ | ||
72 | #define PAGE_OFFSET (0x80000000UL) | ||
73 | |||
74 | /* | ||
75 | * ALSA uses virt_to_page() on DMA pages, which I'm not entirely sure | ||
76 | * is a good idea. Anyway, we can't simply subtract PAGE_OFFSET here | ||
77 | * in that case, so we'll have to mask out the three most significant | ||
78 | * bits of the address instead... | ||
79 | * | ||
80 | * What's the difference between __pa() and virt_to_phys() anyway? | ||
81 | */ | ||
82 | #define __pa(x) PHYSADDR(x) | ||
83 | #define __va(x) ((void *)(P1SEGADDR(x))) | ||
84 | |||
85 | #define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT) | ||
86 | |||
87 | #define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT)) | ||
88 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
89 | |||
90 | #ifndef CONFIG_NEED_MULTIPLE_NODES | ||
91 | |||
92 | #define PHYS_PFN_OFFSET (CONFIG_PHYS_OFFSET >> PAGE_SHIFT) | ||
93 | |||
94 | #define pfn_to_page(pfn) (mem_map + ((pfn) - PHYS_PFN_OFFSET)) | ||
95 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PHYS_PFN_OFFSET) | ||
96 | #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) | ||
97 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ | ||
98 | |||
99 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
100 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
101 | |||
102 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ | ||
103 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
104 | |||
105 | /* | ||
106 | * Memory above this physical address will be considered highmem. | ||
107 | */ | ||
108 | #define HIGHMEM_START 0x20000000UL | ||
109 | |||
110 | #endif /* __KERNEL__ */ | ||
111 | |||
112 | #endif /* __ASM_AVR32_PAGE_H */ | ||
diff --git a/include/asm-avr32/param.h b/include/asm-avr32/param.h new file mode 100644 index 000000000000..34bc8d4c3b29 --- /dev/null +++ b/include/asm-avr32/param.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __ASM_AVR32_PARAM_H | ||
2 | #define __ASM_AVR32_PARAM_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | # define HZ CONFIG_HZ | ||
6 | # define USER_HZ 100 /* User interfaces are in "ticks" */ | ||
7 | # define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ | ||
8 | #endif | ||
9 | |||
10 | #ifndef HZ | ||
11 | # define HZ 100 | ||
12 | #endif | ||
13 | |||
14 | /* TODO: Should be configurable */ | ||
15 | #define EXEC_PAGESIZE 4096 | ||
16 | |||
17 | #ifndef NOGROUP | ||
18 | # define NOGROUP (-1) | ||
19 | #endif | ||
20 | |||
21 | #define MAXHOSTNAMELEN 64 | ||
22 | |||
23 | #endif /* __ASM_AVR32_PARAM_H */ | ||
diff --git a/include/asm-avr32/pci.h b/include/asm-avr32/pci.h new file mode 100644 index 000000000000..0f5f134b896a --- /dev/null +++ b/include/asm-avr32/pci.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __ASM_AVR32_PCI_H__ | ||
2 | #define __ASM_AVR32_PCI_H__ | ||
3 | |||
4 | /* We don't support PCI yet, but some drivers require this file anyway */ | ||
5 | |||
6 | #define PCI_DMA_BUS_IS_PHYS (1) | ||
7 | |||
8 | #endif /* __ASM_AVR32_PCI_H__ */ | ||
diff --git a/include/asm-avr32/percpu.h b/include/asm-avr32/percpu.h new file mode 100644 index 000000000000..69227b4cd0d4 --- /dev/null +++ b/include/asm-avr32/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_PERCPU_H | ||
2 | #define __ASM_AVR32_PERCPU_H | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_PERCPU_H */ | ||
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h new file mode 100644 index 000000000000..7492cfb92ced --- /dev/null +++ b/include/asm-avr32/pgalloc.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_PGALLOC_H | ||
9 | #define __ASM_AVR32_PGALLOC_H | ||
10 | |||
11 | #include <asm/processor.h> | ||
12 | #include <linux/threads.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/mm.h> | ||
15 | |||
16 | #define pmd_populate_kernel(mm, pmd, pte) \ | ||
17 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) | ||
18 | |||
19 | static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | ||
20 | struct page *pte) | ||
21 | { | ||
22 | set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); | ||
23 | } | ||
24 | |||
25 | /* | ||
26 | * Allocate and free page tables | ||
27 | */ | ||
28 | static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) | ||
29 | { | ||
30 | unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); | ||
31 | pgd_t *pgd = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL); | ||
32 | |||
33 | if (pgd) | ||
34 | memset(pgd, 0, pgd_size); | ||
35 | |||
36 | return pgd; | ||
37 | } | ||
38 | |||
39 | static inline void pgd_free(pgd_t *pgd) | ||
40 | { | ||
41 | kfree(pgd); | ||
42 | } | ||
43 | |||
44 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
45 | unsigned long address) | ||
46 | { | ||
47 | int count = 0; | ||
48 | pte_t *pte; | ||
49 | |||
50 | do { | ||
51 | pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT); | ||
52 | if (pte) | ||
53 | clear_page(pte); | ||
54 | else { | ||
55 | current->state = TASK_UNINTERRUPTIBLE; | ||
56 | schedule_timeout(HZ); | ||
57 | } | ||
58 | } while (!pte && (count++ < 10)); | ||
59 | |||
60 | return pte; | ||
61 | } | ||
62 | |||
63 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | ||
64 | unsigned long address) | ||
65 | { | ||
66 | int count = 0; | ||
67 | struct page *pte; | ||
68 | |||
69 | do { | ||
70 | pte = alloc_pages(GFP_KERNEL, 0); | ||
71 | if (pte) | ||
72 | clear_page(page_address(pte)); | ||
73 | else { | ||
74 | current->state = TASK_UNINTERRUPTIBLE; | ||
75 | schedule_timeout(HZ); | ||
76 | } | ||
77 | } while (!pte && (count++ < 10)); | ||
78 | |||
79 | return pte; | ||
80 | } | ||
81 | |||
82 | static inline void pte_free_kernel(pte_t *pte) | ||
83 | { | ||
84 | free_page((unsigned long)pte); | ||
85 | } | ||
86 | |||
87 | static inline void pte_free(struct page *pte) | ||
88 | { | ||
89 | __free_page(pte); | ||
90 | } | ||
91 | |||
92 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) | ||
93 | |||
94 | #define check_pgt_cache() do { } while(0) | ||
95 | |||
96 | #endif /* __ASM_AVR32_PGALLOC_H */ | ||
diff --git a/include/asm-avr32/pgtable-2level.h b/include/asm-avr32/pgtable-2level.h new file mode 100644 index 000000000000..425dd567b5b9 --- /dev/null +++ b/include/asm-avr32/pgtable-2level.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_PGTABLE_2LEVEL_H | ||
9 | #define __ASM_AVR32_PGTABLE_2LEVEL_H | ||
10 | |||
11 | #include <asm-generic/pgtable-nopmd.h> | ||
12 | |||
13 | /* | ||
14 | * Traditional 2-level paging structure | ||
15 | */ | ||
16 | #define PGDIR_SHIFT 22 | ||
17 | #define PTRS_PER_PGD 1024 | ||
18 | |||
19 | #define PTRS_PER_PTE 1024 | ||
20 | |||
21 | #ifndef __ASSEMBLY__ | ||
22 | #define pte_ERROR(e) \ | ||
23 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
24 | #define pgd_ERROR(e) \ | ||
25 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | ||
26 | |||
27 | /* | ||
28 | * Certain architectures need to do special things when PTEs | ||
29 | * within a page table are directly modified. Thus, the following | ||
30 | * hook is made available. | ||
31 | */ | ||
32 | #define set_pte(pteptr, pteval) (*(pteptr) = pteval) | ||
33 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep, pteval) | ||
34 | |||
35 | /* | ||
36 | * (pmds are folded into pgds so this doesn't get actually called, | ||
37 | * but the define is needed for a generic inline function.) | ||
38 | */ | ||
39 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | ||
40 | |||
41 | #define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT))) | ||
42 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
43 | #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
44 | |||
45 | #endif /* !__ASSEMBLY__ */ | ||
46 | |||
47 | #endif /* __ASM_AVR32_PGTABLE_2LEVEL_H */ | ||
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h new file mode 100644 index 000000000000..6b8ca9db2bd5 --- /dev/null +++ b/include/asm-avr32/pgtable.h | |||
@@ -0,0 +1,408 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_PGTABLE_H | ||
9 | #define __ASM_AVR32_PGTABLE_H | ||
10 | |||
11 | #include <asm/addrspace.h> | ||
12 | |||
13 | #ifndef __ASSEMBLY__ | ||
14 | #include <linux/sched.h> | ||
15 | |||
16 | #endif /* !__ASSEMBLY__ */ | ||
17 | |||
18 | /* | ||
19 | * Use two-level page tables just as the i386 (without PAE) | ||
20 | */ | ||
21 | #include <asm/pgtable-2level.h> | ||
22 | |||
23 | /* | ||
24 | * The following code might need some cleanup when the values are | ||
25 | * final... | ||
26 | */ | ||
27 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
28 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
29 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
30 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
31 | |||
32 | #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) | ||
33 | #define FIRST_USER_ADDRESS 0 | ||
34 | |||
35 | #define PTE_PHYS_MASK 0x1ffff000 | ||
36 | |||
37 | #ifndef __ASSEMBLY__ | ||
38 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
39 | extern void paging_init(void); | ||
40 | |||
41 | /* | ||
42 | * ZERO_PAGE is a global shared page that is always zero: used for | ||
43 | * zero-mapped memory areas etc. | ||
44 | */ | ||
45 | extern struct page *empty_zero_page; | ||
46 | #define ZERO_PAGE(vaddr) (empty_zero_page) | ||
47 | |||
48 | /* | ||
49 | * Just any arbitrary offset to the start of the vmalloc VM area: the | ||
50 | * current 8 MiB value just means that there will be a 8 MiB "hole" | ||
51 | * after the uncached physical memory (P2 segment) until the vmalloc | ||
52 | * area starts. That means that any out-of-bounds memory accesses will | ||
53 | * hopefully be caught; we don't know if the end of the P1/P2 segments | ||
54 | * are actually used for anything, but it is anyway safer to let the | ||
55 | * MMU catch these kinds of errors than to rely on the memory bus. | ||
56 | * | ||
57 | * A "hole" of the same size is added to the end of the P3 segment as | ||
58 | * well. It might seem wasteful to use 16 MiB of virtual address space | ||
59 | * on this, but we do have 512 MiB of it... | ||
60 | * | ||
61 | * The vmalloc() routines leave a hole of 4 KiB between each vmalloced | ||
62 | * area for the same reason. | ||
63 | */ | ||
64 | #define VMALLOC_OFFSET (8 * 1024 * 1024) | ||
65 | #define VMALLOC_START (P3SEG + VMALLOC_OFFSET) | ||
66 | #define VMALLOC_END (P4SEG - VMALLOC_OFFSET) | ||
67 | #endif /* !__ASSEMBLY__ */ | ||
68 | |||
69 | /* | ||
70 | * Page flags. Some of these flags are not directly supported by | ||
71 | * hardware, so we have to emulate them. | ||
72 | */ | ||
73 | #define _TLBEHI_BIT_VALID 9 | ||
74 | #define _TLBEHI_VALID (1 << _TLBEHI_BIT_VALID) | ||
75 | |||
76 | #define _PAGE_BIT_WT 0 /* W-bit : write-through */ | ||
77 | #define _PAGE_BIT_DIRTY 1 /* D-bit : page changed */ | ||
78 | #define _PAGE_BIT_SZ0 2 /* SZ0-bit : Size of page */ | ||
79 | #define _PAGE_BIT_SZ1 3 /* SZ1-bit : Size of page */ | ||
80 | #define _PAGE_BIT_EXECUTE 4 /* X-bit : execute access allowed */ | ||
81 | #define _PAGE_BIT_RW 5 /* AP0-bit : write access allowed */ | ||
82 | #define _PAGE_BIT_USER 6 /* AP1-bit : user space access allowed */ | ||
83 | #define _PAGE_BIT_BUFFER 7 /* B-bit : bufferable */ | ||
84 | #define _PAGE_BIT_GLOBAL 8 /* G-bit : global (ignore ASID) */ | ||
85 | #define _PAGE_BIT_CACHABLE 9 /* C-bit : cachable */ | ||
86 | |||
87 | /* If we drop support for 1K pages, we get two extra bits */ | ||
88 | #define _PAGE_BIT_PRESENT 10 | ||
89 | #define _PAGE_BIT_ACCESSED 11 /* software: page was accessed */ | ||
90 | |||
91 | /* The following flags are only valid when !PRESENT */ | ||
92 | #define _PAGE_BIT_FILE 0 /* software: pagecache or swap? */ | ||
93 | |||
94 | #define _PAGE_WT (1 << _PAGE_BIT_WT) | ||
95 | #define _PAGE_DIRTY (1 << _PAGE_BIT_DIRTY) | ||
96 | #define _PAGE_EXECUTE (1 << _PAGE_BIT_EXECUTE) | ||
97 | #define _PAGE_RW (1 << _PAGE_BIT_RW) | ||
98 | #define _PAGE_USER (1 << _PAGE_BIT_USER) | ||
99 | #define _PAGE_BUFFER (1 << _PAGE_BIT_BUFFER) | ||
100 | #define _PAGE_GLOBAL (1 << _PAGE_BIT_GLOBAL) | ||
101 | #define _PAGE_CACHABLE (1 << _PAGE_BIT_CACHABLE) | ||
102 | |||
103 | /* Software flags */ | ||
104 | #define _PAGE_ACCESSED (1 << _PAGE_BIT_ACCESSED) | ||
105 | #define _PAGE_PRESENT (1 << _PAGE_BIT_PRESENT) | ||
106 | #define _PAGE_FILE (1 << _PAGE_BIT_FILE) | ||
107 | |||
108 | /* | ||
109 | * Page types, i.e. sizes. _PAGE_TYPE_NONE corresponds to what is | ||
110 | * usually called _PAGE_PROTNONE on other architectures. | ||
111 | * | ||
112 | * XXX: Find out if _PAGE_PROTNONE is equivalent with !_PAGE_USER. If | ||
113 | * so, we can encode all possible page sizes (although we can't really | ||
114 | * support 1K pages anyway due to the _PAGE_PRESENT and _PAGE_ACCESSED | ||
115 | * bits) | ||
116 | * | ||
117 | */ | ||
118 | #define _PAGE_TYPE_MASK ((1 << _PAGE_BIT_SZ0) | (1 << _PAGE_BIT_SZ1)) | ||
119 | #define _PAGE_TYPE_NONE (0 << _PAGE_BIT_SZ0) | ||
120 | #define _PAGE_TYPE_SMALL (1 << _PAGE_BIT_SZ0) | ||
121 | #define _PAGE_TYPE_MEDIUM (2 << _PAGE_BIT_SZ0) | ||
122 | #define _PAGE_TYPE_LARGE (3 << _PAGE_BIT_SZ0) | ||
123 | |||
124 | /* | ||
125 | * Mask which drop software flags. We currently can't handle more than | ||
126 | * 512 MiB of physical memory, so we can use bits 29-31 for other | ||
127 | * stuff. With a fixed 4K page size, we can use bits 10-11 as well as | ||
128 | * bits 2-3 (SZ) | ||
129 | */ | ||
130 | #define _PAGE_FLAGS_HARDWARE_MASK 0xfffff3ff | ||
131 | |||
132 | #define _PAGE_FLAGS_CACHE_MASK (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT) | ||
133 | |||
134 | /* TODO: Check for saneness */ | ||
135 | /* User-mode page table flags (to be set in a pgd or pmd entry) */ | ||
136 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_TYPE_SMALL | _PAGE_RW \ | ||
137 | | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
138 | /* Kernel-mode page table flags */ | ||
139 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_TYPE_SMALL | _PAGE_RW \ | ||
140 | | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
141 | /* Flags that may be modified by software */ | ||
142 | #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY \ | ||
143 | | _PAGE_FLAGS_CACHE_MASK) | ||
144 | |||
145 | #define _PAGE_FLAGS_READ (_PAGE_CACHABLE | _PAGE_BUFFER) | ||
146 | #define _PAGE_FLAGS_WRITE (_PAGE_FLAGS_READ | _PAGE_RW | _PAGE_DIRTY) | ||
147 | |||
148 | #define _PAGE_NORMAL(x) __pgprot((x) | _PAGE_PRESENT | _PAGE_TYPE_SMALL \ | ||
149 | | _PAGE_ACCESSED) | ||
150 | |||
151 | #define PAGE_NONE (_PAGE_ACCESSED | _PAGE_TYPE_NONE) | ||
152 | #define PAGE_READ (_PAGE_FLAGS_READ | _PAGE_USER) | ||
153 | #define PAGE_EXEC (_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_USER) | ||
154 | #define PAGE_WRITE (_PAGE_FLAGS_WRITE | _PAGE_USER) | ||
155 | #define PAGE_KERNEL _PAGE_NORMAL(_PAGE_FLAGS_WRITE | _PAGE_EXECUTE | _PAGE_GLOBAL) | ||
156 | #define PAGE_KERNEL_RO _PAGE_NORMAL(_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_GLOBAL) | ||
157 | |||
158 | #define _PAGE_P(x) _PAGE_NORMAL((x) & ~(_PAGE_RW | _PAGE_DIRTY)) | ||
159 | #define _PAGE_S(x) _PAGE_NORMAL(x) | ||
160 | |||
161 | #define PAGE_COPY _PAGE_P(PAGE_WRITE | PAGE_READ) | ||
162 | |||
163 | #ifndef __ASSEMBLY__ | ||
164 | /* | ||
165 | * The hardware supports flags for write- and execute access. Read is | ||
166 | * always allowed if the page is loaded into the TLB, so the "-w-", | ||
167 | * "--x" and "-wx" mappings are implemented as "rw-", "r-x" and "rwx", | ||
168 | * respectively. | ||
169 | * | ||
170 | * The "---" case is handled by software; the page will simply not be | ||
171 | * loaded into the TLB if the page type is _PAGE_TYPE_NONE. | ||
172 | */ | ||
173 | |||
174 | #define __P000 __pgprot(PAGE_NONE) | ||
175 | #define __P001 _PAGE_P(PAGE_READ) | ||
176 | #define __P010 _PAGE_P(PAGE_WRITE) | ||
177 | #define __P011 _PAGE_P(PAGE_WRITE | PAGE_READ) | ||
178 | #define __P100 _PAGE_P(PAGE_EXEC) | ||
179 | #define __P101 _PAGE_P(PAGE_EXEC | PAGE_READ) | ||
180 | #define __P110 _PAGE_P(PAGE_EXEC | PAGE_WRITE) | ||
181 | #define __P111 _PAGE_P(PAGE_EXEC | PAGE_WRITE | PAGE_READ) | ||
182 | |||
183 | #define __S000 __pgprot(PAGE_NONE) | ||
184 | #define __S001 _PAGE_S(PAGE_READ) | ||
185 | #define __S010 _PAGE_S(PAGE_WRITE) | ||
186 | #define __S011 _PAGE_S(PAGE_WRITE | PAGE_READ) | ||
187 | #define __S100 _PAGE_S(PAGE_EXEC) | ||
188 | #define __S101 _PAGE_S(PAGE_EXEC | PAGE_READ) | ||
189 | #define __S110 _PAGE_S(PAGE_EXEC | PAGE_WRITE) | ||
190 | #define __S111 _PAGE_S(PAGE_EXEC | PAGE_WRITE | PAGE_READ) | ||
191 | |||
192 | #define pte_none(x) (!pte_val(x)) | ||
193 | #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) | ||
194 | |||
195 | #define pte_clear(mm,addr,xp) \ | ||
196 | do { \ | ||
197 | set_pte_at(mm, addr, xp, __pte(0)); \ | ||
198 | } while (0) | ||
199 | |||
200 | /* | ||
201 | * The following only work if pte_present() is true. | ||
202 | * Undefined behaviour if not.. | ||
203 | */ | ||
204 | static inline int pte_read(pte_t pte) | ||
205 | { | ||
206 | return pte_val(pte) & _PAGE_USER; | ||
207 | } | ||
208 | static inline int pte_write(pte_t pte) | ||
209 | { | ||
210 | return pte_val(pte) & _PAGE_RW; | ||
211 | } | ||
212 | static inline int pte_exec(pte_t pte) | ||
213 | { | ||
214 | return pte_val(pte) & _PAGE_EXECUTE; | ||
215 | } | ||
216 | static inline int pte_dirty(pte_t pte) | ||
217 | { | ||
218 | return pte_val(pte) & _PAGE_DIRTY; | ||
219 | } | ||
220 | static inline int pte_young(pte_t pte) | ||
221 | { | ||
222 | return pte_val(pte) & _PAGE_ACCESSED; | ||
223 | } | ||
224 | |||
225 | /* | ||
226 | * The following only work if pte_present() is not true. | ||
227 | */ | ||
228 | static inline int pte_file(pte_t pte) | ||
229 | { | ||
230 | return pte_val(pte) & _PAGE_FILE; | ||
231 | } | ||
232 | |||
233 | /* Mutator functions for PTE bits */ | ||
234 | static inline pte_t pte_rdprotect(pte_t pte) | ||
235 | { | ||
236 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); | ||
237 | return pte; | ||
238 | } | ||
239 | static inline pte_t pte_wrprotect(pte_t pte) | ||
240 | { | ||
241 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); | ||
242 | return pte; | ||
243 | } | ||
244 | static inline pte_t pte_exprotect(pte_t pte) | ||
245 | { | ||
246 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); | ||
247 | return pte; | ||
248 | } | ||
249 | static inline pte_t pte_mkclean(pte_t pte) | ||
250 | { | ||
251 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); | ||
252 | return pte; | ||
253 | } | ||
254 | static inline pte_t pte_mkold(pte_t pte) | ||
255 | { | ||
256 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); | ||
257 | return pte; | ||
258 | } | ||
259 | static inline pte_t pte_mkread(pte_t pte) | ||
260 | { | ||
261 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); | ||
262 | return pte; | ||
263 | } | ||
264 | static inline pte_t pte_mkwrite(pte_t pte) | ||
265 | { | ||
266 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); | ||
267 | return pte; | ||
268 | } | ||
269 | static inline pte_t pte_mkexec(pte_t pte) | ||
270 | { | ||
271 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); | ||
272 | return pte; | ||
273 | } | ||
274 | static inline pte_t pte_mkdirty(pte_t pte) | ||
275 | { | ||
276 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); | ||
277 | return pte; | ||
278 | } | ||
279 | static inline pte_t pte_mkyoung(pte_t pte) | ||
280 | { | ||
281 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); | ||
282 | return pte; | ||
283 | } | ||
284 | |||
285 | #define pmd_none(x) (!pmd_val(x)) | ||
286 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) | ||
287 | #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) | ||
288 | #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) \ | ||
289 | != _KERNPG_TABLE) | ||
290 | |||
291 | /* | ||
292 | * Permanent address of a page. We don't support highmem, so this is | ||
293 | * trivial. | ||
294 | */ | ||
295 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) | ||
296 | #define pte_page(x) phys_to_page(pte_val(x) & PTE_PHYS_MASK) | ||
297 | |||
298 | /* | ||
299 | * Mark the prot value as uncacheable and unbufferable | ||
300 | */ | ||
301 | #define pgprot_noncached(prot) \ | ||
302 | __pgprot(pgprot_val(prot) & ~(_PAGE_BUFFER | _PAGE_CACHABLE)) | ||
303 | |||
304 | /* | ||
305 | * Mark the prot value as uncacheable but bufferable | ||
306 | */ | ||
307 | #define pgprot_writecombine(prot) \ | ||
308 | __pgprot((pgprot_val(prot) & ~_PAGE_CACHABLE) | _PAGE_BUFFER) | ||
309 | |||
310 | /* | ||
311 | * Conversion functions: convert a page and protection to a page entry, | ||
312 | * and a page entry and page directory to the page they refer to. | ||
313 | * | ||
314 | * extern pte_t mk_pte(struct page *page, pgprot_t pgprot) | ||
315 | */ | ||
316 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | ||
317 | |||
318 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
319 | { | ||
320 | set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | ||
321 | | pgprot_val(newprot))); | ||
322 | return pte; | ||
323 | } | ||
324 | |||
325 | #define page_pte(page) page_pte_prot(page, __pgprot(0)) | ||
326 | |||
327 | #define pmd_page_vaddr(pmd) \ | ||
328 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ||
329 | |||
330 | #define pmd_page(pmd) (phys_to_page(pmd_val(pmd))) | ||
331 | |||
332 | /* to find an entry in a page-table-directory. */ | ||
333 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | ||
334 | #define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) | ||
335 | #define pgd_offset_current(address) \ | ||
336 | ((pgd_t *)__mfsr(SYSREG_PTBR) + pgd_index(address)) | ||
337 | |||
338 | /* to find an entry in a kernel page-table-directory */ | ||
339 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
340 | |||
341 | /* Find an entry in the third-level page table.. */ | ||
342 | #define pte_index(address) \ | ||
343 | ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
344 | #define pte_offset(dir, address) \ | ||
345 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) | ||
346 | #define pte_offset_kernel(dir, address) \ | ||
347 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) | ||
348 | #define pte_offset_map(dir, address) pte_offset_kernel(dir, address) | ||
349 | #define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) | ||
350 | #define pte_unmap(pte) do { } while (0) | ||
351 | #define pte_unmap_nested(pte) do { } while (0) | ||
352 | |||
353 | struct vm_area_struct; | ||
354 | extern void update_mmu_cache(struct vm_area_struct * vma, | ||
355 | unsigned long address, pte_t pte); | ||
356 | |||
357 | /* | ||
358 | * Encode and decode a swap entry | ||
359 | * | ||
360 | * Constraints: | ||
361 | * _PAGE_FILE at bit 0 | ||
362 | * _PAGE_TYPE_* at bits 2-3 (for emulating _PAGE_PROTNONE) | ||
363 | * _PAGE_PRESENT at bit 10 | ||
364 | * | ||
365 | * We encode the type into bits 4-9 and offset into bits 11-31. This | ||
366 | * gives us a 21 bits offset, or 2**21 * 4K = 8G usable swap space per | ||
367 | * device, and 64 possible types. | ||
368 | * | ||
369 | * NOTE: We should set ZEROs at the position of _PAGE_PRESENT | ||
370 | * and _PAGE_PROTNONE bits | ||
371 | */ | ||
372 | #define __swp_type(x) (((x).val >> 4) & 0x3f) | ||
373 | #define __swp_offset(x) ((x).val >> 11) | ||
374 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 4) | ((offset) << 11) }) | ||
375 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
376 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
377 | |||
378 | /* | ||
379 | * Encode and decode a nonlinear file mapping entry. We have to | ||
380 | * preserve _PAGE_FILE and _PAGE_PRESENT here. _PAGE_TYPE_* isn't | ||
381 | * necessary, since _PAGE_FILE implies !_PAGE_PROTNONE (?) | ||
382 | */ | ||
383 | #define PTE_FILE_MAX_BITS 30 | ||
384 | #define pte_to_pgoff(pte) (((pte_val(pte) >> 1) & 0x1ff) \ | ||
385 | | ((pte_val(pte) >> 11) << 9)) | ||
386 | #define pgoff_to_pte(off) ((pte_t) { ((((off) & 0x1ff) << 1) \ | ||
387 | | (((off) >> 9) << 11) \ | ||
388 | | _PAGE_FILE) }) | ||
389 | |||
390 | typedef pte_t *pte_addr_t; | ||
391 | |||
392 | #define kern_addr_valid(addr) (1) | ||
393 | |||
394 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | ||
395 | remap_pfn_range(vma, vaddr, pfn, size, prot) | ||
396 | |||
397 | #define MK_IOSPACE_PFN(space, pfn) (pfn) | ||
398 | #define GET_IOSPACE(pfn) 0 | ||
399 | #define GET_PFN(pfn) (pfn) | ||
400 | |||
401 | /* No page table caches to initialize (?) */ | ||
402 | #define pgtable_cache_init() do { } while(0) | ||
403 | |||
404 | #include <asm-generic/pgtable.h> | ||
405 | |||
406 | #endif /* !__ASSEMBLY__ */ | ||
407 | |||
408 | #endif /* __ASM_AVR32_PGTABLE_H */ | ||
diff --git a/include/asm-avr32/poll.h b/include/asm-avr32/poll.h new file mode 100644 index 000000000000..736e29755dfc --- /dev/null +++ b/include/asm-avr32/poll.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __ASM_AVR32_POLL_H | ||
2 | #define __ASM_AVR32_POLL_H | ||
3 | |||
4 | /* These are specified by iBCS2 */ | ||
5 | #define POLLIN 0x0001 | ||
6 | #define POLLPRI 0x0002 | ||
7 | #define POLLOUT 0x0004 | ||
8 | #define POLLERR 0x0008 | ||
9 | #define POLLHUP 0x0010 | ||
10 | #define POLLNVAL 0x0020 | ||
11 | |||
12 | /* The rest seem to be more-or-less nonstandard. Check them! */ | ||
13 | #define POLLRDNORM 0x0040 | ||
14 | #define POLLRDBAND 0x0080 | ||
15 | #define POLLWRNORM 0x0100 | ||
16 | #define POLLWRBAND 0x0200 | ||
17 | #define POLLMSG 0x0400 | ||
18 | #define POLLREMOVE 0x1000 | ||
19 | #define POLLRDHUP 0x2000 | ||
20 | |||
21 | struct pollfd { | ||
22 | int fd; | ||
23 | short events; | ||
24 | short revents; | ||
25 | }; | ||
26 | |||
27 | #endif /* __ASM_AVR32_POLL_H */ | ||
diff --git a/include/asm-avr32/posix_types.h b/include/asm-avr32/posix_types.h new file mode 100644 index 000000000000..2831b039b349 --- /dev/null +++ b/include/asm-avr32/posix_types.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_POSIX_TYPES_H | ||
9 | #define __ASM_AVR32_POSIX_TYPES_H | ||
10 | |||
11 | /* | ||
12 | * This file is generally used by user-level software, so you need to | ||
13 | * be a little careful about namespace pollution etc. Also, we cannot | ||
14 | * assume GCC is being used. | ||
15 | */ | ||
16 | |||
17 | typedef unsigned long __kernel_ino_t; | ||
18 | typedef unsigned short __kernel_mode_t; | ||
19 | typedef unsigned short __kernel_nlink_t; | ||
20 | typedef long __kernel_off_t; | ||
21 | typedef int __kernel_pid_t; | ||
22 | typedef unsigned short __kernel_ipc_pid_t; | ||
23 | typedef unsigned int __kernel_uid_t; | ||
24 | typedef unsigned int __kernel_gid_t; | ||
25 | typedef unsigned long __kernel_size_t; | ||
26 | typedef int __kernel_ssize_t; | ||
27 | typedef int __kernel_ptrdiff_t; | ||
28 | typedef long __kernel_time_t; | ||
29 | typedef long __kernel_suseconds_t; | ||
30 | typedef long __kernel_clock_t; | ||
31 | typedef int __kernel_timer_t; | ||
32 | typedef int __kernel_clockid_t; | ||
33 | typedef int __kernel_daddr_t; | ||
34 | typedef char * __kernel_caddr_t; | ||
35 | typedef unsigned short __kernel_uid16_t; | ||
36 | typedef unsigned short __kernel_gid16_t; | ||
37 | typedef unsigned int __kernel_uid32_t; | ||
38 | typedef unsigned int __kernel_gid32_t; | ||
39 | |||
40 | typedef unsigned short __kernel_old_uid_t; | ||
41 | typedef unsigned short __kernel_old_gid_t; | ||
42 | typedef unsigned short __kernel_old_dev_t; | ||
43 | |||
44 | #ifdef __GNUC__ | ||
45 | typedef long long __kernel_loff_t; | ||
46 | #endif | ||
47 | |||
48 | typedef struct { | ||
49 | #if defined(__KERNEL__) || defined(__USE_ALL) | ||
50 | int val[2]; | ||
51 | #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
52 | int __val[2]; | ||
53 | #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
54 | } __kernel_fsid_t; | ||
55 | |||
56 | #if defined(__KERNEL__) | ||
57 | |||
58 | #undef __FD_SET | ||
59 | static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) | ||
60 | { | ||
61 | unsigned long __tmp = __fd / __NFDBITS; | ||
62 | unsigned long __rem = __fd % __NFDBITS; | ||
63 | __fdsetp->fds_bits[__tmp] |= (1UL<<__rem); | ||
64 | } | ||
65 | |||
66 | #undef __FD_CLR | ||
67 | static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp) | ||
68 | { | ||
69 | unsigned long __tmp = __fd / __NFDBITS; | ||
70 | unsigned long __rem = __fd % __NFDBITS; | ||
71 | __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem); | ||
72 | } | ||
73 | |||
74 | |||
75 | #undef __FD_ISSET | ||
76 | static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p) | ||
77 | { | ||
78 | unsigned long __tmp = __fd / __NFDBITS; | ||
79 | unsigned long __rem = __fd % __NFDBITS; | ||
80 | return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0; | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | * This will unroll the loop for the normal constant case (8 ints, | ||
85 | * for a 256-bit fd_set) | ||
86 | */ | ||
87 | #undef __FD_ZERO | ||
88 | static __inline__ void __FD_ZERO(__kernel_fd_set *__p) | ||
89 | { | ||
90 | unsigned long *__tmp = __p->fds_bits; | ||
91 | int __i; | ||
92 | |||
93 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
94 | switch (__FDSET_LONGS) { | ||
95 | case 16: | ||
96 | __tmp[ 0] = 0; __tmp[ 1] = 0; | ||
97 | __tmp[ 2] = 0; __tmp[ 3] = 0; | ||
98 | __tmp[ 4] = 0; __tmp[ 5] = 0; | ||
99 | __tmp[ 6] = 0; __tmp[ 7] = 0; | ||
100 | __tmp[ 8] = 0; __tmp[ 9] = 0; | ||
101 | __tmp[10] = 0; __tmp[11] = 0; | ||
102 | __tmp[12] = 0; __tmp[13] = 0; | ||
103 | __tmp[14] = 0; __tmp[15] = 0; | ||
104 | return; | ||
105 | |||
106 | case 8: | ||
107 | __tmp[ 0] = 0; __tmp[ 1] = 0; | ||
108 | __tmp[ 2] = 0; __tmp[ 3] = 0; | ||
109 | __tmp[ 4] = 0; __tmp[ 5] = 0; | ||
110 | __tmp[ 6] = 0; __tmp[ 7] = 0; | ||
111 | return; | ||
112 | |||
113 | case 4: | ||
114 | __tmp[ 0] = 0; __tmp[ 1] = 0; | ||
115 | __tmp[ 2] = 0; __tmp[ 3] = 0; | ||
116 | return; | ||
117 | } | ||
118 | } | ||
119 | __i = __FDSET_LONGS; | ||
120 | while (__i) { | ||
121 | __i--; | ||
122 | *__tmp = 0; | ||
123 | __tmp++; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | #endif /* defined(__KERNEL__) */ | ||
128 | |||
129 | #endif /* __ASM_AVR32_POSIX_TYPES_H */ | ||
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h new file mode 100644 index 000000000000..f6913778a45f --- /dev/null +++ b/include/asm-avr32/processor.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_PROCESSOR_H | ||
9 | #define __ASM_AVR32_PROCESSOR_H | ||
10 | |||
11 | #include <asm/page.h> | ||
12 | #include <asm/cache.h> | ||
13 | |||
14 | #define TASK_SIZE 0x80000000 | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | |||
18 | static inline void *current_text_addr(void) | ||
19 | { | ||
20 | register void *pc asm("pc"); | ||
21 | return pc; | ||
22 | } | ||
23 | |||
24 | enum arch_type { | ||
25 | ARCH_AVR32A, | ||
26 | ARCH_AVR32B, | ||
27 | ARCH_MAX | ||
28 | }; | ||
29 | |||
30 | enum cpu_type { | ||
31 | CPU_MORGAN, | ||
32 | CPU_AT32AP, | ||
33 | CPU_MAX | ||
34 | }; | ||
35 | |||
36 | enum tlb_config { | ||
37 | TLB_NONE, | ||
38 | TLB_SPLIT, | ||
39 | TLB_UNIFIED, | ||
40 | TLB_INVALID | ||
41 | }; | ||
42 | |||
43 | struct avr32_cpuinfo { | ||
44 | struct clk *clk; | ||
45 | unsigned long loops_per_jiffy; | ||
46 | enum arch_type arch_type; | ||
47 | enum cpu_type cpu_type; | ||
48 | unsigned short arch_revision; | ||
49 | unsigned short cpu_revision; | ||
50 | enum tlb_config tlb_config; | ||
51 | |||
52 | struct cache_info icache; | ||
53 | struct cache_info dcache; | ||
54 | }; | ||
55 | |||
56 | extern struct avr32_cpuinfo boot_cpu_data; | ||
57 | |||
58 | #ifdef CONFIG_SMP | ||
59 | extern struct avr32_cpuinfo cpu_data[]; | ||
60 | #define current_cpu_data cpu_data[smp_processor_id()] | ||
61 | #else | ||
62 | #define cpu_data (&boot_cpu_data) | ||
63 | #define current_cpu_data boot_cpu_data | ||
64 | #endif | ||
65 | |||
66 | /* This decides where the kernel will search for a free chunk of vm | ||
67 | * space during mmap's | ||
68 | */ | ||
69 | #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) | ||
70 | |||
71 | #define cpu_relax() barrier() | ||
72 | #define cpu_sync_pipeline() asm volatile("sub pc, -2" : : : "memory") | ||
73 | |||
74 | struct cpu_context { | ||
75 | unsigned long sr; | ||
76 | unsigned long pc; | ||
77 | unsigned long ksp; /* Kernel stack pointer */ | ||
78 | unsigned long r7; | ||
79 | unsigned long r6; | ||
80 | unsigned long r5; | ||
81 | unsigned long r4; | ||
82 | unsigned long r3; | ||
83 | unsigned long r2; | ||
84 | unsigned long r1; | ||
85 | unsigned long r0; | ||
86 | }; | ||
87 | |||
88 | /* This struct contains the CPU context as stored by switch_to() */ | ||
89 | struct thread_struct { | ||
90 | struct cpu_context cpu_context; | ||
91 | unsigned long single_step_addr; | ||
92 | u16 single_step_insn; | ||
93 | }; | ||
94 | |||
95 | #define INIT_THREAD { \ | ||
96 | .cpu_context = { \ | ||
97 | .ksp = sizeof(init_stack) + (long)&init_stack, \ | ||
98 | }, \ | ||
99 | } | ||
100 | |||
101 | /* | ||
102 | * Do necessary setup to start up a newly executed thread. | ||
103 | */ | ||
104 | #define start_thread(regs, new_pc, new_sp) \ | ||
105 | do { \ | ||
106 | set_fs(USER_DS); \ | ||
107 | memset(regs, 0, sizeof(*regs)); \ | ||
108 | regs->sr = MODE_USER; \ | ||
109 | regs->pc = new_pc & ~1; \ | ||
110 | regs->sp = new_sp; \ | ||
111 | } while(0) | ||
112 | |||
113 | struct task_struct; | ||
114 | |||
115 | /* Free all resources held by a thread */ | ||
116 | extern void release_thread(struct task_struct *); | ||
117 | |||
118 | /* Create a kernel thread without removing it from tasklists */ | ||
119 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
120 | |||
121 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
122 | #define prepare_to_copy(tsk) do { } while(0) | ||
123 | |||
124 | /* Return saved PC of a blocked thread */ | ||
125 | #define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) | ||
126 | |||
127 | struct pt_regs; | ||
128 | void show_trace(struct task_struct *task, unsigned long *stack, | ||
129 | struct pt_regs *regs); | ||
130 | |||
131 | extern unsigned long get_wchan(struct task_struct *p); | ||
132 | |||
133 | #define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) | ||
134 | #define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) | ||
135 | |||
136 | #define ARCH_HAS_PREFETCH | ||
137 | |||
138 | static inline void prefetch(const void *x) | ||
139 | { | ||
140 | const char *c = x; | ||
141 | asm volatile("pref %0" : : "r"(c)); | ||
142 | } | ||
143 | #define PREFETCH_STRIDE L1_CACHE_BYTES | ||
144 | |||
145 | #endif /* __ASSEMBLY__ */ | ||
146 | |||
147 | #endif /* __ASM_AVR32_PROCESSOR_H */ | ||
diff --git a/include/asm-avr32/ptrace.h b/include/asm-avr32/ptrace.h new file mode 100644 index 000000000000..60f0f19a81f1 --- /dev/null +++ b/include/asm-avr32/ptrace.h | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_PTRACE_H | ||
9 | #define __ASM_AVR32_PTRACE_H | ||
10 | |||
11 | #define PTRACE_GETREGS 12 | ||
12 | #define PTRACE_SETREGS 13 | ||
13 | |||
14 | /* | ||
15 | * Status Register bits | ||
16 | */ | ||
17 | #define SR_H 0x40000000 | ||
18 | #define SR_R 0x20000000 | ||
19 | #define SR_J 0x10000000 | ||
20 | #define SR_DM 0x08000000 | ||
21 | #define SR_D 0x04000000 | ||
22 | #define MODE_NMI 0x01c00000 | ||
23 | #define MODE_EXCEPTION 0x01800000 | ||
24 | #define MODE_INT3 0x01400000 | ||
25 | #define MODE_INT2 0x01000000 | ||
26 | #define MODE_INT1 0x00c00000 | ||
27 | #define MODE_INT0 0x00800000 | ||
28 | #define MODE_SUPERVISOR 0x00400000 | ||
29 | #define MODE_USER 0x00000000 | ||
30 | #define MODE_MASK 0x01c00000 | ||
31 | #define SR_EM 0x00200000 | ||
32 | #define SR_I3M 0x00100000 | ||
33 | #define SR_I2M 0x00080000 | ||
34 | #define SR_I1M 0x00040000 | ||
35 | #define SR_I0M 0x00020000 | ||
36 | #define SR_GM 0x00010000 | ||
37 | |||
38 | #define SR_H_BIT 30 | ||
39 | #define SR_R_BIT 29 | ||
40 | #define SR_J_BIT 28 | ||
41 | #define SR_DM_BIT 27 | ||
42 | #define SR_D_BIT 26 | ||
43 | #define MODE_SHIFT 22 | ||
44 | #define SR_EM_BIT 21 | ||
45 | #define SR_I3M_BIT 20 | ||
46 | #define SR_I2M_BIT 19 | ||
47 | #define SR_I1M_BIT 18 | ||
48 | #define SR_I0M_BIT 17 | ||
49 | #define SR_GM_BIT 16 | ||
50 | |||
51 | /* The user-visible part */ | ||
52 | #define SR_L 0x00000020 | ||
53 | #define SR_Q 0x00000010 | ||
54 | #define SR_V 0x00000008 | ||
55 | #define SR_N 0x00000004 | ||
56 | #define SR_Z 0x00000002 | ||
57 | #define SR_C 0x00000001 | ||
58 | |||
59 | #define SR_L_BIT 5 | ||
60 | #define SR_Q_BIT 4 | ||
61 | #define SR_V_BIT 3 | ||
62 | #define SR_N_BIT 2 | ||
63 | #define SR_Z_BIT 1 | ||
64 | #define SR_C_BIT 0 | ||
65 | |||
66 | /* | ||
67 | * The order is defined by the stmts instruction. r0 is stored first, | ||
68 | * so it gets the highest address. | ||
69 | * | ||
70 | * Registers 0-12 are general-purpose registers (r12 is normally used for | ||
71 | * the function return value). | ||
72 | * Register 13 is the stack pointer | ||
73 | * Register 14 is the link register | ||
74 | * Register 15 is the program counter (retrieved from the RAR sysreg) | ||
75 | */ | ||
76 | #define FRAME_SIZE_FULL 72 | ||
77 | #define REG_R12_ORIG 68 | ||
78 | #define REG_R0 64 | ||
79 | #define REG_R1 60 | ||
80 | #define REG_R2 56 | ||
81 | #define REG_R3 52 | ||
82 | #define REG_R4 48 | ||
83 | #define REG_R5 44 | ||
84 | #define REG_R6 40 | ||
85 | #define REG_R7 36 | ||
86 | #define REG_R8 32 | ||
87 | #define REG_R9 28 | ||
88 | #define REG_R10 24 | ||
89 | #define REG_R11 20 | ||
90 | #define REG_R12 16 | ||
91 | #define REG_SP 12 | ||
92 | #define REG_LR 8 | ||
93 | |||
94 | #define FRAME_SIZE_MIN 8 | ||
95 | #define REG_PC 4 | ||
96 | #define REG_SR 0 | ||
97 | |||
98 | #ifndef __ASSEMBLY__ | ||
99 | struct pt_regs { | ||
100 | /* These are always saved */ | ||
101 | unsigned long sr; | ||
102 | unsigned long pc; | ||
103 | |||
104 | /* These are sometimes saved */ | ||
105 | unsigned long lr; | ||
106 | unsigned long sp; | ||
107 | unsigned long r12; | ||
108 | unsigned long r11; | ||
109 | unsigned long r10; | ||
110 | unsigned long r9; | ||
111 | unsigned long r8; | ||
112 | unsigned long r7; | ||
113 | unsigned long r6; | ||
114 | unsigned long r5; | ||
115 | unsigned long r4; | ||
116 | unsigned long r3; | ||
117 | unsigned long r2; | ||
118 | unsigned long r1; | ||
119 | unsigned long r0; | ||
120 | |||
121 | /* Only saved on system call */ | ||
122 | unsigned long r12_orig; | ||
123 | }; | ||
124 | |||
125 | #ifdef __KERNEL__ | ||
126 | # define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER) | ||
127 | extern void show_regs (struct pt_regs *); | ||
128 | |||
129 | static __inline__ int valid_user_regs(struct pt_regs *regs) | ||
130 | { | ||
131 | /* | ||
132 | * Some of the Java bits might be acceptable if/when we | ||
133 | * implement some support for that stuff... | ||
134 | */ | ||
135 | if ((regs->sr & 0xffff0000) == 0) | ||
136 | return 1; | ||
137 | |||
138 | /* | ||
139 | * Force status register flags to be sane and report this | ||
140 | * illegal behaviour... | ||
141 | */ | ||
142 | regs->sr &= 0x0000ffff; | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | #define instruction_pointer(regs) ((regs)->pc) | ||
147 | |||
148 | #define profile_pc(regs) instruction_pointer(regs) | ||
149 | |||
150 | #endif /* __KERNEL__ */ | ||
151 | |||
152 | #endif /* ! __ASSEMBLY__ */ | ||
153 | |||
154 | #endif /* __ASM_AVR32_PTRACE_H */ | ||
diff --git a/include/asm-avr32/resource.h b/include/asm-avr32/resource.h new file mode 100644 index 000000000000..c6dd101472b1 --- /dev/null +++ b/include/asm-avr32/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_RESOURCE_H | ||
2 | #define __ASM_AVR32_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_RESOURCE_H */ | ||
diff --git a/include/asm-avr32/scatterlist.h b/include/asm-avr32/scatterlist.h new file mode 100644 index 000000000000..bfe7d753423c --- /dev/null +++ b/include/asm-avr32/scatterlist.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __ASM_AVR32_SCATTERLIST_H | ||
2 | #define __ASM_AVR32_SCATTERLIST_H | ||
3 | |||
4 | struct scatterlist { | ||
5 | struct page *page; | ||
6 | unsigned int offset; | ||
7 | dma_addr_t dma_address; | ||
8 | unsigned int length; | ||
9 | }; | ||
10 | |||
11 | /* These macros should be used after a pci_map_sg call has been done | ||
12 | * to get bus addresses of each of the SG entries and their lengths. | ||
13 | * You should only work with the number of sg entries pci_map_sg | ||
14 | * returns. | ||
15 | */ | ||
16 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
17 | #define sg_dma_len(sg) ((sg)->length) | ||
18 | |||
19 | #define ISA_DMA_THRESHOLD (0xffffffff) | ||
20 | |||
21 | #endif /* __ASM_AVR32_SCATTERLIST_H */ | ||
diff --git a/include/asm-avr32/sections.h b/include/asm-avr32/sections.h new file mode 100644 index 000000000000..aa14252e4181 --- /dev/null +++ b/include/asm-avr32/sections.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_SECTIONS_H | ||
2 | #define __ASM_AVR32_SECTIONS_H | ||
3 | |||
4 | #include <asm-generic/sections.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_SECTIONS_H */ | ||
diff --git a/include/asm-avr32/semaphore.h b/include/asm-avr32/semaphore.h new file mode 100644 index 000000000000..ef99ddccc10c --- /dev/null +++ b/include/asm-avr32/semaphore.h | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * SMP- and interrupt-safe semaphores. | ||
3 | * | ||
4 | * Copyright (C) 2006 Atmel Corporation | ||
5 | * | ||
6 | * Based on include/asm-i386/semaphore.h | ||
7 | * Copyright (C) 1996 Linus Torvalds | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #ifndef __ASM_AVR32_SEMAPHORE_H | ||
14 | #define __ASM_AVR32_SEMAPHORE_H | ||
15 | |||
16 | #include <linux/linkage.h> | ||
17 | |||
18 | #include <asm/system.h> | ||
19 | #include <asm/atomic.h> | ||
20 | #include <linux/wait.h> | ||
21 | #include <linux/rwsem.h> | ||
22 | |||
23 | struct semaphore { | ||
24 | atomic_t count; | ||
25 | int sleepers; | ||
26 | wait_queue_head_t wait; | ||
27 | }; | ||
28 | |||
29 | #define __SEMAPHORE_INITIALIZER(name, n) \ | ||
30 | { \ | ||
31 | .count = ATOMIC_INIT(n), \ | ||
32 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ | ||
33 | } | ||
34 | |||
35 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ | ||
36 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | ||
37 | |||
38 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) | ||
39 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) | ||
40 | |||
41 | static inline void sema_init (struct semaphore *sem, int val) | ||
42 | { | ||
43 | atomic_set(&sem->count, val); | ||
44 | sem->sleepers = 0; | ||
45 | init_waitqueue_head(&sem->wait); | ||
46 | } | ||
47 | |||
48 | static inline void init_MUTEX (struct semaphore *sem) | ||
49 | { | ||
50 | sema_init(sem, 1); | ||
51 | } | ||
52 | |||
53 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) | ||
54 | { | ||
55 | sema_init(sem, 0); | ||
56 | } | ||
57 | |||
58 | void __down(struct semaphore * sem); | ||
59 | int __down_interruptible(struct semaphore * sem); | ||
60 | void __up(struct semaphore * sem); | ||
61 | |||
62 | /* | ||
63 | * This is ugly, but we want the default case to fall through. | ||
64 | * "__down_failed" is a special asm handler that calls the C | ||
65 | * routine that actually waits. See arch/i386/kernel/semaphore.c | ||
66 | */ | ||
67 | static inline void down(struct semaphore * sem) | ||
68 | { | ||
69 | might_sleep(); | ||
70 | if (unlikely(atomic_dec_return (&sem->count) < 0)) | ||
71 | __down (sem); | ||
72 | } | ||
73 | |||
74 | /* | ||
75 | * Interruptible try to acquire a semaphore. If we obtained | ||
76 | * it, return zero. If we were interrupted, returns -EINTR | ||
77 | */ | ||
78 | static inline int down_interruptible(struct semaphore * sem) | ||
79 | { | ||
80 | int ret = 0; | ||
81 | |||
82 | might_sleep(); | ||
83 | if (unlikely(atomic_dec_return (&sem->count) < 0)) | ||
84 | ret = __down_interruptible (sem); | ||
85 | return ret; | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * Non-blockingly attempt to down() a semaphore. | ||
90 | * Returns zero if we acquired it | ||
91 | */ | ||
92 | static inline int down_trylock(struct semaphore * sem) | ||
93 | { | ||
94 | return atomic_dec_if_positive(&sem->count) < 0; | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Note! This is subtle. We jump to wake people up only if | ||
99 | * the semaphore was negative (== somebody was waiting on it). | ||
100 | * The default case (no contention) will result in NO | ||
101 | * jumps for both down() and up(). | ||
102 | */ | ||
103 | static inline void up(struct semaphore * sem) | ||
104 | { | ||
105 | if (unlikely(atomic_inc_return (&sem->count) <= 0)) | ||
106 | __up (sem); | ||
107 | } | ||
108 | |||
109 | #endif /*__ASM_AVR32_SEMAPHORE_H */ | ||
diff --git a/include/asm-avr32/sembuf.h b/include/asm-avr32/sembuf.h new file mode 100644 index 000000000000..e472216e0c97 --- /dev/null +++ b/include/asm-avr32/sembuf.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __ASM_AVR32_SEMBUF_H | ||
2 | #define __ASM_AVR32_SEMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The semid64_ds structure for AVR32 architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct semid64_ds { | ||
15 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
16 | __kernel_time_t sem_otime; /* last semop time */ | ||
17 | unsigned long __unused1; | ||
18 | __kernel_time_t sem_ctime; /* last change time */ | ||
19 | unsigned long __unused2; | ||
20 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
21 | unsigned long __unused3; | ||
22 | unsigned long __unused4; | ||
23 | }; | ||
24 | |||
25 | #endif /* __ASM_AVR32_SEMBUF_H */ | ||
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h new file mode 100644 index 000000000000..10193da4113b --- /dev/null +++ b/include/asm-avr32/setup.h | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * Based on linux/include/asm-arm/setup.h | ||
5 | * Copyright (C) 1997-1999 Russel King | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __ASM_AVR32_SETUP_H__ | ||
12 | #define __ASM_AVR32_SETUP_H__ | ||
13 | |||
14 | #define COMMAND_LINE_SIZE 256 | ||
15 | |||
16 | /* Magic number indicating that a tag table is present */ | ||
17 | #define ATAG_MAGIC 0xa2a25441 | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | /* | ||
22 | * Generic memory range, used by several tags. | ||
23 | * | ||
24 | * addr is always physical. | ||
25 | * size is measured in bytes. | ||
26 | * next is for use by the OS, e.g. for grouping regions into | ||
27 | * linked lists. | ||
28 | */ | ||
29 | struct tag_mem_range { | ||
30 | u32 addr; | ||
31 | u32 size; | ||
32 | struct tag_mem_range * next; | ||
33 | }; | ||
34 | |||
35 | /* The list ends with an ATAG_NONE node. */ | ||
36 | #define ATAG_NONE 0x00000000 | ||
37 | |||
38 | struct tag_header { | ||
39 | u32 size; | ||
40 | u32 tag; | ||
41 | }; | ||
42 | |||
43 | /* The list must start with an ATAG_CORE node */ | ||
44 | #define ATAG_CORE 0x54410001 | ||
45 | |||
46 | struct tag_core { | ||
47 | u32 flags; | ||
48 | u32 pagesize; | ||
49 | u32 rootdev; | ||
50 | }; | ||
51 | |||
52 | /* it is allowed to have multiple ATAG_MEM nodes */ | ||
53 | #define ATAG_MEM 0x54410002 | ||
54 | /* ATAG_MEM uses tag_mem_range */ | ||
55 | |||
56 | /* command line: \0 terminated string */ | ||
57 | #define ATAG_CMDLINE 0x54410003 | ||
58 | |||
59 | struct tag_cmdline { | ||
60 | char cmdline[1]; /* this is the minimum size */ | ||
61 | }; | ||
62 | |||
63 | /* Ramdisk image (may be compressed) */ | ||
64 | #define ATAG_RDIMG 0x54410004 | ||
65 | /* ATAG_RDIMG uses tag_mem_range */ | ||
66 | |||
67 | /* Information about various clocks present in the system */ | ||
68 | #define ATAG_CLOCK 0x54410005 | ||
69 | |||
70 | struct tag_clock { | ||
71 | u32 clock_id; /* Which clock are we talking about? */ | ||
72 | u32 clock_flags; /* Special features */ | ||
73 | u64 clock_hz; /* Clock speed in Hz */ | ||
74 | }; | ||
75 | |||
76 | /* The clock types we know about */ | ||
77 | #define CLOCK_BOOTCPU 0 | ||
78 | |||
79 | /* Memory reserved for the system (e.g. the bootloader) */ | ||
80 | #define ATAG_RSVD_MEM 0x54410006 | ||
81 | /* ATAG_RSVD_MEM uses tag_mem_range */ | ||
82 | |||
83 | /* Ethernet information */ | ||
84 | |||
85 | #define ATAG_ETHERNET 0x54410007 | ||
86 | |||
87 | struct tag_ethernet { | ||
88 | u8 mac_index; | ||
89 | u8 mii_phy_addr; | ||
90 | u8 hw_address[6]; | ||
91 | }; | ||
92 | |||
93 | #define ETH_INVALID_PHY 0xff | ||
94 | |||
95 | struct tag { | ||
96 | struct tag_header hdr; | ||
97 | union { | ||
98 | struct tag_core core; | ||
99 | struct tag_mem_range mem_range; | ||
100 | struct tag_cmdline cmdline; | ||
101 | struct tag_clock clock; | ||
102 | struct tag_ethernet ethernet; | ||
103 | } u; | ||
104 | }; | ||
105 | |||
106 | struct tagtable { | ||
107 | u32 tag; | ||
108 | int (*parse)(struct tag *); | ||
109 | }; | ||
110 | |||
111 | #define __tag __attribute_used__ __attribute__((__section__(".taglist"))) | ||
112 | #define __tagtable(tag, fn) \ | ||
113 | static struct tagtable __tagtable_##fn __tag = { tag, fn } | ||
114 | |||
115 | #define tag_member_present(tag,member) \ | ||
116 | ((unsigned long)(&((struct tag *)0L)->member + 1) \ | ||
117 | <= (tag)->hdr.size * 4) | ||
118 | |||
119 | #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) | ||
120 | #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) | ||
121 | |||
122 | #define for_each_tag(t,base) \ | ||
123 | for (t = base; t->hdr.size; t = tag_next(t)) | ||
124 | |||
125 | extern struct tag_mem_range *mem_phys; | ||
126 | extern struct tag_mem_range *mem_reserved; | ||
127 | extern struct tag_mem_range *mem_ramdisk; | ||
128 | |||
129 | extern struct tag *bootloader_tags; | ||
130 | |||
131 | extern void setup_bootmem(void); | ||
132 | extern void setup_processor(void); | ||
133 | extern void board_setup_fbmem(unsigned long fbmem_start, | ||
134 | unsigned long fbmem_size); | ||
135 | |||
136 | /* Chip-specific hook to enable the use of SDRAM */ | ||
137 | void chip_enable_sdram(void); | ||
138 | |||
139 | #endif /* !__ASSEMBLY__ */ | ||
140 | |||
141 | #endif /* __ASM_AVR32_SETUP_H__ */ | ||
diff --git a/include/asm-avr32/shmbuf.h b/include/asm-avr32/shmbuf.h new file mode 100644 index 000000000000..c62fba41739a --- /dev/null +++ b/include/asm-avr32/shmbuf.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef __ASM_AVR32_SHMBUF_H | ||
2 | #define __ASM_AVR32_SHMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The shmid64_ds structure for i386 architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct shmid64_ds { | ||
15 | struct ipc64_perm shm_perm; /* operation perms */ | ||
16 | size_t shm_segsz; /* size of segment (bytes) */ | ||
17 | __kernel_time_t shm_atime; /* last attach time */ | ||
18 | unsigned long __unused1; | ||
19 | __kernel_time_t shm_dtime; /* last detach time */ | ||
20 | unsigned long __unused2; | ||
21 | __kernel_time_t shm_ctime; /* last change time */ | ||
22 | unsigned long __unused3; | ||
23 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
24 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
25 | unsigned long shm_nattch; /* no. of current attaches */ | ||
26 | unsigned long __unused4; | ||
27 | unsigned long __unused5; | ||
28 | }; | ||
29 | |||
30 | struct shminfo64 { | ||
31 | unsigned long shmmax; | ||
32 | unsigned long shmmin; | ||
33 | unsigned long shmmni; | ||
34 | unsigned long shmseg; | ||
35 | unsigned long shmall; | ||
36 | unsigned long __unused1; | ||
37 | unsigned long __unused2; | ||
38 | unsigned long __unused3; | ||
39 | unsigned long __unused4; | ||
40 | }; | ||
41 | |||
42 | #endif /* __ASM_AVR32_SHMBUF_H */ | ||
diff --git a/include/asm-avr32/shmparam.h b/include/asm-avr32/shmparam.h new file mode 100644 index 000000000000..3681266c77f7 --- /dev/null +++ b/include/asm-avr32/shmparam.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_SHMPARAM_H | ||
2 | #define __ASM_AVR32_SHMPARAM_H | ||
3 | |||
4 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
5 | |||
6 | #endif /* __ASM_AVR32_SHMPARAM_H */ | ||
diff --git a/include/asm-avr32/sigcontext.h b/include/asm-avr32/sigcontext.h new file mode 100644 index 000000000000..e04062b5f39f --- /dev/null +++ b/include/asm-avr32/sigcontext.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_SIGCONTEXT_H | ||
9 | #define __ASM_AVR32_SIGCONTEXT_H | ||
10 | |||
11 | struct sigcontext { | ||
12 | unsigned long oldmask; | ||
13 | |||
14 | /* CPU registers */ | ||
15 | unsigned long sr; | ||
16 | unsigned long pc; | ||
17 | unsigned long lr; | ||
18 | unsigned long sp; | ||
19 | unsigned long r12; | ||
20 | unsigned long r11; | ||
21 | unsigned long r10; | ||
22 | unsigned long r9; | ||
23 | unsigned long r8; | ||
24 | unsigned long r7; | ||
25 | unsigned long r6; | ||
26 | unsigned long r5; | ||
27 | unsigned long r4; | ||
28 | unsigned long r3; | ||
29 | unsigned long r2; | ||
30 | unsigned long r1; | ||
31 | unsigned long r0; | ||
32 | }; | ||
33 | |||
34 | #endif /* __ASM_AVR32_SIGCONTEXT_H */ | ||
diff --git a/include/asm-avr32/siginfo.h b/include/asm-avr32/siginfo.h new file mode 100644 index 000000000000..5ee93f40a8a8 --- /dev/null +++ b/include/asm-avr32/siginfo.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _AVR32_SIGINFO_H | ||
2 | #define _AVR32_SIGINFO_H | ||
3 | |||
4 | #include <asm-generic/siginfo.h> | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-avr32/signal.h b/include/asm-avr32/signal.h new file mode 100644 index 000000000000..caffefeeba1f --- /dev/null +++ b/include/asm-avr32/signal.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_SIGNAL_H | ||
9 | #define __ASM_AVR32_SIGNAL_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | |||
13 | /* Avoid too many header ordering problems. */ | ||
14 | struct siginfo; | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | /* Most things should be clean enough to redefine this at will, if care | ||
18 | is taken to make libc match. */ | ||
19 | |||
20 | #define _NSIG 64 | ||
21 | #define _NSIG_BPW 32 | ||
22 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
23 | |||
24 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
25 | |||
26 | typedef struct { | ||
27 | unsigned long sig[_NSIG_WORDS]; | ||
28 | } sigset_t; | ||
29 | |||
30 | #else | ||
31 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
32 | |||
33 | #define NSIG 32 | ||
34 | typedef unsigned long sigset_t; | ||
35 | |||
36 | #endif /* __KERNEL__ */ | ||
37 | |||
38 | #define SIGHUP 1 | ||
39 | #define SIGINT 2 | ||
40 | #define SIGQUIT 3 | ||
41 | #define SIGILL 4 | ||
42 | #define SIGTRAP 5 | ||
43 | #define SIGABRT 6 | ||
44 | #define SIGIOT 6 | ||
45 | #define SIGBUS 7 | ||
46 | #define SIGFPE 8 | ||
47 | #define SIGKILL 9 | ||
48 | #define SIGUSR1 10 | ||
49 | #define SIGSEGV 11 | ||
50 | #define SIGUSR2 12 | ||
51 | #define SIGPIPE 13 | ||
52 | #define SIGALRM 14 | ||
53 | #define SIGTERM 15 | ||
54 | #define SIGSTKFLT 16 | ||
55 | #define SIGCHLD 17 | ||
56 | #define SIGCONT 18 | ||
57 | #define SIGSTOP 19 | ||
58 | #define SIGTSTP 20 | ||
59 | #define SIGTTIN 21 | ||
60 | #define SIGTTOU 22 | ||
61 | #define SIGURG 23 | ||
62 | #define SIGXCPU 24 | ||
63 | #define SIGXFSZ 25 | ||
64 | #define SIGVTALRM 26 | ||
65 | #define SIGPROF 27 | ||
66 | #define SIGWINCH 28 | ||
67 | #define SIGIO 29 | ||
68 | #define SIGPOLL SIGIO | ||
69 | /* | ||
70 | #define SIGLOST 29 | ||
71 | */ | ||
72 | #define SIGPWR 30 | ||
73 | #define SIGSYS 31 | ||
74 | #define SIGUNUSED 31 | ||
75 | |||
76 | /* These should not be considered constants from userland. */ | ||
77 | #define SIGRTMIN 32 | ||
78 | #define SIGRTMAX (_NSIG-1) | ||
79 | |||
80 | /* | ||
81 | * SA_FLAGS values: | ||
82 | * | ||
83 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
84 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
85 | * SA_SIGINFO deliver the signal with SIGINFO structs | ||
86 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
87 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
88 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
89 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
90 | * | ||
91 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
92 | * Unix names RESETHAND and NODEFER respectively. | ||
93 | */ | ||
94 | #define SA_NOCLDSTOP 0x00000001 | ||
95 | #define SA_NOCLDWAIT 0x00000002 | ||
96 | #define SA_SIGINFO 0x00000004 | ||
97 | #define SA_RESTORER 0x04000000 | ||
98 | #define SA_ONSTACK 0x08000000 | ||
99 | #define SA_RESTART 0x10000000 | ||
100 | #define SA_NODEFER 0x40000000 | ||
101 | #define SA_RESETHAND 0x80000000 | ||
102 | |||
103 | #define SA_NOMASK SA_NODEFER | ||
104 | #define SA_ONESHOT SA_RESETHAND | ||
105 | |||
106 | /* | ||
107 | * sigaltstack controls | ||
108 | */ | ||
109 | #define SS_ONSTACK 1 | ||
110 | #define SS_DISABLE 2 | ||
111 | |||
112 | #define MINSIGSTKSZ 2048 | ||
113 | #define SIGSTKSZ 8192 | ||
114 | |||
115 | #include <asm-generic/signal.h> | ||
116 | |||
117 | #ifdef __KERNEL__ | ||
118 | struct old_sigaction { | ||
119 | __sighandler_t sa_handler; | ||
120 | old_sigset_t sa_mask; | ||
121 | unsigned long sa_flags; | ||
122 | __sigrestore_t sa_restorer; | ||
123 | }; | ||
124 | |||
125 | struct sigaction { | ||
126 | __sighandler_t sa_handler; | ||
127 | unsigned long sa_flags; | ||
128 | __sigrestore_t sa_restorer; | ||
129 | sigset_t sa_mask; /* mask last for extensibility */ | ||
130 | }; | ||
131 | |||
132 | struct k_sigaction { | ||
133 | struct sigaction sa; | ||
134 | }; | ||
135 | #else | ||
136 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
137 | |||
138 | struct sigaction { | ||
139 | union { | ||
140 | __sighandler_t _sa_handler; | ||
141 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
142 | } _u; | ||
143 | sigset_t sa_mask; | ||
144 | unsigned long sa_flags; | ||
145 | void (*sa_restorer)(void); | ||
146 | }; | ||
147 | |||
148 | #define sa_handler _u._sa_handler | ||
149 | #define sa_sigaction _u._sa_sigaction | ||
150 | |||
151 | #endif /* __KERNEL__ */ | ||
152 | |||
153 | typedef struct sigaltstack { | ||
154 | void __user *ss_sp; | ||
155 | int ss_flags; | ||
156 | size_t ss_size; | ||
157 | } stack_t; | ||
158 | |||
159 | #ifdef __KERNEL__ | ||
160 | |||
161 | #include <asm/sigcontext.h> | ||
162 | #undef __HAVE_ARCH_SIG_BITOPS | ||
163 | |||
164 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
165 | |||
166 | #endif /* __KERNEL__ */ | ||
167 | |||
168 | #endif | ||
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h new file mode 100644 index 000000000000..543229de8173 --- /dev/null +++ b/include/asm-avr32/socket.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef __ASM_AVR32_SOCKET_H | ||
2 | #define __ASM_AVR32_SOCKET_H | ||
3 | |||
4 | #include <asm/sockios.h> | ||
5 | |||
6 | /* For setsockopt(2) */ | ||
7 | #define SOL_SOCKET 1 | ||
8 | |||
9 | #define SO_DEBUG 1 | ||
10 | #define SO_REUSEADDR 2 | ||
11 | #define SO_TYPE 3 | ||
12 | #define SO_ERROR 4 | ||
13 | #define SO_DONTROUTE 5 | ||
14 | #define SO_BROADCAST 6 | ||
15 | #define SO_SNDBUF 7 | ||
16 | #define SO_RCVBUF 8 | ||
17 | #define SO_SNDBUFFORCE 32 | ||
18 | #define SO_RCVBUFFORCE 33 | ||
19 | #define SO_KEEPALIVE 9 | ||
20 | #define SO_OOBINLINE 10 | ||
21 | #define SO_NO_CHECK 11 | ||
22 | #define SO_PRIORITY 12 | ||
23 | #define SO_LINGER 13 | ||
24 | #define SO_BSDCOMPAT 14 | ||
25 | /* To add :#define SO_REUSEPORT 15 */ | ||
26 | #define SO_PASSCRED 16 | ||
27 | #define SO_PEERCRED 17 | ||
28 | #define SO_RCVLOWAT 18 | ||
29 | #define SO_SNDLOWAT 19 | ||
30 | #define SO_RCVTIMEO 20 | ||
31 | #define SO_SNDTIMEO 21 | ||
32 | |||
33 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
34 | #define SO_SECURITY_AUTHENTICATION 22 | ||
35 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
36 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
37 | |||
38 | #define SO_BINDTODEVICE 25 | ||
39 | |||
40 | /* Socket filtering */ | ||
41 | #define SO_ATTACH_FILTER 26 | ||
42 | #define SO_DETACH_FILTER 27 | ||
43 | |||
44 | #define SO_PEERNAME 28 | ||
45 | #define SO_TIMESTAMP 29 | ||
46 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
47 | |||
48 | #define SO_ACCEPTCONN 30 | ||
49 | |||
50 | #define SO_PEERSEC 31 | ||
51 | #define SO_PASSSEC 34 | ||
52 | |||
53 | #endif /* __ASM_AVR32_SOCKET_H */ | ||
diff --git a/include/asm-avr32/sockios.h b/include/asm-avr32/sockios.h new file mode 100644 index 000000000000..84f3d65b3b3b --- /dev/null +++ b/include/asm-avr32/sockios.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __ASM_AVR32_SOCKIOS_H | ||
2 | #define __ASM_AVR32_SOCKIOS_H | ||
3 | |||
4 | /* Socket-level I/O control calls. */ | ||
5 | #define FIOSETOWN 0x8901 | ||
6 | #define SIOCSPGRP 0x8902 | ||
7 | #define FIOGETOWN 0x8903 | ||
8 | #define SIOCGPGRP 0x8904 | ||
9 | #define SIOCATMARK 0x8905 | ||
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | ||
11 | |||
12 | #endif /* __ASM_AVR32_SOCKIOS_H */ | ||
diff --git a/include/asm-avr32/stat.h b/include/asm-avr32/stat.h new file mode 100644 index 000000000000..e72881e10230 --- /dev/null +++ b/include/asm-avr32/stat.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_STAT_H | ||
9 | #define __ASM_AVR32_STAT_H | ||
10 | |||
11 | struct __old_kernel_stat { | ||
12 | unsigned short st_dev; | ||
13 | unsigned short st_ino; | ||
14 | unsigned short st_mode; | ||
15 | unsigned short st_nlink; | ||
16 | unsigned short st_uid; | ||
17 | unsigned short st_gid; | ||
18 | unsigned short st_rdev; | ||
19 | unsigned long st_size; | ||
20 | unsigned long st_atime; | ||
21 | unsigned long st_mtime; | ||
22 | unsigned long st_ctime; | ||
23 | }; | ||
24 | |||
25 | struct stat { | ||
26 | unsigned long st_dev; | ||
27 | unsigned long st_ino; | ||
28 | unsigned short st_mode; | ||
29 | unsigned short st_nlink; | ||
30 | unsigned short st_uid; | ||
31 | unsigned short st_gid; | ||
32 | unsigned long st_rdev; | ||
33 | unsigned long st_size; | ||
34 | unsigned long st_blksize; | ||
35 | unsigned long st_blocks; | ||
36 | unsigned long st_atime; | ||
37 | unsigned long st_atime_nsec; | ||
38 | unsigned long st_mtime; | ||
39 | unsigned long st_mtime_nsec; | ||
40 | unsigned long st_ctime; | ||
41 | unsigned long st_ctime_nsec; | ||
42 | unsigned long __unused4; | ||
43 | unsigned long __unused5; | ||
44 | }; | ||
45 | |||
46 | #define STAT_HAVE_NSEC 1 | ||
47 | |||
48 | struct stat64 { | ||
49 | unsigned long long st_dev; | ||
50 | |||
51 | unsigned long long st_ino; | ||
52 | unsigned int st_mode; | ||
53 | unsigned int st_nlink; | ||
54 | |||
55 | unsigned long st_uid; | ||
56 | unsigned long st_gid; | ||
57 | |||
58 | unsigned long long st_rdev; | ||
59 | |||
60 | long long st_size; | ||
61 | unsigned long __pad1; /* align 64-bit st_blocks */ | ||
62 | unsigned long st_blksize; | ||
63 | |||
64 | unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ | ||
65 | |||
66 | unsigned long st_atime; | ||
67 | unsigned long st_atime_nsec; | ||
68 | |||
69 | unsigned long st_mtime; | ||
70 | unsigned long st_mtime_nsec; | ||
71 | |||
72 | unsigned long st_ctime; | ||
73 | unsigned long st_ctime_nsec; | ||
74 | |||
75 | unsigned long __unused1; | ||
76 | unsigned long __unused2; | ||
77 | }; | ||
78 | |||
79 | #endif /* __ASM_AVR32_STAT_H */ | ||
diff --git a/include/asm-avr32/statfs.h b/include/asm-avr32/statfs.h new file mode 100644 index 000000000000..2961bd18c50e --- /dev/null +++ b/include/asm-avr32/statfs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_STATFS_H | ||
2 | #define __ASM_AVR32_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_STATFS_H */ | ||
diff --git a/include/asm-avr32/string.h b/include/asm-avr32/string.h new file mode 100644 index 000000000000..c91a623cd585 --- /dev/null +++ b/include/asm-avr32/string.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_STRING_H | ||
9 | #define __ASM_AVR32_STRING_H | ||
10 | |||
11 | #define __HAVE_ARCH_MEMSET | ||
12 | extern void *memset(void *b, int c, size_t len); | ||
13 | |||
14 | #define __HAVE_ARCH_MEMCPY | ||
15 | extern void *memcpy(void *to, const void *from, size_t len); | ||
16 | |||
17 | #endif /* __ASM_AVR32_STRING_H */ | ||
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h new file mode 100644 index 000000000000..f91975f330f6 --- /dev/null +++ b/include/asm-avr32/sysreg.h | |||
@@ -0,0 +1,332 @@ | |||
1 | /* | ||
2 | * AVR32 System Registers | ||
3 | * | ||
4 | * Copyright (C) 2004-2006 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __ASM_AVR32_SYSREG_H__ | ||
11 | #define __ASM_AVR32_SYSREG_H__ | ||
12 | |||
13 | /* sysreg register offsets */ | ||
14 | #define SYSREG_SR 0x0000 | ||
15 | #define SYSREG_EVBA 0x0004 | ||
16 | #define SYSREG_ACBA 0x0008 | ||
17 | #define SYSREG_CPUCR 0x000c | ||
18 | #define SYSREG_ECR 0x0010 | ||
19 | #define SYSREG_RSR_SUP 0x0014 | ||
20 | #define SYSREG_RSR_INT0 0x0018 | ||
21 | #define SYSREG_RSR_INT1 0x001c | ||
22 | #define SYSREG_RSR_INT2 0x0020 | ||
23 | #define SYSREG_RSR_INT3 0x0024 | ||
24 | #define SYSREG_RSR_EX 0x0028 | ||
25 | #define SYSREG_RSR_NMI 0x002c | ||
26 | #define SYSREG_RSR_DBG 0x0030 | ||
27 | #define SYSREG_RAR_SUP 0x0034 | ||
28 | #define SYSREG_RAR_INT0 0x0038 | ||
29 | #define SYSREG_RAR_INT1 0x003c | ||
30 | #define SYSREG_RAR_INT2 0x0040 | ||
31 | #define SYSREG_RAR_INT3 0x0044 | ||
32 | #define SYSREG_RAR_EX 0x0048 | ||
33 | #define SYSREG_RAR_NMI 0x004c | ||
34 | #define SYSREG_RAR_DBG 0x0050 | ||
35 | #define SYSREG_JECR 0x0054 | ||
36 | #define SYSREG_JOSP 0x0058 | ||
37 | #define SYSREG_JAVA_LV0 0x005c | ||
38 | #define SYSREG_JAVA_LV1 0x0060 | ||
39 | #define SYSREG_JAVA_LV2 0x0064 | ||
40 | #define SYSREG_JAVA_LV3 0x0068 | ||
41 | #define SYSREG_JAVA_LV4 0x006c | ||
42 | #define SYSREG_JAVA_LV5 0x0070 | ||
43 | #define SYSREG_JAVA_LV6 0x0074 | ||
44 | #define SYSREG_JAVA_LV7 0x0078 | ||
45 | #define SYSREG_JTBA 0x007c | ||
46 | #define SYSREG_JBCR 0x0080 | ||
47 | #define SYSREG_CONFIG0 0x0100 | ||
48 | #define SYSREG_CONFIG1 0x0104 | ||
49 | #define SYSREG_COUNT 0x0108 | ||
50 | #define SYSREG_COMPARE 0x010c | ||
51 | #define SYSREG_TLBEHI 0x0110 | ||
52 | #define SYSREG_TLBELO 0x0114 | ||
53 | #define SYSREG_PTBR 0x0118 | ||
54 | #define SYSREG_TLBEAR 0x011c | ||
55 | #define SYSREG_MMUCR 0x0120 | ||
56 | #define SYSREG_TLBARLO 0x0124 | ||
57 | #define SYSREG_TLBARHI 0x0128 | ||
58 | #define SYSREG_PCCNT 0x012c | ||
59 | #define SYSREG_PCNT0 0x0130 | ||
60 | #define SYSREG_PCNT1 0x0134 | ||
61 | #define SYSREG_PCCR 0x0138 | ||
62 | #define SYSREG_BEAR 0x013c | ||
63 | |||
64 | /* Bitfields in SR */ | ||
65 | #define SYSREG_SR_C_OFFSET 0 | ||
66 | #define SYSREG_SR_C_SIZE 1 | ||
67 | #define SYSREG_Z_OFFSET 1 | ||
68 | #define SYSREG_Z_SIZE 1 | ||
69 | #define SYSREG_SR_N_OFFSET 2 | ||
70 | #define SYSREG_SR_N_SIZE 1 | ||
71 | #define SYSREG_SR_V_OFFSET 3 | ||
72 | #define SYSREG_SR_V_SIZE 1 | ||
73 | #define SYSREG_Q_OFFSET 4 | ||
74 | #define SYSREG_Q_SIZE 1 | ||
75 | #define SYSREG_GM_OFFSET 16 | ||
76 | #define SYSREG_GM_SIZE 1 | ||
77 | #define SYSREG_I0M_OFFSET 17 | ||
78 | #define SYSREG_I0M_SIZE 1 | ||
79 | #define SYSREG_I1M_OFFSET 18 | ||
80 | #define SYSREG_I1M_SIZE 1 | ||
81 | #define SYSREG_I2M_OFFSET 19 | ||
82 | #define SYSREG_I2M_SIZE 1 | ||
83 | #define SYSREG_I3M_OFFSET 20 | ||
84 | #define SYSREG_I3M_SIZE 1 | ||
85 | #define SYSREG_EM_OFFSET 21 | ||
86 | #define SYSREG_EM_SIZE 1 | ||
87 | #define SYSREG_M0_OFFSET 22 | ||
88 | #define SYSREG_M0_SIZE 1 | ||
89 | #define SYSREG_M1_OFFSET 23 | ||
90 | #define SYSREG_M1_SIZE 1 | ||
91 | #define SYSREG_M2_OFFSET 24 | ||
92 | #define SYSREG_M2_SIZE 1 | ||
93 | #define SYSREG_SR_D_OFFSET 26 | ||
94 | #define SYSREG_SR_D_SIZE 1 | ||
95 | #define SYSREG_DM_OFFSET 27 | ||
96 | #define SYSREG_DM_SIZE 1 | ||
97 | #define SYSREG_SR_J_OFFSET 28 | ||
98 | #define SYSREG_SR_J_SIZE 1 | ||
99 | #define SYSREG_R_OFFSET 29 | ||
100 | #define SYSREG_R_SIZE 1 | ||
101 | #define SYSREG_H_OFFSET 30 | ||
102 | #define SYSREG_H_SIZE 1 | ||
103 | |||
104 | /* Bitfields in EVBA */ | ||
105 | |||
106 | /* Bitfields in ACBA */ | ||
107 | |||
108 | /* Bitfields in CPUCR */ | ||
109 | #define SYSREG_BI_OFFSET 0 | ||
110 | #define SYSREG_BI_SIZE 1 | ||
111 | #define SYSREG_BE_OFFSET 1 | ||
112 | #define SYSREG_BE_SIZE 1 | ||
113 | #define SYSREG_FE_OFFSET 2 | ||
114 | #define SYSREG_FE_SIZE 1 | ||
115 | #define SYSREG_RE_OFFSET 3 | ||
116 | #define SYSREG_RE_SIZE 1 | ||
117 | #define SYSREG_IBE_OFFSET 4 | ||
118 | #define SYSREG_IBE_SIZE 1 | ||
119 | #define SYSREG_IEE_OFFSET 5 | ||
120 | #define SYSREG_IEE_SIZE 1 | ||
121 | |||
122 | /* Bitfields in ECR */ | ||
123 | #define SYSREG_ECR_OFFSET 0 | ||
124 | #define SYSREG_ECR_SIZE 32 | ||
125 | |||
126 | /* Bitfields in RSR_SUP */ | ||
127 | |||
128 | /* Bitfields in RSR_INT0 */ | ||
129 | |||
130 | /* Bitfields in RSR_INT1 */ | ||
131 | |||
132 | /* Bitfields in RSR_INT2 */ | ||
133 | |||
134 | /* Bitfields in RSR_INT3 */ | ||
135 | |||
136 | /* Bitfields in RSR_EX */ | ||
137 | |||
138 | /* Bitfields in RSR_NMI */ | ||
139 | |||
140 | /* Bitfields in RSR_DBG */ | ||
141 | |||
142 | /* Bitfields in RAR_SUP */ | ||
143 | |||
144 | /* Bitfields in RAR_INT0 */ | ||
145 | |||
146 | /* Bitfields in RAR_INT1 */ | ||
147 | |||
148 | /* Bitfields in RAR_INT2 */ | ||
149 | |||
150 | /* Bitfields in RAR_INT3 */ | ||
151 | |||
152 | /* Bitfields in RAR_EX */ | ||
153 | |||
154 | /* Bitfields in RAR_NMI */ | ||
155 | |||
156 | /* Bitfields in RAR_DBG */ | ||
157 | |||
158 | /* Bitfields in JECR */ | ||
159 | |||
160 | /* Bitfields in JOSP */ | ||
161 | |||
162 | /* Bitfields in JAVA_LV0 */ | ||
163 | |||
164 | /* Bitfields in JAVA_LV1 */ | ||
165 | |||
166 | /* Bitfields in JAVA_LV2 */ | ||
167 | |||
168 | /* Bitfields in JAVA_LV3 */ | ||
169 | |||
170 | /* Bitfields in JAVA_LV4 */ | ||
171 | |||
172 | /* Bitfields in JAVA_LV5 */ | ||
173 | |||
174 | /* Bitfields in JAVA_LV6 */ | ||
175 | |||
176 | /* Bitfields in JAVA_LV7 */ | ||
177 | |||
178 | /* Bitfields in JTBA */ | ||
179 | |||
180 | /* Bitfields in JBCR */ | ||
181 | |||
182 | /* Bitfields in CONFIG0 */ | ||
183 | #define SYSREG_CONFIG0_D_OFFSET 1 | ||
184 | #define SYSREG_CONFIG0_D_SIZE 1 | ||
185 | #define SYSREG_CONFIG0_S_OFFSET 2 | ||
186 | #define SYSREG_CONFIG0_S_SIZE 1 | ||
187 | #define SYSREG_O_OFFSET 3 | ||
188 | #define SYSREG_O_SIZE 1 | ||
189 | #define SYSREG_P_OFFSET 4 | ||
190 | #define SYSREG_P_SIZE 1 | ||
191 | #define SYSREG_CONFIG0_J_OFFSET 5 | ||
192 | #define SYSREG_CONFIG0_J_SIZE 1 | ||
193 | #define SYSREG_F_OFFSET 6 | ||
194 | #define SYSREG_F_SIZE 1 | ||
195 | #define SYSREG_MMUT_OFFSET 7 | ||
196 | #define SYSREG_MMUT_SIZE 3 | ||
197 | #define SYSREG_AR_OFFSET 10 | ||
198 | #define SYSREG_AR_SIZE 3 | ||
199 | #define SYSREG_AT_OFFSET 13 | ||
200 | #define SYSREG_AT_SIZE 3 | ||
201 | #define SYSREG_PROCESSORREVISION_OFFSET 16 | ||
202 | #define SYSREG_PROCESSORREVISION_SIZE 8 | ||
203 | #define SYSREG_PROCESSORID_OFFSET 24 | ||
204 | #define SYSREG_PROCESSORID_SIZE 8 | ||
205 | |||
206 | /* Bitfields in CONFIG1 */ | ||
207 | #define SYSREG_DASS_OFFSET 0 | ||
208 | #define SYSREG_DASS_SIZE 3 | ||
209 | #define SYSREG_DLSZ_OFFSET 3 | ||
210 | #define SYSREG_DLSZ_SIZE 3 | ||
211 | #define SYSREG_DSET_OFFSET 6 | ||
212 | #define SYSREG_DSET_SIZE 4 | ||
213 | #define SYSREG_IASS_OFFSET 10 | ||
214 | #define SYSREG_IASS_SIZE 2 | ||
215 | #define SYSREG_ILSZ_OFFSET 13 | ||
216 | #define SYSREG_ILSZ_SIZE 3 | ||
217 | #define SYSREG_ISET_OFFSET 16 | ||
218 | #define SYSREG_ISET_SIZE 4 | ||
219 | #define SYSREG_DMMUSZ_OFFSET 20 | ||
220 | #define SYSREG_DMMUSZ_SIZE 6 | ||
221 | #define SYSREG_IMMUSZ_OFFSET 26 | ||
222 | #define SYSREG_IMMUSZ_SIZE 6 | ||
223 | |||
224 | /* Bitfields in COUNT */ | ||
225 | |||
226 | /* Bitfields in COMPARE */ | ||
227 | |||
228 | /* Bitfields in TLBEHI */ | ||
229 | #define SYSREG_ASID_OFFSET 0 | ||
230 | #define SYSREG_ASID_SIZE 8 | ||
231 | #define SYSREG_TLBEHI_I_OFFSET 8 | ||
232 | #define SYSREG_TLBEHI_I_SIZE 1 | ||
233 | #define SYSREG_TLBEHI_V_OFFSET 9 | ||
234 | #define SYSREG_TLBEHI_V_SIZE 1 | ||
235 | #define SYSREG_VPN_OFFSET 10 | ||
236 | #define SYSREG_VPN_SIZE 22 | ||
237 | |||
238 | /* Bitfields in TLBELO */ | ||
239 | #define SYSREG_W_OFFSET 0 | ||
240 | #define SYSREG_W_SIZE 1 | ||
241 | #define SYSREG_TLBELO_D_OFFSET 1 | ||
242 | #define SYSREG_TLBELO_D_SIZE 1 | ||
243 | #define SYSREG_SZ_OFFSET 2 | ||
244 | #define SYSREG_SZ_SIZE 2 | ||
245 | #define SYSREG_AP_OFFSET 4 | ||
246 | #define SYSREG_AP_SIZE 3 | ||
247 | #define SYSREG_B_OFFSET 7 | ||
248 | #define SYSREG_B_SIZE 1 | ||
249 | #define SYSREG_G_OFFSET 8 | ||
250 | #define SYSREG_G_SIZE 1 | ||
251 | #define SYSREG_TLBELO_C_OFFSET 9 | ||
252 | #define SYSREG_TLBELO_C_SIZE 1 | ||
253 | #define SYSREG_PFN_OFFSET 10 | ||
254 | #define SYSREG_PFN_SIZE 22 | ||
255 | |||
256 | /* Bitfields in PTBR */ | ||
257 | |||
258 | /* Bitfields in TLBEAR */ | ||
259 | |||
260 | /* Bitfields in MMUCR */ | ||
261 | #define SYSREG_E_OFFSET 0 | ||
262 | #define SYSREG_E_SIZE 1 | ||
263 | #define SYSREG_M_OFFSET 1 | ||
264 | #define SYSREG_M_SIZE 1 | ||
265 | #define SYSREG_MMUCR_I_OFFSET 2 | ||
266 | #define SYSREG_MMUCR_I_SIZE 1 | ||
267 | #define SYSREG_MMUCR_N_OFFSET 3 | ||
268 | #define SYSREG_MMUCR_N_SIZE 1 | ||
269 | #define SYSREG_MMUCR_S_OFFSET 4 | ||
270 | #define SYSREG_MMUCR_S_SIZE 1 | ||
271 | #define SYSREG_DLA_OFFSET 8 | ||
272 | #define SYSREG_DLA_SIZE 6 | ||
273 | #define SYSREG_DRP_OFFSET 14 | ||
274 | #define SYSREG_DRP_SIZE 6 | ||
275 | #define SYSREG_ILA_OFFSET 20 | ||
276 | #define SYSREG_ILA_SIZE 6 | ||
277 | #define SYSREG_IRP_OFFSET 26 | ||
278 | #define SYSREG_IRP_SIZE 6 | ||
279 | |||
280 | /* Bitfields in TLBARLO */ | ||
281 | |||
282 | /* Bitfields in TLBARHI */ | ||
283 | |||
284 | /* Bitfields in PCCNT */ | ||
285 | |||
286 | /* Bitfields in PCNT0 */ | ||
287 | |||
288 | /* Bitfields in PCNT1 */ | ||
289 | |||
290 | /* Bitfields in PCCR */ | ||
291 | |||
292 | /* Bitfields in BEAR */ | ||
293 | |||
294 | /* Constants for ECR */ | ||
295 | #define ECR_UNRECOVERABLE 0 | ||
296 | #define ECR_TLB_MULTIPLE 1 | ||
297 | #define ECR_BUS_ERROR_WRITE 2 | ||
298 | #define ECR_BUS_ERROR_READ 3 | ||
299 | #define ECR_NMI 4 | ||
300 | #define ECR_ADDR_ALIGN_X 5 | ||
301 | #define ECR_PROTECTION_X 6 | ||
302 | #define ECR_DEBUG 7 | ||
303 | #define ECR_ILLEGAL_OPCODE 8 | ||
304 | #define ECR_UNIMPL_INSTRUCTION 9 | ||
305 | #define ECR_PRIVILEGE_VIOLATION 10 | ||
306 | #define ECR_FPE 11 | ||
307 | #define ECR_COPROC_ABSENT 12 | ||
308 | #define ECR_ADDR_ALIGN_R 13 | ||
309 | #define ECR_ADDR_ALIGN_W 14 | ||
310 | #define ECR_PROTECTION_R 15 | ||
311 | #define ECR_PROTECTION_W 16 | ||
312 | #define ECR_DTLB_MODIFIED 17 | ||
313 | #define ECR_TLB_MISS_X 20 | ||
314 | #define ECR_TLB_MISS_R 24 | ||
315 | #define ECR_TLB_MISS_W 28 | ||
316 | |||
317 | /* Bit manipulation macros */ | ||
318 | #define SYSREG_BIT(name) (1 << SYSREG_##name##_OFFSET) | ||
319 | #define SYSREG_BF(name,value) (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) << SYSREG_##name##_OFFSET) | ||
320 | #define SYSREG_BFEXT(name,value) (((value) >> SYSREG_##name##_OFFSET) & ((1 << SYSREG_##name##_SIZE) - 1)) | ||
321 | #define SYSREG_BFINS(name,value,old) (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) << SYSREG_##name##_OFFSET)) | SYSREG_BF(name,value)) | ||
322 | |||
323 | #ifdef __CHECKER__ | ||
324 | extern unsigned long __builtin_mfsr(unsigned long reg); | ||
325 | extern void __builtin_mtsr(unsigned long reg, unsigned long value); | ||
326 | #endif | ||
327 | |||
328 | /* Register access macros */ | ||
329 | #define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg) | ||
330 | #define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value) | ||
331 | |||
332 | #endif /* __ASM_AVR32_SYSREG_H__ */ | ||
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h new file mode 100644 index 000000000000..ac596058697d --- /dev/null +++ b/include/asm-avr32/system.h | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_SYSTEM_H | ||
9 | #define __ASM_AVR32_SYSTEM_H | ||
10 | |||
11 | #include <linux/compiler.h> | ||
12 | #include <linux/types.h> | ||
13 | |||
14 | #include <asm/ptrace.h> | ||
15 | #include <asm/sysreg.h> | ||
16 | |||
17 | #define xchg(ptr,x) \ | ||
18 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
19 | |||
20 | #define nop() asm volatile("nop") | ||
21 | |||
22 | #define mb() asm volatile("" : : : "memory") | ||
23 | #define rmb() mb() | ||
24 | #define wmb() asm volatile("sync 0" : : : "memory") | ||
25 | #define read_barrier_depends() do { } while(0) | ||
26 | #define set_mb(var, value) do { var = value; mb(); } while(0) | ||
27 | |||
28 | /* | ||
29 | * Help PathFinder and other Nexus-compliant debuggers keep track of | ||
30 | * the current PID by emitting an Ownership Trace Message each time we | ||
31 | * switch task. | ||
32 | */ | ||
33 | #ifdef CONFIG_OWNERSHIP_TRACE | ||
34 | #include <asm/ocd.h> | ||
35 | #define finish_arch_switch(prev) \ | ||
36 | do { \ | ||
37 | __mtdr(DBGREG_PID, prev->pid); \ | ||
38 | __mtdr(DBGREG_PID, current->pid); \ | ||
39 | } while(0) | ||
40 | #endif | ||
41 | |||
42 | /* | ||
43 | * switch_to(prev, next, last) should switch from task `prev' to task | ||
44 | * `next'. `prev' will never be the same as `next'. | ||
45 | * | ||
46 | * We just delegate everything to the __switch_to assembly function, | ||
47 | * which is implemented in arch/avr32/kernel/switch_to.S | ||
48 | * | ||
49 | * mb() tells GCC not to cache `current' across this call. | ||
50 | */ | ||
51 | struct cpu_context; | ||
52 | struct task_struct; | ||
53 | extern struct task_struct *__switch_to(struct task_struct *, | ||
54 | struct cpu_context *, | ||
55 | struct cpu_context *); | ||
56 | #define switch_to(prev, next, last) \ | ||
57 | do { \ | ||
58 | last = __switch_to(prev, &prev->thread.cpu_context + 1, \ | ||
59 | &next->thread.cpu_context); \ | ||
60 | } while (0) | ||
61 | |||
62 | #ifdef CONFIG_SMP | ||
63 | # error "The AVR32 port does not support SMP" | ||
64 | #else | ||
65 | # define smp_mb() barrier() | ||
66 | # define smp_rmb() barrier() | ||
67 | # define smp_wmb() barrier() | ||
68 | # define smp_read_barrier_depends() do { } while(0) | ||
69 | #endif | ||
70 | |||
71 | #include <linux/irqflags.h> | ||
72 | |||
73 | extern void __xchg_called_with_bad_pointer(void); | ||
74 | |||
75 | #ifdef __CHECKER__ | ||
76 | extern unsigned long __builtin_xchg(void *ptr, unsigned long x); | ||
77 | #endif | ||
78 | |||
79 | #define xchg_u32(val, m) __builtin_xchg((void *)m, val) | ||
80 | |||
81 | static inline unsigned long __xchg(unsigned long x, | ||
82 | volatile void *ptr, | ||
83 | int size) | ||
84 | { | ||
85 | switch(size) { | ||
86 | case 4: | ||
87 | return xchg_u32(x, ptr); | ||
88 | default: | ||
89 | __xchg_called_with_bad_pointer(); | ||
90 | return x; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, | ||
95 | unsigned long new) | ||
96 | { | ||
97 | __u32 ret; | ||
98 | |||
99 | asm volatile( | ||
100 | "1: ssrf 5\n" | ||
101 | " ld.w %[ret], %[m]\n" | ||
102 | " cp.w %[ret], %[old]\n" | ||
103 | " brne 2f\n" | ||
104 | " stcond %[m], %[new]\n" | ||
105 | " brne 1b\n" | ||
106 | "2:\n" | ||
107 | : [ret] "=&r"(ret), [m] "=m"(*m) | ||
108 | : "m"(m), [old] "ir"(old), [new] "r"(new) | ||
109 | : "memory", "cc"); | ||
110 | return ret; | ||
111 | } | ||
112 | |||
113 | extern unsigned long __cmpxchg_u64_unsupported_on_32bit_kernels( | ||
114 | volatile int * m, unsigned long old, unsigned long new); | ||
115 | #define __cmpxchg_u64 __cmpxchg_u64_unsupported_on_32bit_kernels | ||
116 | |||
117 | /* This function doesn't exist, so you'll get a linker error | ||
118 | if something tries to do an invalid cmpxchg(). */ | ||
119 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
120 | |||
121 | #define __HAVE_ARCH_CMPXCHG 1 | ||
122 | |||
123 | static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | ||
124 | unsigned long new, int size) | ||
125 | { | ||
126 | switch (size) { | ||
127 | case 4: | ||
128 | return __cmpxchg_u32(ptr, old, new); | ||
129 | case 8: | ||
130 | return __cmpxchg_u64(ptr, old, new); | ||
131 | } | ||
132 | |||
133 | __cmpxchg_called_with_bad_pointer(); | ||
134 | return old; | ||
135 | } | ||
136 | |||
137 | #define cmpxchg(ptr, old, new) \ | ||
138 | ((typeof(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), \ | ||
139 | (unsigned long)(new), \ | ||
140 | sizeof(*(ptr)))) | ||
141 | |||
142 | struct pt_regs; | ||
143 | extern void __die(const char *, struct pt_regs *, unsigned long, | ||
144 | const char *, const char *, unsigned long); | ||
145 | extern void __die_if_kernel(const char *, struct pt_regs *, unsigned long, | ||
146 | const char *, const char *, unsigned long); | ||
147 | |||
148 | #define die(msg, regs, err) \ | ||
149 | __die(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__) | ||
150 | #define die_if_kernel(msg, regs, err) \ | ||
151 | __die_if_kernel(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__) | ||
152 | |||
153 | #define arch_align_stack(x) (x) | ||
154 | |||
155 | #endif /* __ASM_AVR32_SYSTEM_H */ | ||
diff --git a/include/asm-avr32/termbits.h b/include/asm-avr32/termbits.h new file mode 100644 index 000000000000..9dc6eacafa33 --- /dev/null +++ b/include/asm-avr32/termbits.h | |||
@@ -0,0 +1,173 @@ | |||
1 | #ifndef __ASM_AVR32_TERMBITS_H | ||
2 | #define __ASM_AVR32_TERMBITS_H | ||
3 | |||
4 | #include <linux/posix_types.h> | ||
5 | |||
6 | typedef unsigned char cc_t; | ||
7 | typedef unsigned int speed_t; | ||
8 | typedef unsigned int tcflag_t; | ||
9 | |||
10 | #define NCCS 19 | ||
11 | struct termios { | ||
12 | tcflag_t c_iflag; /* input mode flags */ | ||
13 | tcflag_t c_oflag; /* output mode flags */ | ||
14 | tcflag_t c_cflag; /* control mode flags */ | ||
15 | tcflag_t c_lflag; /* local mode flags */ | ||
16 | cc_t c_line; /* line discipline */ | ||
17 | cc_t c_cc[NCCS]; /* control characters */ | ||
18 | }; | ||
19 | |||
20 | /* c_cc characters */ | ||
21 | #define VINTR 0 | ||
22 | #define VQUIT 1 | ||
23 | #define VERASE 2 | ||
24 | #define VKILL 3 | ||
25 | #define VEOF 4 | ||
26 | #define VTIME 5 | ||
27 | #define VMIN 6 | ||
28 | #define VSWTC 7 | ||
29 | #define VSTART 8 | ||
30 | #define VSTOP 9 | ||
31 | #define VSUSP 10 | ||
32 | #define VEOL 11 | ||
33 | #define VREPRINT 12 | ||
34 | #define VDISCARD 13 | ||
35 | #define VWERASE 14 | ||
36 | #define VLNEXT 15 | ||
37 | #define VEOL2 16 | ||
38 | |||
39 | /* c_iflag bits */ | ||
40 | #define IGNBRK 0000001 | ||
41 | #define BRKINT 0000002 | ||
42 | #define IGNPAR 0000004 | ||
43 | #define PARMRK 0000010 | ||
44 | #define INPCK 0000020 | ||
45 | #define ISTRIP 0000040 | ||
46 | #define INLCR 0000100 | ||
47 | #define IGNCR 0000200 | ||
48 | #define ICRNL 0000400 | ||
49 | #define IUCLC 0001000 | ||
50 | #define IXON 0002000 | ||
51 | #define IXANY 0004000 | ||
52 | #define IXOFF 0010000 | ||
53 | #define IMAXBEL 0020000 | ||
54 | #define IUTF8 0040000 | ||
55 | |||
56 | /* c_oflag bits */ | ||
57 | #define OPOST 0000001 | ||
58 | #define OLCUC 0000002 | ||
59 | #define ONLCR 0000004 | ||
60 | #define OCRNL 0000010 | ||
61 | #define ONOCR 0000020 | ||
62 | #define ONLRET 0000040 | ||
63 | #define OFILL 0000100 | ||
64 | #define OFDEL 0000200 | ||
65 | #define NLDLY 0000400 | ||
66 | #define NL0 0000000 | ||
67 | #define NL1 0000400 | ||
68 | #define CRDLY 0003000 | ||
69 | #define CR0 0000000 | ||
70 | #define CR1 0001000 | ||
71 | #define CR2 0002000 | ||
72 | #define CR3 0003000 | ||
73 | #define TABDLY 0014000 | ||
74 | #define TAB0 0000000 | ||
75 | #define TAB1 0004000 | ||
76 | #define TAB2 0010000 | ||
77 | #define TAB3 0014000 | ||
78 | #define XTABS 0014000 | ||
79 | #define BSDLY 0020000 | ||
80 | #define BS0 0000000 | ||
81 | #define BS1 0020000 | ||
82 | #define VTDLY 0040000 | ||
83 | #define VT0 0000000 | ||
84 | #define VT1 0040000 | ||
85 | #define FFDLY 0100000 | ||
86 | #define FF0 0000000 | ||
87 | #define FF1 0100000 | ||
88 | |||
89 | /* c_cflag bit meaning */ | ||
90 | #define CBAUD 0010017 | ||
91 | #define B0 0000000 /* hang up */ | ||
92 | #define B50 0000001 | ||
93 | #define B75 0000002 | ||
94 | #define B110 0000003 | ||
95 | #define B134 0000004 | ||
96 | #define B150 0000005 | ||
97 | #define B200 0000006 | ||
98 | #define B300 0000007 | ||
99 | #define B600 0000010 | ||
100 | #define B1200 0000011 | ||
101 | #define B1800 0000012 | ||
102 | #define B2400 0000013 | ||
103 | #define B4800 0000014 | ||
104 | #define B9600 0000015 | ||
105 | #define B19200 0000016 | ||
106 | #define B38400 0000017 | ||
107 | #define EXTA B19200 | ||
108 | #define EXTB B38400 | ||
109 | #define CSIZE 0000060 | ||
110 | #define CS5 0000000 | ||
111 | #define CS6 0000020 | ||
112 | #define CS7 0000040 | ||
113 | #define CS8 0000060 | ||
114 | #define CSTOPB 0000100 | ||
115 | #define CREAD 0000200 | ||
116 | #define PARENB 0000400 | ||
117 | #define PARODD 0001000 | ||
118 | #define HUPCL 0002000 | ||
119 | #define CLOCAL 0004000 | ||
120 | #define CBAUDEX 0010000 | ||
121 | #define B57600 0010001 | ||
122 | #define B115200 0010002 | ||
123 | #define B230400 0010003 | ||
124 | #define B460800 0010004 | ||
125 | #define B500000 0010005 | ||
126 | #define B576000 0010006 | ||
127 | #define B921600 0010007 | ||
128 | #define B1000000 0010010 | ||
129 | #define B1152000 0010011 | ||
130 | #define B1500000 0010012 | ||
131 | #define B2000000 0010013 | ||
132 | #define B2500000 0010014 | ||
133 | #define B3000000 0010015 | ||
134 | #define B3500000 0010016 | ||
135 | #define B4000000 0010017 | ||
136 | #define CIBAUD 002003600000 /* input baud rate (not used) */ | ||
137 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
138 | #define CRTSCTS 020000000000 /* flow control */ | ||
139 | |||
140 | /* c_lflag bits */ | ||
141 | #define ISIG 0000001 | ||
142 | #define ICANON 0000002 | ||
143 | #define XCASE 0000004 | ||
144 | #define ECHO 0000010 | ||
145 | #define ECHOE 0000020 | ||
146 | #define ECHOK 0000040 | ||
147 | #define ECHONL 0000100 | ||
148 | #define NOFLSH 0000200 | ||
149 | #define TOSTOP 0000400 | ||
150 | #define ECHOCTL 0001000 | ||
151 | #define ECHOPRT 0002000 | ||
152 | #define ECHOKE 0004000 | ||
153 | #define FLUSHO 0010000 | ||
154 | #define PENDIN 0040000 | ||
155 | #define IEXTEN 0100000 | ||
156 | |||
157 | /* tcflow() and TCXONC use these */ | ||
158 | #define TCOOFF 0 | ||
159 | #define TCOON 1 | ||
160 | #define TCIOFF 2 | ||
161 | #define TCION 3 | ||
162 | |||
163 | /* tcflush() and TCFLSH use these */ | ||
164 | #define TCIFLUSH 0 | ||
165 | #define TCOFLUSH 1 | ||
166 | #define TCIOFLUSH 2 | ||
167 | |||
168 | /* tcsetattr uses these */ | ||
169 | #define TCSANOW 0 | ||
170 | #define TCSADRAIN 1 | ||
171 | #define TCSAFLUSH 2 | ||
172 | |||
173 | #endif /* __ASM_AVR32_TERMBITS_H */ | ||
diff --git a/include/asm-avr32/termios.h b/include/asm-avr32/termios.h new file mode 100644 index 000000000000..615bc0639e5c --- /dev/null +++ b/include/asm-avr32/termios.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_TERMIOS_H | ||
9 | #define __ASM_AVR32_TERMIOS_H | ||
10 | |||
11 | #include <asm/termbits.h> | ||
12 | #include <asm/ioctls.h> | ||
13 | |||
14 | struct winsize { | ||
15 | unsigned short ws_row; | ||
16 | unsigned short ws_col; | ||
17 | unsigned short ws_xpixel; | ||
18 | unsigned short ws_ypixel; | ||
19 | }; | ||
20 | |||
21 | #define NCC 8 | ||
22 | struct termio { | ||
23 | unsigned short c_iflag; /* input mode flags */ | ||
24 | unsigned short c_oflag; /* output mode flags */ | ||
25 | unsigned short c_cflag; /* control mode flags */ | ||
26 | unsigned short c_lflag; /* local mode flags */ | ||
27 | unsigned char c_line; /* line discipline */ | ||
28 | unsigned char c_cc[NCC]; /* control characters */ | ||
29 | }; | ||
30 | |||
31 | /* modem lines */ | ||
32 | #define TIOCM_LE 0x001 | ||
33 | #define TIOCM_DTR 0x002 | ||
34 | #define TIOCM_RTS 0x004 | ||
35 | #define TIOCM_ST 0x008 | ||
36 | #define TIOCM_SR 0x010 | ||
37 | #define TIOCM_CTS 0x020 | ||
38 | #define TIOCM_CAR 0x040 | ||
39 | #define TIOCM_RNG 0x080 | ||
40 | #define TIOCM_DSR 0x100 | ||
41 | #define TIOCM_CD TIOCM_CAR | ||
42 | #define TIOCM_RI TIOCM_RNG | ||
43 | #define TIOCM_OUT1 0x2000 | ||
44 | #define TIOCM_OUT2 0x4000 | ||
45 | #define TIOCM_LOOP 0x8000 | ||
46 | |||
47 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
48 | |||
49 | /* line disciplines */ | ||
50 | #define N_TTY 0 | ||
51 | #define N_SLIP 1 | ||
52 | #define N_MOUSE 2 | ||
53 | #define N_PPP 3 | ||
54 | #define N_STRIP 4 | ||
55 | #define N_AX25 5 | ||
56 | #define N_X25 6 /* X.25 async */ | ||
57 | #define N_6PACK 7 | ||
58 | #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ | ||
59 | #define N_R3964 9 /* Reserved for Simatic R3964 module */ | ||
60 | #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ | ||
61 | #define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */ | ||
62 | #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ | ||
63 | #define N_HDLC 13 /* synchronous HDLC */ | ||
64 | #define N_SYNC_PPP 14 /* synchronous PPP */ | ||
65 | #define N_HCI 15 /* Bluetooth HCI UART */ | ||
66 | |||
67 | #ifdef __KERNEL__ | ||
68 | /* intr=^C quit=^\ erase=del kill=^U | ||
69 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | ||
70 | start=^Q stop=^S susp=^Z eol=\0 | ||
71 | reprint=^R discard=^U werase=^W lnext=^V | ||
72 | eol2=\0 | ||
73 | */ | ||
74 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | ||
75 | |||
76 | #include <asm-generic/termios.h> | ||
77 | |||
78 | #endif /* __KERNEL__ */ | ||
79 | |||
80 | #endif /* __ASM_AVR32_TERMIOS_H */ | ||
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h new file mode 100644 index 000000000000..d1f5b35ebd54 --- /dev/null +++ b/include/asm-avr32/thread_info.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_THREAD_INFO_H | ||
9 | #define __ASM_AVR32_THREAD_INFO_H | ||
10 | |||
11 | #include <asm/page.h> | ||
12 | |||
13 | #define THREAD_SIZE_ORDER 1 | ||
14 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | #include <asm/types.h> | ||
18 | |||
19 | struct task_struct; | ||
20 | struct exec_domain; | ||
21 | |||
22 | struct thread_info { | ||
23 | struct task_struct *task; /* main task structure */ | ||
24 | struct exec_domain *exec_domain; /* execution domain */ | ||
25 | unsigned long flags; /* low level flags */ | ||
26 | __u32 cpu; | ||
27 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
28 | struct restart_block restart_block; | ||
29 | __u8 supervisor_stack[0]; | ||
30 | }; | ||
31 | |||
32 | #define INIT_THREAD_INFO(tsk) \ | ||
33 | { \ | ||
34 | .task = &tsk, \ | ||
35 | .exec_domain = &default_exec_domain, \ | ||
36 | .flags = 0, \ | ||
37 | .cpu = 0, \ | ||
38 | .preempt_count = 1, \ | ||
39 | .restart_block = { \ | ||
40 | .fn = do_no_restart_syscall \ | ||
41 | } \ | ||
42 | } | ||
43 | |||
44 | #define init_thread_info (init_thread_union.thread_info) | ||
45 | #define init_stack (init_thread_union.stack) | ||
46 | |||
47 | /* | ||
48 | * Get the thread information struct from C. | ||
49 | * We do the usual trick and use the lower end of the stack for this | ||
50 | */ | ||
51 | static inline struct thread_info *current_thread_info(void) | ||
52 | { | ||
53 | unsigned long addr = ~(THREAD_SIZE - 1); | ||
54 | |||
55 | asm("and %0, sp" : "=r"(addr) : "0"(addr)); | ||
56 | return (struct thread_info *)addr; | ||
57 | } | ||
58 | |||
59 | /* thread information allocation */ | ||
60 | #define alloc_thread_info(ti) \ | ||
61 | ((struct thread_info *) __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER)) | ||
62 | #define free_thread_info(ti) free_pages((unsigned long)(ti), 1) | ||
63 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
64 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
65 | |||
66 | #endif /* !__ASSEMBLY__ */ | ||
67 | |||
68 | #define PREEMPT_ACTIVE 0x40000000 | ||
69 | |||
70 | /* | ||
71 | * Thread information flags | ||
72 | * - these are process state flags that various assembly files may need to access | ||
73 | * - pending work-to-be-done flags are in LSW | ||
74 | * - other flags in MSW | ||
75 | */ | ||
76 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
77 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
78 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
79 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
80 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling | ||
81 | TIF_NEED_RESCHED */ | ||
82 | #define TIF_BREAKPOINT 5 /* true if we should break after return */ | ||
83 | #define TIF_SINGLE_STEP 6 /* single step after next break */ | ||
84 | #define TIF_MEMDIE 7 | ||
85 | #define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */ | ||
86 | #define TIF_USERSPACE 31 /* true if FS sets userspace */ | ||
87 | |||
88 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | ||
89 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | ||
90 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | ||
91 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | ||
92 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
93 | #define _TIF_BREAKPOINT (1 << TIF_BREAKPOINT) | ||
94 | #define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) | ||
95 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) | ||
96 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
97 | |||
98 | /* XXX: These two masks must never span more than 16 bits! */ | ||
99 | /* work to do on interrupt/exception return */ | ||
100 | #define _TIF_WORK_MASK 0x0000013e | ||
101 | /* work to do on any return to userspace */ | ||
102 | #define _TIF_ALLWORK_MASK 0x0000013f | ||
103 | /* work to do on return from debug mode */ | ||
104 | #define _TIF_DBGWORK_MASK 0x0000017e | ||
105 | |||
106 | #endif /* __ASM_AVR32_THREAD_INFO_H */ | ||
diff --git a/include/asm-avr32/timex.h b/include/asm-avr32/timex.h new file mode 100644 index 000000000000..5e44ecb3ce0c --- /dev/null +++ b/include/asm-avr32/timex.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_TIMEX_H | ||
9 | #define __ASM_AVR32_TIMEX_H | ||
10 | |||
11 | /* | ||
12 | * This is the frequency of the timer used for Linux's timer interrupt. | ||
13 | * The value should be defined as accurate as possible or under certain | ||
14 | * circumstances Linux timekeeping might become inaccurate or fail. | ||
15 | * | ||
16 | * For many system the exact clockrate of the timer isn't known but due to | ||
17 | * the way this value is used we can get away with a wrong value as long | ||
18 | * as this value is: | ||
19 | * | ||
20 | * - a multiple of HZ | ||
21 | * - a divisor of the actual rate | ||
22 | * | ||
23 | * 500000 is a good such cheat value. | ||
24 | * | ||
25 | * The obscure number 1193182 is the same as used by the original i8254 | ||
26 | * time in legacy PC hardware; the chip is never found in AVR32 systems. | ||
27 | */ | ||
28 | #define CLOCK_TICK_RATE 500000 /* Underlying HZ */ | ||
29 | |||
30 | typedef unsigned long cycles_t; | ||
31 | |||
32 | static inline cycles_t get_cycles (void) | ||
33 | { | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | extern int read_current_timer(unsigned long *timer_value); | ||
38 | #define ARCH_HAS_READ_CURRENT_TIMER 1 | ||
39 | |||
40 | #endif /* __ASM_AVR32_TIMEX_H */ | ||
diff --git a/include/asm-avr32/tlb.h b/include/asm-avr32/tlb.h new file mode 100644 index 000000000000..5c55f9ce7c7d --- /dev/null +++ b/include/asm-avr32/tlb.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_TLB_H | ||
9 | #define __ASM_AVR32_TLB_H | ||
10 | |||
11 | #define tlb_start_vma(tlb, vma) \ | ||
12 | flush_cache_range(vma, vma->vm_start, vma->vm_end) | ||
13 | |||
14 | #define tlb_end_vma(tlb, vma) \ | ||
15 | flush_tlb_range(vma, vma->vm_start, vma->vm_end) | ||
16 | |||
17 | #define __tlb_remove_tlb_entry(tlb, pte, address) do { } while(0) | ||
18 | |||
19 | /* | ||
20 | * Flush whole TLB for MM | ||
21 | */ | ||
22 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
23 | |||
24 | #include <asm-generic/tlb.h> | ||
25 | |||
26 | /* | ||
27 | * For debugging purposes | ||
28 | */ | ||
29 | extern void show_dtlb_entry(unsigned int index); | ||
30 | extern void dump_dtlb(void); | ||
31 | |||
32 | #endif /* __ASM_AVR32_TLB_H */ | ||
diff --git a/include/asm-avr32/tlbflush.h b/include/asm-avr32/tlbflush.h new file mode 100644 index 000000000000..730e268f81f3 --- /dev/null +++ b/include/asm-avr32/tlbflush.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_TLBFLUSH_H | ||
9 | #define __ASM_AVR32_TLBFLUSH_H | ||
10 | |||
11 | #include <asm/mmu.h> | ||
12 | |||
13 | /* | ||
14 | * TLB flushing: | ||
15 | * | ||
16 | * - flush_tlb() flushes the current mm struct TLBs | ||
17 | * - flush_tlb_all() flushes all processes' TLB entries | ||
18 | * - flush_tlb_mm(mm) flushes the specified mm context TLBs | ||
19 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
20 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
21 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
22 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | ||
23 | */ | ||
24 | extern void flush_tlb(void); | ||
25 | extern void flush_tlb_all(void); | ||
26 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
27 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | ||
28 | unsigned long end); | ||
29 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); | ||
30 | extern void __flush_tlb_page(unsigned long asid, unsigned long page); | ||
31 | |||
32 | static inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
33 | unsigned long start, unsigned long end) | ||
34 | { | ||
35 | /* Nothing to do */ | ||
36 | } | ||
37 | |||
38 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | ||
39 | |||
40 | #endif /* __ASM_AVR32_TLBFLUSH_H */ | ||
diff --git a/include/asm-avr32/topology.h b/include/asm-avr32/topology.h new file mode 100644 index 000000000000..5b766cbb4806 --- /dev/null +++ b/include/asm-avr32/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_AVR32_TOPOLOGY_H | ||
2 | #define __ASM_AVR32_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* __ASM_AVR32_TOPOLOGY_H */ | ||
diff --git a/include/asm-avr32/traps.h b/include/asm-avr32/traps.h new file mode 100644 index 000000000000..6a8fb944f414 --- /dev/null +++ b/include/asm-avr32/traps.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_TRAPS_H | ||
9 | #define __ASM_AVR32_TRAPS_H | ||
10 | |||
11 | #include <linux/list.h> | ||
12 | |||
13 | struct undef_hook { | ||
14 | struct list_head node; | ||
15 | u32 insn_mask; | ||
16 | u32 insn_val; | ||
17 | int (*fn)(struct pt_regs *regs, u32 insn); | ||
18 | }; | ||
19 | |||
20 | void register_undef_hook(struct undef_hook *hook); | ||
21 | void unregister_undef_hook(struct undef_hook *hook); | ||
22 | |||
23 | #endif /* __ASM_AVR32_TRAPS_H */ | ||
diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h new file mode 100644 index 000000000000..3f47db9675af --- /dev/null +++ b/include/asm-avr32/types.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_TYPES_H | ||
9 | #define __ASM_AVR32_TYPES_H | ||
10 | |||
11 | #ifndef __ASSEMBLY__ | ||
12 | |||
13 | typedef unsigned short umode_t; | ||
14 | |||
15 | /* | ||
16 | * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the | ||
17 | * header files exported to user space | ||
18 | */ | ||
19 | typedef __signed__ char __s8; | ||
20 | typedef unsigned char __u8; | ||
21 | |||
22 | typedef __signed__ short __s16; | ||
23 | typedef unsigned short __u16; | ||
24 | |||
25 | typedef __signed__ int __s32; | ||
26 | typedef unsigned int __u32; | ||
27 | |||
28 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) | ||
29 | typedef __signed__ long long __s64; | ||
30 | typedef unsigned long long __u64; | ||
31 | #endif | ||
32 | |||
33 | #endif /* __ASSEMBLY__ */ | ||
34 | |||
35 | /* | ||
36 | * These aren't exported outside the kernel to avoid name space clashes | ||
37 | */ | ||
38 | #ifdef __KERNEL__ | ||
39 | |||
40 | #define BITS_PER_LONG 32 | ||
41 | |||
42 | #ifndef __ASSEMBLY__ | ||
43 | |||
44 | typedef signed char s8; | ||
45 | typedef unsigned char u8; | ||
46 | |||
47 | typedef signed short s16; | ||
48 | typedef unsigned short u16; | ||
49 | |||
50 | typedef signed int s32; | ||
51 | typedef unsigned int u32; | ||
52 | |||
53 | typedef signed long long s64; | ||
54 | typedef unsigned long long u64; | ||
55 | |||
56 | /* Dma addresses are 32-bits wide. */ | ||
57 | |||
58 | typedef u32 dma_addr_t; | ||
59 | |||
60 | #ifdef CONFIG_LBD | ||
61 | typedef u64 sector_t; | ||
62 | #define HAVE_SECTOR_T | ||
63 | #endif | ||
64 | |||
65 | #endif /* __ASSEMBLY__ */ | ||
66 | |||
67 | #endif /* __KERNEL__ */ | ||
68 | |||
69 | |||
70 | #endif /* __ASM_AVR32_TYPES_H */ | ||
diff --git a/include/asm-avr32/uaccess.h b/include/asm-avr32/uaccess.h new file mode 100644 index 000000000000..821deb5a9d28 --- /dev/null +++ b/include/asm-avr32/uaccess.h | |||
@@ -0,0 +1,335 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_UACCESS_H | ||
9 | #define __ASM_AVR32_UACCESS_H | ||
10 | |||
11 | #include <linux/errno.h> | ||
12 | #include <linux/sched.h> | ||
13 | |||
14 | #define VERIFY_READ 0 | ||
15 | #define VERIFY_WRITE 1 | ||
16 | |||
17 | typedef struct { | ||
18 | unsigned int is_user_space; | ||
19 | } mm_segment_t; | ||
20 | |||
21 | /* | ||
22 | * The fs value determines whether argument validity checking should be | ||
23 | * performed or not. If get_fs() == USER_DS, checking is performed, with | ||
24 | * get_fs() == KERNEL_DS, checking is bypassed. | ||
25 | * | ||
26 | * For historical reasons (Data Segment Register?), these macros are misnamed. | ||
27 | */ | ||
28 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
29 | #define segment_eq(a,b) ((a).is_user_space == (b).is_user_space) | ||
30 | |||
31 | #define USER_ADDR_LIMIT 0x80000000 | ||
32 | |||
33 | #define KERNEL_DS MAKE_MM_SEG(0) | ||
34 | #define USER_DS MAKE_MM_SEG(1) | ||
35 | |||
36 | #define get_ds() (KERNEL_DS) | ||
37 | |||
38 | static inline mm_segment_t get_fs(void) | ||
39 | { | ||
40 | return MAKE_MM_SEG(test_thread_flag(TIF_USERSPACE)); | ||
41 | } | ||
42 | |||
43 | static inline void set_fs(mm_segment_t s) | ||
44 | { | ||
45 | if (s.is_user_space) | ||
46 | set_thread_flag(TIF_USERSPACE); | ||
47 | else | ||
48 | clear_thread_flag(TIF_USERSPACE); | ||
49 | } | ||
50 | |||
51 | /* | ||
52 | * Test whether a block of memory is a valid user space address. | ||
53 | * Returns 0 if the range is valid, nonzero otherwise. | ||
54 | * | ||
55 | * We do the following checks: | ||
56 | * 1. Is the access from kernel space? | ||
57 | * 2. Does (addr + size) set the carry bit? | ||
58 | * 3. Is (addr + size) a negative number (i.e. >= 0x80000000)? | ||
59 | * | ||
60 | * If yes on the first check, access is granted. | ||
61 | * If no on any of the others, access is denied. | ||
62 | */ | ||
63 | #define __range_ok(addr, size) \ | ||
64 | (test_thread_flag(TIF_USERSPACE) \ | ||
65 | && (((unsigned long)(addr) >= 0x80000000) \ | ||
66 | || ((unsigned long)(size) > 0x80000000) \ | ||
67 | || (((unsigned long)(addr) + (unsigned long)(size)) > 0x80000000))) | ||
68 | |||
69 | #define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0)) | ||
70 | |||
71 | static inline int | ||
72 | verify_area(int type, const void __user *addr, unsigned long size) | ||
73 | { | ||
74 | return access_ok(type, addr, size) ? 0 : -EFAULT; | ||
75 | } | ||
76 | |||
77 | /* Generic arbitrary sized copy. Return the number of bytes NOT copied */ | ||
78 | extern __kernel_size_t __copy_user(void *to, const void *from, | ||
79 | __kernel_size_t n); | ||
80 | |||
81 | extern __kernel_size_t copy_to_user(void __user *to, const void *from, | ||
82 | __kernel_size_t n); | ||
83 | extern __kernel_size_t copy_from_user(void *to, const void __user *from, | ||
84 | __kernel_size_t n); | ||
85 | |||
86 | static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, | ||
87 | __kernel_size_t n) | ||
88 | { | ||
89 | return __copy_user((void __force *)to, from, n); | ||
90 | } | ||
91 | static inline __kernel_size_t __copy_from_user(void *to, | ||
92 | const void __user *from, | ||
93 | __kernel_size_t n) | ||
94 | { | ||
95 | return __copy_user(to, (const void __force *)from, n); | ||
96 | } | ||
97 | |||
98 | #define __copy_to_user_inatomic __copy_to_user | ||
99 | #define __copy_from_user_inatomic __copy_from_user | ||
100 | |||
101 | /* | ||
102 | * put_user: - Write a simple value into user space. | ||
103 | * @x: Value to copy to user space. | ||
104 | * @ptr: Destination address, in user space. | ||
105 | * | ||
106 | * Context: User context only. This function may sleep. | ||
107 | * | ||
108 | * This macro copies a single simple value from kernel space to user | ||
109 | * space. It supports simple types like char and int, but not larger | ||
110 | * data types like structures or arrays. | ||
111 | * | ||
112 | * @ptr must have pointer-to-simple-variable type, and @x must be assignable | ||
113 | * to the result of dereferencing @ptr. | ||
114 | * | ||
115 | * Returns zero on success, or -EFAULT on error. | ||
116 | */ | ||
117 | #define put_user(x,ptr) \ | ||
118 | __put_user_check((x),(ptr),sizeof(*(ptr))) | ||
119 | |||
120 | /* | ||
121 | * get_user: - Get a simple variable from user space. | ||
122 | * @x: Variable to store result. | ||
123 | * @ptr: Source address, in user space. | ||
124 | * | ||
125 | * Context: User context only. This function may sleep. | ||
126 | * | ||
127 | * This macro copies a single simple variable from user space to kernel | ||
128 | * space. It supports simple types like char and int, but not larger | ||
129 | * data types like structures or arrays. | ||
130 | * | ||
131 | * @ptr must have pointer-to-simple-variable type, and the result of | ||
132 | * dereferencing @ptr must be assignable to @x without a cast. | ||
133 | * | ||
134 | * Returns zero on success, or -EFAULT on error. | ||
135 | * On error, the variable @x is set to zero. | ||
136 | */ | ||
137 | #define get_user(x,ptr) \ | ||
138 | __get_user_check((x),(ptr),sizeof(*(ptr))) | ||
139 | |||
140 | /* | ||
141 | * __put_user: - Write a simple value into user space, with less checking. | ||
142 | * @x: Value to copy to user space. | ||
143 | * @ptr: Destination address, in user space. | ||
144 | * | ||
145 | * Context: User context only. This function may sleep. | ||
146 | * | ||
147 | * This macro copies a single simple value from kernel space to user | ||
148 | * space. It supports simple types like char and int, but not larger | ||
149 | * data types like structures or arrays. | ||
150 | * | ||
151 | * @ptr must have pointer-to-simple-variable type, and @x must be assignable | ||
152 | * to the result of dereferencing @ptr. | ||
153 | * | ||
154 | * Caller must check the pointer with access_ok() before calling this | ||
155 | * function. | ||
156 | * | ||
157 | * Returns zero on success, or -EFAULT on error. | ||
158 | */ | ||
159 | #define __put_user(x,ptr) \ | ||
160 | __put_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
161 | |||
162 | /* | ||
163 | * __get_user: - Get a simple variable from user space, with less checking. | ||
164 | * @x: Variable to store result. | ||
165 | * @ptr: Source address, in user space. | ||
166 | * | ||
167 | * Context: User context only. This function may sleep. | ||
168 | * | ||
169 | * This macro copies a single simple variable from user space to kernel | ||
170 | * space. It supports simple types like char and int, but not larger | ||
171 | * data types like structures or arrays. | ||
172 | * | ||
173 | * @ptr must have pointer-to-simple-variable type, and the result of | ||
174 | * dereferencing @ptr must be assignable to @x without a cast. | ||
175 | * | ||
176 | * Caller must check the pointer with access_ok() before calling this | ||
177 | * function. | ||
178 | * | ||
179 | * Returns zero on success, or -EFAULT on error. | ||
180 | * On error, the variable @x is set to zero. | ||
181 | */ | ||
182 | #define __get_user(x,ptr) \ | ||
183 | __get_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
184 | |||
185 | extern int __get_user_bad(void); | ||
186 | extern int __put_user_bad(void); | ||
187 | |||
188 | #define __get_user_nocheck(x, ptr, size) \ | ||
189 | ({ \ | ||
190 | typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ | ||
191 | int __gu_err = 0; \ | ||
192 | \ | ||
193 | switch (size) { \ | ||
194 | case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \ | ||
195 | case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \ | ||
196 | case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \ | ||
197 | case 8: __get_user_asm("d", __gu_val, ptr, __gu_err); break; \ | ||
198 | default: __gu_err = __get_user_bad(); break; \ | ||
199 | } \ | ||
200 | \ | ||
201 | x = __gu_val; \ | ||
202 | __gu_err; \ | ||
203 | }) | ||
204 | |||
205 | #define __get_user_check(x, ptr, size) \ | ||
206 | ({ \ | ||
207 | typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ | ||
208 | const typeof(*(ptr)) __user * __gu_addr = (ptr); \ | ||
209 | int __gu_err = 0; \ | ||
210 | \ | ||
211 | if (access_ok(VERIFY_READ, __gu_addr, size)) { \ | ||
212 | switch (size) { \ | ||
213 | case 1: \ | ||
214 | __get_user_asm("ub", __gu_val, __gu_addr, \ | ||
215 | __gu_err); \ | ||
216 | break; \ | ||
217 | case 2: \ | ||
218 | __get_user_asm("uh", __gu_val, __gu_addr, \ | ||
219 | __gu_err); \ | ||
220 | break; \ | ||
221 | case 4: \ | ||
222 | __get_user_asm("w", __gu_val, __gu_addr, \ | ||
223 | __gu_err); \ | ||
224 | break; \ | ||
225 | case 8: \ | ||
226 | __get_user_asm("d", __gu_val, __gu_addr, \ | ||
227 | __gu_err); \ | ||
228 | break; \ | ||
229 | default: \ | ||
230 | __gu_err = __get_user_bad(); \ | ||
231 | break; \ | ||
232 | } \ | ||
233 | } else { \ | ||
234 | __gu_err = -EFAULT; \ | ||
235 | } \ | ||
236 | x = __gu_val; \ | ||
237 | __gu_err; \ | ||
238 | }) | ||
239 | |||
240 | #define __get_user_asm(suffix, __gu_val, ptr, __gu_err) \ | ||
241 | asm volatile( \ | ||
242 | "1: ld." suffix " %1, %3 \n" \ | ||
243 | "2: \n" \ | ||
244 | " .section .fixup, \"ax\" \n" \ | ||
245 | "3: mov %0, %4 \n" \ | ||
246 | " rjmp 2b \n" \ | ||
247 | " .previous \n" \ | ||
248 | " .section __ex_table, \"a\" \n" \ | ||
249 | " .long 1b, 3b \n" \ | ||
250 | " .previous \n" \ | ||
251 | : "=r"(__gu_err), "=r"(__gu_val) \ | ||
252 | : "0"(__gu_err), "m"(*(ptr)), "i"(-EFAULT)) | ||
253 | |||
254 | #define __put_user_nocheck(x, ptr, size) \ | ||
255 | ({ \ | ||
256 | typeof(*(ptr)) __pu_val; \ | ||
257 | int __pu_err = 0; \ | ||
258 | \ | ||
259 | __pu_val = (x); \ | ||
260 | switch (size) { \ | ||
261 | case 1: __put_user_asm("b", ptr, __pu_val, __pu_err); break; \ | ||
262 | case 2: __put_user_asm("h", ptr, __pu_val, __pu_err); break; \ | ||
263 | case 4: __put_user_asm("w", ptr, __pu_val, __pu_err); break; \ | ||
264 | case 8: __put_user_asm("d", ptr, __pu_val, __pu_err); break; \ | ||
265 | default: __pu_err = __put_user_bad(); break; \ | ||
266 | } \ | ||
267 | __pu_err; \ | ||
268 | }) | ||
269 | |||
270 | #define __put_user_check(x, ptr, size) \ | ||
271 | ({ \ | ||
272 | typeof(*(ptr)) __pu_val; \ | ||
273 | typeof(*(ptr)) __user *__pu_addr = (ptr); \ | ||
274 | int __pu_err = 0; \ | ||
275 | \ | ||
276 | __pu_val = (x); \ | ||
277 | if (access_ok(VERIFY_WRITE, __pu_addr, size)) { \ | ||
278 | switch (size) { \ | ||
279 | case 1: \ | ||
280 | __put_user_asm("b", __pu_addr, __pu_val, \ | ||
281 | __pu_err); \ | ||
282 | break; \ | ||
283 | case 2: \ | ||
284 | __put_user_asm("h", __pu_addr, __pu_val, \ | ||
285 | __pu_err); \ | ||
286 | break; \ | ||
287 | case 4: \ | ||
288 | __put_user_asm("w", __pu_addr, __pu_val, \ | ||
289 | __pu_err); \ | ||
290 | break; \ | ||
291 | case 8: \ | ||
292 | __put_user_asm("d", __pu_addr, __pu_val, \ | ||
293 | __pu_err); \ | ||
294 | break; \ | ||
295 | default: \ | ||
296 | __pu_err = __put_user_bad(); \ | ||
297 | break; \ | ||
298 | } \ | ||
299 | } else { \ | ||
300 | __pu_err = -EFAULT; \ | ||
301 | } \ | ||
302 | __pu_err; \ | ||
303 | }) | ||
304 | |||
305 | #define __put_user_asm(suffix, ptr, __pu_val, __gu_err) \ | ||
306 | asm volatile( \ | ||
307 | "1: st." suffix " %1, %3 \n" \ | ||
308 | "2: \n" \ | ||
309 | " .section .fixup, \"ax\" \n" \ | ||
310 | "3: mov %0, %4 \n" \ | ||
311 | " rjmp 2b \n" \ | ||
312 | " .previous \n" \ | ||
313 | " .section __ex_table, \"a\" \n" \ | ||
314 | " .long 1b, 3b \n" \ | ||
315 | " .previous \n" \ | ||
316 | : "=r"(__gu_err), "=m"(*(ptr)) \ | ||
317 | : "0"(__gu_err), "r"(__pu_val), "i"(-EFAULT)) | ||
318 | |||
319 | extern __kernel_size_t clear_user(void __user *addr, __kernel_size_t size); | ||
320 | extern __kernel_size_t __clear_user(void __user *addr, __kernel_size_t size); | ||
321 | |||
322 | extern long strncpy_from_user(char *dst, const char __user *src, long count); | ||
323 | extern long __strncpy_from_user(char *dst, const char __user *src, long count); | ||
324 | |||
325 | extern long strnlen_user(const char __user *__s, long __n); | ||
326 | extern long __strnlen_user(const char __user *__s, long __n); | ||
327 | |||
328 | #define strlen_user(s) strnlen_user(s, ~0UL >> 1) | ||
329 | |||
330 | struct exception_table_entry | ||
331 | { | ||
332 | unsigned long insn, fixup; | ||
333 | }; | ||
334 | |||
335 | #endif /* __ASM_AVR32_UACCESS_H */ | ||
diff --git a/include/asm-avr32/ucontext.h b/include/asm-avr32/ucontext.h new file mode 100644 index 000000000000..ac7259c2a799 --- /dev/null +++ b/include/asm-avr32/ucontext.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __ASM_AVR32_UCONTEXT_H | ||
2 | #define __ASM_AVR32_UCONTEXT_H | ||
3 | |||
4 | struct ucontext { | ||
5 | unsigned long uc_flags; | ||
6 | struct ucontext * uc_link; | ||
7 | stack_t uc_stack; | ||
8 | struct sigcontext uc_mcontext; | ||
9 | sigset_t uc_sigmask; | ||
10 | }; | ||
11 | |||
12 | #endif /* __ASM_AVR32_UCONTEXT_H */ | ||
diff --git a/include/asm-avr32/unaligned.h b/include/asm-avr32/unaligned.h new file mode 100644 index 000000000000..3042723fcbfd --- /dev/null +++ b/include/asm-avr32/unaligned.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __ASM_AVR32_UNALIGNED_H | ||
2 | #define __ASM_AVR32_UNALIGNED_H | ||
3 | |||
4 | /* | ||
5 | * AVR32 can handle some unaligned accesses, depending on the | ||
6 | * implementation. The AVR32 AP implementation can handle unaligned | ||
7 | * words, but halfwords must be halfword-aligned, and doublewords must | ||
8 | * be word-aligned. | ||
9 | * | ||
10 | * TODO: Make all this CPU-specific and optimize. | ||
11 | */ | ||
12 | |||
13 | #include <linux/string.h> | ||
14 | |||
15 | /* Use memmove here, so gcc does not insert a __builtin_memcpy. */ | ||
16 | |||
17 | #define get_unaligned(ptr) \ | ||
18 | ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) | ||
19 | |||
20 | #define put_unaligned(val, ptr) \ | ||
21 | ({ __typeof__(*(ptr)) __tmp = (val); \ | ||
22 | memmove((ptr), &__tmp, sizeof(*(ptr))); \ | ||
23 | (void)0; }) | ||
24 | |||
25 | #endif /* __ASM_AVR32_UNALIGNED_H */ | ||
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h new file mode 100644 index 000000000000..1f528f92690d --- /dev/null +++ b/include/asm-avr32/unistd.h | |||
@@ -0,0 +1,387 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_UNISTD_H | ||
9 | #define __ASM_AVR32_UNISTD_H | ||
10 | |||
11 | /* | ||
12 | * This file contains the system call numbers. | ||
13 | */ | ||
14 | |||
15 | #define __NR_restart_syscall 0 | ||
16 | #define __NR_exit 1 | ||
17 | #define __NR_fork 2 | ||
18 | #define __NR_read 3 | ||
19 | #define __NR_write 4 | ||
20 | #define __NR_open 5 | ||
21 | #define __NR_close 6 | ||
22 | #define __NR_umask 7 | ||
23 | #define __NR_creat 8 | ||
24 | #define __NR_link 9 | ||
25 | #define __NR_unlink 10 | ||
26 | #define __NR_execve 11 | ||
27 | #define __NR_chdir 12 | ||
28 | #define __NR_time 13 | ||
29 | #define __NR_mknod 14 | ||
30 | #define __NR_chmod 15 | ||
31 | #define __NR_chown 16 | ||
32 | #define __NR_lchown 17 | ||
33 | #define __NR_lseek 18 | ||
34 | #define __NR__llseek 19 | ||
35 | #define __NR_getpid 20 | ||
36 | #define __NR_mount 21 | ||
37 | #define __NR_umount2 22 | ||
38 | #define __NR_setuid 23 | ||
39 | #define __NR_getuid 24 | ||
40 | #define __NR_stime 25 | ||
41 | #define __NR_ptrace 26 | ||
42 | #define __NR_alarm 27 | ||
43 | #define __NR_pause 28 | ||
44 | #define __NR_utime 29 | ||
45 | #define __NR_stat 30 | ||
46 | #define __NR_fstat 31 | ||
47 | #define __NR_lstat 32 | ||
48 | #define __NR_access 33 | ||
49 | #define __NR_chroot 34 | ||
50 | #define __NR_sync 35 | ||
51 | #define __NR_fsync 36 | ||
52 | #define __NR_kill 37 | ||
53 | #define __NR_rename 38 | ||
54 | #define __NR_mkdir 39 | ||
55 | #define __NR_rmdir 40 | ||
56 | #define __NR_dup 41 | ||
57 | #define __NR_pipe 42 | ||
58 | #define __NR_times 43 | ||
59 | #define __NR_clone 44 | ||
60 | #define __NR_brk 45 | ||
61 | #define __NR_setgid 46 | ||
62 | #define __NR_getgid 47 | ||
63 | #define __NR_getcwd 48 | ||
64 | #define __NR_geteuid 49 | ||
65 | #define __NR_getegid 50 | ||
66 | #define __NR_acct 51 | ||
67 | #define __NR_setfsuid 52 | ||
68 | #define __NR_setfsgid 53 | ||
69 | #define __NR_ioctl 54 | ||
70 | #define __NR_fcntl 55 | ||
71 | #define __NR_setpgid 56 | ||
72 | #define __NR_mremap 57 | ||
73 | #define __NR_setresuid 58 | ||
74 | #define __NR_getresuid 59 | ||
75 | #define __NR_setreuid 60 | ||
76 | #define __NR_setregid 61 | ||
77 | #define __NR_ustat 62 | ||
78 | #define __NR_dup2 63 | ||
79 | #define __NR_getppid 64 | ||
80 | #define __NR_getpgrp 65 | ||
81 | #define __NR_setsid 66 | ||
82 | #define __NR_rt_sigaction 67 | ||
83 | #define __NR_rt_sigreturn 68 | ||
84 | #define __NR_rt_sigprocmask 69 | ||
85 | #define __NR_rt_sigpending 70 | ||
86 | #define __NR_rt_sigtimedwait 71 | ||
87 | #define __NR_rt_sigqueueinfo 72 | ||
88 | #define __NR_rt_sigsuspend 73 | ||
89 | #define __NR_sethostname 74 | ||
90 | #define __NR_setrlimit 75 | ||
91 | #define __NR_getrlimit 76 /* SuS compliant getrlimit */ | ||
92 | #define __NR_getrusage 77 | ||
93 | #define __NR_gettimeofday 78 | ||
94 | #define __NR_settimeofday 79 | ||
95 | #define __NR_getgroups 80 | ||
96 | #define __NR_setgroups 81 | ||
97 | #define __NR_select 82 | ||
98 | #define __NR_symlink 83 | ||
99 | #define __NR_fchdir 84 | ||
100 | #define __NR_readlink 85 | ||
101 | #define __NR_pread 86 | ||
102 | #define __NR_pwrite 87 | ||
103 | #define __NR_swapon 88 | ||
104 | #define __NR_reboot 89 | ||
105 | #define __NR_mmap2 90 | ||
106 | #define __NR_munmap 91 | ||
107 | #define __NR_truncate 92 | ||
108 | #define __NR_ftruncate 93 | ||
109 | #define __NR_fchmod 94 | ||
110 | #define __NR_fchown 95 | ||
111 | #define __NR_getpriority 96 | ||
112 | #define __NR_setpriority 97 | ||
113 | #define __NR_wait4 98 | ||
114 | #define __NR_statfs 99 | ||
115 | #define __NR_fstatfs 100 | ||
116 | #define __NR_vhangup 101 | ||
117 | #define __NR_sigaltstack 102 | ||
118 | #define __NR_syslog 103 | ||
119 | #define __NR_setitimer 104 | ||
120 | #define __NR_getitimer 105 | ||
121 | #define __NR_swapoff 106 | ||
122 | #define __NR_sysinfo 107 | ||
123 | #define __NR_ipc 108 | ||
124 | #define __NR_sendfile 109 | ||
125 | #define __NR_setdomainname 110 | ||
126 | #define __NR_uname 111 | ||
127 | #define __NR_adjtimex 112 | ||
128 | #define __NR_mprotect 113 | ||
129 | #define __NR_vfork 114 | ||
130 | #define __NR_init_module 115 | ||
131 | #define __NR_delete_module 116 | ||
132 | #define __NR_quotactl 117 | ||
133 | #define __NR_getpgid 118 | ||
134 | #define __NR_bdflush 119 | ||
135 | #define __NR_sysfs 120 | ||
136 | #define __NR_personality 121 | ||
137 | #define __NR_afs_syscall 122 /* Syscall for Andrew File System */ | ||
138 | #define __NR_getdents 123 | ||
139 | #define __NR_flock 124 | ||
140 | #define __NR_msync 125 | ||
141 | #define __NR_readv 126 | ||
142 | #define __NR_writev 127 | ||
143 | #define __NR_getsid 128 | ||
144 | #define __NR_fdatasync 129 | ||
145 | #define __NR__sysctl 130 | ||
146 | #define __NR_mlock 131 | ||
147 | #define __NR_munlock 132 | ||
148 | #define __NR_mlockall 133 | ||
149 | #define __NR_munlockall 134 | ||
150 | #define __NR_sched_setparam 135 | ||
151 | #define __NR_sched_getparam 136 | ||
152 | #define __NR_sched_setscheduler 137 | ||
153 | #define __NR_sched_getscheduler 138 | ||
154 | #define __NR_sched_yield 139 | ||
155 | #define __NR_sched_get_priority_max 140 | ||
156 | #define __NR_sched_get_priority_min 141 | ||
157 | #define __NR_sched_rr_get_interval 142 | ||
158 | #define __NR_nanosleep 143 | ||
159 | #define __NR_poll 144 | ||
160 | #define __NR_nfsservctl 145 | ||
161 | #define __NR_setresgid 146 | ||
162 | #define __NR_getresgid 147 | ||
163 | #define __NR_prctl 148 | ||
164 | #define __NR_socket 149 | ||
165 | #define __NR_bind 150 | ||
166 | #define __NR_connect 151 | ||
167 | #define __NR_listen 152 | ||
168 | #define __NR_accept 153 | ||
169 | #define __NR_getsockname 154 | ||
170 | #define __NR_getpeername 155 | ||
171 | #define __NR_socketpair 156 | ||
172 | #define __NR_send 157 | ||
173 | #define __NR_recv 158 | ||
174 | #define __NR_sendto 159 | ||
175 | #define __NR_recvfrom 160 | ||
176 | #define __NR_shutdown 161 | ||
177 | #define __NR_setsockopt 162 | ||
178 | #define __NR_getsockopt 163 | ||
179 | #define __NR_sendmsg 164 | ||
180 | #define __NR_recvmsg 165 | ||
181 | #define __NR_truncate64 166 | ||
182 | #define __NR_ftruncate64 167 | ||
183 | #define __NR_stat64 168 | ||
184 | #define __NR_lstat64 169 | ||
185 | #define __NR_fstat64 170 | ||
186 | #define __NR_pivot_root 171 | ||
187 | #define __NR_mincore 172 | ||
188 | #define __NR_madvise 173 | ||
189 | #define __NR_getdents64 174 | ||
190 | #define __NR_fcntl64 175 | ||
191 | #define __NR_gettid 176 | ||
192 | #define __NR_readahead 177 | ||
193 | #define __NR_setxattr 178 | ||
194 | #define __NR_lsetxattr 179 | ||
195 | #define __NR_fsetxattr 180 | ||
196 | #define __NR_getxattr 181 | ||
197 | #define __NR_lgetxattr 182 | ||
198 | #define __NR_fgetxattr 183 | ||
199 | #define __NR_listxattr 184 | ||
200 | #define __NR_llistxattr 185 | ||
201 | #define __NR_flistxattr 186 | ||
202 | #define __NR_removexattr 187 | ||
203 | #define __NR_lremovexattr 188 | ||
204 | #define __NR_fremovexattr 189 | ||
205 | #define __NR_tkill 190 | ||
206 | #define __NR_sendfile64 191 | ||
207 | #define __NR_futex 192 | ||
208 | #define __NR_sched_setaffinity 193 | ||
209 | #define __NR_sched_getaffinity 194 | ||
210 | #define __NR_capget 195 | ||
211 | #define __NR_capset 196 | ||
212 | #define __NR_io_setup 197 | ||
213 | #define __NR_io_destroy 198 | ||
214 | #define __NR_io_getevents 199 | ||
215 | #define __NR_io_submit 200 | ||
216 | #define __NR_io_cancel 201 | ||
217 | #define __NR_fadvise64 202 | ||
218 | #define __NR_exit_group 203 | ||
219 | #define __NR_lookup_dcookie 204 | ||
220 | #define __NR_epoll_create 205 | ||
221 | #define __NR_epoll_ctl 206 | ||
222 | #define __NR_epoll_wait 207 | ||
223 | #define __NR_remap_file_pages 208 | ||
224 | #define __NR_set_tid_address 209 | ||
225 | |||
226 | #define __NR_timer_create 210 | ||
227 | #define __NR_timer_settime 211 | ||
228 | #define __NR_timer_gettime 212 | ||
229 | #define __NR_timer_getoverrun 213 | ||
230 | #define __NR_timer_delete 214 | ||
231 | #define __NR_clock_settime 215 | ||
232 | #define __NR_clock_gettime 216 | ||
233 | #define __NR_clock_getres 217 | ||
234 | #define __NR_clock_nanosleep 218 | ||
235 | #define __NR_statfs64 219 | ||
236 | #define __NR_fstatfs64 220 | ||
237 | #define __NR_tgkill 221 | ||
238 | /* 222 reserved for tux */ | ||
239 | #define __NR_utimes 223 | ||
240 | #define __NR_fadvise64_64 224 | ||
241 | |||
242 | #define __NR_cacheflush 225 | ||
243 | |||
244 | #define __NR_vserver 226 | ||
245 | #define __NR_mq_open 227 | ||
246 | #define __NR_mq_unlink 228 | ||
247 | #define __NR_mq_timedsend 229 | ||
248 | #define __NR_mq_timedreceive 230 | ||
249 | #define __NR_mq_notify 231 | ||
250 | #define __NR_mq_getsetattr 232 | ||
251 | #define __NR_kexec_load 233 | ||
252 | #define __NR_waitid 234 | ||
253 | #define __NR_add_key 235 | ||
254 | #define __NR_request_key 236 | ||
255 | #define __NR_keyctl 237 | ||
256 | #define __NR_ioprio_set 238 | ||
257 | #define __NR_ioprio_get 239 | ||
258 | #define __NR_inotify_init 240 | ||
259 | #define __NR_inotify_add_watch 241 | ||
260 | #define __NR_inotify_rm_watch 242 | ||
261 | #define __NR_openat 243 | ||
262 | #define __NR_mkdirat 244 | ||
263 | #define __NR_mknodat 245 | ||
264 | #define __NR_fchownat 246 | ||
265 | #define __NR_futimesat 247 | ||
266 | #define __NR_fstatat64 248 | ||
267 | #define __NR_unlinkat 249 | ||
268 | #define __NR_renameat 250 | ||
269 | #define __NR_linkat 251 | ||
270 | #define __NR_symlinkat 252 | ||
271 | #define __NR_readlinkat 253 | ||
272 | #define __NR_fchmodat 254 | ||
273 | #define __NR_faccessat 255 | ||
274 | #define __NR_pselect6 256 | ||
275 | #define __NR_ppoll 257 | ||
276 | #define __NR_unshare 258 | ||
277 | #define __NR_set_robust_list 259 | ||
278 | #define __NR_get_robust_list 260 | ||
279 | #define __NR_splice 261 | ||
280 | #define __NR_sync_file_range 262 | ||
281 | #define __NR_tee 263 | ||
282 | #define __NR_vmsplice 264 | ||
283 | |||
284 | #define NR_syscalls 265 | ||
285 | |||
286 | |||
287 | /* | ||
288 | * AVR32 calling convention for system calls: | ||
289 | * - System call number in r8 | ||
290 | * - Parameters in r12 and downwards to r9 as well as r6 and r5. | ||
291 | * - Return value in r12 | ||
292 | */ | ||
293 | |||
294 | /* | ||
295 | * user-visible error numbers are in the range -1 - -124: see | ||
296 | * <asm-generic/errno.h> | ||
297 | */ | ||
298 | |||
299 | #define __syscall_return(type, res) do { \ | ||
300 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | ||
301 | errno = -(res); \ | ||
302 | res = -1; \ | ||
303 | } \ | ||
304 | return (type) (res); \ | ||
305 | } while (0) | ||
306 | |||
307 | #ifdef __KERNEL__ | ||
308 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
309 | #define __ARCH_WANT_STAT64 | ||
310 | #define __ARCH_WANT_SYS_ALARM | ||
311 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
312 | #define __ARCH_WANT_SYS_PAUSE | ||
313 | #define __ARCH_WANT_SYS_TIME | ||
314 | #define __ARCH_WANT_SYS_UTIME | ||
315 | #define __ARCH_WANT_SYS_WAITPID | ||
316 | #define __ARCH_WANT_SYS_FADVISE64 | ||
317 | #define __ARCH_WANT_SYS_GETPGRP | ||
318 | #define __ARCH_WANT_SYS_LLSEEK | ||
319 | #define __ARCH_WANT_SYS_GETPGRP | ||
320 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
321 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
322 | #endif | ||
323 | |||
324 | #if defined(__KERNEL_SYSCALLS__) || defined(__CHECKER__) | ||
325 | |||
326 | #include <linux/types.h> | ||
327 | #include <linux/linkage.h> | ||
328 | #include <asm/signal.h> | ||
329 | |||
330 | struct pt_regs; | ||
331 | |||
332 | /* | ||
333 | * we need this inline - forking from kernel space will result | ||
334 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
335 | * is no problem, but for the stack. This is handled by not letting | ||
336 | * main() use the stack at all after fork(). Thus, no function | ||
337 | * calls - which means inline code for fork too, as otherwise we | ||
338 | * would use the stack upon exit from 'fork()'. | ||
339 | * | ||
340 | * Actually only pause and fork are needed inline, so that there | ||
341 | * won't be any messing with the stack from main(), but we define | ||
342 | * some others too. | ||
343 | */ | ||
344 | static inline int execve(const char *file, char **argv, char **envp) | ||
345 | { | ||
346 | register long scno asm("r8") = __NR_execve; | ||
347 | register long sc1 asm("r12") = (long)file; | ||
348 | register long sc2 asm("r11") = (long)argv; | ||
349 | register long sc3 asm("r10") = (long)envp; | ||
350 | int res; | ||
351 | |||
352 | asm volatile("scall" | ||
353 | : "=r"(sc1) | ||
354 | : "r"(scno), "0"(sc1), "r"(sc2), "r"(sc3) | ||
355 | : "lr", "memory"); | ||
356 | res = sc1; | ||
357 | __syscall_return(int, res); | ||
358 | } | ||
359 | |||
360 | asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize); | ||
361 | asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | ||
362 | struct pt_regs *regs); | ||
363 | asmlinkage int sys_rt_sigreturn(struct pt_regs *regs); | ||
364 | asmlinkage int sys_pipe(unsigned long __user *filedes); | ||
365 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | ||
366 | unsigned long prot, unsigned long flags, | ||
367 | unsigned long fd, off_t offset); | ||
368 | asmlinkage int sys_cacheflush(int operation, void __user *addr, size_t len); | ||
369 | asmlinkage int sys_fork(struct pt_regs *regs); | ||
370 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
371 | unsigned long parent_tidptr, | ||
372 | unsigned long child_tidptr, struct pt_regs *regs); | ||
373 | asmlinkage int sys_vfork(struct pt_regs *regs); | ||
374 | asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv, | ||
375 | char __user *__user *uenvp, struct pt_regs *regs); | ||
376 | |||
377 | #endif | ||
378 | |||
379 | /* | ||
380 | * "Conditional" syscalls | ||
381 | * | ||
382 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
383 | * but it doesn't work on all toolchains, so we just do it by hand | ||
384 | */ | ||
385 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); | ||
386 | |||
387 | #endif /* __ASM_AVR32_UNISTD_H */ | ||
diff --git a/include/asm-avr32/user.h b/include/asm-avr32/user.h new file mode 100644 index 000000000000..060fb3acee49 --- /dev/null +++ b/include/asm-avr32/user.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Note: We may not need these definitions for AVR32, as we don't | ||
9 | * support a.out. | ||
10 | */ | ||
11 | #ifndef __ASM_AVR32_USER_H | ||
12 | #define __ASM_AVR32_USER_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <asm/ptrace.h> | ||
16 | #include <asm/page.h> | ||
17 | |||
18 | /* | ||
19 | * Core file format: The core file is written in such a way that gdb | ||
20 | * can understand it and provide useful information to the user (under | ||
21 | * linux we use the `trad-core' bfd). The file contents are as follows: | ||
22 | * | ||
23 | * upage: 1 page consisting of a user struct that tells gdb | ||
24 | * what is present in the file. Directly after this is a | ||
25 | * copy of the task_struct, which is currently not used by gdb, | ||
26 | * but it may come in handy at some point. All of the registers | ||
27 | * are stored as part of the upage. The upage should always be | ||
28 | * only one page long. | ||
29 | * data: The data segment follows next. We use current->end_text to | ||
30 | * current->brk to pick up all of the user variables, plus any memory | ||
31 | * that may have been sbrk'ed. No attempt is made to determine if a | ||
32 | * page is demand-zero or if a page is totally unused, we just cover | ||
33 | * the entire range. All of the addresses are rounded in such a way | ||
34 | * that an integral number of pages is written. | ||
35 | * stack: We need the stack information in order to get a meaningful | ||
36 | * backtrace. We need to write the data from usp to | ||
37 | * current->start_stack, so we round each of these in order to be able | ||
38 | * to write an integer number of pages. | ||
39 | */ | ||
40 | |||
41 | struct user_fpu_struct { | ||
42 | /* We have no FPU (yet) */ | ||
43 | }; | ||
44 | |||
45 | struct user { | ||
46 | struct pt_regs regs; /* entire machine state */ | ||
47 | size_t u_tsize; /* text size (pages) */ | ||
48 | size_t u_dsize; /* data size (pages) */ | ||
49 | size_t u_ssize; /* stack size (pages) */ | ||
50 | unsigned long start_code; /* text starting address */ | ||
51 | unsigned long start_data; /* data starting address */ | ||
52 | unsigned long start_stack; /* stack starting address */ | ||
53 | long int signal; /* signal causing core dump */ | ||
54 | struct regs * u_ar0; /* help gdb find registers */ | ||
55 | unsigned long magic; /* identifies a core file */ | ||
56 | char u_comm[32]; /* user command name */ | ||
57 | }; | ||
58 | |||
59 | #define NBPG PAGE_SIZE | ||
60 | #define UPAGES 1 | ||
61 | #define HOST_TEXT_START_ADDR (u.start_code) | ||
62 | #define HOST_DATA_START_ADDR (u.start_data) | ||
63 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | ||
64 | |||
65 | #endif /* __ASM_AVR32_USER_H */ | ||
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h index 5d76c1c0d6c9..c94a7107019c 100644 --- a/include/asm-cris/pgtable.h +++ b/include/asm-cris/pgtable.h | |||
@@ -253,7 +253,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
253 | { pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } | 253 | { pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } |
254 | 254 | ||
255 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 255 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
256 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 256 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
257 | 257 | ||
258 | /* to find an entry in a page-table-directory. */ | 258 | /* to find an entry in a page-table-directory. */ |
259 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 259 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
@@ -271,7 +271,7 @@ static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) | |||
271 | #define __pte_offset(address) \ | 271 | #define __pte_offset(address) \ |
272 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 272 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
273 | #define pte_offset_kernel(dir, address) \ | 273 | #define pte_offset_kernel(dir, address) \ |
274 | ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) | 274 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) |
275 | #define pte_offset_map(dir, address) \ | 275 | #define pte_offset_map(dir, address) \ |
276 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | 276 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
277 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | 277 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) |
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index 980ae1b0cd28..1f70d47148bd 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h | |||
@@ -157,23 +157,105 @@ static inline int __test_bit(int nr, const volatile void * addr) | |||
157 | __constant_test_bit((nr),(addr)) : \ | 157 | __constant_test_bit((nr),(addr)) : \ |
158 | __test_bit((nr),(addr))) | 158 | __test_bit((nr),(addr))) |
159 | 159 | ||
160 | #include <asm-generic/bitops/ffs.h> | ||
161 | #include <asm-generic/bitops/__ffs.h> | ||
162 | #include <asm-generic/bitops/find.h> | 160 | #include <asm-generic/bitops/find.h> |
163 | 161 | ||
164 | /* | 162 | /** |
165 | * fls: find last bit set. | 163 | * fls - find last bit set |
164 | * @x: the word to search | ||
165 | * | ||
166 | * This is defined the same way as ffs: | ||
167 | * - return 32..1 to indicate bit 31..0 most significant bit set | ||
168 | * - return 0 to indicate no bits set | ||
166 | */ | 169 | */ |
167 | #define fls(x) \ | 170 | #define fls(x) \ |
168 | ({ \ | 171 | ({ \ |
169 | int bit; \ | 172 | int bit; \ |
170 | \ | 173 | \ |
171 | asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x)); \ | 174 | asm(" subcc %1,gr0,gr0,icc0 \n" \ |
175 | " ckne icc0,cc4 \n" \ | ||
176 | " cscan.p %1,gr0,%0 ,cc4,#1 \n" \ | ||
177 | " csub %0,%0,%0 ,cc4,#0 \n" \ | ||
178 | " csub %2,%0,%0 ,cc4,#1 \n" \ | ||
179 | : "=&r"(bit) \ | ||
180 | : "r"(x), "r"(32) \ | ||
181 | : "icc0", "cc4" \ | ||
182 | ); \ | ||
172 | \ | 183 | \ |
173 | bit ? 33 - bit : bit; \ | 184 | bit; \ |
174 | }) | 185 | }) |
175 | 186 | ||
176 | #include <asm-generic/bitops/fls64.h> | 187 | /** |
188 | * fls64 - find last bit set in a 64-bit value | ||
189 | * @n: the value to search | ||
190 | * | ||
191 | * This is defined the same way as ffs: | ||
192 | * - return 64..1 to indicate bit 63..0 most significant bit set | ||
193 | * - return 0 to indicate no bits set | ||
194 | */ | ||
195 | static inline __attribute__((const)) | ||
196 | int fls64(u64 n) | ||
197 | { | ||
198 | union { | ||
199 | u64 ll; | ||
200 | struct { u32 h, l; }; | ||
201 | } _; | ||
202 | int bit, x, y; | ||
203 | |||
204 | _.ll = n; | ||
205 | |||
206 | asm(" subcc.p %3,gr0,gr0,icc0 \n" | ||
207 | " subcc %4,gr0,gr0,icc1 \n" | ||
208 | " ckne icc0,cc4 \n" | ||
209 | " ckne icc1,cc5 \n" | ||
210 | " norcr cc4,cc5,cc6 \n" | ||
211 | " csub.p %0,%0,%0 ,cc6,1 \n" | ||
212 | " orcr cc5,cc4,cc4 \n" | ||
213 | " andcr cc4,cc5,cc4 \n" | ||
214 | " cscan.p %3,gr0,%0 ,cc4,0 \n" | ||
215 | " setlos #64,%1 \n" | ||
216 | " cscan.p %4,gr0,%0 ,cc4,1 \n" | ||
217 | " setlos #32,%2 \n" | ||
218 | " csub.p %1,%0,%0 ,cc4,0 \n" | ||
219 | " csub %2,%0,%0 ,cc4,1 \n" | ||
220 | : "=&r"(bit), "=r"(x), "=r"(y) | ||
221 | : "0r"(_.h), "r"(_.l) | ||
222 | : "icc0", "icc1", "cc4", "cc5", "cc6" | ||
223 | ); | ||
224 | return bit; | ||
225 | |||
226 | } | ||
227 | |||
228 | /** | ||
229 | * ffs - find first bit set | ||
230 | * @x: the word to search | ||
231 | * | ||
232 | * - return 32..1 to indicate bit 31..0 most least significant bit set | ||
233 | * - return 0 to indicate no bits set | ||
234 | */ | ||
235 | static inline __attribute__((const)) | ||
236 | int ffs(int x) | ||
237 | { | ||
238 | /* Note: (x & -x) gives us a mask that is the least significant | ||
239 | * (rightmost) 1-bit of the value in x. | ||
240 | */ | ||
241 | return fls(x & -x); | ||
242 | } | ||
243 | |||
244 | /** | ||
245 | * __ffs - find first bit set | ||
246 | * @x: the word to search | ||
247 | * | ||
248 | * - return 31..0 to indicate bit 31..0 most least significant bit set | ||
249 | * - if no bits are set in x, the result is undefined | ||
250 | */ | ||
251 | static inline __attribute__((const)) | ||
252 | int __ffs(unsigned long x) | ||
253 | { | ||
254 | int bit; | ||
255 | asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x & -x)); | ||
256 | return 31 - bit; | ||
257 | } | ||
258 | |||
177 | #include <asm-generic/bitops/sched.h> | 259 | #include <asm-generic/bitops/sched.h> |
178 | #include <asm-generic/bitops/hweight.h> | 260 | #include <asm-generic/bitops/hweight.h> |
179 | 261 | ||
diff --git a/include/asm-frv/cpu-irqs.h b/include/asm-frv/cpu-irqs.h index 5cd691e1f8c4..478f3498fcfe 100644 --- a/include/asm-frv/cpu-irqs.h +++ b/include/asm-frv/cpu-irqs.h | |||
@@ -14,36 +14,6 @@ | |||
14 | 14 | ||
15 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
16 | 16 | ||
17 | #include <asm/irq-routing.h> | ||
18 | |||
19 | #define IRQ_BASE_CPU (NR_IRQ_ACTIONS_PER_GROUP * 0) | ||
20 | |||
21 | /* IRQ IDs presented to drivers */ | ||
22 | enum { | ||
23 | IRQ_CPU__UNUSED = IRQ_BASE_CPU, | ||
24 | IRQ_CPU_UART0, | ||
25 | IRQ_CPU_UART1, | ||
26 | IRQ_CPU_TIMER0, | ||
27 | IRQ_CPU_TIMER1, | ||
28 | IRQ_CPU_TIMER2, | ||
29 | IRQ_CPU_DMA0, | ||
30 | IRQ_CPU_DMA1, | ||
31 | IRQ_CPU_DMA2, | ||
32 | IRQ_CPU_DMA3, | ||
33 | IRQ_CPU_DMA4, | ||
34 | IRQ_CPU_DMA5, | ||
35 | IRQ_CPU_DMA6, | ||
36 | IRQ_CPU_DMA7, | ||
37 | IRQ_CPU_EXTERNAL0, | ||
38 | IRQ_CPU_EXTERNAL1, | ||
39 | IRQ_CPU_EXTERNAL2, | ||
40 | IRQ_CPU_EXTERNAL3, | ||
41 | IRQ_CPU_EXTERNAL4, | ||
42 | IRQ_CPU_EXTERNAL5, | ||
43 | IRQ_CPU_EXTERNAL6, | ||
44 | IRQ_CPU_EXTERNAL7, | ||
45 | }; | ||
46 | |||
47 | /* IRQ to level mappings */ | 17 | /* IRQ to level mappings */ |
48 | #define IRQ_GDBSTUB_LEVEL 15 | 18 | #define IRQ_GDBSTUB_LEVEL 15 |
49 | #define IRQ_UART_LEVEL 13 | 19 | #define IRQ_UART_LEVEL 13 |
@@ -82,6 +52,30 @@ enum { | |||
82 | #define IRQ_XIRQ6_LEVEL 7 | 52 | #define IRQ_XIRQ6_LEVEL 7 |
83 | #define IRQ_XIRQ7_LEVEL 8 | 53 | #define IRQ_XIRQ7_LEVEL 8 |
84 | 54 | ||
55 | /* IRQ IDs presented to drivers */ | ||
56 | #define IRQ_CPU__UNUSED IRQ_BASE_CPU | ||
57 | #define IRQ_CPU_UART0 (IRQ_BASE_CPU + IRQ_UART0_LEVEL) | ||
58 | #define IRQ_CPU_UART1 (IRQ_BASE_CPU + IRQ_UART1_LEVEL) | ||
59 | #define IRQ_CPU_TIMER0 (IRQ_BASE_CPU + IRQ_TIMER0_LEVEL) | ||
60 | #define IRQ_CPU_TIMER1 (IRQ_BASE_CPU + IRQ_TIMER1_LEVEL) | ||
61 | #define IRQ_CPU_TIMER2 (IRQ_BASE_CPU + IRQ_TIMER2_LEVEL) | ||
62 | #define IRQ_CPU_DMA0 (IRQ_BASE_CPU + IRQ_DMA0_LEVEL) | ||
63 | #define IRQ_CPU_DMA1 (IRQ_BASE_CPU + IRQ_DMA1_LEVEL) | ||
64 | #define IRQ_CPU_DMA2 (IRQ_BASE_CPU + IRQ_DMA2_LEVEL) | ||
65 | #define IRQ_CPU_DMA3 (IRQ_BASE_CPU + IRQ_DMA3_LEVEL) | ||
66 | #define IRQ_CPU_DMA4 (IRQ_BASE_CPU + IRQ_DMA4_LEVEL) | ||
67 | #define IRQ_CPU_DMA5 (IRQ_BASE_CPU + IRQ_DMA5_LEVEL) | ||
68 | #define IRQ_CPU_DMA6 (IRQ_BASE_CPU + IRQ_DMA6_LEVEL) | ||
69 | #define IRQ_CPU_DMA7 (IRQ_BASE_CPU + IRQ_DMA7_LEVEL) | ||
70 | #define IRQ_CPU_EXTERNAL0 (IRQ_BASE_CPU + IRQ_XIRQ0_LEVEL) | ||
71 | #define IRQ_CPU_EXTERNAL1 (IRQ_BASE_CPU + IRQ_XIRQ1_LEVEL) | ||
72 | #define IRQ_CPU_EXTERNAL2 (IRQ_BASE_CPU + IRQ_XIRQ2_LEVEL) | ||
73 | #define IRQ_CPU_EXTERNAL3 (IRQ_BASE_CPU + IRQ_XIRQ3_LEVEL) | ||
74 | #define IRQ_CPU_EXTERNAL4 (IRQ_BASE_CPU + IRQ_XIRQ4_LEVEL) | ||
75 | #define IRQ_CPU_EXTERNAL5 (IRQ_BASE_CPU + IRQ_XIRQ5_LEVEL) | ||
76 | #define IRQ_CPU_EXTERNAL6 (IRQ_BASE_CPU + IRQ_XIRQ6_LEVEL) | ||
77 | #define IRQ_CPU_EXTERNAL7 (IRQ_BASE_CPU + IRQ_XIRQ7_LEVEL) | ||
78 | |||
85 | #endif /* !__ASSEMBLY__ */ | 79 | #endif /* !__ASSEMBLY__ */ |
86 | 80 | ||
87 | #endif /* _ASM_CPU_IRQS_H */ | 81 | #endif /* _ASM_CPU_IRQS_H */ |
diff --git a/include/asm-frv/hardirq.h b/include/asm-frv/hardirq.h index 7581b5a7559a..fc47515822a2 100644 --- a/include/asm-frv/hardirq.h +++ b/include/asm-frv/hardirq.h | |||
@@ -26,5 +26,10 @@ typedef struct { | |||
26 | #error SMP not available on FR-V | 26 | #error SMP not available on FR-V |
27 | #endif /* CONFIG_SMP */ | 27 | #endif /* CONFIG_SMP */ |
28 | 28 | ||
29 | extern atomic_t irq_err_count; | ||
30 | static inline void ack_bad_irq(int irq) | ||
31 | { | ||
32 | atomic_inc(&irq_err_count); | ||
33 | } | ||
29 | 34 | ||
30 | #endif | 35 | #endif |
diff --git a/include/asm-frv/irq-routing.h b/include/asm-frv/irq-routing.h deleted file mode 100644 index ac3ab900a1dc..000000000000 --- a/include/asm-frv/irq-routing.h +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* irq-routing.h: multiplexed IRQ routing | ||
2 | * | ||
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_IRQ_ROUTING_H | ||
13 | #define _ASM_IRQ_ROUTING_H | ||
14 | |||
15 | #ifndef __ASSEMBLY__ | ||
16 | |||
17 | #include <linux/spinlock.h> | ||
18 | #include <asm/irq.h> | ||
19 | |||
20 | struct irq_source; | ||
21 | struct irq_level; | ||
22 | |||
23 | /* | ||
24 | * IRQ action distribution sets | ||
25 | */ | ||
26 | struct irq_group { | ||
27 | int first_irq; /* first IRQ distributed here */ | ||
28 | void (*control)(struct irq_group *group, int index, int on); | ||
29 | |||
30 | struct irqaction *actions[NR_IRQ_ACTIONS_PER_GROUP]; /* IRQ action chains */ | ||
31 | struct irq_source *sources[NR_IRQ_ACTIONS_PER_GROUP]; /* IRQ sources */ | ||
32 | int disable_cnt[NR_IRQ_ACTIONS_PER_GROUP]; /* disable counts */ | ||
33 | }; | ||
34 | |||
35 | /* | ||
36 | * IRQ source manager | ||
37 | */ | ||
38 | struct irq_source { | ||
39 | struct irq_source *next; | ||
40 | struct irq_level *level; | ||
41 | const char *muxname; | ||
42 | volatile void __iomem *muxdata; | ||
43 | unsigned long irqmask; | ||
44 | |||
45 | void (*doirq)(struct irq_source *source); | ||
46 | }; | ||
47 | |||
48 | /* | ||
49 | * IRQ level management (per CPU IRQ priority / entry vector) | ||
50 | */ | ||
51 | struct irq_level { | ||
52 | int usage; | ||
53 | int disable_count; | ||
54 | unsigned long flags; /* current IRQF_DISABLED and IRQF_SHARED settings */ | ||
55 | spinlock_t lock; | ||
56 | struct irq_source *sources; | ||
57 | }; | ||
58 | |||
59 | extern struct irq_level frv_irq_levels[16]; | ||
60 | extern struct irq_group *irq_groups[NR_IRQ_GROUPS]; | ||
61 | |||
62 | extern void frv_irq_route(struct irq_source *source, int irqlevel); | ||
63 | extern void frv_irq_route_external(struct irq_source *source, int irq); | ||
64 | extern void frv_irq_set_group(struct irq_group *group); | ||
65 | extern void distribute_irqs(struct irq_group *group, unsigned long irqmask); | ||
66 | extern void route_cpu_irqs(void); | ||
67 | |||
68 | #endif /* !__ASSEMBLY__ */ | ||
69 | |||
70 | #endif /* _ASM_IRQ_ROUTING_H */ | ||
diff --git a/include/asm-frv/irq.h b/include/asm-frv/irq.h index 58b619215a50..8fefd6b827aa 100644 --- a/include/asm-frv/irq.h +++ b/include/asm-frv/irq.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* irq.h: FRV IRQ definitions | 1 | /* irq.h: FRV IRQ definitions |
2 | * | 2 | * |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -12,32 +12,22 @@ | |||
12 | #ifndef _ASM_IRQ_H_ | 12 | #ifndef _ASM_IRQ_H_ |
13 | #define _ASM_IRQ_H_ | 13 | #define _ASM_IRQ_H_ |
14 | 14 | ||
15 | |||
16 | /* | ||
17 | * the system has an on-CPU PIC and another PIC on the FPGA and other PICs on other peripherals, | ||
18 | * so we do some routing in irq-routing.[ch] to reduce the number of false-positives seen by | ||
19 | * drivers | ||
20 | */ | ||
21 | |||
22 | /* this number is used when no interrupt has been assigned */ | 15 | /* this number is used when no interrupt has been assigned */ |
23 | #define NO_IRQ (-1) | 16 | #define NO_IRQ (-1) |
24 | 17 | ||
25 | #define NR_IRQ_LOG2_ACTIONS_PER_GROUP 5 | 18 | #define NR_IRQS 48 |
26 | #define NR_IRQ_ACTIONS_PER_GROUP (1 << NR_IRQ_LOG2_ACTIONS_PER_GROUP) | 19 | #define IRQ_BASE_CPU (0 * 16) |
27 | #define NR_IRQ_GROUPS 4 | 20 | #define IRQ_BASE_FPGA (1 * 16) |
28 | #define NR_IRQS (NR_IRQ_ACTIONS_PER_GROUP * NR_IRQ_GROUPS) | 21 | #define IRQ_BASE_MB93493 (2 * 16) |
29 | 22 | ||
30 | /* probe returns a 32-bit IRQ mask:-/ */ | 23 | /* probe returns a 32-bit IRQ mask:-/ */ |
31 | #define MIN_PROBE_IRQ (NR_IRQS - 32) | 24 | #define MIN_PROBE_IRQ (NR_IRQS - 32) |
32 | 25 | ||
26 | #ifndef __ASSEMBLY__ | ||
33 | static inline int irq_canonicalize(int irq) | 27 | static inline int irq_canonicalize(int irq) |
34 | { | 28 | { |
35 | return irq; | 29 | return irq; |
36 | } | 30 | } |
37 | 31 | #endif | |
38 | extern void disable_irq_nosync(unsigned int irq); | ||
39 | extern void disable_irq(unsigned int irq); | ||
40 | extern void enable_irq(unsigned int irq); | ||
41 | |||
42 | 32 | ||
43 | #endif /* _ASM_IRQ_H_ */ | 33 | #endif /* _ASM_IRQ_H_ */ |
diff --git a/include/asm-frv/libata-portmap.h b/include/asm-frv/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-frv/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-frv/mb93091-fpga-irqs.h b/include/asm-frv/mb93091-fpga-irqs.h index 341bfc52a0eb..19778c5ba9d6 100644 --- a/include/asm-frv/mb93091-fpga-irqs.h +++ b/include/asm-frv/mb93091-fpga-irqs.h | |||
@@ -12,11 +12,9 @@ | |||
12 | #ifndef _ASM_MB93091_FPGA_IRQS_H | 12 | #ifndef _ASM_MB93091_FPGA_IRQS_H |
13 | #define _ASM_MB93091_FPGA_IRQS_H | 13 | #define _ASM_MB93091_FPGA_IRQS_H |
14 | 14 | ||
15 | #ifndef __ASSEMBLY__ | 15 | #include <asm/irq.h> |
16 | |||
17 | #include <asm/irq-routing.h> | ||
18 | 16 | ||
19 | #define IRQ_BASE_FPGA (NR_IRQ_ACTIONS_PER_GROUP * 1) | 17 | #ifndef __ASSEMBLY__ |
20 | 18 | ||
21 | /* IRQ IDs presented to drivers */ | 19 | /* IRQ IDs presented to drivers */ |
22 | enum { | 20 | enum { |
diff --git a/include/asm-frv/mb93093-fpga-irqs.h b/include/asm-frv/mb93093-fpga-irqs.h index 1e0f11c2fcdb..590266b1a6d3 100644 --- a/include/asm-frv/mb93093-fpga-irqs.h +++ b/include/asm-frv/mb93093-fpga-irqs.h | |||
@@ -12,11 +12,9 @@ | |||
12 | #ifndef _ASM_MB93093_FPGA_IRQS_H | 12 | #ifndef _ASM_MB93093_FPGA_IRQS_H |
13 | #define _ASM_MB93093_FPGA_IRQS_H | 13 | #define _ASM_MB93093_FPGA_IRQS_H |
14 | 14 | ||
15 | #ifndef __ASSEMBLY__ | 15 | #include <asm/irq.h> |
16 | |||
17 | #include <asm/irq-routing.h> | ||
18 | 16 | ||
19 | #define IRQ_BASE_FPGA (NR_IRQ_ACTIONS_PER_GROUP * 1) | 17 | #ifndef __ASSEMBLY__ |
20 | 18 | ||
21 | /* IRQ IDs presented to drivers */ | 19 | /* IRQ IDs presented to drivers */ |
22 | enum { | 20 | enum { |
diff --git a/include/asm-frv/mb93493-irqs.h b/include/asm-frv/mb93493-irqs.h index 15096e731325..82c7aeddd333 100644 --- a/include/asm-frv/mb93493-irqs.h +++ b/include/asm-frv/mb93493-irqs.h | |||
@@ -12,11 +12,9 @@ | |||
12 | #ifndef _ASM_MB93493_IRQS_H | 12 | #ifndef _ASM_MB93493_IRQS_H |
13 | #define _ASM_MB93493_IRQS_H | 13 | #define _ASM_MB93493_IRQS_H |
14 | 14 | ||
15 | #ifndef __ASSEMBLY__ | 15 | #include <asm/irq.h> |
16 | |||
17 | #include <asm/irq-routing.h> | ||
18 | 16 | ||
19 | #define IRQ_BASE_MB93493 (NR_IRQ_ACTIONS_PER_GROUP * 2) | 17 | #ifndef __ASSEMBLY__ |
20 | 18 | ||
21 | /* IRQ IDs presented to drivers */ | 19 | /* IRQ IDs presented to drivers */ |
22 | enum { | 20 | enum { |
diff --git a/include/asm-frv/mb93493-regs.h b/include/asm-frv/mb93493-regs.h index c54aa9d14468..8a1f6aac8cf1 100644 --- a/include/asm-frv/mb93493-regs.h +++ b/include/asm-frv/mb93493-regs.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/mb-regs.h> | 15 | #include <asm/mb-regs.h> |
16 | #include <asm/mb93493-irqs.h> | 16 | #include <asm/mb93493-irqs.h> |
17 | 17 | ||
18 | #define __addr_MB93493(X) ((volatile unsigned long *)(__region_CS3 + (X))) | ||
18 | #define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); }) | 19 | #define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); }) |
19 | 20 | ||
20 | #define __set_MB93493(X,V) \ | 21 | #define __set_MB93493(X,V) \ |
@@ -26,6 +27,7 @@ do { \ | |||
26 | #define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V)) | 27 | #define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V)) |
27 | #define MB93493_STSR_EN | 28 | #define MB93493_STSR_EN |
28 | 29 | ||
30 | #define __addr_MB93493_IQSR(X) __addr_MB93493(0x3d0 + (X) * 4) | ||
29 | #define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4) | 31 | #define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4) |
30 | #define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V)) | 32 | #define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V)) |
31 | 33 | ||
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 7af7485e889e..2fb3c6f05e03 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h | |||
@@ -217,7 +217,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) | |||
217 | } | 217 | } |
218 | 218 | ||
219 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) | 219 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) |
220 | #define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd })) | 220 | #define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd })) |
221 | 221 | ||
222 | /* | 222 | /* |
223 | * allocating and freeing a pud is trivial: the 1-entry pud is | 223 | * allocating and freeing a pud is trivial: the 1-entry pud is |
@@ -246,7 +246,7 @@ static inline void pud_clear(pud_t *pud) { } | |||
246 | #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval }) | 246 | #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval }) |
247 | 247 | ||
248 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) | 248 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) |
249 | #define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud })) | 249 | #define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud })) |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * (pmds are folded into pgds so this doesn't get actually called, | 252 | * (pmds are folded into pgds so this doesn't get actually called, |
@@ -362,7 +362,7 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address) | |||
362 | #define pmd_bad(x) (pmd_val(x) & xAMPRx_SS) | 362 | #define pmd_bad(x) (pmd_val(x) & xAMPRx_SS) |
363 | #define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0) | 363 | #define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0) |
364 | 364 | ||
365 | #define pmd_page_kernel(pmd) \ | 365 | #define pmd_page_vaddr(pmd) \ |
366 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 366 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
367 | 367 | ||
368 | #ifndef CONFIG_DISCONTIGMEM | 368 | #ifndef CONFIG_DISCONTIGMEM |
@@ -458,7 +458,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
458 | #define pte_index(address) \ | 458 | #define pte_index(address) \ |
459 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 459 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
460 | #define pte_offset_kernel(dir, address) \ | 460 | #define pte_offset_kernel(dir, address) \ |
461 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 461 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
462 | 462 | ||
463 | #if defined(CONFIG_HIGHPTE) | 463 | #if defined(CONFIG_HIGHPTE) |
464 | #define pte_offset_map(dir, address) \ | 464 | #define pte_offset_map(dir, address) \ |
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h index b80dbd839475..d104d1b91d39 100644 --- a/include/asm-frv/unistd.h +++ b/include/asm-frv/unistd.h | |||
@@ -320,6 +320,7 @@ | |||
320 | #ifdef __KERNEL__ | 320 | #ifdef __KERNEL__ |
321 | 321 | ||
322 | #define NR_syscalls 310 | 322 | #define NR_syscalls 310 |
323 | #include <linux/err.h> | ||
323 | 324 | ||
324 | /* | 325 | /* |
325 | * process the return value of a syscall, consigning it to one of two possible fates | 326 | * process the return value of a syscall, consigning it to one of two possible fates |
@@ -329,7 +330,7 @@ | |||
329 | #define __syscall_return(type, res) \ | 330 | #define __syscall_return(type, res) \ |
330 | do { \ | 331 | do { \ |
331 | unsigned long __sr2 = (res); \ | 332 | unsigned long __sr2 = (res); \ |
332 | if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) { \ | 333 | if (__builtin_expect(__sr2 >= (unsigned long)(-MAX_ERRNO), 0)) { \ |
333 | errno = (-__sr2); \ | 334 | errno = (-__sr2); \ |
334 | __sr2 = ~0UL; \ | 335 | __sr2 = ~0UL; \ |
335 | } \ | 336 | } \ |
diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h index 68c6fea994d9..7b88d3931e34 100644 --- a/include/asm-generic/4level-fixup.h +++ b/include/asm-generic/4level-fixup.h | |||
@@ -21,6 +21,10 @@ | |||
21 | #define pud_present(pud) 1 | 21 | #define pud_present(pud) 1 |
22 | #define pud_ERROR(pud) do { } while (0) | 22 | #define pud_ERROR(pud) do { } while (0) |
23 | #define pud_clear(pud) pgd_clear(pud) | 23 | #define pud_clear(pud) pgd_clear(pud) |
24 | #define pud_val(pud) pgd_val(pud) | ||
25 | #define pud_populate(mm, pud, pmd) pgd_populate(mm, pud, pmd) | ||
26 | #define pud_page(pud) pgd_page(pud) | ||
27 | #define pud_page_vaddr(pud) pgd_page_vaddr(pud) | ||
24 | 28 | ||
25 | #undef pud_free_tlb | 29 | #undef pud_free_tlb |
26 | #define pud_free_tlb(tlb, x) do { } while (0) | 30 | #define pud_free_tlb(tlb, x) do { } while (0) |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index e160e04290fb..6d45ee5472af 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -14,7 +14,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; | |||
14 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name | 14 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name |
15 | 15 | ||
16 | /* var is in discarded region: offset to particular copy we want */ | 16 | /* var is in discarded region: offset to particular copy we want */ |
17 | #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) | 17 | #define per_cpu(var, cpu) (*({ \ |
18 | extern int simple_indentifier_##var(void); \ | ||
19 | RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); })) | ||
18 | #define __get_cpu_var(var) per_cpu(var, smp_processor_id()) | 20 | #define __get_cpu_var(var) per_cpu(var, smp_processor_id()) |
19 | #define __raw_get_cpu_var(var) per_cpu(var, raw_smp_processor_id()) | 21 | #define __raw_get_cpu_var(var) per_cpu(var, raw_smp_processor_id()) |
20 | 22 | ||
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index c8d53ba20e19..29ff5d84d8c3 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h | |||
@@ -47,7 +47,7 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address) | |||
47 | #define __pmd(x) ((pmd_t) { __pud(x) } ) | 47 | #define __pmd(x) ((pmd_t) { __pud(x) } ) |
48 | 48 | ||
49 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) | 49 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) |
50 | #define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud })) | 50 | #define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud })) |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * allocating and freeing a pmd is trivial: the 1-entry pmd is | 53 | * allocating and freeing a pmd is trivial: the 1-entry pmd is |
diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index 82e29f0ce467..566464500558 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h | |||
@@ -44,7 +44,7 @@ static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address) | |||
44 | #define __pud(x) ((pud_t) { __pgd(x) } ) | 44 | #define __pud(x) ((pud_t) { __pgd(x) } ) |
45 | 45 | ||
46 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) | 46 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) |
47 | #define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd })) | 47 | #define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd })) |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * allocating and freeing a pud is trivial: the 1-entry pud is | 50 | * allocating and freeing a pud is trivial: the 1-entry pud is |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index c2059a3a0621..349260cd86ed 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_GENERIC_PGTABLE_H | 1 | #ifndef _ASM_GENERIC_PGTABLE_H |
2 | #define _ASM_GENERIC_PGTABLE_H | 2 | #define _ASM_GENERIC_PGTABLE_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
4 | #ifndef __HAVE_ARCH_PTEP_ESTABLISH | 6 | #ifndef __HAVE_ARCH_PTEP_ESTABLISH |
5 | /* | 7 | /* |
6 | * Establish a new mapping: | 8 | * Establish a new mapping: |
@@ -188,7 +190,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres | |||
188 | }) | 190 | }) |
189 | #endif | 191 | #endif |
190 | 192 | ||
191 | #ifndef __ASSEMBLY__ | ||
192 | /* | 193 | /* |
193 | * When walking page tables, we usually want to skip any p?d_none entries; | 194 | * When walking page tables, we usually want to skip any p?d_none entries; |
194 | * and any p?d_bad entries - reporting the error before resetting to none. | 195 | * and any p?d_bad entries - reporting the error before resetting to none. |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index db5a3732f106..69240b52f8e1 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -118,15 +118,15 @@ | |||
118 | __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ | 118 | __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ |
119 | *(__ksymtab_strings) \ | 119 | *(__ksymtab_strings) \ |
120 | } \ | 120 | } \ |
121 | __end_rodata = .; \ | ||
122 | . = ALIGN(4096); \ | ||
123 | \ | 121 | \ |
124 | /* Built-in module parameters. */ \ | 122 | /* Built-in module parameters. */ \ |
125 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ | 123 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ |
126 | VMLINUX_SYMBOL(__start___param) = .; \ | 124 | VMLINUX_SYMBOL(__start___param) = .; \ |
127 | *(__param) \ | 125 | *(__param) \ |
128 | VMLINUX_SYMBOL(__stop___param) = .; \ | 126 | VMLINUX_SYMBOL(__stop___param) = .; \ |
129 | } | 127 | } \ |
128 | __end_rodata = .; \ | ||
129 | . = ALIGN(4096); | ||
130 | 130 | ||
131 | #define SECURITY_INIT \ | 131 | #define SECURITY_INIT \ |
132 | .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ | 132 | .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ |
@@ -194,3 +194,6 @@ | |||
194 | .stab.index 0 : { *(.stab.index) } \ | 194 | .stab.index 0 : { *(.stab.index) } \ |
195 | .stab.indexstr 0 : { *(.stab.indexstr) } \ | 195 | .stab.indexstr 0 : { *(.stab.indexstr) } \ |
196 | .comment 0 : { *(.comment) } | 196 | .comment 0 : { *(.comment) } |
197 | |||
198 | #define NOTES \ | ||
199 | .notes : { *(.note.*) } :note | ||
diff --git a/include/asm-h8300/unistd.h b/include/asm-h8300/unistd.h index 226dd596c2da..a2dd90462d80 100644 --- a/include/asm-h8300/unistd.h +++ b/include/asm-h8300/unistd.h | |||
@@ -295,14 +295,14 @@ | |||
295 | #ifdef __KERNEL__ | 295 | #ifdef __KERNEL__ |
296 | 296 | ||
297 | #define NR_syscalls 289 | 297 | #define NR_syscalls 289 |
298 | #include <linux/err.h> | ||
298 | 299 | ||
299 | 300 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO: see | |
300 | /* user-visible error numbers are in the range -1 - -122: see | ||
301 | <asm-m68k/errno.h> */ | 301 | <asm-m68k/errno.h> */ |
302 | 302 | ||
303 | #define __syscall_return(type, res) \ | 303 | #define __syscall_return(type, res) \ |
304 | do { \ | 304 | do { \ |
305 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | 305 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
306 | /* avoid using res which is declared to be in register d0; \ | 306 | /* avoid using res which is declared to be in register d0; \ |
307 | errno might expand to a function call and clobber it. */ \ | 307 | errno might expand to a function call and clobber it. */ \ |
308 | int __err = -(res); \ | 308 | int __err = -(res); \ |
diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild index b75a348d0c1c..147e4ac1ebf0 100644 --- a/include/asm-i386/Kbuild +++ b/include/asm-i386/Kbuild | |||
@@ -3,6 +3,7 @@ include include/asm-generic/Kbuild.asm | |||
3 | header-y += boot.h | 3 | header-y += boot.h |
4 | header-y += debugreg.h | 4 | header-y += debugreg.h |
5 | header-y += ldt.h | 5 | header-y += ldt.h |
6 | header-y += ptrace-abi.h | ||
6 | header-y += ucontext.h | 7 | header-y += ucontext.h |
7 | 8 | ||
8 | unifdef-y += mtrr.h | 9 | unifdef-y += mtrr.h |
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h index 20f523954218..6016632d032f 100644 --- a/include/asm-i386/acpi.h +++ b/include/asm-i386/acpi.h | |||
@@ -131,21 +131,7 @@ static inline void disable_acpi(void) | |||
131 | extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); | 131 | extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); |
132 | 132 | ||
133 | #ifdef CONFIG_X86_IO_APIC | 133 | #ifdef CONFIG_X86_IO_APIC |
134 | extern int skip_ioapic_setup; | ||
135 | extern int acpi_skip_timer_override; | 134 | extern int acpi_skip_timer_override; |
136 | |||
137 | static inline void disable_ioapic_setup(void) | ||
138 | { | ||
139 | skip_ioapic_setup = 1; | ||
140 | } | ||
141 | |||
142 | static inline int ioapic_setup_disabled(void) | ||
143 | { | ||
144 | return skip_ioapic_setup; | ||
145 | } | ||
146 | |||
147 | #else | ||
148 | static inline void disable_ioapic_setup(void) { } | ||
149 | #endif | 135 | #endif |
150 | 136 | ||
151 | static inline void acpi_noirq_set(void) { acpi_noirq = 1; } | 137 | static inline void acpi_noirq_set(void) { acpi_noirq = 1; } |
diff --git a/include/asm-i386/alternative-asm.i b/include/asm-i386/alternative-asm.i new file mode 100644 index 000000000000..6c47e3b9484b --- /dev/null +++ b/include/asm-i386/alternative-asm.i | |||
@@ -0,0 +1,14 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
3 | #ifdef CONFIG_SMP | ||
4 | .macro LOCK_PREFIX | ||
5 | 1: lock | ||
6 | .section .smp_locks,"a" | ||
7 | .align 4 | ||
8 | .long 1b | ||
9 | .previous | ||
10 | .endm | ||
11 | #else | ||
12 | .macro LOCK_PREFIX | ||
13 | .endm | ||
14 | #endif | ||
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index 2c1e371cebb6..3a42b7d6fc92 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h | |||
@@ -16,20 +16,8 @@ | |||
16 | #define APIC_VERBOSE 1 | 16 | #define APIC_VERBOSE 1 |
17 | #define APIC_DEBUG 2 | 17 | #define APIC_DEBUG 2 |
18 | 18 | ||
19 | extern int enable_local_apic; | ||
20 | extern int apic_verbosity; | 19 | extern int apic_verbosity; |
21 | 20 | ||
22 | static inline void lapic_disable(void) | ||
23 | { | ||
24 | enable_local_apic = -1; | ||
25 | clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); | ||
26 | } | ||
27 | |||
28 | static inline void lapic_enable(void) | ||
29 | { | ||
30 | enable_local_apic = 1; | ||
31 | } | ||
32 | |||
33 | /* | 21 | /* |
34 | * Define the default level of output to be very little | 22 | * Define the default level of output to be very little |
35 | * This can be turned up by using apic=verbose for more | 23 | * This can be turned up by using apic=verbose for more |
@@ -42,6 +30,8 @@ static inline void lapic_enable(void) | |||
42 | } while (0) | 30 | } while (0) |
43 | 31 | ||
44 | 32 | ||
33 | extern void generic_apic_probe(void); | ||
34 | |||
45 | #ifdef CONFIG_X86_LOCAL_APIC | 35 | #ifdef CONFIG_X86_LOCAL_APIC |
46 | 36 | ||
47 | /* | 37 | /* |
@@ -117,8 +107,6 @@ extern void enable_APIC_timer(void); | |||
117 | 107 | ||
118 | extern void enable_NMI_through_LVT0 (void * dummy); | 108 | extern void enable_NMI_through_LVT0 (void * dummy); |
119 | 109 | ||
120 | extern int disable_timer_pin_1; | ||
121 | |||
122 | void smp_send_timer_broadcast_ipi(struct pt_regs *regs); | 110 | void smp_send_timer_broadcast_ipi(struct pt_regs *regs); |
123 | void switch_APIC_timer_to_ipi(void *cpumask); | 111 | void switch_APIC_timer_to_ipi(void *cpumask); |
124 | void switch_ipi_to_APIC_timer(void *cpumask); | 112 | void switch_ipi_to_APIC_timer(void *cpumask); |
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h index 89b8b82c82b3..5874ef119ffd 100644 --- a/include/asm-i386/desc.h +++ b/include/asm-i386/desc.h | |||
@@ -33,50 +33,99 @@ static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) | |||
33 | return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; | 33 | return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; |
34 | } | 34 | } |
35 | 35 | ||
36 | /* | ||
37 | * This is the ldt that every process will get unless we need | ||
38 | * something other than this. | ||
39 | */ | ||
40 | extern struct desc_struct default_ldt[]; | ||
41 | extern struct desc_struct idt_table[]; | ||
42 | extern void set_intr_gate(unsigned int irq, void * addr); | ||
43 | |||
44 | static inline void pack_descriptor(__u32 *a, __u32 *b, | ||
45 | unsigned long base, unsigned long limit, unsigned char type, unsigned char flags) | ||
46 | { | ||
47 | *a = ((base & 0xffff) << 16) | (limit & 0xffff); | ||
48 | *b = (base & 0xff000000) | ((base & 0xff0000) >> 16) | | ||
49 | (limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20); | ||
50 | } | ||
51 | |||
52 | static inline void pack_gate(__u32 *a, __u32 *b, | ||
53 | unsigned long base, unsigned short seg, unsigned char type, unsigned char flags) | ||
54 | { | ||
55 | *a = (seg << 16) | (base & 0xffff); | ||
56 | *b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff); | ||
57 | } | ||
58 | |||
59 | #define DESCTYPE_LDT 0x82 /* present, system, DPL-0, LDT */ | ||
60 | #define DESCTYPE_TSS 0x89 /* present, system, DPL-0, 32-bit TSS */ | ||
61 | #define DESCTYPE_TASK 0x85 /* present, system, DPL-0, task gate */ | ||
62 | #define DESCTYPE_INT 0x8e /* present, system, DPL-0, interrupt gate */ | ||
63 | #define DESCTYPE_TRAP 0x8f /* present, system, DPL-0, trap gate */ | ||
64 | #define DESCTYPE_DPL3 0x60 /* DPL-3 */ | ||
65 | #define DESCTYPE_S 0x10 /* !system */ | ||
66 | |||
36 | #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) | 67 | #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) |
37 | #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) | 68 | #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) |
38 | 69 | ||
39 | #define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) | 70 | #define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) |
40 | #define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) | 71 | #define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) |
41 | #define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr)) | 72 | #define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr)) |
42 | #define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt)) | 73 | #define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt)) |
43 | 74 | ||
44 | #define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) | 75 | #define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) |
45 | #define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) | 76 | #define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) |
46 | #define store_tr(tr) __asm__ ("str %0":"=mr" (tr)) | 77 | #define store_tr(tr) __asm__ ("str %0":"=m" (tr)) |
47 | #define store_ldt(ldt) __asm__ ("sldt %0":"=mr" (ldt)) | 78 | #define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt)) |
48 | 79 | ||
49 | /* | 80 | #if TLS_SIZE != 24 |
50 | * This is the ldt that every process will get unless we need | 81 | # error update this code. |
51 | * something other than this. | 82 | #endif |
52 | */ | ||
53 | extern struct desc_struct default_ldt[]; | ||
54 | extern void set_intr_gate(unsigned int irq, void * addr); | ||
55 | 83 | ||
56 | #define _set_tssldt_desc(n,addr,limit,type) \ | 84 | static inline void load_TLS(struct thread_struct *t, unsigned int cpu) |
57 | __asm__ __volatile__ ("movw %w3,0(%2)\n\t" \ | ||
58 | "movw %w1,2(%2)\n\t" \ | ||
59 | "rorl $16,%1\n\t" \ | ||
60 | "movb %b1,4(%2)\n\t" \ | ||
61 | "movb %4,5(%2)\n\t" \ | ||
62 | "movb $0,6(%2)\n\t" \ | ||
63 | "movb %h1,7(%2)\n\t" \ | ||
64 | "rorl $16,%1" \ | ||
65 | : "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type)) | ||
66 | |||
67 | static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) | ||
68 | { | 85 | { |
69 | _set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr, | 86 | #define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] |
70 | offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89); | 87 | C(0); C(1); C(2); |
88 | #undef C | ||
71 | } | 89 | } |
72 | 90 | ||
73 | #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) | 91 | static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) |
92 | { | ||
93 | __u32 *lp = (__u32 *)((char *)dt + entry*8); | ||
94 | *lp = entry_a; | ||
95 | *(lp+1) = entry_b; | ||
96 | } | ||
97 | |||
98 | #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | ||
99 | #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | ||
100 | #define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | ||
101 | |||
102 | static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) | ||
103 | { | ||
104 | __u32 a, b; | ||
105 | pack_gate(&a, &b, (unsigned long)addr, seg, type, 0); | ||
106 | write_idt_entry(idt_table, gate, a, b); | ||
107 | } | ||
74 | 108 | ||
75 | static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) | 109 | static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) |
76 | { | 110 | { |
77 | _set_tssldt_desc(&get_cpu_gdt_table(cpu)[GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82); | 111 | __u32 a, b; |
112 | pack_descriptor(&a, &b, (unsigned long)addr, | ||
113 | offsetof(struct tss_struct, __cacheline_filler) - 1, | ||
114 | DESCTYPE_TSS, 0); | ||
115 | write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b); | ||
78 | } | 116 | } |
79 | 117 | ||
118 | static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int entries) | ||
119 | { | ||
120 | __u32 a, b; | ||
121 | pack_descriptor(&a, &b, (unsigned long)addr, | ||
122 | entries * sizeof(struct desc_struct) - 1, | ||
123 | DESCTYPE_LDT, 0); | ||
124 | write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b); | ||
125 | } | ||
126 | |||
127 | #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) | ||
128 | |||
80 | #define LDT_entry_a(info) \ | 129 | #define LDT_entry_a(info) \ |
81 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | 130 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) |
82 | 131 | ||
@@ -102,24 +151,6 @@ static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) | |||
102 | (info)->seg_not_present == 1 && \ | 151 | (info)->seg_not_present == 1 && \ |
103 | (info)->useable == 0 ) | 152 | (info)->useable == 0 ) |
104 | 153 | ||
105 | static inline void write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b) | ||
106 | { | ||
107 | __u32 *lp = (__u32 *)((char *)ldt + entry*8); | ||
108 | *lp = entry_a; | ||
109 | *(lp+1) = entry_b; | ||
110 | } | ||
111 | |||
112 | #if TLS_SIZE != 24 | ||
113 | # error update this code. | ||
114 | #endif | ||
115 | |||
116 | static inline void load_TLS(struct thread_struct *t, unsigned int cpu) | ||
117 | { | ||
118 | #define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] | ||
119 | C(0); C(1); C(2); | ||
120 | #undef C | ||
121 | } | ||
122 | |||
123 | static inline void clear_LDT(void) | 154 | static inline void clear_LDT(void) |
124 | { | 155 | { |
125 | int cpu = get_cpu(); | 156 | int cpu = get_cpu(); |
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h index 9cf20cacf76e..576ae01d71c8 100644 --- a/include/asm-i386/dma-mapping.h +++ b/include/asm-i386/dma-mapping.h | |||
@@ -21,8 +21,7 @@ static inline dma_addr_t | |||
21 | dma_map_single(struct device *dev, void *ptr, size_t size, | 21 | dma_map_single(struct device *dev, void *ptr, size_t size, |
22 | enum dma_data_direction direction) | 22 | enum dma_data_direction direction) |
23 | { | 23 | { |
24 | if (direction == DMA_NONE) | 24 | BUG_ON(direction == DMA_NONE); |
25 | BUG(); | ||
26 | WARN_ON(size == 0); | 25 | WARN_ON(size == 0); |
27 | flush_write_buffers(); | 26 | flush_write_buffers(); |
28 | return virt_to_phys(ptr); | 27 | return virt_to_phys(ptr); |
@@ -32,8 +31,7 @@ static inline void | |||
32 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | 31 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, |
33 | enum dma_data_direction direction) | 32 | enum dma_data_direction direction) |
34 | { | 33 | { |
35 | if (direction == DMA_NONE) | 34 | BUG_ON(direction == DMA_NONE); |
36 | BUG(); | ||
37 | } | 35 | } |
38 | 36 | ||
39 | static inline int | 37 | static inline int |
@@ -42,8 +40,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
42 | { | 40 | { |
43 | int i; | 41 | int i; |
44 | 42 | ||
45 | if (direction == DMA_NONE) | 43 | BUG_ON(direction == DMA_NONE); |
46 | BUG(); | ||
47 | WARN_ON(nents == 0 || sg[0].length == 0); | 44 | WARN_ON(nents == 0 || sg[0].length == 0); |
48 | 45 | ||
49 | for (i = 0; i < nents; i++ ) { | 46 | for (i = 0; i < nents; i++ ) { |
diff --git a/include/asm-i386/dwarf2.h b/include/asm-i386/dwarf2.h index 2280f6272f80..6d66398a307d 100644 --- a/include/asm-i386/dwarf2.h +++ b/include/asm-i386/dwarf2.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _DWARF2_H | 1 | #ifndef _DWARF2_H |
2 | #define _DWARF2_H | 2 | #define _DWARF2_H |
3 | 3 | ||
4 | #include <linux/config.h> | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
7 | #warning "asm/dwarf2.h should be only included in pure assembly files" | 5 | #warning "asm/dwarf2.h should be only included in pure assembly files" |
8 | #endif | 6 | #endif |
@@ -28,6 +26,13 @@ | |||
28 | #define CFI_RESTORE .cfi_restore | 26 | #define CFI_RESTORE .cfi_restore |
29 | #define CFI_REMEMBER_STATE .cfi_remember_state | 27 | #define CFI_REMEMBER_STATE .cfi_remember_state |
30 | #define CFI_RESTORE_STATE .cfi_restore_state | 28 | #define CFI_RESTORE_STATE .cfi_restore_state |
29 | #define CFI_UNDEFINED .cfi_undefined | ||
30 | |||
31 | #ifdef CONFIG_AS_CFI_SIGNAL_FRAME | ||
32 | #define CFI_SIGNAL_FRAME .cfi_signal_frame | ||
33 | #else | ||
34 | #define CFI_SIGNAL_FRAME | ||
35 | #endif | ||
31 | 36 | ||
32 | #else | 37 | #else |
33 | 38 | ||
@@ -48,6 +53,8 @@ | |||
48 | #define CFI_RESTORE ignore | 53 | #define CFI_RESTORE ignore |
49 | #define CFI_REMEMBER_STATE ignore | 54 | #define CFI_REMEMBER_STATE ignore |
50 | #define CFI_RESTORE_STATE ignore | 55 | #define CFI_RESTORE_STATE ignore |
56 | #define CFI_UNDEFINED ignore | ||
57 | #define CFI_SIGNAL_FRAME ignore | ||
51 | 58 | ||
52 | #endif | 59 | #endif |
53 | 60 | ||
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h index ca82acb8cb1f..f7514fb6e8e4 100644 --- a/include/asm-i386/e820.h +++ b/include/asm-i386/e820.h | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | #define E820_RAM 1 | 19 | #define E820_RAM 1 |
20 | #define E820_RESERVED 2 | 20 | #define E820_RESERVED 2 |
21 | #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ | 21 | #define E820_ACPI 3 |
22 | #define E820_NVS 4 | 22 | #define E820_NVS 4 |
23 | 23 | ||
24 | #define HIGH_MEMORY (1024*1024) | 24 | #define HIGH_MEMORY (1024*1024) |
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h index a48cc3f7ccc6..02428cb36621 100644 --- a/include/asm-i386/fixmap.h +++ b/include/asm-i386/fixmap.h | |||
@@ -19,7 +19,11 @@ | |||
19 | * Leave one empty page between vmalloc'ed areas and | 19 | * Leave one empty page between vmalloc'ed areas and |
20 | * the start of the fixmap. | 20 | * the start of the fixmap. |
21 | */ | 21 | */ |
22 | #define __FIXADDR_TOP 0xfffff000 | 22 | #ifndef CONFIG_COMPAT_VDSO |
23 | extern unsigned long __FIXADDR_TOP; | ||
24 | #else | ||
25 | #define __FIXADDR_TOP 0xfffff000 | ||
26 | #endif | ||
23 | 27 | ||
24 | #ifndef __ASSEMBLY__ | 28 | #ifndef __ASSEMBLY__ |
25 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
@@ -93,6 +97,7 @@ enum fixed_addresses { | |||
93 | 97 | ||
94 | extern void __set_fixmap (enum fixed_addresses idx, | 98 | extern void __set_fixmap (enum fixed_addresses idx, |
95 | unsigned long phys, pgprot_t flags); | 99 | unsigned long phys, pgprot_t flags); |
100 | extern void reserve_top_address(unsigned long reserve); | ||
96 | 101 | ||
97 | #define set_fixmap(idx, phys) \ | 102 | #define set_fixmap(idx, phys) \ |
98 | __set_fixmap(idx, phys, PAGE_KERNEL) | 103 | __set_fixmap(idx, phys, PAGE_KERNEL) |
diff --git a/include/asm-i386/frame.i b/include/asm-i386/frame.i new file mode 100644 index 000000000000..4d68ddce18b6 --- /dev/null +++ b/include/asm-i386/frame.i | |||
@@ -0,0 +1,24 @@ | |||
1 | #include <linux/config.h> | ||
2 | #include <asm/dwarf2.h> | ||
3 | |||
4 | /* The annotation hides the frame from the unwinder and makes it look | ||
5 | like a ordinary ebp save/restore. This avoids some special cases for | ||
6 | frame pointer later */ | ||
7 | #ifdef CONFIG_FRAME_POINTER | ||
8 | .macro FRAME | ||
9 | pushl %ebp | ||
10 | CFI_ADJUST_CFA_OFFSET 4 | ||
11 | CFI_REL_OFFSET ebp,0 | ||
12 | movl %esp,%ebp | ||
13 | .endm | ||
14 | .macro ENDFRAME | ||
15 | popl %ebp | ||
16 | CFI_ADJUST_CFA_OFFSET -4 | ||
17 | CFI_RESTORE ebp | ||
18 | .endm | ||
19 | #else | ||
20 | .macro FRAME | ||
21 | .endm | ||
22 | .macro ENDFRAME | ||
23 | .endm | ||
24 | #endif | ||
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h index b3783a32abee..8ffbb0f07457 100644 --- a/include/asm-i386/genapic.h +++ b/include/asm-i386/genapic.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_GENAPIC_H | 1 | #ifndef _ASM_GENAPIC_H |
2 | #define _ASM_GENAPIC_H 1 | 2 | #define _ASM_GENAPIC_H 1 |
3 | 3 | ||
4 | #include <asm/mpspec.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * Generic APIC driver interface. | 7 | * Generic APIC driver interface. |
6 | * | 8 | * |
@@ -63,14 +65,25 @@ struct genapic { | |||
63 | unsigned (*get_apic_id)(unsigned long x); | 65 | unsigned (*get_apic_id)(unsigned long x); |
64 | unsigned long apic_id_mask; | 66 | unsigned long apic_id_mask; |
65 | unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask); | 67 | unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask); |
66 | 68 | ||
69 | #ifdef CONFIG_SMP | ||
67 | /* ipi */ | 70 | /* ipi */ |
68 | void (*send_IPI_mask)(cpumask_t mask, int vector); | 71 | void (*send_IPI_mask)(cpumask_t mask, int vector); |
69 | void (*send_IPI_allbutself)(int vector); | 72 | void (*send_IPI_allbutself)(int vector); |
70 | void (*send_IPI_all)(int vector); | 73 | void (*send_IPI_all)(int vector); |
74 | #endif | ||
71 | }; | 75 | }; |
72 | 76 | ||
73 | #define APICFUNC(x) .x = x | 77 | #define APICFUNC(x) .x = x, |
78 | |||
79 | /* More functions could be probably marked IPIFUNC and save some space | ||
80 | in UP GENERICARCH kernels, but I don't have the nerve right now | ||
81 | to untangle this mess. -AK */ | ||
82 | #ifdef CONFIG_SMP | ||
83 | #define IPIFUNC(x) APICFUNC(x) | ||
84 | #else | ||
85 | #define IPIFUNC(x) | ||
86 | #endif | ||
74 | 87 | ||
75 | #define APIC_INIT(aname, aprobe) { \ | 88 | #define APIC_INIT(aname, aprobe) { \ |
76 | .name = aname, \ | 89 | .name = aname, \ |
@@ -80,33 +93,33 @@ struct genapic { | |||
80 | .no_balance_irq = NO_BALANCE_IRQ, \ | 93 | .no_balance_irq = NO_BALANCE_IRQ, \ |
81 | .ESR_DISABLE = esr_disable, \ | 94 | .ESR_DISABLE = esr_disable, \ |
82 | .apic_destination_logical = APIC_DEST_LOGICAL, \ | 95 | .apic_destination_logical = APIC_DEST_LOGICAL, \ |
83 | APICFUNC(apic_id_registered), \ | 96 | APICFUNC(apic_id_registered) \ |
84 | APICFUNC(target_cpus), \ | 97 | APICFUNC(target_cpus) \ |
85 | APICFUNC(check_apicid_used), \ | 98 | APICFUNC(check_apicid_used) \ |
86 | APICFUNC(check_apicid_present), \ | 99 | APICFUNC(check_apicid_present) \ |
87 | APICFUNC(init_apic_ldr), \ | 100 | APICFUNC(init_apic_ldr) \ |
88 | APICFUNC(ioapic_phys_id_map), \ | 101 | APICFUNC(ioapic_phys_id_map) \ |
89 | APICFUNC(clustered_apic_check), \ | 102 | APICFUNC(clustered_apic_check) \ |
90 | APICFUNC(multi_timer_check), \ | 103 | APICFUNC(multi_timer_check) \ |
91 | APICFUNC(apicid_to_node), \ | 104 | APICFUNC(apicid_to_node) \ |
92 | APICFUNC(cpu_to_logical_apicid), \ | 105 | APICFUNC(cpu_to_logical_apicid) \ |
93 | APICFUNC(cpu_present_to_apicid), \ | 106 | APICFUNC(cpu_present_to_apicid) \ |
94 | APICFUNC(apicid_to_cpu_present), \ | 107 | APICFUNC(apicid_to_cpu_present) \ |
95 | APICFUNC(mpc_apic_id), \ | 108 | APICFUNC(mpc_apic_id) \ |
96 | APICFUNC(setup_portio_remap), \ | 109 | APICFUNC(setup_portio_remap) \ |
97 | APICFUNC(check_phys_apicid_present), \ | 110 | APICFUNC(check_phys_apicid_present) \ |
98 | APICFUNC(mpc_oem_bus_info), \ | 111 | APICFUNC(mpc_oem_bus_info) \ |
99 | APICFUNC(mpc_oem_pci_bus), \ | 112 | APICFUNC(mpc_oem_pci_bus) \ |
100 | APICFUNC(mps_oem_check), \ | 113 | APICFUNC(mps_oem_check) \ |
101 | APICFUNC(get_apic_id), \ | 114 | APICFUNC(get_apic_id) \ |
102 | .apic_id_mask = APIC_ID_MASK, \ | 115 | .apic_id_mask = APIC_ID_MASK, \ |
103 | APICFUNC(cpu_mask_to_apicid), \ | 116 | APICFUNC(cpu_mask_to_apicid) \ |
104 | APICFUNC(acpi_madt_oem_check), \ | 117 | APICFUNC(acpi_madt_oem_check) \ |
105 | APICFUNC(send_IPI_mask), \ | 118 | IPIFUNC(send_IPI_mask) \ |
106 | APICFUNC(send_IPI_allbutself), \ | 119 | IPIFUNC(send_IPI_allbutself) \ |
107 | APICFUNC(send_IPI_all), \ | 120 | IPIFUNC(send_IPI_all) \ |
108 | APICFUNC(enable_apic_mode), \ | 121 | APICFUNC(enable_apic_mode) \ |
109 | APICFUNC(phys_pkg_id), \ | 122 | APICFUNC(phys_pkg_id) \ |
110 | } | 123 | } |
111 | 124 | ||
112 | extern struct genapic *genapic; | 125 | extern struct genapic *genapic; |
diff --git a/include/asm-i386/intel_arch_perfmon.h b/include/asm-i386/intel_arch_perfmon.h index 134ea9cc5283..b52cd60a075b 100644 --- a/include/asm-i386/intel_arch_perfmon.h +++ b/include/asm-i386/intel_arch_perfmon.h | |||
@@ -14,6 +14,18 @@ | |||
14 | 14 | ||
15 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) | 15 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) |
16 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) | 16 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) |
17 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT (1 << 0) | 17 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) |
18 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ | ||
19 | (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) | ||
20 | |||
21 | union cpuid10_eax { | ||
22 | struct { | ||
23 | unsigned int version_id:8; | ||
24 | unsigned int num_counters:8; | ||
25 | unsigned int bit_width:8; | ||
26 | unsigned int mask_length:8; | ||
27 | } split; | ||
28 | unsigned int full; | ||
29 | }; | ||
18 | 30 | ||
19 | #endif /* X86_INTEL_ARCH_PERFMON_H */ | 31 | #endif /* X86_INTEL_ARCH_PERFMON_H */ |
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h index 5092e819b8a2..5d309275a1dc 100644 --- a/include/asm-i386/io_apic.h +++ b/include/asm-i386/io_apic.h | |||
@@ -188,6 +188,16 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned | |||
188 | /* 1 if "noapic" boot option passed */ | 188 | /* 1 if "noapic" boot option passed */ |
189 | extern int skip_ioapic_setup; | 189 | extern int skip_ioapic_setup; |
190 | 190 | ||
191 | static inline void disable_ioapic_setup(void) | ||
192 | { | ||
193 | skip_ioapic_setup = 1; | ||
194 | } | ||
195 | |||
196 | static inline int ioapic_setup_disabled(void) | ||
197 | { | ||
198 | return skip_ioapic_setup; | ||
199 | } | ||
200 | |||
191 | /* | 201 | /* |
192 | * If we use the IO-APIC for IRQ routing, disable automatic | 202 | * If we use the IO-APIC for IRQ routing, disable automatic |
193 | * assignment of PCI IRQ's. | 203 | * assignment of PCI IRQ's. |
@@ -206,6 +216,7 @@ extern int (*ioapic_renumber_irq)(int ioapic, int irq); | |||
206 | 216 | ||
207 | #else /* !CONFIG_X86_IO_APIC */ | 217 | #else /* !CONFIG_X86_IO_APIC */ |
208 | #define io_apic_assign_pci_irqs 0 | 218 | #define io_apic_assign_pci_irqs 0 |
219 | static inline void disable_ioapic_setup(void) { } | ||
209 | #endif | 220 | #endif |
210 | 221 | ||
211 | extern int assign_irq_vector(int irq); | 222 | extern int assign_irq_vector(int irq); |
diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h index 53f0e06672dc..4dfc9f5ed031 100644 --- a/include/asm-i386/kexec.h +++ b/include/asm-i386/kexec.h | |||
@@ -1,6 +1,26 @@ | |||
1 | #ifndef _I386_KEXEC_H | 1 | #ifndef _I386_KEXEC_H |
2 | #define _I386_KEXEC_H | 2 | #define _I386_KEXEC_H |
3 | 3 | ||
4 | #define PA_CONTROL_PAGE 0 | ||
5 | #define VA_CONTROL_PAGE 1 | ||
6 | #define PA_PGD 2 | ||
7 | #define VA_PGD 3 | ||
8 | #define PA_PTE_0 4 | ||
9 | #define VA_PTE_0 5 | ||
10 | #define PA_PTE_1 6 | ||
11 | #define VA_PTE_1 7 | ||
12 | #ifdef CONFIG_X86_PAE | ||
13 | #define PA_PMD_0 8 | ||
14 | #define VA_PMD_0 9 | ||
15 | #define PA_PMD_1 10 | ||
16 | #define VA_PMD_1 11 | ||
17 | #define PAGES_NR 12 | ||
18 | #else | ||
19 | #define PAGES_NR 8 | ||
20 | #endif | ||
21 | |||
22 | #ifndef __ASSEMBLY__ | ||
23 | |||
4 | #include <asm/fixmap.h> | 24 | #include <asm/fixmap.h> |
5 | #include <asm/ptrace.h> | 25 | #include <asm/ptrace.h> |
6 | #include <asm/string.h> | 26 | #include <asm/string.h> |
@@ -72,5 +92,12 @@ static inline void crash_setup_regs(struct pt_regs *newregs, | |||
72 | newregs->eip = (unsigned long)current_text_addr(); | 92 | newregs->eip = (unsigned long)current_text_addr(); |
73 | } | 93 | } |
74 | } | 94 | } |
95 | asmlinkage NORET_TYPE void | ||
96 | relocate_kernel(unsigned long indirection_page, | ||
97 | unsigned long control_page, | ||
98 | unsigned long start_address, | ||
99 | unsigned int has_pae) ATTRIB_NORET; | ||
100 | |||
101 | #endif /* __ASSEMBLY__ */ | ||
75 | 102 | ||
76 | #endif /* _I386_KEXEC_H */ | 103 | #endif /* _I386_KEXEC_H */ |
diff --git a/include/asm-i386/libata-portmap.h b/include/asm-i386/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-i386/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h index b5f3f0d0b2bc..26333685a7fb 100644 --- a/include/asm-i386/mach-es7000/mach_apic.h +++ b/include/asm-i386/mach-es7000/mach_apic.h | |||
@@ -123,9 +123,13 @@ extern u8 cpu_2_logical_apicid[]; | |||
123 | /* Mapping from cpu number to logical apicid */ | 123 | /* Mapping from cpu number to logical apicid */ |
124 | static inline int cpu_to_logical_apicid(int cpu) | 124 | static inline int cpu_to_logical_apicid(int cpu) |
125 | { | 125 | { |
126 | #ifdef CONFIG_SMP | ||
126 | if (cpu >= NR_CPUS) | 127 | if (cpu >= NR_CPUS) |
127 | return BAD_APICID; | 128 | return BAD_APICID; |
128 | return (int)cpu_2_logical_apicid[cpu]; | 129 | return (int)cpu_2_logical_apicid[cpu]; |
130 | #else | ||
131 | return logical_smp_processor_id(); | ||
132 | #endif | ||
129 | } | 133 | } |
130 | 134 | ||
131 | static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused) | 135 | static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused) |
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h index 9fd073286289..a81b05961595 100644 --- a/include/asm-i386/mach-summit/mach_apic.h +++ b/include/asm-i386/mach-summit/mach_apic.h | |||
@@ -46,10 +46,12 @@ extern u8 cpu_2_logical_apicid[]; | |||
46 | static inline void init_apic_ldr(void) | 46 | static inline void init_apic_ldr(void) |
47 | { | 47 | { |
48 | unsigned long val, id; | 48 | unsigned long val, id; |
49 | int i, count; | 49 | int count = 0; |
50 | u8 lid; | ||
51 | u8 my_id = (u8)hard_smp_processor_id(); | 50 | u8 my_id = (u8)hard_smp_processor_id(); |
52 | u8 my_cluster = (u8)apicid_cluster(my_id); | 51 | u8 my_cluster = (u8)apicid_cluster(my_id); |
52 | #ifdef CONFIG_SMP | ||
53 | u8 lid; | ||
54 | int i; | ||
53 | 55 | ||
54 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | 56 | /* Create logical APIC IDs by counting CPUs already in cluster. */ |
55 | for (count = 0, i = NR_CPUS; --i >= 0; ) { | 57 | for (count = 0, i = NR_CPUS; --i >= 0; ) { |
@@ -57,6 +59,7 @@ static inline void init_apic_ldr(void) | |||
57 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | 59 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) |
58 | ++count; | 60 | ++count; |
59 | } | 61 | } |
62 | #endif | ||
60 | /* We only have a 4 wide bitmap in cluster mode. If a deranged | 63 | /* We only have a 4 wide bitmap in cluster mode. If a deranged |
61 | * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */ | 64 | * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */ |
62 | BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT); | 65 | BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT); |
@@ -91,9 +94,13 @@ static inline int apicid_to_node(int logical_apicid) | |||
91 | /* Mapping from cpu number to logical apicid */ | 94 | /* Mapping from cpu number to logical apicid */ |
92 | static inline int cpu_to_logical_apicid(int cpu) | 95 | static inline int cpu_to_logical_apicid(int cpu) |
93 | { | 96 | { |
97 | #ifdef CONFIG_SMP | ||
94 | if (cpu >= NR_CPUS) | 98 | if (cpu >= NR_CPUS) |
95 | return BAD_APICID; | 99 | return BAD_APICID; |
96 | return (int)cpu_2_logical_apicid[cpu]; | 100 | return (int)cpu_2_logical_apicid[cpu]; |
101 | #else | ||
102 | return logical_smp_processor_id(); | ||
103 | #endif | ||
97 | } | 104 | } |
98 | 105 | ||
99 | static inline int cpu_present_to_apicid(int mps_cpu) | 106 | static inline int cpu_present_to_apicid(int mps_cpu) |
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 22cb07cc8f32..61b073322006 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h | |||
@@ -38,10 +38,16 @@ static inline void get_memcfg_numa(void) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | extern int early_pfn_to_nid(unsigned long pfn); | 40 | extern int early_pfn_to_nid(unsigned long pfn); |
41 | extern void numa_kva_reserve(void); | ||
41 | 42 | ||
42 | #else /* !CONFIG_NUMA */ | 43 | #else /* !CONFIG_NUMA */ |
44 | |||
43 | #define get_memcfg_numa get_memcfg_numa_flat | 45 | #define get_memcfg_numa get_memcfg_numa_flat |
44 | #define get_zholes_size(n) (0) | 46 | #define get_zholes_size(n) (0) |
47 | |||
48 | static inline void numa_kva_reserve(void) | ||
49 | { | ||
50 | } | ||
45 | #endif /* CONFIG_NUMA */ | 51 | #endif /* CONFIG_NUMA */ |
46 | 52 | ||
47 | #ifdef CONFIG_DISCONTIGMEM | 53 | #ifdef CONFIG_DISCONTIGMEM |
diff --git a/include/asm-i386/mutex.h b/include/asm-i386/mutex.h index 05a538531229..7a17d9e58ad6 100644 --- a/include/asm-i386/mutex.h +++ b/include/asm-i386/mutex.h | |||
@@ -30,14 +30,10 @@ do { \ | |||
30 | \ | 30 | \ |
31 | __asm__ __volatile__( \ | 31 | __asm__ __volatile__( \ |
32 | LOCK_PREFIX " decl (%%eax) \n" \ | 32 | LOCK_PREFIX " decl (%%eax) \n" \ |
33 | " js 2f \n" \ | 33 | " jns 1f \n" \ |
34 | " call "#fail_fn" \n" \ | ||
34 | "1: \n" \ | 35 | "1: \n" \ |
35 | \ | 36 | \ |
36 | LOCK_SECTION_START("") \ | ||
37 | "2: call "#fail_fn" \n" \ | ||
38 | " jmp 1b \n" \ | ||
39 | LOCK_SECTION_END \ | ||
40 | \ | ||
41 | :"=a" (dummy) \ | 37 | :"=a" (dummy) \ |
42 | : "a" (count) \ | 38 | : "a" (count) \ |
43 | : "memory", "ecx", "edx"); \ | 39 | : "memory", "ecx", "edx"); \ |
@@ -86,14 +82,10 @@ do { \ | |||
86 | \ | 82 | \ |
87 | __asm__ __volatile__( \ | 83 | __asm__ __volatile__( \ |
88 | LOCK_PREFIX " incl (%%eax) \n" \ | 84 | LOCK_PREFIX " incl (%%eax) \n" \ |
89 | " jle 2f \n" \ | 85 | " jg 1f \n" \ |
86 | " call "#fail_fn" \n" \ | ||
90 | "1: \n" \ | 87 | "1: \n" \ |
91 | \ | 88 | \ |
92 | LOCK_SECTION_START("") \ | ||
93 | "2: call "#fail_fn" \n" \ | ||
94 | " jmp 1b \n" \ | ||
95 | LOCK_SECTION_END \ | ||
96 | \ | ||
97 | :"=a" (dummy) \ | 89 | :"=a" (dummy) \ |
98 | : "a" (count) \ | 90 | : "a" (count) \ |
99 | : "memory", "ecx", "edx"); \ | 91 | : "memory", "ecx", "edx"); \ |
diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h index 67d994799999..303bcd4592bb 100644 --- a/include/asm-i386/nmi.h +++ b/include/asm-i386/nmi.h | |||
@@ -6,32 +6,29 @@ | |||
6 | 6 | ||
7 | #include <linux/pm.h> | 7 | #include <linux/pm.h> |
8 | 8 | ||
9 | struct pt_regs; | ||
10 | |||
11 | typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu); | ||
12 | |||
13 | /** | 9 | /** |
14 | * set_nmi_callback | 10 | * do_nmi_callback |
15 | * | 11 | * |
16 | * Set a handler for an NMI. Only one handler may be | 12 | * Check to see if a callback exists and execute it. Return 1 |
17 | * set. Return 1 if the NMI was handled. | 13 | * if the handler exists and was handled successfully. |
18 | */ | 14 | */ |
19 | void set_nmi_callback(nmi_callback_t callback); | 15 | int do_nmi_callback(struct pt_regs *regs, int cpu); |
20 | 16 | ||
21 | /** | 17 | extern int nmi_watchdog_enabled; |
22 | * unset_nmi_callback | 18 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); |
23 | * | 19 | extern int avail_to_resrv_perfctr_nmi(unsigned int); |
24 | * Remove the handler previously set. | 20 | extern int reserve_perfctr_nmi(unsigned int); |
25 | */ | 21 | extern void release_perfctr_nmi(unsigned int); |
26 | void unset_nmi_callback(void); | 22 | extern int reserve_evntsel_nmi(unsigned int); |
27 | 23 | extern void release_evntsel_nmi(unsigned int); | |
28 | extern void setup_apic_nmi_watchdog (void); | 24 | |
29 | extern int reserve_lapic_nmi(void); | 25 | extern void setup_apic_nmi_watchdog (void *); |
30 | extern void release_lapic_nmi(void); | 26 | extern void stop_apic_nmi_watchdog (void *); |
31 | extern void disable_timer_nmi_watchdog(void); | 27 | extern void disable_timer_nmi_watchdog(void); |
32 | extern void enable_timer_nmi_watchdog(void); | 28 | extern void enable_timer_nmi_watchdog(void); |
33 | extern void nmi_watchdog_tick (struct pt_regs * regs); | 29 | extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); |
34 | 30 | ||
31 | extern atomic_t nmi_active; | ||
35 | extern unsigned int nmi_watchdog; | 32 | extern unsigned int nmi_watchdog; |
36 | #define NMI_DEFAULT -1 | 33 | #define NMI_DEFAULT -1 |
37 | #define NMI_NONE 0 | 34 | #define NMI_NONE 0 |
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h index 2756d4b04c27..201c86a6711e 100644 --- a/include/asm-i386/pgtable-2level.h +++ b/include/asm-i386/pgtable-2level.h | |||
@@ -21,8 +21,9 @@ | |||
21 | #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) | 21 | #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) |
22 | #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) | 22 | #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) |
23 | 23 | ||
24 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | ||
24 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte_low, 0)) | 25 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte_low, 0)) |
25 | #define pte_same(a, b) ((a).pte_low == (b).pte_low) | 26 | |
26 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 27 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
27 | #define pte_none(x) (!(x).pte_low) | 28 | #define pte_none(x) (!(x).pte_low) |
28 | #define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) | 29 | #define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) |
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h index dccb1b3337ad..0d899173232e 100644 --- a/include/asm-i386/pgtable-3level.h +++ b/include/asm-i386/pgtable-3level.h | |||
@@ -77,7 +77,7 @@ static inline void pud_clear (pud_t * pud) { } | |||
77 | #define pud_page(pud) \ | 77 | #define pud_page(pud) \ |
78 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) | 78 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) |
79 | 79 | ||
80 | #define pud_page_kernel(pud) \ | 80 | #define pud_page_vaddr(pud) \ |
81 | ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) | 81 | ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) |
82 | 82 | ||
83 | 83 | ||
@@ -105,6 +105,7 @@ static inline void pmd_clear(pmd_t *pmd) | |||
105 | *(tmp + 1) = 0; | 105 | *(tmp + 1) = 0; |
106 | } | 106 | } |
107 | 107 | ||
108 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | ||
108 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 109 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
109 | { | 110 | { |
110 | pte_t res; | 111 | pte_t res; |
@@ -117,6 +118,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | |||
117 | return res; | 118 | return res; |
118 | } | 119 | } |
119 | 120 | ||
121 | #define __HAVE_ARCH_PTE_SAME | ||
120 | static inline int pte_same(pte_t a, pte_t b) | 122 | static inline int pte_same(pte_t a, pte_t b) |
121 | { | 123 | { |
122 | return a.pte_low == b.pte_low && a.pte_high == b.pte_high; | 124 | return a.pte_low == b.pte_low && a.pte_high == b.pte_high; |
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 09697fec3d2b..541b3e234335 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h | |||
@@ -246,6 +246,23 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p | |||
246 | # include <asm/pgtable-2level.h> | 246 | # include <asm/pgtable-2level.h> |
247 | #endif | 247 | #endif |
248 | 248 | ||
249 | /* | ||
250 | * We only update the dirty/accessed state if we set | ||
251 | * the dirty bit by hand in the kernel, since the hardware | ||
252 | * will do the accessed bit for us, and we don't want to | ||
253 | * race with other CPU's that might be updating the dirty | ||
254 | * bit at the same time. | ||
255 | */ | ||
256 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | ||
257 | #define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ | ||
258 | do { \ | ||
259 | if (dirty) { \ | ||
260 | (ptep)->pte_low = (entry).pte_low; \ | ||
261 | flush_tlb_page(vma, address); \ | ||
262 | } \ | ||
263 | } while (0) | ||
264 | |||
265 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | ||
249 | static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) | 266 | static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) |
250 | { | 267 | { |
251 | if (!pte_dirty(*ptep)) | 268 | if (!pte_dirty(*ptep)) |
@@ -253,6 +270,7 @@ static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned | |||
253 | return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); | 270 | return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); |
254 | } | 271 | } |
255 | 272 | ||
273 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | ||
256 | static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) | 274 | static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) |
257 | { | 275 | { |
258 | if (!pte_young(*ptep)) | 276 | if (!pte_young(*ptep)) |
@@ -260,6 +278,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned | |||
260 | return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); | 278 | return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); |
261 | } | 279 | } |
262 | 280 | ||
281 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL | ||
263 | static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) | 282 | static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) |
264 | { | 283 | { |
265 | pte_t pte; | 284 | pte_t pte; |
@@ -272,6 +291,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long | |||
272 | return pte; | 291 | return pte; |
273 | } | 292 | } |
274 | 293 | ||
294 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | ||
275 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 295 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
276 | { | 296 | { |
277 | clear_bit(_PAGE_BIT_RW, &ptep->pte_low); | 297 | clear_bit(_PAGE_BIT_RW, &ptep->pte_low); |
@@ -364,11 +384,11 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
364 | #define pte_index(address) \ | 384 | #define pte_index(address) \ |
365 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 385 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
366 | #define pte_offset_kernel(dir, address) \ | 386 | #define pte_offset_kernel(dir, address) \ |
367 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 387 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
368 | 388 | ||
369 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 389 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
370 | 390 | ||
371 | #define pmd_page_kernel(pmd) \ | 391 | #define pmd_page_vaddr(pmd) \ |
372 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 392 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
373 | 393 | ||
374 | /* | 394 | /* |
@@ -391,8 +411,6 @@ extern pte_t *lookup_address(unsigned long address); | |||
391 | static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} | 411 | static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} |
392 | #endif | 412 | #endif |
393 | 413 | ||
394 | extern void noexec_setup(const char *str); | ||
395 | |||
396 | #if defined(CONFIG_HIGHPTE) | 414 | #if defined(CONFIG_HIGHPTE) |
397 | #define pte_offset_map(dir, address) \ | 415 | #define pte_offset_map(dir, address) \ |
398 | ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) | 416 | ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) |
@@ -411,23 +429,8 @@ extern void noexec_setup(const char *str); | |||
411 | /* | 429 | /* |
412 | * The i386 doesn't have any external MMU info: the kernel page | 430 | * The i386 doesn't have any external MMU info: the kernel page |
413 | * tables contain all the necessary information. | 431 | * tables contain all the necessary information. |
414 | * | ||
415 | * Also, we only update the dirty/accessed state if we set | ||
416 | * the dirty bit by hand in the kernel, since the hardware | ||
417 | * will do the accessed bit for us, and we don't want to | ||
418 | * race with other CPU's that might be updating the dirty | ||
419 | * bit at the same time. | ||
420 | */ | 432 | */ |
421 | #define update_mmu_cache(vma,address,pte) do { } while (0) | 433 | #define update_mmu_cache(vma,address,pte) do { } while (0) |
422 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | ||
423 | #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ | ||
424 | do { \ | ||
425 | if (__dirty) { \ | ||
426 | (__ptep)->pte_low = (__entry).pte_low; \ | ||
427 | flush_tlb_page(__vma, __address); \ | ||
428 | } \ | ||
429 | } while (0) | ||
430 | |||
431 | #endif /* !__ASSEMBLY__ */ | 434 | #endif /* !__ASSEMBLY__ */ |
432 | 435 | ||
433 | #ifdef CONFIG_FLATMEM | 436 | #ifdef CONFIG_FLATMEM |
@@ -441,12 +444,6 @@ extern void noexec_setup(const char *str); | |||
441 | #define GET_IOSPACE(pfn) 0 | 444 | #define GET_IOSPACE(pfn) 0 |
442 | #define GET_PFN(pfn) (pfn) | 445 | #define GET_PFN(pfn) (pfn) |
443 | 446 | ||
444 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | ||
445 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | ||
446 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | ||
447 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL | ||
448 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | ||
449 | #define __HAVE_ARCH_PTE_SAME | ||
450 | #include <asm-generic/pgtable.h> | 447 | #include <asm-generic/pgtable.h> |
451 | 448 | ||
452 | #endif /* _I386_PGTABLE_H */ | 449 | #endif /* _I386_PGTABLE_H */ |
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index b32346d62e10..2277127696d2 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
@@ -143,6 +143,18 @@ static inline void detect_ht(struct cpuinfo_x86 *c) {} | |||
143 | #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ | 143 | #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ |
144 | #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ | 144 | #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ |
145 | 145 | ||
146 | static inline void __cpuid(unsigned int *eax, unsigned int *ebx, | ||
147 | unsigned int *ecx, unsigned int *edx) | ||
148 | { | ||
149 | /* ecx is often an input as well as an output. */ | ||
150 | __asm__("cpuid" | ||
151 | : "=a" (*eax), | ||
152 | "=b" (*ebx), | ||
153 | "=c" (*ecx), | ||
154 | "=d" (*edx) | ||
155 | : "0" (*eax), "2" (*ecx)); | ||
156 | } | ||
157 | |||
146 | /* | 158 | /* |
147 | * Generic CPUID function | 159 | * Generic CPUID function |
148 | * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx | 160 | * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx |
@@ -150,24 +162,18 @@ static inline void detect_ht(struct cpuinfo_x86 *c) {} | |||
150 | */ | 162 | */ |
151 | static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) | 163 | static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) |
152 | { | 164 | { |
153 | __asm__("cpuid" | 165 | *eax = op; |
154 | : "=a" (*eax), | 166 | *ecx = 0; |
155 | "=b" (*ebx), | 167 | __cpuid(eax, ebx, ecx, edx); |
156 | "=c" (*ecx), | ||
157 | "=d" (*edx) | ||
158 | : "0" (op), "c"(0)); | ||
159 | } | 168 | } |
160 | 169 | ||
161 | /* Some CPUID calls want 'count' to be placed in ecx */ | 170 | /* Some CPUID calls want 'count' to be placed in ecx */ |
162 | static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, | 171 | static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, |
163 | int *edx) | 172 | int *edx) |
164 | { | 173 | { |
165 | __asm__("cpuid" | 174 | *eax = op; |
166 | : "=a" (*eax), | 175 | *ecx = count; |
167 | "=b" (*ebx), | 176 | __cpuid(eax, ebx, ecx, edx); |
168 | "=c" (*ecx), | ||
169 | "=d" (*edx) | ||
170 | : "0" (op), "c" (count)); | ||
171 | } | 177 | } |
172 | 178 | ||
173 | /* | 179 | /* |
@@ -175,42 +181,30 @@ static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, | |||
175 | */ | 181 | */ |
176 | static inline unsigned int cpuid_eax(unsigned int op) | 182 | static inline unsigned int cpuid_eax(unsigned int op) |
177 | { | 183 | { |
178 | unsigned int eax; | 184 | unsigned int eax, ebx, ecx, edx; |
179 | 185 | ||
180 | __asm__("cpuid" | 186 | cpuid(op, &eax, &ebx, &ecx, &edx); |
181 | : "=a" (eax) | ||
182 | : "0" (op) | ||
183 | : "bx", "cx", "dx"); | ||
184 | return eax; | 187 | return eax; |
185 | } | 188 | } |
186 | static inline unsigned int cpuid_ebx(unsigned int op) | 189 | static inline unsigned int cpuid_ebx(unsigned int op) |
187 | { | 190 | { |
188 | unsigned int eax, ebx; | 191 | unsigned int eax, ebx, ecx, edx; |
189 | 192 | ||
190 | __asm__("cpuid" | 193 | cpuid(op, &eax, &ebx, &ecx, &edx); |
191 | : "=a" (eax), "=b" (ebx) | ||
192 | : "0" (op) | ||
193 | : "cx", "dx" ); | ||
194 | return ebx; | 194 | return ebx; |
195 | } | 195 | } |
196 | static inline unsigned int cpuid_ecx(unsigned int op) | 196 | static inline unsigned int cpuid_ecx(unsigned int op) |
197 | { | 197 | { |
198 | unsigned int eax, ecx; | 198 | unsigned int eax, ebx, ecx, edx; |
199 | 199 | ||
200 | __asm__("cpuid" | 200 | cpuid(op, &eax, &ebx, &ecx, &edx); |
201 | : "=a" (eax), "=c" (ecx) | ||
202 | : "0" (op) | ||
203 | : "bx", "dx" ); | ||
204 | return ecx; | 201 | return ecx; |
205 | } | 202 | } |
206 | static inline unsigned int cpuid_edx(unsigned int op) | 203 | static inline unsigned int cpuid_edx(unsigned int op) |
207 | { | 204 | { |
208 | unsigned int eax, edx; | 205 | unsigned int eax, ebx, ecx, edx; |
209 | 206 | ||
210 | __asm__("cpuid" | 207 | cpuid(op, &eax, &ebx, &ecx, &edx); |
211 | : "=a" (eax), "=d" (edx) | ||
212 | : "0" (op) | ||
213 | : "bx", "cx"); | ||
214 | return edx; | 208 | return edx; |
215 | } | 209 | } |
216 | 210 | ||
diff --git a/include/asm-i386/ptrace-abi.h b/include/asm-i386/ptrace-abi.h new file mode 100644 index 000000000000..a44901817a26 --- /dev/null +++ b/include/asm-i386/ptrace-abi.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef I386_PTRACE_ABI_H | ||
2 | #define I386_PTRACE_ABI_H | ||
3 | |||
4 | #define EBX 0 | ||
5 | #define ECX 1 | ||
6 | #define EDX 2 | ||
7 | #define ESI 3 | ||
8 | #define EDI 4 | ||
9 | #define EBP 5 | ||
10 | #define EAX 6 | ||
11 | #define DS 7 | ||
12 | #define ES 8 | ||
13 | #define FS 9 | ||
14 | #define GS 10 | ||
15 | #define ORIG_EAX 11 | ||
16 | #define EIP 12 | ||
17 | #define CS 13 | ||
18 | #define EFL 14 | ||
19 | #define UESP 15 | ||
20 | #define SS 16 | ||
21 | #define FRAME_SIZE 17 | ||
22 | |||
23 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
24 | #define PTRACE_GETREGS 12 | ||
25 | #define PTRACE_SETREGS 13 | ||
26 | #define PTRACE_GETFPREGS 14 | ||
27 | #define PTRACE_SETFPREGS 15 | ||
28 | #define PTRACE_GETFPXREGS 18 | ||
29 | #define PTRACE_SETFPXREGS 19 | ||
30 | |||
31 | #define PTRACE_OLDSETOPTIONS 21 | ||
32 | |||
33 | #define PTRACE_GET_THREAD_AREA 25 | ||
34 | #define PTRACE_SET_THREAD_AREA 26 | ||
35 | |||
36 | #define PTRACE_SYSEMU 31 | ||
37 | #define PTRACE_SYSEMU_SINGLESTEP 32 | ||
38 | |||
39 | #endif | ||
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h index f324c53b6f9a..a4a0e5207db5 100644 --- a/include/asm-i386/ptrace.h +++ b/include/asm-i386/ptrace.h | |||
@@ -1,24 +1,7 @@ | |||
1 | #ifndef _I386_PTRACE_H | 1 | #ifndef _I386_PTRACE_H |
2 | #define _I386_PTRACE_H | 2 | #define _I386_PTRACE_H |
3 | 3 | ||
4 | #define EBX 0 | 4 | #include <asm/ptrace-abi.h> |
5 | #define ECX 1 | ||
6 | #define EDX 2 | ||
7 | #define ESI 3 | ||
8 | #define EDI 4 | ||
9 | #define EBP 5 | ||
10 | #define EAX 6 | ||
11 | #define DS 7 | ||
12 | #define ES 8 | ||
13 | #define FS 9 | ||
14 | #define GS 10 | ||
15 | #define ORIG_EAX 11 | ||
16 | #define EIP 12 | ||
17 | #define CS 13 | ||
18 | #define EFL 14 | ||
19 | #define UESP 15 | ||
20 | #define SS 16 | ||
21 | #define FRAME_SIZE 17 | ||
22 | 5 | ||
23 | /* this struct defines the way the registers are stored on the | 6 | /* this struct defines the way the registers are stored on the |
24 | stack during a system call. */ | 7 | stack during a system call. */ |
@@ -41,25 +24,10 @@ struct pt_regs { | |||
41 | int xss; | 24 | int xss; |
42 | }; | 25 | }; |
43 | 26 | ||
44 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
45 | #define PTRACE_GETREGS 12 | ||
46 | #define PTRACE_SETREGS 13 | ||
47 | #define PTRACE_GETFPREGS 14 | ||
48 | #define PTRACE_SETFPREGS 15 | ||
49 | #define PTRACE_GETFPXREGS 18 | ||
50 | #define PTRACE_SETFPXREGS 19 | ||
51 | |||
52 | #define PTRACE_OLDSETOPTIONS 21 | ||
53 | |||
54 | #define PTRACE_GET_THREAD_AREA 25 | ||
55 | #define PTRACE_SET_THREAD_AREA 26 | ||
56 | |||
57 | #define PTRACE_SYSEMU 31 | ||
58 | #define PTRACE_SYSEMU_SINGLESTEP 32 | ||
59 | |||
60 | #ifdef __KERNEL__ | 27 | #ifdef __KERNEL__ |
61 | 28 | ||
62 | #include <asm/vm86.h> | 29 | #include <asm/vm86.h> |
30 | #include <asm/segment.h> | ||
63 | 31 | ||
64 | struct task_struct; | 32 | struct task_struct; |
65 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); | 33 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); |
@@ -73,18 +41,14 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int erro | |||
73 | */ | 41 | */ |
74 | static inline int user_mode(struct pt_regs *regs) | 42 | static inline int user_mode(struct pt_regs *regs) |
75 | { | 43 | { |
76 | return (regs->xcs & 3) != 0; | 44 | return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL; |
77 | } | 45 | } |
78 | static inline int user_mode_vm(struct pt_regs *regs) | 46 | static inline int user_mode_vm(struct pt_regs *regs) |
79 | { | 47 | { |
80 | return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0; | 48 | return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; |
81 | } | 49 | } |
82 | #define instruction_pointer(regs) ((regs)->eip) | 50 | #define instruction_pointer(regs) ((regs)->eip) |
83 | #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) | ||
84 | extern unsigned long profile_pc(struct pt_regs *regs); | 51 | extern unsigned long profile_pc(struct pt_regs *regs); |
85 | #else | ||
86 | #define profile_pc(regs) instruction_pointer(regs) | ||
87 | #endif | ||
88 | #endif /* __KERNEL__ */ | 52 | #endif /* __KERNEL__ */ |
89 | 53 | ||
90 | #endif | 54 | #endif |
diff --git a/include/asm-i386/rwlock.h b/include/asm-i386/rwlock.h index 87c069ccba08..c3e5db32fa48 100644 --- a/include/asm-i386/rwlock.h +++ b/include/asm-i386/rwlock.h | |||
@@ -20,52 +20,6 @@ | |||
20 | #define RW_LOCK_BIAS 0x01000000 | 20 | #define RW_LOCK_BIAS 0x01000000 |
21 | #define RW_LOCK_BIAS_STR "0x01000000" | 21 | #define RW_LOCK_BIAS_STR "0x01000000" |
22 | 22 | ||
23 | #define __build_read_lock_ptr(rw, helper) \ | 23 | /* Code is in asm-i386/spinlock.h */ |
24 | asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t" \ | ||
25 | "jns 1f\n" \ | ||
26 | "call " helper "\n\t" \ | ||
27 | "1:\n" \ | ||
28 | ::"a" (rw) : "memory") | ||
29 | |||
30 | #define __build_read_lock_const(rw, helper) \ | ||
31 | asm volatile(LOCK_PREFIX " subl $1,%0\n\t" \ | ||
32 | "jns 1f\n" \ | ||
33 | "pushl %%eax\n\t" \ | ||
34 | "leal %0,%%eax\n\t" \ | ||
35 | "call " helper "\n\t" \ | ||
36 | "popl %%eax\n\t" \ | ||
37 | "1:\n" \ | ||
38 | :"+m" (*(volatile int *)rw) : : "memory") | ||
39 | |||
40 | #define __build_read_lock(rw, helper) do { \ | ||
41 | if (__builtin_constant_p(rw)) \ | ||
42 | __build_read_lock_const(rw, helper); \ | ||
43 | else \ | ||
44 | __build_read_lock_ptr(rw, helper); \ | ||
45 | } while (0) | ||
46 | |||
47 | #define __build_write_lock_ptr(rw, helper) \ | ||
48 | asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ | ||
49 | "jz 1f\n" \ | ||
50 | "call " helper "\n\t" \ | ||
51 | "1:\n" \ | ||
52 | ::"a" (rw) : "memory") | ||
53 | |||
54 | #define __build_write_lock_const(rw, helper) \ | ||
55 | asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ | ||
56 | "jz 1f\n" \ | ||
57 | "pushl %%eax\n\t" \ | ||
58 | "leal %0,%%eax\n\t" \ | ||
59 | "call " helper "\n\t" \ | ||
60 | "popl %%eax\n\t" \ | ||
61 | "1:\n" \ | ||
62 | :"+m" (*(volatile int *)rw) : : "memory") | ||
63 | |||
64 | #define __build_write_lock(rw, helper) do { \ | ||
65 | if (__builtin_constant_p(rw)) \ | ||
66 | __build_write_lock_const(rw, helper); \ | ||
67 | else \ | ||
68 | __build_write_lock_ptr(rw, helper); \ | ||
69 | } while (0) | ||
70 | 24 | ||
71 | #endif | 25 | #endif |
diff --git a/include/asm-i386/rwsem.h b/include/asm-i386/rwsem.h index 43113f5608eb..bc598d6388e3 100644 --- a/include/asm-i386/rwsem.h +++ b/include/asm-i386/rwsem.h | |||
@@ -99,17 +99,9 @@ static inline void __down_read(struct rw_semaphore *sem) | |||
99 | __asm__ __volatile__( | 99 | __asm__ __volatile__( |
100 | "# beginning down_read\n\t" | 100 | "# beginning down_read\n\t" |
101 | LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ | 101 | LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ |
102 | " js 2f\n\t" /* jump if we weren't granted the lock */ | 102 | " jns 1f\n" |
103 | " call call_rwsem_down_read_failed\n" | ||
103 | "1:\n\t" | 104 | "1:\n\t" |
104 | LOCK_SECTION_START("") | ||
105 | "2:\n\t" | ||
106 | " pushl %%ecx\n\t" | ||
107 | " pushl %%edx\n\t" | ||
108 | " call rwsem_down_read_failed\n\t" | ||
109 | " popl %%edx\n\t" | ||
110 | " popl %%ecx\n\t" | ||
111 | " jmp 1b\n" | ||
112 | LOCK_SECTION_END | ||
113 | "# ending down_read\n\t" | 105 | "# ending down_read\n\t" |
114 | : "+m" (sem->count) | 106 | : "+m" (sem->count) |
115 | : "a" (sem) | 107 | : "a" (sem) |
@@ -151,15 +143,9 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) | |||
151 | "# beginning down_write\n\t" | 143 | "# beginning down_write\n\t" |
152 | LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ | 144 | LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ |
153 | " testl %%edx,%%edx\n\t" /* was the count 0 before? */ | 145 | " testl %%edx,%%edx\n\t" /* was the count 0 before? */ |
154 | " jnz 2f\n\t" /* jump if we weren't granted the lock */ | 146 | " jz 1f\n" |
155 | "1:\n\t" | 147 | " call call_rwsem_down_write_failed\n" |
156 | LOCK_SECTION_START("") | 148 | "1:\n" |
157 | "2:\n\t" | ||
158 | " pushl %%ecx\n\t" | ||
159 | " call rwsem_down_write_failed\n\t" | ||
160 | " popl %%ecx\n\t" | ||
161 | " jmp 1b\n" | ||
162 | LOCK_SECTION_END | ||
163 | "# ending down_write" | 149 | "# ending down_write" |
164 | : "+m" (sem->count), "=d" (tmp) | 150 | : "+m" (sem->count), "=d" (tmp) |
165 | : "a" (sem), "1" (tmp) | 151 | : "a" (sem), "1" (tmp) |
@@ -193,17 +179,9 @@ static inline void __up_read(struct rw_semaphore *sem) | |||
193 | __asm__ __volatile__( | 179 | __asm__ __volatile__( |
194 | "# beginning __up_read\n\t" | 180 | "# beginning __up_read\n\t" |
195 | LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ | 181 | LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ |
196 | " js 2f\n\t" /* jump if the lock is being waited upon */ | 182 | " jns 1f\n\t" |
197 | "1:\n\t" | 183 | " call call_rwsem_wake\n" |
198 | LOCK_SECTION_START("") | 184 | "1:\n" |
199 | "2:\n\t" | ||
200 | " decw %%dx\n\t" /* do nothing if still outstanding active readers */ | ||
201 | " jnz 1b\n\t" | ||
202 | " pushl %%ecx\n\t" | ||
203 | " call rwsem_wake\n\t" | ||
204 | " popl %%ecx\n\t" | ||
205 | " jmp 1b\n" | ||
206 | LOCK_SECTION_END | ||
207 | "# ending __up_read\n" | 185 | "# ending __up_read\n" |
208 | : "+m" (sem->count), "=d" (tmp) | 186 | : "+m" (sem->count), "=d" (tmp) |
209 | : "a" (sem), "1" (tmp) | 187 | : "a" (sem), "1" (tmp) |
@@ -219,17 +197,9 @@ static inline void __up_write(struct rw_semaphore *sem) | |||
219 | "# beginning __up_write\n\t" | 197 | "# beginning __up_write\n\t" |
220 | " movl %2,%%edx\n\t" | 198 | " movl %2,%%edx\n\t" |
221 | LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ | 199 | LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ |
222 | " jnz 2f\n\t" /* jump if the lock is being waited upon */ | 200 | " jz 1f\n" |
201 | " call call_rwsem_wake\n" | ||
223 | "1:\n\t" | 202 | "1:\n\t" |
224 | LOCK_SECTION_START("") | ||
225 | "2:\n\t" | ||
226 | " decw %%dx\n\t" /* did the active count reduce to 0? */ | ||
227 | " jnz 1b\n\t" /* jump back if not */ | ||
228 | " pushl %%ecx\n\t" | ||
229 | " call rwsem_wake\n\t" | ||
230 | " popl %%ecx\n\t" | ||
231 | " jmp 1b\n" | ||
232 | LOCK_SECTION_END | ||
233 | "# ending __up_write\n" | 203 | "# ending __up_write\n" |
234 | : "+m" (sem->count) | 204 | : "+m" (sem->count) |
235 | : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS) | 205 | : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS) |
@@ -244,17 +214,9 @@ static inline void __downgrade_write(struct rw_semaphore *sem) | |||
244 | __asm__ __volatile__( | 214 | __asm__ __volatile__( |
245 | "# beginning __downgrade_write\n\t" | 215 | "# beginning __downgrade_write\n\t" |
246 | LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ | 216 | LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ |
247 | " js 2f\n\t" /* jump if the lock is being waited upon */ | 217 | " jns 1f\n\t" |
218 | " call call_rwsem_downgrade_wake\n" | ||
248 | "1:\n\t" | 219 | "1:\n\t" |
249 | LOCK_SECTION_START("") | ||
250 | "2:\n\t" | ||
251 | " pushl %%ecx\n\t" | ||
252 | " pushl %%edx\n\t" | ||
253 | " call rwsem_downgrade_wake\n\t" | ||
254 | " popl %%edx\n\t" | ||
255 | " popl %%ecx\n\t" | ||
256 | " jmp 1b\n" | ||
257 | LOCK_SECTION_END | ||
258 | "# ending __downgrade_write\n" | 220 | "# ending __downgrade_write\n" |
259 | : "+m" (sem->count) | 221 | : "+m" (sem->count) |
260 | : "a" (sem), "i" (-RWSEM_WAITING_BIAS) | 222 | : "a" (sem), "i" (-RWSEM_WAITING_BIAS) |
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h index faf995307b9e..b7ab59685ba7 100644 --- a/include/asm-i386/segment.h +++ b/include/asm-i386/segment.h | |||
@@ -83,6 +83,11 @@ | |||
83 | 83 | ||
84 | #define GDT_SIZE (GDT_ENTRIES * 8) | 84 | #define GDT_SIZE (GDT_ENTRIES * 8) |
85 | 85 | ||
86 | /* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */ | ||
87 | #define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8) | ||
88 | /* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */ | ||
89 | #define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8) | ||
90 | |||
86 | /* Simple and small GDT entries for booting only */ | 91 | /* Simple and small GDT entries for booting only */ |
87 | 92 | ||
88 | #define GDT_ENTRY_BOOT_CS 2 | 93 | #define GDT_ENTRY_BOOT_CS 2 |
@@ -112,4 +117,16 @@ | |||
112 | */ | 117 | */ |
113 | #define IDT_ENTRIES 256 | 118 | #define IDT_ENTRIES 256 |
114 | 119 | ||
120 | /* Bottom two bits of selector give the ring privilege level */ | ||
121 | #define SEGMENT_RPL_MASK 0x3 | ||
122 | /* Bit 2 is table indicator (LDT/GDT) */ | ||
123 | #define SEGMENT_TI_MASK 0x4 | ||
124 | |||
125 | /* User mode is privilege level 3 */ | ||
126 | #define USER_RPL 0x3 | ||
127 | /* LDT segment has TI set, GDT has it cleared */ | ||
128 | #define SEGMENT_LDT 0x4 | ||
129 | #define SEGMENT_GDT 0x0 | ||
130 | |||
131 | #define get_kernel_rpl() 0 | ||
115 | #endif | 132 | #endif |
diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h index d51e800acf29..4e34a468c383 100644 --- a/include/asm-i386/semaphore.h +++ b/include/asm-i386/semaphore.h | |||
@@ -100,13 +100,10 @@ static inline void down(struct semaphore * sem) | |||
100 | __asm__ __volatile__( | 100 | __asm__ __volatile__( |
101 | "# atomic down operation\n\t" | 101 | "# atomic down operation\n\t" |
102 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ | 102 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ |
103 | "js 2f\n" | 103 | "jns 2f\n" |
104 | "1:\n" | 104 | "\tlea %0,%%eax\n\t" |
105 | LOCK_SECTION_START("") | 105 | "call __down_failed\n" |
106 | "2:\tlea %0,%%eax\n\t" | 106 | "2:" |
107 | "call __down_failed\n\t" | ||
108 | "jmp 1b\n" | ||
109 | LOCK_SECTION_END | ||
110 | :"+m" (sem->count) | 107 | :"+m" (sem->count) |
111 | : | 108 | : |
112 | :"memory","ax"); | 109 | :"memory","ax"); |
@@ -123,16 +120,13 @@ static inline int down_interruptible(struct semaphore * sem) | |||
123 | might_sleep(); | 120 | might_sleep(); |
124 | __asm__ __volatile__( | 121 | __asm__ __volatile__( |
125 | "# atomic interruptible down operation\n\t" | 122 | "# atomic interruptible down operation\n\t" |
123 | "xorl %0,%0\n\t" | ||
126 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 124 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
127 | "js 2f\n\t" | 125 | "jns 2f\n\t" |
128 | "xorl %0,%0\n" | 126 | "lea %1,%%eax\n\t" |
129 | "1:\n" | 127 | "call __down_failed_interruptible\n" |
130 | LOCK_SECTION_START("") | 128 | "2:" |
131 | "2:\tlea %1,%%eax\n\t" | 129 | :"=&a" (result), "+m" (sem->count) |
132 | "call __down_failed_interruptible\n\t" | ||
133 | "jmp 1b\n" | ||
134 | LOCK_SECTION_END | ||
135 | :"=a" (result), "+m" (sem->count) | ||
136 | : | 130 | : |
137 | :"memory"); | 131 | :"memory"); |
138 | return result; | 132 | return result; |
@@ -148,16 +142,13 @@ static inline int down_trylock(struct semaphore * sem) | |||
148 | 142 | ||
149 | __asm__ __volatile__( | 143 | __asm__ __volatile__( |
150 | "# atomic interruptible down operation\n\t" | 144 | "# atomic interruptible down operation\n\t" |
145 | "xorl %0,%0\n\t" | ||
151 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 146 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
152 | "js 2f\n\t" | 147 | "jns 2f\n\t" |
153 | "xorl %0,%0\n" | 148 | "lea %1,%%eax\n\t" |
154 | "1:\n" | ||
155 | LOCK_SECTION_START("") | ||
156 | "2:\tlea %1,%%eax\n\t" | ||
157 | "call __down_failed_trylock\n\t" | 149 | "call __down_failed_trylock\n\t" |
158 | "jmp 1b\n" | 150 | "2:\n" |
159 | LOCK_SECTION_END | 151 | :"=&a" (result), "+m" (sem->count) |
160 | :"=a" (result), "+m" (sem->count) | ||
161 | : | 152 | : |
162 | :"memory"); | 153 | :"memory"); |
163 | return result; | 154 | return result; |
@@ -166,22 +157,16 @@ static inline int down_trylock(struct semaphore * sem) | |||
166 | /* | 157 | /* |
167 | * Note! This is subtle. We jump to wake people up only if | 158 | * Note! This is subtle. We jump to wake people up only if |
168 | * the semaphore was negative (== somebody was waiting on it). | 159 | * the semaphore was negative (== somebody was waiting on it). |
169 | * The default case (no contention) will result in NO | ||
170 | * jumps for both down() and up(). | ||
171 | */ | 160 | */ |
172 | static inline void up(struct semaphore * sem) | 161 | static inline void up(struct semaphore * sem) |
173 | { | 162 | { |
174 | __asm__ __volatile__( | 163 | __asm__ __volatile__( |
175 | "# atomic up operation\n\t" | 164 | "# atomic up operation\n\t" |
176 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ | 165 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ |
177 | "jle 2f\n" | 166 | "jg 1f\n\t" |
178 | "1:\n" | 167 | "lea %0,%%eax\n\t" |
179 | LOCK_SECTION_START("") | 168 | "call __up_wakeup\n" |
180 | "2:\tlea %0,%%eax\n\t" | 169 | "1:" |
181 | "call __up_wakeup\n\t" | ||
182 | "jmp 1b\n" | ||
183 | LOCK_SECTION_END | ||
184 | ".subsection 0\n" | ||
185 | :"+m" (sem->count) | 170 | :"+m" (sem->count) |
186 | : | 171 | : |
187 | :"memory","ax"); | 172 | :"memory","ax"); |
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 142d10e34ade..32ac8c91d5c5 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h | |||
@@ -80,17 +80,12 @@ static inline int hard_smp_processor_id(void) | |||
80 | return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); | 80 | return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); |
81 | } | 81 | } |
82 | #endif | 82 | #endif |
83 | |||
84 | static __inline int logical_smp_processor_id(void) | ||
85 | { | ||
86 | /* we don't want to mark this access volatile - bad code generation */ | ||
87 | return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); | ||
88 | } | ||
89 | |||
90 | #endif | 83 | #endif |
91 | 84 | ||
92 | extern int __cpu_disable(void); | 85 | extern int __cpu_disable(void); |
93 | extern void __cpu_die(unsigned int cpu); | 86 | extern void __cpu_die(unsigned int cpu); |
87 | extern unsigned int num_processors; | ||
88 | |||
94 | #endif /* !__ASSEMBLY__ */ | 89 | #endif /* !__ASSEMBLY__ */ |
95 | 90 | ||
96 | #else /* CONFIG_SMP */ | 91 | #else /* CONFIG_SMP */ |
@@ -100,4 +95,15 @@ extern void __cpu_die(unsigned int cpu); | |||
100 | #define NO_PROC_ID 0xFF /* No processor magic marker */ | 95 | #define NO_PROC_ID 0xFF /* No processor magic marker */ |
101 | 96 | ||
102 | #endif | 97 | #endif |
98 | |||
99 | #ifndef __ASSEMBLY__ | ||
100 | #ifdef CONFIG_X86_LOCAL_APIC | ||
101 | static __inline int logical_smp_processor_id(void) | ||
102 | { | ||
103 | /* we don't want to mark this access volatile - bad code generation */ | ||
104 | return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); | ||
105 | } | ||
106 | #endif | ||
107 | #endif | ||
108 | |||
103 | #endif | 109 | #endif |
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index d1020363c41a..b0b3043f05e1 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h | |||
@@ -4,8 +4,12 @@ | |||
4 | #include <asm/atomic.h> | 4 | #include <asm/atomic.h> |
5 | #include <asm/rwlock.h> | 5 | #include <asm/rwlock.h> |
6 | #include <asm/page.h> | 6 | #include <asm/page.h> |
7 | #include <asm/processor.h> | ||
7 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
8 | 9 | ||
10 | #define CLI_STRING "cli" | ||
11 | #define STI_STRING "sti" | ||
12 | |||
9 | /* | 13 | /* |
10 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 14 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
11 | * | 15 | * |
@@ -17,67 +21,64 @@ | |||
17 | * (the type definitions are in asm/spinlock_types.h) | 21 | * (the type definitions are in asm/spinlock_types.h) |
18 | */ | 22 | */ |
19 | 23 | ||
20 | #define __raw_spin_is_locked(x) \ | 24 | static inline int __raw_spin_is_locked(raw_spinlock_t *x) |
21 | (*(volatile signed char *)(&(x)->slock) <= 0) | 25 | { |
22 | 26 | return *(volatile signed char *)(&(x)->slock) <= 0; | |
23 | #define __raw_spin_lock_string \ | 27 | } |
24 | "\n1:\t" \ | ||
25 | LOCK_PREFIX " ; decb %0\n\t" \ | ||
26 | "jns 3f\n" \ | ||
27 | "2:\t" \ | ||
28 | "rep;nop\n\t" \ | ||
29 | "cmpb $0,%0\n\t" \ | ||
30 | "jle 2b\n\t" \ | ||
31 | "jmp 1b\n" \ | ||
32 | "3:\n\t" | ||
33 | |||
34 | /* | ||
35 | * NOTE: there's an irqs-on section here, which normally would have to be | ||
36 | * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use | ||
37 | * __raw_spin_lock_string_flags(). | ||
38 | */ | ||
39 | #define __raw_spin_lock_string_flags \ | ||
40 | "\n1:\t" \ | ||
41 | LOCK_PREFIX " ; decb %0\n\t" \ | ||
42 | "jns 5f\n" \ | ||
43 | "2:\t" \ | ||
44 | "testl $0x200, %1\n\t" \ | ||
45 | "jz 4f\n\t" \ | ||
46 | "sti\n" \ | ||
47 | "3:\t" \ | ||
48 | "rep;nop\n\t" \ | ||
49 | "cmpb $0, %0\n\t" \ | ||
50 | "jle 3b\n\t" \ | ||
51 | "cli\n\t" \ | ||
52 | "jmp 1b\n" \ | ||
53 | "4:\t" \ | ||
54 | "rep;nop\n\t" \ | ||
55 | "cmpb $0, %0\n\t" \ | ||
56 | "jg 1b\n\t" \ | ||
57 | "jmp 4b\n" \ | ||
58 | "5:\n\t" | ||
59 | 28 | ||
60 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 29 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
61 | { | 30 | { |
62 | asm(__raw_spin_lock_string : "+m" (lock->slock) : : "memory"); | 31 | asm volatile("\n1:\t" |
32 | LOCK_PREFIX " ; decb %0\n\t" | ||
33 | "jns 3f\n" | ||
34 | "2:\t" | ||
35 | "rep;nop\n\t" | ||
36 | "cmpb $0,%0\n\t" | ||
37 | "jle 2b\n\t" | ||
38 | "jmp 1b\n" | ||
39 | "3:\n\t" | ||
40 | : "+m" (lock->slock) : : "memory"); | ||
63 | } | 41 | } |
64 | 42 | ||
65 | /* | 43 | /* |
66 | * It is easier for the lock validator if interrupts are not re-enabled | 44 | * It is easier for the lock validator if interrupts are not re-enabled |
67 | * in the middle of a lock-acquire. This is a performance feature anyway | 45 | * in the middle of a lock-acquire. This is a performance feature anyway |
68 | * so we turn it off: | 46 | * so we turn it off: |
47 | * | ||
48 | * NOTE: there's an irqs-on section here, which normally would have to be | ||
49 | * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use this variant. | ||
69 | */ | 50 | */ |
70 | #ifndef CONFIG_PROVE_LOCKING | 51 | #ifndef CONFIG_PROVE_LOCKING |
71 | static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | 52 | static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) |
72 | { | 53 | { |
73 | asm(__raw_spin_lock_string_flags : "+m" (lock->slock) : "r" (flags) : "memory"); | 54 | asm volatile( |
55 | "\n1:\t" | ||
56 | LOCK_PREFIX " ; decb %0\n\t" | ||
57 | "jns 5f\n" | ||
58 | "2:\t" | ||
59 | "testl $0x200, %1\n\t" | ||
60 | "jz 4f\n\t" | ||
61 | STI_STRING "\n" | ||
62 | "3:\t" | ||
63 | "rep;nop\n\t" | ||
64 | "cmpb $0, %0\n\t" | ||
65 | "jle 3b\n\t" | ||
66 | CLI_STRING "\n\t" | ||
67 | "jmp 1b\n" | ||
68 | "4:\t" | ||
69 | "rep;nop\n\t" | ||
70 | "cmpb $0, %0\n\t" | ||
71 | "jg 1b\n\t" | ||
72 | "jmp 4b\n" | ||
73 | "5:\n\t" | ||
74 | : "+m" (lock->slock) : "r" (flags) : "memory"); | ||
74 | } | 75 | } |
75 | #endif | 76 | #endif |
76 | 77 | ||
77 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | 78 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
78 | { | 79 | { |
79 | char oldval; | 80 | char oldval; |
80 | __asm__ __volatile__( | 81 | asm volatile( |
81 | "xchgb %b0,%1" | 82 | "xchgb %b0,%1" |
82 | :"=q" (oldval), "+m" (lock->slock) | 83 | :"=q" (oldval), "+m" (lock->slock) |
83 | :"0" (0) : "memory"); | 84 | :"0" (0) : "memory"); |
@@ -93,38 +94,29 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
93 | 94 | ||
94 | #if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) | 95 | #if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) |
95 | 96 | ||
96 | #define __raw_spin_unlock_string \ | ||
97 | "movb $1,%0" \ | ||
98 | :"+m" (lock->slock) : : "memory" | ||
99 | |||
100 | |||
101 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 97 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
102 | { | 98 | { |
103 | __asm__ __volatile__( | 99 | asm volatile("movb $1,%0" : "+m" (lock->slock) :: "memory"); |
104 | __raw_spin_unlock_string | ||
105 | ); | ||
106 | } | 100 | } |
107 | 101 | ||
108 | #else | 102 | #else |
109 | 103 | ||
110 | #define __raw_spin_unlock_string \ | ||
111 | "xchgb %b0, %1" \ | ||
112 | :"=q" (oldval), "+m" (lock->slock) \ | ||
113 | :"0" (oldval) : "memory" | ||
114 | |||
115 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 104 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
116 | { | 105 | { |
117 | char oldval = 1; | 106 | char oldval = 1; |
118 | 107 | ||
119 | __asm__ __volatile__( | 108 | asm volatile("xchgb %b0, %1" |
120 | __raw_spin_unlock_string | 109 | : "=q" (oldval), "+m" (lock->slock) |
121 | ); | 110 | : "0" (oldval) : "memory"); |
122 | } | 111 | } |
123 | 112 | ||
124 | #endif | 113 | #endif |
125 | 114 | ||
126 | #define __raw_spin_unlock_wait(lock) \ | 115 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) |
127 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | 116 | { |
117 | while (__raw_spin_is_locked(lock)) | ||
118 | cpu_relax(); | ||
119 | } | ||
128 | 120 | ||
129 | /* | 121 | /* |
130 | * Read-write spinlocks, allowing multiple readers | 122 | * Read-write spinlocks, allowing multiple readers |
@@ -151,22 +143,36 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
151 | * read_can_lock - would read_trylock() succeed? | 143 | * read_can_lock - would read_trylock() succeed? |
152 | * @lock: the rwlock in question. | 144 | * @lock: the rwlock in question. |
153 | */ | 145 | */ |
154 | #define __raw_read_can_lock(x) ((int)(x)->lock > 0) | 146 | static inline int __raw_read_can_lock(raw_rwlock_t *x) |
147 | { | ||
148 | return (int)(x)->lock > 0; | ||
149 | } | ||
155 | 150 | ||
156 | /** | 151 | /** |
157 | * write_can_lock - would write_trylock() succeed? | 152 | * write_can_lock - would write_trylock() succeed? |
158 | * @lock: the rwlock in question. | 153 | * @lock: the rwlock in question. |
159 | */ | 154 | */ |
160 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | 155 | static inline int __raw_write_can_lock(raw_rwlock_t *x) |
156 | { | ||
157 | return (x)->lock == RW_LOCK_BIAS; | ||
158 | } | ||
161 | 159 | ||
162 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 160 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
163 | { | 161 | { |
164 | __build_read_lock(rw, "__read_lock_failed"); | 162 | asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t" |
163 | "jns 1f\n" | ||
164 | "call __read_lock_failed\n\t" | ||
165 | "1:\n" | ||
166 | ::"a" (rw) : "memory"); | ||
165 | } | 167 | } |
166 | 168 | ||
167 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 169 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
168 | { | 170 | { |
169 | __build_write_lock(rw, "__write_lock_failed"); | 171 | asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" |
172 | "jz 1f\n" | ||
173 | "call __write_lock_failed\n\t" | ||
174 | "1:\n" | ||
175 | ::"a" (rw) : "memory"); | ||
170 | } | 176 | } |
171 | 177 | ||
172 | static inline int __raw_read_trylock(raw_rwlock_t *lock) | 178 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
diff --git a/include/asm-i386/stacktrace.h b/include/asm-i386/stacktrace.h new file mode 100644 index 000000000000..7d1f6a5cbfca --- /dev/null +++ b/include/asm-i386/stacktrace.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-x86_64/stacktrace.h> | |||
diff --git a/include/asm-i386/sync_bitops.h b/include/asm-i386/sync_bitops.h new file mode 100644 index 000000000000..c94d51c993ee --- /dev/null +++ b/include/asm-i386/sync_bitops.h | |||
@@ -0,0 +1,156 @@ | |||
1 | #ifndef _I386_SYNC_BITOPS_H | ||
2 | #define _I386_SYNC_BITOPS_H | ||
3 | |||
4 | /* | ||
5 | * Copyright 1992, Linus Torvalds. | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * These have to be done with inline assembly: that way the bit-setting | ||
10 | * is guaranteed to be atomic. All bit operations return 0 if the bit | ||
11 | * was cleared before the operation and != 0 if it was not. | ||
12 | * | ||
13 | * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). | ||
14 | */ | ||
15 | |||
16 | #define ADDR (*(volatile long *) addr) | ||
17 | |||
18 | /** | ||
19 | * sync_set_bit - Atomically set a bit in memory | ||
20 | * @nr: the bit to set | ||
21 | * @addr: the address to start counting from | ||
22 | * | ||
23 | * This function is atomic and may not be reordered. See __set_bit() | ||
24 | * if you do not require the atomic guarantees. | ||
25 | * | ||
26 | * Note: there are no guarantees that this function will not be reordered | ||
27 | * on non x86 architectures, so if you are writting portable code, | ||
28 | * make sure not to rely on its reordering guarantees. | ||
29 | * | ||
30 | * Note that @nr may be almost arbitrarily large; this function is not | ||
31 | * restricted to acting on a single-word quantity. | ||
32 | */ | ||
33 | static inline void sync_set_bit(int nr, volatile unsigned long * addr) | ||
34 | { | ||
35 | __asm__ __volatile__("lock; btsl %1,%0" | ||
36 | :"+m" (ADDR) | ||
37 | :"Ir" (nr) | ||
38 | : "memory"); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * sync_clear_bit - Clears a bit in memory | ||
43 | * @nr: Bit to clear | ||
44 | * @addr: Address to start counting from | ||
45 | * | ||
46 | * sync_clear_bit() is atomic and may not be reordered. However, it does | ||
47 | * not contain a memory barrier, so if it is used for locking purposes, | ||
48 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | ||
49 | * in order to ensure changes are visible on other processors. | ||
50 | */ | ||
51 | static inline void sync_clear_bit(int nr, volatile unsigned long * addr) | ||
52 | { | ||
53 | __asm__ __volatile__("lock; btrl %1,%0" | ||
54 | :"+m" (ADDR) | ||
55 | :"Ir" (nr) | ||
56 | : "memory"); | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * sync_change_bit - Toggle a bit in memory | ||
61 | * @nr: Bit to change | ||
62 | * @addr: Address to start counting from | ||
63 | * | ||
64 | * change_bit() is atomic and may not be reordered. It may be | ||
65 | * reordered on other architectures than x86. | ||
66 | * Note that @nr may be almost arbitrarily large; this function is not | ||
67 | * restricted to acting on a single-word quantity. | ||
68 | */ | ||
69 | static inline void sync_change_bit(int nr, volatile unsigned long * addr) | ||
70 | { | ||
71 | __asm__ __volatile__("lock; btcl %1,%0" | ||
72 | :"+m" (ADDR) | ||
73 | :"Ir" (nr) | ||
74 | : "memory"); | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * sync_test_and_set_bit - Set a bit and return its old value | ||
79 | * @nr: Bit to set | ||
80 | * @addr: Address to count from | ||
81 | * | ||
82 | * This operation is atomic and cannot be reordered. | ||
83 | * It may be reordered on other architectures than x86. | ||
84 | * It also implies a memory barrier. | ||
85 | */ | ||
86 | static inline int sync_test_and_set_bit(int nr, volatile unsigned long * addr) | ||
87 | { | ||
88 | int oldbit; | ||
89 | |||
90 | __asm__ __volatile__("lock; btsl %2,%1\n\tsbbl %0,%0" | ||
91 | :"=r" (oldbit),"+m" (ADDR) | ||
92 | :"Ir" (nr) : "memory"); | ||
93 | return oldbit; | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * sync_test_and_clear_bit - Clear a bit and return its old value | ||
98 | * @nr: Bit to clear | ||
99 | * @addr: Address to count from | ||
100 | * | ||
101 | * This operation is atomic and cannot be reordered. | ||
102 | * It can be reorderdered on other architectures other than x86. | ||
103 | * It also implies a memory barrier. | ||
104 | */ | ||
105 | static inline int sync_test_and_clear_bit(int nr, volatile unsigned long * addr) | ||
106 | { | ||
107 | int oldbit; | ||
108 | |||
109 | __asm__ __volatile__("lock; btrl %2,%1\n\tsbbl %0,%0" | ||
110 | :"=r" (oldbit),"+m" (ADDR) | ||
111 | :"Ir" (nr) : "memory"); | ||
112 | return oldbit; | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * sync_test_and_change_bit - Change a bit and return its old value | ||
117 | * @nr: Bit to change | ||
118 | * @addr: Address to count from | ||
119 | * | ||
120 | * This operation is atomic and cannot be reordered. | ||
121 | * It also implies a memory barrier. | ||
122 | */ | ||
123 | static inline int sync_test_and_change_bit(int nr, volatile unsigned long* addr) | ||
124 | { | ||
125 | int oldbit; | ||
126 | |||
127 | __asm__ __volatile__("lock; btcl %2,%1\n\tsbbl %0,%0" | ||
128 | :"=r" (oldbit),"+m" (ADDR) | ||
129 | :"Ir" (nr) : "memory"); | ||
130 | return oldbit; | ||
131 | } | ||
132 | |||
133 | static __always_inline int sync_const_test_bit(int nr, const volatile unsigned long *addr) | ||
134 | { | ||
135 | return ((1UL << (nr & 31)) & | ||
136 | (((const volatile unsigned int *)addr)[nr >> 5])) != 0; | ||
137 | } | ||
138 | |||
139 | static inline int sync_var_test_bit(int nr, const volatile unsigned long * addr) | ||
140 | { | ||
141 | int oldbit; | ||
142 | |||
143 | __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0" | ||
144 | :"=r" (oldbit) | ||
145 | :"m" (ADDR),"Ir" (nr)); | ||
146 | return oldbit; | ||
147 | } | ||
148 | |||
149 | #define sync_test_bit(nr,addr) \ | ||
150 | (__builtin_constant_p(nr) ? \ | ||
151 | sync_constant_test_bit((nr),(addr)) : \ | ||
152 | sync_var_test_bit((nr),(addr))) | ||
153 | |||
154 | #undef ADDR | ||
155 | |||
156 | #endif /* _I386_SYNC_BITOPS_H */ | ||
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 098bcee94e38..a6dabbcd6e6a 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h | |||
@@ -267,6 +267,9 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz | |||
267 | #define cmpxchg(ptr,o,n)\ | 267 | #define cmpxchg(ptr,o,n)\ |
268 | ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ | 268 | ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ |
269 | (unsigned long)(n),sizeof(*(ptr)))) | 269 | (unsigned long)(n),sizeof(*(ptr)))) |
270 | #define sync_cmpxchg(ptr,o,n)\ | ||
271 | ((__typeof__(*(ptr)))__sync_cmpxchg((ptr),(unsigned long)(o),\ | ||
272 | (unsigned long)(n),sizeof(*(ptr)))) | ||
270 | #endif | 273 | #endif |
271 | 274 | ||
272 | static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | 275 | static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, |
@@ -296,6 +299,39 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |||
296 | return old; | 299 | return old; |
297 | } | 300 | } |
298 | 301 | ||
302 | /* | ||
303 | * Always use locked operations when touching memory shared with a | ||
304 | * hypervisor, since the system may be SMP even if the guest kernel | ||
305 | * isn't. | ||
306 | */ | ||
307 | static inline unsigned long __sync_cmpxchg(volatile void *ptr, | ||
308 | unsigned long old, | ||
309 | unsigned long new, int size) | ||
310 | { | ||
311 | unsigned long prev; | ||
312 | switch (size) { | ||
313 | case 1: | ||
314 | __asm__ __volatile__("lock; cmpxchgb %b1,%2" | ||
315 | : "=a"(prev) | ||
316 | : "q"(new), "m"(*__xg(ptr)), "0"(old) | ||
317 | : "memory"); | ||
318 | return prev; | ||
319 | case 2: | ||
320 | __asm__ __volatile__("lock; cmpxchgw %w1,%2" | ||
321 | : "=a"(prev) | ||
322 | : "r"(new), "m"(*__xg(ptr)), "0"(old) | ||
323 | : "memory"); | ||
324 | return prev; | ||
325 | case 4: | ||
326 | __asm__ __volatile__("lock; cmpxchgl %1,%2" | ||
327 | : "=a"(prev) | ||
328 | : "r"(new), "m"(*__xg(ptr)), "0"(old) | ||
329 | : "memory"); | ||
330 | return prev; | ||
331 | } | ||
332 | return old; | ||
333 | } | ||
334 | |||
299 | #ifndef CONFIG_X86_CMPXCHG | 335 | #ifndef CONFIG_X86_CMPXCHG |
300 | /* | 336 | /* |
301 | * Building a kernel capable running on 80386. It may be necessary to | 337 | * Building a kernel capable running on 80386. It may be necessary to |
diff --git a/include/asm-i386/therm_throt.h b/include/asm-i386/therm_throt.h new file mode 100644 index 000000000000..399bf6026b16 --- /dev/null +++ b/include/asm-i386/therm_throt.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef __ASM_I386_THERM_THROT_H__ | ||
2 | #define __ASM_I386_THERM_THROT_H__ 1 | ||
3 | |||
4 | #include <asm/atomic.h> | ||
5 | |||
6 | extern atomic_t therm_throt_en; | ||
7 | int therm_throt_process(int curr); | ||
8 | |||
9 | #endif /* __ASM_I386_THERM_THROT_H__ */ | ||
diff --git a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h index d57ca5c540b6..360648b0f2b3 100644 --- a/include/asm-i386/tlbflush.h +++ b/include/asm-i386/tlbflush.h | |||
@@ -36,8 +36,6 @@ | |||
36 | : "memory"); \ | 36 | : "memory"); \ |
37 | } while (0) | 37 | } while (0) |
38 | 38 | ||
39 | extern unsigned long pgkern_mask; | ||
40 | |||
41 | # define __flush_tlb_all() \ | 39 | # define __flush_tlb_all() \ |
42 | do { \ | 40 | do { \ |
43 | if (cpu_has_pge) \ | 41 | if (cpu_has_pge) \ |
@@ -49,7 +47,7 @@ extern unsigned long pgkern_mask; | |||
49 | #define cpu_has_invlpg (boot_cpu_data.x86 > 3) | 47 | #define cpu_has_invlpg (boot_cpu_data.x86 > 3) |
50 | 48 | ||
51 | #define __flush_tlb_single(addr) \ | 49 | #define __flush_tlb_single(addr) \ |
52 | __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) | 50 | __asm__ __volatile__("invlpg (%0)" ::"r" (addr) : "memory") |
53 | 51 | ||
54 | #ifdef CONFIG_X86_INVLPG | 52 | #ifdef CONFIG_X86_INVLPG |
55 | # define __flush_tlb_one(addr) __flush_tlb_single(addr) | 53 | # define __flush_tlb_one(addr) __flush_tlb_single(addr) |
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h index 97b828ce31e0..c13933185c1c 100644 --- a/include/asm-i386/tsc.h +++ b/include/asm-i386/tsc.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef _ASM_i386_TSC_H | 6 | #ifndef _ASM_i386_TSC_H |
7 | #define _ASM_i386_TSC_H | 7 | #define _ASM_i386_TSC_H |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <asm/processor.h> | 9 | #include <asm/processor.h> |
11 | 10 | ||
12 | /* | 11 | /* |
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index fc1c8ddae149..bd9987087adc 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h | |||
@@ -323,18 +323,20 @@ | |||
323 | #define __NR_tee 315 | 323 | #define __NR_tee 315 |
324 | #define __NR_vmsplice 316 | 324 | #define __NR_vmsplice 316 |
325 | #define __NR_move_pages 317 | 325 | #define __NR_move_pages 317 |
326 | #define __NR_getcpu 318 | ||
326 | 327 | ||
327 | #ifdef __KERNEL__ | 328 | #ifdef __KERNEL__ |
328 | 329 | ||
329 | #define NR_syscalls 318 | 330 | #define NR_syscalls 319 |
331 | #include <linux/err.h> | ||
330 | 332 | ||
331 | /* | 333 | /* |
332 | * user-visible error numbers are in the range -1 - -128: see | 334 | * user-visible error numbers are in the range -1 - -MAX_ERRNO: see |
333 | * <asm-i386/errno.h> | 335 | * <asm-i386/errno.h> |
334 | */ | 336 | */ |
335 | #define __syscall_return(type, res) \ | 337 | #define __syscall_return(type, res) \ |
336 | do { \ | 338 | do { \ |
337 | if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \ | 339 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
338 | errno = -(res); \ | 340 | errno = -(res); \ |
339 | res = -1; \ | 341 | res = -1; \ |
340 | } \ | 342 | } \ |
diff --git a/include/asm-i386/unwind.h b/include/asm-i386/unwind.h index 4c1a0b968569..5031d693b89d 100644 --- a/include/asm-i386/unwind.h +++ b/include/asm-i386/unwind.h | |||
@@ -18,6 +18,7 @@ struct unwind_frame_info | |||
18 | { | 18 | { |
19 | struct pt_regs regs; | 19 | struct pt_regs regs; |
20 | struct task_struct *task; | 20 | struct task_struct *task; |
21 | unsigned call_frame:1; | ||
21 | }; | 22 | }; |
22 | 23 | ||
23 | #define UNW_PC(frame) (frame)->regs.eip | 24 | #define UNW_PC(frame) (frame)->regs.eip |
@@ -28,6 +29,8 @@ struct unwind_frame_info | |||
28 | #define FRAME_LINK_OFFSET 0 | 29 | #define FRAME_LINK_OFFSET 0 |
29 | #define STACK_BOTTOM(tsk) STACK_LIMIT((tsk)->thread.esp0) | 30 | #define STACK_BOTTOM(tsk) STACK_LIMIT((tsk)->thread.esp0) |
30 | #define STACK_TOP(tsk) ((tsk)->thread.esp0) | 31 | #define STACK_TOP(tsk) ((tsk)->thread.esp0) |
32 | #else | ||
33 | #define UNW_FP(frame) ((void)(frame), 0) | ||
31 | #endif | 34 | #endif |
32 | #define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1)) | 35 | #define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1)) |
33 | 36 | ||
@@ -42,6 +45,10 @@ struct unwind_frame_info | |||
42 | PTREGS_INFO(edi), \ | 45 | PTREGS_INFO(edi), \ |
43 | PTREGS_INFO(eip) | 46 | PTREGS_INFO(eip) |
44 | 47 | ||
48 | #define UNW_DEFAULT_RA(raItem, dataAlign) \ | ||
49 | ((raItem).where == Memory && \ | ||
50 | !((raItem).value * (dataAlign) + 4)) | ||
51 | |||
45 | static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, | 52 | static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, |
46 | /*const*/ struct pt_regs *regs) | 53 | /*const*/ struct pt_regs *regs) |
47 | { | 54 | { |
@@ -88,6 +95,7 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info) | |||
88 | 95 | ||
89 | #define UNW_PC(frame) ((void)(frame), 0) | 96 | #define UNW_PC(frame) ((void)(frame), 0) |
90 | #define UNW_SP(frame) ((void)(frame), 0) | 97 | #define UNW_SP(frame) ((void)(frame), 0) |
98 | #define UNW_FP(frame) ((void)(frame), 0) | ||
91 | 99 | ||
92 | static inline int arch_unw_user_mode(const void *info) | 100 | static inline int arch_unw_user_mode(const void *info) |
93 | { | 101 | { |
diff --git a/include/asm-ia64/esi.h b/include/asm-ia64/esi.h new file mode 100644 index 000000000000..84aac0e0b583 --- /dev/null +++ b/include/asm-ia64/esi.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * ESI service calls. | ||
3 | * | ||
4 | * Copyright (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. | ||
5 | * Alex Williamson <alex.williamson@hp.com> | ||
6 | */ | ||
7 | #ifndef esi_h | ||
8 | #define esi_h | ||
9 | |||
10 | #include <linux/efi.h> | ||
11 | |||
12 | #define ESI_QUERY 0x00000001 | ||
13 | #define ESI_OPEN_HANDLE 0x02000000 | ||
14 | #define ESI_CLOSE_HANDLE 0x02000001 | ||
15 | |||
16 | enum esi_proc_type { | ||
17 | ESI_PROC_SERIALIZED, /* calls need to be serialized */ | ||
18 | ESI_PROC_MP_SAFE, /* MP-safe, but not reentrant */ | ||
19 | ESI_PROC_REENTRANT /* MP-safe and reentrant */ | ||
20 | }; | ||
21 | |||
22 | extern int ia64_esi_init (void); | ||
23 | extern struct ia64_sal_retval esi_call_phys (void *, u64 *); | ||
24 | extern int ia64_esi_call(efi_guid_t, struct ia64_sal_retval *, | ||
25 | enum esi_proc_type, | ||
26 | u64, u64, u64, u64, u64, u64, u64, u64); | ||
27 | extern int ia64_esi_call_phys(efi_guid_t, struct ia64_sal_retval *, u64, u64, | ||
28 | u64, u64, u64, u64, u64, u64); | ||
29 | |||
30 | #endif /* esi_h */ | ||
diff --git a/include/asm-ia64/futex.h b/include/asm-ia64/futex.h index 6a332a9f099c..07d77f3a8cbe 100644 --- a/include/asm-ia64/futex.h +++ b/include/asm-ia64/futex.h | |||
@@ -1,6 +1,124 @@ | |||
1 | #ifndef _ASM_FUTEX_H | 1 | #ifndef _ASM_FUTEX_H |
2 | #define _ASM_FUTEX_H | 2 | #define _ASM_FUTEX_H |
3 | 3 | ||
4 | #include <asm-generic/futex.h> | 4 | #include <linux/futex.h> |
5 | #include <asm/errno.h> | ||
6 | #include <asm/system.h> | ||
7 | #include <asm/uaccess.h> | ||
5 | 8 | ||
6 | #endif | 9 | #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ |
10 | do { \ | ||
11 | register unsigned long r8 __asm ("r8") = 0; \ | ||
12 | __asm__ __volatile__( \ | ||
13 | " mf;; \n" \ | ||
14 | "[1:] " insn ";; \n" \ | ||
15 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" \ | ||
16 | "[2:]" \ | ||
17 | : "+r" (r8), "=r" (oldval) \ | ||
18 | : "r" (uaddr), "r" (oparg) \ | ||
19 | : "memory"); \ | ||
20 | ret = r8; \ | ||
21 | } while (0) | ||
22 | |||
23 | #define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \ | ||
24 | do { \ | ||
25 | register unsigned long r8 __asm ("r8") = 0; \ | ||
26 | int val, newval; \ | ||
27 | do { \ | ||
28 | __asm__ __volatile__( \ | ||
29 | " mf;; \n" \ | ||
30 | "[1:] ld4 %3=[%4];; \n" \ | ||
31 | " mov %2=%3 \n" \ | ||
32 | insn ";; \n" \ | ||
33 | " mov ar.ccv=%2;; \n" \ | ||
34 | "[2:] cmpxchg4.acq %1=[%4],%3,ar.ccv;; \n" \ | ||
35 | " .xdata4 \"__ex_table\", 1b-., 3f-.\n" \ | ||
36 | " .xdata4 \"__ex_table\", 2b-., 3f-.\n" \ | ||
37 | "[3:]" \ | ||
38 | : "+r" (r8), "=r" (val), "=&r" (oldval), \ | ||
39 | "=&r" (newval) \ | ||
40 | : "r" (uaddr), "r" (oparg) \ | ||
41 | : "memory"); \ | ||
42 | if (unlikely (r8)) \ | ||
43 | break; \ | ||
44 | } while (unlikely (val != oldval)); \ | ||
45 | ret = r8; \ | ||
46 | } while (0) | ||
47 | |||
48 | static inline int | ||
49 | futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | ||
50 | { | ||
51 | int op = (encoded_op >> 28) & 7; | ||
52 | int cmp = (encoded_op >> 24) & 15; | ||
53 | int oparg = (encoded_op << 8) >> 20; | ||
54 | int cmparg = (encoded_op << 20) >> 20; | ||
55 | int oldval = 0, ret; | ||
56 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | ||
57 | oparg = 1 << oparg; | ||
58 | |||
59 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | ||
60 | return -EFAULT; | ||
61 | |||
62 | inc_preempt_count(); | ||
63 | |||
64 | switch (op) { | ||
65 | case FUTEX_OP_SET: | ||
66 | __futex_atomic_op1("xchg4 %1=[%2],%3", ret, oldval, uaddr, | ||
67 | oparg); | ||
68 | break; | ||
69 | case FUTEX_OP_ADD: | ||
70 | __futex_atomic_op2("add %3=%3,%5", ret, oldval, uaddr, oparg); | ||
71 | break; | ||
72 | case FUTEX_OP_OR: | ||
73 | __futex_atomic_op2("or %3=%3,%5", ret, oldval, uaddr, oparg); | ||
74 | break; | ||
75 | case FUTEX_OP_ANDN: | ||
76 | __futex_atomic_op2("and %3=%3,%5", ret, oldval, uaddr, | ||
77 | ~oparg); | ||
78 | break; | ||
79 | case FUTEX_OP_XOR: | ||
80 | __futex_atomic_op2("xor %3=%3,%5", ret, oldval, uaddr, oparg); | ||
81 | break; | ||
82 | default: | ||
83 | ret = -ENOSYS; | ||
84 | } | ||
85 | |||
86 | dec_preempt_count(); | ||
87 | |||
88 | if (!ret) { | ||
89 | switch (cmp) { | ||
90 | case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break; | ||
91 | case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break; | ||
92 | case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break; | ||
93 | case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break; | ||
94 | case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break; | ||
95 | case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break; | ||
96 | default: ret = -ENOSYS; | ||
97 | } | ||
98 | } | ||
99 | return ret; | ||
100 | } | ||
101 | |||
102 | static inline int | ||
103 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | ||
104 | { | ||
105 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | ||
106 | return -EFAULT; | ||
107 | |||
108 | { | ||
109 | register unsigned long r8 __asm ("r8"); | ||
110 | __asm__ __volatile__( | ||
111 | " mf;; \n" | ||
112 | " mov ar.ccv=%3;; \n" | ||
113 | "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n" | ||
114 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" | ||
115 | "[2:]" | ||
116 | : "=r" (r8) | ||
117 | : "r" (uaddr), "r" (newval), | ||
118 | "rO" ((long) (unsigned) oldval) | ||
119 | : "memory"); | ||
120 | return r8; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | #endif /* _ASM_FUTEX_H */ | ||
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h index 938904910115..1b45b71c79b9 100644 --- a/include/asm-ia64/kprobes.h +++ b/include/asm-ia64/kprobes.h | |||
@@ -29,7 +29,8 @@ | |||
29 | #include <linux/percpu.h> | 29 | #include <linux/percpu.h> |
30 | #include <asm/break.h> | 30 | #include <asm/break.h> |
31 | 31 | ||
32 | #define MAX_INSN_SIZE 16 | 32 | #define __ARCH_WANT_KPROBES_INSN_SLOT |
33 | #define MAX_INSN_SIZE 1 | ||
33 | #define BREAK_INST (long)(__IA64_BREAK_KPROBE << 6) | 34 | #define BREAK_INST (long)(__IA64_BREAK_KPROBE << 6) |
34 | 35 | ||
35 | typedef union cmp_inst { | 36 | typedef union cmp_inst { |
@@ -94,7 +95,7 @@ struct kprobe_ctlblk { | |||
94 | #define IP_RELATIVE_PREDICT_OPCODE (7) | 95 | #define IP_RELATIVE_PREDICT_OPCODE (7) |
95 | #define LONG_BRANCH_OPCODE (0xC) | 96 | #define LONG_BRANCH_OPCODE (0xC) |
96 | #define LONG_CALL_OPCODE (0xD) | 97 | #define LONG_CALL_OPCODE (0xD) |
97 | #define arch_remove_kprobe(p) do {} while (0) | 98 | #define flush_insn_slot(p) do { } while (0) |
98 | 99 | ||
99 | typedef struct kprobe_opcode { | 100 | typedef struct kprobe_opcode { |
100 | bundle_t bundle; | 101 | bundle_t bundle; |
@@ -108,7 +109,7 @@ struct fnptr { | |||
108 | /* Architecture specific copy of original instruction*/ | 109 | /* Architecture specific copy of original instruction*/ |
109 | struct arch_specific_insn { | 110 | struct arch_specific_insn { |
110 | /* copy of the instruction to be emulated */ | 111 | /* copy of the instruction to be emulated */ |
111 | kprobe_opcode_t insn; | 112 | kprobe_opcode_t *insn; |
112 | #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1 | 113 | #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1 |
113 | #define INST_FLAG_FIX_BRANCH_REG 2 | 114 | #define INST_FLAG_FIX_BRANCH_REG 2 |
114 | #define INST_FLAG_BREAK_INST 4 | 115 | #define INST_FLAG_BREAK_INST 4 |
@@ -125,6 +126,6 @@ static inline void jprobe_return(void) | |||
125 | } | 126 | } |
126 | extern void invalidate_stacked_regs(void); | 127 | extern void invalidate_stacked_regs(void); |
127 | extern void flush_register_stack(void); | 128 | extern void flush_register_stack(void); |
128 | extern void flush_insn_slot(struct kprobe *p); | 129 | extern void arch_remove_kprobe(struct kprobe *p); |
129 | 130 | ||
130 | #endif /* _ASM_KPROBES_H */ | 131 | #endif /* _ASM_KPROBES_H */ |
diff --git a/include/asm-ia64/libata-portmap.h b/include/asm-ia64/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-ia64/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h index 27c9203d8ce3..76203f9a8718 100644 --- a/include/asm-ia64/mca_asm.h +++ b/include/asm-ia64/mca_asm.h | |||
@@ -197,9 +197,9 @@ | |||
197 | movl temp2 = start_addr; \ | 197 | movl temp2 = start_addr; \ |
198 | ;; \ | 198 | ;; \ |
199 | mov cr.iip = temp2; \ | 199 | mov cr.iip = temp2; \ |
200 | movl gp = __gp \ | ||
200 | ;; \ | 201 | ;; \ |
201 | DATA_PA_TO_VA(sp, temp1); \ | 202 | DATA_PA_TO_VA(sp, temp1); \ |
202 | DATA_PA_TO_VA(gp, temp2); \ | ||
203 | srlz.i; \ | 203 | srlz.i; \ |
204 | ;; \ | 204 | ;; \ |
205 | nop 1; \ | 205 | nop 1; \ |
diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h index 6a33a07b3f1d..c3b1f862e6e7 100644 --- a/include/asm-ia64/meminit.h +++ b/include/asm-ia64/meminit.h | |||
@@ -55,6 +55,7 @@ extern void efi_memmap_init(unsigned long *, unsigned long *); | |||
55 | extern unsigned long vmalloc_end; | 55 | extern unsigned long vmalloc_end; |
56 | extern struct page *vmem_map; | 56 | extern struct page *vmem_map; |
57 | extern int find_largest_hole (u64 start, u64 end, void *arg); | 57 | extern int find_largest_hole (u64 start, u64 end, void *arg); |
58 | extern int register_active_ranges (u64 start, u64 end, void *arg); | ||
58 | extern int create_mem_map_page_table (u64 start, u64 end, void *arg); | 59 | extern int create_mem_map_page_table (u64 start, u64 end, void *arg); |
59 | extern int vmemmap_find_next_valid_pfn(int, int); | 60 | extern int vmemmap_find_next_valid_pfn(int, int); |
60 | #else | 61 | #else |
diff --git a/include/asm-ia64/module.h b/include/asm-ia64/module.h index 85c82bd819f2..d2da61e4c49b 100644 --- a/include/asm-ia64/module.h +++ b/include/asm-ia64/module.h | |||
@@ -28,7 +28,8 @@ struct mod_arch_specific { | |||
28 | #define Elf_Ehdr Elf64_Ehdr | 28 | #define Elf_Ehdr Elf64_Ehdr |
29 | 29 | ||
30 | #define MODULE_PROC_FAMILY "ia64" | 30 | #define MODULE_PROC_FAMILY "ia64" |
31 | #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | 31 | #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \ |
32 | "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) | ||
32 | 33 | ||
33 | #define ARCH_SHF_SMALL SHF_IA_64_SHORT | 34 | #define ARCH_SHF_SMALL SHF_IA_64_SHORT |
34 | 35 | ||
diff --git a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h index e5a8260593a5..7d5e2ccc37a0 100644 --- a/include/asm-ia64/numa.h +++ b/include/asm-ia64/numa.h | |||
@@ -64,7 +64,13 @@ extern int paddr_to_nid(unsigned long paddr); | |||
64 | 64 | ||
65 | #define local_nodeid (cpu_to_node_map[smp_processor_id()]) | 65 | #define local_nodeid (cpu_to_node_map[smp_processor_id()]) |
66 | 66 | ||
67 | extern void map_cpu_to_node(int cpu, int nid); | ||
68 | extern void unmap_cpu_from_node(int cpu, int nid); | ||
69 | |||
70 | |||
67 | #else /* !CONFIG_NUMA */ | 71 | #else /* !CONFIG_NUMA */ |
72 | #define map_cpu_to_node(cpu, nid) do{}while(0) | ||
73 | #define unmap_cpu_from_node(cpu, nid) do{}while(0) | ||
68 | 74 | ||
69 | #define paddr_to_nid(addr) 0 | 75 | #define paddr_to_nid(addr) 0 |
70 | 76 | ||
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h index 20a8d618c845..2c8fd92d0ece 100644 --- a/include/asm-ia64/pal.h +++ b/include/asm-ia64/pal.h | |||
@@ -78,6 +78,7 @@ | |||
78 | #define PAL_VM_TR_READ 261 /* read contents of translation register */ | 78 | #define PAL_VM_TR_READ 261 /* read contents of translation register */ |
79 | #define PAL_GET_PSTATE 262 /* get the current P-state */ | 79 | #define PAL_GET_PSTATE 262 /* get the current P-state */ |
80 | #define PAL_SET_PSTATE 263 /* set the P-state */ | 80 | #define PAL_SET_PSTATE 263 /* set the P-state */ |
81 | #define PAL_BRAND_INFO 274 /* Processor branding information */ | ||
81 | 82 | ||
82 | #ifndef __ASSEMBLY__ | 83 | #ifndef __ASSEMBLY__ |
83 | 84 | ||
@@ -963,7 +964,8 @@ static inline s64 | |||
963 | ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr) | 964 | ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr) |
964 | { | 965 | { |
965 | struct ia64_pal_retval iprv; | 966 | struct ia64_pal_retval iprv; |
966 | PAL_CALL(iprv, PAL_CACHE_READ, line_id.pclid_data, physical_addr, 0); | 967 | PAL_CALL_PHYS_STK(iprv, PAL_CACHE_READ, line_id.pclid_data, |
968 | physical_addr, 0); | ||
967 | return iprv.status; | 969 | return iprv.status; |
968 | } | 970 | } |
969 | 971 | ||
@@ -985,7 +987,8 @@ static inline s64 | |||
985 | ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data) | 987 | ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data) |
986 | { | 988 | { |
987 | struct ia64_pal_retval iprv; | 989 | struct ia64_pal_retval iprv; |
988 | PAL_CALL(iprv, PAL_CACHE_WRITE, line_id.pclid_data, physical_addr, data); | 990 | PAL_CALL_PHYS_STK(iprv, PAL_CACHE_WRITE, line_id.pclid_data, |
991 | physical_addr, data); | ||
989 | return iprv.status; | 992 | return iprv.status; |
990 | } | 993 | } |
991 | 994 | ||
@@ -1133,6 +1136,15 @@ ia64_pal_set_pstate (u64 pstate_index) | |||
1133 | return iprv.status; | 1136 | return iprv.status; |
1134 | } | 1137 | } |
1135 | 1138 | ||
1139 | /* Processor branding information*/ | ||
1140 | static inline s64 | ||
1141 | ia64_pal_get_brand_info (char *brand_info) | ||
1142 | { | ||
1143 | struct ia64_pal_retval iprv; | ||
1144 | PAL_CALL_STK(iprv, PAL_BRAND_INFO, 0, (u64)brand_info, 0); | ||
1145 | return iprv.status; | ||
1146 | } | ||
1147 | |||
1136 | /* Cause the processor to enter LIGHT HALT state, where prefetching and execution are | 1148 | /* Cause the processor to enter LIGHT HALT state, where prefetching and execution are |
1137 | * suspended, but cache and TLB coherency is maintained. | 1149 | * suspended, but cache and TLB coherency is maintained. |
1138 | */ | 1150 | */ |
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index 228981cadf8f..553182747722 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h | |||
@@ -275,21 +275,23 @@ ia64_phys_addr_valid (unsigned long addr) | |||
275 | #define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd))) | 275 | #define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd))) |
276 | #define pmd_present(pmd) (pmd_val(pmd) != 0UL) | 276 | #define pmd_present(pmd) (pmd_val(pmd) != 0UL) |
277 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) | 277 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) |
278 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK)) | 278 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK)) |
279 | #define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET)) | 279 | #define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET)) |
280 | 280 | ||
281 | #define pud_none(pud) (!pud_val(pud)) | 281 | #define pud_none(pud) (!pud_val(pud)) |
282 | #define pud_bad(pud) (!ia64_phys_addr_valid(pud_val(pud))) | 282 | #define pud_bad(pud) (!ia64_phys_addr_valid(pud_val(pud))) |
283 | #define pud_present(pud) (pud_val(pud) != 0UL) | 283 | #define pud_present(pud) (pud_val(pud) != 0UL) |
284 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) | 284 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) |
285 | #define pud_page(pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK)) | 285 | #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK)) |
286 | #define pud_page(pud) virt_to_page((pud_val(pud) + PAGE_OFFSET)) | ||
286 | 287 | ||
287 | #ifdef CONFIG_PGTABLE_4 | 288 | #ifdef CONFIG_PGTABLE_4 |
288 | #define pgd_none(pgd) (!pgd_val(pgd)) | 289 | #define pgd_none(pgd) (!pgd_val(pgd)) |
289 | #define pgd_bad(pgd) (!ia64_phys_addr_valid(pgd_val(pgd))) | 290 | #define pgd_bad(pgd) (!ia64_phys_addr_valid(pgd_val(pgd))) |
290 | #define pgd_present(pgd) (pgd_val(pgd) != 0UL) | 291 | #define pgd_present(pgd) (pgd_val(pgd) != 0UL) |
291 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) | 292 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) |
292 | #define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & _PFN_MASK)) | 293 | #define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_val(pgd) & _PFN_MASK)) |
294 | #define pgd_page(pgd) virt_to_page((pgd_val(pgd) + PAGE_OFFSET)) | ||
293 | #endif | 295 | #endif |
294 | 296 | ||
295 | /* | 297 | /* |
@@ -360,19 +362,19 @@ pgd_offset (struct mm_struct *mm, unsigned long address) | |||
360 | #ifdef CONFIG_PGTABLE_4 | 362 | #ifdef CONFIG_PGTABLE_4 |
361 | /* Find an entry in the second-level page table.. */ | 363 | /* Find an entry in the second-level page table.. */ |
362 | #define pud_offset(dir,addr) \ | 364 | #define pud_offset(dir,addr) \ |
363 | ((pud_t *) pgd_page(*(dir)) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) | 365 | ((pud_t *) pgd_page_vaddr(*(dir)) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) |
364 | #endif | 366 | #endif |
365 | 367 | ||
366 | /* Find an entry in the third-level page table.. */ | 368 | /* Find an entry in the third-level page table.. */ |
367 | #define pmd_offset(dir,addr) \ | 369 | #define pmd_offset(dir,addr) \ |
368 | ((pmd_t *) pud_page(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) | 370 | ((pmd_t *) pud_page_vaddr(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) |
369 | 371 | ||
370 | /* | 372 | /* |
371 | * Find an entry in the third-level page table. This looks more complicated than it | 373 | * Find an entry in the third-level page table. This looks more complicated than it |
372 | * should be because some platforms place page tables in high memory. | 374 | * should be because some platforms place page tables in high memory. |
373 | */ | 375 | */ |
374 | #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 376 | #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
375 | #define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) | 377 | #define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) |
376 | #define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr) | 378 | #define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr) |
377 | #define pte_offset_map_nested(dir,addr) pte_offset_map(dir, addr) | 379 | #define pte_offset_map_nested(dir,addr) pte_offset_map(dir, addr) |
378 | #define pte_unmap(pte) do { } while (0) | 380 | #define pte_unmap(pte) do { } while (0) |
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 265f4824db0e..5830d36fd8e6 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h | |||
@@ -20,12 +20,6 @@ | |||
20 | #include <asm/ustack.h> | 20 | #include <asm/ustack.h> |
21 | 21 | ||
22 | #define IA64_NUM_DBG_REGS 8 | 22 | #define IA64_NUM_DBG_REGS 8 |
23 | /* | ||
24 | * Limits for PMC and PMD are set to less than maximum architected values | ||
25 | * but should be sufficient for a while | ||
26 | */ | ||
27 | #define IA64_NUM_PMC_REGS 64 | ||
28 | #define IA64_NUM_PMD_REGS 64 | ||
29 | 23 | ||
30 | #define DEFAULT_MAP_BASE __IA64_UL_CONST(0x2000000000000000) | 24 | #define DEFAULT_MAP_BASE __IA64_UL_CONST(0x2000000000000000) |
31 | #define DEFAULT_TASK_SIZE __IA64_UL_CONST(0xa000000000000000) | 25 | #define DEFAULT_TASK_SIZE __IA64_UL_CONST(0xa000000000000000) |
@@ -163,6 +157,7 @@ struct cpuinfo_ia64 { | |||
163 | __u8 family; | 157 | __u8 family; |
164 | __u8 archrev; | 158 | __u8 archrev; |
165 | char vendor[16]; | 159 | char vendor[16]; |
160 | char *model_name; | ||
166 | 161 | ||
167 | #ifdef CONFIG_NUMA | 162 | #ifdef CONFIG_NUMA |
168 | struct ia64_node_data *node_data; | 163 | struct ia64_node_data *node_data; |
@@ -262,13 +257,9 @@ struct thread_struct { | |||
262 | # define INIT_THREAD_IA32 | 257 | # define INIT_THREAD_IA32 |
263 | #endif /* CONFIG_IA32_SUPPORT */ | 258 | #endif /* CONFIG_IA32_SUPPORT */ |
264 | #ifdef CONFIG_PERFMON | 259 | #ifdef CONFIG_PERFMON |
265 | __u64 pmcs[IA64_NUM_PMC_REGS]; | ||
266 | __u64 pmds[IA64_NUM_PMD_REGS]; | ||
267 | void *pfm_context; /* pointer to detailed PMU context */ | 260 | void *pfm_context; /* pointer to detailed PMU context */ |
268 | unsigned long pfm_needs_checking; /* when >0, pending perfmon work on kernel exit */ | 261 | unsigned long pfm_needs_checking; /* when >0, pending perfmon work on kernel exit */ |
269 | # define INIT_THREAD_PM .pmcs = {0UL, }, \ | 262 | # define INIT_THREAD_PM .pfm_context = NULL, \ |
270 | .pmds = {0UL, }, \ | ||
271 | .pfm_context = NULL, \ | ||
272 | .pfm_needs_checking = 0UL, | 263 | .pfm_needs_checking = 0UL, |
273 | #else | 264 | #else |
274 | # define INIT_THREAD_PM | 265 | # define INIT_THREAD_PM |
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h index 719ff309ce09..60fd4ae014f6 100644 --- a/include/asm-ia64/smp.h +++ b/include/asm-ia64/smp.h | |||
@@ -122,12 +122,11 @@ extern void __init smp_build_cpu_map(void); | |||
122 | extern void __init init_smp_config (void); | 122 | extern void __init init_smp_config (void); |
123 | extern void smp_do_timer (struct pt_regs *regs); | 123 | extern void smp_do_timer (struct pt_regs *regs); |
124 | 124 | ||
125 | extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info, | ||
126 | int retry, int wait); | ||
127 | extern void smp_send_reschedule (int cpu); | 125 | extern void smp_send_reschedule (int cpu); |
128 | extern void lock_ipi_calllock(void); | 126 | extern void lock_ipi_calllock(void); |
129 | extern void unlock_ipi_calllock(void); | 127 | extern void unlock_ipi_calllock(void); |
130 | extern void identify_siblings (struct cpuinfo_ia64 *); | 128 | extern void identify_siblings (struct cpuinfo_ia64 *); |
129 | extern int is_multithreading_enabled(void); | ||
131 | 130 | ||
132 | #else | 131 | #else |
133 | 132 | ||
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index f581662c5ab8..bb0eb727dcd0 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h | |||
@@ -286,7 +286,8 @@ | |||
286 | /* 1294, 1295 reserved for pselect/ppoll */ | 286 | /* 1294, 1295 reserved for pselect/ppoll */ |
287 | #define __NR_unshare 1296 | 287 | #define __NR_unshare 1296 |
288 | #define __NR_splice 1297 | 288 | #define __NR_splice 1297 |
289 | /* 1298, 1299 reserved for set_robust_list/get_robust_list */ | 289 | #define __NR_set_robust_list 1298 |
290 | #define __NR_get_robust_list 1299 | ||
290 | #define __NR_sync_file_range 1300 | 291 | #define __NR_sync_file_range 1300 |
291 | #define __NR_tee 1301 | 292 | #define __NR_tee 1301 |
292 | #define __NR_vmsplice 1302 | 293 | #define __NR_vmsplice 1302 |
diff --git a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h index be0f167e344a..6a674e3d37a2 100644 --- a/include/asm-m32r/pgtable-2level.h +++ b/include/asm-m32r/pgtable-2level.h | |||
@@ -52,9 +52,13 @@ static inline int pgd_present(pgd_t pgd) { return 1; } | |||
52 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | 52 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) |
53 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) | 53 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) |
54 | 54 | ||
55 | #define pgd_page(pgd) \ | 55 | #define pgd_page_vaddr(pgd) \ |
56 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | 56 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) |
57 | 57 | ||
58 | #ifndef CONFIG_DISCONTIGMEM | ||
59 | #define pgd_page(pgd) (mem_map + ((pgd_val(pgd) >> PAGE_SHIFT) - PFN_BASE)) | ||
60 | #endif /* !CONFIG_DISCONTIGMEM */ | ||
61 | |||
58 | static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) | 62 | static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) |
59 | { | 63 | { |
60 | return (pmd_t *) dir; | 64 | return (pmd_t *) dir; |
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h index 1983b7f4527a..1c15ba7ce319 100644 --- a/include/asm-m32r/pgtable.h +++ b/include/asm-m32r/pgtable.h | |||
@@ -336,7 +336,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
336 | pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); | 336 | pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); |
337 | } | 337 | } |
338 | 338 | ||
339 | #define pmd_page_kernel(pmd) \ | 339 | #define pmd_page_vaddr(pmd) \ |
340 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 340 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
341 | 341 | ||
342 | #ifndef CONFIG_DISCONTIGMEM | 342 | #ifndef CONFIG_DISCONTIGMEM |
@@ -358,7 +358,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
358 | #define pte_index(address) \ | 358 | #define pte_index(address) \ |
359 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 359 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
360 | #define pte_offset_kernel(dir, address) \ | 360 | #define pte_offset_kernel(dir, address) \ |
361 | ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) | 361 | ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) |
362 | #define pte_offset_map(dir, address) \ | 362 | #define pte_offset_map(dir, address) \ |
363 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) | 363 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) |
364 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | 364 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) |
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h index f94c1a673569..f9f90727a4a1 100644 --- a/include/asm-m32r/spinlock.h +++ b/include/asm-m32r/spinlock.h | |||
@@ -298,7 +298,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
298 | ); | 298 | ); |
299 | } | 299 | } |
300 | 300 | ||
301 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) | 301 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
302 | { | ||
303 | atomic_t *count = (atomic_t*)lock; | ||
304 | if (atomic_dec_return(count) >= 0) | ||
305 | return 1; | ||
306 | atomic_inc(count); | ||
307 | return 0; | ||
308 | } | ||
302 | 309 | ||
303 | static inline int __raw_write_trylock(raw_rwlock_t *lock) | 310 | static inline int __raw_write_trylock(raw_rwlock_t *lock) |
304 | { | 311 | { |
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h index 9e618afec6ed..4ce0619f6989 100644 --- a/include/asm-m32r/system.h +++ b/include/asm-m32r/system.h | |||
@@ -328,15 +328,15 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
328 | #define smp_rmb() rmb() | 328 | #define smp_rmb() rmb() |
329 | #define smp_wmb() wmb() | 329 | #define smp_wmb() wmb() |
330 | #define smp_read_barrier_depends() read_barrier_depends() | 330 | #define smp_read_barrier_depends() read_barrier_depends() |
331 | #define set_mb(var, value) do { (void) xchg(&var, value); } while (0) | ||
331 | #else | 332 | #else |
332 | #define smp_mb() barrier() | 333 | #define smp_mb() barrier() |
333 | #define smp_rmb() barrier() | 334 | #define smp_rmb() barrier() |
334 | #define smp_wmb() barrier() | 335 | #define smp_wmb() barrier() |
335 | #define smp_read_barrier_depends() do { } while (0) | 336 | #define smp_read_barrier_depends() do { } while (0) |
337 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | ||
336 | #endif | 338 | #endif |
337 | 339 | ||
338 | #define set_mb(var, value) do { xchg(&var, value); } while (0) | ||
339 | |||
340 | #define arch_align_stack(x) (x) | 340 | #define arch_align_stack(x) (x) |
341 | 341 | ||
342 | #endif /* _ASM_M32R_SYSTEM_H */ | 342 | #endif /* _ASM_M32R_SYSTEM_H */ |
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h index 89f376e6229f..5c6a9ac6cf1a 100644 --- a/include/asm-m32r/unistd.h +++ b/include/asm-m32r/unistd.h | |||
@@ -296,8 +296,9 @@ | |||
296 | #ifdef __KERNEL__ | 296 | #ifdef __KERNEL__ |
297 | 297 | ||
298 | #define NR_syscalls 285 | 298 | #define NR_syscalls 285 |
299 | #include <linux/err.h> | ||
299 | 300 | ||
300 | /* user-visible error numbers are in the range -1 - -124: see | 301 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO: see |
301 | * <asm-m32r/errno.h> | 302 | * <asm-m32r/errno.h> |
302 | */ | 303 | */ |
303 | 304 | ||
@@ -305,7 +306,7 @@ | |||
305 | 306 | ||
306 | #define __syscall_return(type, res) \ | 307 | #define __syscall_return(type, res) \ |
307 | do { \ | 308 | do { \ |
308 | if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \ | 309 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
309 | /* Avoid using "res" which is declared to be in register r0; \ | 310 | /* Avoid using "res" which is declared to be in register r0; \ |
310 | errno might expand to a function call and clobber it. */ \ | 311 | errno might expand to a function call and clobber it. */ \ |
311 | int __err = -(res); \ | 312 | int __err = -(res); \ |
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h index 1ccc7338a54b..61e4406ed96a 100644 --- a/include/asm-m68k/motorola_pgtable.h +++ b/include/asm-m68k/motorola_pgtable.h | |||
@@ -150,6 +150,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) | |||
150 | #define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) | 150 | #define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) |
151 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) | 151 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) |
152 | #define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) | 152 | #define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) |
153 | #define pgd_page(pgd) (mem_map + ((unsigned long)(__va(pgd_val(pgd)) - PAGE_OFFSET) >> PAGE_SHIFT)) | ||
153 | 154 | ||
154 | #define pte_ERROR(e) \ | 155 | #define pte_ERROR(e) \ |
155 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | 156 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) |
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index 7c0b6296b45c..751632b904db 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h | |||
@@ -288,13 +288,14 @@ | |||
288 | #ifdef __KERNEL__ | 288 | #ifdef __KERNEL__ |
289 | 289 | ||
290 | #define NR_syscalls 282 | 290 | #define NR_syscalls 282 |
291 | #include <linux/err.h> | ||
291 | 292 | ||
292 | /* user-visible error numbers are in the range -1 - -124: see | 293 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO: see |
293 | <asm-m68k/errno.h> */ | 294 | <asm-m68k/errno.h> */ |
294 | 295 | ||
295 | #define __syscall_return(type, res) \ | 296 | #define __syscall_return(type, res) \ |
296 | do { \ | 297 | do { \ |
297 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | 298 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
298 | /* avoid using res which is declared to be in register d0; \ | 299 | /* avoid using res which is declared to be in register d0; \ |
299 | errno might expand to a function call and clobber it. */ \ | 300 | errno might expand to a function call and clobber it. */ \ |
300 | int __err = -(res); \ | 301 | int __err = -(res); \ |
diff --git a/include/asm-m68knommu/unistd.h b/include/asm-m68knommu/unistd.h index 1b2abdf281e1..21fdc37c5c2c 100644 --- a/include/asm-m68knommu/unistd.h +++ b/include/asm-m68knommu/unistd.h | |||
@@ -289,13 +289,14 @@ | |||
289 | #ifdef __KERNEL__ | 289 | #ifdef __KERNEL__ |
290 | 290 | ||
291 | #define NR_syscalls 282 | 291 | #define NR_syscalls 282 |
292 | #include <linux/err.h> | ||
292 | 293 | ||
293 | /* user-visible error numbers are in the range -1 - -122: see | 294 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO: see |
294 | <asm-m68k/errno.h> */ | 295 | <asm-m68k/errno.h> */ |
295 | 296 | ||
296 | #define __syscall_return(type, res) \ | 297 | #define __syscall_return(type, res) \ |
297 | do { \ | 298 | do { \ |
298 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | 299 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
299 | /* avoid using res which is declared to be in register d0; \ | 300 | /* avoid using res which is declared to be in register d0; \ |
300 | errno might expand to a function call and clobber it. */ \ | 301 | errno might expand to a function call and clobber it. */ \ |
301 | int __err = -(res); \ | 302 | int __err = -(res); \ |
diff --git a/include/asm-mips/Kbuild b/include/asm-mips/Kbuild index c68e1680da01..7897f05e3165 100644 --- a/include/asm-mips/Kbuild +++ b/include/asm-mips/Kbuild | |||
@@ -1 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | |||
3 | header-y += cachectl.h sgidefs.h sysmips.h | ||
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h index 3b745e76f429..78c35ec46362 100644 --- a/include/asm-mips/bootinfo.h +++ b/include/asm-mips/bootinfo.h | |||
@@ -112,8 +112,7 @@ | |||
112 | * Valid machtype for group GALILEO | 112 | * Valid machtype for group GALILEO |
113 | */ | 113 | */ |
114 | #define MACH_GROUP_GALILEO 11 /* Galileo Eval Boards */ | 114 | #define MACH_GROUP_GALILEO 11 /* Galileo Eval Boards */ |
115 | #define MACH_EV96100 0 /* EV96100 */ | 115 | #define MACH_EV64120A 0 /* EV64120A */ |
116 | #define MACH_EV64120A 1 /* EV64120A */ | ||
117 | 116 | ||
118 | /* | 117 | /* |
119 | * Valid machtype for group MOMENCO | 118 | * Valid machtype for group MOMENCO |
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h index 47bc8f6c20d2..36416fdfcf68 100644 --- a/include/asm-mips/cacheflush.h +++ b/include/asm-mips/cacheflush.h | |||
@@ -21,7 +21,6 @@ | |||
21 | * - flush_cache_range(vma, start, end) flushes a range of pages | 21 | * - flush_cache_range(vma, start, end) flushes a range of pages |
22 | * - flush_icache_range(start, end) flush a range of instructions | 22 | * - flush_icache_range(start, end) flush a range of instructions |
23 | * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache | 23 | * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache |
24 | * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache | ||
25 | * | 24 | * |
26 | * MIPS specific flush operations: | 25 | * MIPS specific flush operations: |
27 | * | 26 | * |
@@ -39,7 +38,7 @@ extern void __flush_dcache_page(struct page *page); | |||
39 | 38 | ||
40 | static inline void flush_dcache_page(struct page *page) | 39 | static inline void flush_dcache_page(struct page *page) |
41 | { | 40 | { |
42 | if (cpu_has_dc_aliases) | 41 | if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) |
43 | __flush_dcache_page(page); | 42 | __flush_dcache_page(page); |
44 | 43 | ||
45 | } | 44 | } |
@@ -47,8 +46,13 @@ static inline void flush_dcache_page(struct page *page) | |||
47 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 46 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
48 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 47 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
49 | 48 | ||
50 | extern void (*flush_icache_page)(struct vm_area_struct *vma, | 49 | extern void (*__flush_icache_page)(struct vm_area_struct *vma, |
51 | struct page *page); | 50 | struct page *page); |
51 | static inline void flush_icache_page(struct vm_area_struct *vma, | ||
52 | struct page *page) | ||
53 | { | ||
54 | } | ||
55 | |||
52 | extern void (*flush_icache_range)(unsigned long start, unsigned long end); | 56 | extern void (*flush_icache_range)(unsigned long start, unsigned long end); |
53 | #define flush_cache_vmap(start, end) flush_cache_all() | 57 | #define flush_cache_vmap(start, end) flush_cache_all() |
54 | #define flush_cache_vunmap(start, end) flush_cache_all() | 58 | #define flush_cache_vunmap(start, end) flush_cache_all() |
@@ -60,7 +64,7 @@ static inline void copy_to_user_page(struct vm_area_struct *vma, | |||
60 | if (cpu_has_dc_aliases) | 64 | if (cpu_has_dc_aliases) |
61 | flush_cache_page(vma, vaddr, page_to_pfn(page)); | 65 | flush_cache_page(vma, vaddr, page_to_pfn(page)); |
62 | memcpy(dst, src, len); | 66 | memcpy(dst, src, len); |
63 | flush_icache_page(vma, page); | 67 | __flush_icache_page(vma, page); |
64 | } | 68 | } |
65 | 69 | ||
66 | static inline void copy_from_user_page(struct vm_area_struct *vma, | 70 | static inline void copy_from_user_page(struct vm_area_struct *vma, |
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h index 787220e6c1fc..00a50ec1c19f 100644 --- a/include/asm-mips/fcntl.h +++ b/include/asm-mips/fcntl.h | |||
@@ -25,8 +25,6 @@ | |||
25 | 25 | ||
26 | #define F_SETOWN 24 /* for sockets. */ | 26 | #define F_SETOWN 24 /* for sockets. */ |
27 | #define F_GETOWN 23 /* for sockets. */ | 27 | #define F_GETOWN 23 /* for sockets. */ |
28 | #define F_SETSIG 10 /* for sockets. */ | ||
29 | #define F_GETSIG 11 /* for sockets. */ | ||
30 | 28 | ||
31 | #ifndef __mips64 | 29 | #ifndef __mips64 |
32 | #define F_GETLK64 33 /* using 'struct flock64' */ | 30 | #define F_GETLK64 33 /* using 'struct flock64' */ |
diff --git a/include/asm-mips/galileo-boards/gt96100.h b/include/asm-mips/galileo-boards/gt96100.h deleted file mode 100644 index aabd1b629c19..000000000000 --- a/include/asm-mips/galileo-boards/gt96100.h +++ /dev/null | |||
@@ -1,427 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2000 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. | ||
4 | * stevel@mvista.com or source@mvista.com | ||
5 | * | ||
6 | * This program is free software; you can distribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License (Version 2) as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
13 | * for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
18 | * | ||
19 | * Register offsets of the MIPS GT96100 Advanced Communication Controller. | ||
20 | */ | ||
21 | #ifndef _GT96100_H | ||
22 | #define _GT96100_H | ||
23 | |||
24 | /* | ||
25 | * Galileo GT96100 internal register base. | ||
26 | */ | ||
27 | #define MIPS_GT96100_BASE (KSEG1ADDR(0x14000000)) | ||
28 | |||
29 | #define GT96100_WRITE(ofs, data) \ | ||
30 | *(volatile u32 *)(MIPS_GT96100_BASE+ofs) = cpu_to_le32(data) | ||
31 | #define GT96100_READ(ofs) \ | ||
32 | le32_to_cpu(*(volatile u32 *)(MIPS_GT96100_BASE+ofs)) | ||
33 | |||
34 | #define GT96100_ETH_IO_SIZE 0x4000 | ||
35 | |||
36 | /************************************************************************ | ||
37 | * Register offset addresses follow | ||
38 | ************************************************************************/ | ||
39 | |||
40 | /* CPU Interface Control Registers */ | ||
41 | #define GT96100_CPU_INTERF_CONFIG 0x000000 | ||
42 | |||
43 | /* Ethernet Ports */ | ||
44 | #define GT96100_ETH_PHY_ADDR_REG 0x080800 | ||
45 | #define GT96100_ETH_SMI_REG 0x080810 | ||
46 | /* | ||
47 | These are offsets to port 0 registers. Add GT96100_ETH_IO_SIZE to | ||
48 | get offsets to port 1 registers. | ||
49 | */ | ||
50 | #define GT96100_ETH_PORT_CONFIG 0x084800 | ||
51 | #define GT96100_ETH_PORT_CONFIG_EXT 0x084808 | ||
52 | #define GT96100_ETH_PORT_COMM 0x084810 | ||
53 | #define GT96100_ETH_PORT_STATUS 0x084818 | ||
54 | #define GT96100_ETH_SER_PARAM 0x084820 | ||
55 | #define GT96100_ETH_HASH_TBL_PTR 0x084828 | ||
56 | #define GT96100_ETH_FLOW_CNTRL_SRC_ADDR_L 0x084830 | ||
57 | #define GT96100_ETH_FLOW_CNTRL_SRC_ADDR_H 0x084838 | ||
58 | #define GT96100_ETH_SDMA_CONFIG 0x084840 | ||
59 | #define GT96100_ETH_SDMA_COMM 0x084848 | ||
60 | #define GT96100_ETH_INT_CAUSE 0x084850 | ||
61 | #define GT96100_ETH_INT_MASK 0x084858 | ||
62 | #define GT96100_ETH_1ST_RX_DESC_PTR0 0x084880 | ||
63 | #define GT96100_ETH_1ST_RX_DESC_PTR1 0x084884 | ||
64 | #define GT96100_ETH_1ST_RX_DESC_PTR2 0x084888 | ||
65 | #define GT96100_ETH_1ST_RX_DESC_PTR3 0x08488C | ||
66 | #define GT96100_ETH_CURR_RX_DESC_PTR0 0x0848A0 | ||
67 | #define GT96100_ETH_CURR_RX_DESC_PTR1 0x0848A4 | ||
68 | #define GT96100_ETH_CURR_RX_DESC_PTR2 0x0848A8 | ||
69 | #define GT96100_ETH_CURR_RX_DESC_PTR3 0x0848AC | ||
70 | #define GT96100_ETH_CURR_TX_DESC_PTR0 0x0848E0 | ||
71 | #define GT96100_ETH_CURR_TX_DESC_PTR1 0x0848E4 | ||
72 | #define GT96100_ETH_MIB_COUNT_BASE 0x085800 | ||
73 | |||
74 | /* SDMAs */ | ||
75 | #define GT96100_SDMA_GROUP_CONFIG 0x101AF0 | ||
76 | /* SDMA Group 0 */ | ||
77 | #define GT96100_SDMA_G0_CHAN0_CONFIG 0x000900 | ||
78 | #define GT96100_SDMA_G0_CHAN0_COMM 0x000908 | ||
79 | #define GT96100_SDMA_G0_CHAN0_RX_DESC_BASE 0x008900 | ||
80 | #define GT96100_SDMA_G0_CHAN0_CURR_RX_DESC_PTR 0x008910 | ||
81 | #define GT96100_SDMA_G0_CHAN0_TX_DESC_BASE 0x00C900 | ||
82 | #define GT96100_SDMA_G0_CHAN0_CURR_TX_DESC_PTR 0x00C910 | ||
83 | #define GT96100_SDMA_G0_CHAN0_1ST_TX_DESC_PTR 0x00C914 | ||
84 | #define GT96100_SDMA_G0_CHAN1_CONFIG 0x010900 | ||
85 | #define GT96100_SDMA_G0_CHAN1_COMM 0x010908 | ||
86 | #define GT96100_SDMA_G0_CHAN1_RX_DESC_BASE 0x018900 | ||
87 | #define GT96100_SDMA_G0_CHAN1_CURR_RX_DESC_PTR 0x018910 | ||
88 | #define GT96100_SDMA_G0_CHAN1_TX_DESC_BASE 0x01C900 | ||
89 | #define GT96100_SDMA_G0_CHAN1_CURR_TX_DESC_PTR 0x01C910 | ||
90 | #define GT96100_SDMA_G0_CHAN1_1ST_TX_DESC_PTR 0x01C914 | ||
91 | #define GT96100_SDMA_G0_CHAN2_CONFIG 0x020900 | ||
92 | #define GT96100_SDMA_G0_CHAN2_COMM 0x020908 | ||
93 | #define GT96100_SDMA_G0_CHAN2_RX_DESC_BASE 0x028900 | ||
94 | #define GT96100_SDMA_G0_CHAN2_CURR_RX_DESC_PTR 0x028910 | ||
95 | #define GT96100_SDMA_G0_CHAN2_TX_DESC_BASE 0x02C900 | ||
96 | #define GT96100_SDMA_G0_CHAN2_CURR_TX_DESC_PTR 0x02C910 | ||
97 | #define GT96100_SDMA_G0_CHAN2_1ST_TX_DESC_PTR 0x02C914 | ||
98 | #define GT96100_SDMA_G0_CHAN3_CONFIG 0x030900 | ||
99 | #define GT96100_SDMA_G0_CHAN3_COMM 0x030908 | ||
100 | #define GT96100_SDMA_G0_CHAN3_RX_DESC_BASE 0x038900 | ||
101 | #define GT96100_SDMA_G0_CHAN3_CURR_RX_DESC_PTR 0x038910 | ||
102 | #define GT96100_SDMA_G0_CHAN3_TX_DESC_BASE 0x03C900 | ||
103 | #define GT96100_SDMA_G0_CHAN3_CURR_TX_DESC_PTR 0x03C910 | ||
104 | #define GT96100_SDMA_G0_CHAN3_1ST_TX_DESC_PTR 0x03C914 | ||
105 | #define GT96100_SDMA_G0_CHAN4_CONFIG 0x040900 | ||
106 | #define GT96100_SDMA_G0_CHAN4_COMM 0x040908 | ||
107 | #define GT96100_SDMA_G0_CHAN4_RX_DESC_BASE 0x048900 | ||
108 | #define GT96100_SDMA_G0_CHAN4_CURR_RX_DESC_PTR 0x048910 | ||
109 | #define GT96100_SDMA_G0_CHAN4_TX_DESC_BASE 0x04C900 | ||
110 | #define GT96100_SDMA_G0_CHAN4_CURR_TX_DESC_PTR 0x04C910 | ||
111 | #define GT96100_SDMA_G0_CHAN4_1ST_TX_DESC_PTR 0x04C914 | ||
112 | #define GT96100_SDMA_G0_CHAN5_CONFIG 0x050900 | ||
113 | #define GT96100_SDMA_G0_CHAN5_COMM 0x050908 | ||
114 | #define GT96100_SDMA_G0_CHAN5_RX_DESC_BASE 0x058900 | ||
115 | #define GT96100_SDMA_G0_CHAN5_CURR_RX_DESC_PTR 0x058910 | ||
116 | #define GT96100_SDMA_G0_CHAN5_TX_DESC_BASE 0x05C900 | ||
117 | #define GT96100_SDMA_G0_CHAN5_CURR_TX_DESC_PTR 0x05C910 | ||
118 | #define GT96100_SDMA_G0_CHAN5_1ST_TX_DESC_PTR 0x05C914 | ||
119 | #define GT96100_SDMA_G0_CHAN6_CONFIG 0x060900 | ||
120 | #define GT96100_SDMA_G0_CHAN6_COMM 0x060908 | ||
121 | #define GT96100_SDMA_G0_CHAN6_RX_DESC_BASE 0x068900 | ||
122 | #define GT96100_SDMA_G0_CHAN6_CURR_RX_DESC_PTR 0x068910 | ||
123 | #define GT96100_SDMA_G0_CHAN6_TX_DESC_BASE 0x06C900 | ||
124 | #define GT96100_SDMA_G0_CHAN6_CURR_TX_DESC_PTR 0x06C910 | ||
125 | #define GT96100_SDMA_G0_CHAN6_1ST_TX_DESC_PTR 0x06C914 | ||
126 | #define GT96100_SDMA_G0_CHAN7_CONFIG 0x070900 | ||
127 | #define GT96100_SDMA_G0_CHAN7_COMM 0x070908 | ||
128 | #define GT96100_SDMA_G0_CHAN7_RX_DESC_BASE 0x078900 | ||
129 | #define GT96100_SDMA_G0_CHAN7_CURR_RX_DESC_PTR 0x078910 | ||
130 | #define GT96100_SDMA_G0_CHAN7_TX_DESC_BASE 0x07C900 | ||
131 | #define GT96100_SDMA_G0_CHAN7_CURR_TX_DESC_PTR 0x07C910 | ||
132 | #define GT96100_SDMA_G0_CHAN7_1ST_TX_DESC_PTR 0x07C914 | ||
133 | /* SDMA Group 1 */ | ||
134 | #define GT96100_SDMA_G1_CHAN0_CONFIG 0x100900 | ||
135 | #define GT96100_SDMA_G1_CHAN0_COMM 0x100908 | ||
136 | #define GT96100_SDMA_G1_CHAN0_RX_DESC_BASE 0x108900 | ||
137 | #define GT96100_SDMA_G1_CHAN0_CURR_RX_DESC_PTR 0x108910 | ||
138 | #define GT96100_SDMA_G1_CHAN0_TX_DESC_BASE 0x10C900 | ||
139 | #define GT96100_SDMA_G1_CHAN0_CURR_TX_DESC_PTR 0x10C910 | ||
140 | #define GT96100_SDMA_G1_CHAN0_1ST_TX_DESC_PTR 0x10C914 | ||
141 | #define GT96100_SDMA_G1_CHAN1_CONFIG 0x110900 | ||
142 | #define GT96100_SDMA_G1_CHAN1_COMM 0x110908 | ||
143 | #define GT96100_SDMA_G1_CHAN1_RX_DESC_BASE 0x118900 | ||
144 | #define GT96100_SDMA_G1_CHAN1_CURR_RX_DESC_PTR 0x118910 | ||
145 | #define GT96100_SDMA_G1_CHAN1_TX_DESC_BASE 0x11C900 | ||
146 | #define GT96100_SDMA_G1_CHAN1_CURR_TX_DESC_PTR 0x11C910 | ||
147 | #define GT96100_SDMA_G1_CHAN1_1ST_TX_DESC_PTR 0x11C914 | ||
148 | #define GT96100_SDMA_G1_CHAN2_CONFIG 0x120900 | ||
149 | #define GT96100_SDMA_G1_CHAN2_COMM 0x120908 | ||
150 | #define GT96100_SDMA_G1_CHAN2_RX_DESC_BASE 0x128900 | ||
151 | #define GT96100_SDMA_G1_CHAN2_CURR_RX_DESC_PTR 0x128910 | ||
152 | #define GT96100_SDMA_G1_CHAN2_TX_DESC_BASE 0x12C900 | ||
153 | #define GT96100_SDMA_G1_CHAN2_CURR_TX_DESC_PTR 0x12C910 | ||
154 | #define GT96100_SDMA_G1_CHAN2_1ST_TX_DESC_PTR 0x12C914 | ||
155 | #define GT96100_SDMA_G1_CHAN3_CONFIG 0x130900 | ||
156 | #define GT96100_SDMA_G1_CHAN3_COMM 0x130908 | ||
157 | #define GT96100_SDMA_G1_CHAN3_RX_DESC_BASE 0x138900 | ||
158 | #define GT96100_SDMA_G1_CHAN3_CURR_RX_DESC_PTR 0x138910 | ||
159 | #define GT96100_SDMA_G1_CHAN3_TX_DESC_BASE 0x13C900 | ||
160 | #define GT96100_SDMA_G1_CHAN3_CURR_TX_DESC_PTR 0x13C910 | ||
161 | #define GT96100_SDMA_G1_CHAN3_1ST_TX_DESC_PTR 0x13C914 | ||
162 | #define GT96100_SDMA_G1_CHAN4_CONFIG 0x140900 | ||
163 | #define GT96100_SDMA_G1_CHAN4_COMM 0x140908 | ||
164 | #define GT96100_SDMA_G1_CHAN4_RX_DESC_BASE 0x148900 | ||
165 | #define GT96100_SDMA_G1_CHAN4_CURR_RX_DESC_PTR 0x148910 | ||
166 | #define GT96100_SDMA_G1_CHAN4_TX_DESC_BASE 0x14C900 | ||
167 | #define GT96100_SDMA_G1_CHAN4_CURR_TX_DESC_PTR 0x14C910 | ||
168 | #define GT96100_SDMA_G1_CHAN4_1ST_TX_DESC_PTR 0x14C914 | ||
169 | #define GT96100_SDMA_G1_CHAN5_CONFIG 0x150900 | ||
170 | #define GT96100_SDMA_G1_CHAN5_COMM 0x150908 | ||
171 | #define GT96100_SDMA_G1_CHAN5_RX_DESC_BASE 0x158900 | ||
172 | #define GT96100_SDMA_G1_CHAN5_CURR_RX_DESC_PTR 0x158910 | ||
173 | #define GT96100_SDMA_G1_CHAN5_TX_DESC_BASE 0x15C900 | ||
174 | #define GT96100_SDMA_G1_CHAN5_CURR_TX_DESC_PTR 0x15C910 | ||
175 | #define GT96100_SDMA_G1_CHAN5_1ST_TX_DESC_PTR 0x15C914 | ||
176 | #define GT96100_SDMA_G1_CHAN6_CONFIG 0x160900 | ||
177 | #define GT96100_SDMA_G1_CHAN6_COMM 0x160908 | ||
178 | #define GT96100_SDMA_G1_CHAN6_RX_DESC_BASE 0x168900 | ||
179 | #define GT96100_SDMA_G1_CHAN6_CURR_RX_DESC_PTR 0x168910 | ||
180 | #define GT96100_SDMA_G1_CHAN6_TX_DESC_BASE 0x16C900 | ||
181 | #define GT96100_SDMA_G1_CHAN6_CURR_TX_DESC_PTR 0x16C910 | ||
182 | #define GT96100_SDMA_G1_CHAN6_1ST_TX_DESC_PTR 0x16C914 | ||
183 | #define GT96100_SDMA_G1_CHAN7_CONFIG 0x170900 | ||
184 | #define GT96100_SDMA_G1_CHAN7_COMM 0x170908 | ||
185 | #define GT96100_SDMA_G1_CHAN7_RX_DESC_BASE 0x178900 | ||
186 | #define GT96100_SDMA_G1_CHAN7_CURR_RX_DESC_PTR 0x178910 | ||
187 | #define GT96100_SDMA_G1_CHAN7_TX_DESC_BASE 0x17C900 | ||
188 | #define GT96100_SDMA_G1_CHAN7_CURR_TX_DESC_PTR 0x17C910 | ||
189 | #define GT96100_SDMA_G1_CHAN7_1ST_TX_DESC_PTR 0x17C914 | ||
190 | /* MPSCs */ | ||
191 | #define GT96100_MPSC0_MAIN_CONFIG_LOW 0x000A00 | ||
192 | #define GT96100_MPSC0_MAIN_CONFIG_HIGH 0x000A04 | ||
193 | #define GT96100_MPSC0_PROTOCOL_CONFIG 0x000A08 | ||
194 | #define GT96100_MPSC_CHAN0_REG1 0x000A0C | ||
195 | #define GT96100_MPSC_CHAN0_REG2 0x000A10 | ||
196 | #define GT96100_MPSC_CHAN0_REG3 0x000A14 | ||
197 | #define GT96100_MPSC_CHAN0_REG4 0x000A18 | ||
198 | #define GT96100_MPSC_CHAN0_REG5 0x000A1C | ||
199 | #define GT96100_MPSC_CHAN0_REG6 0x000A20 | ||
200 | #define GT96100_MPSC_CHAN0_REG7 0x000A24 | ||
201 | #define GT96100_MPSC_CHAN0_REG8 0x000A28 | ||
202 | #define GT96100_MPSC_CHAN0_REG9 0x000A2C | ||
203 | #define GT96100_MPSC_CHAN0_REG10 0x000A30 | ||
204 | #define GT96100_MPSC_CHAN0_REG11 0x000A34 | ||
205 | #define GT96100_MPSC1_MAIN_CONFIG_LOW 0x008A00 | ||
206 | #define GT96100_MPSC1_MAIN_CONFIG_HIGH 0x008A04 | ||
207 | #define GT96100_MPSC1_PROTOCOL_CONFIG 0x008A08 | ||
208 | #define GT96100_MPSC_CHAN1_REG1 0x008A0C | ||
209 | #define GT96100_MPSC_CHAN1_REG2 0x008A10 | ||
210 | #define GT96100_MPSC_CHAN1_REG3 0x008A14 | ||
211 | #define GT96100_MPSC_CHAN1_REG4 0x008A18 | ||
212 | #define GT96100_MPSC_CHAN1_REG5 0x008A1C | ||
213 | #define GT96100_MPSC_CHAN1_REG6 0x008A20 | ||
214 | #define GT96100_MPSC_CHAN1_REG7 0x008A24 | ||
215 | #define GT96100_MPSC_CHAN1_REG8 0x008A28 | ||
216 | #define GT96100_MPSC_CHAN1_REG9 0x008A2C | ||
217 | #define GT96100_MPSC_CHAN1_REG10 0x008A30 | ||
218 | #define GT96100_MPSC_CHAN1_REG11 0x008A34 | ||
219 | #define GT96100_MPSC2_MAIN_CONFIG_LOW 0x010A00 | ||
220 | #define GT96100_MPSC2_MAIN_CONFIG_HIGH 0x010A04 | ||
221 | #define GT96100_MPSC2_PROTOCOL_CONFIG 0x010A08 | ||
222 | #define GT96100_MPSC_CHAN2_REG1 0x010A0C | ||
223 | #define GT96100_MPSC_CHAN2_REG2 0x010A10 | ||
224 | #define GT96100_MPSC_CHAN2_REG3 0x010A14 | ||
225 | #define GT96100_MPSC_CHAN2_REG4 0x010A18 | ||
226 | #define GT96100_MPSC_CHAN2_REG5 0x010A1C | ||
227 | #define GT96100_MPSC_CHAN2_REG6 0x010A20 | ||
228 | #define GT96100_MPSC_CHAN2_REG7 0x010A24 | ||
229 | #define GT96100_MPSC_CHAN2_REG8 0x010A28 | ||
230 | #define GT96100_MPSC_CHAN2_REG9 0x010A2C | ||
231 | #define GT96100_MPSC_CHAN2_REG10 0x010A30 | ||
232 | #define GT96100_MPSC_CHAN2_REG11 0x010A34 | ||
233 | #define GT96100_MPSC3_MAIN_CONFIG_LOW 0x018A00 | ||
234 | #define GT96100_MPSC3_MAIN_CONFIG_HIGH 0x018A04 | ||
235 | #define GT96100_MPSC3_PROTOCOL_CONFIG 0x018A08 | ||
236 | #define GT96100_MPSC_CHAN3_REG1 0x018A0C | ||
237 | #define GT96100_MPSC_CHAN3_REG2 0x018A10 | ||
238 | #define GT96100_MPSC_CHAN3_REG3 0x018A14 | ||
239 | #define GT96100_MPSC_CHAN3_REG4 0x018A18 | ||
240 | #define GT96100_MPSC_CHAN3_REG5 0x018A1C | ||
241 | #define GT96100_MPSC_CHAN3_REG6 0x018A20 | ||
242 | #define GT96100_MPSC_CHAN3_REG7 0x018A24 | ||
243 | #define GT96100_MPSC_CHAN3_REG8 0x018A28 | ||
244 | #define GT96100_MPSC_CHAN3_REG9 0x018A2C | ||
245 | #define GT96100_MPSC_CHAN3_REG10 0x018A30 | ||
246 | #define GT96100_MPSC_CHAN3_REG11 0x018A34 | ||
247 | #define GT96100_MPSC4_MAIN_CONFIG_LOW 0x020A00 | ||
248 | #define GT96100_MPSC4_MAIN_CONFIG_HIGH 0x020A04 | ||
249 | #define GT96100_MPSC4_PROTOCOL_CONFIG 0x020A08 | ||
250 | #define GT96100_MPSC_CHAN4_REG1 0x020A0C | ||
251 | #define GT96100_MPSC_CHAN4_REG2 0x020A10 | ||
252 | #define GT96100_MPSC_CHAN4_REG3 0x020A14 | ||
253 | #define GT96100_MPSC_CHAN4_REG4 0x020A18 | ||
254 | #define GT96100_MPSC_CHAN4_REG5 0x020A1C | ||
255 | #define GT96100_MPSC_CHAN4_REG6 0x020A20 | ||
256 | #define GT96100_MPSC_CHAN4_REG7 0x020A24 | ||
257 | #define GT96100_MPSC_CHAN4_REG8 0x020A28 | ||
258 | #define GT96100_MPSC_CHAN4_REG9 0x020A2C | ||
259 | #define GT96100_MPSC_CHAN4_REG10 0x020A30 | ||
260 | #define GT96100_MPSC_CHAN4_REG11 0x020A34 | ||
261 | #define GT96100_MPSC5_MAIN_CONFIG_LOW 0x028A00 | ||
262 | #define GT96100_MPSC5_MAIN_CONFIG_HIGH 0x028A04 | ||
263 | #define GT96100_MPSC5_PROTOCOL_CONFIG 0x028A08 | ||
264 | #define GT96100_MPSC_CHAN5_REG1 0x028A0C | ||
265 | #define GT96100_MPSC_CHAN5_REG2 0x028A10 | ||
266 | #define GT96100_MPSC_CHAN5_REG3 0x028A14 | ||
267 | #define GT96100_MPSC_CHAN5_REG4 0x028A18 | ||
268 | #define GT96100_MPSC_CHAN5_REG5 0x028A1C | ||
269 | #define GT96100_MPSC_CHAN5_REG6 0x028A20 | ||
270 | #define GT96100_MPSC_CHAN5_REG7 0x028A24 | ||
271 | #define GT96100_MPSC_CHAN5_REG8 0x028A28 | ||
272 | #define GT96100_MPSC_CHAN5_REG9 0x028A2C | ||
273 | #define GT96100_MPSC_CHAN5_REG10 0x028A30 | ||
274 | #define GT96100_MPSC_CHAN5_REG11 0x028A34 | ||
275 | #define GT96100_MPSC6_MAIN_CONFIG_LOW 0x030A00 | ||
276 | #define GT96100_MPSC6_MAIN_CONFIG_HIGH 0x030A04 | ||
277 | #define GT96100_MPSC6_PROTOCOL_CONFIG 0x030A08 | ||
278 | #define GT96100_MPSC_CHAN6_REG1 0x030A0C | ||
279 | #define GT96100_MPSC_CHAN6_REG2 0x030A10 | ||
280 | #define GT96100_MPSC_CHAN6_REG3 0x030A14 | ||
281 | #define GT96100_MPSC_CHAN6_REG4 0x030A18 | ||
282 | #define GT96100_MPSC_CHAN6_REG5 0x030A1C | ||
283 | #define GT96100_MPSC_CHAN6_REG6 0x030A20 | ||
284 | #define GT96100_MPSC_CHAN6_REG7 0x030A24 | ||
285 | #define GT96100_MPSC_CHAN6_REG8 0x030A28 | ||
286 | #define GT96100_MPSC_CHAN6_REG9 0x030A2C | ||
287 | #define GT96100_MPSC_CHAN6_REG10 0x030A30 | ||
288 | #define GT96100_MPSC_CHAN6_REG11 0x030A34 | ||
289 | #define GT96100_MPSC7_MAIN_CONFIG_LOW 0x038A00 | ||
290 | #define GT96100_MPSC7_MAIN_CONFIG_HIGH 0x038A04 | ||
291 | #define GT96100_MPSC7_PROTOCOL_CONFIG 0x038A08 | ||
292 | #define GT96100_MPSC_CHAN7_REG1 0x038A0C | ||
293 | #define GT96100_MPSC_CHAN7_REG2 0x038A10 | ||
294 | #define GT96100_MPSC_CHAN7_REG3 0x038A14 | ||
295 | #define GT96100_MPSC_CHAN7_REG4 0x038A18 | ||
296 | #define GT96100_MPSC_CHAN7_REG5 0x038A1C | ||
297 | #define GT96100_MPSC_CHAN7_REG6 0x038A20 | ||
298 | #define GT96100_MPSC_CHAN7_REG7 0x038A24 | ||
299 | #define GT96100_MPSC_CHAN7_REG8 0x038A28 | ||
300 | #define GT96100_MPSC_CHAN7_REG9 0x038A2C | ||
301 | #define GT96100_MPSC_CHAN7_REG10 0x038A30 | ||
302 | #define GT96100_MPSC_CHAN7_REG11 0x038A34 | ||
303 | /* FlexTDMs */ | ||
304 | /* TDPR0 - Transmit Dual Port RAM. block size 0xff */ | ||
305 | #define GT96100_FXTDM0_TDPR0_BLK0_BASE 0x000B00 | ||
306 | #define GT96100_FXTDM0_TDPR0_BLK1_BASE 0x001B00 | ||
307 | #define GT96100_FXTDM0_TDPR0_BLK2_BASE 0x002B00 | ||
308 | #define GT96100_FXTDM0_TDPR0_BLK3_BASE 0x003B00 | ||
309 | /* RDPR0 - Receive Dual Port RAM. block size 0xff */ | ||
310 | #define GT96100_FXTDM0_RDPR0_BLK0_BASE 0x004B00 | ||
311 | #define GT96100_FXTDM0_RDPR0_BLK1_BASE 0x005B00 | ||
312 | #define GT96100_FXTDM0_RDPR0_BLK2_BASE 0x006B00 | ||
313 | #define GT96100_FXTDM0_RDPR0_BLK3_BASE 0x007B00 | ||
314 | #define GT96100_FXTDM0_TX_READ_PTR 0x008B00 | ||
315 | #define GT96100_FXTDM0_RX_READ_PTR 0x008B04 | ||
316 | #define GT96100_FXTDM0_CONFIG 0x008B08 | ||
317 | #define GT96100_FXTDM0_AUX_CHANA_TX 0x008B0C | ||
318 | #define GT96100_FXTDM0_AUX_CHANA_RX 0x008B10 | ||
319 | #define GT96100_FXTDM0_AUX_CHANB_TX 0x008B14 | ||
320 | #define GT96100_FXTDM0_AUX_CHANB_RX 0x008B18 | ||
321 | #define GT96100_FXTDM1_TDPR1_BLK0_BASE 0x010B00 | ||
322 | #define GT96100_FXTDM1_TDPR1_BLK1_BASE 0x011B00 | ||
323 | #define GT96100_FXTDM1_TDPR1_BLK2_BASE 0x012B00 | ||
324 | #define GT96100_FXTDM1_TDPR1_BLK3_BASE 0x013B00 | ||
325 | #define GT96100_FXTDM1_RDPR1_BLK0_BASE 0x014B00 | ||
326 | #define GT96100_FXTDM1_RDPR1_BLK1_BASE 0x015B00 | ||
327 | #define GT96100_FXTDM1_RDPR1_BLK2_BASE 0x016B00 | ||
328 | #define GT96100_FXTDM1_RDPR1_BLK3_BASE 0x017B00 | ||
329 | #define GT96100_FXTDM1_TX_READ_PTR 0x018B00 | ||
330 | #define GT96100_FXTDM1_RX_READ_PTR 0x018B04 | ||
331 | #define GT96100_FXTDM1_CONFIG 0x018B08 | ||
332 | #define GT96100_FXTDM1_AUX_CHANA_TX 0x018B0C | ||
333 | #define GT96100_FXTDM1_AUX_CHANA_RX 0x018B10 | ||
334 | #define GT96100_FLTDM1_AUX_CHANB_TX 0x018B14 | ||
335 | #define GT96100_FLTDM1_AUX_CHANB_RX 0x018B18 | ||
336 | #define GT96100_FLTDM2_TDPR2_BLK0_BASE 0x020B00 | ||
337 | #define GT96100_FLTDM2_TDPR2_BLK1_BASE 0x021B00 | ||
338 | #define GT96100_FLTDM2_TDPR2_BLK2_BASE 0x022B00 | ||
339 | #define GT96100_FLTDM2_TDPR2_BLK3_BASE 0x023B00 | ||
340 | #define GT96100_FLTDM2_RDPR2_BLK0_BASE 0x024B00 | ||
341 | #define GT96100_FLTDM2_RDPR2_BLK1_BASE 0x025B00 | ||
342 | #define GT96100_FLTDM2_RDPR2_BLK2_BASE 0x026B00 | ||
343 | #define GT96100_FLTDM2_RDPR2_BLK3_BASE 0x027B00 | ||
344 | #define GT96100_FLTDM2_TX_READ_PTR 0x028B00 | ||
345 | #define GT96100_FLTDM2_RX_READ_PTR 0x028B04 | ||
346 | #define GT96100_FLTDM2_CONFIG 0x028B08 | ||
347 | #define GT96100_FLTDM2_AUX_CHANA_TX 0x028B0C | ||
348 | #define GT96100_FLTDM2_AUX_CHANA_RX 0x028B10 | ||
349 | #define GT96100_FLTDM2_AUX_CHANB_TX 0x028B14 | ||
350 | #define GT96100_FLTDM2_AUX_CHANB_RX 0x028B18 | ||
351 | #define GT96100_FLTDM3_TDPR3_BLK0_BASE 0x030B00 | ||
352 | #define GT96100_FLTDM3_TDPR3_BLK1_BASE 0x031B00 | ||
353 | #define GT96100_FLTDM3_TDPR3_BLK2_BASE 0x032B00 | ||
354 | #define GT96100_FLTDM3_TDPR3_BLK3_BASE 0x033B00 | ||
355 | #define GT96100_FXTDM3_RDPR3_BLK0_BASE 0x034B00 | ||
356 | #define GT96100_FXTDM3_RDPR3_BLK1_BASE 0x035B00 | ||
357 | #define GT96100_FXTDM3_RDPR3_BLK2_BASE 0x036B00 | ||
358 | #define GT96100_FXTDM3_RDPR3_BLK3_BASE 0x037B00 | ||
359 | #define GT96100_FXTDM3_TX_READ_PTR 0x038B00 | ||
360 | #define GT96100_FXTDM3_RX_READ_PTR 0x038B04 | ||
361 | #define GT96100_FXTDM3_CONFIG 0x038B08 | ||
362 | #define GT96100_FXTDM3_AUX_CHANA_TX 0x038B0C | ||
363 | #define GT96100_FXTDM3_AUX_CHANA_RX 0x038B10 | ||
364 | #define GT96100_FXTDM3_AUX_CHANB_TX 0x038B14 | ||
365 | #define GT96100_FXTDM3_AUX_CHANB_RX 0x038B18 | ||
366 | /* Baud Rate Generators */ | ||
367 | #define GT96100_BRG0_CONFIG 0x102A00 | ||
368 | #define GT96100_BRG0_BAUD_TUNE 0x102A04 | ||
369 | #define GT96100_BRG1_CONFIG 0x102A08 | ||
370 | #define GT96100_BRG1_BAUD_TUNE 0x102A0C | ||
371 | #define GT96100_BRG2_CONFIG 0x102A10 | ||
372 | #define GT96100_BRG2_BAUD_TUNE 0x102A14 | ||
373 | #define GT96100_BRG3_CONFIG 0x102A18 | ||
374 | #define GT96100_BRG3_BAUD_TUNE 0x102A1C | ||
375 | #define GT96100_BRG4_CONFIG 0x102A20 | ||
376 | #define GT96100_BRG4_BAUD_TUNE 0x102A24 | ||
377 | #define GT96100_BRG5_CONFIG 0x102A28 | ||
378 | #define GT96100_BRG5_BAUD_TUNE 0x102A2C | ||
379 | #define GT96100_BRG6_CONFIG 0x102A30 | ||
380 | #define GT96100_BRG6_BAUD_TUNE 0x102A34 | ||
381 | #define GT96100_BRG7_CONFIG 0x102A38 | ||
382 | #define GT96100_BRG7_BAUD_TUNE 0x102A3C | ||
383 | /* Routing Registers */ | ||
384 | #define GT96100_ROUTE_MAIN 0x101A00 | ||
385 | #define GT96100_ROUTE_RX_CLOCK 0x101A10 | ||
386 | #define GT96100_ROUTE_TX_CLOCK 0x101A20 | ||
387 | /* General Purpose Ports */ | ||
388 | #define GT96100_GPP_CONFIG0 0x100A00 | ||
389 | #define GT96100_GPP_CONFIG1 0x100A04 | ||
390 | #define GT96100_GPP_CONFIG2 0x100A08 | ||
391 | #define GT96100_GPP_CONFIG3 0x100A0C | ||
392 | #define GT96100_GPP_IO0 0x100A20 | ||
393 | #define GT96100_GPP_IO1 0x100A24 | ||
394 | #define GT96100_GPP_IO2 0x100A28 | ||
395 | #define GT96100_GPP_IO3 0x100A2C | ||
396 | #define GT96100_GPP_DATA0 0x100A40 | ||
397 | #define GT96100_GPP_DATA1 0x100A44 | ||
398 | #define GT96100_GPP_DATA2 0x100A48 | ||
399 | #define GT96100_GPP_DATA3 0x100A4C | ||
400 | #define GT96100_GPP_LEVEL0 0x100A60 | ||
401 | #define GT96100_GPP_LEVEL1 0x100A64 | ||
402 | #define GT96100_GPP_LEVEL2 0x100A68 | ||
403 | #define GT96100_GPP_LEVEL3 0x100A6C | ||
404 | /* Watchdog */ | ||
405 | #define GT96100_WD_CONFIG 0x101A80 | ||
406 | #define GT96100_WD_VALUE 0x101A84 | ||
407 | /* Communication Unit Arbiter */ | ||
408 | #define GT96100_COMM_UNIT_ARBTR_CONFIG 0x101AC0 | ||
409 | /* PCI Arbiters */ | ||
410 | #define GT96100_PCI0_ARBTR_CONFIG 0x101AE0 | ||
411 | #define GT96100_PCI1_ARBTR_CONFIG 0x101AE4 | ||
412 | /* CIU Arbiter */ | ||
413 | #define GT96100_CIU_ARBITER_CONFIG 0x101AC0 | ||
414 | /* Interrupt Controller */ | ||
415 | #define GT96100_MAIN_CAUSE 0x000C18 | ||
416 | #define GT96100_INT0_MAIN_MASK 0x000C1C | ||
417 | #define GT96100_INT1_MAIN_MASK 0x000C24 | ||
418 | #define GT96100_HIGH_CAUSE 0x000C98 | ||
419 | #define GT96100_INT0_HIGH_MASK 0x000C9C | ||
420 | #define GT96100_INT1_HIGH_MASK 0x000CA4 | ||
421 | #define GT96100_INT0_SELECT 0x000C70 | ||
422 | #define GT96100_INT1_SELECT 0x000C74 | ||
423 | #define GT96100_SERIAL_CAUSE 0x103A00 | ||
424 | #define GT96100_SERINT0_MASK 0x103A80 | ||
425 | #define GT96100_SERINT1_MASK 0x103A88 | ||
426 | |||
427 | #endif /* _GT96100_H */ | ||
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h index 25f5e8a4177d..0fe02945feba 100644 --- a/include/asm-mips/hazards.h +++ b/include/asm-mips/hazards.h | |||
@@ -12,102 +12,95 @@ | |||
12 | 12 | ||
13 | 13 | ||
14 | #ifdef __ASSEMBLY__ | 14 | #ifdef __ASSEMBLY__ |
15 | 15 | #define ASMMACRO(name, code...) .macro name; code; .endm | |
16 | .macro _ssnop | ||
17 | sll $0, $0, 1 | ||
18 | .endm | ||
19 | |||
20 | .macro _ehb | ||
21 | sll $0, $0, 3 | ||
22 | .endm | ||
23 | |||
24 | /* | ||
25 | * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent | ||
26 | * use of the JTLB for instructions should not occur for 4 cpu cycles and use | ||
27 | * for data translations should not occur for 3 cpu cycles. | ||
28 | */ | ||
29 | #ifdef CONFIG_CPU_RM9000 | ||
30 | |||
31 | .macro mtc0_tlbw_hazard | ||
32 | .set push | ||
33 | .set mips32 | ||
34 | _ssnop; _ssnop; _ssnop; _ssnop | ||
35 | .set pop | ||
36 | .endm | ||
37 | |||
38 | .macro tlbw_eret_hazard | ||
39 | .set push | ||
40 | .set mips32 | ||
41 | _ssnop; _ssnop; _ssnop; _ssnop | ||
42 | .set pop | ||
43 | .endm | ||
44 | |||
45 | #else | 16 | #else |
46 | 17 | ||
47 | /* | 18 | #define ASMMACRO(name, code...) \ |
48 | * The taken branch will result in a two cycle penalty for the two killed | 19 | __asm__(".macro " #name "; " #code "; .endm"); \ |
49 | * instructions on R4000 / R4400. Other processors only have a single cycle | 20 | \ |
50 | * hazard so this is nice trick to have an optimal code for a range of | 21 | static inline void name(void) \ |
51 | * processors. | 22 | { \ |
52 | */ | 23 | __asm__ __volatile__ (#name); \ |
53 | .macro mtc0_tlbw_hazard | 24 | } |
54 | b . + 8 | ||
55 | .endm | ||
56 | 25 | ||
57 | .macro tlbw_eret_hazard | ||
58 | .endm | ||
59 | #endif | 26 | #endif |
60 | 27 | ||
28 | ASMMACRO(_ssnop, | ||
29 | sll $0, $0, 1 | ||
30 | ) | ||
31 | |||
32 | ASMMACRO(_ehb, | ||
33 | sll $0, $0, 3 | ||
34 | ) | ||
35 | |||
61 | /* | 36 | /* |
62 | * mtc0->mfc0 hazard | 37 | * TLB hazards |
63 | * The 24K has a 2 cycle mtc0/mfc0 execution hazard. | ||
64 | * It is a MIPS32R2 processor so ehb will clear the hazard. | ||
65 | */ | 38 | */ |
39 | #if defined(CONFIG_CPU_MIPSR2) | ||
66 | 40 | ||
67 | #ifdef CONFIG_CPU_MIPSR2 | ||
68 | /* | 41 | /* |
69 | * Use a macro for ehb unless explicit support for MIPSR2 is enabled | 42 | * MIPSR2 defines ehb for hazard avoidance |
70 | */ | 43 | */ |
71 | 44 | ||
72 | #define irq_enable_hazard \ | 45 | ASMMACRO(mtc0_tlbw_hazard, |
46 | _ehb | ||
47 | ) | ||
48 | ASMMACRO(tlbw_use_hazard, | ||
49 | _ehb | ||
50 | ) | ||
51 | ASMMACRO(tlb_probe_hazard, | ||
52 | _ehb | ||
53 | ) | ||
54 | ASMMACRO(irq_enable_hazard, | ||
55 | ) | ||
56 | ASMMACRO(irq_disable_hazard, | ||
73 | _ehb | 57 | _ehb |
74 | 58 | ) | |
75 | #define irq_disable_hazard \ | 59 | ASMMACRO(back_to_back_c0_hazard, |
76 | _ehb | 60 | _ehb |
77 | 61 | ) | |
78 | #elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) | ||
79 | |||
80 | /* | 62 | /* |
81 | * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. | 63 | * gcc has a tradition of misscompiling the previous construct using the |
64 | * address of a label as argument to inline assembler. Gas otoh has the | ||
65 | * annoying difference between la and dla which are only usable for 32-bit | ||
66 | * rsp. 64-bit code, so can't be used without conditional compilation. | ||
67 | * The alterantive is switching the assembler to 64-bit code which happens | ||
68 | * to work right even for 32-bit code ... | ||
82 | */ | 69 | */ |
70 | #define instruction_hazard() \ | ||
71 | do { \ | ||
72 | unsigned long tmp; \ | ||
73 | \ | ||
74 | __asm__ __volatile__( \ | ||
75 | " .set mips64r2 \n" \ | ||
76 | " dla %0, 1f \n" \ | ||
77 | " jr.hb %0 \n" \ | ||
78 | " .set mips0 \n" \ | ||
79 | "1: \n" \ | ||
80 | : "=r" (tmp)); \ | ||
81 | } while (0) | ||
83 | 82 | ||
84 | #define irq_enable_hazard | 83 | #elif defined(CONFIG_CPU_R10000) |
85 | |||
86 | #define irq_disable_hazard | ||
87 | |||
88 | #else | ||
89 | 84 | ||
90 | /* | 85 | /* |
91 | * Classic MIPS needs 1 - 3 nops or ssnops | 86 | * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. |
92 | */ | 87 | */ |
93 | #define irq_enable_hazard | ||
94 | #define irq_disable_hazard \ | ||
95 | _ssnop; _ssnop; _ssnop | ||
96 | 88 | ||
97 | #endif | 89 | ASMMACRO(mtc0_tlbw_hazard, |
98 | 90 | ) | |
99 | #else /* __ASSEMBLY__ */ | 91 | ASMMACRO(tlbw_use_hazard, |
100 | 92 | ) | |
101 | __asm__( | 93 | ASMMACRO(tlb_probe_hazard, |
102 | " .macro _ssnop \n" | 94 | ) |
103 | " sll $0, $0, 1 \n" | 95 | ASMMACRO(irq_enable_hazard, |
104 | " .endm \n" | 96 | ) |
105 | " \n" | 97 | ASMMACRO(irq_disable_hazard, |
106 | " .macro _ehb \n" | 98 | ) |
107 | " sll $0, $0, 3 \n" | 99 | ASMMACRO(back_to_back_c0_hazard, |
108 | " .endm \n"); | 100 | ) |
101 | #define instruction_hazard() do { } while (0) | ||
109 | 102 | ||
110 | #ifdef CONFIG_CPU_RM9000 | 103 | #elif defined(CONFIG_CPU_RM9000) |
111 | 104 | ||
112 | /* | 105 | /* |
113 | * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent | 106 | * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent |
@@ -115,176 +108,73 @@ __asm__( | |||
115 | * for data translations should not occur for 3 cpu cycles. | 108 | * for data translations should not occur for 3 cpu cycles. |
116 | */ | 109 | */ |
117 | 110 | ||
118 | #define mtc0_tlbw_hazard() \ | 111 | ASMMACRO(mtc0_tlbw_hazard, |
119 | __asm__ __volatile__( \ | 112 | _ssnop; _ssnop; _ssnop; _ssnop |
120 | " .set mips32 \n" \ | 113 | ) |
121 | " _ssnop \n" \ | 114 | ASMMACRO(tlbw_use_hazard, |
122 | " _ssnop \n" \ | 115 | _ssnop; _ssnop; _ssnop; _ssnop |
123 | " _ssnop \n" \ | 116 | ) |
124 | " _ssnop \n" \ | 117 | ASMMACRO(tlb_probe_hazard, |
125 | " .set mips0 \n") | 118 | _ssnop; _ssnop; _ssnop; _ssnop |
126 | 119 | ) | |
127 | #define tlbw_use_hazard() \ | 120 | ASMMACRO(irq_enable_hazard, |
128 | __asm__ __volatile__( \ | 121 | ) |
129 | " .set mips32 \n" \ | 122 | ASMMACRO(irq_disable_hazard, |
130 | " _ssnop \n" \ | 123 | ) |
131 | " _ssnop \n" \ | 124 | ASMMACRO(back_to_back_c0_hazard, |
132 | " _ssnop \n" \ | 125 | ) |
133 | " _ssnop \n" \ | 126 | #define instruction_hazard() do { } while (0) |
134 | " .set mips0 \n") | ||
135 | |||
136 | #else | ||
137 | |||
138 | /* | ||
139 | * Overkill warning ... | ||
140 | */ | ||
141 | #define mtc0_tlbw_hazard() \ | ||
142 | __asm__ __volatile__( \ | ||
143 | " .set noreorder \n" \ | ||
144 | " nop \n" \ | ||
145 | " nop \n" \ | ||
146 | " nop \n" \ | ||
147 | " nop \n" \ | ||
148 | " nop \n" \ | ||
149 | " nop \n" \ | ||
150 | " .set reorder \n") | ||
151 | |||
152 | #define tlbw_use_hazard() \ | ||
153 | __asm__ __volatile__( \ | ||
154 | " .set noreorder \n" \ | ||
155 | " nop \n" \ | ||
156 | " nop \n" \ | ||
157 | " nop \n" \ | ||
158 | " nop \n" \ | ||
159 | " nop \n" \ | ||
160 | " nop \n" \ | ||
161 | " .set reorder \n") | ||
162 | |||
163 | #endif | ||
164 | |||
165 | /* | ||
166 | * Interrupt enable/disable hazards | ||
167 | * Some processors have hazards when modifying | ||
168 | * the status register to change the interrupt state | ||
169 | */ | ||
170 | |||
171 | #ifdef CONFIG_CPU_MIPSR2 | ||
172 | |||
173 | __asm__(" .macro irq_enable_hazard \n" | ||
174 | " _ehb \n" | ||
175 | " .endm \n" | ||
176 | " \n" | ||
177 | " .macro irq_disable_hazard \n" | ||
178 | " _ehb \n" | ||
179 | " .endm \n"); | ||
180 | 127 | ||
181 | #elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) | 128 | #elif defined(CONFIG_CPU_SB1) |
182 | 129 | ||
183 | /* | 130 | /* |
184 | * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. | 131 | * Mostly like R4000 for historic reasons |
185 | */ | 132 | */ |
186 | 133 | ASMMACRO(mtc0_tlbw_hazard, | |
187 | __asm__( | 134 | ) |
188 | " .macro irq_enable_hazard \n" | 135 | ASMMACRO(tlbw_use_hazard, |
189 | " .endm \n" | 136 | ) |
190 | " \n" | 137 | ASMMACRO(tlb_probe_hazard, |
191 | " .macro irq_disable_hazard \n" | 138 | ) |
192 | " .endm \n"); | 139 | ASMMACRO(irq_enable_hazard, |
140 | ) | ||
141 | ASMMACRO(irq_disable_hazard, | ||
142 | _ssnop; _ssnop; _ssnop | ||
143 | ) | ||
144 | ASMMACRO(back_to_back_c0_hazard, | ||
145 | ) | ||
146 | #define instruction_hazard() do { } while (0) | ||
193 | 147 | ||
194 | #else | 148 | #else |
195 | 149 | ||
196 | /* | 150 | /* |
197 | * Default for classic MIPS processors. Assume worst case hazards but don't | 151 | * Finally the catchall case for all other processors including R4000, R4400, |
198 | * care about the irq_enable_hazard - sooner or later the hardware will | 152 | * R4600, R4700, R5000, RM7000, NEC VR41xx etc. |
199 | * enable it and we don't care when exactly. | ||
200 | */ | ||
201 | |||
202 | __asm__( | ||
203 | " # \n" | ||
204 | " # There is a hazard but we do not care \n" | ||
205 | " # \n" | ||
206 | " .macro\tirq_enable_hazard \n" | ||
207 | " .endm \n" | ||
208 | " \n" | ||
209 | " .macro\tirq_disable_hazard \n" | ||
210 | " _ssnop \n" | ||
211 | " _ssnop \n" | ||
212 | " _ssnop \n" | ||
213 | " .endm \n"); | ||
214 | |||
215 | #endif | ||
216 | |||
217 | #define irq_enable_hazard() \ | ||
218 | __asm__ __volatile__("irq_enable_hazard") | ||
219 | #define irq_disable_hazard() \ | ||
220 | __asm__ __volatile__("irq_disable_hazard") | ||
221 | |||
222 | |||
223 | /* | ||
224 | * Back-to-back hazards - | ||
225 | * | 153 | * |
226 | * What is needed to separate a move to cp0 from a subsequent read from the | 154 | * The taken branch will result in a two cycle penalty for the two killed |
227 | * same cp0 register? | 155 | * instructions on R4000 / R4400. Other processors only have a single cycle |
228 | */ | 156 | * hazard so this is nice trick to have an optimal code for a range of |
229 | #ifdef CONFIG_CPU_MIPSR2 | 157 | * processors. |
230 | |||
231 | __asm__(" .macro back_to_back_c0_hazard \n" | ||
232 | " _ehb \n" | ||
233 | " .endm \n"); | ||
234 | |||
235 | #elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \ | ||
236 | defined(CONFIG_CPU_SB1) | ||
237 | |||
238 | __asm__(" .macro back_to_back_c0_hazard \n" | ||
239 | " .endm \n"); | ||
240 | |||
241 | #else | ||
242 | |||
243 | __asm__(" .macro back_to_back_c0_hazard \n" | ||
244 | " .set noreorder \n" | ||
245 | " _ssnop \n" | ||
246 | " _ssnop \n" | ||
247 | " _ssnop \n" | ||
248 | " .set reorder \n" | ||
249 | " .endm"); | ||
250 | |||
251 | #endif | ||
252 | |||
253 | #define back_to_back_c0_hazard() \ | ||
254 | __asm__ __volatile__("back_to_back_c0_hazard") | ||
255 | |||
256 | |||
257 | /* | ||
258 | * Instruction execution hazard | ||
259 | */ | ||
260 | #ifdef CONFIG_CPU_MIPSR2 | ||
261 | /* | ||
262 | * gcc has a tradition of misscompiling the previous construct using the | ||
263 | * address of a label as argument to inline assembler. Gas otoh has the | ||
264 | * annoying difference between la and dla which are only usable for 32-bit | ||
265 | * rsp. 64-bit code, so can't be used without conditional compilation. | ||
266 | * The alterantive is switching the assembler to 64-bit code which happens | ||
267 | * to work right even for 32-bit code ... | ||
268 | */ | 158 | */ |
269 | #define instruction_hazard() \ | 159 | ASMMACRO(mtc0_tlbw_hazard, |
270 | do { \ | 160 | nop |
271 | unsigned long tmp; \ | 161 | ) |
272 | \ | 162 | ASMMACRO(tlbw_use_hazard, |
273 | __asm__ __volatile__( \ | 163 | nop; nop; nop |
274 | " .set mips64r2 \n" \ | 164 | ) |
275 | " dla %0, 1f \n" \ | 165 | ASMMACRO(tlb_probe_hazard, |
276 | " jr.hb %0 \n" \ | 166 | nop; nop; nop |
277 | " .set mips0 \n" \ | 167 | ) |
278 | "1: \n" \ | 168 | ASMMACRO(irq_enable_hazard, |
279 | : "=r" (tmp)); \ | 169 | ) |
280 | } while (0) | 170 | ASMMACRO(irq_disable_hazard, |
281 | 171 | nop; nop; nop | |
282 | #else | 172 | ) |
173 | ASMMACRO(back_to_back_c0_hazard, | ||
174 | _ssnop; _ssnop; _ssnop; | ||
175 | ) | ||
283 | #define instruction_hazard() do { } while (0) | 176 | #define instruction_hazard() do { } while (0) |
284 | #endif | ||
285 | |||
286 | extern void mips_ihb(void); | ||
287 | 177 | ||
288 | #endif /* __ASSEMBLY__ */ | 178 | #endif |
289 | 179 | ||
290 | #endif /* _ASM_HAZARDS_H */ | 180 | #endif /* _ASM_HAZARDS_H */ |
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h index 896550bad322..d35c61776a02 100644 --- a/include/asm-mips/irq.h +++ b/include/asm-mips/irq.h | |||
@@ -76,8 +76,4 @@ extern int setup_irq_smtc(unsigned int irq, struct irqaction * new, | |||
76 | unsigned long hwmask); | 76 | unsigned long hwmask); |
77 | #endif /* CONFIG_MIPS_MT_SMTC */ | 77 | #endif /* CONFIG_MIPS_MT_SMTC */ |
78 | 78 | ||
79 | #ifdef CONFIG_SMP | ||
80 | #define ARCH_HAS_IRQ_PER_CPU | ||
81 | #endif | ||
82 | |||
83 | #endif /* _ASM_IRQ_H */ | 79 | #endif /* _ASM_IRQ_H */ |
diff --git a/include/asm-mips/mach-atlas/mc146818rtc.h b/include/asm-mips/mach-atlas/mc146818rtc.h index 397522ea5565..a73a5698420c 100644 --- a/include/asm-mips/mach-atlas/mc146818rtc.h +++ b/include/asm-mips/mach-atlas/mc146818rtc.h | |||
@@ -28,10 +28,12 @@ | |||
28 | #include <asm/mips-boards/atlas.h> | 28 | #include <asm/mips-boards/atlas.h> |
29 | #include <asm/mips-boards/atlasint.h> | 29 | #include <asm/mips-boards/atlasint.h> |
30 | 30 | ||
31 | #define ARCH_RTC_LOCATION | ||
32 | |||
31 | #define RTC_PORT(x) (ATLAS_RTC_ADR_REG + (x) * 8) | 33 | #define RTC_PORT(x) (ATLAS_RTC_ADR_REG + (x) * 8) |
32 | #define RTC_IO_EXTENT 0x100 | 34 | #define RTC_IO_EXTENT 0x100 |
33 | #define RTC_IOMAPPED 0 | 35 | #define RTC_IOMAPPED 0 |
34 | #define RTC_IRQ ATLASINT_RTC | 36 | #define RTC_IRQ ATLAS_INT_RTC |
35 | 37 | ||
36 | static inline unsigned char CMOS_READ(unsigned long addr) | 38 | static inline unsigned char CMOS_READ(unsigned long addr) |
37 | { | 39 | { |
diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h index d5b38a247e5a..eeb0c3115b6a 100644 --- a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h +++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h | |||
@@ -316,7 +316,7 @@ typedef struct dbdma_chan_config { | |||
316 | au1x_ddma_desc_t *chan_desc_base; | 316 | au1x_ddma_desc_t *chan_desc_base; |
317 | au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr; | 317 | au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr; |
318 | void *chan_callparam; | 318 | void *chan_callparam; |
319 | void (*chan_callback)(int, void *, struct pt_regs *); | 319 | void (*chan_callback)(int, void *); |
320 | } chan_tab_t; | 320 | } chan_tab_t; |
321 | 321 | ||
322 | #define DEV_FLAGS_INUSE (1 << 0) | 322 | #define DEV_FLAGS_INUSE (1 << 0) |
@@ -334,8 +334,8 @@ typedef struct dbdma_chan_config { | |||
334 | * meaningful name. The 'callback' is called during dma completion | 334 | * meaningful name. The 'callback' is called during dma completion |
335 | * interrupt. | 335 | * interrupt. |
336 | */ | 336 | */ |
337 | u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, | 337 | extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, |
338 | void (*callback)(int, void *, struct pt_regs *), void *callparam); | 338 | void (*callback)(int, void *), void *callparam); |
339 | 339 | ||
340 | #define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS | 340 | #define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS |
341 | 341 | ||
diff --git a/include/asm-mips/mach-ev96100/mach-gt64120.h b/include/asm-mips/mach-ev96100/mach-gt64120.h deleted file mode 100644 index 0ef1e6c25acf..000000000000 --- a/include/asm-mips/mach-ev96100/mach-gt64120.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * This is a direct copy of the ev96100.h file, with a global | ||
3 | * search and replace. The numbers are the same. | ||
4 | * | ||
5 | * The reason I'm duplicating this is so that the 64120/96100 | ||
6 | * defines won't be confusing in the source code. | ||
7 | */ | ||
8 | #ifndef _ASM_GT64120_EV96100_GT64120_DEP_H | ||
9 | #define _ASM_GT64120_EV96100_GT64120_DEP_H | ||
10 | |||
11 | /* | ||
12 | * GT96100 config space base address | ||
13 | */ | ||
14 | #define GT64120_BASE (KSEG1ADDR(0x14000000)) | ||
15 | |||
16 | /* | ||
17 | * PCI Bus allocation | ||
18 | * | ||
19 | * (Guessing ...) | ||
20 | */ | ||
21 | #define GT_PCI_MEM_BASE 0x12000000UL | ||
22 | #define GT_PCI_MEM_SIZE 0x02000000UL | ||
23 | #define GT_PCI_IO_BASE 0x10000000UL | ||
24 | #define GT_PCI_IO_SIZE 0x02000000UL | ||
25 | #define GT_ISA_IO_BASE PCI_IO_BASE | ||
26 | |||
27 | /* | ||
28 | * Duart I/O ports. | ||
29 | */ | ||
30 | #define EV96100_COM1_BASE_ADDR (0xBD000000 + 0x20) | ||
31 | #define EV96100_COM2_BASE_ADDR (0xBD000000 + 0x00) | ||
32 | |||
33 | |||
34 | /* | ||
35 | * EV96100 interrupt controller register base. | ||
36 | */ | ||
37 | #define EV96100_ICTRL_REGS_BASE (KSEG1ADDR(0x1f000000)) | ||
38 | |||
39 | /* | ||
40 | * EV96100 UART register base. | ||
41 | */ | ||
42 | #define EV96100_UART0_REGS_BASE EV96100_COM1_BASE_ADDR | ||
43 | #define EV96100_UART1_REGS_BASE EV96100_COM2_BASE_ADDR | ||
44 | #define EV96100_BASE_BAUD ( 3686400 / 16 ) | ||
45 | |||
46 | #endif /* _ASM_GT64120_EV96100_GT64120_DEP_H */ | ||
diff --git a/include/asm-mips/mach-excite/excite.h b/include/asm-mips/mach-excite/excite.h index 130bd4b8edce..4c29ba44992c 100644 --- a/include/asm-mips/mach-excite/excite.h +++ b/include/asm-mips/mach-excite/excite.h | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | #define EXCITE_CPU_EXT_CLOCK 100000000 | 8 | #define EXCITE_CPU_EXT_CLOCK 100000000 |
9 | 9 | ||
10 | #if !defined(__ASSEMBLER__) | 10 | #if !defined(__ASSEMBLY__) |
11 | void __init excite_kgdb_init(void); | 11 | void __init excite_kgdb_init(void); |
12 | void excite_procfs_init(void); | 12 | void excite_procfs_init(void); |
13 | extern unsigned long memsize; | 13 | extern unsigned long memsize; |
diff --git a/include/asm-mips/mach-excite/excite_fpga.h b/include/asm-mips/mach-excite/excite_fpga.h new file mode 100644 index 000000000000..38fcda703a0b --- /dev/null +++ b/include/asm-mips/mach-excite/excite_fpga.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef EXCITE_FPGA_H_INCLUDED | ||
2 | #define EXCITE_FPGA_H_INCLUDED | ||
3 | |||
4 | |||
5 | /** | ||
6 | * Adress alignment of the individual FPGA bytes. | ||
7 | * The address arrangement of the individual bytes of the FPGA is two | ||
8 | * byte aligned at the embedded MK2 platform. | ||
9 | */ | ||
10 | #ifdef EXCITE_CCI_FPGA_MK2 | ||
11 | typedef unsigned char excite_cci_fpga_align_t __attribute__ ((aligned(2))); | ||
12 | #else | ||
13 | typedef unsigned char excite_cci_fpga_align_t; | ||
14 | #endif | ||
15 | |||
16 | |||
17 | /** | ||
18 | * Size of Dual Ported RAM. | ||
19 | */ | ||
20 | #define EXCITE_DPR_SIZE 263 | ||
21 | |||
22 | |||
23 | /** | ||
24 | * Size of Reserved Status Fields in Dual Ported RAM. | ||
25 | */ | ||
26 | #define EXCITE_DPR_STATUS_SIZE 7 | ||
27 | |||
28 | |||
29 | |||
30 | /** | ||
31 | * FPGA. | ||
32 | * Hardware register layout of the FPGA interface. The FPGA must accessed | ||
33 | * byte wise solely. | ||
34 | * @see EXCITE_CCI_DPR_MK2 | ||
35 | */ | ||
36 | typedef struct excite_fpga { | ||
37 | |||
38 | /** | ||
39 | * Dual Ported RAM. | ||
40 | */ | ||
41 | excite_cci_fpga_align_t dpr[EXCITE_DPR_SIZE]; | ||
42 | |||
43 | /** | ||
44 | * Status. | ||
45 | */ | ||
46 | excite_cci_fpga_align_t status[EXCITE_DPR_STATUS_SIZE]; | ||
47 | |||
48 | #ifdef EXCITE_CCI_FPGA_MK2 | ||
49 | /** | ||
50 | * RM9000 Interrupt. | ||
51 | * Write access initiates interrupt at the RM9000 (MIPS) processor of the eXcite. | ||
52 | */ | ||
53 | excite_cci_fpga_align_t rm9k_int; | ||
54 | #else | ||
55 | /** | ||
56 | * MK2 Interrupt. | ||
57 | * Write access initiates interrupt at the ARM processor of the MK2. | ||
58 | */ | ||
59 | excite_cci_fpga_align_t mk2_int; | ||
60 | |||
61 | excite_cci_fpga_align_t gap[0x1000-0x10f]; | ||
62 | |||
63 | /** | ||
64 | * IRQ Source/Acknowledge. | ||
65 | */ | ||
66 | excite_cci_fpga_align_t rm9k_irq_src; | ||
67 | |||
68 | /** | ||
69 | * IRQ Mask. | ||
70 | * Set bits enable the related interrupt. | ||
71 | */ | ||
72 | excite_cci_fpga_align_t rm9k_irq_mask; | ||
73 | #endif | ||
74 | |||
75 | |||
76 | } excite_fpga; | ||
77 | |||
78 | |||
79 | |||
80 | #endif /* ndef EXCITE_FPGA_H_INCLUDED */ | ||
diff --git a/include/asm-mips/mach-qemu/cpu-feature-overrides.h b/include/asm-mips/mach-qemu/cpu-feature-overrides.h index f4e370e27168..529445dacedb 100644 --- a/include/asm-mips/mach-qemu/cpu-feature-overrides.h +++ b/include/asm-mips/mach-qemu/cpu-feature-overrides.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | #define cpu_has_llsc 1 | 21 | #define cpu_has_llsc 1 |
22 | #define cpu_has_vtag_icache 0 | 22 | #define cpu_has_vtag_icache 0 |
23 | #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) | 23 | #define cpu_has_dc_aliases 0 |
24 | #define cpu_has_ic_fills_f_dc 0 | 24 | #define cpu_has_ic_fills_f_dc 0 |
25 | 25 | ||
26 | #define cpu_has_dsp 0 | 26 | #define cpu_has_dsp 0 |
diff --git a/include/asm-mips/mips-boards/atlasint.h b/include/asm-mips/mips-boards/atlasint.h index fd7ebc54fa90..b15e4ea0b091 100644 --- a/include/asm-mips/mips-boards/atlasint.h +++ b/include/asm-mips/mips-boards/atlasint.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Carsten Langgaard, carstenl@mips.com | 2 | * Copyright (C) 1999, 2006 MIPS Technologies, Inc. All rights reserved. |
3 | * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved. | 3 | * Authors: Carsten Langgaard <carstenl@mips.com> |
4 | * Maciej W. Rozycki <macro@mips.com> | ||
4 | * | 5 | * |
5 | * ######################################################################## | 6 | * ######################################################################## |
6 | * | 7 | * |
@@ -25,41 +26,88 @@ | |||
25 | #ifndef _MIPS_ATLASINT_H | 26 | #ifndef _MIPS_ATLASINT_H |
26 | #define _MIPS_ATLASINT_H | 27 | #define _MIPS_ATLASINT_H |
27 | 28 | ||
28 | #define ATLASINT_BASE 1 | 29 | /* |
29 | #define ATLASINT_UART (ATLASINT_BASE+0) | 30 | * Interrupts 0..7 are used for Atlas CPU interrupts (nonEIC mode) |
30 | #define ATLASINT_TIM0 (ATLASINT_BASE+1) | 31 | */ |
31 | #define ATLASINT_RES2 (ATLASINT_BASE+2) | 32 | #define MIPSCPU_INT_BASE 0 |
32 | #define ATLASINT_RES3 (ATLASINT_BASE+3) | 33 | |
33 | #define ATLASINT_RTC (ATLASINT_BASE+4) | 34 | /* CPU interrupt offsets */ |
34 | #define ATLASINT_COREHI (ATLASINT_BASE+5) | 35 | #define MIPSCPU_INT_SW0 0 |
35 | #define ATLASINT_CORELO (ATLASINT_BASE+6) | 36 | #define MIPSCPU_INT_SW1 1 |
36 | #define ATLASINT_RES7 (ATLASINT_BASE+7) | 37 | #define MIPSCPU_INT_MB0 2 |
37 | #define ATLASINT_PCIA (ATLASINT_BASE+8) | 38 | #define MIPSCPU_INT_ATLAS MIPSCPU_INT_MB0 |
38 | #define ATLASINT_PCIB (ATLASINT_BASE+9) | 39 | #define MIPSCPU_INT_MB1 3 |
39 | #define ATLASINT_PCIC (ATLASINT_BASE+10) | 40 | #define MIPSCPU_INT_MB2 4 |
40 | #define ATLASINT_PCID (ATLASINT_BASE+11) | 41 | #define MIPSCPU_INT_MB3 5 |
41 | #define ATLASINT_ENUM (ATLASINT_BASE+12) | 42 | #define MIPSCPU_INT_MB4 6 |
42 | #define ATLASINT_DEG (ATLASINT_BASE+13) | 43 | #define MIPSCPU_INT_CPUCTR 7 |
43 | #define ATLASINT_ATXFAIL (ATLASINT_BASE+14) | 44 | |
44 | #define ATLASINT_INTA (ATLASINT_BASE+15) | 45 | /* |
45 | #define ATLASINT_INTB (ATLASINT_BASE+16) | 46 | * Interrupts 8..39 are used for Atlas interrupt controller interrupts |
46 | #define ATLASINT_ETH ATLASINT_INTB | 47 | */ |
47 | #define ATLASINT_INTC (ATLASINT_BASE+17) | 48 | #define ATLAS_INT_BASE 8 |
48 | #define ATLASINT_SCSI ATLASINT_INTC | 49 | #define ATLAS_INT_UART (ATLAS_INT_BASE + 0) |
49 | #define ATLASINT_INTD (ATLASINT_BASE+18) | 50 | #define ATLAS_INT_TIM0 (ATLAS_INT_BASE + 1) |
50 | #define ATLASINT_SERR (ATLASINT_BASE+19) | 51 | #define ATLAS_INT_RES2 (ATLAS_INT_BASE + 2) |
51 | #define ATLASINT_RES20 (ATLASINT_BASE+20) | 52 | #define ATLAS_INT_RES3 (ATLAS_INT_BASE + 3) |
52 | #define ATLASINT_RES21 (ATLASINT_BASE+21) | 53 | #define ATLAS_INT_RTC (ATLAS_INT_BASE + 4) |
53 | #define ATLASINT_RES22 (ATLASINT_BASE+22) | 54 | #define ATLAS_INT_COREHI (ATLAS_INT_BASE + 5) |
54 | #define ATLASINT_RES23 (ATLASINT_BASE+23) | 55 | #define ATLAS_INT_CORELO (ATLAS_INT_BASE + 6) |
55 | #define ATLASINT_RES24 (ATLASINT_BASE+24) | 56 | #define ATLAS_INT_RES7 (ATLAS_INT_BASE + 7) |
56 | #define ATLASINT_RES25 (ATLASINT_BASE+25) | 57 | #define ATLAS_INT_PCIA (ATLAS_INT_BASE + 8) |
57 | #define ATLASINT_RES26 (ATLASINT_BASE+26) | 58 | #define ATLAS_INT_PCIB (ATLAS_INT_BASE + 9) |
58 | #define ATLASINT_RES27 (ATLASINT_BASE+27) | 59 | #define ATLAS_INT_PCIC (ATLAS_INT_BASE + 10) |
59 | #define ATLASINT_RES28 (ATLASINT_BASE+28) | 60 | #define ATLAS_INT_PCID (ATLAS_INT_BASE + 11) |
60 | #define ATLASINT_RES29 (ATLASINT_BASE+29) | 61 | #define ATLAS_INT_ENUM (ATLAS_INT_BASE + 12) |
61 | #define ATLASINT_RES30 (ATLASINT_BASE+30) | 62 | #define ATLAS_INT_DEG (ATLAS_INT_BASE + 13) |
62 | #define ATLASINT_RES31 (ATLASINT_BASE+31) | 63 | #define ATLAS_INT_ATXFAIL (ATLAS_INT_BASE + 14) |
63 | #define ATLASINT_END (ATLASINT_BASE+31) | 64 | #define ATLAS_INT_INTA (ATLAS_INT_BASE + 15) |
65 | #define ATLAS_INT_INTB (ATLAS_INT_BASE + 16) | ||
66 | #define ATLAS_INT_ETH ATLAS_INT_INTB | ||
67 | #define ATLAS_INT_INTC (ATLAS_INT_BASE + 17) | ||
68 | #define ATLAS_INT_SCSI ATLAS_INT_INTC | ||
69 | #define ATLAS_INT_INTD (ATLAS_INT_BASE + 18) | ||
70 | #define ATLAS_INT_SERR (ATLAS_INT_BASE + 19) | ||
71 | #define ATLAS_INT_RES20 (ATLAS_INT_BASE + 20) | ||
72 | #define ATLAS_INT_RES21 (ATLAS_INT_BASE + 21) | ||
73 | #define ATLAS_INT_RES22 (ATLAS_INT_BASE + 22) | ||
74 | #define ATLAS_INT_RES23 (ATLAS_INT_BASE + 23) | ||
75 | #define ATLAS_INT_RES24 (ATLAS_INT_BASE + 24) | ||
76 | #define ATLAS_INT_RES25 (ATLAS_INT_BASE + 25) | ||
77 | #define ATLAS_INT_RES26 (ATLAS_INT_BASE + 26) | ||
78 | #define ATLAS_INT_RES27 (ATLAS_INT_BASE + 27) | ||
79 | #define ATLAS_INT_RES28 (ATLAS_INT_BASE + 28) | ||
80 | #define ATLAS_INT_RES29 (ATLAS_INT_BASE + 29) | ||
81 | #define ATLAS_INT_RES30 (ATLAS_INT_BASE + 30) | ||
82 | #define ATLAS_INT_RES31 (ATLAS_INT_BASE + 31) | ||
83 | #define ATLAS_INT_END (ATLAS_INT_BASE + 31) | ||
84 | |||
85 | /* | ||
86 | * Interrupts 64..127 are used for Soc-it Classic interrupts | ||
87 | */ | ||
88 | #define MSC01C_INT_BASE 64 | ||
89 | |||
90 | /* SOC-it Classic interrupt offsets */ | ||
91 | #define MSC01C_INT_TMR 0 | ||
92 | #define MSC01C_INT_PCI 1 | ||
93 | |||
94 | /* | ||
95 | * Interrupts 64..127 are used for Soc-it EIC interrupts | ||
96 | */ | ||
97 | #define MSC01E_INT_BASE 64 | ||
98 | |||
99 | /* SOC-it EIC interrupt offsets */ | ||
100 | #define MSC01E_INT_SW0 1 | ||
101 | #define MSC01E_INT_SW1 2 | ||
102 | #define MSC01E_INT_MB0 3 | ||
103 | #define MSC01E_INT_ATLAS MSC01E_INT_MB0 | ||
104 | #define MSC01E_INT_MB1 4 | ||
105 | #define MSC01E_INT_MB2 5 | ||
106 | #define MSC01E_INT_MB3 6 | ||
107 | #define MSC01E_INT_MB4 7 | ||
108 | #define MSC01E_INT_TMR 8 | ||
109 | #define MSC01E_INT_PCI 9 | ||
110 | #define MSC01E_INT_PERFCTR 10 | ||
111 | #define MSC01E_INT_CPUCTR 11 | ||
64 | 112 | ||
65 | #endif /* !(_MIPS_ATLASINT_H) */ | 113 | #endif /* !(_MIPS_ATLASINT_H) */ |
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h index 18b69de87daa..fe065d6070ca 100644 --- a/include/asm-mips/mmu_context.h +++ b/include/asm-mips/mmu_context.h | |||
@@ -262,10 +262,10 @@ drop_mmu_context(struct mm_struct *mm, unsigned cpu) | |||
262 | /* See comments for similar code above */ | 262 | /* See comments for similar code above */ |
263 | prevvpe = dvpe(); | 263 | prevvpe = dvpe(); |
264 | oldasid = (read_c0_entryhi() & ASID_MASK); | 264 | oldasid = (read_c0_entryhi() & ASID_MASK); |
265 | if(smtc_live_asid[mytlb][oldasid]) { | 265 | if (smtc_live_asid[mytlb][oldasid]) { |
266 | smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu); | 266 | smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu); |
267 | if(smtc_live_asid[mytlb][oldasid] == 0) | 267 | if(smtc_live_asid[mytlb][oldasid] == 0) |
268 | smtc_flush_tlb_asid(oldasid); | 268 | smtc_flush_tlb_asid(oldasid); |
269 | } | 269 | } |
270 | /* See comments for similar code above */ | 270 | /* See comments for similar code above */ |
271 | write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) | 271 | write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) |
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 219d359861f3..85b258ee7090 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h | |||
@@ -34,6 +34,8 @@ | |||
34 | 34 | ||
35 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
36 | 36 | ||
37 | #include <asm/cpu-features.h> | ||
38 | |||
37 | extern void clear_page(void * page); | 39 | extern void clear_page(void * page); |
38 | extern void copy_page(void * to, void * from); | 40 | extern void copy_page(void * to, void * from); |
39 | 41 | ||
@@ -53,7 +55,7 @@ static inline void clear_user_page(void *addr, unsigned long vaddr, | |||
53 | extern void (*flush_data_cache_page)(unsigned long addr); | 55 | extern void (*flush_data_cache_page)(unsigned long addr); |
54 | 56 | ||
55 | clear_page(addr); | 57 | clear_page(addr); |
56 | if (pages_do_alias((unsigned long) addr, vaddr)) | 58 | if (pages_do_alias((unsigned long) addr, vaddr & PAGE_MASK)) |
57 | flush_data_cache_page((unsigned long)addr); | 59 | flush_data_cache_page((unsigned long)addr); |
58 | } | 60 | } |
59 | 61 | ||
@@ -63,7 +65,8 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | |||
63 | extern void (*flush_data_cache_page)(unsigned long addr); | 65 | extern void (*flush_data_cache_page)(unsigned long addr); |
64 | 66 | ||
65 | copy_page(vto, vfrom); | 67 | copy_page(vto, vfrom); |
66 | if (pages_do_alias((unsigned long)vto, vaddr)) | 68 | if (!cpu_has_ic_fills_f_dc || |
69 | pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK)) | ||
67 | flush_data_cache_page((unsigned long)vto); | 70 | flush_data_cache_page((unsigned long)vto); |
68 | } | 71 | } |
69 | 72 | ||
@@ -74,15 +77,17 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | |||
74 | #ifdef CONFIG_CPU_MIPS32 | 77 | #ifdef CONFIG_CPU_MIPS32 |
75 | typedef struct { unsigned long pte_low, pte_high; } pte_t; | 78 | typedef struct { unsigned long pte_low, pte_high; } pte_t; |
76 | #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) | 79 | #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) |
80 | #define __pte(x) ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; }) | ||
77 | #else | 81 | #else |
78 | typedef struct { unsigned long long pte; } pte_t; | 82 | typedef struct { unsigned long long pte; } pte_t; |
79 | #define pte_val(x) ((x).pte) | 83 | #define pte_val(x) ((x).pte) |
84 | #define __pte(x) ((pte_t) { (x) } ) | ||
80 | #endif | 85 | #endif |
81 | #else | 86 | #else |
82 | typedef struct { unsigned long pte; } pte_t; | 87 | typedef struct { unsigned long pte; } pte_t; |
83 | #define pte_val(x) ((x).pte) | 88 | #define pte_val(x) ((x).pte) |
84 | #endif | ||
85 | #define __pte(x) ((pte_t) { (x) } ) | 89 | #define __pte(x) ((pte_t) { (x) } ) |
90 | #endif | ||
86 | 91 | ||
87 | /* | 92 | /* |
88 | * For 3-level pagetables we defines these ourselves, for 2-level the | 93 | * For 3-level pagetables we defines these ourselves, for 2-level the |
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h index 4b26d8528133..d20f2e9b28be 100644 --- a/include/asm-mips/pgtable-32.h +++ b/include/asm-mips/pgtable-32.h | |||
@@ -156,9 +156,9 @@ pfn_pte(unsigned long pfn, pgprot_t prot) | |||
156 | #define __pte_offset(address) \ | 156 | #define __pte_offset(address) \ |
157 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 157 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
158 | #define pte_offset(dir, address) \ | 158 | #define pte_offset(dir, address) \ |
159 | ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address)) | 159 | ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address)) |
160 | #define pte_offset_kernel(dir, address) \ | 160 | #define pte_offset_kernel(dir, address) \ |
161 | ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) | 161 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) |
162 | 162 | ||
163 | #define pte_offset_map(dir, address) \ | 163 | #define pte_offset_map(dir, address) \ |
164 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | 164 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h index e3db93212eab..d05fb6f38aa7 100644 --- a/include/asm-mips/pgtable-64.h +++ b/include/asm-mips/pgtable-64.h | |||
@@ -93,8 +93,12 @@ | |||
93 | #define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t)) | 93 | #define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t)) |
94 | #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) | 94 | #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) |
95 | 95 | ||
96 | #if PGDIR_SIZE >= TASK_SIZE | ||
97 | #define USER_PTRS_PER_PGD (1) | ||
98 | #else | ||
96 | #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) | 99 | #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) |
97 | #define FIRST_USER_ADDRESS 0 | 100 | #endif |
101 | #define FIRST_USER_ADDRESS 0UL | ||
98 | 102 | ||
99 | #define VMALLOC_START MAP_BASE | 103 | #define VMALLOC_START MAP_BASE |
100 | #define VMALLOC_END \ | 104 | #define VMALLOC_END \ |
@@ -178,24 +182,26 @@ static inline void pud_clear(pud_t *pudp) | |||
178 | /* to find an entry in a page-table-directory */ | 182 | /* to find an entry in a page-table-directory */ |
179 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) | 183 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) |
180 | 184 | ||
181 | static inline unsigned long pud_page(pud_t pud) | 185 | static inline unsigned long pud_page_vaddr(pud_t pud) |
182 | { | 186 | { |
183 | return pud_val(pud); | 187 | return pud_val(pud); |
184 | } | 188 | } |
189 | #define pud_phys(pud) (pud_val(pud) - PAGE_OFFSET) | ||
190 | #define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT)) | ||
185 | 191 | ||
186 | /* Find an entry in the second-level page table.. */ | 192 | /* Find an entry in the second-level page table.. */ |
187 | static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) | 193 | static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) |
188 | { | 194 | { |
189 | return (pmd_t *) pud_page(*pud) + pmd_index(address); | 195 | return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address); |
190 | } | 196 | } |
191 | 197 | ||
192 | /* Find an entry in the third-level page table.. */ | 198 | /* Find an entry in the third-level page table.. */ |
193 | #define __pte_offset(address) \ | 199 | #define __pte_offset(address) \ |
194 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 200 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
195 | #define pte_offset(dir, address) \ | 201 | #define pte_offset(dir, address) \ |
196 | ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address)) | 202 | ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address)) |
197 | #define pte_offset_kernel(dir, address) \ | 203 | #define pte_offset_kernel(dir, address) \ |
198 | ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) | 204 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) |
199 | #define pte_offset_map(dir, address) \ | 205 | #define pte_offset_map(dir, address) \ |
200 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | 206 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
201 | #define pte_offset_map_nested(dir, address) \ | 207 | #define pte_offset_map_nested(dir, address) \ |
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index a36ca1be17f2..1ca4d1e185c7 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -87,7 +87,7 @@ extern void paging_init(void); | |||
87 | */ | 87 | */ |
88 | #define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) | 88 | #define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) |
89 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) | 89 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) |
90 | #define pmd_page_kernel(pmd) pmd_val(pmd) | 90 | #define pmd_page_vaddr(pmd) pmd_val(pmd) |
91 | 91 | ||
92 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 92 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
93 | 93 | ||
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h index 4113316ee0da..4fb0fc43ffd7 100644 --- a/include/asm-mips/ptrace.h +++ b/include/asm-mips/ptrace.h | |||
@@ -10,8 +10,6 @@ | |||
10 | #define _ASM_PTRACE_H | 10 | #define _ASM_PTRACE_H |
11 | 11 | ||
12 | 12 | ||
13 | #include <asm/isadep.h> | ||
14 | |||
15 | /* 0 - 31 are integer registers, 32 - 63 are fp registers. */ | 13 | /* 0 - 31 are integer registers, 32 - 63 are fp registers. */ |
16 | #define FPR_BASE 32 | 14 | #define FPR_BASE 32 |
17 | #define PC 64 | 15 | #define PC 64 |
@@ -73,6 +71,7 @@ struct pt_regs { | |||
73 | #ifdef __KERNEL__ | 71 | #ifdef __KERNEL__ |
74 | 72 | ||
75 | #include <linux/linkage.h> | 73 | #include <linux/linkage.h> |
74 | #include <asm/isadep.h> | ||
76 | 75 | ||
77 | /* | 76 | /* |
78 | * Does the process account for user or for system time? | 77 | * Does the process account for user or for system time? |
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h index 584bd9c0ab2e..035637c67e7c 100644 --- a/include/asm-mips/serial.h +++ b/include/asm-mips/serial.h | |||
@@ -52,9 +52,9 @@ | |||
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * Both Galileo boards have the same UART mappings. | 55 | * Galileo EV64120 evaluation board |
56 | */ | 56 | */ |
57 | #if defined (CONFIG_MIPS_EV96100) || defined (CONFIG_MIPS_EV64120) | 57 | #ifdef CONFIG_MIPS_EV64120 |
58 | #include <asm/galileo-boards/ev96100.h> | 58 | #include <asm/galileo-boards/ev96100.h> |
59 | #include <asm/galileo-boards/ev96100int.h> | 59 | #include <asm/galileo-boards/ev96100int.h> |
60 | #define EV96100_SERIAL_PORT_DEFNS \ | 60 | #define EV96100_SERIAL_PORT_DEFNS \ |
diff --git a/include/asm-mips/sibyte/sb1250_defs.h b/include/asm-mips/sibyte/sb1250_defs.h index 335dbaf1d831..a885491217c1 100644 --- a/include/asm-mips/sibyte/sb1250_defs.h +++ b/include/asm-mips/sibyte/sb1250_defs.h | |||
@@ -212,7 +212,7 @@ | |||
212 | * Note: you'll need to define uint32_t and uint64_t in your headers. | 212 | * Note: you'll need to define uint32_t and uint64_t in your headers. |
213 | */ | 213 | */ |
214 | 214 | ||
215 | #if !defined(__ASSEMBLER__) | 215 | #if !defined(__ASSEMBLY__) |
216 | #define _SB_MAKE64(x) ((uint64_t)(x)) | 216 | #define _SB_MAKE64(x) ((uint64_t)(x)) |
217 | #define _SB_MAKE32(x) ((uint32_t)(x)) | 217 | #define _SB_MAKE32(x) ((uint32_t)(x)) |
218 | #else | 218 | #else |
@@ -251,9 +251,9 @@ | |||
251 | */ | 251 | */ |
252 | 252 | ||
253 | 253 | ||
254 | #if defined(__mips64) && !defined(__ASSEMBLER__) | 254 | #if defined(__mips64) && !defined(__ASSEMBLY__) |
255 | #define SBWRITECSR(csr,val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val) | 255 | #define SBWRITECSR(csr,val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val) |
256 | #define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr))) | 256 | #define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr))) |
257 | #endif /* __ASSEMBLER__ */ | 257 | #endif /* __ASSEMBLY__ */ |
258 | 258 | ||
259 | #endif | 259 | #endif |
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h index f4178bdcfcb0..7ed0bb611e56 100644 --- a/include/asm-mips/sibyte/sb1250_scd.h +++ b/include/asm-mips/sibyte/sb1250_scd.h | |||
@@ -149,7 +149,7 @@ | |||
149 | * (For the assembler version, sysrev and dest may be the same register. | 149 | * (For the assembler version, sysrev and dest may be the same register. |
150 | * Also, it clobbers AT.) | 150 | * Also, it clobbers AT.) |
151 | */ | 151 | */ |
152 | #ifdef __ASSEMBLER__ | 152 | #ifdef __ASSEMBLY__ |
153 | #define SYS_SOC_TYPE(dest, sysrev) \ | 153 | #define SYS_SOC_TYPE(dest, sysrev) \ |
154 | .set push ; \ | 154 | .set push ; \ |
155 | .set reorder ; \ | 155 | .set reorder ; \ |
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h index 87a1dff95199..8b391a2f0814 100644 --- a/include/asm-mips/signal.h +++ b/include/asm-mips/signal.h | |||
@@ -108,17 +108,8 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */ | |||
108 | #define SIG_BLOCK 1 /* for blocking signals */ | 108 | #define SIG_BLOCK 1 /* for blocking signals */ |
109 | #define SIG_UNBLOCK 2 /* for unblocking signals */ | 109 | #define SIG_UNBLOCK 2 /* for unblocking signals */ |
110 | #define SIG_SETMASK 3 /* for setting the signal mask */ | 110 | #define SIG_SETMASK 3 /* for setting the signal mask */ |
111 | #define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: | ||
112 | set only the low 32 bit of the sigset. */ | ||
113 | 111 | ||
114 | /* Type of a signal handler. */ | 112 | #include <asm-generic/signal.h> |
115 | typedef void __signalfn_t(int); | ||
116 | typedef __signalfn_t __user *__sighandler_t; | ||
117 | |||
118 | /* Fake signal functions */ | ||
119 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ | ||
120 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ | ||
121 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ | ||
122 | 113 | ||
123 | struct sigaction { | 114 | struct sigaction { |
124 | unsigned int sa_flags; | 115 | unsigned int sa_flags; |
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h index 669b8e349ff2..4c1a1b53aeaf 100644 --- a/include/asm-mips/spinlock.h +++ b/include/asm-mips/spinlock.h | |||
@@ -239,7 +239,51 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
239 | : "memory"); | 239 | : "memory"); |
240 | } | 240 | } |
241 | 241 | ||
242 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) | 242 | static inline int __raw_read_trylock(raw_rwlock_t *rw) |
243 | { | ||
244 | unsigned int tmp; | ||
245 | int ret; | ||
246 | |||
247 | if (R10000_LLSC_WAR) { | ||
248 | __asm__ __volatile__( | ||
249 | " .set noreorder # __raw_read_trylock \n" | ||
250 | " li %2, 0 \n" | ||
251 | "1: ll %1, %3 \n" | ||
252 | " bnez %1, 2f \n" | ||
253 | " addu %1, 1 \n" | ||
254 | " sc %1, %0 \n" | ||
255 | " beqzl %1, 1b \n" | ||
256 | " .set reorder \n" | ||
257 | #ifdef CONFIG_SMP | ||
258 | " sync \n" | ||
259 | #endif | ||
260 | " li %2, 1 \n" | ||
261 | "2: \n" | ||
262 | : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret) | ||
263 | : "m" (rw->lock) | ||
264 | : "memory"); | ||
265 | } else { | ||
266 | __asm__ __volatile__( | ||
267 | " .set noreorder # __raw_read_trylock \n" | ||
268 | " li %2, 0 \n" | ||
269 | "1: ll %1, %3 \n" | ||
270 | " bnez %1, 2f \n" | ||
271 | " addu %1, 1 \n" | ||
272 | " sc %1, %0 \n" | ||
273 | " beqz %1, 1b \n" | ||
274 | " .set reorder \n" | ||
275 | #ifdef CONFIG_SMP | ||
276 | " sync \n" | ||
277 | #endif | ||
278 | " li %2, 1 \n" | ||
279 | "2: \n" | ||
280 | : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret) | ||
281 | : "m" (rw->lock) | ||
282 | : "memory"); | ||
283 | } | ||
284 | |||
285 | return ret; | ||
286 | } | ||
243 | 287 | ||
244 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 288 | static inline int __raw_write_trylock(raw_rwlock_t *rw) |
245 | { | 289 | { |
@@ -283,4 +327,5 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw) | |||
283 | return ret; | 327 | return ret; |
284 | } | 328 | } |
285 | 329 | ||
330 | |||
286 | #endif /* _ASM_SPINLOCK_H */ | 331 | #endif /* _ASM_SPINLOCK_H */ |
diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h index 98aa737b34aa..b80de8e0fbbd 100644 --- a/include/asm-mips/timex.h +++ b/include/asm-mips/timex.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #ifndef _ASM_TIMEX_H | 8 | #ifndef _ASM_TIMEX_H |
9 | #define _ASM_TIMEX_H | 9 | #define _ASM_TIMEX_H |
10 | 10 | ||
11 | #ifdef __KERNEL__ | ||
12 | |||
11 | #include <asm/mipsregs.h> | 13 | #include <asm/mipsregs.h> |
12 | 14 | ||
13 | /* | 15 | /* |
@@ -51,4 +53,6 @@ static inline cycles_t get_cycles (void) | |||
51 | return read_c0_count(); | 53 | return read_c0_count(); |
52 | } | 54 | } |
53 | 55 | ||
56 | #endif /* __KERNEL__ */ | ||
57 | |||
54 | #endif /* _ASM_TIMEX_H */ | 58 | #endif /* _ASM_TIMEX_H */ |
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h index 610ccb8a50b3..c39142920fe6 100644 --- a/include/asm-mips/unistd.h +++ b/include/asm-mips/unistd.h | |||
@@ -313,7 +313,7 @@ | |||
313 | #define __NR_mknodat (__NR_Linux + 290) | 313 | #define __NR_mknodat (__NR_Linux + 290) |
314 | #define __NR_fchownat (__NR_Linux + 291) | 314 | #define __NR_fchownat (__NR_Linux + 291) |
315 | #define __NR_futimesat (__NR_Linux + 292) | 315 | #define __NR_futimesat (__NR_Linux + 292) |
316 | #define __NR_fstatat (__NR_Linux + 293) | 316 | #define __NR_fstatat64 (__NR_Linux + 293) |
317 | #define __NR_unlinkat (__NR_Linux + 294) | 317 | #define __NR_unlinkat (__NR_Linux + 294) |
318 | #define __NR_renameat (__NR_Linux + 295) | 318 | #define __NR_renameat (__NR_Linux + 295) |
319 | #define __NR_linkat (__NR_Linux + 296) | 319 | #define __NR_linkat (__NR_Linux + 296) |
@@ -329,16 +329,18 @@ | |||
329 | #define __NR_tee (__NR_Linux + 306) | 329 | #define __NR_tee (__NR_Linux + 306) |
330 | #define __NR_vmsplice (__NR_Linux + 307) | 330 | #define __NR_vmsplice (__NR_Linux + 307) |
331 | #define __NR_move_pages (__NR_Linux + 308) | 331 | #define __NR_move_pages (__NR_Linux + 308) |
332 | #define __NR_set_robust_list (__NR_Linux + 309) | ||
333 | #define __NR_get_robust_list (__NR_Linux + 310) | ||
332 | 334 | ||
333 | /* | 335 | /* |
334 | * Offset of the last Linux o32 flavoured syscall | 336 | * Offset of the last Linux o32 flavoured syscall |
335 | */ | 337 | */ |
336 | #define __NR_Linux_syscalls 308 | 338 | #define __NR_Linux_syscalls 310 |
337 | 339 | ||
338 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 340 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
339 | 341 | ||
340 | #define __NR_O32_Linux 4000 | 342 | #define __NR_O32_Linux 4000 |
341 | #define __NR_O32_Linux_syscalls 308 | 343 | #define __NR_O32_Linux_syscalls 310 |
342 | 344 | ||
343 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 345 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
344 | 346 | ||
@@ -598,7 +600,7 @@ | |||
598 | #define __NR_mknodat (__NR_Linux + 249) | 600 | #define __NR_mknodat (__NR_Linux + 249) |
599 | #define __NR_fchownat (__NR_Linux + 250) | 601 | #define __NR_fchownat (__NR_Linux + 250) |
600 | #define __NR_futimesat (__NR_Linux + 251) | 602 | #define __NR_futimesat (__NR_Linux + 251) |
601 | #define __NR_fstatat (__NR_Linux + 252) | 603 | #define __NR_newfstatat (__NR_Linux + 252) |
602 | #define __NR_unlinkat (__NR_Linux + 253) | 604 | #define __NR_unlinkat (__NR_Linux + 253) |
603 | #define __NR_renameat (__NR_Linux + 254) | 605 | #define __NR_renameat (__NR_Linux + 254) |
604 | #define __NR_linkat (__NR_Linux + 255) | 606 | #define __NR_linkat (__NR_Linux + 255) |
@@ -614,16 +616,18 @@ | |||
614 | #define __NR_tee (__NR_Linux + 265) | 616 | #define __NR_tee (__NR_Linux + 265) |
615 | #define __NR_vmsplice (__NR_Linux + 266) | 617 | #define __NR_vmsplice (__NR_Linux + 266) |
616 | #define __NR_move_pages (__NR_Linux + 267) | 618 | #define __NR_move_pages (__NR_Linux + 267) |
619 | #define __NR_set_robust_list (__NR_Linux + 268) | ||
620 | #define __NR_get_robust_list (__NR_Linux + 269) | ||
617 | 621 | ||
618 | /* | 622 | /* |
619 | * Offset of the last Linux 64-bit flavoured syscall | 623 | * Offset of the last Linux 64-bit flavoured syscall |
620 | */ | 624 | */ |
621 | #define __NR_Linux_syscalls 267 | 625 | #define __NR_Linux_syscalls 269 |
622 | 626 | ||
623 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 627 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
624 | 628 | ||
625 | #define __NR_64_Linux 5000 | 629 | #define __NR_64_Linux 5000 |
626 | #define __NR_64_Linux_syscalls 267 | 630 | #define __NR_64_Linux_syscalls 269 |
627 | 631 | ||
628 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 632 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
629 | 633 | ||
@@ -887,7 +891,7 @@ | |||
887 | #define __NR_mknodat (__NR_Linux + 253) | 891 | #define __NR_mknodat (__NR_Linux + 253) |
888 | #define __NR_fchownat (__NR_Linux + 254) | 892 | #define __NR_fchownat (__NR_Linux + 254) |
889 | #define __NR_futimesat (__NR_Linux + 255) | 893 | #define __NR_futimesat (__NR_Linux + 255) |
890 | #define __NR_fstatat (__NR_Linux + 256) | 894 | #define __NR_newfstatat (__NR_Linux + 256) |
891 | #define __NR_unlinkat (__NR_Linux + 257) | 895 | #define __NR_unlinkat (__NR_Linux + 257) |
892 | #define __NR_renameat (__NR_Linux + 258) | 896 | #define __NR_renameat (__NR_Linux + 258) |
893 | #define __NR_linkat (__NR_Linux + 259) | 897 | #define __NR_linkat (__NR_Linux + 259) |
@@ -903,16 +907,18 @@ | |||
903 | #define __NR_tee (__NR_Linux + 269) | 907 | #define __NR_tee (__NR_Linux + 269) |
904 | #define __NR_vmsplice (__NR_Linux + 270) | 908 | #define __NR_vmsplice (__NR_Linux + 270) |
905 | #define __NR_move_pages (__NR_Linux + 271) | 909 | #define __NR_move_pages (__NR_Linux + 271) |
910 | #define __NR_set_robust_list (__NR_Linux + 272) | ||
911 | #define __NR_get_robust_list (__NR_Linux + 273) | ||
906 | 912 | ||
907 | /* | 913 | /* |
908 | * Offset of the last N32 flavoured syscall | 914 | * Offset of the last N32 flavoured syscall |
909 | */ | 915 | */ |
910 | #define __NR_Linux_syscalls 271 | 916 | #define __NR_Linux_syscalls 273 |
911 | 917 | ||
912 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 918 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
913 | 919 | ||
914 | #define __NR_N32_Linux 6000 | 920 | #define __NR_N32_Linux 6000 |
915 | #define __NR_N32_Linux_syscalls 271 | 921 | #define __NR_N32_Linux_syscalls 273 |
916 | 922 | ||
917 | #ifdef __KERNEL__ | 923 | #ifdef __KERNEL__ |
918 | 924 | ||
diff --git a/include/asm-mips/user.h b/include/asm-mips/user.h index 89bf8b4cab3c..61f2a093b91b 100644 --- a/include/asm-mips/user.h +++ b/include/asm-mips/user.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #ifndef _ASM_USER_H | 8 | #ifndef _ASM_USER_H |
9 | #define _ASM_USER_H | 9 | #define _ASM_USER_H |
10 | 10 | ||
11 | #ifdef __KERNEL__ | ||
12 | |||
11 | #include <asm/page.h> | 13 | #include <asm/page.h> |
12 | #include <asm/reg.h> | 14 | #include <asm/reg.h> |
13 | 15 | ||
@@ -55,4 +57,6 @@ struct user { | |||
55 | #define HOST_DATA_START_ADDR (u.start_data) | 57 | #define HOST_DATA_START_ADDR (u.start_data) |
56 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | 58 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) |
57 | 59 | ||
60 | #endif /* __KERNEL__ */ | ||
61 | |||
58 | #endif /* _ASM_USER_H */ | 62 | #endif /* _ASM_USER_H */ |
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h index 5066c54dae0a..c0b61e0d1497 100644 --- a/include/asm-parisc/pgtable.h +++ b/include/asm-parisc/pgtable.h | |||
@@ -303,7 +303,8 @@ static inline void pmd_clear(pmd_t *pmd) { | |||
303 | 303 | ||
304 | 304 | ||
305 | #if PT_NLEVELS == 3 | 305 | #if PT_NLEVELS == 3 |
306 | #define pgd_page(pgd) ((unsigned long) __va(pgd_address(pgd))) | 306 | #define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_address(pgd))) |
307 | #define pgd_page(pgd) virt_to_page((void *)pgd_page_vaddr(pgd)) | ||
307 | 308 | ||
308 | /* For 64 bit we have three level tables */ | 309 | /* For 64 bit we have three level tables */ |
309 | 310 | ||
@@ -382,7 +383,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
382 | 383 | ||
383 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) | 384 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) |
384 | 385 | ||
385 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_address(pmd))) | 386 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_address(pmd))) |
386 | 387 | ||
387 | #define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd))) | 388 | #define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd))) |
388 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) | 389 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) |
@@ -400,7 +401,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
400 | 401 | ||
401 | #if PT_NLEVELS == 3 | 402 | #if PT_NLEVELS == 3 |
402 | #define pmd_offset(dir,address) \ | 403 | #define pmd_offset(dir,address) \ |
403 | ((pmd_t *) pgd_page(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) | 404 | ((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) |
404 | #else | 405 | #else |
405 | #define pmd_offset(dir,addr) ((pmd_t *) dir) | 406 | #define pmd_offset(dir,addr) ((pmd_t *) dir) |
406 | #endif | 407 | #endif |
@@ -408,7 +409,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
408 | /* Find an entry in the third-level page table.. */ | 409 | /* Find an entry in the third-level page table.. */ |
409 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) | 410 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) |
410 | #define pte_offset_kernel(pmd, address) \ | 411 | #define pte_offset_kernel(pmd, address) \ |
411 | ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address)) | 412 | ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) |
412 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) | 413 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) |
413 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) | 414 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) |
414 | #define pte_unmap(pte) do { } while (0) | 415 | #define pte_unmap(pte) do { } while (0) |
diff --git a/include/asm-powerpc/libata-portmap.h b/include/asm-powerpc/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-powerpc/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h index e7036155672e..345d9b07b3e2 100644 --- a/include/asm-powerpc/pgtable-4k.h +++ b/include/asm-powerpc/pgtable-4k.h | |||
@@ -88,10 +88,11 @@ | |||
88 | #define pgd_bad(pgd) (pgd_val(pgd) == 0) | 88 | #define pgd_bad(pgd) (pgd_val(pgd) == 0) |
89 | #define pgd_present(pgd) (pgd_val(pgd) != 0) | 89 | #define pgd_present(pgd) (pgd_val(pgd) != 0) |
90 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) | 90 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) |
91 | #define pgd_page(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) | 91 | #define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) |
92 | #define pgd_page(pgd) virt_to_page(pgd_page_vaddr(pgd)) | ||
92 | 93 | ||
93 | #define pud_offset(pgdp, addr) \ | 94 | #define pud_offset(pgdp, addr) \ |
94 | (((pud_t *) pgd_page(*(pgdp))) + \ | 95 | (((pud_t *) pgd_page_vaddr(*(pgdp))) + \ |
95 | (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) | 96 | (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) |
96 | 97 | ||
97 | #define pud_ERROR(e) \ | 98 | #define pud_ERROR(e) \ |
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h index 8dbf5ad8150f..10f52743f4ff 100644 --- a/include/asm-powerpc/pgtable.h +++ b/include/asm-powerpc/pgtable.h | |||
@@ -196,8 +196,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
196 | || (pmd_val(pmd) & PMD_BAD_BITS)) | 196 | || (pmd_val(pmd) & PMD_BAD_BITS)) |
197 | #define pmd_present(pmd) (pmd_val(pmd) != 0) | 197 | #define pmd_present(pmd) (pmd_val(pmd) != 0) |
198 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) | 198 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) |
199 | #define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) | 199 | #define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) |
200 | #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) | 200 | #define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd)) |
201 | 201 | ||
202 | #define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) | 202 | #define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) |
203 | #define pud_none(pud) (!pud_val(pud)) | 203 | #define pud_none(pud) (!pud_val(pud)) |
@@ -205,7 +205,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
205 | || (pud_val(pud) & PUD_BAD_BITS)) | 205 | || (pud_val(pud) & PUD_BAD_BITS)) |
206 | #define pud_present(pud) (pud_val(pud) != 0) | 206 | #define pud_present(pud) (pud_val(pud) != 0) |
207 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) | 207 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) |
208 | #define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS) | 208 | #define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS) |
209 | #define pud_page(pud) virt_to_page(pud_page_vaddr(pud)) | ||
209 | 210 | ||
210 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) | 211 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) |
211 | 212 | ||
@@ -219,10 +220,10 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
219 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | 220 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) |
220 | 221 | ||
221 | #define pmd_offset(pudp,addr) \ | 222 | #define pmd_offset(pudp,addr) \ |
222 | (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) | 223 | (((pmd_t *) pud_page_vaddr(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) |
223 | 224 | ||
224 | #define pte_offset_kernel(dir,addr) \ | 225 | #define pte_offset_kernel(dir,addr) \ |
225 | (((pte_t *) pmd_page_kernel(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) | 226 | (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) |
226 | 227 | ||
227 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) | 228 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) |
228 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) | 229 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) |
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 51fa7c662917..b1fdbf40dba2 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h | |||
@@ -526,7 +526,7 @@ static inline int pgd_bad(pgd_t pgd) { return 0; } | |||
526 | static inline int pgd_present(pgd_t pgd) { return 1; } | 526 | static inline int pgd_present(pgd_t pgd) { return 1; } |
527 | #define pgd_clear(xp) do { } while (0) | 527 | #define pgd_clear(xp) do { } while (0) |
528 | 528 | ||
529 | #define pgd_page(pgd) \ | 529 | #define pgd_page_vaddr(pgd) \ |
530 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | 530 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) |
531 | 531 | ||
532 | /* | 532 | /* |
@@ -720,12 +720,12 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
720 | * of the pte page. -- paulus | 720 | * of the pte page. -- paulus |
721 | */ | 721 | */ |
722 | #ifndef CONFIG_BOOKE | 722 | #ifndef CONFIG_BOOKE |
723 | #define pmd_page_kernel(pmd) \ | 723 | #define pmd_page_vaddr(pmd) \ |
724 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 724 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
725 | #define pmd_page(pmd) \ | 725 | #define pmd_page(pmd) \ |
726 | (mem_map + (pmd_val(pmd) >> PAGE_SHIFT)) | 726 | (mem_map + (pmd_val(pmd) >> PAGE_SHIFT)) |
727 | #else | 727 | #else |
728 | #define pmd_page_kernel(pmd) \ | 728 | #define pmd_page_vaddr(pmd) \ |
729 | ((unsigned long) (pmd_val(pmd) & PAGE_MASK)) | 729 | ((unsigned long) (pmd_val(pmd) & PAGE_MASK)) |
730 | #define pmd_page(pmd) \ | 730 | #define pmd_page(pmd) \ |
731 | (mem_map + (__pa(pmd_val(pmd)) >> PAGE_SHIFT)) | 731 | (mem_map + (__pa(pmd_val(pmd)) >> PAGE_SHIFT)) |
@@ -748,7 +748,7 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
748 | #define pte_index(address) \ | 748 | #define pte_index(address) \ |
749 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 749 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
750 | #define pte_offset_kernel(dir, addr) \ | 750 | #define pte_offset_kernel(dir, addr) \ |
751 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) | 751 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) |
752 | #define pte_offset_map(dir, addr) \ | 752 | #define pte_offset_map(dir, addr) \ |
753 | ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) | 753 | ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) |
754 | #define pte_offset_map_nested(dir, addr) \ | 754 | #define pte_offset_map_nested(dir, addr) \ |
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h index 28b3517e787c..495ad99c7635 100644 --- a/include/asm-s390/percpu.h +++ b/include/asm-s390/percpu.h | |||
@@ -15,18 +15,20 @@ | |||
15 | */ | 15 | */ |
16 | #if defined(__s390x__) && defined(MODULE) | 16 | #if defined(__s390x__) && defined(MODULE) |
17 | 17 | ||
18 | #define __reloc_hide(var,offset) \ | 18 | #define __reloc_hide(var,offset) (*({ \ |
19 | (*({ unsigned long *__ptr; \ | 19 | extern int simple_indentifier_##var(void); \ |
20 | asm ( "larl %0,per_cpu__"#var"@GOTENT" \ | 20 | unsigned long *__ptr; \ |
21 | : "=a" (__ptr) : "X" (per_cpu__##var) ); \ | 21 | asm ( "larl %0,per_cpu__"#var"@GOTENT" \ |
22 | (typeof(&per_cpu__##var))((*__ptr) + (offset)); })) | 22 | : "=a" (__ptr) : "X" (per_cpu__##var) ); \ |
23 | (typeof(&per_cpu__##var))((*__ptr) + (offset)); })) | ||
23 | 24 | ||
24 | #else | 25 | #else |
25 | 26 | ||
26 | #define __reloc_hide(var, offset) \ | 27 | #define __reloc_hide(var, offset) (*({ \ |
27 | (*({ unsigned long __ptr; \ | 28 | extern int simple_indentifier_##var(void); \ |
28 | asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \ | 29 | unsigned long __ptr; \ |
29 | (typeof(&per_cpu__##var)) (__ptr + (offset)); })) | 30 | asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \ |
31 | (typeof(&per_cpu__##var)) (__ptr + (offset)); })) | ||
30 | 32 | ||
31 | #endif | 33 | #endif |
32 | 34 | ||
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 1a07028d575e..e965309fedac 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -664,11 +664,13 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) | |||
664 | #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) | 664 | #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) |
665 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 665 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
666 | 666 | ||
667 | #define pmd_page_kernel(pmd) (pmd_val(pmd) & PAGE_MASK) | 667 | #define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK) |
668 | 668 | ||
669 | #define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) | 669 | #define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) |
670 | 670 | ||
671 | #define pgd_page_kernel(pgd) (pgd_val(pgd) & PAGE_MASK) | 671 | #define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK) |
672 | |||
673 | #define pgd_page(pgd) (mem_map+(pgd_val(pgd) >> PAGE_SHIFT)) | ||
672 | 674 | ||
673 | /* to find an entry in a page-table-directory */ | 675 | /* to find an entry in a page-table-directory */ |
674 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 676 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
@@ -690,14 +692,14 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
690 | /* Find an entry in the second-level page table.. */ | 692 | /* Find an entry in the second-level page table.. */ |
691 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | 693 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) |
692 | #define pmd_offset(dir,addr) \ | 694 | #define pmd_offset(dir,addr) \ |
693 | ((pmd_t *) pgd_page_kernel(*(dir)) + pmd_index(addr)) | 695 | ((pmd_t *) pgd_page_vaddr(*(dir)) + pmd_index(addr)) |
694 | 696 | ||
695 | #endif /* __s390x__ */ | 697 | #endif /* __s390x__ */ |
696 | 698 | ||
697 | /* Find an entry in the third-level page table.. */ | 699 | /* Find an entry in the third-level page table.. */ |
698 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) | 700 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) |
699 | #define pte_offset_kernel(pmd, address) \ | 701 | #define pte_offset_kernel(pmd, address) \ |
700 | ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address)) | 702 | ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) |
701 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) | 703 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) |
702 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) | 704 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) |
703 | #define pte_unmap(pte) do { } while (0) | 705 | #define pte_unmap(pte) do { } while (0) |
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index a3a4e5fd30d7..578c2209fa76 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
@@ -337,6 +337,8 @@ struct notifier_block; | |||
337 | int register_idle_notifier(struct notifier_block *nb); | 337 | int register_idle_notifier(struct notifier_block *nb); |
338 | int unregister_idle_notifier(struct notifier_block *nb); | 338 | int unregister_idle_notifier(struct notifier_block *nb); |
339 | 339 | ||
340 | #define ARCH_LOW_ADDRESS_LIMIT 0x7fffffffUL | ||
341 | |||
340 | #endif | 342 | #endif |
341 | 343 | ||
342 | /* | 344 | /* |
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index 02b942d85c37..d49c54cb5505 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -342,9 +342,11 @@ | |||
342 | 342 | ||
343 | #ifdef __KERNEL__ | 343 | #ifdef __KERNEL__ |
344 | 344 | ||
345 | #include <linux/err.h> | ||
346 | |||
345 | #define __syscall_return(type, res) \ | 347 | #define __syscall_return(type, res) \ |
346 | do { \ | 348 | do { \ |
347 | if ((unsigned long)(res) >= (unsigned long)(-4095)) {\ | 349 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
348 | errno = -(res); \ | 350 | errno = -(res); \ |
349 | res = -1; \ | 351 | res = -1; \ |
350 | } \ | 352 | } \ |
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h index 720afc11c2ca..b860218e402e 100644 --- a/include/asm-sh/addrspace.h +++ b/include/asm-sh/addrspace.h | |||
@@ -14,11 +14,19 @@ | |||
14 | #include <asm/cpu/addrspace.h> | 14 | #include <asm/cpu/addrspace.h> |
15 | 15 | ||
16 | /* Memory segments (32bit Privileged mode addresses) */ | 16 | /* Memory segments (32bit Privileged mode addresses) */ |
17 | #ifndef CONFIG_CPU_SH2A | ||
17 | #define P0SEG 0x00000000 | 18 | #define P0SEG 0x00000000 |
18 | #define P1SEG 0x80000000 | 19 | #define P1SEG 0x80000000 |
19 | #define P2SEG 0xa0000000 | 20 | #define P2SEG 0xa0000000 |
20 | #define P3SEG 0xc0000000 | 21 | #define P3SEG 0xc0000000 |
21 | #define P4SEG 0xe0000000 | 22 | #define P4SEG 0xe0000000 |
23 | #else | ||
24 | #define P0SEG 0x00000000 | ||
25 | #define P1SEG 0x00000000 | ||
26 | #define P2SEG 0x20000000 | ||
27 | #define P3SEG 0x00000000 | ||
28 | #define P4SEG 0x80000000 | ||
29 | #endif | ||
22 | 30 | ||
23 | /* Returns the privileged segment base of a given address */ | 31 | /* Returns the privileged segment base of a given address */ |
24 | #define PXSEG(a) (((unsigned long)(a)) & 0xe0000000) | 32 | #define PXSEG(a) (((unsigned long)(a)) & 0xe0000000) |
diff --git a/include/asm-sh/adx/io.h b/include/asm-sh/adx/io.h deleted file mode 100644 index ab1225f1d557..000000000000 --- a/include/asm-sh/adx/io.h +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/io_adx.h | ||
3 | * | ||
4 | * Copyright (C) 2001 A&D Co., Ltd. | ||
5 | * | ||
6 | * This file may be copied or modified under the terms of the GNU | ||
7 | * General Public License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * IO functions for an A&D ADX Board | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SH_IO_ADX_H | ||
13 | #define _ASM_SH_IO_ADX_H | ||
14 | |||
15 | #include <asm/io_generic.h> | ||
16 | |||
17 | extern unsigned char adx_inb(unsigned long port); | ||
18 | extern unsigned short adx_inw(unsigned long port); | ||
19 | extern unsigned int adx_inl(unsigned long port); | ||
20 | |||
21 | extern void adx_outb(unsigned char value, unsigned long port); | ||
22 | extern void adx_outw(unsigned short value, unsigned long port); | ||
23 | extern void adx_outl(unsigned int value, unsigned long port); | ||
24 | |||
25 | extern unsigned char adx_inb_p(unsigned long port); | ||
26 | extern void adx_outb_p(unsigned char value, unsigned long port); | ||
27 | |||
28 | extern void adx_insb(unsigned long port, void *addr, unsigned long count); | ||
29 | extern void adx_insw(unsigned long port, void *addr, unsigned long count); | ||
30 | extern void adx_insl(unsigned long port, void *addr, unsigned long count); | ||
31 | extern void adx_outsb(unsigned long port, const void *addr, unsigned long count); | ||
32 | extern void adx_outsw(unsigned long port, const void *addr, unsigned long count); | ||
33 | extern void adx_outsl(unsigned long port, const void *addr, unsigned long count); | ||
34 | |||
35 | extern unsigned char adx_readb(unsigned long addr); | ||
36 | extern unsigned short adx_readw(unsigned long addr); | ||
37 | extern unsigned int adx_readl(unsigned long addr); | ||
38 | extern void adx_writeb(unsigned char b, unsigned long addr); | ||
39 | extern void adx_writew(unsigned short b, unsigned long addr); | ||
40 | extern void adx_writel(unsigned int b, unsigned long addr); | ||
41 | |||
42 | extern void * adx_ioremap(unsigned long offset, unsigned long size); | ||
43 | extern void adx_iounmap(void *addr); | ||
44 | |||
45 | extern unsigned long adx_isa_port2addr(unsigned long offset); | ||
46 | |||
47 | extern void setup_adx(void); | ||
48 | extern void init_adx_IRQ(void); | ||
49 | |||
50 | #ifdef __WANT_IO_DEF | ||
51 | |||
52 | #define __inb adx_inb | ||
53 | #define __inw adx_inw | ||
54 | #define __inl adx_inl | ||
55 | #define __outb adx_outb | ||
56 | #define __outw adx_outw | ||
57 | #define __outl adx_outl | ||
58 | |||
59 | #define __inb_p adx_inb_p | ||
60 | #define __inw_p adx_inw | ||
61 | #define __inl_p adx_inl | ||
62 | #define __outb_p adx_outb_p | ||
63 | #define __outw_p adx_outw | ||
64 | #define __outl_p adx_outl | ||
65 | |||
66 | #define __insb adx_insb | ||
67 | #define __insw adx_insw | ||
68 | #define __insl adx_insl | ||
69 | #define __outsb adx_outsb | ||
70 | #define __outsw adx_outsw | ||
71 | #define __outsl adx_outsl | ||
72 | |||
73 | #define __readb adx_readb | ||
74 | #define __readw adx_readw | ||
75 | #define __readl adx_readl | ||
76 | #define __writeb adx_writeb | ||
77 | #define __writew adx_writew | ||
78 | #define __writel adx_writel | ||
79 | |||
80 | #define __isa_port2addr adx_isa_port2addr | ||
81 | #define __ioremap adx_ioremap | ||
82 | #define __iounmap adx_iounmap | ||
83 | |||
84 | #endif | ||
85 | |||
86 | #endif /* _ASM_SH_IO_AANDD_H */ | ||
diff --git a/include/asm-sh/apm.h b/include/asm-sh/apm.h new file mode 100644 index 000000000000..8b091e93651f --- /dev/null +++ b/include/asm-sh/apm.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com> | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef __ASM_SH_APM_H | ||
11 | #define __ASM_SH_APM_H | ||
12 | |||
13 | #define APM_AC_OFFLINE 0 | ||
14 | #define APM_AC_ONLINE 1 | ||
15 | #define APM_AC_BACKUP 2 | ||
16 | #define APM_AC_UNKNOWN 0xff | ||
17 | |||
18 | #define APM_BATTERY_STATUS_HIGH 0 | ||
19 | #define APM_BATTERY_STATUS_LOW 1 | ||
20 | #define APM_BATTERY_STATUS_CRITICAL 2 | ||
21 | #define APM_BATTERY_STATUS_CHARGING 3 | ||
22 | #define APM_BATTERY_STATUS_NOT_PRESENT 4 | ||
23 | #define APM_BATTERY_STATUS_UNKNOWN 0xff | ||
24 | |||
25 | #define APM_BATTERY_LIFE_UNKNOWN 0xFFFF | ||
26 | #define APM_BATTERY_LIFE_MINUTES 0x8000 | ||
27 | #define APM_BATTERY_LIFE_VALUE_MASK 0x7FFF | ||
28 | |||
29 | #define APM_BATTERY_FLAG_HIGH (1 << 0) | ||
30 | #define APM_BATTERY_FLAG_LOW (1 << 1) | ||
31 | #define APM_BATTERY_FLAG_CRITICAL (1 << 2) | ||
32 | #define APM_BATTERY_FLAG_CHARGING (1 << 3) | ||
33 | #define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7) | ||
34 | #define APM_BATTERY_FLAG_UNKNOWN 0xff | ||
35 | |||
36 | #define APM_UNITS_MINS 0 | ||
37 | #define APM_UNITS_SECS 1 | ||
38 | #define APM_UNITS_UNKNOWN -1 | ||
39 | |||
40 | |||
41 | extern int (*apm_get_info)(char *buf, char **start, off_t fpos, int length); | ||
42 | extern int apm_suspended; | ||
43 | |||
44 | void apm_queue_event(apm_event_t event); | ||
45 | |||
46 | #endif | ||
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h index fb627de217f2..8bdc1ba56f73 100644 --- a/include/asm-sh/atomic.h +++ b/include/asm-sh/atomic.h | |||
@@ -14,6 +14,7 @@ typedef struct { volatile int counter; } atomic_t; | |||
14 | #define atomic_read(v) ((v)->counter) | 14 | #define atomic_read(v) ((v)->counter) |
15 | #define atomic_set(v,i) ((v)->counter = (i)) | 15 | #define atomic_set(v,i) ((v)->counter = (i)) |
16 | 16 | ||
17 | #include <linux/compiler.h> | ||
17 | #include <asm/system.h> | 18 | #include <asm/system.h> |
18 | 19 | ||
19 | /* | 20 | /* |
@@ -21,49 +22,110 @@ typedef struct { volatile int counter; } atomic_t; | |||
21 | * forward to code at the end of this object's .text section, then | 22 | * forward to code at the end of this object's .text section, then |
22 | * branch back to restart the operation. | 23 | * branch back to restart the operation. |
23 | */ | 24 | */ |
24 | 25 | static inline void atomic_add(int i, atomic_t *v) | |
25 | static __inline__ void atomic_add(int i, atomic_t * v) | ||
26 | { | 26 | { |
27 | #ifdef CONFIG_CPU_SH4A | ||
28 | unsigned long tmp; | ||
29 | |||
30 | __asm__ __volatile__ ( | ||
31 | "1: movli.l @%3, %0 ! atomic_add \n" | ||
32 | " add %2, %0 \n" | ||
33 | " movco.l %0, @%3 \n" | ||
34 | " bf 1b \n" | ||
35 | : "=&z" (tmp), "=r" (&v->counter) | ||
36 | : "r" (i), "r" (&v->counter) | ||
37 | : "t"); | ||
38 | #else | ||
27 | unsigned long flags; | 39 | unsigned long flags; |
28 | 40 | ||
29 | local_irq_save(flags); | 41 | local_irq_save(flags); |
30 | *(long *)v += i; | 42 | *(long *)v += i; |
31 | local_irq_restore(flags); | 43 | local_irq_restore(flags); |
44 | #endif | ||
32 | } | 45 | } |
33 | 46 | ||
34 | static __inline__ void atomic_sub(int i, atomic_t *v) | 47 | static inline void atomic_sub(int i, atomic_t *v) |
35 | { | 48 | { |
49 | #ifdef CONFIG_CPU_SH4A | ||
50 | unsigned long tmp; | ||
51 | |||
52 | __asm__ __volatile__ ( | ||
53 | "1: movli.l @%3, %0 ! atomic_sub \n" | ||
54 | " sub %2, %0 \n" | ||
55 | " movco.l %0, @%3 \n" | ||
56 | " bf 1b \n" | ||
57 | : "=&z" (tmp), "=r" (&v->counter) | ||
58 | : "r" (i), "r" (&v->counter) | ||
59 | : "t"); | ||
60 | #else | ||
36 | unsigned long flags; | 61 | unsigned long flags; |
37 | 62 | ||
38 | local_irq_save(flags); | 63 | local_irq_save(flags); |
39 | *(long *)v -= i; | 64 | *(long *)v -= i; |
40 | local_irq_restore(flags); | 65 | local_irq_restore(flags); |
66 | #endif | ||
41 | } | 67 | } |
42 | 68 | ||
43 | static __inline__ int atomic_add_return(int i, atomic_t * v) | 69 | /* |
70 | * SH-4A note: | ||
71 | * | ||
72 | * We basically get atomic_xxx_return() for free compared with | ||
73 | * atomic_xxx(). movli.l/movco.l require r0 due to the instruction | ||
74 | * encoding, so the retval is automatically set without having to | ||
75 | * do any special work. | ||
76 | */ | ||
77 | static inline int atomic_add_return(int i, atomic_t *v) | ||
44 | { | 78 | { |
45 | unsigned long temp, flags; | 79 | unsigned long temp; |
80 | |||
81 | #ifdef CONFIG_CPU_SH4A | ||
82 | __asm__ __volatile__ ( | ||
83 | "1: movli.l @%3, %0 ! atomic_add_return \n" | ||
84 | " add %2, %0 \n" | ||
85 | " movco.l %0, @%3 \n" | ||
86 | " bf 1b \n" | ||
87 | " synco \n" | ||
88 | : "=&z" (temp), "=r" (&v->counter) | ||
89 | : "r" (i), "r" (&v->counter) | ||
90 | : "t"); | ||
91 | #else | ||
92 | unsigned long flags; | ||
46 | 93 | ||
47 | local_irq_save(flags); | 94 | local_irq_save(flags); |
48 | temp = *(long *)v; | 95 | temp = *(long *)v; |
49 | temp += i; | 96 | temp += i; |
50 | *(long *)v = temp; | 97 | *(long *)v = temp; |
51 | local_irq_restore(flags); | 98 | local_irq_restore(flags); |
99 | #endif | ||
52 | 100 | ||
53 | return temp; | 101 | return temp; |
54 | } | 102 | } |
55 | 103 | ||
56 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | 104 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) |
57 | 105 | ||
58 | static __inline__ int atomic_sub_return(int i, atomic_t * v) | 106 | static inline int atomic_sub_return(int i, atomic_t *v) |
59 | { | 107 | { |
60 | unsigned long temp, flags; | 108 | unsigned long temp; |
109 | |||
110 | #ifdef CONFIG_CPU_SH4A | ||
111 | __asm__ __volatile__ ( | ||
112 | "1: movli.l @%3, %0 ! atomic_sub_return \n" | ||
113 | " sub %2, %0 \n" | ||
114 | " movco.l %0, @%3 \n" | ||
115 | " bf 1b \n" | ||
116 | " synco \n" | ||
117 | : "=&z" (temp), "=r" (&v->counter) | ||
118 | : "r" (i), "r" (&v->counter) | ||
119 | : "t"); | ||
120 | #else | ||
121 | unsigned long flags; | ||
61 | 122 | ||
62 | local_irq_save(flags); | 123 | local_irq_save(flags); |
63 | temp = *(long *)v; | 124 | temp = *(long *)v; |
64 | temp -= i; | 125 | temp -= i; |
65 | *(long *)v = temp; | 126 | *(long *)v = temp; |
66 | local_irq_restore(flags); | 127 | local_irq_restore(flags); |
128 | #endif | ||
67 | 129 | ||
68 | return temp; | 130 | return temp; |
69 | } | 131 | } |
@@ -118,22 +180,48 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
118 | } | 180 | } |
119 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 181 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
120 | 182 | ||
121 | static __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) | 183 | static inline void atomic_clear_mask(unsigned int mask, atomic_t *v) |
122 | { | 184 | { |
185 | #ifdef CONFIG_CPU_SH4A | ||
186 | unsigned long tmp; | ||
187 | |||
188 | __asm__ __volatile__ ( | ||
189 | "1: movli.l @%3, %0 ! atomic_clear_mask \n" | ||
190 | " and %2, %0 \n" | ||
191 | " movco.l %0, @%3 \n" | ||
192 | " bf 1b \n" | ||
193 | : "=&z" (tmp), "=r" (&v->counter) | ||
194 | : "r" (~mask), "r" (&v->counter) | ||
195 | : "t"); | ||
196 | #else | ||
123 | unsigned long flags; | 197 | unsigned long flags; |
124 | 198 | ||
125 | local_irq_save(flags); | 199 | local_irq_save(flags); |
126 | *(long *)v &= ~mask; | 200 | *(long *)v &= ~mask; |
127 | local_irq_restore(flags); | 201 | local_irq_restore(flags); |
202 | #endif | ||
128 | } | 203 | } |
129 | 204 | ||
130 | static __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v) | 205 | static inline void atomic_set_mask(unsigned int mask, atomic_t *v) |
131 | { | 206 | { |
207 | #ifdef CONFIG_CPU_SH4A | ||
208 | unsigned long tmp; | ||
209 | |||
210 | __asm__ __volatile__ ( | ||
211 | "1: movli.l @%3, %0 ! atomic_set_mask \n" | ||
212 | " or %2, %0 \n" | ||
213 | " movco.l %0, @%3 \n" | ||
214 | " bf 1b \n" | ||
215 | : "=&z" (tmp), "=r" (&v->counter) | ||
216 | : "r" (mask), "r" (&v->counter) | ||
217 | : "t"); | ||
218 | #else | ||
132 | unsigned long flags; | 219 | unsigned long flags; |
133 | 220 | ||
134 | local_irq_save(flags); | 221 | local_irq_save(flags); |
135 | *(long *)v |= mask; | 222 | *(long *)v |= mask; |
136 | local_irq_restore(flags); | 223 | local_irq_restore(flags); |
224 | #endif | ||
137 | } | 225 | } |
138 | 226 | ||
139 | /* Atomic operations are already serializing on SH */ | 227 | /* Atomic operations are already serializing on SH */ |
diff --git a/include/asm-sh/auxvec.h b/include/asm-sh/auxvec.h index fc21e4db5881..1b6916e63e90 100644 --- a/include/asm-sh/auxvec.h +++ b/include/asm-sh/auxvec.h | |||
@@ -1,4 +1,18 @@ | |||
1 | #ifndef __ASM_SH_AUXVEC_H | 1 | #ifndef __ASM_SH_AUXVEC_H |
2 | #define __ASM_SH_AUXVEC_H | 2 | #define __ASM_SH_AUXVEC_H |
3 | 3 | ||
4 | /* | ||
5 | * Architecture-neutral AT_ values in 0-17, leave some room | ||
6 | * for more of them. | ||
7 | */ | ||
8 | |||
9 | #ifdef CONFIG_VSYSCALL | ||
10 | /* | ||
11 | * Only define this in the vsyscall case, the entry point to | ||
12 | * the vsyscall page gets placed here. The kernel will attempt | ||
13 | * to build a gate VMA we don't care about otherwise.. | ||
14 | */ | ||
15 | #define AT_SYSINFO_EHDR 33 | ||
16 | #endif | ||
17 | |||
4 | #endif /* __ASM_SH_AUXVEC_H */ | 18 | #endif /* __ASM_SH_AUXVEC_H */ |
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index e34f82508568..1c16792cee1d 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h | |||
@@ -6,7 +6,7 @@ | |||
6 | /* For __swab32 */ | 6 | /* For __swab32 */ |
7 | #include <asm/byteorder.h> | 7 | #include <asm/byteorder.h> |
8 | 8 | ||
9 | static __inline__ void set_bit(int nr, volatile void * addr) | 9 | static inline void set_bit(int nr, volatile void * addr) |
10 | { | 10 | { |
11 | int mask; | 11 | int mask; |
12 | volatile unsigned int *a = addr; | 12 | volatile unsigned int *a = addr; |
@@ -24,7 +24,7 @@ static __inline__ void set_bit(int nr, volatile void * addr) | |||
24 | */ | 24 | */ |
25 | #define smp_mb__before_clear_bit() barrier() | 25 | #define smp_mb__before_clear_bit() barrier() |
26 | #define smp_mb__after_clear_bit() barrier() | 26 | #define smp_mb__after_clear_bit() barrier() |
27 | static __inline__ void clear_bit(int nr, volatile void * addr) | 27 | static inline void clear_bit(int nr, volatile void * addr) |
28 | { | 28 | { |
29 | int mask; | 29 | int mask; |
30 | volatile unsigned int *a = addr; | 30 | volatile unsigned int *a = addr; |
@@ -37,7 +37,7 @@ static __inline__ void clear_bit(int nr, volatile void * addr) | |||
37 | local_irq_restore(flags); | 37 | local_irq_restore(flags); |
38 | } | 38 | } |
39 | 39 | ||
40 | static __inline__ void change_bit(int nr, volatile void * addr) | 40 | static inline void change_bit(int nr, volatile void * addr) |
41 | { | 41 | { |
42 | int mask; | 42 | int mask; |
43 | volatile unsigned int *a = addr; | 43 | volatile unsigned int *a = addr; |
@@ -50,7 +50,7 @@ static __inline__ void change_bit(int nr, volatile void * addr) | |||
50 | local_irq_restore(flags); | 50 | local_irq_restore(flags); |
51 | } | 51 | } |
52 | 52 | ||
53 | static __inline__ int test_and_set_bit(int nr, volatile void * addr) | 53 | static inline int test_and_set_bit(int nr, volatile void * addr) |
54 | { | 54 | { |
55 | int mask, retval; | 55 | int mask, retval; |
56 | volatile unsigned int *a = addr; | 56 | volatile unsigned int *a = addr; |
@@ -66,7 +66,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr) | |||
66 | return retval; | 66 | return retval; |
67 | } | 67 | } |
68 | 68 | ||
69 | static __inline__ int test_and_clear_bit(int nr, volatile void * addr) | 69 | static inline int test_and_clear_bit(int nr, volatile void * addr) |
70 | { | 70 | { |
71 | int mask, retval; | 71 | int mask, retval; |
72 | volatile unsigned int *a = addr; | 72 | volatile unsigned int *a = addr; |
@@ -82,7 +82,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr) | |||
82 | return retval; | 82 | return retval; |
83 | } | 83 | } |
84 | 84 | ||
85 | static __inline__ int test_and_change_bit(int nr, volatile void * addr) | 85 | static inline int test_and_change_bit(int nr, volatile void * addr) |
86 | { | 86 | { |
87 | int mask, retval; | 87 | int mask, retval; |
88 | volatile unsigned int *a = addr; | 88 | volatile unsigned int *a = addr; |
@@ -100,7 +100,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr) | |||
100 | 100 | ||
101 | #include <asm-generic/bitops/non-atomic.h> | 101 | #include <asm-generic/bitops/non-atomic.h> |
102 | 102 | ||
103 | static __inline__ unsigned long ffz(unsigned long word) | 103 | static inline unsigned long ffz(unsigned long word) |
104 | { | 104 | { |
105 | unsigned long result; | 105 | unsigned long result; |
106 | 106 | ||
@@ -120,7 +120,7 @@ static __inline__ unsigned long ffz(unsigned long word) | |||
120 | * | 120 | * |
121 | * Undefined if no bit exists, so code should check against 0 first. | 121 | * Undefined if no bit exists, so code should check against 0 first. |
122 | */ | 122 | */ |
123 | static __inline__ unsigned long __ffs(unsigned long word) | 123 | static inline unsigned long __ffs(unsigned long word) |
124 | { | 124 | { |
125 | unsigned long result; | 125 | unsigned long result; |
126 | 126 | ||
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h index a6de3d06a3d9..b4000c8bf31b 100644 --- a/include/asm-sh/bugs.h +++ b/include/asm-sh/bugs.h | |||
@@ -32,6 +32,10 @@ static void __init check_bugs(void) | |||
32 | case CPU_SH7750 ... CPU_SH4_501: | 32 | case CPU_SH7750 ... CPU_SH4_501: |
33 | *p++ = '4'; | 33 | *p++ = '4'; |
34 | break; | 34 | break; |
35 | case CPU_SH7770 ... CPU_SH7781: | ||
36 | *p++ = '4'; | ||
37 | *p++ = 'a'; | ||
38 | break; | ||
35 | default: | 39 | default: |
36 | *p++ = '?'; | 40 | *p++ = '?'; |
37 | *p++ = '!'; | 41 | *p++ = '!'; |
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h index 656fdfe9e8b4..e3a180cf5062 100644 --- a/include/asm-sh/cache.h +++ b/include/asm-sh/cache.h | |||
@@ -10,7 +10,6 @@ | |||
10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
11 | 11 | ||
12 | #include <asm/cpu/cache.h> | 12 | #include <asm/cpu/cache.h> |
13 | #include <asm/cpu/cacheflush.h> | ||
14 | 13 | ||
15 | #define SH_CACHE_VALID 1 | 14 | #define SH_CACHE_VALID 1 |
16 | #define SH_CACHE_UPDATED 2 | 15 | #define SH_CACHE_UPDATED 2 |
@@ -23,24 +22,31 @@ | |||
23 | #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) | 22 | #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) |
24 | 23 | ||
25 | struct cache_info { | 24 | struct cache_info { |
26 | unsigned int ways; | 25 | unsigned int ways; /* Number of cache ways */ |
27 | unsigned int sets; | 26 | unsigned int sets; /* Number of cache sets */ |
28 | unsigned int linesz; | 27 | unsigned int linesz; /* Cache line size (bytes) */ |
29 | 28 | ||
30 | unsigned int way_incr; | 29 | unsigned int way_size; /* sets * line size */ |
31 | 30 | ||
31 | /* | ||
32 | * way_incr is the address offset for accessing the next way | ||
33 | * in memory mapped cache array ops. | ||
34 | */ | ||
35 | unsigned int way_incr; | ||
32 | unsigned int entry_shift; | 36 | unsigned int entry_shift; |
33 | unsigned int entry_mask; | 37 | unsigned int entry_mask; |
34 | 38 | ||
39 | /* | ||
40 | * Compute a mask which selects the address bits which overlap between | ||
41 | * 1. those used to select the cache set during indexing | ||
42 | * 2. those in the physical page number. | ||
43 | */ | ||
44 | unsigned int alias_mask; | ||
45 | |||
46 | unsigned int n_aliases; /* Number of aliases */ | ||
47 | |||
35 | unsigned long flags; | 48 | unsigned long flags; |
36 | }; | 49 | }; |
37 | 50 | ||
38 | /* Flush (write-back only) a region (smaller than a page) */ | ||
39 | extern void __flush_wback_region(void *start, int size); | ||
40 | /* Flush (write-back & invalidate) a region (smaller than a page) */ | ||
41 | extern void __flush_purge_region(void *start, int size); | ||
42 | /* Flush (invalidate only) a region (smaller than a page) */ | ||
43 | extern void __flush_invalidate_region(void *start, int size); | ||
44 | |||
45 | #endif /* __KERNEL__ */ | 51 | #endif /* __KERNEL__ */ |
46 | #endif /* __ASM_SH_CACHE_H */ | 52 | #endif /* __ASM_SH_CACHE_H */ |
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h index 9dfb33edb008..07f62ec9ff0c 100644 --- a/include/asm-sh/cacheflush.h +++ b/include/asm-sh/cacheflush.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ASM_SH_CACHEFLUSH_H | 2 | #define __ASM_SH_CACHEFLUSH_H |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #include <linux/mm.h> | ||
5 | #include <asm/cpu/cacheflush.h> | 6 | #include <asm/cpu/cacheflush.h> |
6 | 7 | ||
7 | /* Flush (write-back only) a region (smaller than a page) */ | 8 | /* Flush (write-back only) a region (smaller than a page) */ |
@@ -27,5 +28,7 @@ extern void __flush_invalidate_region(void *start, int size); | |||
27 | memcpy(dst, src, len); \ | 28 | memcpy(dst, src, len); \ |
28 | } while (0) | 29 | } while (0) |
29 | 30 | ||
31 | #define HAVE_ARCH_UNMAPPED_AREA | ||
32 | |||
30 | #endif /* __KERNEL__ */ | 33 | #endif /* __KERNEL__ */ |
31 | #endif /* __ASM_SH_CACHEFLUSH_H */ | 34 | #endif /* __ASM_SH_CACHEFLUSH_H */ |
diff --git a/include/asm-sh/cat68701/io.h b/include/asm-sh/cat68701/io.h deleted file mode 100644 index 753b8466ad11..000000000000 --- a/include/asm-sh/cat68701/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/io_cat68701.h | ||
3 | * | ||
4 | * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) | ||
5 | * 2001 Yutarou Ebihar (ebihara@si-linux.com) | ||
6 | * | ||
7 | * May be copied or modified under the terms of the GNU General Public | ||
8 | * License. See linux/COPYING for more information. | ||
9 | * | ||
10 | * IO functions for an AONE Corp. CAT-68701 SH7708 Borad | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_SH_IO_CAT68701_H | ||
14 | #define _ASM_SH_IO_CAT68701_H | ||
15 | |||
16 | extern unsigned long cat68701_isa_port2addr(unsigned long offset); | ||
17 | extern int cat68701_irq_demux(int irq); | ||
18 | |||
19 | extern void init_cat68701_IRQ(void); | ||
20 | extern void heartbeat_cat68701(void); | ||
21 | |||
22 | #endif /* _ASM_SH_IO_CAT68701_H */ | ||
diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h index fa03b30c4269..08168afe6746 100644 --- a/include/asm-sh/checksum.h +++ b/include/asm-sh/checksum.h | |||
@@ -159,6 +159,7 @@ static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | #define _HAVE_ARCH_IPV6_CSUM | 161 | #define _HAVE_ARCH_IPV6_CSUM |
162 | #ifdef CONFIG_IPV6 | ||
162 | static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, | 163 | static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, |
163 | struct in6_addr *daddr, | 164 | struct in6_addr *daddr, |
164 | __u32 len, | 165 | __u32 len, |
@@ -194,6 +195,7 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, | |||
194 | 195 | ||
195 | return csum_fold(sum); | 196 | return csum_fold(sum); |
196 | } | 197 | } |
198 | #endif | ||
197 | 199 | ||
198 | /* | 200 | /* |
199 | * Copy and checksum to user | 201 | * Copy and checksum to user |
diff --git a/include/asm-sh/cpu-features.h b/include/asm-sh/cpu-features.h new file mode 100644 index 000000000000..4bccd7c032f9 --- /dev/null +++ b/include/asm-sh/cpu-features.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef __ASM_SH_CPU_FEATURES_H | ||
2 | #define __ASM_SH_CPU_FEATURES_H | ||
3 | |||
4 | /* | ||
5 | * Processor flags | ||
6 | * | ||
7 | * Note: When adding a new flag, keep cpu_flags[] in | ||
8 | * arch/sh/kernel/setup.c in sync so symbolic name | ||
9 | * mapping of the processor flags has a chance of being | ||
10 | * reasonably accurate. | ||
11 | * | ||
12 | * These flags are also available through the ELF | ||
13 | * auxiliary vector as AT_HWCAP. | ||
14 | */ | ||
15 | #define CPU_HAS_FPU 0x0001 /* Hardware FPU support */ | ||
16 | #define CPU_HAS_P2_FLUSH_BUG 0x0002 /* Need to flush the cache in P2 area */ | ||
17 | #define CPU_HAS_MMU_PAGE_ASSOC 0x0004 /* SH3: TLB way selection bit support */ | ||
18 | #define CPU_HAS_DSP 0x0008 /* SH-DSP: DSP support */ | ||
19 | #define CPU_HAS_PERF_COUNTER 0x0010 /* Hardware performance counters */ | ||
20 | #define CPU_HAS_PTEA 0x0020 /* PTEA register */ | ||
21 | #define CPU_HAS_LLSC 0x0040 /* movli.l/movco.l */ | ||
22 | #define CPU_HAS_L2_CACHE 0x0080 /* Secondary cache / URAM */ | ||
23 | |||
24 | #endif /* __ASM_SH_CPU_FEATURES_H */ | ||
diff --git a/include/asm-sh/cpu-sh2/shmparam.h b/include/asm-sh/cpu-sh2/shmparam.h deleted file mode 100644 index 817c1821ee4b..000000000000 --- a/include/asm-sh/cpu-sh2/shmparam.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/cpu-sh2/shmparam.h | ||
3 | * | ||
4 | * Copyright (C) 2003 Paul Mundt | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_CPU_SH2_SHMPARAM_H | ||
11 | #define __ASM_CPU_SH2_SHMPARAM_H | ||
12 | |||
13 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
14 | |||
15 | #endif /* __ASM_CPU_SH2_SHMPARAM_H */ | ||
16 | |||
diff --git a/include/asm-sh/cpu-sh3/cache.h b/include/asm-sh/cpu-sh3/cache.h index 406aa8d9b947..ffe08d2813f9 100644 --- a/include/asm-sh/cpu-sh3/cache.h +++ b/include/asm-sh/cpu-sh3/cache.h | |||
@@ -26,12 +26,10 @@ | |||
26 | #define CCR_CACHE_ENABLE CCR_CACHE_CE | 26 | #define CCR_CACHE_ENABLE CCR_CACHE_CE |
27 | #define CCR_CACHE_INVALIDATE CCR_CACHE_CF | 27 | #define CCR_CACHE_INVALIDATE CCR_CACHE_CF |
28 | 28 | ||
29 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) | 29 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || defined(CONFIG_CPU_SUBTYPE_SH7710) |
30 | #define CCR3 0xa40000b4 | 30 | #define CCR3 0xa40000b4 |
31 | #define CCR_CACHE_16KB 0x00010000 | 31 | #define CCR_CACHE_16KB 0x00010000 |
32 | #define CCR_CACHE_32KB 0x00020000 | 32 | #define CCR_CACHE_32KB 0x00020000 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | |||
36 | #endif /* __ASM_CPU_SH3_CACHE_H */ | 35 | #endif /* __ASM_CPU_SH3_CACHE_H */ |
37 | |||
diff --git a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h index f51aed00c68f..03fde97a7fd0 100644 --- a/include/asm-sh/cpu-sh3/cacheflush.h +++ b/include/asm-sh/cpu-sh3/cacheflush.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #ifndef __ASM_CPU_SH3_CACHEFLUSH_H | 10 | #ifndef __ASM_CPU_SH3_CACHEFLUSH_H |
11 | #define __ASM_CPU_SH3_CACHEFLUSH_H | 11 | #define __ASM_CPU_SH3_CACHEFLUSH_H |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * Cache flushing: | 14 | * Cache flushing: |
15 | * | 15 | * |
16 | * - flush_cache_all() flushes entire cache | 16 | * - flush_cache_all() flushes entire cache |
@@ -35,53 +35,33 @@ | |||
35 | /* 32KB cache, 4kb PAGE sizes need to check bit 12 */ | 35 | /* 32KB cache, 4kb PAGE sizes need to check bit 12 */ |
36 | #define CACHE_ALIAS 0x00001000 | 36 | #define CACHE_ALIAS 0x00001000 |
37 | 37 | ||
38 | struct page; | ||
39 | struct mm_struct; | ||
40 | struct vm_area_struct; | ||
41 | |||
42 | extern void flush_cache_all(void); | ||
43 | extern void flush_cache_mm(struct mm_struct *mm); | ||
44 | extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | ||
45 | unsigned long end); | ||
46 | extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); | ||
47 | extern void flush_dcache_page(struct page *pg); | ||
48 | extern void flush_icache_range(unsigned long start, unsigned long end); | ||
49 | extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); | ||
50 | |||
51 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
52 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
53 | |||
54 | /* SH3 has unified cache so no special action needed here */ | ||
55 | #define flush_cache_sigtramp(vaddr) do { } while (0) | ||
56 | #define flush_page_to_ram(page) do { } while (0) | ||
57 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | ||
58 | |||
59 | #define p3_cache_init() do { } while (0) | ||
60 | |||
61 | #define PG_mapped PG_arch_1 | 38 | #define PG_mapped PG_arch_1 |
62 | 39 | ||
63 | /* We provide our own get_unmapped_area to avoid cache alias issue */ | 40 | void flush_cache_all(void); |
64 | #define HAVE_ARCH_UNMAPPED_AREA | 41 | void flush_cache_mm(struct mm_struct *mm); |
65 | 42 | void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | |
43 | unsigned long end); | ||
44 | void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); | ||
45 | void flush_dcache_page(struct page *pg); | ||
46 | void flush_icache_range(unsigned long start, unsigned long end); | ||
47 | void flush_icache_page(struct vm_area_struct *vma, struct page *page); | ||
66 | #else | 48 | #else |
67 | |||
68 | #define flush_cache_all() do { } while (0) | 49 | #define flush_cache_all() do { } while (0) |
69 | #define flush_cache_mm(mm) do { } while (0) | 50 | #define flush_cache_mm(mm) do { } while (0) |
70 | #define flush_cache_range(vma, start, end) do { } while (0) | 51 | #define flush_cache_range(vma, start, end) do { } while (0) |
71 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | 52 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) |
72 | #define flush_dcache_page(page) do { } while (0) | 53 | #define flush_dcache_page(page) do { } while (0) |
73 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
74 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
75 | #define flush_icache_range(start, end) do { } while (0) | 54 | #define flush_icache_range(start, end) do { } while (0) |
76 | #define flush_icache_page(vma,pg) do { } while (0) | 55 | #define flush_icache_page(vma,pg) do { } while (0) |
77 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | 56 | #endif |
78 | #define flush_cache_sigtramp(vaddr) do { } while (0) | ||
79 | 57 | ||
80 | #define p3_cache_init() do { } while (0) | 58 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
59 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
81 | 60 | ||
82 | #define HAVE_ARCH_UNMAPPED_AREA | 61 | /* SH3 has unified cache so no special action needed here */ |
62 | #define flush_cache_sigtramp(vaddr) do { } while (0) | ||
63 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | ||
83 | 64 | ||
84 | #endif | 65 | #define p3_cache_init() do { } while (0) |
85 | 66 | ||
86 | #endif /* __ASM_CPU_SH3_CACHEFLUSH_H */ | 67 | #endif /* __ASM_CPU_SH3_CACHEFLUSH_H */ |
87 | |||
diff --git a/include/asm-sh/cpu-sh3/freq.h b/include/asm-sh/cpu-sh3/freq.h index b61b6e331df0..273f3229785c 100644 --- a/include/asm-sh/cpu-sh3/freq.h +++ b/include/asm-sh/cpu-sh3/freq.h | |||
@@ -18,5 +18,9 @@ | |||
18 | #define MIN_DIVISOR_NR 0 | 18 | #define MIN_DIVISOR_NR 0 |
19 | #define MAX_DIVISOR_NR 4 | 19 | #define MAX_DIVISOR_NR 4 |
20 | 20 | ||
21 | #define FRQCR_CKOEN 0x0100 | ||
22 | #define FRQCR_PLLEN 0x0080 | ||
23 | #define FRQCR_PSTBY 0x0040 | ||
24 | |||
21 | #endif /* __ASM_CPU_SH3_FREQ_H */ | 25 | #endif /* __ASM_CPU_SH3_FREQ_H */ |
22 | 26 | ||
diff --git a/include/asm-sh/cpu-sh3/mmu_context.h b/include/asm-sh/cpu-sh3/mmu_context.h index a844ea0965b6..bccb7ddb438b 100644 --- a/include/asm-sh/cpu-sh3/mmu_context.h +++ b/include/asm-sh/cpu-sh3/mmu_context.h | |||
@@ -27,8 +27,12 @@ | |||
27 | #define TRA 0xffffffd0 | 27 | #define TRA 0xffffffd0 |
28 | #define EXPEVT 0xffffffd4 | 28 | #define EXPEVT 0xffffffd4 |
29 | 29 | ||
30 | #if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \ | 30 | #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \ |
31 | defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705) | 31 | defined(CONFIG_CPU_SUBTYPE_SH7709) || \ |
32 | defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | ||
33 | defined(CONFIG_CPU_SUBTYPE_SH7300) || \ | ||
34 | defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | ||
35 | defined(CONFIG_CPU_SUBTYPE_SH7710) | ||
32 | #define INTEVT 0xa4000000 /* INTEVTE2(0xa4000000) */ | 36 | #define INTEVT 0xa4000000 /* INTEVTE2(0xa4000000) */ |
33 | #else | 37 | #else |
34 | #define INTEVT 0xffffffd8 | 38 | #define INTEVT 0xffffffd8 |
diff --git a/include/asm-sh/cpu-sh3/shmparam.h b/include/asm-sh/cpu-sh3/shmparam.h deleted file mode 100644 index da5b5eec81ee..000000000000 --- a/include/asm-sh/cpu-sh3/shmparam.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/cpu-sh3/shmparam.h | ||
3 | * | ||
4 | * Copyright (C) 1999 Niibe Yutaka | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_CPU_SH3_SHMPARAM_H | ||
11 | #define __ASM_CPU_SH3_SHMPARAM_H | ||
12 | |||
13 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
14 | |||
15 | #endif /* __ASM_CPU_SH3_SHMPARAM_H */ | ||
16 | |||
diff --git a/include/asm-sh/cpu-sh3/timer.h b/include/asm-sh/cpu-sh3/timer.h index 3d8e95e8d10c..b2394cf76f49 100644 --- a/include/asm-sh/cpu-sh3/timer.h +++ b/include/asm-sh/cpu-sh3/timer.h | |||
@@ -20,9 +20,14 @@ | |||
20 | * SH7710 | 20 | * SH7710 |
21 | * SH7720 | 21 | * SH7720 |
22 | * SH7300 | 22 | * SH7300 |
23 | * SH7710 | ||
23 | * --------------------------------------------------------------------------- | 24 | * --------------------------------------------------------------------------- |
24 | */ | 25 | */ |
25 | 26 | ||
27 | #if !defined(CONFIG_CPU_SUBTYPE_SH7727) | ||
28 | #define TMU_TOCR 0xfffffe90 /* Byte access */ | ||
29 | #endif | ||
30 | |||
26 | #if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710) | 31 | #if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710) |
27 | #define TMU_TSTR 0xa412fe92 /* Byte access */ | 32 | #define TMU_TSTR 0xa412fe92 /* Byte access */ |
28 | 33 | ||
@@ -39,9 +44,6 @@ | |||
39 | #define TMU2_TCR 0xa412feb4 /* Word access */ | 44 | #define TMU2_TCR 0xa412feb4 /* Word access */ |
40 | 45 | ||
41 | #else | 46 | #else |
42 | #if !defined(CONFIG_CPU_SUBTYPE_SH7727) | ||
43 | #define TMU_TOCR 0xfffffe90 /* Byte access */ | ||
44 | #endif | ||
45 | #define TMU_TSTR 0xfffffe92 /* Byte access */ | 47 | #define TMU_TSTR 0xfffffe92 /* Byte access */ |
46 | 48 | ||
47 | #define TMU0_TCOR 0xfffffe94 /* Long access */ | 49 | #define TMU0_TCOR 0xfffffe94 /* Long access */ |
diff --git a/include/asm-sh/cpu-sh3/ubc.h b/include/asm-sh/cpu-sh3/ubc.h index 0f809dec4e17..9d308cbe9b29 100644 --- a/include/asm-sh/cpu-sh3/ubc.h +++ b/include/asm-sh/cpu-sh3/ubc.h | |||
@@ -11,6 +11,19 @@ | |||
11 | #ifndef __ASM_CPU_SH3_UBC_H | 11 | #ifndef __ASM_CPU_SH3_UBC_H |
12 | #define __ASM_CPU_SH3_UBC_H | 12 | #define __ASM_CPU_SH3_UBC_H |
13 | 13 | ||
14 | #if defined(CONFIG_CPU_SUBTYPE_SH7710) | ||
15 | #define UBC_BARA 0xa4ffffb0 | ||
16 | #define UBC_BAMRA 0xa4ffffb4 | ||
17 | #define UBC_BBRA 0xa4ffffb8 | ||
18 | #define UBC_BASRA 0xffffffe4 | ||
19 | #define UBC_BARB 0xa4ffffa0 | ||
20 | #define UBC_BAMRB 0xa4ffffa4 | ||
21 | #define UBC_BBRB 0xa4ffffa8 | ||
22 | #define UBC_BASRB 0xffffffe8 | ||
23 | #define UBC_BDRB 0xa4ffff90 | ||
24 | #define UBC_BDMRB 0xa4ffff94 | ||
25 | #define UBC_BRCR 0xa4ffff98 | ||
26 | #else | ||
14 | #define UBC_BARA 0xffffffb0 | 27 | #define UBC_BARA 0xffffffb0 |
15 | #define UBC_BAMRA 0xffffffb4 | 28 | #define UBC_BAMRA 0xffffffb4 |
16 | #define UBC_BBRA 0xffffffb8 | 29 | #define UBC_BBRA 0xffffffb8 |
@@ -22,6 +35,6 @@ | |||
22 | #define UBC_BDRB 0xffffff90 | 35 | #define UBC_BDRB 0xffffff90 |
23 | #define UBC_BDMRB 0xffffff94 | 36 | #define UBC_BDMRB 0xffffff94 |
24 | #define UBC_BRCR 0xffffff98 | 37 | #define UBC_BRCR 0xffffff98 |
38 | #endif | ||
25 | 39 | ||
26 | #endif /* __ASM_CPU_SH3_UBC_H */ | 40 | #endif /* __ASM_CPU_SH3_UBC_H */ |
27 | |||
diff --git a/include/asm-sh/cpu-sh4/addrspace.h b/include/asm-sh/cpu-sh4/addrspace.h index 727634d886ce..bb2e1b03060c 100644 --- a/include/asm-sh/cpu-sh4/addrspace.h +++ b/include/asm-sh/cpu-sh4/addrspace.h | |||
@@ -22,5 +22,8 @@ | |||
22 | #define P4SEG_TLB_DATA 0xf7000000 | 22 | #define P4SEG_TLB_DATA 0xf7000000 |
23 | #define P4SEG_REG_BASE 0xff000000 | 23 | #define P4SEG_REG_BASE 0xff000000 |
24 | 24 | ||
25 | #define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */ | ||
26 | #define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */ | ||
27 | |||
25 | #endif /* __ASM_CPU_SH4_ADDRSPACE_H */ | 28 | #endif /* __ASM_CPU_SH4_ADDRSPACE_H */ |
26 | 29 | ||
diff --git a/include/asm-sh/cpu-sh4/cache.h b/include/asm-sh/cpu-sh4/cache.h index 1fe20359312c..6e9c7e6ee8e4 100644 --- a/include/asm-sh/cpu-sh4/cache.h +++ b/include/asm-sh/cpu-sh4/cache.h | |||
@@ -22,7 +22,9 @@ | |||
22 | #define CCR_CACHE_ICE 0x0100 /* Instruction Cache Enable */ | 22 | #define CCR_CACHE_ICE 0x0100 /* Instruction Cache Enable */ |
23 | #define CCR_CACHE_ICI 0x0800 /* IC Invalidate */ | 23 | #define CCR_CACHE_ICI 0x0800 /* IC Invalidate */ |
24 | #define CCR_CACHE_IIX 0x8000 /* IC Index Enable */ | 24 | #define CCR_CACHE_IIX 0x8000 /* IC Index Enable */ |
25 | #ifndef CONFIG_CPU_SUBTYPE_SH7780 | ||
25 | #define CCR_CACHE_EMODE 0x80000000 /* EMODE Enable */ | 26 | #define CCR_CACHE_EMODE 0x80000000 /* EMODE Enable */ |
27 | #endif | ||
26 | 28 | ||
27 | /* Default CCR setup: 8k+16k-byte cache,P1-wb,enable */ | 29 | /* Default CCR setup: 8k+16k-byte cache,P1-wb,enable */ |
28 | #define CCR_CACHE_ENABLE (CCR_CACHE_OCE|CCR_CACHE_ICE) | 30 | #define CCR_CACHE_ENABLE (CCR_CACHE_OCE|CCR_CACHE_ICE) |
diff --git a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h index f323567e085f..515fd574267c 100644 --- a/include/asm-sh/cpu-sh4/cacheflush.h +++ b/include/asm-sh/cpu-sh4/cacheflush.h | |||
@@ -16,40 +16,29 @@ | |||
16 | * caching; in which case they're only semi-broken), | 16 | * caching; in which case they're only semi-broken), |
17 | * so we need them. | 17 | * so we need them. |
18 | */ | 18 | */ |
19 | 19 | void flush_cache_all(void); | |
20 | /* Page is 4K, OC size is 16K, there are four lines. */ | 20 | void flush_cache_mm(struct mm_struct *mm); |
21 | #define CACHE_ALIAS 0x00003000 | 21 | void flush_cache_range(struct vm_area_struct *vma, unsigned long start, |
22 | 22 | unsigned long end); | |
23 | struct page; | 23 | void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, |
24 | struct mm_struct; | 24 | unsigned long pfn); |
25 | struct vm_area_struct; | 25 | void flush_dcache_page(struct page *pg); |
26 | |||
27 | extern void flush_cache_all(void); | ||
28 | extern void flush_cache_mm(struct mm_struct *mm); | ||
29 | extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | ||
30 | unsigned long end); | ||
31 | extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); | ||
32 | extern void flush_dcache_page(struct page *pg); | ||
33 | 26 | ||
34 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 27 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
35 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 28 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
36 | 29 | ||
37 | extern void flush_icache_range(unsigned long start, unsigned long end); | 30 | void flush_icache_range(unsigned long start, unsigned long end); |
38 | extern void flush_cache_sigtramp(unsigned long addr); | 31 | void flush_cache_sigtramp(unsigned long addr); |
39 | extern void flush_icache_user_range(struct vm_area_struct *vma, | 32 | void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, |
40 | struct page *page, unsigned long addr, | 33 | unsigned long addr, int len); |
41 | int len); | ||
42 | 34 | ||
43 | #define flush_icache_page(vma,pg) do { } while (0) | 35 | #define flush_icache_page(vma,pg) do { } while (0) |
44 | 36 | ||
45 | /* Initialization of P3 area for copy_user_page */ | 37 | /* Initialization of P3 area for copy_user_page */ |
46 | extern void p3_cache_init(void); | 38 | void p3_cache_init(void); |
47 | 39 | ||
48 | #define PG_mapped PG_arch_1 | 40 | #define PG_mapped PG_arch_1 |
49 | 41 | ||
50 | /* We provide our own get_unmapped_area to avoid cache alias issue */ | ||
51 | #define HAVE_ARCH_UNMAPPED_AREA | ||
52 | |||
53 | #ifdef CONFIG_MMU | 42 | #ifdef CONFIG_MMU |
54 | extern int remap_area_pages(unsigned long addr, unsigned long phys_addr, | 43 | extern int remap_area_pages(unsigned long addr, unsigned long phys_addr, |
55 | unsigned long size, unsigned long flags); | 44 | unsigned long size, unsigned long flags); |
@@ -61,4 +50,3 @@ static inline int remap_area_pages(unsigned long addr, unsigned long phys_addr, | |||
61 | } | 50 | } |
62 | #endif /* CONFIG_MMU */ | 51 | #endif /* CONFIG_MMU */ |
63 | #endif /* __ASM_CPU_SH4_CACHEFLUSH_H */ | 52 | #endif /* __ASM_CPU_SH4_CACHEFLUSH_H */ |
64 | |||
diff --git a/include/asm-sh/cpu-sh4/dma-sh7780.h b/include/asm-sh/cpu-sh4/dma-sh7780.h new file mode 100644 index 000000000000..6c90d28331b2 --- /dev/null +++ b/include/asm-sh/cpu-sh4/dma-sh7780.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef __ASM_SH_CPU_SH4_DMA_SH7780_H | ||
2 | #define __ASM_SH_CPU_SH4_DMA_SH7780_H | ||
3 | |||
4 | #define REQ_HE 0x000000C0 | ||
5 | #define REQ_H 0x00000080 | ||
6 | #define REQ_LE 0x00000040 | ||
7 | #define TM_BURST 0x0000020 | ||
8 | #define TS_8 0x00000000 | ||
9 | #define TS_16 0x00000008 | ||
10 | #define TS_32 0x00000010 | ||
11 | #define TS_16BLK 0x00000018 | ||
12 | #define TS_32BLK 0x00100000 | ||
13 | |||
14 | /* | ||
15 | * The SuperH DMAC supports a number of transmit sizes, we list them here, | ||
16 | * with their respective values as they appear in the CHCR registers. | ||
17 | * | ||
18 | * Defaults to a 64-bit transfer size. | ||
19 | */ | ||
20 | enum { | ||
21 | XMIT_SZ_8BIT, | ||
22 | XMIT_SZ_16BIT, | ||
23 | XMIT_SZ_32BIT, | ||
24 | XMIT_SZ_128BIT, | ||
25 | XMIT_SZ_256BIT, | ||
26 | }; | ||
27 | |||
28 | /* | ||
29 | * The DMA count is defined as the number of bytes to transfer. | ||
30 | */ | ||
31 | static unsigned int __attribute__ ((used)) ts_shift[] = { | ||
32 | [XMIT_SZ_8BIT] = 0, | ||
33 | [XMIT_SZ_16BIT] = 1, | ||
34 | [XMIT_SZ_32BIT] = 2, | ||
35 | [XMIT_SZ_128BIT] = 4, | ||
36 | [XMIT_SZ_256BIT] = 5, | ||
37 | }; | ||
38 | |||
39 | #endif /* __ASM_SH_CPU_SH4_DMA_SH7780_H */ | ||
diff --git a/include/asm-sh/cpu-sh4/dma.h b/include/asm-sh/cpu-sh4/dma.h index 0dfe61f14802..3e4b3e6d80c0 100644 --- a/include/asm-sh/cpu-sh4/dma.h +++ b/include/asm-sh/cpu-sh4/dma.h | |||
@@ -1,11 +1,17 @@ | |||
1 | #ifndef __ASM_CPU_SH4_DMA_H | 1 | #ifndef __ASM_CPU_SH4_DMA_H |
2 | #define __ASM_CPU_SH4_DMA_H | 2 | #define __ASM_CPU_SH4_DMA_H |
3 | 3 | ||
4 | #define DMAOR_INIT ( 0x8000 | DMAOR_DME ) | ||
5 | |||
4 | #ifdef CONFIG_CPU_SH4A | 6 | #ifdef CONFIG_CPU_SH4A |
5 | #define SH_DMAC_BASE 0xfc808020 | 7 | #define SH_DMAC_BASE 0xfc808020 |
8 | |||
9 | #define CHCR_TS_MASK 0x18 | ||
10 | #define CHCR_TS_SHIFT 3 | ||
11 | |||
12 | #include <asm/cpu/dma-sh7780.h> | ||
6 | #else | 13 | #else |
7 | #define SH_DMAC_BASE 0xffa00000 | 14 | #define SH_DMAC_BASE 0xffa00000 |
8 | #endif | ||
9 | 15 | ||
10 | /* Definitions for the SuperH DMAC */ | 16 | /* Definitions for the SuperH DMAC */ |
11 | #define TM_BURST 0x0000080 | 17 | #define TM_BURST 0x0000080 |
@@ -19,8 +25,6 @@ | |||
19 | 25 | ||
20 | #define DMAOR_COD 0x00000008 | 26 | #define DMAOR_COD 0x00000008 |
21 | 27 | ||
22 | #define DMAOR_INIT ( 0x8000 | DMAOR_DME ) | ||
23 | |||
24 | /* | 28 | /* |
25 | * The SuperH DMAC supports a number of transmit sizes, we list them here, | 29 | * The SuperH DMAC supports a number of transmit sizes, we list them here, |
26 | * with their respective values as they appear in the CHCR registers. | 30 | * with their respective values as they appear in the CHCR registers. |
@@ -45,5 +49,6 @@ static unsigned int ts_shift[] __attribute__ ((used)) = { | |||
45 | [XMIT_SZ_32BIT] = 2, | 49 | [XMIT_SZ_32BIT] = 2, |
46 | [XMIT_SZ_256BIT] = 5, | 50 | [XMIT_SZ_256BIT] = 5, |
47 | }; | 51 | }; |
52 | #endif | ||
48 | 53 | ||
49 | #endif /* __ASM_CPU_SH4_DMA_H */ | 54 | #endif /* __ASM_CPU_SH4_DMA_H */ |
diff --git a/include/asm-sh/cpu-sh4/shmparam.h b/include/asm-sh/cpu-sh4/shmparam.h deleted file mode 100644 index a5a0aa9425fe..000000000000 --- a/include/asm-sh/cpu-sh4/shmparam.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/cpu-sh4/shmparam.h | ||
3 | * | ||
4 | * Copyright (C) 1999 Niibe Yutaka | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_CPU_SH4_SHMPARAM_H | ||
11 | #define __ASM_CPU_SH4_SHMPARAM_H | ||
12 | |||
13 | /* | ||
14 | * SH-4 has D-cache alias issue | ||
15 | */ | ||
16 | #define SHMLBA (PAGE_SIZE*4) /* attach addr a multiple of this */ | ||
17 | |||
18 | #endif /* __ASM_CPU_SH4_SHMPARAM_H */ | ||
19 | |||
diff --git a/include/asm-sh/cpu-sh4/sq.h b/include/asm-sh/cpu-sh4/sq.h index 366b09166d3b..586d6491816a 100644 --- a/include/asm-sh/cpu-sh4/sq.h +++ b/include/asm-sh/cpu-sh4/sq.h | |||
@@ -17,7 +17,7 @@ | |||
17 | * Store queues range from e0000000-e3fffffc, allowing approx. 64MB to be | 17 | * Store queues range from e0000000-e3fffffc, allowing approx. 64MB to be |
18 | * mapped to any physical address space. Since data is written (and aligned) | 18 | * mapped to any physical address space. Since data is written (and aligned) |
19 | * to 32-byte boundaries, we need to be sure that all allocations are aligned. | 19 | * to 32-byte boundaries, we need to be sure that all allocations are aligned. |
20 | */ | 20 | */ |
21 | #define SQ_SIZE 32 | 21 | #define SQ_SIZE 32 |
22 | #define SQ_ALIGN_MASK (~(SQ_SIZE - 1)) | 22 | #define SQ_ALIGN_MASK (~(SQ_SIZE - 1)) |
23 | #define SQ_ALIGN(addr) (((addr)+SQ_SIZE-1) & SQ_ALIGN_MASK) | 23 | #define SQ_ALIGN(addr) (((addr)+SQ_SIZE-1) & SQ_ALIGN_MASK) |
@@ -26,23 +26,10 @@ | |||
26 | #define SQ_QACR1 (P4SEG_REG_BASE + 0x3c) | 26 | #define SQ_QACR1 (P4SEG_REG_BASE + 0x3c) |
27 | #define SQ_ADDRMAX (P4SEG_STORE_QUE + 0x04000000) | 27 | #define SQ_ADDRMAX (P4SEG_STORE_QUE + 0x04000000) |
28 | 28 | ||
29 | struct sq_mapping { | ||
30 | const char *name; | ||
31 | |||
32 | unsigned long sq_addr; | ||
33 | unsigned long addr; | ||
34 | unsigned int size; | ||
35 | |||
36 | struct list_head list; | ||
37 | }; | ||
38 | |||
39 | /* arch/sh/kernel/cpu/sh4/sq.c */ | 29 | /* arch/sh/kernel/cpu/sh4/sq.c */ |
40 | extern struct sq_mapping *sq_remap(unsigned long phys, unsigned int size, const char *name); | 30 | unsigned long sq_remap(unsigned long phys, unsigned int size, |
41 | extern void sq_unmap(struct sq_mapping *map); | 31 | const char *name, unsigned long flags); |
42 | 32 | void sq_unmap(unsigned long vaddr); | |
43 | extern void sq_clear(unsigned long addr, unsigned int len); | 33 | void sq_flush_range(unsigned long start, unsigned int len); |
44 | extern void sq_flush(void *addr); | ||
45 | extern void sq_flush_range(unsigned long start, unsigned int len); | ||
46 | 34 | ||
47 | #endif /* __ASM_CPU_SH4_SQ_H */ | 35 | #endif /* __ASM_CPU_SH4_SQ_H */ |
48 | |||
diff --git a/include/asm-sh/cqreek/cqreek.h b/include/asm-sh/cqreek/cqreek.h deleted file mode 100644 index 09aecc06693e..000000000000 --- a/include/asm-sh/cqreek/cqreek.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | #ifndef __ASM_SH_CQREEK_CQREEK_H | ||
2 | #define __ASM_SH_CQREEK_CQREEK_H | ||
3 | |||
4 | #define BRIDGE_FEATURE 0x0002 | ||
5 | |||
6 | #define BRIDGE_IDE_CTRL 0x0018 | ||
7 | #define BRIDGE_IDE_INTR_LVL 0x001A | ||
8 | #define BRIDGE_IDE_INTR_MASK 0x001C | ||
9 | #define BRIDGE_IDE_INTR_STAT 0x001E | ||
10 | |||
11 | #define BRIDGE_ISA_CTRL 0x0028 | ||
12 | #define BRIDGE_ISA_INTR_LVL 0x002A | ||
13 | #define BRIDGE_ISA_INTR_MASK 0x002C | ||
14 | #define BRIDGE_ISA_INTR_STAT 0x002E | ||
15 | |||
16 | /* arch/sh/boards/cqreek/setup.c */ | ||
17 | extern void setup_cqreek(void); | ||
18 | |||
19 | /* arch/sh/boards/cqreek/irq.c */ | ||
20 | extern int cqreek_has_ide, cqreek_has_isa; | ||
21 | extern void init_cqreek_IRQ(void); | ||
22 | |||
23 | /* arch/sh/boards/cqreek/io.c */ | ||
24 | extern unsigned long cqreek_port2addr(unsigned long port); | ||
25 | |||
26 | #endif /* __ASM_SH_CQREEK_CQREEK_H */ | ||
27 | |||
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h index 124968f9866e..56cd4b977232 100644 --- a/include/asm-sh/dma-mapping.h +++ b/include/asm-sh/dma-mapping.h | |||
@@ -141,25 +141,35 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | static void dma_sync_single_for_cpu(struct device *dev, | 144 | static inline void dma_sync_single_for_cpu(struct device *dev, |
145 | dma_addr_t dma_handle, size_t size, | 145 | dma_addr_t dma_handle, size_t size, |
146 | enum dma_data_direction dir) | 146 | enum dma_data_direction dir) |
147 | __attribute__ ((alias("dma_sync_single"))); | 147 | { |
148 | dma_sync_single(dev, dma_handle, size, dir); | ||
149 | } | ||
150 | |||
151 | static inline void dma_sync_single_for_device(struct device *dev, | ||
152 | dma_addr_t dma_handle, | ||
153 | size_t size, | ||
154 | enum dma_data_direction dir) | ||
155 | { | ||
156 | dma_sync_single(dev, dma_handle, size, dir); | ||
157 | } | ||
148 | 158 | ||
149 | static void dma_sync_single_for_device(struct device *dev, | 159 | static inline void dma_sync_sg_for_cpu(struct device *dev, |
150 | dma_addr_t dma_handle, size_t size, | 160 | struct scatterlist *sg, int nelems, |
151 | enum dma_data_direction dir) | 161 | enum dma_data_direction dir) |
152 | __attribute__ ((alias("dma_sync_single"))); | 162 | { |
163 | dma_sync_sg(dev, sg, nelems, dir); | ||
164 | } | ||
153 | 165 | ||
154 | static void dma_sync_sg_for_cpu(struct device *dev, | 166 | static inline void dma_sync_sg_for_device(struct device *dev, |
155 | struct scatterlist *sg, int nelems, | 167 | struct scatterlist *sg, int nelems, |
156 | enum dma_data_direction dir) | 168 | enum dma_data_direction dir) |
157 | __attribute__ ((alias("dma_sync_sg"))); | 169 | { |
170 | dma_sync_sg(dev, sg, nelems, dir); | ||
171 | } | ||
158 | 172 | ||
159 | static void dma_sync_sg_for_device(struct device *dev, | ||
160 | struct scatterlist *sg, int nelems, | ||
161 | enum dma_data_direction dir) | ||
162 | __attribute__ ((alias("dma_sync_sg"))); | ||
163 | 173 | ||
164 | static inline int dma_get_cache_alignment(void) | 174 | static inline int dma_get_cache_alignment(void) |
165 | { | 175 | { |
@@ -174,6 +184,4 @@ static inline int dma_mapping_error(dma_addr_t dma_addr) | |||
174 | { | 184 | { |
175 | return dma_addr == 0; | 185 | return dma_addr == 0; |
176 | } | 186 | } |
177 | |||
178 | #endif /* __ASM_SH_DMA_MAPPING_H */ | 187 | #endif /* __ASM_SH_DMA_MAPPING_H */ |
179 | |||
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h index e62a6d0ed932..d9daa028689f 100644 --- a/include/asm-sh/dma.h +++ b/include/asm-sh/dma.h | |||
@@ -89,6 +89,7 @@ struct dma_channel { | |||
89 | wait_queue_head_t wait_queue; | 89 | wait_queue_head_t wait_queue; |
90 | 90 | ||
91 | struct sys_device dev; | 91 | struct sys_device dev; |
92 | char *name; | ||
92 | }; | 93 | }; |
93 | 94 | ||
94 | struct dma_info { | 95 | struct dma_info { |
diff --git a/include/asm-sh/dmida/io.h b/include/asm-sh/dmida/io.h deleted file mode 100644 index 21bd416c01c3..000000000000 --- a/include/asm-sh/dmida/io.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #ifndef __ASM_SH_DMIDA_IO_H | ||
2 | #define __ASM_SH_DMIDA_IO_H | ||
3 | |||
4 | /* | ||
5 | * Nothing special here.. just use the generic cchip io routines. | ||
6 | */ | ||
7 | #include <asm/hd64465/io.h> | ||
8 | |||
9 | #endif /* __ASM_SH_DMIDA_IO_H */ | ||
10 | |||
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h index 1b63dfeea4f2..3a07ab40ac4d 100644 --- a/include/asm-sh/elf.h +++ b/include/asm-sh/elf.h | |||
@@ -1,6 +1,11 @@ | |||
1 | #ifndef __ASM_SH_ELF_H | 1 | #ifndef __ASM_SH_ELF_H |
2 | #define __ASM_SH_ELF_H | 2 | #define __ASM_SH_ELF_H |
3 | 3 | ||
4 | #include <asm/processor.h> | ||
5 | #include <asm/auxvec.h> | ||
6 | #include <asm/ptrace.h> | ||
7 | #include <asm/user.h> | ||
8 | |||
4 | /* SH relocation types */ | 9 | /* SH relocation types */ |
5 | #define R_SH_NONE 0 | 10 | #define R_SH_NONE 0 |
6 | #define R_SH_DIR32 1 | 11 | #define R_SH_DIR32 1 |
@@ -46,9 +51,6 @@ | |||
46 | * ELF register definitions.. | 51 | * ELF register definitions.. |
47 | */ | 52 | */ |
48 | 53 | ||
49 | #include <asm/ptrace.h> | ||
50 | #include <asm/user.h> | ||
51 | |||
52 | typedef unsigned long elf_greg_t; | 54 | typedef unsigned long elf_greg_t; |
53 | 55 | ||
54 | #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) | 56 | #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) |
@@ -91,7 +93,7 @@ typedef struct user_fpu_struct elf_fpregset_t; | |||
91 | instruction set this CPU supports. This could be done in user space, | 93 | instruction set this CPU supports. This could be done in user space, |
92 | but it's not easy, and we've already done it here. */ | 94 | but it's not easy, and we've already done it here. */ |
93 | 95 | ||
94 | #define ELF_HWCAP (0) | 96 | #define ELF_HWCAP (boot_cpu_data.flags) |
95 | 97 | ||
96 | /* This yields a string that ld.so will use to load implementation | 98 | /* This yields a string that ld.so will use to load implementation |
97 | specific libraries for optimization. This is more specific in | 99 | specific libraries for optimization. This is more specific in |
@@ -119,4 +121,24 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); | |||
119 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) | 121 | #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) |
120 | #endif | 122 | #endif |
121 | 123 | ||
124 | #ifdef CONFIG_VSYSCALL | ||
125 | /* vDSO has arch_setup_additional_pages */ | ||
126 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES | ||
127 | struct linux_binprm; | ||
128 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, | ||
129 | int executable_stack); | ||
130 | |||
131 | extern unsigned int vdso_enabled; | ||
132 | extern void __kernel_vsyscall; | ||
133 | |||
134 | #define VDSO_BASE ((unsigned long)current->mm->context.vdso) | ||
135 | #define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x)) | ||
136 | |||
137 | #define ARCH_DLINFO \ | ||
138 | do { \ | ||
139 | if (vdso_enabled) \ | ||
140 | NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \ | ||
141 | } while (0) | ||
142 | #endif /* CONFIG_VSYSCALL */ | ||
143 | |||
122 | #endif /* __ASM_SH_ELF_H */ | 144 | #endif /* __ASM_SH_ELF_H */ |
diff --git a/include/asm-sh/fixmap.h b/include/asm-sh/fixmap.h index 412bccaa07e6..458e9fa59545 100644 --- a/include/asm-sh/fixmap.h +++ b/include/asm-sh/fixmap.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * addresses. The point is to have a constant address at | 25 | * addresses. The point is to have a constant address at |
26 | * compile time, but to set the physical address only | 26 | * compile time, but to set the physical address only |
27 | * in the boot process. We allocate these special addresses | 27 | * in the boot process. We allocate these special addresses |
28 | * from the end of virtual memory (0xfffff000) backwards. | 28 | * from the end of P3 backwards. |
29 | * Also this lets us do fail-safe vmalloc(), we | 29 | * Also this lets us do fail-safe vmalloc(), we |
30 | * can guarantee that these special addresses and | 30 | * can guarantee that these special addresses and |
31 | * vmalloc()-ed addresses never overlap. | 31 | * vmalloc()-ed addresses never overlap. |
diff --git a/include/asm-sh/flat.h b/include/asm-sh/flat.h index f29072e1c87e..0d5cc04ab005 100644 --- a/include/asm-sh/flat.h +++ b/include/asm-sh/flat.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #define __ASM_SH_FLAT_H | 13 | #define __ASM_SH_FLAT_H |
14 | 14 | ||
15 | #define flat_stack_align(sp) /* nothing needed */ | 15 | #define flat_stack_align(sp) /* nothing needed */ |
16 | #define flat_argvp_envp_on_stack() 1 | 16 | #define flat_argvp_envp_on_stack() 0 |
17 | #define flat_old_ram_flag(flags) (flags) | 17 | #define flat_old_ram_flag(flags) (flags) |
18 | #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) | 18 | #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) |
19 | #define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp) | 19 | #define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp) |
diff --git a/include/asm-sh/harp/harp.h b/include/asm-sh/harp/harp.h deleted file mode 100644 index b2fbcfae9940..000000000000 --- a/include/asm-sh/harp/harp.h +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 David J. Mckay (david.mckay@st.com) | ||
3 | * | ||
4 | * May be copied or modified under the terms of the GNU General Public | ||
5 | * License. See linux/COPYING for more information. | ||
6 | * | ||
7 | * Defintions applicable to the STMicroelectronics ST40STB1 HARP and | ||
8 | * compatible boards. | ||
9 | */ | ||
10 | |||
11 | #if defined(CONFIG_SH_STB1_HARP) | ||
12 | |||
13 | #define EPLD_BASE 0xa0800000 | ||
14 | |||
15 | #define EPLD_LED (EPLD_BASE+0x000c0000) | ||
16 | #define EPLD_INTSTAT0 (EPLD_BASE+0x00200000) | ||
17 | #define EPLD_INTSTAT1 (EPLD_BASE+0x00240000) | ||
18 | #define EPLD_INTMASK0 (EPLD_BASE+0x00280000) | ||
19 | #define EPLD_INTMASK1 (EPLD_BASE+0x002c0000) | ||
20 | #define EPLD_PAGEADDR (EPLD_BASE+0x00300000) | ||
21 | #define EPLD_REVID1 (EPLD_BASE+0x00380000) | ||
22 | #define EPLD_REVID2 (EPLD_BASE+0x003c0000) | ||
23 | |||
24 | #define EPLD_LED_ON 1 | ||
25 | #define EPLD_LED_OFF 0 | ||
26 | |||
27 | #elif defined(CONFIG_SH_STB1_OVERDRIVE) | ||
28 | |||
29 | #define EPLD_BASE 0xa7000000 | ||
30 | |||
31 | #define EPLD_REVID (EPLD_BASE+0x00000000) | ||
32 | #define EPLD_LED (EPLD_BASE+0x00040000) | ||
33 | #define EPLD_INTMASK0 (EPLD_BASE+0x001c0000) | ||
34 | #define EPLD_INTMASK1 (EPLD_BASE+0x00200000) | ||
35 | #define EPLD_INTSTAT0 (EPLD_BASE+0x00240000) | ||
36 | #define EPLD_INTSTAT1 (EPLD_BASE+0x00280000) | ||
37 | |||
38 | #define EPLD_LED_ON 0 | ||
39 | #define EPLD_LED_OFF 1 | ||
40 | |||
41 | #else | ||
42 | #error Unknown board | ||
43 | #endif | ||
diff --git a/include/asm-sh/harp/io.h b/include/asm-sh/harp/io.h deleted file mode 100644 index 68f39e0b39de..000000000000 --- a/include/asm-sh/harp/io.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #ifndef __ASM_SH_HARP_IO_H | ||
2 | #define __ASM_SH_HARP_IO_H | ||
3 | |||
4 | /* | ||
5 | * Nothing special here.. just use the generic cchip io routines. | ||
6 | */ | ||
7 | #include <asm/hd64465/io.h> | ||
8 | |||
9 | #endif /* __ASM_SH_HARP_IO_H */ | ||
10 | |||
diff --git a/include/asm-sh/hd64461/hd64461.h b/include/asm-sh/hd64461.h index 87f13d24c630..27e5c34e2659 100644 --- a/include/asm-sh/hd64461/hd64461.h +++ b/include/asm-sh/hd64461.h | |||
@@ -40,7 +40,12 @@ | |||
40 | #define HD64461_LCDCBAR 0x11000 | 40 | #define HD64461_LCDCBAR 0x11000 |
41 | #define HD64461_LCDCLOR 0x11002 | 41 | #define HD64461_LCDCLOR 0x11002 |
42 | #define HD64461_LCDCCR 0x11004 | 42 | #define HD64461_LCDCCR 0x11004 |
43 | #define HD64461_LCDCCR_MOFF 0x80 | 43 | #define HD64461_LCDCCR_STBACK 0x0400 |
44 | #define HD64461_LCDCCR_STREQ 0x0100 | ||
45 | #define HD64461_LCDCCR_MOFF 0x0080 | ||
46 | #define HD64461_LCDCCR_REFSEL 0x0040 | ||
47 | #define HD64461_LCDCCR_EPON 0x0020 | ||
48 | #define HD64461_LCDCCR_SPON 0x0010 | ||
44 | 49 | ||
45 | #define HD64461_LDR1 0x11010 | 50 | #define HD64461_LDR1 0x11010 |
46 | #define HD64461_LDR1_DON 0x01 | 51 | #define HD64461_LDR1_DON 0x01 |
@@ -54,9 +59,9 @@ | |||
54 | #define HD64461_LDVSPR 0x1101c | 59 | #define HD64461_LDVSPR 0x1101c |
55 | #define HD64461_LDR3 0x1101e | 60 | #define HD64461_LDR3 0x1101e |
56 | 61 | ||
57 | #define HD64461_CPTWAR 0x11030 | 62 | #define HD64461_CPTWAR 0x11030 |
58 | #define HD64461_CPTWDR 0x11032 | 63 | #define HD64461_CPTWDR 0x11032 |
59 | #define HD64461_CPTRAR 0x11034 | 64 | #define HD64461_CPTRAR 0x11034 |
60 | #define HD64461_CPTRDR 0x11036 | 65 | #define HD64461_CPTRDR 0x11036 |
61 | 66 | ||
62 | #define HD64461_GRDOR 0x11040 | 67 | #define HD64461_GRDOR 0x11040 |
@@ -111,7 +116,7 @@ | |||
111 | #define HD64461_PCCISR_BVD1 0x01 /* battery 1 */ | 116 | #define HD64461_PCCISR_BVD1 0x01 /* battery 1 */ |
112 | 117 | ||
113 | #define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */ | 118 | #define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */ |
114 | #define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */ | 119 | #define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */ |
115 | #define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */ | 120 | #define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */ |
116 | #define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */ | 121 | #define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */ |
117 | #define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */ | 122 | #define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */ |
@@ -139,11 +144,11 @@ | |||
139 | 144 | ||
140 | /* PCC Card Status Change Interrupt Enable Register */ | 145 | /* PCC Card Status Change Interrupt Enable Register */ |
141 | #define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */ | 146 | #define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */ |
142 | #define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */ | 147 | #define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */ |
143 | #define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */ | 148 | #define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */ |
144 | #define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */ | 149 | #define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */ |
145 | #define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */ | 150 | #define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */ |
146 | #define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */ | 151 | #define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */ |
147 | 152 | ||
148 | #define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */ | 153 | #define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */ |
149 | #define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */ | 154 | #define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */ |
@@ -155,7 +160,6 @@ | |||
155 | #define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */ | 160 | #define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */ |
156 | #define HD64461_PCCSCR_SWP 0x01 /* write protect */ | 161 | #define HD64461_PCCSCR_SWP 0x01 /* write protect */ |
157 | 162 | ||
158 | |||
159 | #define HD64461_P0OCR 0x1202a | 163 | #define HD64461_P0OCR 0x1202a |
160 | #define HD64461_P1OCR 0x1202c | 164 | #define HD64461_P1OCR 0x1202c |
161 | #define HD64461_PGCR 0x1202e | 165 | #define HD64461_PGCR 0x1202e |
@@ -180,23 +184,25 @@ | |||
180 | #define HD64461_NIRR 0x15000 | 184 | #define HD64461_NIRR 0x15000 |
181 | #define HD64461_NIMR 0x15002 | 185 | #define HD64461_NIMR 0x15002 |
182 | 186 | ||
183 | #ifndef CONFIG_HD64461_IOBASE | ||
184 | #define CONFIG_HD64461_IOBASE 0xb0000000 | ||
185 | #endif | ||
186 | #ifndef CONFIG_HD64461_IRQ | ||
187 | #define CONFIG_HD64461_IRQ 36 | ||
188 | #endif | ||
189 | |||
190 | #define HD64461_IRQBASE OFFCHIP_IRQ_BASE | 187 | #define HD64461_IRQBASE OFFCHIP_IRQ_BASE |
191 | #define HD64461_IRQ_NUM 16 | 188 | #define HD64461_IRQ_NUM 16 |
192 | 189 | ||
193 | #define HD64461_IRQ_UART (HD64461_IRQBASE+5) | 190 | #define HD64461_IRQ_UART (HD64461_IRQBASE+5) |
194 | #define HD64461_IRQ_IRDA (HD64461_IRQBASE+6) | 191 | #define HD64461_IRQ_IRDA (HD64461_IRQBASE+6) |
195 | #define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9) | 192 | #define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9) |
196 | #define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10) | 193 | #define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10) |
197 | #define HD64461_IRQ_GPIO (HD64461_IRQBASE+11) | 194 | #define HD64461_IRQ_GPIO (HD64461_IRQBASE+11) |
198 | #define HD64461_IRQ_AFE (HD64461_IRQBASE+12) | 195 | #define HD64461_IRQ_AFE (HD64461_IRQBASE+12) |
199 | #define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13) | 196 | #define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13) |
200 | #define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14) | 197 | #define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14) |
198 | |||
199 | #define __IO_PREFIX hd64461 | ||
200 | #include <asm/io_generic.h> | ||
201 | |||
202 | /* arch/sh/cchips/hd6446x/hd64461/setup.c */ | ||
203 | int hd64461_irq_demux(int irq); | ||
204 | void hd64461_register_irq_demux(int irq, | ||
205 | int (*demux) (int irq, void *dev), void *dev); | ||
206 | void hd64461_unregister_irq_demux(int irq); | ||
201 | 207 | ||
202 | #endif | 208 | #endif |
diff --git a/include/asm-sh/hd64461/io.h b/include/asm-sh/hd64461/io.h deleted file mode 100644 index 67f2489088d9..000000000000 --- a/include/asm-sh/hd64461/io.h +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/io_hd64461.h | ||
3 | * | ||
4 | * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * IO functions for an HD64461 | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SH_IO_HD64461_H | ||
13 | #define _ASM_SH_IO_HD64461_H | ||
14 | |||
15 | extern unsigned char hd64461_inb(unsigned long port); | ||
16 | extern unsigned short hd64461_inw(unsigned long port); | ||
17 | extern unsigned int hd64461_inl(unsigned long port); | ||
18 | |||
19 | extern void hd64461_outb(unsigned char value, unsigned long port); | ||
20 | extern void hd64461_outw(unsigned short value, unsigned long port); | ||
21 | extern void hd64461_outl(unsigned int value, unsigned long port); | ||
22 | |||
23 | extern unsigned char hd64461_inb_p(unsigned long port); | ||
24 | extern void hd64461_outb_p(unsigned char value, unsigned long port); | ||
25 | |||
26 | extern void hd64461_insb(unsigned long port, void *addr, unsigned long count); | ||
27 | extern void hd64461_insw(unsigned long port, void *addr, unsigned long count); | ||
28 | extern void hd64461_insl(unsigned long port, void *addr, unsigned long count); | ||
29 | |||
30 | extern void hd64461_outsb(unsigned long port, const void *buffer, unsigned long count); | ||
31 | extern void hd64461_outsw(unsigned long port, const void *buffer, unsigned long count); | ||
32 | extern void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count); | ||
33 | |||
34 | extern unsigned short hd64461_readw(unsigned long addr); | ||
35 | extern void hd64461_writew(unsigned short b, unsigned long addr); | ||
36 | |||
37 | |||
38 | extern int hd64461_irq_demux(int irq); | ||
39 | extern void hd64461_register_irq_demux(int irq, | ||
40 | int (*demux)(int irq, void *dev), void *dev); | ||
41 | extern void hd64461_unregister_irq_demux(int irq); | ||
42 | |||
43 | #endif /* _ASM_SH_IO_HD64461_H */ | ||
diff --git a/include/asm-sh/hp6xx/hp6xx.h b/include/asm-sh/hp6xx/hp6xx.h index a26247fd3d87..f35134c159dd 100644 --- a/include/asm-sh/hp6xx/hp6xx.h +++ b/include/asm-sh/hp6xx/hp6xx.h | |||
@@ -2,16 +2,33 @@ | |||
2 | #define __ASM_SH_HP6XX_H | 2 | #define __ASM_SH_HP6XX_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright (C) 2003 Andriy Skulysh | 5 | * Copyright (C) 2003, 2004, 2005 Andriy Skulysh |
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | * | ||
6 | */ | 11 | */ |
7 | 12 | ||
8 | #define HP680_TS_IRQ IRQ3_IRQ | 13 | #define HP680_BTN_IRQ IRQ0_IRQ |
14 | #define HP680_TS_IRQ IRQ3_IRQ | ||
15 | #define HP680_HD64461_IRQ IRQ4_IRQ | ||
9 | 16 | ||
10 | #define DAC_LCD_BRIGHTNESS 0 | 17 | #define DAC_LCD_BRIGHTNESS 0 |
11 | #define DAC_SPEAKER_VOLUME 1 | 18 | #define DAC_SPEAKER_VOLUME 1 |
12 | 19 | ||
20 | #define PGDR_OPENED 0x01 | ||
21 | #define PGDR_MAIN_BATTERY_OUT 0x04 | ||
22 | #define PGDR_PLAY_BUTTON 0x08 | ||
23 | #define PGDR_REWIND_BUTTON 0x10 | ||
24 | #define PGDR_RECORD_BUTTON 0x20 | ||
25 | |||
13 | #define PHDR_TS_PEN_DOWN 0x08 | 26 | #define PHDR_TS_PEN_DOWN 0x08 |
14 | 27 | ||
28 | #define PJDR_LED_BLINK 0x02 | ||
29 | |||
30 | #define PKDR_LED_GREEN 0x10 | ||
31 | |||
15 | #define SCPDR_TS_SCAN_ENABLE 0x20 | 32 | #define SCPDR_TS_SCAN_ENABLE 0x20 |
16 | #define SCPDR_TS_SCAN_Y 0x02 | 33 | #define SCPDR_TS_SCAN_Y 0x02 |
17 | #define SCPDR_TS_SCAN_X 0x01 | 34 | #define SCPDR_TS_SCAN_X 0x01 |
@@ -21,11 +38,43 @@ | |||
21 | 38 | ||
22 | #define ADC_CHANNEL_TS_Y 1 | 39 | #define ADC_CHANNEL_TS_Y 1 |
23 | #define ADC_CHANNEL_TS_X 2 | 40 | #define ADC_CHANNEL_TS_X 2 |
41 | #define ADC_CHANNEL_BATTERY 3 | ||
42 | #define ADC_CHANNEL_BACKUP 4 | ||
43 | #define ADC_CHANNEL_CHARGE 5 | ||
24 | 44 | ||
25 | #define HD64461_GPADR_SPEAKER 0x01 | 45 | #define HD64461_GPADR_SPEAKER 0x01 |
26 | #define HD64461_GPADR_PCMCIA0 (0x02|0x08) | 46 | #define HD64461_GPADR_PCMCIA0 (0x02|0x08) |
47 | |||
27 | #define HD64461_GPBDR_LCDOFF 0x01 | 48 | #define HD64461_GPBDR_LCDOFF 0x01 |
49 | #define HD64461_GPBDR_LCD_CONTRAST_MASK 0x78 | ||
28 | #define HD64461_GPBDR_LED_RED 0x80 | 50 | #define HD64461_GPBDR_LED_RED 0x80 |
29 | 51 | ||
52 | #include <asm/hd64461.h> | ||
53 | #include <asm/io.h> | ||
54 | |||
55 | #define PJDR 0xa4000130 | ||
56 | #define PKDR 0xa4000132 | ||
57 | |||
58 | static inline void hp6xx_led_red(int on) | ||
59 | { | ||
60 | u16 v16; | ||
61 | v16 = ctrl_inw(CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000); | ||
62 | if (on) | ||
63 | ctrl_outw(v16 & (~HD64461_GPBDR_LED_RED), CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000); | ||
64 | else | ||
65 | ctrl_outw(v16 | HD64461_GPBDR_LED_RED, CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000); | ||
66 | } | ||
67 | |||
68 | static inline void hp6xx_led_green(int on) | ||
69 | { | ||
70 | u8 v8; | ||
71 | |||
72 | v8 = ctrl_inb(PKDR); | ||
73 | if (on) | ||
74 | ctrl_outb(v8 & (~PKDR_LED_GREEN), PKDR); | ||
75 | else | ||
76 | ctrl_outb(v8 | PKDR_LED_GREEN, PKDR); | ||
77 | } | ||
78 | |||
30 | 79 | ||
31 | #endif /* __ASM_SH_HP6XX_H */ | 80 | #endif /* __ASM_SH_HP6XX_H */ |
diff --git a/include/asm-sh/hp6xx/io.h b/include/asm-sh/hp6xx/io.h index 731798003550..2044476ab199 100644 --- a/include/asm-sh/hp6xx/io.h +++ b/include/asm-sh/hp6xx/io.h | |||
@@ -4,7 +4,7 @@ | |||
4 | /* | 4 | /* |
5 | * Nothing special here.. just use the generic cchip io routines. | 5 | * Nothing special here.. just use the generic cchip io routines. |
6 | */ | 6 | */ |
7 | #include <asm/hd64461/io.h> | 7 | #include <asm/hd64461.h> |
8 | 8 | ||
9 | #endif /* __ASM_SH_HP6XX_IO_H */ | 9 | #endif /* __ASM_SH_HP6XX_IO_H */ |
10 | 10 | ||
diff --git a/include/asm-sh/hs7751rvoip/hs7751rvoip.h b/include/asm-sh/hs7751rvoip/hs7751rvoip.h index 5f995f937a44..c4cff9d33927 100644 --- a/include/asm-sh/hs7751rvoip/hs7751rvoip.h +++ b/include/asm-sh/hs7751rvoip/hs7751rvoip.h | |||
@@ -19,8 +19,6 @@ | |||
19 | #define PA_OUTPORTR 0xa400000e /* Output Port Reguster */ | 19 | #define PA_OUTPORTR 0xa400000e /* Output Port Reguster */ |
20 | #define PA_VERREG 0xa4000014 /* FPGA Version Register */ | 20 | #define PA_VERREG 0xa4000014 /* FPGA Version Register */ |
21 | 21 | ||
22 | #define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */ | ||
23 | #define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */ | ||
24 | #define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ | 22 | #define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ |
25 | 23 | ||
26 | #define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ | 24 | #define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ |
@@ -44,4 +42,13 @@ | |||
44 | #define IRQ_RINGING 4 /* Ringing IRQ */ | 42 | #define IRQ_RINGING 4 /* Ringing IRQ */ |
45 | #define IRQ_CODEC 5 /* CODEC IRQ */ | 43 | #define IRQ_CODEC 5 /* CODEC IRQ */ |
46 | 44 | ||
45 | #define __IO_PREFIX hs7751rvoip | ||
46 | #include <asm/io_generic.h> | ||
47 | |||
48 | /* arch/sh/boards/renesas/hs7751rvoip/irq.c */ | ||
49 | void init_hs7751rvoip_IRQ(void); | ||
50 | |||
51 | /* arch/sh/boards/renesas/hs7751rvoip/io.c */ | ||
52 | void *hs7751rvoip_ioremap(unsigned long, unsigned long); | ||
53 | |||
47 | #endif /* __ASM_SH_RENESAS_HS7751RVOIP */ | 54 | #endif /* __ASM_SH_RENESAS_HS7751RVOIP */ |
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index 894e64b2d5f0..ed12d38e8c00 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h | |||
@@ -107,6 +107,9 @@ | |||
107 | #define __raw_writew(v, a) __writew(v, (void __iomem *)(a)) | 107 | #define __raw_writew(v, a) __writew(v, (void __iomem *)(a)) |
108 | #define __raw_writel(v, a) __writel(v, (void __iomem *)(a)) | 108 | #define __raw_writel(v, a) __writel(v, (void __iomem *)(a)) |
109 | 109 | ||
110 | void __raw_writesl(unsigned long addr, const void *data, int longlen); | ||
111 | void __raw_readsl(unsigned long addr, void *data, int longlen); | ||
112 | |||
110 | /* | 113 | /* |
111 | * The platform header files may define some of these macros to use | 114 | * The platform header files may define some of these macros to use |
112 | * the inlined versions where appropriate. These macros may also be | 115 | * the inlined versions where appropriate. These macros may also be |
@@ -132,6 +135,9 @@ | |||
132 | # define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) | 135 | # define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) |
133 | #endif | 136 | #endif |
134 | 137 | ||
138 | #define writesl __raw_writesl | ||
139 | #define readsl __raw_readsl | ||
140 | |||
135 | #define readb_relaxed(a) readb(a) | 141 | #define readb_relaxed(a) readb(a) |
136 | #define readw_relaxed(a) readw(a) | 142 | #define readw_relaxed(a) readw(a) |
137 | #define readl_relaxed(a) readl(a) | 143 | #define readl_relaxed(a) readl(a) |
@@ -209,8 +215,14 @@ static inline void ctrl_outl(unsigned int b, unsigned long addr) | |||
209 | *(volatile unsigned long*)addr = b; | 215 | *(volatile unsigned long*)addr = b; |
210 | } | 216 | } |
211 | 217 | ||
218 | static inline void ctrl_delay(void) | ||
219 | { | ||
220 | ctrl_inw(P2SEG); | ||
221 | } | ||
222 | |||
212 | #define IO_SPACE_LIMIT 0xffffffff | 223 | #define IO_SPACE_LIMIT 0xffffffff |
213 | 224 | ||
225 | #ifdef CONFIG_MMU | ||
214 | /* | 226 | /* |
215 | * Change virtual addresses to physical addresses and vv. | 227 | * Change virtual addresses to physical addresses and vv. |
216 | * These are trivial on the 1:1 Linux/SuperH mapping | 228 | * These are trivial on the 1:1 Linux/SuperH mapping |
@@ -224,6 +236,10 @@ static inline void *phys_to_virt(unsigned long address) | |||
224 | { | 236 | { |
225 | return (void *)P1SEGADDR(address); | 237 | return (void *)P1SEGADDR(address); |
226 | } | 238 | } |
239 | #else | ||
240 | #define phys_to_virt(address) ((void *)(address)) | ||
241 | #define virt_to_phys(address) ((unsigned long)(address)) | ||
242 | #endif | ||
227 | 243 | ||
228 | #define virt_to_bus virt_to_phys | 244 | #define virt_to_bus virt_to_phys |
229 | #define bus_to_virt phys_to_virt | 245 | #define bus_to_virt phys_to_virt |
diff --git a/include/asm-sh/irq-sh73180.h b/include/asm-sh/irq-sh73180.h index d705252be260..b28af9a69d72 100644 --- a/include/asm-sh/irq-sh73180.h +++ b/include/asm-sh/irq-sh73180.h | |||
@@ -311,6 +311,4 @@ | |||
311 | #define IRQ6_PRIORITY 1 | 311 | #define IRQ6_PRIORITY 1 |
312 | #define IRQ7_PRIORITY 1 | 312 | #define IRQ7_PRIORITY 1 |
313 | 313 | ||
314 | int shmse_irq_demux(int irq); | ||
315 | |||
316 | #endif /* __ASM_SH_IRQ_SH73180_H */ | 314 | #endif /* __ASM_SH_IRQ_SH73180_H */ |
diff --git a/include/asm-sh/irq-sh7343.h b/include/asm-sh/irq-sh7343.h new file mode 100644 index 000000000000..5d15419b53b0 --- /dev/null +++ b/include/asm-sh/irq-sh7343.h | |||
@@ -0,0 +1,317 @@ | |||
1 | #ifndef __ASM_SH_IRQ_SH7343_H | ||
2 | #define __ASM_SH_IRQ_SH7343_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/asm-sh/irq-sh7343.h | ||
6 | * | ||
7 | * Copyright (C) 2006 Kenati Technologies Inc. | ||
8 | * Andre Mccurdy <andre@kenati.com> | ||
9 | * Ranjit Deshpande <ranjit@kenati.com> | ||
10 | */ | ||
11 | |||
12 | #undef INTC_IPRA | ||
13 | #undef INTC_IPRB | ||
14 | #undef INTC_IPRC | ||
15 | #undef INTC_IPRD | ||
16 | |||
17 | #undef DMTE0_IRQ | ||
18 | #undef DMTE1_IRQ | ||
19 | #undef DMTE2_IRQ | ||
20 | #undef DMTE3_IRQ | ||
21 | #undef DMTE4_IRQ | ||
22 | #undef DMTE5_IRQ | ||
23 | #undef DMTE6_IRQ | ||
24 | #undef DMTE7_IRQ | ||
25 | #undef DMAE_IRQ | ||
26 | #undef DMA_IPR_ADDR | ||
27 | #undef DMA_IPR_POS | ||
28 | #undef DMA_PRIORITY | ||
29 | |||
30 | #undef INTC_IMCR0 | ||
31 | #undef INTC_IMCR1 | ||
32 | #undef INTC_IMCR2 | ||
33 | #undef INTC_IMCR3 | ||
34 | #undef INTC_IMCR4 | ||
35 | #undef INTC_IMCR5 | ||
36 | #undef INTC_IMCR6 | ||
37 | #undef INTC_IMCR7 | ||
38 | #undef INTC_IMCR8 | ||
39 | #undef INTC_IMCR9 | ||
40 | #undef INTC_IMCR10 | ||
41 | |||
42 | |||
43 | #define INTC_IPRA 0xA4080000UL | ||
44 | #define INTC_IPRB 0xA4080004UL | ||
45 | #define INTC_IPRC 0xA4080008UL | ||
46 | #define INTC_IPRD 0xA408000CUL | ||
47 | #define INTC_IPRE 0xA4080010UL | ||
48 | #define INTC_IPRF 0xA4080014UL | ||
49 | #define INTC_IPRG 0xA4080018UL | ||
50 | #define INTC_IPRH 0xA408001CUL | ||
51 | #define INTC_IPRI 0xA4080020UL | ||
52 | #define INTC_IPRJ 0xA4080024UL | ||
53 | #define INTC_IPRK 0xA4080028UL | ||
54 | #define INTC_IPRL 0xA408002CUL | ||
55 | |||
56 | #define INTC_IMR0 0xA4080080UL | ||
57 | #define INTC_IMR1 0xA4080084UL | ||
58 | #define INTC_IMR2 0xA4080088UL | ||
59 | #define INTC_IMR3 0xA408008CUL | ||
60 | #define INTC_IMR4 0xA4080090UL | ||
61 | #define INTC_IMR5 0xA4080094UL | ||
62 | #define INTC_IMR6 0xA4080098UL | ||
63 | #define INTC_IMR7 0xA408009CUL | ||
64 | #define INTC_IMR8 0xA40800A0UL | ||
65 | #define INTC_IMR9 0xA40800A4UL | ||
66 | #define INTC_IMR10 0xA40800A8UL | ||
67 | #define INTC_IMR11 0xA40800ACUL | ||
68 | |||
69 | #define INTC_IMCR0 0xA40800C0UL | ||
70 | #define INTC_IMCR1 0xA40800C4UL | ||
71 | #define INTC_IMCR2 0xA40800C8UL | ||
72 | #define INTC_IMCR3 0xA40800CCUL | ||
73 | #define INTC_IMCR4 0xA40800D0UL | ||
74 | #define INTC_IMCR5 0xA40800D4UL | ||
75 | #define INTC_IMCR6 0xA40800D8UL | ||
76 | #define INTC_IMCR7 0xA40800DCUL | ||
77 | #define INTC_IMCR8 0xA40800E0UL | ||
78 | #define INTC_IMCR9 0xA40800E4UL | ||
79 | #define INTC_IMCR10 0xA40800E8UL | ||
80 | #define INTC_IMCR11 0xA40800ECUL | ||
81 | |||
82 | #define INTC_ICR0 0xA4140000UL | ||
83 | #define INTC_ICR1 0xA414001CUL | ||
84 | |||
85 | #define INTMSK0 0xa4140044 | ||
86 | #define INTMSKCLR0 0xa4140064 | ||
87 | #define INTC_INTPRI0 0xa4140010 | ||
88 | |||
89 | /* | ||
90 | NOTE: | ||
91 | |||
92 | *_IRQ = (INTEVT2 - 0x200)/0x20 | ||
93 | */ | ||
94 | |||
95 | /* TMU0 */ | ||
96 | #define TMU0_IRQ 16 | ||
97 | #define TMU0_IPR_ADDR INTC_IPRA | ||
98 | #define TMU0_IPR_POS 3 | ||
99 | #define TMU0_PRIORITY 2 | ||
100 | |||
101 | #define TIMER_IRQ 16 | ||
102 | #define TIMER_IPR_ADDR INTC_IPRA | ||
103 | #define TIMER_IPR_POS 3 | ||
104 | #define TIMER_PRIORITY 2 | ||
105 | |||
106 | /* TMU1 */ | ||
107 | #define TMU1_IRQ 17 | ||
108 | #define TMU1_IPR_ADDR INTC_IPRA | ||
109 | #define TMU1_IPR_POS 2 | ||
110 | #define TMU1_PRIORITY 2 | ||
111 | |||
112 | /* TMU2 */ | ||
113 | #define TMU2_IRQ 18 | ||
114 | #define TMU2_IPR_ADDR INTC_IPRA | ||
115 | #define TMU2_IPR_POS 1 | ||
116 | #define TMU2_PRIORITY 2 | ||
117 | |||
118 | /* LCDC */ | ||
119 | #define LCDC_IRQ 28 | ||
120 | #define LCDC_IPR_ADDR INTC_IPRB | ||
121 | #define LCDC_IPR_POS 2 | ||
122 | #define LCDC_PRIORITY 2 | ||
123 | |||
124 | /* VIO (Video I/O) */ | ||
125 | #define CEU_IRQ 52 | ||
126 | #define BEU_IRQ 53 | ||
127 | #define VEU_IRQ 54 | ||
128 | #define VOU_IRQ 55 | ||
129 | #define VIO_IPR_ADDR INTC_IPRE | ||
130 | #define VIO_IPR_POS 2 | ||
131 | #define VIO_PRIORITY 2 | ||
132 | |||
133 | /* MFI (Multi Functional Interface) */ | ||
134 | #define MFI_IRQ 56 | ||
135 | #define MFI_IPR_ADDR INTC_IPRE | ||
136 | #define MFI_IPR_POS 1 | ||
137 | #define MFI_PRIORITY 2 | ||
138 | |||
139 | /* VPU (Video Processing Unit) */ | ||
140 | #define VPU_IRQ 60 | ||
141 | #define VPU_IPR_ADDR INTC_IPRE | ||
142 | #define VPU_IPR_POS 0 | ||
143 | #define VPU_PRIORITY 2 | ||
144 | |||
145 | /* 3DG */ | ||
146 | #define TDG_IRQ 63 | ||
147 | #define TDG_IPR_ADDR INTC_IPRJ | ||
148 | #define TDG_IPR_POS 2 | ||
149 | #define TDG_PRIORITY 2 | ||
150 | |||
151 | /* DMAC(1) */ | ||
152 | #define DMTE0_IRQ 48 | ||
153 | #define DMTE1_IRQ 49 | ||
154 | #define DMTE2_IRQ 50 | ||
155 | #define DMTE3_IRQ 51 | ||
156 | #define DMA1_IPR_ADDR INTC_IPRE | ||
157 | #define DMA1_IPR_POS 3 | ||
158 | #define DMA1_PRIORITY 7 | ||
159 | |||
160 | /* DMAC(2) */ | ||
161 | #define DMTE4_IRQ 76 | ||
162 | #define DMTE5_IRQ 77 | ||
163 | #define DMA2_IPR_ADDR INTC_IPRF | ||
164 | #define DMA2_IPR_POS 2 | ||
165 | #define DMA2_PRIORITY 7 | ||
166 | |||
167 | /* SCIF0 */ | ||
168 | #define SCIF_ERI_IRQ 80 | ||
169 | #define SCIF_RXI_IRQ 81 | ||
170 | #define SCIF_BRI_IRQ 82 | ||
171 | #define SCIF_TXI_IRQ 83 | ||
172 | #define SCIF_IPR_ADDR INTC_IPRG | ||
173 | #define SCIF_IPR_POS 3 | ||
174 | #define SCIF_PRIORITY 3 | ||
175 | |||
176 | /* SIOF0 */ | ||
177 | #define SIOF0_IRQ 84 | ||
178 | #define SIOF0_IPR_ADDR INTC_IPRH | ||
179 | #define SIOF0_IPR_POS 3 | ||
180 | #define SIOF0_PRIORITY 3 | ||
181 | |||
182 | /* FLCTL (Flash Memory Controller) */ | ||
183 | #define FLSTE_IRQ 92 | ||
184 | #define FLTEND_IRQ 93 | ||
185 | #define FLTRQ0_IRQ 94 | ||
186 | #define FLTRQ1_IRQ 95 | ||
187 | #define FLCTL_IPR_ADDR INTC_IPRH | ||
188 | #define FLCTL_IPR_POS 1 | ||
189 | #define FLCTL_PRIORITY 3 | ||
190 | |||
191 | /* IIC(0) (IIC Bus Interface) */ | ||
192 | #define IIC0_ALI_IRQ 96 | ||
193 | #define IIC0_TACKI_IRQ 97 | ||
194 | #define IIC0_WAITI_IRQ 98 | ||
195 | #define IIC0_DTEI_IRQ 99 | ||
196 | #define IIC0_IPR_ADDR INTC_IPRH | ||
197 | #define IIC0_IPR_POS 0 | ||
198 | #define IIC0_PRIORITY 3 | ||
199 | |||
200 | /* IIC(1) (IIC Bus Interface) */ | ||
201 | #define IIC1_ALI_IRQ 44 | ||
202 | #define IIC1_TACKI_IRQ 45 | ||
203 | #define IIC1_WAITI_IRQ 46 | ||
204 | #define IIC1_DTEI_IRQ 47 | ||
205 | #define IIC1_IPR_ADDR INTC_IPRI | ||
206 | #define IIC1_IPR_POS 0 | ||
207 | #define IIC1_PRIORITY 3 | ||
208 | |||
209 | /* SIO0 */ | ||
210 | #define SIO0_IRQ 88 | ||
211 | #define SIO0_IPR_ADDR INTC_IPRI | ||
212 | #define SIO0_IPR_POS 3 | ||
213 | #define SIO0_PRIORITY 3 | ||
214 | |||
215 | /* SDHI */ | ||
216 | #define SDHI_SDHII0_IRQ 100 | ||
217 | #define SDHI_SDHII1_IRQ 101 | ||
218 | #define SDHI_SDHII2_IRQ 102 | ||
219 | #define SDHI_SDHII3_IRQ 103 | ||
220 | #define SDHI_IPR_ADDR INTC_IPRK | ||
221 | #define SDHI_IPR_POS 0 | ||
222 | #define SDHI_PRIORITY 3 | ||
223 | |||
224 | /* SIU (Sound Interface Unit) */ | ||
225 | #define SIU_IRQ 108 | ||
226 | #define SIU_IPR_ADDR INTC_IPRJ | ||
227 | #define SIU_IPR_POS 1 | ||
228 | #define SIU_PRIORITY 3 | ||
229 | |||
230 | #define PORT_PACR 0xA4050100UL | ||
231 | #define PORT_PBCR 0xA4050102UL | ||
232 | #define PORT_PCCR 0xA4050104UL | ||
233 | #define PORT_PDCR 0xA4050106UL | ||
234 | #define PORT_PECR 0xA4050108UL | ||
235 | #define PORT_PFCR 0xA405010AUL | ||
236 | #define PORT_PGCR 0xA405010CUL | ||
237 | #define PORT_PHCR 0xA405010EUL | ||
238 | #define PORT_PJCR 0xA4050110UL | ||
239 | #define PORT_PKCR 0xA4050112UL | ||
240 | #define PORT_PLCR 0xA4050114UL | ||
241 | #define PORT_SCPCR 0xA4050116UL | ||
242 | #define PORT_PMCR 0xA4050118UL | ||
243 | #define PORT_PNCR 0xA405011AUL | ||
244 | #define PORT_PQCR 0xA405011CUL | ||
245 | #define PORT_PRCR 0xA405011EUL | ||
246 | #define PORT_PTCR 0xA405014CUL | ||
247 | #define PORT_PUCR 0xA405014EUL | ||
248 | #define PORT_PVCR 0xA4050150UL | ||
249 | |||
250 | #define PORT_PSELA 0xA4050140UL | ||
251 | #define PORT_PSELB 0xA4050142UL | ||
252 | #define PORT_PSELC 0xA4050144UL | ||
253 | #define PORT_PSELE 0xA4050158UL | ||
254 | |||
255 | #define PORT_HIZCRA 0xA4050146UL | ||
256 | #define PORT_HIZCRB 0xA4050148UL | ||
257 | #define PORT_DRVCR 0xA405014AUL | ||
258 | |||
259 | #define PORT_PADR 0xA4050120UL | ||
260 | #define PORT_PBDR 0xA4050122UL | ||
261 | #define PORT_PCDR 0xA4050124UL | ||
262 | #define PORT_PDDR 0xA4050126UL | ||
263 | #define PORT_PEDR 0xA4050128UL | ||
264 | #define PORT_PFDR 0xA405012AUL | ||
265 | #define PORT_PGDR 0xA405012CUL | ||
266 | #define PORT_PHDR 0xA405012EUL | ||
267 | #define PORT_PJDR 0xA4050130UL | ||
268 | #define PORT_PKDR 0xA4050132UL | ||
269 | #define PORT_PLDR 0xA4050134UL | ||
270 | #define PORT_SCPDR 0xA4050136UL | ||
271 | #define PORT_PMDR 0xA4050138UL | ||
272 | #define PORT_PNDR 0xA405013AUL | ||
273 | #define PORT_PQDR 0xA405013CUL | ||
274 | #define PORT_PRDR 0xA405013EUL | ||
275 | #define PORT_PTDR 0xA405016CUL | ||
276 | #define PORT_PUDR 0xA405016EUL | ||
277 | #define PORT_PVDR 0xA4050170UL | ||
278 | |||
279 | #define IRQ0_IRQ 32 | ||
280 | #define IRQ1_IRQ 33 | ||
281 | #define IRQ2_IRQ 34 | ||
282 | #define IRQ3_IRQ 35 | ||
283 | #define IRQ4_IRQ 36 | ||
284 | #define IRQ5_IRQ 37 | ||
285 | #define IRQ6_IRQ 38 | ||
286 | #define IRQ7_IRQ 39 | ||
287 | |||
288 | #define INTPRI00 0xA4140010UL | ||
289 | |||
290 | #define IRQ0_IPR_ADDR INTPRI00 | ||
291 | #define IRQ1_IPR_ADDR INTPRI00 | ||
292 | #define IRQ2_IPR_ADDR INTPRI00 | ||
293 | #define IRQ3_IPR_ADDR INTPRI00 | ||
294 | #define IRQ4_IPR_ADDR INTPRI00 | ||
295 | #define IRQ5_IPR_ADDR INTPRI00 | ||
296 | #define IRQ6_IPR_ADDR INTPRI00 | ||
297 | #define IRQ7_IPR_ADDR INTPRI00 | ||
298 | |||
299 | #define IRQ0_IPR_POS 7 | ||
300 | #define IRQ1_IPR_POS 6 | ||
301 | #define IRQ2_IPR_POS 5 | ||
302 | #define IRQ3_IPR_POS 4 | ||
303 | #define IRQ4_IPR_POS 3 | ||
304 | #define IRQ5_IPR_POS 2 | ||
305 | #define IRQ6_IPR_POS 1 | ||
306 | #define IRQ7_IPR_POS 0 | ||
307 | |||
308 | #define IRQ0_PRIORITY 1 | ||
309 | #define IRQ1_PRIORITY 1 | ||
310 | #define IRQ2_PRIORITY 1 | ||
311 | #define IRQ3_PRIORITY 1 | ||
312 | #define IRQ4_PRIORITY 1 | ||
313 | #define IRQ5_PRIORITY 1 | ||
314 | #define IRQ6_PRIORITY 1 | ||
315 | #define IRQ7_PRIORITY 1 | ||
316 | |||
317 | #endif /* __ASM_SH_IRQ_SH7343_H */ | ||
diff --git a/include/asm-sh/irq-sh7780.h b/include/asm-sh/irq-sh7780.h index 7f90315cd830..895c5780e454 100644 --- a/include/asm-sh/irq-sh7780.h +++ b/include/asm-sh/irq-sh7780.h | |||
@@ -145,11 +145,6 @@ | |||
145 | #define TMU_CH5_IPR_POS 1 | 145 | #define TMU_CH5_IPR_POS 1 |
146 | #define TMU_CH5_PRIORITY 2 | 146 | #define TMU_CH5_PRIORITY 2 |
147 | 147 | ||
148 | #define RTC_IRQ 22 | ||
149 | #define RTC_IPR_ADDR INTC_INT2PRI1 | ||
150 | #define RTC_IPR_POS 0 | ||
151 | #define RTC_PRIORITY TIMER_PRIORITY | ||
152 | |||
153 | /* SCIF0 */ | 148 | /* SCIF0 */ |
154 | #define SCIF0_ERI_IRQ 40 | 149 | #define SCIF0_ERI_IRQ 40 |
155 | #define SCIF0_RXI_IRQ 41 | 150 | #define SCIF0_RXI_IRQ 41 |
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index 611e67cd0627..0e5f365aff70 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h | |||
@@ -192,7 +192,7 @@ | |||
192 | 192 | ||
193 | #if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \ | 193 | #if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \ |
194 | defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \ | 194 | defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \ |
195 | defined (CONFIG_CPU_SUBTYPE_SH7751) | 195 | defined (CONFIG_CPU_SUBTYPE_SH7751) || defined (CONFIG_CPU_SUBTYPE_SH7706) |
196 | #define SCI_ERI_IRQ 23 | 196 | #define SCI_ERI_IRQ 23 |
197 | #define SCI_RXI_IRQ 24 | 197 | #define SCI_RXI_IRQ 24 |
198 | #define SCI_TXI_IRQ 25 | 198 | #define SCI_TXI_IRQ 25 |
@@ -207,6 +207,7 @@ | |||
207 | #define SCIF0_IPR_POS 3 | 207 | #define SCIF0_IPR_POS 3 |
208 | #define SCIF0_PRIORITY 3 | 208 | #define SCIF0_PRIORITY 3 |
209 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 209 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
210 | defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | ||
210 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ | 211 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ |
211 | defined(CONFIG_CPU_SUBTYPE_SH7709) | 212 | defined(CONFIG_CPU_SUBTYPE_SH7709) |
212 | #define SCIF_ERI_IRQ 56 | 213 | #define SCIF_ERI_IRQ 56 |
@@ -261,9 +262,12 @@ | |||
261 | #elif defined(CONFIG_CPU_SUBTYPE_SH7708) | 262 | #elif defined(CONFIG_CPU_SUBTYPE_SH7708) |
262 | # define ONCHIP_NR_IRQS 32 | 263 | # define ONCHIP_NR_IRQS 32 |
263 | #elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \ | 264 | #elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \ |
265 | defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | ||
264 | defined(CONFIG_CPU_SUBTYPE_SH7705) | 266 | defined(CONFIG_CPU_SUBTYPE_SH7705) |
265 | # define ONCHIP_NR_IRQS 64 // Actually 61 | 267 | # define ONCHIP_NR_IRQS 64 // Actually 61 |
266 | # define PINT_NR_IRQS 16 | 268 | # define PINT_NR_IRQS 16 |
269 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) | ||
270 | # define ONCHIP_NR_IRQS 104 | ||
267 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) | 271 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) |
268 | # define ONCHIP_NR_IRQS 48 // Actually 44 | 272 | # define ONCHIP_NR_IRQS 48 // Actually 44 |
269 | #elif defined(CONFIG_CPU_SUBTYPE_SH7751) | 273 | #elif defined(CONFIG_CPU_SUBTYPE_SH7751) |
@@ -275,7 +279,8 @@ | |||
275 | #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) | 279 | #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) |
276 | # define ONCHIP_NR_IRQS 144 | 280 | # define ONCHIP_NR_IRQS 144 |
277 | #elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \ | 281 | #elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \ |
278 | defined(CONFIG_CPU_SUBTYPE_SH73180) | 282 | defined(CONFIG_CPU_SUBTYPE_SH73180) || \ |
283 | defined(CONFIG_CPU_SUBTYPE_SH7343) | ||
279 | # define ONCHIP_NR_IRQS 109 | 284 | # define ONCHIP_NR_IRQS 109 |
280 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) | 285 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
281 | # define ONCHIP_NR_IRQS 111 | 286 | # define ONCHIP_NR_IRQS 111 |
@@ -311,6 +316,8 @@ | |||
311 | # define OFFCHIP_NR_IRQS 4 | 316 | # define OFFCHIP_NR_IRQS 4 |
312 | #elif defined(CONFIG_SH_R7780RP) | 317 | #elif defined(CONFIG_SH_R7780RP) |
313 | # define OFFCHIP_NR_IRQS 16 | 318 | # define OFFCHIP_NR_IRQS 16 |
319 | #elif defined(CONFIG_SH_7343_SOLUTION_ENGINE) | ||
320 | # define OFFCHIP_NR_IRQS 12 | ||
314 | #elif defined(CONFIG_SH_UNKNOWN) | 321 | #elif defined(CONFIG_SH_UNKNOWN) |
315 | # define OFFCHIP_NR_IRQS 16 /* Must also be last */ | 322 | # define OFFCHIP_NR_IRQS 16 /* Must also be last */ |
316 | #else | 323 | #else |
@@ -335,6 +342,11 @@ extern void make_maskreg_irq(unsigned int irq); | |||
335 | extern unsigned short *irq_mask_register; | 342 | extern unsigned short *irq_mask_register; |
336 | 343 | ||
337 | /* | 344 | /* |
345 | * PINT IRQs | ||
346 | */ | ||
347 | void init_IRQ_pint(void); | ||
348 | |||
349 | /* | ||
338 | * Function for "on chip support modules". | 350 | * Function for "on chip support modules". |
339 | */ | 351 | */ |
340 | extern void make_ipr_irq(unsigned int irq, unsigned int addr, | 352 | extern void make_ipr_irq(unsigned int irq, unsigned int addr, |
@@ -471,8 +483,10 @@ extern int ipr_irq_demux(int irq); | |||
471 | 483 | ||
472 | #define INTC_ICR 0xfffffee0UL | 484 | #define INTC_ICR 0xfffffee0UL |
473 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 485 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
486 | defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | ||
474 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ | 487 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ |
475 | defined(CONFIG_CPU_SUBTYPE_SH7709) | 488 | defined(CONFIG_CPU_SUBTYPE_SH7709) || \ |
489 | defined(CONFIG_CPU_SUBTYPE_SH7710) | ||
476 | #define INTC_IRR0 0xa4000004UL | 490 | #define INTC_IRR0 0xa4000004UL |
477 | #define INTC_IRR1 0xa4000006UL | 491 | #define INTC_IRR1 0xa4000006UL |
478 | #define INTC_IRR2 0xa4000008UL | 492 | #define INTC_IRR2 0xa4000008UL |
@@ -491,8 +505,105 @@ extern int ipr_irq_demux(int irq); | |||
491 | #define INTC_IPRF 0xa4080000UL | 505 | #define INTC_IPRF 0xa4080000UL |
492 | #define INTC_IPRG 0xa4080002UL | 506 | #define INTC_IPRG 0xa4080002UL |
493 | #define INTC_IPRH 0xa4080004UL | 507 | #define INTC_IPRH 0xa4080004UL |
494 | #endif | 508 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) |
509 | /* Interrupt Controller Registers */ | ||
510 | #undef INTC_IPRA | ||
511 | #undef INTC_IPRB | ||
512 | #define INTC_IPRA 0xA414FEE2UL | ||
513 | #define INTC_IPRB 0xA414FEE4UL | ||
514 | #define INTC_IPRF 0xA4080000UL | ||
515 | #define INTC_IPRG 0xA4080002UL | ||
516 | #define INTC_IPRH 0xA4080004UL | ||
517 | #define INTC_IPRI 0xA4080006UL | ||
518 | |||
519 | #undef INTC_ICR0 | ||
520 | #undef INTC_ICR1 | ||
521 | #define INTC_ICR0 0xA414FEE0UL | ||
522 | #define INTC_ICR1 0xA4140010UL | ||
523 | |||
524 | #define INTC_IRR0 0xa4000004UL | ||
525 | #define INTC_IRR1 0xa4000006UL | ||
526 | #define INTC_IRR2 0xa4000008UL | ||
527 | #define INTC_IRR3 0xa400000AUL | ||
528 | #define INTC_IRR4 0xa400000CUL | ||
529 | #define INTC_IRR5 0xa4080020UL | ||
530 | #define INTC_IRR7 0xa4080024UL | ||
531 | #define INTC_IRR8 0xa4080026UL | ||
532 | |||
533 | /* Interrupt numbers */ | ||
534 | #define TIMER2_IRQ 18 | ||
535 | #define TIMER2_IPR_ADDR INTC_IPRA | ||
536 | #define TIMER2_IPR_POS 1 | ||
537 | #define TIMER2_PRIORITY 2 | ||
538 | |||
539 | /* WDT */ | ||
540 | #define WDT_IRQ 27 | ||
541 | #define WDT_IPR_ADDR INTC_IPRB | ||
542 | #define WDT_IPR_POS 3 | ||
543 | #define WDT_PRIORITY 2 | ||
544 | |||
545 | #define SCIF0_ERI_IRQ 52 | ||
546 | #define SCIF0_RXI_IRQ 53 | ||
547 | #define SCIF0_BRI_IRQ 54 | ||
548 | #define SCIF0_TXI_IRQ 55 | ||
549 | #define SCIF0_IPR_ADDR INTC_IPRE | ||
550 | #define SCIF0_IPR_POS 2 | ||
551 | #define SCIF0_PRIORITY 3 | ||
552 | |||
553 | #define DMTE4_IRQ 76 | ||
554 | #define DMTE5_IRQ 77 | ||
555 | #define DMA2_IPR_ADDR INTC_IPRF | ||
556 | #define DMA2_IPR_POS 2 | ||
557 | #define DMA2_PRIORITY 7 | ||
495 | 558 | ||
559 | #define IPSEC_IRQ 79 | ||
560 | #define IPSEC_IPR_ADDR INTC_IPRF | ||
561 | #define IPSEC_IPR_POS 3 | ||
562 | #define IPSEC_PRIORITY 3 | ||
563 | |||
564 | /* EDMAC */ | ||
565 | #define EDMAC0_IRQ 80 | ||
566 | #define EDMAC0_IPR_ADDR INTC_IPRG | ||
567 | #define EDMAC0_IPR_POS 3 | ||
568 | #define EDMAC0_PRIORITY 3 | ||
569 | |||
570 | #define EDMAC1_IRQ 81 | ||
571 | #define EDMAC1_IPR_ADDR INTC_IPRG | ||
572 | #define EDMAC1_IPR_POS 2 | ||
573 | #define EDMAC1_PRIORITY 3 | ||
574 | |||
575 | #define EDMAC2_IRQ 82 | ||
576 | #define EDMAC2_IPR_ADDR INTC_IPRG | ||
577 | #define EDMAC2_IPR_POS 1 | ||
578 | #define EDMAC2_PRIORITY 3 | ||
579 | |||
580 | /* SIOF */ | ||
581 | #define SIOF0_ERI_IRQ 96 | ||
582 | #define SIOF0_TXI_IRQ 97 | ||
583 | #define SIOF0_RXI_IRQ 98 | ||
584 | #define SIOF0_CCI_IRQ 99 | ||
585 | #define SIOF0_IPR_ADDR INTC_IPRH | ||
586 | #define SIOF0_IPR_POS 0 | ||
587 | #define SIOF0_PRIORITY 7 | ||
588 | |||
589 | #define SIOF1_ERI_IRQ 100 | ||
590 | #define SIOF1_TXI_IRQ 101 | ||
591 | #define SIOF1_RXI_IRQ 102 | ||
592 | #define SIOF1_CCI_IRQ 103 | ||
593 | #define SIOF1_IPR_ADDR INTC_IPRI | ||
594 | #define SIOF1_IPR_POS 1 | ||
595 | #define SIOF1_PRIORITY 7 | ||
596 | #endif /* CONFIG_CPU_SUBTYPE_SH7710 */ | ||
597 | |||
598 | #if defined(CONFIG_CPU_SUBTYPE_SH7710) | ||
599 | #define PORT_PACR 0xa4050100UL | ||
600 | #define PORT_PBCR 0xa4050102UL | ||
601 | #define PORT_PCCR 0xa4050104UL | ||
602 | #define PORT_PETCR 0xa4050106UL | ||
603 | #define PORT_PADR 0xa4050120UL | ||
604 | #define PORT_PBDR 0xa4050122UL | ||
605 | #define PORT_PCDR 0xa4050124UL | ||
606 | #else | ||
496 | #define PORT_PACR 0xa4000100UL | 607 | #define PORT_PACR 0xa4000100UL |
497 | #define PORT_PBCR 0xa4000102UL | 608 | #define PORT_PBCR 0xa4000102UL |
498 | #define PORT_PCCR 0xa4000104UL | 609 | #define PORT_PCCR 0xa4000104UL |
@@ -501,6 +612,7 @@ extern int ipr_irq_demux(int irq); | |||
501 | #define PORT_PBDR 0xa4000122UL | 612 | #define PORT_PBDR 0xa4000122UL |
502 | #define PORT_PCDR 0xa4000124UL | 613 | #define PORT_PCDR 0xa4000124UL |
503 | #define PORT_PFDR 0xa400012aUL | 614 | #define PORT_PFDR 0xa400012aUL |
615 | #endif | ||
504 | 616 | ||
505 | #define IRQ0_IRQ 32 | 617 | #define IRQ0_IRQ 32 |
506 | #define IRQ1_IRQ 33 | 618 | #define IRQ1_IRQ 33 |
@@ -577,7 +689,7 @@ extern int ipr_irq_demux(int irq); | |||
577 | #define NR_INTC2_IRQS 64 | 689 | #define NR_INTC2_IRQS 64 |
578 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) | 690 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
579 | #define INTC2_BASE 0xffd40000 | 691 | #define INTC2_BASE 0xffd40000 |
580 | #define INTC2_FIRST_IRQ 22 | 692 | #define INTC2_FIRST_IRQ 21 |
581 | #define INTC2_INTMSK_OFFSET (0x38) | 693 | #define INTC2_INTMSK_OFFSET (0x38) |
582 | #define INTC2_INTMSKCLR_OFFSET (0x3c) | 694 | #define INTC2_INTMSKCLR_OFFSET (0x3c) |
583 | #define NR_INTC2_IRQS 60 | 695 | #define NR_INTC2_IRQS 60 |
@@ -594,6 +706,8 @@ void intc2_add_clear_irq(int irq, int (*fn)(int)); | |||
594 | 706 | ||
595 | #endif | 707 | #endif |
596 | 708 | ||
709 | extern int shmse_irq_demux(int irq); | ||
710 | |||
597 | static inline int generic_irq_demux(int irq) | 711 | static inline int generic_irq_demux(int irq) |
598 | { | 712 | { |
599 | return irq; | 713 | return irq; |
@@ -605,8 +719,21 @@ static inline int generic_irq_demux(int irq) | |||
605 | #define irq_canonicalize(irq) (irq) | 719 | #define irq_canonicalize(irq) (irq) |
606 | #define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) | 720 | #define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) |
607 | 721 | ||
722 | #ifdef CONFIG_4KSTACKS | ||
723 | extern void irq_ctx_init(int cpu); | ||
724 | extern void irq_ctx_exit(int cpu); | ||
725 | # define __ARCH_HAS_DO_SOFTIRQ | ||
726 | #else | ||
727 | # define irq_ctx_init(cpu) do { } while (0) | ||
728 | # define irq_ctx_exit(cpu) do { } while (0) | ||
729 | #endif | ||
730 | |||
608 | #if defined(CONFIG_CPU_SUBTYPE_SH73180) | 731 | #if defined(CONFIG_CPU_SUBTYPE_SH73180) |
609 | #include <asm/irq-sh73180.h> | 732 | #include <asm/irq-sh73180.h> |
610 | #endif | 733 | #endif |
611 | 734 | ||
735 | #if defined(CONFIG_CPU_SUBTYPE_SH7343) | ||
736 | #include <asm/irq-sh7343.h> | ||
737 | #endif | ||
738 | |||
612 | #endif /* __ASM_SH_IRQ_H */ | 739 | #endif /* __ASM_SH_IRQ_H */ |
diff --git a/include/asm-sh/kexec.h b/include/asm-sh/kexec.h index 9dfe59f6fcb5..9d235af20cdd 100644 --- a/include/asm-sh/kexec.h +++ b/include/asm-sh/kexec.h | |||
@@ -23,11 +23,10 @@ | |||
23 | /* The native architecture */ | 23 | /* The native architecture */ |
24 | #define KEXEC_ARCH KEXEC_ARCH_SH | 24 | #define KEXEC_ARCH KEXEC_ARCH_SH |
25 | 25 | ||
26 | #ifndef __ASSEMBLY__ | 26 | #define MAX_NOTE_BYTES 1024 |
27 | 27 | ||
28 | extern void machine_shutdown(void); | 28 | /* Provide a dummy definition to avoid build failures. */ |
29 | extern void *crash_notes; | 29 | static inline void crash_setup_regs(struct pt_regs *newregs, |
30 | 30 | struct pt_regs *oldregs) { } | |
31 | #endif /* __ASSEMBLY__ */ | ||
32 | 31 | ||
33 | #endif /* _SH_KEXEC_H */ | 32 | #endif /* _SH_KEXEC_H */ |
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h index 1653ffb75fbe..7b26f53fe343 100644 --- a/include/asm-sh/kgdb.h +++ b/include/asm-sh/kgdb.h | |||
@@ -128,4 +128,19 @@ extern int setjmp(jmp_buf __jmpb); | |||
128 | #define KGDB_ASSERT(condition, message) | 128 | #define KGDB_ASSERT(condition, message) |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | /* Taken from sh-stub.c of GDB 4.18 */ | ||
132 | static const char hexchars[] = "0123456789abcdef"; | ||
133 | |||
134 | /* Get high hex bits */ | ||
135 | static inline char highhex(const int x) | ||
136 | { | ||
137 | return hexchars[(x >> 4) & 0xf]; | ||
138 | } | ||
139 | |||
140 | /* Get low hex bits */ | ||
141 | static inline char lowhex(const int x) | ||
142 | { | ||
143 | return hexchars[x & 0xf]; | ||
144 | } | ||
145 | |||
131 | #endif | 146 | #endif |
diff --git a/include/asm-sh/landisk/gio.h b/include/asm-sh/landisk/gio.h new file mode 100644 index 000000000000..3fce4c451a46 --- /dev/null +++ b/include/asm-sh/landisk/gio.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef __ASM_SH_LANDISK_GIO_H | ||
2 | #define __ASM_SH_LANDISK_GIO_H | ||
3 | |||
4 | #include <linux/ioctl.h> | ||
5 | |||
6 | /* version */ | ||
7 | #define VERSION_STR "1.00" | ||
8 | |||
9 | /* Driver name */ | ||
10 | #define GIO_DRIVER_NAME "/dev/giodrv" | ||
11 | |||
12 | /* Use 'k' as magic number */ | ||
13 | #define GIODRV_IOC_MAGIC 'k' | ||
14 | |||
15 | #define GIODRV_IOCRESET _IO(GIODRV_IOC_MAGIC, 0) | ||
16 | /* | ||
17 | * S means "Set" through a ptr, | ||
18 | * T means "Tell" directly | ||
19 | * G means "Get" (to a pointed var) | ||
20 | * Q means "Query", response is on the return value | ||
21 | * X means "eXchange": G and S atomically | ||
22 | * H means "sHift": T and Q atomically | ||
23 | */ | ||
24 | #define GIODRV_IOCSGIODATA1 _IOW(GIODRV_IOC_MAGIC, 1, unsigned char *) | ||
25 | #define GIODRV_IOCGGIODATA1 _IOR(GIODRV_IOC_MAGIC, 2, unsigned char *) | ||
26 | #define GIODRV_IOCSGIODATA2 _IOW(GIODRV_IOC_MAGIC, 3, unsigned short *) | ||
27 | #define GIODRV_IOCGGIODATA2 _IOR(GIODRV_IOC_MAGIC, 4, unsigned short *) | ||
28 | #define GIODRV_IOCSGIODATA4 _IOW(GIODRV_IOC_MAGIC, 5, unsigned long *) | ||
29 | #define GIODRV_IOCGGIODATA4 _IOR(GIODRV_IOC_MAGIC, 6, unsigned long *) | ||
30 | #define GIODRV_IOCSGIOSETADDR _IOW(GIODRV_IOC_MAGIC, 7, unsigned long *) | ||
31 | #define GIODRV_IOCHARDRESET _IO(GIODRV_IOC_MAGIC, 8) /* debugging tool */ | ||
32 | |||
33 | #define GIODRV_IOCSGIO_LED _IOW(GIODRV_IOC_MAGIC, 9, unsigned long *) | ||
34 | #define GIODRV_IOCGGIO_LED _IOR(GIODRV_IOC_MAGIC, 10, unsigned long *) | ||
35 | #define GIODRV_IOCSGIO_BUZZER _IOW(GIODRV_IOC_MAGIC, 11, unsigned long *) | ||
36 | #define GIODRV_IOCGGIO_LANDISK _IOR(GIODRV_IOC_MAGIC, 14, unsigned long *) | ||
37 | #define GIODRV_IOCGGIO_BTN _IOR(GIODRV_IOC_MAGIC, 22, unsigned long *) | ||
38 | #define GIODRV_IOCSGIO_BTNPID _IOW(GIODRV_IOC_MAGIC, 23, unsigned long *) | ||
39 | #define GIODRV_IOCGGIO_BTNPID _IOR(GIODRV_IOC_MAGIC, 24, unsigned long *) | ||
40 | |||
41 | #define GIODRV_IOC_MAXNR 8 | ||
42 | #define GIO_READ 0x00000000 | ||
43 | #define GIO_WRITE 0x00000001 | ||
44 | |||
45 | #endif /* __ASM_SH_LANDISK_GIO_H */ | ||
diff --git a/include/asm-sh/landisk/ide.h b/include/asm-sh/landisk/ide.h new file mode 100644 index 000000000000..6490e28415ed --- /dev/null +++ b/include/asm-sh/landisk/ide.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * modifed by kogiidena | ||
3 | * 2005.03.03 | ||
4 | */ | ||
5 | |||
6 | #ifndef __ASM_SH_LANDISK_IDE_H | ||
7 | #define __ASM_SH_LANDISK_IDE_H | ||
8 | |||
9 | /* Nothing to see here.. */ | ||
10 | #include <asm/landisk/iodata_landisk.h> | ||
11 | #define IRQ_CFCARD IRQ_FATA /* CF Card IRQ */ | ||
12 | #define IRQ_PCMCIA IRQ_ATA /* PCMCIA IRQ */ | ||
13 | |||
14 | #endif /* __ASM_SH_LANDISK_IDE_H */ | ||
diff --git a/include/asm-sh/landisk/iodata_landisk.h b/include/asm-sh/landisk/iodata_landisk.h new file mode 100644 index 000000000000..c74d3c73f377 --- /dev/null +++ b/include/asm-sh/landisk/iodata_landisk.h | |||
@@ -0,0 +1,79 @@ | |||
1 | #ifndef __ASM_SH_IODATA_LANDISK_H | ||
2 | #define __ASM_SH_IODATA_LANDISK_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/asm-sh/landisk/iodata_landisk.h | ||
6 | * | ||
7 | * Copyright (C) 2000 Atom Create Engineering Co., Ltd. | ||
8 | * | ||
9 | * IO-DATA LANDISK support | ||
10 | */ | ||
11 | |||
12 | /* Box specific addresses. */ | ||
13 | |||
14 | #define PA_USB 0xa4000000 /* USB Controller M66590 */ | ||
15 | |||
16 | #define PA_ATARST 0xb0000000 /* ATA/FATA Access Control Register */ | ||
17 | #define PA_LED 0xb0000001 /* LED Control Register */ | ||
18 | #define PA_STATUS 0xb0000002 /* Switch Status Register */ | ||
19 | #define PA_SHUTDOWN 0xb0000003 /* Shutdown Control Register */ | ||
20 | #define PA_PCIPME 0xb0000004 /* PCI PME Status Register */ | ||
21 | #define PA_IMASK 0xb0000005 /* Interrupt Mask Register */ | ||
22 | /* 2003.10.31 I-O DATA NSD NWG add. for shutdown port clear */ | ||
23 | #define PA_PWRINT_CLR 0xb0000006 /* Shutdown Interrupt clear Register */ | ||
24 | |||
25 | #define PA_LCD_CLRDSP 0x00 /* LCD Clear Display Offset */ | ||
26 | #define PA_LCD_RTNHOME 0x00 /* LCD Return Home Offset */ | ||
27 | #define PA_LCD_ENTMODE 0x00 /* LCD Entry Mode Offset */ | ||
28 | #define PA_LCD_DSPCTL 0x00 /* LCD Display ON/OFF Control Offset */ | ||
29 | #define PA_LCD_FUNC 0x00 /* LCD Function Set Offset */ | ||
30 | #define PA_LCD_CGRAM 0x00 /* LCD Set CGRAM Address Offset */ | ||
31 | #define PA_LCD_DDRAM 0x00 /* LCD Set DDRAM Address Offset */ | ||
32 | #define PA_LCD_RDFLAG 0x01 /* LCD Read Busy Flag Offset */ | ||
33 | #define PA_LCD_WTDATA 0x02 /* LCD Write Datat to RAM Offset */ | ||
34 | #define PA_LCD_RDDATA 0x03 /* LCD Read Data from RAM Offset */ | ||
35 | #define PA_PIDE_OFFSET 0x40 /* CF IDE Offset */ | ||
36 | #define PA_SIDE_OFFSET 0x40 /* HDD IDE Offset */ | ||
37 | |||
38 | #define IRQ_PCIINTA 5 /* PCI INTA IRQ */ | ||
39 | #define IRQ_PCIINTB 6 /* PCI INTB IRQ */ | ||
40 | #define IRQ_PCIINDC 7 /* PCI INTC IRQ */ | ||
41 | #define IRQ_PCIINTD 8 /* PCI INTD IRQ */ | ||
42 | #define IRQ_ATA 9 /* ATA IRQ */ | ||
43 | #define IRQ_FATA 10 /* FATA IRQ */ | ||
44 | #define IRQ_POWER 11 /* Power Switch IRQ */ | ||
45 | #define IRQ_BUTTON 12 /* USL-5P Button IRQ */ | ||
46 | #define IRQ_FAULT 13 /* USL-5P Fault IRQ */ | ||
47 | |||
48 | #define SHUTDOWN_BTN_MAJOR 99 /* Shutdown button device major no. */ | ||
49 | |||
50 | #define SHUTDOWN_LOOP_CNT 5 /* Shutdown button Detection loop */ | ||
51 | #define SHUTDOWN_DELAY 200 /* Shutdown button delay value(ms) */ | ||
52 | |||
53 | |||
54 | /* added by kogiidena */ | ||
55 | /* | ||
56 | * landisk_ledparam | ||
57 | * | ||
58 | * led ------10 -6543210 -6543210 -6543210 | ||
59 | * |000000..|0.......|0.......|U.......| | ||
60 | * | HARD |fastblik| blink | on | | ||
61 | * | ||
62 | * led0: power U:update flag | ||
63 | * led1: error | ||
64 | * led2: usb1 | ||
65 | * led3: usb2 | ||
66 | * led4: usb3 | ||
67 | * led5: usb4 | ||
68 | * led6: usb5 | ||
69 | * | ||
70 | */ | ||
71 | extern int landisk_ledparam; /* from setup.c */ | ||
72 | extern int landisk_buzzerparam; /* from setup.c */ | ||
73 | extern int landisk_arch; /* from setup.c */ | ||
74 | |||
75 | #define __IO_PREFIX landisk | ||
76 | #include <asm/io_generic.h> | ||
77 | |||
78 | #endif /* __ASM_SH_IODATA_LANDISK_H */ | ||
79 | |||
diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h index 550501fa4fed..70389b72ffef 100644 --- a/include/asm-sh/machvec.h +++ b/include/asm-sh/machvec.h | |||
@@ -8,17 +8,18 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifndef _ASM_SH_MACHVEC_H | 10 | #ifndef _ASM_SH_MACHVEC_H |
11 | #define _ASM_SH_MACHVEC_H 1 | 11 | #define _ASM_SH_MACHVEC_H |
12 | 12 | ||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/time.h> | 14 | #include <linux/time.h> |
15 | |||
16 | #include <asm/machtypes.h> | 15 | #include <asm/machtypes.h> |
17 | #include <asm/machvec_init.h> | 16 | #include <asm/machvec_init.h> |
18 | 17 | ||
19 | struct device; | 18 | struct device; |
20 | 19 | ||
21 | struct sh_machine_vector { | 20 | struct sh_machine_vector { |
21 | void (*mv_setup)(char **cmdline_p); | ||
22 | const char *mv_name; | ||
22 | int mv_nr_irqs; | 23 | int mv_nr_irqs; |
23 | 24 | ||
24 | u8 (*mv_inb)(unsigned long); | 25 | u8 (*mv_inb)(unsigned long); |
@@ -65,4 +66,6 @@ struct sh_machine_vector { | |||
65 | 66 | ||
66 | extern struct sh_machine_vector sh_mv; | 67 | extern struct sh_machine_vector sh_mv; |
67 | 68 | ||
69 | #define get_system_type() sh_mv.mv_name | ||
70 | |||
68 | #endif /* _ASM_SH_MACHVEC_H */ | 71 | #endif /* _ASM_SH_MACHVEC_H */ |
diff --git a/include/asm-sh/mc146818rtc.h b/include/asm-sh/mc146818rtc.h index 1707cfb2915d..0aee96a97330 100644 --- a/include/asm-sh/mc146818rtc.h +++ b/include/asm-sh/mc146818rtc.h | |||
@@ -4,173 +4,4 @@ | |||
4 | #ifndef _ASM_MC146818RTC_H | 4 | #ifndef _ASM_MC146818RTC_H |
5 | #define _ASM_MC146818RTC_H | 5 | #define _ASM_MC146818RTC_H |
6 | 6 | ||
7 | #ifdef CONFIG_SH_MPC1211 | ||
8 | #undef _ASM_MC146818RTC_H | ||
9 | #undef RTC_IRQ | ||
10 | #include <asm/mpc1211/mc146818rtc.h> | ||
11 | #else | ||
12 | |||
13 | #include <asm/rtc.h> | ||
14 | |||
15 | #define RTC_ALWAYS_BCD 1 | ||
16 | |||
17 | /* FIXME:RTC Interrupt feature is not implemented yet. */ | ||
18 | #undef RTC_IRQ | ||
19 | #define RTC_IRQ 0 | ||
20 | |||
21 | #if defined(CONFIG_CPU_SH3) | ||
22 | #define RTC_PORT(n) (R64CNT+(n)*2) | ||
23 | #define CMOS_READ(addr) __CMOS_READ(addr,b) | ||
24 | #define CMOS_WRITE(val,addr) __CMOS_WRITE(val,addr,b) | ||
25 | |||
26 | #elif defined(CONFIG_SH_SECUREEDGE5410) | ||
27 | #include <asm/snapgear/io.h> | ||
28 | |||
29 | #define RTC_PORT(n) SECUREEDGE_IOPORT_ADDR | ||
30 | #define CMOS_READ(addr) secureedge5410_cmos_read(addr) | ||
31 | #define CMOS_WRITE(val,addr) secureedge5410_cmos_write(val,addr) | ||
32 | extern unsigned char secureedge5410_cmos_read(int addr); | ||
33 | extern void secureedge5410_cmos_write(unsigned char val, int addr); | ||
34 | |||
35 | #elif defined(CONFIG_CPU_SH4) | ||
36 | #define RTC_PORT(n) (R64CNT+(n)*4) | ||
37 | #define CMOS_READ(addr) __CMOS_READ(addr,w) | ||
38 | #define CMOS_WRITE(val,addr) __CMOS_WRITE(val,addr,w) | ||
39 | #endif | ||
40 | |||
41 | #define __CMOS_READ(addr, s) ({ \ | ||
42 | unsigned char val=0, rcr1, rcr2, r64cnt, retry; \ | ||
43 | switch(addr) { \ | ||
44 | case RTC_SECONDS: \ | ||
45 | val = ctrl_inb(RSECCNT); \ | ||
46 | break; \ | ||
47 | case RTC_SECONDS_ALARM: \ | ||
48 | val = ctrl_inb(RSECAR); \ | ||
49 | break; \ | ||
50 | case RTC_MINUTES: \ | ||
51 | val = ctrl_inb(RMINCNT); \ | ||
52 | break; \ | ||
53 | case RTC_MINUTES_ALARM: \ | ||
54 | val = ctrl_inb(RMINAR); \ | ||
55 | break; \ | ||
56 | case RTC_HOURS: \ | ||
57 | val = ctrl_inb(RHRCNT); \ | ||
58 | break; \ | ||
59 | case RTC_HOURS_ALARM: \ | ||
60 | val = ctrl_inb(RHRAR); \ | ||
61 | break; \ | ||
62 | case RTC_DAY_OF_WEEK: \ | ||
63 | val = ctrl_inb(RWKCNT); \ | ||
64 | break; \ | ||
65 | case RTC_DAY_OF_MONTH: \ | ||
66 | val = ctrl_inb(RDAYCNT); \ | ||
67 | break; \ | ||
68 | case RTC_MONTH: \ | ||
69 | val = ctrl_inb(RMONCNT); \ | ||
70 | break; \ | ||
71 | case RTC_YEAR: \ | ||
72 | val = ctrl_in##s(RYRCNT); \ | ||
73 | break; \ | ||
74 | case RTC_REG_A: /* RTC_FREQ_SELECT */ \ | ||
75 | rcr2 = ctrl_inb(RCR2); \ | ||
76 | val = (rcr2 & RCR2_PESMASK) >> 4; \ | ||
77 | rcr1 = ctrl_inb(RCR1); \ | ||
78 | rcr1 = (rcr1 & (RCR1_CIE | RCR1_AIE)) | RCR1_AF;\ | ||
79 | retry = 0; \ | ||
80 | do { \ | ||
81 | ctrl_outb(rcr1, RCR1); /* clear CF */ \ | ||
82 | r64cnt = ctrl_inb(R64CNT); \ | ||
83 | } while((ctrl_inb(RCR1) & RCR1_CF) && retry++ < 1000);\ | ||
84 | r64cnt ^= RTC_BIT_INVERTED; \ | ||
85 | if(r64cnt == 0x7f || r64cnt == 0) \ | ||
86 | val |= RTC_UIP; \ | ||
87 | break; \ | ||
88 | case RTC_REG_B: /* RTC_CONTROL */ \ | ||
89 | rcr1 = ctrl_inb(RCR1); \ | ||
90 | rcr2 = ctrl_inb(RCR2); \ | ||
91 | if(rcr1 & RCR1_CIE) val |= RTC_UIE; \ | ||
92 | if(rcr1 & RCR1_AIE) val |= RTC_AIE; \ | ||
93 | if(rcr2 & RCR2_PESMASK) val |= RTC_PIE; \ | ||
94 | if(!(rcr2 & RCR2_START))val |= RTC_SET; \ | ||
95 | val |= RTC_24H; \ | ||
96 | break; \ | ||
97 | case RTC_REG_C: /* RTC_INTR_FLAGS */ \ | ||
98 | rcr1 = ctrl_inb(RCR1); \ | ||
99 | rcr1 &= ~(RCR1_CF | RCR1_AF); \ | ||
100 | ctrl_outb(rcr1, RCR1); \ | ||
101 | rcr2 = ctrl_inb(RCR2); \ | ||
102 | rcr2 &= ~RCR2_PEF; \ | ||
103 | ctrl_outb(rcr2, RCR2); \ | ||
104 | break; \ | ||
105 | case RTC_REG_D: /* RTC_VALID */ \ | ||
106 | /* Always valid ... */ \ | ||
107 | val = RTC_VRT; \ | ||
108 | break; \ | ||
109 | default: \ | ||
110 | break; \ | ||
111 | } \ | ||
112 | val; \ | ||
113 | }) | ||
114 | |||
115 | #define __CMOS_WRITE(val, addr, s) ({ \ | ||
116 | unsigned char rcr1,rcr2; \ | ||
117 | switch(addr) { \ | ||
118 | case RTC_SECONDS: \ | ||
119 | ctrl_outb(val, RSECCNT); \ | ||
120 | break; \ | ||
121 | case RTC_SECONDS_ALARM: \ | ||
122 | ctrl_outb(val, RSECAR); \ | ||
123 | break; \ | ||
124 | case RTC_MINUTES: \ | ||
125 | ctrl_outb(val, RMINCNT); \ | ||
126 | break; \ | ||
127 | case RTC_MINUTES_ALARM: \ | ||
128 | ctrl_outb(val, RMINAR); \ | ||
129 | break; \ | ||
130 | case RTC_HOURS: \ | ||
131 | ctrl_outb(val, RHRCNT); \ | ||
132 | break; \ | ||
133 | case RTC_HOURS_ALARM: \ | ||
134 | ctrl_outb(val, RHRAR); \ | ||
135 | break; \ | ||
136 | case RTC_DAY_OF_WEEK: \ | ||
137 | ctrl_outb(val, RWKCNT); \ | ||
138 | break; \ | ||
139 | case RTC_DAY_OF_MONTH: \ | ||
140 | ctrl_outb(val, RDAYCNT); \ | ||
141 | break; \ | ||
142 | case RTC_MONTH: \ | ||
143 | ctrl_outb(val, RMONCNT); \ | ||
144 | break; \ | ||
145 | case RTC_YEAR: \ | ||
146 | ctrl_out##s((ctrl_in##s(RYRCNT) & 0xff00) | (val & 0xff), RYRCNT);\ | ||
147 | break; \ | ||
148 | case RTC_REG_A: /* RTC_FREQ_SELECT */ \ | ||
149 | rcr2 = ctrl_inb(RCR2); \ | ||
150 | if((val & RTC_DIV_CTL) == RTC_DIV_RESET2) \ | ||
151 | rcr2 |= RCR2_RESET; \ | ||
152 | ctrl_outb(rcr2, RCR2); \ | ||
153 | break; \ | ||
154 | case RTC_REG_B: /* RTC_CONTROL */ \ | ||
155 | rcr1 = (ctrl_inb(RCR1) & 0x99) | RCR1_AF; \ | ||
156 | if(val & RTC_AIE) rcr1 |= RCR1_AIE; \ | ||
157 | else rcr1 &= ~RCR1_AIE; \ | ||
158 | if(val & RTC_UIE) rcr1 |= RCR1_CIE; \ | ||
159 | else rcr1 &= ~RCR1_CIE; \ | ||
160 | ctrl_outb(rcr1, RCR1); \ | ||
161 | rcr2 = ctrl_inb(RCR2); \ | ||
162 | if(val & RTC_SET) rcr2 &= ~RCR2_START; \ | ||
163 | else rcr2 |= RCR2_START; \ | ||
164 | ctrl_outb(rcr2, RCR2); \ | ||
165 | break; \ | ||
166 | case RTC_REG_C: /* RTC_INTR_FLAGS */ \ | ||
167 | break; \ | ||
168 | case RTC_REG_D: /* RTC_VALID */ \ | ||
169 | break; \ | ||
170 | default: \ | ||
171 | break; \ | ||
172 | } \ | ||
173 | }) | ||
174 | |||
175 | #endif /* CONFIG_SH_MPC1211 */ | ||
176 | #endif /* _ASM_MC146818RTC_H */ | 7 | #endif /* _ASM_MC146818RTC_H */ |
diff --git a/include/asm-sh/mmu.h b/include/asm-sh/mmu.h index 72f07be6117f..cf47df79bb94 100644 --- a/include/asm-sh/mmu.h +++ b/include/asm-sh/mmu.h | |||
@@ -3,27 +3,76 @@ | |||
3 | 3 | ||
4 | #if !defined(CONFIG_MMU) | 4 | #if !defined(CONFIG_MMU) |
5 | 5 | ||
6 | struct mm_rblock_struct { | ||
7 | int size; | ||
8 | int refcount; | ||
9 | void *kblock; | ||
10 | }; | ||
11 | |||
12 | struct mm_tblock_struct { | ||
13 | struct mm_rblock_struct *rblock; | ||
14 | struct mm_tblock_struct *next; | ||
15 | }; | ||
16 | |||
17 | typedef struct { | 6 | typedef struct { |
18 | struct mm_tblock_struct tblock; | 7 | struct vm_list_struct *vmlist; |
19 | unsigned long end_brk; | 8 | unsigned long end_brk; |
20 | } mm_context_t; | 9 | } mm_context_t; |
21 | 10 | ||
22 | #else | 11 | #else |
23 | 12 | ||
24 | /* Default "unsigned long" context */ | 13 | /* Default "unsigned long" context */ |
25 | typedef unsigned long mm_context_t; | 14 | typedef unsigned long mm_context_id_t; |
15 | |||
16 | typedef struct { | ||
17 | mm_context_id_t id; | ||
18 | void *vdso; | ||
19 | } mm_context_t; | ||
26 | 20 | ||
27 | #endif /* CONFIG_MMU */ | 21 | #endif /* CONFIG_MMU */ |
28 | #endif /* __MMH_H */ | 22 | |
23 | /* | ||
24 | * Privileged Space Mapping Buffer (PMB) definitions | ||
25 | */ | ||
26 | #define PMB_PASCR 0xff000070 | ||
27 | #define PMB_IRMCR 0xff000078 | ||
28 | |||
29 | #define PMB_ADDR 0xf6100000 | ||
30 | #define PMB_DATA 0xf7100000 | ||
31 | #define PMB_ENTRY_MAX 16 | ||
32 | #define PMB_E_MASK 0x0000000f | ||
33 | #define PMB_E_SHIFT 8 | ||
34 | |||
35 | #define PMB_SZ_16M 0x00000000 | ||
36 | #define PMB_SZ_64M 0x00000010 | ||
37 | #define PMB_SZ_128M 0x00000080 | ||
38 | #define PMB_SZ_512M 0x00000090 | ||
39 | #define PMB_SZ_MASK PMB_SZ_512M | ||
40 | #define PMB_C 0x00000008 | ||
41 | #define PMB_WT 0x00000001 | ||
42 | #define PMB_UB 0x00000200 | ||
43 | #define PMB_V 0x00000100 | ||
44 | |||
45 | #define PMB_NO_ENTRY (-1) | ||
46 | |||
47 | struct pmb_entry; | ||
48 | |||
49 | struct pmb_entry { | ||
50 | unsigned long vpn; | ||
51 | unsigned long ppn; | ||
52 | unsigned long flags; | ||
53 | |||
54 | /* | ||
55 | * 0 .. NR_PMB_ENTRIES for specific entry selection, or | ||
56 | * PMB_NO_ENTRY to search for a free one | ||
57 | */ | ||
58 | int entry; | ||
59 | |||
60 | struct pmb_entry *next; | ||
61 | /* Adjacent entry link for contiguous multi-entry mappings */ | ||
62 | struct pmb_entry *link; | ||
63 | }; | ||
64 | |||
65 | /* arch/sh/mm/pmb.c */ | ||
66 | int __set_pmb_entry(unsigned long vpn, unsigned long ppn, | ||
67 | unsigned long flags, int *entry); | ||
68 | int set_pmb_entry(struct pmb_entry *pmbe); | ||
69 | void clear_pmb_entry(struct pmb_entry *pmbe); | ||
70 | struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn, | ||
71 | unsigned long flags); | ||
72 | void pmb_free(struct pmb_entry *pmbe); | ||
73 | long pmb_remap(unsigned long virt, unsigned long phys, | ||
74 | unsigned long size, unsigned long flags); | ||
75 | void pmb_unmap(unsigned long addr); | ||
76 | |||
77 | #endif /* __MMU_H */ | ||
29 | 78 | ||
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h index 6760d064bd02..c7088efe579a 100644 --- a/include/asm-sh/mmu_context.h +++ b/include/asm-sh/mmu_context.h | |||
@@ -49,7 +49,7 @@ get_mmu_context(struct mm_struct *mm) | |||
49 | unsigned long mc = mmu_context_cache; | 49 | unsigned long mc = mmu_context_cache; |
50 | 50 | ||
51 | /* Check if we have old version of context. */ | 51 | /* Check if we have old version of context. */ |
52 | if (((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0) | 52 | if (((mm->context.id ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0) |
53 | /* It's up to date, do nothing */ | 53 | /* It's up to date, do nothing */ |
54 | return; | 54 | return; |
55 | 55 | ||
@@ -68,7 +68,7 @@ get_mmu_context(struct mm_struct *mm) | |||
68 | if (!mc) | 68 | if (!mc) |
69 | mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; | 69 | mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; |
70 | } | 70 | } |
71 | mm->context = mc; | 71 | mm->context.id = mc; |
72 | } | 72 | } |
73 | 73 | ||
74 | /* | 74 | /* |
@@ -78,7 +78,7 @@ get_mmu_context(struct mm_struct *mm) | |||
78 | static __inline__ int init_new_context(struct task_struct *tsk, | 78 | static __inline__ int init_new_context(struct task_struct *tsk, |
79 | struct mm_struct *mm) | 79 | struct mm_struct *mm) |
80 | { | 80 | { |
81 | mm->context = NO_CONTEXT; | 81 | mm->context.id = NO_CONTEXT; |
82 | 82 | ||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
@@ -123,7 +123,7 @@ static __inline__ unsigned long get_asid(void) | |||
123 | static __inline__ void activate_context(struct mm_struct *mm) | 123 | static __inline__ void activate_context(struct mm_struct *mm) |
124 | { | 124 | { |
125 | get_mmu_context(mm); | 125 | get_mmu_context(mm); |
126 | set_asid(mm->context & MMU_CONTEXT_ASID_MASK); | 126 | set_asid(mm->context.id & MMU_CONTEXT_ASID_MASK); |
127 | } | 127 | } |
128 | 128 | ||
129 | /* MMU_TTB can be used for optimizing the fault handling. | 129 | /* MMU_TTB can be used for optimizing the fault handling. |
@@ -174,9 +174,7 @@ static inline void enable_mmu(void) | |||
174 | { | 174 | { |
175 | /* Enable MMU */ | 175 | /* Enable MMU */ |
176 | ctrl_outl(MMU_CONTROL_INIT, MMUCR); | 176 | ctrl_outl(MMU_CONTROL_INIT, MMUCR); |
177 | 177 | ctrl_barrier(); | |
178 | /* The manual suggests doing some nops after turning on the MMU */ | ||
179 | __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop\n\t"); | ||
180 | 178 | ||
181 | if (mmu_context_cache == NO_CONTEXT) | 179 | if (mmu_context_cache == NO_CONTEXT) |
182 | mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; | 180 | mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; |
@@ -191,7 +189,8 @@ static inline void disable_mmu(void) | |||
191 | cr = ctrl_inl(MMUCR); | 189 | cr = ctrl_inl(MMUCR); |
192 | cr &= ~MMU_CONTROL_INIT; | 190 | cr &= ~MMU_CONTROL_INIT; |
193 | ctrl_outl(cr, MMUCR); | 191 | ctrl_outl(cr, MMUCR); |
194 | __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop\n\t"); | 192 | |
193 | ctrl_barrier(); | ||
195 | } | 194 | } |
196 | #else | 195 | #else |
197 | /* | 196 | /* |
diff --git a/include/asm-sh/overdrive/fpga.h b/include/asm-sh/overdrive/fpga.h deleted file mode 100644 index 1cd87992c124..000000000000 --- a/include/asm-sh/overdrive/fpga.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 David J. Mckay (david.mckay@st.com) | ||
3 | * | ||
4 | * May be copied or modified under the terms of the GNU General Public | ||
5 | * License. See linux/COPYING for more information. | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef __FPGA_OD_H__ | ||
10 | #define __FPGA_OD_H__ | ||
11 | |||
12 | /* This routine will program up the fpga which interfaces to the galileo */ | ||
13 | int init_overdrive_fpga(void); | ||
14 | |||
15 | #endif | ||
diff --git a/include/asm-sh/overdrive/gt64111.h b/include/asm-sh/overdrive/gt64111.h deleted file mode 100644 index 01d58bc13a44..000000000000 --- a/include/asm-sh/overdrive/gt64111.h +++ /dev/null | |||
@@ -1,109 +0,0 @@ | |||
1 | #ifndef _GT64111_H_ | ||
2 | #define _GT64111_H_ | ||
3 | |||
4 | #define MASTER_INTERFACE 0x0 | ||
5 | #define RAS10_LO_DEC_ADR 0x8 | ||
6 | #define RAS10_HI_DEC_ADR 0x10 | ||
7 | #define RAS32_LO_DEC_ADR 0x18 | ||
8 | #define RAS32_HI_DEC_ADR 0x20 | ||
9 | #define CS20_LO_DEC_ADR 0x28 | ||
10 | #define CS20_HI_DEC_ADR 0x30 | ||
11 | #define CS3_LO_DEC_ADR 0x38 | ||
12 | #define CS3_HI_DEC_ADR 0x40 | ||
13 | #define PCI_IO_LO_DEC_ADR 0x48 | ||
14 | #define PCI_IO_HI_DEC_ADR 0x50 | ||
15 | #define PCI_MEM0_LO_DEC_ADR 0x58 | ||
16 | #define PCI_MEM0_HI_DEC_ADR 0x60 | ||
17 | #define INTERNAL_SPACE_DEC 0x68 | ||
18 | #define BUS_ERR_ADR_LO_CPU 0x70 | ||
19 | #define READONLY0 0x78 | ||
20 | #define PCI_MEM1_LO_DEC_ADR 0x80 | ||
21 | #define PCI_MEM1_HI_DEC_ADR 0x88 | ||
22 | #define RAS0_LO_DEC_ADR 0x400 | ||
23 | #define RAS0_HI_DEC_ADR 0x404 | ||
24 | #define RAS1_LO_DEC_ADR 0x408 | ||
25 | #define RAS1_HI_DEC_ADR 0x40c | ||
26 | #define RAS2_LO_DEC_ADR 0x410 | ||
27 | #define RAS2_HI_DEC_ADR 0x414 | ||
28 | #define RAS3_LO_DEC_ADR 0x418 | ||
29 | #define RAS3_HI_DEC_ADR 0x41c | ||
30 | #define DEV_CS0_LO_DEC_ADR 0x420 | ||
31 | #define DEV_CS0_HI_DEC_ADR 0x424 | ||
32 | #define DEV_CS1_LO_DEC_ADR 0x428 | ||
33 | #define DEV_CS1_HI_DEC_ADR 0x42c | ||
34 | #define DEV_CS2_LO_DEC_ADR 0x430 | ||
35 | #define DEV_CS2_HI_DEC_ADR 0x434 | ||
36 | #define DEV_CS3_LO_DEC_ADR 0x438 | ||
37 | #define DEV_CS3_HI_DEC_ADR 0x43c | ||
38 | #define DEV_BOOTCS_LO_DEC_ADR 0x440 | ||
39 | #define DEV_BOOTCS_HI_DEC_ADR 0x444 | ||
40 | #define DEV_ADR_DEC_ERR 0x470 | ||
41 | #define DRAM_CFG 0x448 | ||
42 | #define DRAM_BANK0_PARMS 0x44c | ||
43 | #define DRAM_BANK1_PARMS 0x450 | ||
44 | #define DRAM_BANK2_PARMS 0x454 | ||
45 | #define DRAM_BANK3_PARMS 0x458 | ||
46 | #define DEV_BANK0_PARMS 0x45c | ||
47 | #define DEV_BANK1_PARMS 0x460 | ||
48 | #define DEV_BANK2_PARMS 0x464 | ||
49 | #define DEV_BANK3_PARMS 0x468 | ||
50 | #define DEV_BOOT_BANK_PARMS 0x46c | ||
51 | #define CH0_DMA_BYTECOUNT 0x800 | ||
52 | #define CH1_DMA_BYTECOUNT 0x804 | ||
53 | #define CH2_DMA_BYTECOUNT 0x808 | ||
54 | #define CH3_DMA_BYTECOUNT 0x80c | ||
55 | #define CH0_DMA_SRC_ADR 0x810 | ||
56 | #define CH1_DMA_SRC_ADR 0x814 | ||
57 | #define CH2_DMA_SRC_ADR 0x818 | ||
58 | #define CH3_DMA_SRC_ADR 0x81c | ||
59 | #define CH0_DMA_DST_ADR 0x820 | ||
60 | #define CH1_DMA_DST_ADR 0x824 | ||
61 | #define CH2_DMA_DST_ADR 0x828 | ||
62 | #define CH3_DMA_DST_ADR 0x82c | ||
63 | #define CH0_NEXT_REC_PTR 0x830 | ||
64 | #define CH1_NEXT_REC_PTR 0x834 | ||
65 | #define CH2_NEXT_REC_PTR 0x838 | ||
66 | #define CH3_NEXT_REC_PTR 0x83c | ||
67 | #define CH0_CTRL 0x840 | ||
68 | #define CH1_CTRL 0x844 | ||
69 | #define CH2_CTRL 0x848 | ||
70 | #define CH3_CTRL 0x84c | ||
71 | #define DMA_ARBITER 0x860 | ||
72 | #define TIMER0 0x850 | ||
73 | #define TIMER1 0x854 | ||
74 | #define TIMER2 0x858 | ||
75 | #define TIMER3 0x85c | ||
76 | #define TIMER_CTRL 0x864 | ||
77 | #define PCI_CMD 0xc00 | ||
78 | #define PCI_TIMEOUT 0xc04 | ||
79 | #define PCI_RAS10_BANK_SIZE 0xc08 | ||
80 | #define PCI_RAS32_BANK_SIZE 0xc0c | ||
81 | #define PCI_CS20_BANK_SIZE 0xc10 | ||
82 | #define PCI_CS3_BANK_SIZE 0xc14 | ||
83 | #define PCI_SERRMASK 0xc28 | ||
84 | #define PCI_INTACK 0xc34 | ||
85 | #define PCI_BAR_EN 0xc3c | ||
86 | #define PCI_CFG_ADR 0xcf8 | ||
87 | #define PCI_CFG_DATA 0xcfc | ||
88 | #define PCI_INTCAUSE 0xc18 | ||
89 | #define PCI_MAST_MASK 0xc1c | ||
90 | #define PCI_PCIMASK 0xc24 | ||
91 | #define BAR_ENABLE_ADR 0xc3c | ||
92 | |||
93 | /* These are config registers, accessible via PCI space */ | ||
94 | #define PCI_CONFIG_RAS10_BASE_ADR 0x010 | ||
95 | #define PCI_CONFIG_RAS32_BASE_ADR 0x014 | ||
96 | #define PCI_CONFIG_CS20_BASE_ADR 0x018 | ||
97 | #define PCI_CONFIG_CS3_BASE_ADR 0x01c | ||
98 | #define PCI_CONFIG_INT_REG_MM_ADR 0x020 | ||
99 | #define PCI_CONFIG_INT_REG_IO_ADR 0x024 | ||
100 | #define PCI_CONFIG_BOARD_VENDOR 0x02c | ||
101 | #define PCI_CONFIG_ROM_ADR 0x030 | ||
102 | #define PCI_CONFIG_INT_PIN_LINE 0x03c | ||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | #endif | ||
109 | |||
diff --git a/include/asm-sh/overdrive/io.h b/include/asm-sh/overdrive/io.h deleted file mode 100644 index 0dba700e9643..000000000000 --- a/include/asm-sh/overdrive/io.h +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/io_od.h | ||
3 | * | ||
4 | * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * IO functions for an STMicroelectronics Overdrive | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SH_IO_OD_H | ||
13 | #define _ASM_SH_IO_OD_H | ||
14 | |||
15 | extern unsigned char od_inb(unsigned long port); | ||
16 | extern unsigned short od_inw(unsigned long port); | ||
17 | extern unsigned int od_inl(unsigned long port); | ||
18 | |||
19 | extern void od_outb(unsigned char value, unsigned long port); | ||
20 | extern void od_outw(unsigned short value, unsigned long port); | ||
21 | extern void od_outl(unsigned int value, unsigned long port); | ||
22 | |||
23 | extern unsigned char od_inb_p(unsigned long port); | ||
24 | extern unsigned short od_inw_p(unsigned long port); | ||
25 | extern unsigned int od_inl_p(unsigned long port); | ||
26 | extern void od_outb_p(unsigned char value, unsigned long port); | ||
27 | extern void od_outw_p(unsigned short value, unsigned long port); | ||
28 | extern void od_outl_p(unsigned int value, unsigned long port); | ||
29 | |||
30 | extern void od_insb(unsigned long port, void *addr, unsigned long count); | ||
31 | extern void od_insw(unsigned long port, void *addr, unsigned long count); | ||
32 | extern void od_insl(unsigned long port, void *addr, unsigned long count); | ||
33 | extern void od_outsb(unsigned long port, const void *addr, unsigned long count); | ||
34 | extern void od_outsw(unsigned long port, const void *addr, unsigned long count); | ||
35 | extern void od_outsl(unsigned long port, const void *addr, unsigned long count); | ||
36 | |||
37 | extern unsigned long od_isa_port2addr(unsigned long offset); | ||
38 | |||
39 | #endif /* _ASM_SH_IO_OD_H */ | ||
diff --git a/include/asm-sh/overdrive/overdrive.h b/include/asm-sh/overdrive/overdrive.h deleted file mode 100644 index fc746c244f83..000000000000 --- a/include/asm-sh/overdrive/overdrive.h +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 David J. Mckay (david.mckay@st.com) | ||
3 | * | ||
4 | * May be copied or modified under the terms of the GNU General Public | ||
5 | * License. See linux/COPYING for more information. | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | |||
10 | #ifndef __OVERDRIVE_H__ | ||
11 | #define __OVERDRIVE_H__ | ||
12 | |||
13 | #define OVERDRIVE_INT_CT 0xa3a00000 | ||
14 | #define OVERDRIVE_INT_DT 0xa3b00000 | ||
15 | |||
16 | #define OVERDRIVE_CTRL 0xa3000000 | ||
17 | |||
18 | /* Shoving all these bits into the same register is not a good idea. | ||
19 | * As soon as I get a spare moment, I'll change the FPGA and put each | ||
20 | * bit in a separate register | ||
21 | */ | ||
22 | |||
23 | #define VALID_CTRL_BITS 0x1f | ||
24 | |||
25 | #define ENABLE_RS232_MASK 0x1e | ||
26 | #define DISABLE_RS232_BIT 0x01 | ||
27 | |||
28 | #define ENABLE_NMI_MASK 0x1d | ||
29 | #define DISABLE_NMI_BIT 0x02 | ||
30 | |||
31 | #define RESET_PCI_MASK 0x1b | ||
32 | #define ENABLE_PCI_BIT 0x04 | ||
33 | |||
34 | #define ENABLE_LED_MASK 0x17 | ||
35 | #define DISABLE_LED_BIT 0x08 | ||
36 | |||
37 | #define RESET_FPGA_MASK 0x0f | ||
38 | #define ENABLE_FPGA_BIT 0x10 | ||
39 | |||
40 | |||
41 | #define FPGA_DCLK_ADDRESS 0xA3C00000 | ||
42 | |||
43 | #define FPGA_DATA 0x01 /* W */ | ||
44 | #define FPGA_CONFDONE 0x02 /* R */ | ||
45 | #define FPGA_NOT_STATUS 0x04 /* R */ | ||
46 | #define FPGA_INITDONE 0x08 /* R */ | ||
47 | |||
48 | #define FPGA_TIMEOUT 100000 | ||
49 | |||
50 | |||
51 | /* Interrupts for the overdrive. Note that these numbers have | ||
52 | * nothing to do with the actual IRQ numbers they appear on, | ||
53 | * this is all programmable. This is simply the position in the | ||
54 | * INT_CT register. | ||
55 | */ | ||
56 | |||
57 | #define OVERDRIVE_PCI_INTA 0 | ||
58 | #define OVERDRIVE_PCI_INTB 1 | ||
59 | #define OVERDRIVE_PCI_INTC 2 | ||
60 | #define OVERDRIVE_PCI_INTD 3 | ||
61 | #define OVERDRIVE_GALILEO_INT 4 | ||
62 | #define OVERDRIVE_GALILEO_LOCAL_INT 5 | ||
63 | #define OVERDRIVE_AUDIO_INT 6 | ||
64 | #define OVERDRIVE_KEYBOARD_INT 7 | ||
65 | |||
66 | /* Which Linux IRQ should we assign to each interrupt source? */ | ||
67 | #define OVERDRIVE_PCI_IRQ1 2 | ||
68 | #ifdef CONFIG_HACKED_NE2K | ||
69 | #define OVERDRIVE_PCI_IRQ2 7 | ||
70 | #else | ||
71 | #define OVERDRIVE_PCI_IRQ2 2 | ||
72 | #undef OVERDRIVE_PCI_INTB | ||
73 | #define OVERDRIVE_PCI_INTB OVERDRIVE_PCI_INTA | ||
74 | |||
75 | #endif | ||
76 | |||
77 | /* Put the ESS solo audio chip on IRQ 4 */ | ||
78 | #define OVERDRIVE_ESS_IRQ 4 | ||
79 | |||
80 | /* Where the memory behind the PCI bus appears */ | ||
81 | #define PCI_DRAM_BASE 0xb7000000 | ||
82 | #define PCI_DRAM_SIZE (16*1024*1024) | ||
83 | #define PCI_DRAM_FINISH (PCI_DRAM_BASE+PCI_DRAM_SIZE-1) | ||
84 | |||
85 | /* Where the IO region appears in the memory */ | ||
86 | #define PCI_GTIO_BASE 0xb8000000 | ||
87 | |||
88 | #endif | ||
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 6f7eb8a3aba5..ca8b26d90475 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h | |||
@@ -16,7 +16,13 @@ | |||
16 | 16 | ||
17 | /* PAGE_SHIFT determines the page size */ | 17 | /* PAGE_SHIFT determines the page size */ |
18 | #define PAGE_SHIFT 12 | 18 | #define PAGE_SHIFT 12 |
19 | |||
20 | #ifdef __ASSEMBLY__ | ||
21 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
22 | #else | ||
19 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | 23 | #define PAGE_SIZE (1UL << PAGE_SHIFT) |
24 | #endif | ||
25 | |||
20 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 26 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
21 | #define PTE_MASK PAGE_MASK | 27 | #define PTE_MASK PAGE_MASK |
22 | 28 | ||
@@ -30,7 +36,6 @@ | |||
30 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) | 36 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) |
31 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) | 37 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) |
32 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) | 38 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) |
33 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
34 | #endif | 39 | #endif |
35 | 40 | ||
36 | #ifdef __KERNEL__ | 41 | #ifdef __KERNEL__ |
@@ -39,10 +44,18 @@ | |||
39 | extern void (*clear_page)(void *to); | 44 | extern void (*clear_page)(void *to); |
40 | extern void (*copy_page)(void *to, void *from); | 45 | extern void (*copy_page)(void *to, void *from); |
41 | 46 | ||
47 | extern unsigned long shm_align_mask; | ||
48 | |||
49 | #ifdef CONFIG_MMU | ||
42 | extern void clear_page_slow(void *to); | 50 | extern void clear_page_slow(void *to); |
43 | extern void copy_page_slow(void *to, void *from); | 51 | extern void copy_page_slow(void *to, void *from); |
52 | #else | ||
53 | extern void clear_page_nommu(void *to); | ||
54 | extern void copy_page_nommu(void *to, void *from); | ||
55 | #endif | ||
44 | 56 | ||
45 | #if defined(CONFIG_SH7705_CACHE_32KB) && defined(CONFIG_MMU) | 57 | #if defined(CONFIG_MMU) && (defined(CONFIG_CPU_SH4) || \ |
58 | defined(CONFIG_SH7705_CACHE_32KB)) | ||
46 | struct page; | 59 | struct page; |
47 | extern void clear_user_page(void *to, unsigned long address, struct page *pg); | 60 | extern void clear_user_page(void *to, unsigned long address, struct page *pg); |
48 | extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg); | 61 | extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg); |
@@ -51,29 +64,20 @@ extern void __copy_user_page(void *to, void *from, void *orig_to); | |||
51 | #elif defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH3) || !defined(CONFIG_MMU) | 64 | #elif defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH3) || !defined(CONFIG_MMU) |
52 | #define clear_user_page(page, vaddr, pg) clear_page(page) | 65 | #define clear_user_page(page, vaddr, pg) clear_page(page) |
53 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | 66 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) |
54 | #elif defined(CONFIG_CPU_SH4) | ||
55 | struct page; | ||
56 | extern void clear_user_page(void *to, unsigned long address, struct page *pg); | ||
57 | extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg); | ||
58 | extern void __clear_user_page(void *to, void *orig_to); | ||
59 | extern void __copy_user_page(void *to, void *from, void *orig_to); | ||
60 | #endif | 67 | #endif |
61 | 68 | ||
62 | /* | 69 | /* |
63 | * These are used to make use of C type-checking.. | 70 | * These are used to make use of C type-checking.. |
64 | */ | 71 | */ |
65 | typedef struct { unsigned long pte; } pte_t; | 72 | typedef struct { unsigned long pte; } pte_t; |
66 | typedef struct { unsigned long pmd; } pmd_t; | ||
67 | typedef struct { unsigned long pgd; } pgd_t; | 73 | typedef struct { unsigned long pgd; } pgd_t; |
68 | typedef struct { unsigned long pgprot; } pgprot_t; | 74 | typedef struct { unsigned long pgprot; } pgprot_t; |
69 | 75 | ||
70 | #define pte_val(x) ((x).pte) | 76 | #define pte_val(x) ((x).pte) |
71 | #define pmd_val(x) ((x).pmd) | ||
72 | #define pgd_val(x) ((x).pgd) | 77 | #define pgd_val(x) ((x).pgd) |
73 | #define pgprot_val(x) ((x).pgprot) | 78 | #define pgprot_val(x) ((x).pgprot) |
74 | 79 | ||
75 | #define __pte(x) ((pte_t) { (x) } ) | 80 | #define __pte(x) ((pte_t) { (x) } ) |
76 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
77 | #define __pgd(x) ((pgd_t) { (x) } ) | 81 | #define __pgd(x) ((pgd_t) { (x) } ) |
78 | #define __pgprot(x) ((pgprot_t) { (x) } ) | 82 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
79 | 83 | ||
@@ -93,7 +97,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
93 | #define __MEMORY_START CONFIG_MEMORY_START | 97 | #define __MEMORY_START CONFIG_MEMORY_START |
94 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE | 98 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE |
95 | 99 | ||
96 | #define PAGE_OFFSET (0x80000000UL) | 100 | #define PAGE_OFFSET CONFIG_PAGE_OFFSET |
97 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | 101 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) |
98 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 102 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
99 | 103 | ||
@@ -115,5 +119,10 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
115 | #include <asm-generic/memory_model.h> | 119 | #include <asm-generic/memory_model.h> |
116 | #include <asm-generic/page.h> | 120 | #include <asm-generic/page.h> |
117 | 121 | ||
122 | /* vDSO support */ | ||
123 | #ifdef CONFIG_VSYSCALL | ||
124 | #define __HAVE_ARCH_GATE_AREA | ||
125 | #endif | ||
126 | |||
118 | #endif /* __KERNEL__ */ | 127 | #endif /* __KERNEL__ */ |
119 | #endif /* __ASM_SH_PAGE_H */ | 128 | #endif /* __ASM_SH_PAGE_H */ |
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h index 0a523c85b11c..6ccc948fe216 100644 --- a/include/asm-sh/pci.h +++ b/include/asm-sh/pci.h | |||
@@ -32,6 +32,34 @@ extern struct pci_channel board_pci_channels[]; | |||
32 | #define PCIBIOS_MIN_IO board_pci_channels->io_resource->start | 32 | #define PCIBIOS_MIN_IO board_pci_channels->io_resource->start |
33 | #define PCIBIOS_MIN_MEM board_pci_channels->mem_resource->start | 33 | #define PCIBIOS_MIN_MEM board_pci_channels->mem_resource->start |
34 | 34 | ||
35 | /* | ||
36 | * I/O routine helpers | ||
37 | */ | ||
38 | #ifdef CONFIG_CPU_SUBTYPE_SH7780 | ||
39 | #define PCI_IO_AREA 0xFE400000 | ||
40 | #define PCI_IO_SIZE 0x00400000 | ||
41 | #else | ||
42 | #define PCI_IO_AREA 0xFE240000 | ||
43 | #define PCI_IO_SIZE 0X00040000 | ||
44 | #endif | ||
45 | |||
46 | #define PCI_MEM_SIZE 0x01000000 | ||
47 | |||
48 | #define SH4_PCIIOBR_MASK 0xFFFC0000 | ||
49 | #define pci_ioaddr(addr) (PCI_IO_AREA + (addr & ~SH4_PCIIOBR_MASK)) | ||
50 | |||
51 | #if defined(CONFIG_PCI) | ||
52 | #define is_pci_ioaddr(port) \ | ||
53 | (((port) >= PCIBIOS_MIN_IO) && \ | ||
54 | ((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE))) | ||
55 | #define is_pci_memaddr(port) \ | ||
56 | (((port) >= PCIBIOS_MIN_MEM) && \ | ||
57 | ((port) < (PCIBIOS_MIN_MEM + PCI_MEM_SIZE))) | ||
58 | #else | ||
59 | #define is_pci_ioaddr(port) (0) | ||
60 | #define is_pci_memaddr(port) (0) | ||
61 | #endif | ||
62 | |||
35 | struct pci_dev; | 63 | struct pci_dev; |
36 | 64 | ||
37 | extern void pcibios_set_master(struct pci_dev *dev); | 65 | extern void pcibios_set_master(struct pci_dev *dev); |
@@ -87,15 +115,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active) | |||
87 | */ | 115 | */ |
88 | #define pci_dac_dma_supported(pci_dev, mask) (0) | 116 | #define pci_dac_dma_supported(pci_dev, mask) (0) |
89 | 117 | ||
90 | /* These macros should be used after a pci_map_sg call has been done | ||
91 | * to get bus addresses of each of the SG entries and their lengths. | ||
92 | * You should only work with the number of sg entries pci_map_sg | ||
93 | * returns, or alternatively stop on the first sg_dma_len(sg) which | ||
94 | * is 0. | ||
95 | */ | ||
96 | #define sg_dma_address(sg) (virt_to_bus((sg)->dma_address)) | ||
97 | #define sg_dma_len(sg) ((sg)->length) | ||
98 | |||
99 | #ifdef CONFIG_PCI | 118 | #ifdef CONFIG_PCI |
100 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | 119 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
101 | enum pci_dma_burst_strategy *strat, | 120 | enum pci_dma_burst_strategy *strat, |
@@ -107,11 +126,12 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
107 | #endif | 126 | #endif |
108 | 127 | ||
109 | /* Board-specific fixup routines. */ | 128 | /* Board-specific fixup routines. */ |
110 | extern void pcibios_fixup(void); | 129 | void pcibios_fixup(void); |
111 | extern void pcibios_fixup_irqs(void); | 130 | int pcibios_init_platform(void); |
131 | int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin); | ||
112 | 132 | ||
113 | #ifdef CONFIG_PCI_AUTO | 133 | #ifdef CONFIG_PCI_AUTO |
114 | extern int pciauto_assign_resources(int busno, struct pci_channel *hose); | 134 | int pciauto_assign_resources(int busno, struct pci_channel *hose); |
115 | #endif | 135 | #endif |
116 | 136 | ||
117 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | 137 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) |
diff --git a/include/asm-sh/pgalloc.h b/include/asm-sh/pgalloc.h index f4f233f7a4f5..e841465ab4d2 100644 --- a/include/asm-sh/pgalloc.h +++ b/include/asm-sh/pgalloc.h | |||
@@ -1,15 +1,6 @@ | |||
1 | #ifndef __ASM_SH_PGALLOC_H | 1 | #ifndef __ASM_SH_PGALLOC_H |
2 | #define __ASM_SH_PGALLOC_H | 2 | #define __ASM_SH_PGALLOC_H |
3 | 3 | ||
4 | #include <linux/threads.h> | ||
5 | #include <linux/slab.h> | ||
6 | #include <linux/mm.h> | ||
7 | |||
8 | #define pgd_quicklist ((unsigned long *)0) | ||
9 | #define pmd_quicklist ((unsigned long *)0) | ||
10 | #define pte_quicklist ((unsigned long *)0) | ||
11 | #define pgtable_cache_size 0L | ||
12 | |||
13 | #define pmd_populate_kernel(mm, pmd, pte) \ | 4 | #define pmd_populate_kernel(mm, pmd, pte) \ |
14 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) | 5 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) |
15 | 6 | ||
@@ -24,38 +15,24 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
24 | */ | 15 | */ |
25 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 16 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
26 | { | 17 | { |
27 | unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); | 18 | return (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); |
28 | pgd_t *pgd = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL); | ||
29 | |||
30 | if (pgd) | ||
31 | memset(pgd, 0, pgd_size); | ||
32 | |||
33 | return pgd; | ||
34 | } | 19 | } |
35 | 20 | ||
36 | static inline void pgd_free(pgd_t *pgd) | 21 | static inline void pgd_free(pgd_t *pgd) |
37 | { | 22 | { |
38 | kfree(pgd); | 23 | free_page((unsigned long)pgd); |
39 | } | 24 | } |
40 | 25 | ||
41 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 26 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
42 | unsigned long address) | 27 | unsigned long address) |
43 | { | 28 | { |
44 | pte_t *pte; | 29 | return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); |
45 | |||
46 | pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); | ||
47 | |||
48 | return pte; | ||
49 | } | 30 | } |
50 | 31 | ||
51 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 32 | static inline struct page *pte_alloc_one(struct mm_struct *mm, |
52 | unsigned long address) | 33 | unsigned long address) |
53 | { | 34 | { |
54 | struct page *pte; | 35 | return alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); |
55 | |||
56 | pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); | ||
57 | |||
58 | return pte; | ||
59 | } | 36 | } |
60 | 37 | ||
61 | static inline void pte_free_kernel(pte_t *pte) | 38 | static inline void pte_free_kernel(pte_t *pte) |
@@ -75,14 +52,8 @@ static inline void pte_free(struct page *pte) | |||
75 | * inside the pgd, so has no extra memory associated with it. | 52 | * inside the pgd, so has no extra memory associated with it. |
76 | */ | 53 | */ |
77 | 54 | ||
78 | #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) | ||
79 | #define pmd_free(x) do { } while (0) | 55 | #define pmd_free(x) do { } while (0) |
80 | #define __pmd_free_tlb(tlb,x) do { } while (0) | 56 | #define __pmd_free_tlb(tlb,x) do { } while (0) |
81 | #define pgd_populate(mm, pmd, pte) BUG() | ||
82 | #define check_pgt_cache() do { } while (0) | 57 | #define check_pgt_cache() do { } while (0) |
83 | 58 | ||
84 | #ifdef CONFIG_CPU_SH4 | ||
85 | #define PG_mapped PG_arch_1 | ||
86 | #endif | ||
87 | |||
88 | #endif /* __ASM_SH_PGALLOC_H */ | 59 | #endif /* __ASM_SH_PGALLOC_H */ |
diff --git a/include/asm-sh/pgtable-2level.h b/include/asm-sh/pgtable-2level.h index b0528aa3cb1f..b525db6f61c6 100644 --- a/include/asm-sh/pgtable-2level.h +++ b/include/asm-sh/pgtable-2level.h | |||
@@ -50,9 +50,12 @@ static inline void pgd_clear (pgd_t * pgdp) { } | |||
50 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | 50 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) |
51 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) | 51 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) |
52 | 52 | ||
53 | #define pgd_page(pgd) \ | 53 | #define pgd_page_vaddr(pgd) \ |
54 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | 54 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) |
55 | 55 | ||
56 | #define pgd_page(pgd) \ | ||
57 | (phys_to_page(pgd_val(pgd))) | ||
58 | |||
56 | static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | 59 | static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) |
57 | { | 60 | { |
58 | return (pmd_t *) dir; | 61 | return (pmd_t *) dir; |
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index dcd23a03683d..2c8682ad1012 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h | |||
@@ -1,42 +1,42 @@ | |||
1 | #ifndef __ASM_SH_PGTABLE_H | ||
2 | #define __ASM_SH_PGTABLE_H | ||
3 | |||
4 | #include <asm-generic/4level-fixup.h> | ||
5 | |||
6 | /* | 1 | /* |
2 | * This file contains the functions and defines necessary to modify and | ||
3 | * use the SuperH page table tree. | ||
4 | * | ||
7 | * Copyright (C) 1999 Niibe Yutaka | 5 | * Copyright (C) 1999 Niibe Yutaka |
8 | * Copyright (C) 2002, 2003, 2004 Paul Mundt | 6 | * Copyright (C) 2002 - 2005 Paul Mundt |
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General | ||
9 | * Public License. See the file "COPYING" in the main directory of this | ||
10 | * archive for more details. | ||
9 | */ | 11 | */ |
12 | #ifndef __ASM_SH_PGTABLE_H | ||
13 | #define __ASM_SH_PGTABLE_H | ||
10 | 14 | ||
11 | #include <asm/pgtable-2level.h> | 15 | #include <asm-generic/pgtable-nopmd.h> |
16 | #include <asm/page.h> | ||
17 | |||
18 | #define PTRS_PER_PGD 1024 | ||
12 | 19 | ||
13 | /* | ||
14 | * This file contains the functions and defines necessary to modify and use | ||
15 | * the SuperH page table tree. | ||
16 | */ | ||
17 | #ifndef __ASSEMBLY__ | 20 | #ifndef __ASSEMBLY__ |
18 | #include <asm/processor.h> | ||
19 | #include <asm/addrspace.h> | 21 | #include <asm/addrspace.h> |
20 | #include <asm/fixmap.h> | 22 | #include <asm/fixmap.h> |
21 | #include <linux/threads.h> | ||
22 | 23 | ||
23 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | 24 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
24 | extern void paging_init(void); | 25 | extern void paging_init(void); |
25 | 26 | ||
26 | /* | 27 | /* |
27 | * Basically we have the same two-level (which is the logical three level | ||
28 | * Linux page table layout folded) page tables as the i386. | ||
29 | */ | ||
30 | |||
31 | /* | ||
32 | * ZERO_PAGE is a global shared page that is always zero: used | 28 | * ZERO_PAGE is a global shared page that is always zero: used |
33 | * for zero-mapped memory areas etc.. | 29 | * for zero-mapped memory areas etc.. |
34 | */ | 30 | */ |
35 | extern unsigned long empty_zero_page[1024]; | 31 | extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
36 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | 32 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) |
37 | 33 | ||
38 | #endif /* !__ASSEMBLY__ */ | 34 | #endif /* !__ASSEMBLY__ */ |
39 | 35 | ||
36 | /* traditional two-level paging structure */ | ||
37 | #define PGDIR_SHIFT 22 | ||
38 | #define PTRS_PER_PMD 1 | ||
39 | #define PTRS_PER_PTE 1024 | ||
40 | #define PMD_SIZE (1UL << PMD_SHIFT) | 40 | #define PMD_SIZE (1UL << PMD_SHIFT) |
41 | #define PMD_MASK (~(PMD_SIZE-1)) | 41 | #define PMD_MASK (~(PMD_SIZE-1)) |
42 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 42 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
@@ -47,7 +47,6 @@ extern unsigned long empty_zero_page[1024]; | |||
47 | 47 | ||
48 | #define PTE_PHYS_MASK 0x1ffff000 | 48 | #define PTE_PHYS_MASK 0x1ffff000 |
49 | 49 | ||
50 | #ifndef __ASSEMBLY__ | ||
51 | /* | 50 | /* |
52 | * First 1MB map is used by fixed purpose. | 51 | * First 1MB map is used by fixed purpose. |
53 | * Currently only 4-enty (16kB) is used (see arch/sh/mm/cache.c) | 52 | * Currently only 4-enty (16kB) is used (see arch/sh/mm/cache.c) |
@@ -55,20 +54,41 @@ extern unsigned long empty_zero_page[1024]; | |||
55 | #define VMALLOC_START (P3SEG+0x00100000) | 54 | #define VMALLOC_START (P3SEG+0x00100000) |
56 | #define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) | 55 | #define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) |
57 | 56 | ||
58 | #define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */ | 57 | /* |
59 | #define _PAGE_HW_SHARED 0x002 /* SH-bit : page is shared among processes */ | 58 | * Linux PTEL encoding. |
60 | #define _PAGE_DIRTY 0x004 /* D-bit : page changed */ | 59 | * |
61 | #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ | 60 | * Hardware and software bit definitions for the PTEL value: |
62 | #define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */ | 61 | * |
63 | #define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ | 62 | * - Bits 0 and 7 are reserved on SH-3 (_PAGE_WT and _PAGE_SZ1 on SH-4). |
64 | #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ | 63 | * |
65 | #define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */ | 64 | * - Bit 1 is the SH-bit, but is unused on SH-3 due to an MMU bug (the |
66 | #define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ | 65 | * hardware PTEL value can't have the SH-bit set when MMUCR.IX is set, |
67 | #define _PAGE_PROTNONE 0x200 /* software: if not present */ | 66 | * which is the default in cpu-sh3/mmu_context.h:MMU_CONTROL_INIT). |
68 | #define _PAGE_ACCESSED 0x400 /* software: page referenced */ | 67 | * |
69 | #define _PAGE_U0_SHARED 0x800 /* software: page is shared in user space */ | 68 | * In order to keep this relatively clean, do not use these for defining |
70 | 69 | * SH-3 specific flags until all of the other unused bits have been | |
71 | #define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ | 70 | * exhausted. |
71 | * | ||
72 | * - Bit 9 is reserved by everyone and used by _PAGE_PROTNONE. | ||
73 | * | ||
74 | * - Bits 10 and 11 are low bits of the PPN that are reserved on >= 4K pages. | ||
75 | * Bit 10 is used for _PAGE_ACCESSED, bit 11 remains unused. | ||
76 | * | ||
77 | * - Bits 31, 30, and 29 remain unused by everyone and can be used for future | ||
78 | * software flags, although care must be taken to update _PAGE_CLEAR_FLAGS. | ||
79 | */ | ||
80 | #define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */ | ||
81 | #define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */ | ||
82 | #define _PAGE_DIRTY 0x004 /* D-bit : page changed */ | ||
83 | #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ | ||
84 | #define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */ | ||
85 | #define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ | ||
86 | #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ | ||
87 | #define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */ | ||
88 | #define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ | ||
89 | #define _PAGE_PROTNONE 0x200 /* software: if not present */ | ||
90 | #define _PAGE_ACCESSED 0x400 /* software: page referenced */ | ||
91 | #define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ | ||
72 | 92 | ||
73 | /* software: moves to PTEA.TC (Timing Control) */ | 93 | /* software: moves to PTEA.TC (Timing Control) */ |
74 | #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ | 94 | #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ |
@@ -83,23 +103,17 @@ extern unsigned long empty_zero_page[1024]; | |||
83 | #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ | 103 | #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ |
84 | #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ | 104 | #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ |
85 | 105 | ||
86 | 106 | /* Mask which drops unused bits from the PTEL value */ | |
87 | /* Mask which drop software flags | 107 | #ifdef CONFIG_CPU_SH3 |
88 | * We also drop WT bit since it is used for _PAGE_FILE | 108 | #define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \ |
89 | * bit in this implementation. | 109 | _PAGE_FILE | _PAGE_SZ1 | \ |
90 | */ | 110 | _PAGE_HW_SHARED) |
91 | #define _PAGE_CLEAR_FLAGS (_PAGE_WT | _PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_U0_SHARED) | ||
92 | |||
93 | #if defined(CONFIG_CPU_SH3) | ||
94 | /* | ||
95 | * MMU on SH-3 has bug on SH-bit: We can't use it if MMUCR.IX=1. | ||
96 | * Work around: Just drop SH-bit. | ||
97 | */ | ||
98 | #define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS | _PAGE_HW_SHARED)) | ||
99 | #else | 111 | #else |
100 | #define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS)) | 112 | #define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE) |
101 | #endif | 113 | #endif |
102 | 114 | ||
115 | #define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS)) | ||
116 | |||
103 | /* Hardware flags: SZ0=1 (4k-byte) */ | 117 | /* Hardware flags: SZ0=1 (4k-byte) */ |
104 | #define _PAGE_FLAGS_HARD _PAGE_SZ0 | 118 | #define _PAGE_FLAGS_HARD _PAGE_SZ0 |
105 | 119 | ||
@@ -109,15 +123,15 @@ extern unsigned long empty_zero_page[1024]; | |||
109 | #define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1) | 123 | #define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1) |
110 | #endif | 124 | #endif |
111 | 125 | ||
112 | #define _PAGE_SHARED _PAGE_U0_SHARED | ||
113 | |||
114 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) | 126 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) |
115 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | 127 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) |
116 | #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_SHARED) | 128 | #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY) |
129 | |||
130 | #ifndef __ASSEMBLY__ | ||
117 | 131 | ||
118 | #ifdef CONFIG_MMU | 132 | #ifdef CONFIG_MMU |
119 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) | 133 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
120 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_SHARED | _PAGE_FLAGS_HARD) | 134 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
121 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) | 135 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
122 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) | 136 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
123 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) | 137 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) |
@@ -137,12 +151,13 @@ extern unsigned long empty_zero_page[1024]; | |||
137 | #define PAGE_KERNEL_PCC __pgprot(0) | 151 | #define PAGE_KERNEL_PCC __pgprot(0) |
138 | #endif | 152 | #endif |
139 | 153 | ||
154 | #endif /* __ASSEMBLY__ */ | ||
155 | |||
140 | /* | 156 | /* |
141 | * As i386 and MIPS, SuperH can't do page protection for execute, and | 157 | * As i386 and MIPS, SuperH can't do page protection for execute, and |
142 | * considers that the same as a read. Also, write permissions imply | 158 | * considers that the same as a read. Also, write permissions imply |
143 | * read permissions. This is the closest we can get.. | 159 | * read permissions. This is the closest we can get.. |
144 | */ | 160 | */ |
145 | |||
146 | #define __P000 PAGE_NONE | 161 | #define __P000 PAGE_NONE |
147 | #define __P001 PAGE_READONLY | 162 | #define __P001 PAGE_READONLY |
148 | #define __P010 PAGE_COPY | 163 | #define __P010 PAGE_COPY |
@@ -161,6 +176,26 @@ extern unsigned long empty_zero_page[1024]; | |||
161 | #define __S110 PAGE_SHARED | 176 | #define __S110 PAGE_SHARED |
162 | #define __S111 PAGE_SHARED | 177 | #define __S111 PAGE_SHARED |
163 | 178 | ||
179 | #ifndef __ASSEMBLY__ | ||
180 | |||
181 | /* | ||
182 | * Certain architectures need to do special things when PTEs | ||
183 | * within a page table are directly modified. Thus, the following | ||
184 | * hook is made available. | ||
185 | */ | ||
186 | #define set_pte(pteptr, pteval) (*(pteptr) = pteval) | ||
187 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
188 | |||
189 | /* | ||
190 | * (pmds are folded into pgds so this doesn't get actually called, | ||
191 | * but the define is needed for a generic inline function.) | ||
192 | */ | ||
193 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | ||
194 | |||
195 | #define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT))) | ||
196 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
197 | #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
198 | |||
164 | #define pte_none(x) (!pte_val(x)) | 199 | #define pte_none(x) (!pte_val(x)) |
165 | #define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) | 200 | #define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) |
166 | #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) | 201 | #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) |
@@ -171,7 +206,7 @@ extern unsigned long empty_zero_page[1024]; | |||
171 | #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | 206 | #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) |
172 | 207 | ||
173 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) | 208 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) |
174 | #define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) | 209 | #define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) |
175 | 210 | ||
176 | /* | 211 | /* |
177 | * The following only work if pte_present() is true. | 212 | * The following only work if pte_present() is true. |
@@ -225,7 +260,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) | |||
225 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 260 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
226 | { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } | 261 | { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } |
227 | 262 | ||
228 | #define pmd_page_kernel(pmd) \ | 263 | #define pmd_page_vaddr(pmd) \ |
229 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 264 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
230 | 265 | ||
231 | #define pmd_page(pmd) \ | 266 | #define pmd_page(pmd) \ |
@@ -242,12 +277,17 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
242 | #define pte_index(address) \ | 277 | #define pte_index(address) \ |
243 | ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 278 | ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
244 | #define pte_offset_kernel(dir, address) \ | 279 | #define pte_offset_kernel(dir, address) \ |
245 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 280 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
246 | #define pte_offset_map(dir, address) pte_offset_kernel(dir, address) | 281 | #define pte_offset_map(dir, address) pte_offset_kernel(dir, address) |
247 | #define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) | 282 | #define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) |
248 | #define pte_unmap(pte) do { } while (0) | 283 | #define pte_unmap(pte) do { } while (0) |
249 | #define pte_unmap_nested(pte) do { } while (0) | 284 | #define pte_unmap_nested(pte) do { } while (0) |
250 | 285 | ||
286 | #define pte_ERROR(e) \ | ||
287 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
288 | #define pgd_ERROR(e) \ | ||
289 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | ||
290 | |||
251 | struct vm_area_struct; | 291 | struct vm_area_struct; |
252 | extern void update_mmu_cache(struct vm_area_struct * vma, | 292 | extern void update_mmu_cache(struct vm_area_struct * vma, |
253 | unsigned long address, pte_t pte); | 293 | unsigned long address, pte_t pte); |
@@ -272,8 +312,6 @@ extern void update_mmu_cache(struct vm_area_struct * vma, | |||
272 | 312 | ||
273 | typedef pte_t *pte_addr_t; | 313 | typedef pte_t *pte_addr_t; |
274 | 314 | ||
275 | #endif /* !__ASSEMBLY__ */ | ||
276 | |||
277 | #define kern_addr_valid(addr) (1) | 315 | #define kern_addr_valid(addr) (1) |
278 | 316 | ||
279 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | 317 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ |
@@ -301,5 +339,5 @@ extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t | |||
301 | 339 | ||
302 | #include <asm-generic/pgtable.h> | 340 | #include <asm-generic/pgtable.h> |
303 | 341 | ||
342 | #endif /* !__ASSEMBLY__ */ | ||
304 | #endif /* __ASM_SH_PAGE_H */ | 343 | #endif /* __ASM_SH_PAGE_H */ |
305 | |||
diff --git a/include/asm-sh/pm.h b/include/asm-sh/pm.h new file mode 100644 index 000000000000..56fdbd6b1c94 --- /dev/null +++ b/include/asm-sh/pm.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com> | ||
7 | * | ||
8 | */ | ||
9 | #ifndef __ASM_SH_PM_H | ||
10 | #define __ASM_SH_PM_H | ||
11 | |||
12 | extern u8 wakeup_start; | ||
13 | extern u8 wakeup_end; | ||
14 | |||
15 | void pm_enter(void); | ||
16 | |||
17 | #endif | ||
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index eeb0f48bb99e..474773853cd1 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/types.h> | 14 | #include <asm/types.h> |
15 | #include <asm/cache.h> | 15 | #include <asm/cache.h> |
16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
17 | #include <asm/cpu-features.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Default implementation of macro that returns current | 20 | * Default implementation of macro that returns current |
@@ -38,27 +39,30 @@ enum cpu_type { | |||
38 | CPU_SH7604, | 39 | CPU_SH7604, |
39 | 40 | ||
40 | /* SH-3 types */ | 41 | /* SH-3 types */ |
41 | CPU_SH7705, CPU_SH7707, CPU_SH7708, CPU_SH7708S, CPU_SH7708R, | 42 | CPU_SH7705, CPU_SH7706, CPU_SH7707, |
42 | CPU_SH7709, CPU_SH7709A, CPU_SH7729, CPU_SH7300, | 43 | CPU_SH7708, CPU_SH7708S, CPU_SH7708R, |
44 | CPU_SH7709, CPU_SH7709A, CPU_SH7710, | ||
45 | CPU_SH7729, CPU_SH7300, | ||
43 | 46 | ||
44 | /* SH-4 types */ | 47 | /* SH-4 types */ |
45 | CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, | 48 | CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, |
46 | CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, | 49 | CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, |
47 | CPU_SH73180, CPU_SH7770, CPU_SH7780, CPU_SH7781, | 50 | CPU_SH73180, CPU_SH7343, CPU_SH7770, CPU_SH7780, CPU_SH7781, |
48 | 51 | ||
49 | /* Unknown subtype */ | 52 | /* Unknown subtype */ |
50 | CPU_SH_NONE | 53 | CPU_SH_NONE |
51 | }; | 54 | }; |
52 | 55 | ||
53 | struct sh_cpuinfo { | 56 | struct sh_cpuinfo { |
54 | enum cpu_type type; | 57 | unsigned int type; |
55 | unsigned long loops_per_jiffy; | 58 | unsigned long loops_per_jiffy; |
56 | 59 | ||
57 | struct cache_info icache; | 60 | struct cache_info icache; /* Primary I-cache */ |
58 | struct cache_info dcache; | 61 | struct cache_info dcache; /* Primary D-cache */ |
62 | struct cache_info scache; /* Secondary cache */ | ||
59 | 63 | ||
60 | unsigned long flags; | 64 | unsigned long flags; |
61 | }; | 65 | } __attribute__ ((aligned(SMP_CACHE_BYTES))); |
62 | 66 | ||
63 | extern struct sh_cpuinfo boot_cpu_data; | 67 | extern struct sh_cpuinfo boot_cpu_data; |
64 | 68 | ||
@@ -125,17 +129,6 @@ union sh_fpu_union { | |||
125 | struct sh_fpu_soft_struct soft; | 129 | struct sh_fpu_soft_struct soft; |
126 | }; | 130 | }; |
127 | 131 | ||
128 | /* | ||
129 | * Processor flags | ||
130 | */ | ||
131 | |||
132 | #define CPU_HAS_FPU 0x0001 /* Hardware FPU support */ | ||
133 | #define CPU_HAS_P2_FLUSH_BUG 0x0002 /* Need to flush the cache in P2 area */ | ||
134 | #define CPU_HAS_MMU_PAGE_ASSOC 0x0004 /* SH3: TLB way selection bit support */ | ||
135 | #define CPU_HAS_DSP 0x0008 /* SH-DSP: DSP support */ | ||
136 | #define CPU_HAS_PERF_COUNTER 0x0010 /* Hardware performance counters */ | ||
137 | #define CPU_HAS_PTEA 0x0020 /* PTEA register */ | ||
138 | |||
139 | struct thread_struct { | 132 | struct thread_struct { |
140 | unsigned long sp; | 133 | unsigned long sp; |
141 | unsigned long pc; | 134 | unsigned long pc; |
@@ -149,6 +142,10 @@ struct thread_struct { | |||
149 | union sh_fpu_union fpu; | 142 | union sh_fpu_union fpu; |
150 | }; | 143 | }; |
151 | 144 | ||
145 | typedef struct { | ||
146 | unsigned long seg; | ||
147 | } mm_segment_t; | ||
148 | |||
152 | /* Count of active tasks with UBC settings */ | 149 | /* Count of active tasks with UBC settings */ |
153 | extern int ubc_usercnt; | 150 | extern int ubc_usercnt; |
154 | 151 | ||
@@ -266,5 +263,24 @@ extern unsigned long get_wchan(struct task_struct *p); | |||
266 | #define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") | 263 | #define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") |
267 | #define cpu_relax() barrier() | 264 | #define cpu_relax() barrier() |
268 | 265 | ||
266 | #if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH3) || \ | ||
267 | defined(CONFIG_CPU_SH4) | ||
268 | #define PREFETCH_STRIDE L1_CACHE_BYTES | ||
269 | #define ARCH_HAS_PREFETCH | ||
270 | #define ARCH_HAS_PREFETCHW | ||
271 | static inline void prefetch(void *x) | ||
272 | { | ||
273 | __asm__ __volatile__ ("pref @%0\n\t" : : "r" (x) : "memory"); | ||
274 | } | ||
275 | |||
276 | #define prefetchw(x) prefetch(x) | ||
277 | #endif | ||
278 | |||
279 | #ifdef CONFIG_VSYSCALL | ||
280 | extern int vsyscall_init(void); | ||
281 | #else | ||
282 | #define vsyscall_init() do { } while (0) | ||
283 | #endif | ||
284 | |||
269 | #endif /* __KERNEL__ */ | 285 | #endif /* __KERNEL__ */ |
270 | #endif /* __ASM_SH_PROCESSOR_H */ | 286 | #endif /* __ASM_SH_PROCESSOR_H */ |
diff --git a/include/asm-sh/r7780rp/ide.h b/include/asm-sh/r7780rp/ide.h new file mode 100644 index 000000000000..a1ed78e0f617 --- /dev/null +++ b/include/asm-sh/r7780rp/ide.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __ASM_SH_R7780RP_IDE_H | ||
2 | #define __ASM_SH_R7780RP_IDE_H | ||
3 | |||
4 | /* Nothing to see here.. */ | ||
5 | #include <asm/mach/r7780rp.h> | ||
6 | |||
7 | #endif /* __ASM_SH_R7780RP_IDE_H */ | ||
8 | |||
diff --git a/include/asm-sh/r7780rp/r7780rp.h b/include/asm-sh/r7780rp/r7780rp.h new file mode 100644 index 000000000000..f95d9dba31a2 --- /dev/null +++ b/include/asm-sh/r7780rp/r7780rp.h | |||
@@ -0,0 +1,177 @@ | |||
1 | #ifndef __ASM_SH_RENESAS_R7780RP_H | ||
2 | #define __ASM_SH_RENESAS_R7780RP_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/asm-sh/r7780rp.h | ||
6 | * | ||
7 | * Copyright (C) 2000 Atom Create Engineering Co., Ltd. | ||
8 | * | ||
9 | * Renesas Solutions Highlander R7780RP support | ||
10 | */ | ||
11 | |||
12 | /* Box specific addresses. */ | ||
13 | #if defined(CONFIG_SH_R7780MP) | ||
14 | #define PA_BCR 0xa4000000 /* FPGA */ | ||
15 | #define PA_IRLMSK (PA_BCR+0x0000) /* Interrupt Mask control */ | ||
16 | #define PA_IRLMON (PA_BCR+0x0002) /* Interrupt Status control */ | ||
17 | #define PA_IRLPRI1 (PA_BCR+0x0004) /* Interrupt Priorty 1 */ | ||
18 | #define PA_IRLPRI2 (PA_BCR+0x0006) /* Interrupt Priorty 2 */ | ||
19 | #define PA_IRLPRI3 (PA_BCR+0x0008) /* Interrupt Priorty 3 */ | ||
20 | #define PA_IRLPRI4 (PA_BCR+0x000a) /* Interrupt Priorty 4 */ | ||
21 | #define PA_RSTCTL (PA_BCR+0x000c) /* Reset Control */ | ||
22 | #define PA_PCIBD (PA_BCR+0x000e) /* PCI Board detect control */ | ||
23 | #define PA_PCICD (PA_BCR+0x0010) /* PCI Conector detect control */ | ||
24 | #define PA_EXTGIO (PA_BCR+0x0016) /* Extension GPIO Control */ | ||
25 | #define PA_IVDRMON (PA_BCR+0x0018) /* iVDR Moniter control */ | ||
26 | #define PA_IVDRCTL (PA_BCR+0x001a) /* iVDR control */ | ||
27 | #define PA_OBLED (PA_BCR+0x001c) /* On Board LED control */ | ||
28 | #define PA_OBSW (PA_BCR+0x001e) /* On Board Switch control */ | ||
29 | #define PA_AUDIOSEL (PA_BCR+0x0020) /* Sound Interface Select control */ | ||
30 | #define PA_EXTPLR (PA_BCR+0x001e) /* Extention Pin Polarity control */ | ||
31 | #define PA_TPCTL (PA_BCR+0x0100) /* Touch Panel Access control */ | ||
32 | #define PA_TPDCKCTL (PA_BCR+0x0102) /* Touch Panel Access data control */ | ||
33 | #define PA_TPCTLCLR (PA_BCR+0x0104) /* Touch Panel Access control */ | ||
34 | #define PA_TPXPOS (PA_BCR+0x0106) /* Touch Panel X position control */ | ||
35 | #define PA_TPYPOS (PA_BCR+0x0108) /* Touch Panel Y position control */ | ||
36 | #define PA_DBSW (PA_BCR+0x0200) /* Debug Board Switch control */ | ||
37 | #define PA_CFCTL (PA_BCR+0x0300) /* CF Timing control */ | ||
38 | #define PA_CFPOW (PA_BCR+0x0302) /* CF Power control */ | ||
39 | #define PA_CFCDINTCLR (PA_BCR+0x0304) /* CF Insert Interrupt clear */ | ||
40 | #define PA_SCSMR0 (PA_BCR+0x0400) /* SCIF0 Serial mode control */ | ||
41 | #define PA_SCBRR0 (PA_BCR+0x0404) /* SCIF0 Bit rate control */ | ||
42 | #define PA_SCSCR0 (PA_BCR+0x0408) /* SCIF0 Serial control */ | ||
43 | #define PA_SCFTDR0 (PA_BCR+0x040c) /* SCIF0 Send FIFO control */ | ||
44 | #define PA_SCFSR0 (PA_BCR+0x0410) /* SCIF0 Serial status control */ | ||
45 | #define PA_SCFRDR0 (PA_BCR+0x0414) /* SCIF0 Receive FIFO control */ | ||
46 | #define PA_SCFCR0 (PA_BCR+0x0418) /* SCIF0 FIFO control */ | ||
47 | #define PA_SCTFDR0 (PA_BCR+0x041c) /* SCIF0 Send FIFO data control */ | ||
48 | #define PA_SCRFDR0 (PA_BCR+0x0420) /* SCIF0 Receive FIFO data control */ | ||
49 | #define PA_SCSPTR0 (PA_BCR+0x0424) /* SCIF0 Serial Port control */ | ||
50 | #define PA_SCLSR0 (PA_BCR+0x0428) /* SCIF0 Line Status control */ | ||
51 | #define PA_SCRER0 (PA_BCR+0x042c) /* SCIF0 Serial Error control */ | ||
52 | #define PA_SCSMR1 (PA_BCR+0x0500) /* SCIF1 Serial mode control */ | ||
53 | #define PA_SCBRR1 (PA_BCR+0x0504) /* SCIF1 Bit rate control */ | ||
54 | #define PA_SCSCR1 (PA_BCR+0x0508) /* SCIF1 Serial control */ | ||
55 | #define PA_SCFTDR1 (PA_BCR+0x050c) /* SCIF1 Send FIFO control */ | ||
56 | #define PA_SCFSR1 (PA_BCR+0x0510) /* SCIF1 Serial status control */ | ||
57 | #define PA_SCFRDR1 (PA_BCR+0x0514) /* SCIF1 Receive FIFO control */ | ||
58 | #define PA_SCFCR1 (PA_BCR+0x0518) /* SCIF1 FIFO control */ | ||
59 | #define PA_SCTFDR1 (PA_BCR+0x051c) /* SCIF1 Send FIFO data control */ | ||
60 | #define PA_SCRFDR1 (PA_BCR+0x0520) /* SCIF1 Receive FIFO data control */ | ||
61 | #define PA_SCSPTR1 (PA_BCR+0x0524) /* SCIF1 Serial Port control */ | ||
62 | #define PA_SCLSR1 (PA_BCR+0x0528) /* SCIF1 Line Status control */ | ||
63 | #define PA_SCRER1 (PA_BCR+0x052c) /* SCIF1 Serial Error control */ | ||
64 | #define PA_ICCR (PA_BCR+0x0600) /* Serial control */ | ||
65 | #define PA_SAR (PA_BCR+0x0602) /* Serial Slave control */ | ||
66 | #define PA_MDR (PA_BCR+0x0604) /* Serial Mode control */ | ||
67 | #define PA_ADR1 (PA_BCR+0x0606) /* Serial Address1 control */ | ||
68 | #define PA_DAR1 (PA_BCR+0x0646) /* Serial Data1 control */ | ||
69 | #define PA_VERREG (PA_BCR+0x0700) /* FPGA Version Register */ | ||
70 | #define PA_POFF (PA_BCR+0x0800) /* System Power Off control */ | ||
71 | #define PA_PMR (PA_BCR+0x0900) /* */ | ||
72 | |||
73 | #define PA_AX88796L 0xa4100400 /* AX88796L Area */ | ||
74 | #define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */ | ||
75 | #define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */ | ||
76 | #define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */ | ||
77 | #define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ | ||
78 | #define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */ | ||
79 | |||
80 | #define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ | ||
81 | |||
82 | #define IRQ_PCISLOT1 65 /* PCI Slot #1 IRQ */ | ||
83 | #define IRQ_PCISLOT2 66 /* PCI Slot #2 IRQ */ | ||
84 | #define IRQ_PCISLOT3 67 /* PCI Slot #3 IRQ */ | ||
85 | #define IRQ_PCISLOT4 68 /* PCI Slot #4 IRQ */ | ||
86 | #define IRQ_CFCARD 1 /* CF Card IRQ */ | ||
87 | // #define IRQ_CFINST 0 /* CF Card Insert IRQ */ | ||
88 | #define IRQ_TP 2 /* Touch Panel IRQ */ | ||
89 | #define IRQ_SCI1 3 /* SCI1 IRQ */ | ||
90 | #define IRQ_SCI0 4 /* SCI0 IRQ */ | ||
91 | #define IRQ_2SERIAL 5 /* Serial IRQ */ | ||
92 | #define IRQ_RTC 6 /* RTC A / B IRQ */ | ||
93 | #define IRQ_EXTENTION6 7 /* EXT6n IRQ */ | ||
94 | #define IRQ_EXTENTION5 8 /* EXT5n IRQ */ | ||
95 | #define IRQ_EXTENTION4 9 /* EXT4n IRQ */ | ||
96 | #define IRQ_EXTENTION2 10 /* EXT2n IRQ */ | ||
97 | #define IRQ_EXTENTION1 11 /* EXT1n IRQ */ | ||
98 | #define IRQ_ONETH 13 /* On board Ethernet IRQ */ | ||
99 | #define IRQ_PSW 14 /* Push Switch IRQ */ | ||
100 | |||
101 | #else /* R7780RP */ | ||
102 | |||
103 | #define PA_BCR 0xa5000000 /* FPGA */ | ||
104 | #define PA_IRLMSK (PA_BCR+0x0000) /* Interrupt Mask control */ | ||
105 | #define PA_IRLMON (PA_BCR+0x0002) /* Interrupt Status control */ | ||
106 | #define PA_SDPOW (PA_BCR+0x0004) /* SD Power control */ | ||
107 | #define PA_RSTCTL (PA_BCR+0x0006) /* Device Reset control */ | ||
108 | #define PA_PCIBD (PA_BCR+0x0008) /* PCI Board detect control */ | ||
109 | #define PA_PCICD (PA_BCR+0x000a) /* PCI Conector detect control */ | ||
110 | #define PA_ZIGIO1 (PA_BCR+0x000c) /* Zigbee IO control 1 */ | ||
111 | #define PA_ZIGIO2 (PA_BCR+0x000e) /* Zigbee IO control 2 */ | ||
112 | #define PA_ZIGIO3 (PA_BCR+0x0010) /* Zigbee IO control 3 */ | ||
113 | #define PA_ZIGIO4 (PA_BCR+0x0012) /* Zigbee IO control 4 */ | ||
114 | #define PA_IVDRMON (PA_BCR+0x0014) /* iVDR Moniter control */ | ||
115 | #define PA_IVDRCTL (PA_BCR+0x0016) /* iVDR control */ | ||
116 | #define PA_OBLED (PA_BCR+0x0018) /* On Board LED control */ | ||
117 | #define PA_OBSW (PA_BCR+0x001a) /* On Board Switch control */ | ||
118 | #define PA_AUDIOSEL (PA_BCR+0x001c) /* Sound Interface Select control */ | ||
119 | #define PA_EXTPLR (PA_BCR+0x001e) /* Extention Pin Polarity control */ | ||
120 | #define PA_TPCTL (PA_BCR+0x0100) /* Touch Panel Access control */ | ||
121 | #define PA_TPDCKCTL (PA_BCR+0x0102) /* Touch Panel Access data control */ | ||
122 | #define PA_TPCTLCLR (PA_BCR+0x0104) /* Touch Panel Access control */ | ||
123 | #define PA_TPXPOS (PA_BCR+0x0106) /* Touch Panel X position control */ | ||
124 | #define PA_TPYPOS (PA_BCR+0x0108) /* Touch Panel Y position control */ | ||
125 | #define PA_DBDET (PA_BCR+0x0200) /* Debug Board detect control */ | ||
126 | #define PA_DBDISPCTL (PA_BCR+0x0202) /* Debug Board Dot timing control */ | ||
127 | #define PA_DBSW (PA_BCR+0x0204) /* Debug Board Switch control */ | ||
128 | #define PA_CFCTL (PA_BCR+0x0300) /* CF Timing control */ | ||
129 | #define PA_CFPOW (PA_BCR+0x0302) /* CF Power control */ | ||
130 | #define PA_CFCDINTCLR (PA_BCR+0x0304) /* CF Insert Interrupt clear */ | ||
131 | #define PA_SCSMR (PA_BCR+0x0400) /* SCIF Serial mode control */ | ||
132 | #define PA_SCBRR (PA_BCR+0x0402) /* SCIF Bit rate control */ | ||
133 | #define PA_SCSCR (PA_BCR+0x0404) /* SCIF Serial control */ | ||
134 | #define PA_SCFDTR (PA_BCR+0x0406) /* SCIF Send FIFO control */ | ||
135 | #define PA_SCFSR (PA_BCR+0x0408) /* SCIF Serial status control */ | ||
136 | #define PA_SCFRDR (PA_BCR+0x040a) /* SCIF Receive FIFO control */ | ||
137 | #define PA_SCFCR (PA_BCR+0x040c) /* SCIF FIFO control */ | ||
138 | #define PA_SCFDR (PA_BCR+0x040e) /* SCIF FIFO data control */ | ||
139 | #define PA_SCLSR (PA_BCR+0x0412) /* SCIF Line Status control */ | ||
140 | #define PA_ICCR (PA_BCR+0x0500) /* Serial control */ | ||
141 | #define PA_SAR (PA_BCR+0x0502) /* Serial Slave control */ | ||
142 | #define PA_MDR (PA_BCR+0x0504) /* Serial Mode control */ | ||
143 | #define PA_ADR1 (PA_BCR+0x0506) /* Serial Address1 control */ | ||
144 | #define PA_DAR1 (PA_BCR+0x0546) /* Serial Data1 control */ | ||
145 | #define PA_VERREG (PA_BCR+0x0600) /* FPGA Version Register */ | ||
146 | |||
147 | #define PA_AX88796L 0xa5800400 /* AX88796L Area */ | ||
148 | #define PA_SC1602BSLB 0xa6000000 /* SC1602BSLB Area */ | ||
149 | #define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */ | ||
150 | #define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */ | ||
151 | #define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ | ||
152 | #define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */ | ||
153 | |||
154 | #define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ | ||
155 | |||
156 | #define IRQ_PCISLOT1 0 /* PCI Slot #1 IRQ */ | ||
157 | #define IRQ_PCISLOT2 1 /* PCI Slot #2 IRQ */ | ||
158 | #define IRQ_PCISLOT3 2 /* PCI Slot #3 IRQ */ | ||
159 | #define IRQ_PCISLOT4 3 /* PCI Slot #4 IRQ */ | ||
160 | #define IRQ_CFCARD 4 /* CF Card IRQ */ | ||
161 | #define IRQ_CFINST 5 /* CF Card Insert IRQ */ | ||
162 | #define IRQ_M66596 6 /* M66596 IRQ */ | ||
163 | #define IRQ_SDCARD 7 /* SD Card IRQ */ | ||
164 | #define IRQ_TUCHPANEL 8 /* Touch Panel IRQ */ | ||
165 | #define IRQ_SCI 9 /* SCI IRQ */ | ||
166 | #define IRQ_2SERIAL 10 /* Serial IRQ */ | ||
167 | #define IRQ_EXTENTION 11 /* EXTn IRQ */ | ||
168 | #define IRQ_ONETH 12 /* On board Ethernet IRQ */ | ||
169 | #define IRQ_PSW 13 /* Push Switch IRQ */ | ||
170 | #define IRQ_ZIGBEE 14 /* Ziggbee IO IRQ */ | ||
171 | |||
172 | #endif /* CONFIG_SH_R7780MP */ | ||
173 | |||
174 | #define __IO_PREFIX r7780rp | ||
175 | #include <asm/io_generic.h> | ||
176 | |||
177 | #endif /* __ASM_SH_RENESAS_R7780RP */ | ||
diff --git a/include/asm-sh/rtc.h b/include/asm-sh/rtc.h index cea9cdf9b925..91aacc96151b 100644 --- a/include/asm-sh/rtc.h +++ b/include/asm-sh/rtc.h | |||
@@ -1,29 +1,8 @@ | |||
1 | #ifndef _ASM_RTC_H | 1 | #ifndef _ASM_RTC_H |
2 | #define _ASM_RTC_H | 2 | #define _ASM_RTC_H |
3 | #ifdef __KERNEL__ | ||
4 | 3 | ||
5 | #include <asm/machvec.h> | ||
6 | #include <asm/cpu/rtc.h> | ||
7 | |||
8 | extern void sh_rtc_gettimeofday(struct timespec *ts); | ||
9 | extern int sh_rtc_settimeofday(const time_t secs); | ||
10 | extern void (*board_time_init)(void); | 4 | extern void (*board_time_init)(void); |
11 | extern void (*rtc_get_time)(struct timespec *); | 5 | extern void (*rtc_sh_get_time)(struct timespec *); |
12 | extern int (*rtc_set_time)(const time_t); | 6 | extern int (*rtc_sh_set_time)(const time_t); |
13 | |||
14 | /* RCR1 Bits */ | ||
15 | #define RCR1_CF 0x80 /* Carry Flag */ | ||
16 | #define RCR1_CIE 0x10 /* Carry Interrupt Enable */ | ||
17 | #define RCR1_AIE 0x08 /* Alarm Interrupt Enable */ | ||
18 | #define RCR1_AF 0x01 /* Alarm Flag */ | ||
19 | |||
20 | /* RCR2 Bits */ | ||
21 | #define RCR2_PEF 0x80 /* PEriodic interrupt Flag */ | ||
22 | #define RCR2_PESMASK 0x70 /* Periodic interrupt Set */ | ||
23 | #define RCR2_RTCEN 0x08 /* ENable RTC */ | ||
24 | #define RCR2_ADJ 0x04 /* ADJustment (30-second) */ | ||
25 | #define RCR2_RESET 0x02 /* Reset bit */ | ||
26 | #define RCR2_START 0x01 /* Start bit */ | ||
27 | 7 | ||
28 | #endif /* __KERNEL__ */ | ||
29 | #endif /* _ASM_RTC_H */ | 8 | #endif /* _ASM_RTC_H */ |
diff --git a/include/asm-sh/rts7751r2d/rts7751r2d.h b/include/asm-sh/rts7751r2d/rts7751r2d.h index 4e09ba597e9a..b112ae221fd1 100644 --- a/include/asm-sh/rts7751r2d/rts7751r2d.h +++ b/include/asm-sh/rts7751r2d/rts7751r2d.h | |||
@@ -41,8 +41,6 @@ | |||
41 | 41 | ||
42 | #define PA_AX88796L 0xaa000400 /* AX88796L Area */ | 42 | #define PA_AX88796L 0xaa000400 /* AX88796L Area */ |
43 | #define PA_VOYAGER 0xab000000 /* VOYAGER GX Area */ | 43 | #define PA_VOYAGER 0xab000000 /* VOYAGER GX Area */ |
44 | #define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */ | ||
45 | #define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */ | ||
46 | #define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ | 44 | #define PA_IDE_OFFSET 0x1f0 /* CF IDE Offset */ |
47 | #define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */ | 45 | #define AX88796L_IO_BASE 0x1000 /* AX88796L IO Base Address */ |
48 | 46 | ||
diff --git a/include/asm-sh/scatterlist.h b/include/asm-sh/scatterlist.h index 7b91df140022..d19e7cd3b023 100644 --- a/include/asm-sh/scatterlist.h +++ b/include/asm-sh/scatterlist.h | |||
@@ -10,4 +10,13 @@ struct scatterlist { | |||
10 | 10 | ||
11 | #define ISA_DMA_THRESHOLD (0x1fffffff) | 11 | #define ISA_DMA_THRESHOLD (0x1fffffff) |
12 | 12 | ||
13 | /* These macros should be used after a pci_map_sg call has been done | ||
14 | * to get bus addresses of each of the SG entries and their lengths. | ||
15 | * You should only work with the number of sg entries pci_map_sg | ||
16 | * returns, or alternatively stop on the first sg_dma_len(sg) which | ||
17 | * is 0. | ||
18 | */ | ||
19 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
20 | #define sg_dma_len(sg) ((sg)->length) | ||
21 | |||
13 | #endif /* !(__ASM_SH_SCATTERLIST_H) */ | 22 | #endif /* !(__ASM_SH_SCATTERLIST_H) */ |
diff --git a/include/asm-sh/sci.h b/include/asm-sh/sci.h new file mode 100644 index 000000000000..52e73660c129 --- /dev/null +++ b/include/asm-sh/sci.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef __ASM_SH_SCI_H | ||
2 | #define __ASM_SH_SCI_H | ||
3 | |||
4 | #include <linux/serial_core.h> | ||
5 | |||
6 | /* | ||
7 | * Generic header for SuperH SCI(F) | ||
8 | * | ||
9 | * Do not place SH-specific parts in here, sh64 and h8300 depend on this too. | ||
10 | */ | ||
11 | |||
12 | /* Offsets into the sci_port->irqs array */ | ||
13 | enum { | ||
14 | SCIx_ERI_IRQ, | ||
15 | SCIx_RXI_IRQ, | ||
16 | SCIx_TXI_IRQ, | ||
17 | SCIx_BRI_IRQ, | ||
18 | SCIx_NR_IRQS, | ||
19 | }; | ||
20 | |||
21 | /* | ||
22 | * Platform device specific platform_data struct | ||
23 | */ | ||
24 | struct plat_sci_port { | ||
25 | void __iomem *membase; /* io cookie */ | ||
26 | unsigned long mapbase; /* resource base */ | ||
27 | unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ | ||
28 | unsigned int type; /* SCI / SCIF / IRDA */ | ||
29 | upf_t flags; /* UPF_* flags */ | ||
30 | }; | ||
31 | |||
32 | int early_sci_setup(struct uart_port *port); | ||
33 | |||
34 | #endif /* __ASM_SH_SCI_H */ | ||
diff --git a/include/asm-sh/se/se.h b/include/asm-sh/se.h index 791c5da0388a..a1832154a3aa 100644 --- a/include/asm-sh/se/se.h +++ b/include/asm-sh/se.h | |||
@@ -74,4 +74,7 @@ | |||
74 | #define IRQ_STNIC 10 | 74 | #define IRQ_STNIC 10 |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #define __IO_PREFIX se | ||
78 | #include <asm/io_generic.h> | ||
79 | |||
77 | #endif /* __ASM_SH_HITACHI_SE_H */ | 80 | #endif /* __ASM_SH_HITACHI_SE_H */ |
diff --git a/include/asm-sh/se/io.h b/include/asm-sh/se/io.h deleted file mode 100644 index 9eeb86cd6cef..000000000000 --- a/include/asm-sh/se/io.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/io_se.h | ||
3 | * | ||
4 | * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * IO functions for an Hitachi SolutionEngine | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SH_IO_SE_H | ||
13 | #define _ASM_SH_IO_SE_H | ||
14 | |||
15 | extern unsigned char se_inb(unsigned long port); | ||
16 | extern unsigned short se_inw(unsigned long port); | ||
17 | extern unsigned int se_inl(unsigned long port); | ||
18 | |||
19 | extern void se_outb(unsigned char value, unsigned long port); | ||
20 | extern void se_outw(unsigned short value, unsigned long port); | ||
21 | extern void se_outl(unsigned int value, unsigned long port); | ||
22 | |||
23 | extern unsigned char se_inb_p(unsigned long port); | ||
24 | extern void se_outb_p(unsigned char value, unsigned long port); | ||
25 | |||
26 | extern void se_insb(unsigned long port, void *addr, unsigned long count); | ||
27 | extern void se_insw(unsigned long port, void *addr, unsigned long count); | ||
28 | extern void se_insl(unsigned long port, void *addr, unsigned long count); | ||
29 | extern void se_outsb(unsigned long port, const void *addr, unsigned long count); | ||
30 | extern void se_outsw(unsigned long port, const void *addr, unsigned long count); | ||
31 | extern void se_outsl(unsigned long port, const void *addr, unsigned long count); | ||
32 | |||
33 | extern unsigned long se_isa_port2addr(unsigned long offset); | ||
34 | |||
35 | #endif /* _ASM_SH_IO_SE_H */ | ||
diff --git a/include/asm-sh/se7300/se7300.h b/include/asm-sh/se7300.h index 3ec1ded86c97..4e24edccb30d 100644 --- a/include/asm-sh/se7300/se7300.h +++ b/include/asm-sh/se7300.h | |||
@@ -58,4 +58,7 @@ | |||
58 | #define PA_LCD1 0xb8000000 | 58 | #define PA_LCD1 0xb8000000 |
59 | #define PA_LCD2 0xb8800000 | 59 | #define PA_LCD2 0xb8800000 |
60 | 60 | ||
61 | #define __IO_PREFIX sh7300se | ||
62 | #include <asm/io_generic.h> | ||
63 | |||
61 | #endif /* __ASM_SH_HITACHI_SE7300_H */ | 64 | #endif /* __ASM_SH_HITACHI_SE7300_H */ |
diff --git a/include/asm-sh/se7300/io.h b/include/asm-sh/se7300/io.h deleted file mode 100644 index c6af85529714..000000000000 --- a/include/asm-sh/se7300/io.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/se7300/io.h | ||
3 | * | ||
4 | * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp> | ||
5 | * IO functions for SH-Mobile(SH7300) SolutionEngine | ||
6 | */ | ||
7 | |||
8 | #ifndef _ASM_SH_IO_7300SE_H | ||
9 | #define _ASM_SH_IO_7300SE_H | ||
10 | |||
11 | extern unsigned char sh7300se_inb(unsigned long port); | ||
12 | extern unsigned short sh7300se_inw(unsigned long port); | ||
13 | extern unsigned int sh7300se_inl(unsigned long port); | ||
14 | |||
15 | extern void sh7300se_outb(unsigned char value, unsigned long port); | ||
16 | extern void sh7300se_outw(unsigned short value, unsigned long port); | ||
17 | extern void sh7300se_outl(unsigned int value, unsigned long port); | ||
18 | |||
19 | extern unsigned char sh7300se_inb_p(unsigned long port); | ||
20 | extern void sh7300se_outb_p(unsigned char value, unsigned long port); | ||
21 | |||
22 | extern void sh7300se_insb(unsigned long port, void *addr, unsigned long count); | ||
23 | extern void sh7300se_insw(unsigned long port, void *addr, unsigned long count); | ||
24 | extern void sh7300se_insl(unsigned long port, void *addr, unsigned long count); | ||
25 | extern void sh7300se_outsb(unsigned long port, const void *addr, unsigned long count); | ||
26 | extern void sh7300se_outsw(unsigned long port, const void *addr, unsigned long count); | ||
27 | extern void sh7300se_outsl(unsigned long port, const void *addr, unsigned long count); | ||
28 | |||
29 | #endif /* _ASM_SH_IO_7300SE_H */ | ||
diff --git a/include/asm-sh/se73180/se73180.h b/include/asm-sh/se73180.h index f5b93e39e768..3a4acb3e38a1 100644 --- a/include/asm-sh/se73180/se73180.h +++ b/include/asm-sh/se73180.h | |||
@@ -59,4 +59,7 @@ | |||
59 | #define PA_LCD1 0xb8000000 | 59 | #define PA_LCD1 0xb8000000 |
60 | #define PA_LCD2 0xb8800000 | 60 | #define PA_LCD2 0xb8800000 |
61 | 61 | ||
62 | #define __IO_PREFIX sh73180se | ||
63 | #include <asm/io_generic.h> | ||
64 | |||
62 | #endif /* __ASM_SH_HITACHI_SE73180_H */ | 65 | #endif /* __ASM_SH_HITACHI_SE73180_H */ |
diff --git a/include/asm-sh/se73180/io.h b/include/asm-sh/se73180/io.h deleted file mode 100644 index c9cb1b9412c6..000000000000 --- a/include/asm-sh/se73180/io.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/se73180/io.h | ||
3 | * | ||
4 | * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp> | ||
5 | * Based on include/asm-sh/se7300/io.h | ||
6 | * | ||
7 | * IO functions for SH-Mobile3(SH73180) SolutionEngine | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_SH_IO_73180SE_H | ||
12 | #define _ASM_SH_IO_73180SE_H | ||
13 | |||
14 | extern unsigned char sh73180se_inb(unsigned long port); | ||
15 | extern unsigned short sh73180se_inw(unsigned long port); | ||
16 | extern unsigned int sh73180se_inl(unsigned long port); | ||
17 | |||
18 | extern void sh73180se_outb(unsigned char value, unsigned long port); | ||
19 | extern void sh73180se_outw(unsigned short value, unsigned long port); | ||
20 | extern void sh73180se_outl(unsigned int value, unsigned long port); | ||
21 | |||
22 | extern unsigned char sh73180se_inb_p(unsigned long port); | ||
23 | extern void sh73180se_outb_p(unsigned char value, unsigned long port); | ||
24 | |||
25 | extern void sh73180se_insb(unsigned long port, void *addr, unsigned long count); | ||
26 | extern void sh73180se_insw(unsigned long port, void *addr, unsigned long count); | ||
27 | extern void sh73180se_insl(unsigned long port, void *addr, unsigned long count); | ||
28 | extern void sh73180se_outsb(unsigned long port, const void *addr, unsigned long count); | ||
29 | extern void sh73180se_outsw(unsigned long port, const void *addr, unsigned long count); | ||
30 | extern void sh73180se_outsl(unsigned long port, const void *addr, unsigned long count); | ||
31 | |||
32 | #endif /* _ASM_SH_IO_73180SE_H */ | ||
diff --git a/include/asm-sh/se7343.h b/include/asm-sh/se7343.h new file mode 100644 index 000000000000..e7914a54aa96 --- /dev/null +++ b/include/asm-sh/se7343.h | |||
@@ -0,0 +1,82 @@ | |||
1 | #ifndef __ASM_SH_HITACHI_SE7343_H | ||
2 | #define __ASM_SH_HITACHI_SE7343_H | ||
3 | |||
4 | /* | ||
5 | * include/asm-sh/se/se7343.h | ||
6 | * | ||
7 | * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp> | ||
8 | * | ||
9 | * SH-Mobile SolutionEngine 7343 support | ||
10 | */ | ||
11 | |||
12 | /* Box specific addresses. */ | ||
13 | |||
14 | /* Area 0 */ | ||
15 | #define PA_ROM 0x00000000 /* EPROM */ | ||
16 | #define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte(Actually 2MB) */ | ||
17 | #define PA_FROM 0x00400000 /* Flash ROM */ | ||
18 | #define PA_FROM_SIZE 0x00400000 /* Flash size 4M byte */ | ||
19 | #define PA_SRAM 0x00800000 /* SRAM */ | ||
20 | #define PA_FROM_SIZE 0x00400000 /* SRAM size 4M byte */ | ||
21 | /* Area 1 */ | ||
22 | #define PA_EXT1 0x04000000 | ||
23 | #define PA_EXT1_SIZE 0x04000000 | ||
24 | /* Area 2 */ | ||
25 | #define PA_EXT2 0x08000000 | ||
26 | #define PA_EXT2_SIZE 0x04000000 | ||
27 | /* Area 3 */ | ||
28 | #define PA_SDRAM 0x0c000000 | ||
29 | #define PA_SDRAM_SIZE 0x04000000 | ||
30 | /* Area 4 */ | ||
31 | #define PA_PCIC 0x10000000 /* MR-SHPC-01 PCMCIA */ | ||
32 | #define PA_MRSHPC 0xb03fffe0 /* MR-SHPC-01 PCMCIA controller */ | ||
33 | #define PA_MRSHPC_MW1 0xb0400000 /* MR-SHPC-01 memory window base */ | ||
34 | #define PA_MRSHPC_MW2 0xb0500000 /* MR-SHPC-01 attribute window base */ | ||
35 | #define PA_MRSHPC_IO 0xb0600000 /* MR-SHPC-01 I/O window base */ | ||
36 | #define MRSHPC_OPTION (PA_MRSHPC + 6) | ||
37 | #define MRSHPC_CSR (PA_MRSHPC + 8) | ||
38 | #define MRSHPC_ISR (PA_MRSHPC + 10) | ||
39 | #define MRSHPC_ICR (PA_MRSHPC + 12) | ||
40 | #define MRSHPC_CPWCR (PA_MRSHPC + 14) | ||
41 | #define MRSHPC_MW0CR1 (PA_MRSHPC + 16) | ||
42 | #define MRSHPC_MW1CR1 (PA_MRSHPC + 18) | ||
43 | #define MRSHPC_IOWCR1 (PA_MRSHPC + 20) | ||
44 | #define MRSHPC_MW0CR2 (PA_MRSHPC + 22) | ||
45 | #define MRSHPC_MW1CR2 (PA_MRSHPC + 24) | ||
46 | #define MRSHPC_IOWCR2 (PA_MRSHPC + 26) | ||
47 | #define MRSHPC_CDCR (PA_MRSHPC + 28) | ||
48 | #define MRSHPC_PCIC_INFO (PA_MRSHPC + 30) | ||
49 | #define PA_LED 0xb0C00000 /* LED */ | ||
50 | #define LED_SHIFT 0 | ||
51 | #define PA_DIPSW 0xb0900000 /* Dip switch 31 */ | ||
52 | #define PA_CPLD_MODESET 0xb1400004 /* CPLD Mode set register */ | ||
53 | #define PA_CPLD_ST 0xb1400008 /* CPLD Interrupt status register */ | ||
54 | #define PA_CPLD_IMSK 0xb140000a /* CPLD Interrupt mask register */ | ||
55 | /* Area 5 */ | ||
56 | #define PA_EXT5 0x14000000 | ||
57 | #define PA_EXT5_SIZE 0x04000000 | ||
58 | /* Area 6 */ | ||
59 | #define PA_LCD1 0xb8000000 | ||
60 | #define PA_LCD2 0xb8800000 | ||
61 | |||
62 | #define __IO_PREFIX sh7343se | ||
63 | #include <asm/io_generic.h> | ||
64 | |||
65 | /* External Multiplexed interrupts */ | ||
66 | #define PC_IRQ0 OFFCHIP_IRQ_BASE | ||
67 | #define PC_IRQ1 (PC_IRQ0 + 1) | ||
68 | #define PC_IRQ2 (PC_IRQ1 + 1) | ||
69 | #define PC_IRQ3 (PC_IRQ2 + 1) | ||
70 | |||
71 | #define EXT_IRQ0 (PC_IRQ3 + 1) | ||
72 | #define EXT_IRQ1 (EXT_IRQ0 + 1) | ||
73 | #define EXT_IRQ2 (EXT_IRQ1 + 1) | ||
74 | #define EXT_IRQ3 (EXT_IRQ2 + 1) | ||
75 | |||
76 | #define USB_IRQ0 (EXT_IRQ3 + 1) | ||
77 | #define USB_IRQ1 (USB_IRQ0 + 1) | ||
78 | |||
79 | #define UART_IRQ0 (USB_IRQ1 + 1) | ||
80 | #define UART_IRQ1 (UART_IRQ0 + 1) | ||
81 | |||
82 | #endif /* __ASM_SH_HITACHI_SE7343_H */ | ||
diff --git a/include/asm-sh/se7751/se7751.h b/include/asm-sh/se7751.h index 738e22bebdfb..88cd379d9084 100644 --- a/include/asm-sh/se7751/se7751.h +++ b/include/asm-sh/se7751.h | |||
@@ -65,4 +65,7 @@ | |||
65 | 65 | ||
66 | #define IRQ_79C973 13 | 66 | #define IRQ_79C973 13 |
67 | 67 | ||
68 | #define __IO_PREFIX sh7751se | ||
69 | #include <asm/io_generic.h> | ||
70 | |||
68 | #endif /* __ASM_SH_HITACHI_7751SE_H */ | 71 | #endif /* __ASM_SH_HITACHI_7751SE_H */ |
diff --git a/include/asm-sh/se7751/io.h b/include/asm-sh/se7751/io.h deleted file mode 100644 index 78d8f5744bc5..000000000000 --- a/include/asm-sh/se7751/io.h +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/io_7751se.h | ||
3 | * | ||
4 | * Modified version of io_se.h for the 7751se-specific functions. | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * IO functions for an Hitachi SolutionEngine | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_SH_IO_7751SE_H | ||
13 | #define _ASM_SH_IO_7751SE_H | ||
14 | |||
15 | extern unsigned char sh7751se_inb(unsigned long port); | ||
16 | extern unsigned short sh7751se_inw(unsigned long port); | ||
17 | extern unsigned int sh7751se_inl(unsigned long port); | ||
18 | |||
19 | extern void sh7751se_outb(unsigned char value, unsigned long port); | ||
20 | extern void sh7751se_outw(unsigned short value, unsigned long port); | ||
21 | extern void sh7751se_outl(unsigned int value, unsigned long port); | ||
22 | |||
23 | extern unsigned char sh7751se_inb_p(unsigned long port); | ||
24 | extern void sh7751se_outb_p(unsigned char value, unsigned long port); | ||
25 | |||
26 | extern void sh7751se_insb(unsigned long port, void *addr, unsigned long count); | ||
27 | extern void sh7751se_insw(unsigned long port, void *addr, unsigned long count); | ||
28 | extern void sh7751se_insl(unsigned long port, void *addr, unsigned long count); | ||
29 | extern void sh7751se_outsb(unsigned long port, const void *addr, unsigned long count); | ||
30 | extern void sh7751se_outsw(unsigned long port, const void *addr, unsigned long count); | ||
31 | extern void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count); | ||
32 | |||
33 | extern unsigned char sh7751se_readb(unsigned long addr); | ||
34 | extern unsigned short sh7751se_readw(unsigned long addr); | ||
35 | extern unsigned int sh7751se_readl(unsigned long addr); | ||
36 | extern void sh7751se_writeb(unsigned char b, unsigned long addr); | ||
37 | extern void sh7751se_writew(unsigned short b, unsigned long addr); | ||
38 | extern void sh7751se_writel(unsigned int b, unsigned long addr); | ||
39 | |||
40 | extern unsigned long sh7751se_isa_port2addr(unsigned long offset); | ||
41 | |||
42 | #endif /* _ASM_SH_IO_7751SE_H */ | ||
diff --git a/include/asm-sh/setup.h b/include/asm-sh/setup.h index d19de7c8df4e..34ca8a7f06ba 100644 --- a/include/asm-sh/setup.h +++ b/include/asm-sh/setup.h | |||
@@ -4,5 +4,7 @@ | |||
4 | 4 | ||
5 | #define COMMAND_LINE_SIZE 256 | 5 | #define COMMAND_LINE_SIZE 256 |
6 | 6 | ||
7 | int setup_early_printk(char *); | ||
8 | |||
7 | #endif /* _SH_SETUP_H */ | 9 | #endif /* _SH_SETUP_H */ |
8 | #endif /* __KERNEL__ */ | 10 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-sh/sfp-machine.h b/include/asm-sh/sfp-machine.h new file mode 100644 index 000000000000..8a6399a8cfe0 --- /dev/null +++ b/include/asm-sh/sfp-machine.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /* Machine-dependent software floating-point definitions. | ||
2 | SuperH kernel version. | ||
3 | Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. | ||
4 | This file is part of the GNU C Library. | ||
5 | Contributed by Richard Henderson (rth@cygnus.com), | ||
6 | Jakub Jelinek (jj@ultra.linux.cz), | ||
7 | David S. Miller (davem@redhat.com) and | ||
8 | Peter Maydell (pmaydell@chiark.greenend.org.uk). | ||
9 | |||
10 | The GNU C Library is free software; you can redistribute it and/or | ||
11 | modify it under the terms of the GNU Library General Public License as | ||
12 | published by the Free Software Foundation; either version 2 of the | ||
13 | License, or (at your option) any later version. | ||
14 | |||
15 | The GNU C Library is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
18 | Library General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU Library General Public | ||
21 | License along with the GNU C Library; see the file COPYING.LIB. If | ||
22 | not, write to the Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
24 | |||
25 | #ifndef _SFP_MACHINE_H | ||
26 | #define _SFP_MACHINE_H | ||
27 | |||
28 | #include <linux/config.h> | ||
29 | |||
30 | #define _FP_W_TYPE_SIZE 32 | ||
31 | #define _FP_W_TYPE unsigned long | ||
32 | #define _FP_WS_TYPE signed long | ||
33 | #define _FP_I_TYPE long | ||
34 | |||
35 | #define _FP_MUL_MEAT_S(R,X,Y) \ | ||
36 | _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) | ||
37 | #define _FP_MUL_MEAT_D(R,X,Y) \ | ||
38 | _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) | ||
39 | #define _FP_MUL_MEAT_Q(R,X,Y) \ | ||
40 | _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) | ||
41 | |||
42 | #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) | ||
43 | #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) | ||
44 | #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) | ||
45 | |||
46 | #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) | ||
47 | #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 | ||
48 | #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 | ||
49 | #define _FP_NANSIGN_S 0 | ||
50 | #define _FP_NANSIGN_D 0 | ||
51 | #define _FP_NANSIGN_Q 0 | ||
52 | |||
53 | #define _FP_KEEPNANFRACP 1 | ||
54 | |||
55 | /* | ||
56 | * If one NaN is signaling and the other is not, | ||
57 | * we choose that one, otherwise we choose X. | ||
58 | */ | ||
59 | #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ | ||
60 | do { \ | ||
61 | if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ | ||
62 | && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ | ||
63 | { \ | ||
64 | R##_s = Y##_s; \ | ||
65 | _FP_FRAC_COPY_##wc(R,Y); \ | ||
66 | } \ | ||
67 | else \ | ||
68 | { \ | ||
69 | R##_s = X##_s; \ | ||
70 | _FP_FRAC_COPY_##wc(R,X); \ | ||
71 | } \ | ||
72 | R##_c = FP_CLS_NAN; \ | ||
73 | } while (0) | ||
74 | |||
75 | //#define FP_ROUNDMODE FPSCR_RM | ||
76 | #define FP_DENORM_ZERO 1/*FPSCR_DN*/ | ||
77 | |||
78 | /* Exception flags. */ | ||
79 | #define FP_EX_INVALID (1<<4) | ||
80 | #define FP_EX_DIVZERO (1<<3) | ||
81 | #define FP_EX_OVERFLOW (1<<2) | ||
82 | #define FP_EX_UNDERFLOW (1<<1) | ||
83 | #define FP_EX_INEXACT (1<<0) | ||
84 | |||
85 | #endif | ||
86 | |||
diff --git a/include/asm-sh/sh03/io.h b/include/asm-sh/sh03/io.h index 25792e9831ea..df3b187ef883 100644 --- a/include/asm-sh/sh03/io.h +++ b/include/asm-sh/sh03/io.h | |||
@@ -33,14 +33,6 @@ | |||
33 | #define IRL3_IPR_POS 0 | 33 | #define IRL3_IPR_POS 0 |
34 | #define IRL3_PRIORITY 4 | 34 | #define IRL3_PRIORITY 4 |
35 | 35 | ||
36 | 36 | void heartbeat_sh03(void); | |
37 | extern unsigned long sh03_isa_port2addr(unsigned long offset); | ||
38 | |||
39 | extern void setup_sh03(void); | ||
40 | extern void init_sh03_IRQ(void); | ||
41 | extern void heartbeat_sh03(void); | ||
42 | |||
43 | extern void sh03_rtc_gettimeofday(struct timeval *tv); | ||
44 | extern int sh03_rtc_settimeofday(const struct timeval *tv); | ||
45 | 37 | ||
46 | #endif /* _ASM_SH_IO_SH03_H */ | 38 | #endif /* _ASM_SH_IO_SH03_H */ |
diff --git a/include/asm-sh/sh2000/sh2000.h b/include/asm-sh/sh2000/sh2000.h deleted file mode 100644 index 8d547324d59a..000000000000 --- a/include/asm-sh/sh2000/sh2000.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #ifndef __ASM_SH_SH2000_SH2000_H | ||
2 | #define __ASM_SH_SH2000_SH2000_H | ||
3 | |||
4 | /* arch/sh/boards/sh2000/setup.c */ | ||
5 | extern int setup_sh2000(void); | ||
6 | |||
7 | #endif /* __ASM_SH_SH2000_SH2000_H */ | ||
8 | |||
diff --git a/include/asm-sh/shmin/shmin.h b/include/asm-sh/shmin/shmin.h new file mode 100644 index 000000000000..36ba138a81fb --- /dev/null +++ b/include/asm-sh/shmin/shmin.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef __ASM_SH_SHMIN_H | ||
2 | #define __ASM_SH_SHMIN_H | ||
3 | |||
4 | #define SHMIN_IO_BASE 0xb0000000UL | ||
5 | |||
6 | #define SHMIN_NE_IRQ IRQ2_IRQ | ||
7 | #define SHMIN_NE_BASE 0x300 | ||
8 | |||
9 | #endif | ||
diff --git a/include/asm-sh/shmparam.h b/include/asm-sh/shmparam.h index 0a95604b9b66..ba1758d90106 100644 --- a/include/asm-sh/shmparam.h +++ b/include/asm-sh/shmparam.h | |||
@@ -1,8 +1,22 @@ | |||
1 | /* | ||
2 | * include/asm-sh/shmparam.h | ||
3 | * | ||
4 | * Copyright (C) 1999 Niibe Yutaka | ||
5 | * Copyright (C) 2006 Paul Mundt | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
1 | #ifndef __ASM_SH_SHMPARAM_H | 11 | #ifndef __ASM_SH_SHMPARAM_H |
2 | #define __ASM_SH_SHMPARAM_H | 12 | #define __ASM_SH_SHMPARAM_H |
3 | #ifdef __KERNEL__ | ||
4 | 13 | ||
5 | #include <asm/cpu/shmparam.h> | 14 | /* |
15 | * SH-4 and SH-3 7705 have an aliasing dcache. Bump this up to a sensible value | ||
16 | * for everyone, and work out the specifics from the probed cache descriptor. | ||
17 | */ | ||
18 | #define SHMLBA 0x4000 /* attach addr a multiple of this */ | ||
19 | |||
20 | #define __ARCH_FORCE_SHMLBA | ||
6 | 21 | ||
7 | #endif /* __KERNEL__ */ | ||
8 | #endif /* __ASM_SH_SHMPARAM_H */ | 22 | #endif /* __ASM_SH_SHMPARAM_H */ |
diff --git a/include/asm-sh/se/smc37c93x.h b/include/asm-sh/smc37c93x.h index 585da2a8fc45..585da2a8fc45 100644 --- a/include/asm-sh/se/smc37c93x.h +++ b/include/asm-sh/smc37c93x.h | |||
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h index f57c4fe9692a..71ecddf70db3 100644 --- a/include/asm-sh/smp.h +++ b/include/asm-sh/smp.h | |||
@@ -19,11 +19,6 @@ | |||
19 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
20 | #include <asm/current.h> | 20 | #include <asm/current.h> |
21 | 21 | ||
22 | extern cpumask_t cpu_online_map; | ||
23 | extern cpumask_t cpu_possible_map; | ||
24 | |||
25 | #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) | ||
26 | |||
27 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 22 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
28 | 23 | ||
29 | /* I've no idea what the real meaning of this is */ | 24 | /* I've no idea what the real meaning of this is */ |
diff --git a/include/asm-sh/snapgear/io.h b/include/asm-sh/snapgear.h index bfa97ac06280..6b5e4ddc073a 100644 --- a/include/asm-sh/snapgear/io.h +++ b/include/asm-sh/snapgear.h | |||
@@ -40,21 +40,8 @@ | |||
40 | #define IRL3_PRIORITY 4 | 40 | #define IRL3_PRIORITY 4 |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | extern unsigned char snapgear_inb(unsigned long port); | 43 | #define __IO_PREFIX snapgear |
44 | extern unsigned short snapgear_inw(unsigned long port); | 44 | #include <asm/io_generic.h> |
45 | extern unsigned int snapgear_inl(unsigned long port); | ||
46 | |||
47 | extern void snapgear_outb(unsigned char value, unsigned long port); | ||
48 | extern void snapgear_outw(unsigned short value, unsigned long port); | ||
49 | extern void snapgear_outl(unsigned int value, unsigned long port); | ||
50 | |||
51 | extern unsigned char snapgear_inb_p(unsigned long port); | ||
52 | extern void snapgear_outb_p(unsigned char value, unsigned long port); | ||
53 | |||
54 | extern void snapgear_insl(unsigned long port, void *addr, unsigned long count); | ||
55 | extern void snapgear_outsl(unsigned long port, const void *addr, unsigned long count); | ||
56 | |||
57 | extern unsigned long snapgear_isa_port2addr(unsigned long offset); | ||
58 | 45 | ||
59 | #ifdef CONFIG_SH_SECUREEDGE5410 | 46 | #ifdef CONFIG_SH_SECUREEDGE5410 |
60 | /* | 47 | /* |
@@ -79,14 +66,14 @@ extern unsigned long snapgear_isa_port2addr(unsigned long offset); | |||
79 | * D12 - RTS RESET | 66 | * D12 - RTS RESET |
80 | */ | 67 | */ |
81 | 68 | ||
82 | #define SECUREEDGE_IOPORT_ADDR ((volatile short *) 0xb0000000) | 69 | #define SECUREEDGE_IOPORT_ADDR ((volatile short *) 0xb0000000) |
83 | extern unsigned short secureedge5410_ioport; | 70 | extern unsigned short secureedge5410_ioport; |
84 | 71 | ||
85 | #define SECUREEDGE_WRITE_IOPORT(val, mask) (*SECUREEDGE_IOPORT_ADDR = \ | 72 | #define SECUREEDGE_WRITE_IOPORT(val, mask) (*SECUREEDGE_IOPORT_ADDR = \ |
86 | (secureedge5410_ioport = \ | 73 | (secureedge5410_ioport = \ |
87 | ((secureedge5410_ioport & ~(mask)) | ((val) & (mask))))) | 74 | ((secureedge5410_ioport & ~(mask)) | ((val) & (mask))))) |
88 | #define SECUREEDGE_READ_IOPORT() \ | 75 | #define SECUREEDGE_READ_IOPORT() \ |
89 | ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817)) | 76 | ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817)) |
90 | #endif | 77 | #endif |
91 | 78 | ||
92 | #endif /* _ASM_SH_IO_SNAPGEAR_H */ | 79 | #endif /* _ASM_SH_IO_SNAPGEAR_H */ |
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h index ad35ad4958f4..6c1f8fde5ac4 100644 --- a/include/asm-sh/system.h +++ b/include/asm-sh/system.h | |||
@@ -6,6 +6,7 @@ | |||
6 | * Copyright (C) 2002 Paul Mundt | 6 | * Copyright (C) 2002 Paul Mundt |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <asm/types.h> | ||
9 | 10 | ||
10 | /* | 11 | /* |
11 | * switch_to() should switch tasks to task nr n, first | 12 | * switch_to() should switch tasks to task nr n, first |
@@ -66,13 +67,20 @@ static inline void sched_cacheflush(void) | |||
66 | { | 67 | { |
67 | } | 68 | } |
68 | 69 | ||
69 | #define nop() __asm__ __volatile__ ("nop") | 70 | #ifdef CONFIG_CPU_SH4A |
70 | 71 | #define __icbi() \ | |
71 | 72 | { \ | |
72 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | 73 | unsigned long __addr; \ |
74 | __addr = 0xa8000000; \ | ||
75 | __asm__ __volatile__( \ | ||
76 | "icbi %0\n\t" \ | ||
77 | : /* no output */ \ | ||
78 | : "m" (__m(__addr))); \ | ||
79 | } | ||
80 | #endif | ||
73 | 81 | ||
74 | static __inline__ unsigned long tas(volatile int *m) | 82 | static inline unsigned long tas(volatile int *m) |
75 | { /* #define tas(ptr) (xchg((ptr),1)) */ | 83 | { |
76 | unsigned long retval; | 84 | unsigned long retval; |
77 | 85 | ||
78 | __asm__ __volatile__ ("tas.b @%1\n\t" | 86 | __asm__ __volatile__ ("tas.b @%1\n\t" |
@@ -81,12 +89,33 @@ static __inline__ unsigned long tas(volatile int *m) | |||
81 | return retval; | 89 | return retval; |
82 | } | 90 | } |
83 | 91 | ||
84 | extern void __xchg_called_with_bad_pointer(void); | 92 | /* |
85 | 93 | * A brief note on ctrl_barrier(), the control register write barrier. | |
86 | #define mb() __asm__ __volatile__ ("": : :"memory") | 94 | * |
87 | #define rmb() mb() | 95 | * Legacy SH cores typically require a sequence of 8 nops after |
88 | #define wmb() __asm__ __volatile__ ("": : :"memory") | 96 | * modification of a control register in order for the changes to take |
97 | * effect. On newer cores (like the sh4a and sh5) this is accomplished | ||
98 | * with icbi. | ||
99 | * | ||
100 | * Also note that on sh4a in the icbi case we can forego a synco for the | ||
101 | * write barrier, as it's not necessary for control registers. | ||
102 | * | ||
103 | * Historically we have only done this type of barrier for the MMUCR, but | ||
104 | * it's also necessary for the CCR, so we make it generic here instead. | ||
105 | */ | ||
106 | #ifdef CONFIG_CPU_SH4A | ||
107 | #define mb() __asm__ __volatile__ ("synco": : :"memory") | ||
108 | #define rmb() mb() | ||
109 | #define wmb() __asm__ __volatile__ ("synco": : :"memory") | ||
110 | #define ctrl_barrier() __icbi() | ||
111 | #define read_barrier_depends() do { } while(0) | ||
112 | #else | ||
113 | #define mb() __asm__ __volatile__ ("": : :"memory") | ||
114 | #define rmb() mb() | ||
115 | #define wmb() __asm__ __volatile__ ("": : :"memory") | ||
116 | #define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop") | ||
89 | #define read_barrier_depends() do { } while(0) | 117 | #define read_barrier_depends() do { } while(0) |
118 | #endif | ||
90 | 119 | ||
91 | #ifdef CONFIG_SMP | 120 | #ifdef CONFIG_SMP |
92 | #define smp_mb() mb() | 121 | #define smp_mb() mb() |
@@ -103,7 +132,8 @@ extern void __xchg_called_with_bad_pointer(void); | |||
103 | #define set_mb(var, value) do { xchg(&var, value); } while (0) | 132 | #define set_mb(var, value) do { xchg(&var, value); } while (0) |
104 | 133 | ||
105 | /* Interrupt Control */ | 134 | /* Interrupt Control */ |
106 | static __inline__ void local_irq_enable(void) | 135 | #ifdef CONFIG_CPU_HAS_SR_RB |
136 | static inline void local_irq_enable(void) | ||
107 | { | 137 | { |
108 | unsigned long __dummy0, __dummy1; | 138 | unsigned long __dummy0, __dummy1; |
109 | 139 | ||
@@ -116,8 +146,22 @@ static __inline__ void local_irq_enable(void) | |||
116 | : "1" (~0x000000f0) | 146 | : "1" (~0x000000f0) |
117 | : "memory"); | 147 | : "memory"); |
118 | } | 148 | } |
149 | #else | ||
150 | static inline void local_irq_enable(void) | ||
151 | { | ||
152 | unsigned long __dummy0, __dummy1; | ||
153 | |||
154 | __asm__ __volatile__ ( | ||
155 | "stc sr, %0\n\t" | ||
156 | "and %1, %0\n\t" | ||
157 | "ldc %0, sr\n\t" | ||
158 | : "=&r" (__dummy0), "=r" (__dummy1) | ||
159 | : "1" (~0x000000f0) | ||
160 | : "memory"); | ||
161 | } | ||
162 | #endif | ||
119 | 163 | ||
120 | static __inline__ void local_irq_disable(void) | 164 | static inline void local_irq_disable(void) |
121 | { | 165 | { |
122 | unsigned long __dummy; | 166 | unsigned long __dummy; |
123 | __asm__ __volatile__("stc sr, %0\n\t" | 167 | __asm__ __volatile__("stc sr, %0\n\t" |
@@ -128,6 +172,31 @@ static __inline__ void local_irq_disable(void) | |||
128 | : "memory"); | 172 | : "memory"); |
129 | } | 173 | } |
130 | 174 | ||
175 | static inline void set_bl_bit(void) | ||
176 | { | ||
177 | unsigned long __dummy0, __dummy1; | ||
178 | |||
179 | __asm__ __volatile__ ("stc sr, %0\n\t" | ||
180 | "or %2, %0\n\t" | ||
181 | "and %3, %0\n\t" | ||
182 | "ldc %0, sr" | ||
183 | : "=&r" (__dummy0), "=r" (__dummy1) | ||
184 | : "r" (0x10000000), "r" (0xffffff0f) | ||
185 | : "memory"); | ||
186 | } | ||
187 | |||
188 | static inline void clear_bl_bit(void) | ||
189 | { | ||
190 | unsigned long __dummy0, __dummy1; | ||
191 | |||
192 | __asm__ __volatile__ ("stc sr, %0\n\t" | ||
193 | "and %2, %0\n\t" | ||
194 | "ldc %0, sr" | ||
195 | : "=&r" (__dummy0), "=r" (__dummy1) | ||
196 | : "1" (~0x10000000) | ||
197 | : "memory"); | ||
198 | } | ||
199 | |||
131 | #define local_save_flags(x) \ | 200 | #define local_save_flags(x) \ |
132 | __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" ) | 201 | __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" ) |
133 | 202 | ||
@@ -138,7 +207,7 @@ static __inline__ void local_irq_disable(void) | |||
138 | (flags != 0); \ | 207 | (flags != 0); \ |
139 | }) | 208 | }) |
140 | 209 | ||
141 | static __inline__ unsigned long local_irq_save(void) | 210 | static inline unsigned long local_irq_save(void) |
142 | { | 211 | { |
143 | unsigned long flags, __dummy; | 212 | unsigned long flags, __dummy; |
144 | 213 | ||
@@ -154,35 +223,9 @@ static __inline__ unsigned long local_irq_save(void) | |||
154 | return flags; | 223 | return flags; |
155 | } | 224 | } |
156 | 225 | ||
157 | #ifdef DEBUG_CLI_STI | 226 | #define local_irq_restore(x) do { \ |
158 | static __inline__ void local_irq_restore(unsigned long x) | ||
159 | { | ||
160 | if ((x & 0x000000f0) != 0x000000f0) | ||
161 | local_irq_enable(); | ||
162 | else { | ||
163 | unsigned long flags; | ||
164 | local_save_flags(flags); | ||
165 | |||
166 | if (flags == 0) { | ||
167 | extern void dump_stack(void); | ||
168 | printk(KERN_ERR "BUG!\n"); | ||
169 | dump_stack(); | ||
170 | local_irq_disable(); | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | #else | ||
175 | #define local_irq_restore(x) do { \ | ||
176 | if ((x & 0x000000f0) != 0x000000f0) \ | ||
177 | local_irq_enable(); \ | ||
178 | } while (0) | ||
179 | #endif | ||
180 | |||
181 | #define really_restore_flags(x) do { \ | ||
182 | if ((x & 0x000000f0) != 0x000000f0) \ | 227 | if ((x & 0x000000f0) != 0x000000f0) \ |
183 | local_irq_enable(); \ | 228 | local_irq_enable(); \ |
184 | else \ | ||
185 | local_irq_disable(); \ | ||
186 | } while (0) | 229 | } while (0) |
187 | 230 | ||
188 | /* | 231 | /* |
@@ -210,8 +253,8 @@ do { \ | |||
210 | #define back_to_P1() \ | 253 | #define back_to_P1() \ |
211 | do { \ | 254 | do { \ |
212 | unsigned long __dummy; \ | 255 | unsigned long __dummy; \ |
256 | ctrl_barrier(); \ | ||
213 | __asm__ __volatile__( \ | 257 | __asm__ __volatile__( \ |
214 | "nop;nop;nop;nop;nop;nop;nop\n\t" \ | ||
215 | "mov.l 1f, %0\n\t" \ | 258 | "mov.l 1f, %0\n\t" \ |
216 | "jmp @%0\n\t" \ | 259 | "jmp @%0\n\t" \ |
217 | " nop\n\t" \ | 260 | " nop\n\t" \ |
@@ -224,7 +267,7 @@ do { \ | |||
224 | /* For spinlocks etc */ | 267 | /* For spinlocks etc */ |
225 | #define local_irq_save(x) x = local_irq_save() | 268 | #define local_irq_save(x) x = local_irq_save() |
226 | 269 | ||
227 | static __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) | 270 | static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) |
228 | { | 271 | { |
229 | unsigned long flags, retval; | 272 | unsigned long flags, retval; |
230 | 273 | ||
@@ -235,7 +278,7 @@ static __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) | |||
235 | return retval; | 278 | return retval; |
236 | } | 279 | } |
237 | 280 | ||
238 | static __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) | 281 | static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val) |
239 | { | 282 | { |
240 | unsigned long flags, retval; | 283 | unsigned long flags, retval; |
241 | 284 | ||
@@ -246,20 +289,70 @@ static __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned lon | |||
246 | return retval; | 289 | return retval; |
247 | } | 290 | } |
248 | 291 | ||
249 | static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | 292 | extern void __xchg_called_with_bad_pointer(void); |
293 | |||
294 | #define __xchg(ptr, x, size) \ | ||
295 | ({ \ | ||
296 | unsigned long __xchg__res; \ | ||
297 | volatile void *__xchg_ptr = (ptr); \ | ||
298 | switch (size) { \ | ||
299 | case 4: \ | ||
300 | __xchg__res = xchg_u32(__xchg_ptr, x); \ | ||
301 | break; \ | ||
302 | case 1: \ | ||
303 | __xchg__res = xchg_u8(__xchg_ptr, x); \ | ||
304 | break; \ | ||
305 | default: \ | ||
306 | __xchg_called_with_bad_pointer(); \ | ||
307 | __xchg__res = x; \ | ||
308 | break; \ | ||
309 | } \ | ||
310 | \ | ||
311 | __xchg__res; \ | ||
312 | }) | ||
313 | |||
314 | #define xchg(ptr,x) \ | ||
315 | ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)))) | ||
316 | |||
317 | static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old, | ||
318 | unsigned long new) | ||
319 | { | ||
320 | __u32 retval; | ||
321 | unsigned long flags; | ||
322 | |||
323 | local_irq_save(flags); | ||
324 | retval = *m; | ||
325 | if (retval == old) | ||
326 | *m = new; | ||
327 | local_irq_restore(flags); /* implies memory barrier */ | ||
328 | return retval; | ||
329 | } | ||
330 | |||
331 | /* This function doesn't exist, so you'll get a linker error | ||
332 | * if something tries to do an invalid cmpxchg(). */ | ||
333 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
334 | |||
335 | #define __HAVE_ARCH_CMPXCHG 1 | ||
336 | |||
337 | static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, | ||
338 | unsigned long new, int size) | ||
250 | { | 339 | { |
251 | switch (size) { | 340 | switch (size) { |
252 | case 4: | 341 | case 4: |
253 | return xchg_u32(ptr, x); | 342 | return __cmpxchg_u32(ptr, old, new); |
254 | break; | ||
255 | case 1: | ||
256 | return xchg_u8(ptr, x); | ||
257 | break; | ||
258 | } | 343 | } |
259 | __xchg_called_with_bad_pointer(); | 344 | __cmpxchg_called_with_bad_pointer(); |
260 | return x; | 345 | return old; |
261 | } | 346 | } |
262 | 347 | ||
348 | #define cmpxchg(ptr,o,n) \ | ||
349 | ({ \ | ||
350 | __typeof__(*(ptr)) _o_ = (o); \ | ||
351 | __typeof__(*(ptr)) _n_ = (n); \ | ||
352 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
353 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
354 | }) | ||
355 | |||
263 | /* XXX | 356 | /* XXX |
264 | * disable hlt during certain critical i/o operations | 357 | * disable hlt during certain critical i/o operations |
265 | */ | 358 | */ |
diff --git a/include/asm-sh/systemh/io.h b/include/asm-sh/systemh/io.h deleted file mode 100644 index 327849b49db8..000000000000 --- a/include/asm-sh/systemh/io.h +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/systemh/io.h | ||
3 | * | ||
4 | * Stupid I/O definitions for SystemH, cloned from SE7751. | ||
5 | * | ||
6 | * Copyright (C) 2003 Paul Mundt | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #ifndef __ASM_SH_SYSTEMH_IO_H | ||
13 | #define __ASM_SH_SYSTEMH_IO_H | ||
14 | |||
15 | extern unsigned char sh7751systemh_inb(unsigned long port); | ||
16 | extern unsigned short sh7751systemh_inw(unsigned long port); | ||
17 | extern unsigned int sh7751systemh_inl(unsigned long port); | ||
18 | |||
19 | extern void sh7751systemh_outb(unsigned char value, unsigned long port); | ||
20 | extern void sh7751systemh_outw(unsigned short value, unsigned long port); | ||
21 | extern void sh7751systemh_outl(unsigned int value, unsigned long port); | ||
22 | |||
23 | extern unsigned char sh7751systemh_inb_p(unsigned long port); | ||
24 | extern void sh7751systemh_outb_p(unsigned char value, unsigned long port); | ||
25 | |||
26 | extern void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count); | ||
27 | extern void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count); | ||
28 | extern void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count); | ||
29 | extern void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count); | ||
30 | extern void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long count); | ||
31 | extern void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count); | ||
32 | |||
33 | extern unsigned char sh7751systemh_readb(unsigned long addr); | ||
34 | extern unsigned short sh7751systemh_readw(unsigned long addr); | ||
35 | extern unsigned int sh7751systemh_readl(unsigned long addr); | ||
36 | extern void sh7751systemh_writeb(unsigned char b, unsigned long addr); | ||
37 | extern void sh7751systemh_writew(unsigned short b, unsigned long addr); | ||
38 | extern void sh7751systemh_writel(unsigned int b, unsigned long addr); | ||
39 | |||
40 | extern unsigned long sh7751systemh_isa_port2addr(unsigned long offset); | ||
41 | |||
42 | #endif /* __ASM_SH_SYSTEMH_IO_H */ | ||
43 | |||
diff --git a/include/asm-sh/systemh/7751systemh.h b/include/asm-sh/systemh7751.h index 4170531bdbd9..b143bb2a2ca7 100644 --- a/include/asm-sh/systemh/7751systemh.h +++ b/include/asm-sh/systemh7751.h | |||
@@ -65,4 +65,7 @@ | |||
65 | 65 | ||
66 | #define IRQ_79C973 13 | 66 | #define IRQ_79C973 13 |
67 | 67 | ||
68 | #define __IO_PREFIX sh7751systemh | ||
69 | #include <asm/io_generic.h> | ||
70 | |||
68 | #endif /* __ASM_SH_SYSTEMH_7751SYSTEMH_H */ | 71 | #endif /* __ASM_SH_SYSTEMH_7751SYSTEMH_H */ |
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h index 7345350d98c0..3ebc3f9039eb 100644 --- a/include/asm-sh/thread_info.h +++ b/include/asm-sh/thread_info.h | |||
@@ -9,8 +9,8 @@ | |||
9 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) | 9 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) |
10 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller | 10 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller |
11 | */ | 11 | */ |
12 | |||
13 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | #include <asm/page.h> | ||
14 | 14 | ||
15 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
16 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
@@ -21,7 +21,10 @@ struct thread_info { | |||
21 | unsigned long flags; /* low level flags */ | 21 | unsigned long flags; /* low level flags */ |
22 | __u32 cpu; | 22 | __u32 cpu; |
23 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | 23 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
24 | mm_segment_t addr_limit; /* thread address space */ | ||
24 | struct restart_block restart_block; | 25 | struct restart_block restart_block; |
26 | unsigned long previous_sp; /* sp of previous stack in case | ||
27 | of nested IRQ stacks */ | ||
25 | __u8 supervisor_stack[0]; | 28 | __u8 supervisor_stack[0]; |
26 | }; | 29 | }; |
27 | 30 | ||
@@ -29,6 +32,13 @@ struct thread_info { | |||
29 | 32 | ||
30 | #define PREEMPT_ACTIVE 0x10000000 | 33 | #define PREEMPT_ACTIVE 0x10000000 |
31 | 34 | ||
35 | #ifdef CONFIG_4KSTACKS | ||
36 | #define THREAD_SIZE (PAGE_SIZE) | ||
37 | #else | ||
38 | #define THREAD_SIZE (PAGE_SIZE * 2) | ||
39 | #endif | ||
40 | #define STACK_WARN (THREAD_SIZE / 8) | ||
41 | |||
32 | /* | 42 | /* |
33 | * macros/functions for gaining access to the thread information structure | 43 | * macros/functions for gaining access to the thread information structure |
34 | */ | 44 | */ |
@@ -40,6 +50,7 @@ struct thread_info { | |||
40 | .flags = 0, \ | 50 | .flags = 0, \ |
41 | .cpu = 0, \ | 51 | .cpu = 0, \ |
42 | .preempt_count = 1, \ | 52 | .preempt_count = 1, \ |
53 | .addr_limit = KERNEL_DS, \ | ||
43 | .restart_block = { \ | 54 | .restart_block = { \ |
44 | .fn = do_no_restart_syscall, \ | 55 | .fn = do_no_restart_syscall, \ |
45 | }, \ | 56 | }, \ |
@@ -48,24 +59,42 @@ struct thread_info { | |||
48 | #define init_thread_info (init_thread_union.thread_info) | 59 | #define init_thread_info (init_thread_union.thread_info) |
49 | #define init_stack (init_thread_union.stack) | 60 | #define init_stack (init_thread_union.stack) |
50 | 61 | ||
62 | /* how to get the current stack pointer from C */ | ||
63 | register unsigned long current_stack_pointer asm("r15") __attribute_used__; | ||
64 | |||
51 | /* how to get the thread information struct from C */ | 65 | /* how to get the thread information struct from C */ |
52 | static inline struct thread_info *current_thread_info(void) | 66 | static inline struct thread_info *current_thread_info(void) |
53 | { | 67 | { |
54 | struct thread_info *ti; | 68 | struct thread_info *ti; |
69 | #ifdef CONFIG_CPU_HAS_SR_RB | ||
55 | __asm__("stc r7_bank, %0" : "=r" (ti)); | 70 | __asm__("stc r7_bank, %0" : "=r" (ti)); |
71 | #else | ||
72 | unsigned long __dummy; | ||
73 | |||
74 | __asm__ __volatile__ ( | ||
75 | "mov r15, %0\n\t" | ||
76 | "and %1, %0\n\t" | ||
77 | : "=&r" (ti), "=r" (__dummy) | ||
78 | : "1" (~(THREAD_SIZE - 1)) | ||
79 | : "memory"); | ||
80 | #endif | ||
81 | |||
56 | return ti; | 82 | return ti; |
57 | } | 83 | } |
58 | 84 | ||
59 | /* thread information allocation */ | 85 | /* thread information allocation */ |
60 | #define THREAD_SIZE (2*PAGE_SIZE) | 86 | #ifdef CONFIG_DEBUG_STACK_USAGE |
61 | #define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) | 87 | #define alloc_thread_info(ti) kzalloc(THREAD_SIZE, GFP_KERNEL) |
62 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | 88 | #else |
89 | #define alloc_thread_info(ti) kmalloc(THREAD_SIZE, GFP_KERNEL) | ||
90 | #endif | ||
91 | #define free_thread_info(ti) kfree(ti) | ||
63 | 92 | ||
64 | #else /* !__ASSEMBLY__ */ | 93 | #else /* !__ASSEMBLY__ */ |
65 | 94 | ||
66 | /* how to get the thread information struct from ASM */ | 95 | /* how to get the thread information struct from ASM */ |
67 | #define GET_THREAD_INFO(reg) \ | 96 | #define GET_THREAD_INFO(reg) \ |
68 | stc r7_bank, reg | 97 | stc r7_bank, reg |
69 | 98 | ||
70 | #endif | 99 | #endif |
71 | 100 | ||
@@ -79,18 +108,18 @@ static inline struct thread_info *current_thread_info(void) | |||
79 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | 108 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ |
80 | #define TIF_SIGPENDING 2 /* signal pending */ | 109 | #define TIF_SIGPENDING 2 /* signal pending */ |
81 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 110 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
111 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | ||
82 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ | 112 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ |
83 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 113 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
84 | #define TIF_MEMDIE 18 | 114 | #define TIF_MEMDIE 18 |
85 | #define TIF_USERSPACE 31 /* true if FS sets userspace */ | ||
86 | 115 | ||
87 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 116 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
88 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 117 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
89 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 118 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
90 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 119 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
120 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
91 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | 121 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) |
92 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 122 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
93 | #define _TIF_USERSPACE (1<<TIF_USERSPACE) | ||
94 | 123 | ||
95 | #define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */ | 124 | #define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */ |
96 | #define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */ | 125 | #define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */ |
diff --git a/include/asm-sh/timer.h b/include/asm-sh/timer.h index dd6579c0b04c..c7ab28095ba0 100644 --- a/include/asm-sh/timer.h +++ b/include/asm-sh/timer.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | struct sys_timer_ops { | 7 | struct sys_timer_ops { |
8 | int (*init)(void); | 8 | int (*init)(void); |
9 | int (*start)(void); | ||
10 | int (*stop)(void); | ||
9 | unsigned long (*get_offset)(void); | 11 | unsigned long (*get_offset)(void); |
10 | unsigned long (*get_frequency)(void); | 12 | unsigned long (*get_frequency)(void); |
11 | }; | 13 | }; |
diff --git a/include/asm-sh/titan.h b/include/asm-sh/titan.h new file mode 100644 index 000000000000..270a4f4bc8a9 --- /dev/null +++ b/include/asm-sh/titan.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Platform defintions for Titan | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASM_SH_TITAN_TITAN_H | ||
6 | #define _ASM_SH_TITAN_TITAN_H | ||
7 | |||
8 | #define __IO_PREFIX titan | ||
9 | #include <asm/io_generic.h> | ||
10 | |||
11 | /* IRQ assignments */ | ||
12 | #define TITAN_IRQ_WAN 2 /* eth0 (WAN) */ | ||
13 | #define TITAN_IRQ_LAN 5 /* eth1 (LAN) */ | ||
14 | #define TITAN_IRQ_MPCIA 8 /* mPCI A */ | ||
15 | #define TITAN_IRQ_MPCIB 11 /* mPCI B */ | ||
16 | #define TITAN_IRQ_USB 11 /* USB */ | ||
17 | |||
18 | /* | ||
19 | * The external interrupt lines, these take up ints 0 - 15 inclusive | ||
20 | * depending on the priority for the interrupt. In fact the priority | ||
21 | * is the interrupt :-) | ||
22 | */ | ||
23 | #define IRL0_IRQ 0 | ||
24 | #define IRL0_IPR_ADDR INTC_IPRD | ||
25 | #define IRL0_IPR_POS 3 | ||
26 | #define IRL0_PRIORITY 8 | ||
27 | |||
28 | #define IRL1_IRQ 1 | ||
29 | #define IRL1_IPR_ADDR INTC_IPRD | ||
30 | #define IRL1_IPR_POS 2 | ||
31 | #define IRL1_PRIORITY 8 | ||
32 | |||
33 | #define IRL2_IRQ 2 | ||
34 | #define IRL2_IPR_ADDR INTC_IPRD | ||
35 | #define IRL2_IPR_POS 1 | ||
36 | #define IRL2_PRIORITY 8 | ||
37 | |||
38 | #define IRL3_IRQ 3 | ||
39 | #define IRL3_IPR_ADDR INTC_IPRD | ||
40 | #define IRL3_IPR_POS 0 | ||
41 | #define IRL3_PRIORITY 8 | ||
42 | |||
43 | #endif | ||
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h index 2cb01861e7c5..5c49ed6715f2 100644 --- a/include/asm-sh/uaccess.h +++ b/include/asm-sh/uaccess.h | |||
@@ -16,21 +16,9 @@ | |||
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
18 | 18 | ||
19 | /* | ||
20 | * NOTE: Macro/functions in this file depends on threads_info.h implementation. | ||
21 | * Assumes: | ||
22 | * TI_FLAGS == 8 | ||
23 | * TIF_USERSPACE == 31 | ||
24 | * USER_ADDR_LIMIT == 0x80000000 | ||
25 | */ | ||
26 | |||
27 | #define VERIFY_READ 0 | 19 | #define VERIFY_READ 0 |
28 | #define VERIFY_WRITE 1 | 20 | #define VERIFY_WRITE 1 |
29 | 21 | ||
30 | typedef struct { | ||
31 | unsigned int is_user_space; | ||
32 | } mm_segment_t; | ||
33 | |||
34 | /* | 22 | /* |
35 | * The fs value determines whether argument validity checking should be | 23 | * The fs value determines whether argument validity checking should be |
36 | * performed or not. If get_fs() == USER_DS, checking is performed, with | 24 | * performed or not. If get_fs() == USER_DS, checking is performed, with |
@@ -40,16 +28,18 @@ typedef struct { | |||
40 | */ | 28 | */ |
41 | 29 | ||
42 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | 30 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) |
43 | #define segment_eq(a,b) ((a).is_user_space == (b).is_user_space) | ||
44 | 31 | ||
45 | #define USER_ADDR_LIMIT 0x80000000 | 32 | #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFUL) |
33 | #define USER_DS MAKE_MM_SEG(PAGE_OFFSET) | ||
46 | 34 | ||
47 | #define KERNEL_DS MAKE_MM_SEG(0) | 35 | #define segment_eq(a,b) ((a).seg == (b).seg) |
48 | #define USER_DS MAKE_MM_SEG(1) | ||
49 | 36 | ||
50 | #define get_ds() (KERNEL_DS) | 37 | #define get_ds() (KERNEL_DS) |
51 | 38 | ||
52 | #if !defined(CONFIG_MMU) | 39 | #if !defined(CONFIG_MMU) |
40 | /* NOMMU is always true */ | ||
41 | #define __addr_ok(addr) (1) | ||
42 | |||
53 | static inline mm_segment_t get_fs(void) | 43 | static inline mm_segment_t get_fs(void) |
54 | { | 44 | { |
55 | return USER_DS; | 45 | return USER_DS; |
@@ -76,31 +66,11 @@ static inline int __access_ok(unsigned long addr, unsigned long size) | |||
76 | return ((addr >= memory_start) && ((addr + size) < memory_end)); | 66 | return ((addr >= memory_start) && ((addr + size) < memory_end)); |
77 | } | 67 | } |
78 | #else /* CONFIG_MMU */ | 68 | #else /* CONFIG_MMU */ |
79 | static inline mm_segment_t get_fs(void) | 69 | #define __addr_ok(addr) \ |
80 | { | 70 | ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) |
81 | return MAKE_MM_SEG(test_thread_flag(TIF_USERSPACE)); | ||
82 | } | ||
83 | 71 | ||
84 | static inline void set_fs(mm_segment_t s) | 72 | #define get_fs() (current_thread_info()->addr_limit) |
85 | { | 73 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) |
86 | unsigned long ti, flag; | ||
87 | __asm__ __volatile__( | ||
88 | "stc r7_bank, %0\n\t" | ||
89 | "mov.l @(8,%0), %1\n\t" | ||
90 | "shal %1\n\t" | ||
91 | "cmp/pl %2\n\t" | ||
92 | "rotcr %1\n\t" | ||
93 | "mov.l %1, @(8,%0)" | ||
94 | : "=&r" (ti), "=&r" (flag) | ||
95 | : "r" (s.is_user_space) | ||
96 | : "t"); | ||
97 | /**** | ||
98 | if (s.is_user_space) | ||
99 | set_thread_flag(TIF_USERSPACE); | ||
100 | else | ||
101 | clear_thread_flag(TIF_USERSPACE); | ||
102 | ****/ | ||
103 | } | ||
104 | 74 | ||
105 | /* | 75 | /* |
106 | * __access_ok: Check if address with size is OK or not. | 76 | * __access_ok: Check if address with size is OK or not. |
@@ -108,7 +78,7 @@ static inline void set_fs(mm_segment_t s) | |||
108 | * We do three checks: | 78 | * We do three checks: |
109 | * (1) is it user space? | 79 | * (1) is it user space? |
110 | * (2) addr + size --> carry? | 80 | * (2) addr + size --> carry? |
111 | * (3) addr + size >= 0x80000000 (USER_ADDR_LIMIT) | 81 | * (3) addr + size >= 0x80000000 (PAGE_OFFSET) |
112 | * | 82 | * |
113 | * (1) (2) (3) | RESULT | 83 | * (1) (2) (3) | RESULT |
114 | * 0 0 0 | ok | 84 | * 0 0 0 | ok |
@@ -201,6 +171,7 @@ do { \ | |||
201 | __gu_err; \ | 171 | __gu_err; \ |
202 | }) | 172 | }) |
203 | 173 | ||
174 | #ifdef CONFIG_MMU | ||
204 | #define __get_user_check(x,ptr,size) \ | 175 | #define __get_user_check(x,ptr,size) \ |
205 | ({ \ | 176 | ({ \ |
206 | long __gu_err, __gu_val; \ | 177 | long __gu_err, __gu_val; \ |
@@ -290,6 +261,18 @@ __asm__("stc r7_bank, %1\n\t" \ | |||
290 | : "r" (addr) \ | 261 | : "r" (addr) \ |
291 | : "t"); \ | 262 | : "t"); \ |
292 | }) | 263 | }) |
264 | #else /* CONFIG_MMU */ | ||
265 | #define __get_user_check(x,ptr,size) \ | ||
266 | ({ \ | ||
267 | long __gu_err, __gu_val; \ | ||
268 | if (__access_ok((unsigned long)(ptr), (size))) { \ | ||
269 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ | ||
270 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
271 | } else \ | ||
272 | __gu_err = -EFAULT; \ | ||
273 | __gu_err; \ | ||
274 | }) | ||
275 | #endif | ||
293 | 276 | ||
294 | #define __get_user_asm(x, addr, err, insn) \ | 277 | #define __get_user_asm(x, addr, err, insn) \ |
295 | ({ \ | 278 | ({ \ |
@@ -541,7 +524,7 @@ static __inline__ long __strnlen_user(const char __user *__s, long __n) | |||
541 | "3:\n\t" | 524 | "3:\n\t" |
542 | "mov.l 4f, %1\n\t" | 525 | "mov.l 4f, %1\n\t" |
543 | "jmp @%1\n\t" | 526 | "jmp @%1\n\t" |
544 | " mov %5, %0\n" | 527 | " mov #0, %0\n" |
545 | ".balign 4\n" | 528 | ".balign 4\n" |
546 | "4: .long 2b\n" | 529 | "4: .long 2b\n" |
547 | ".previous\n" | 530 | ".previous\n" |
@@ -550,26 +533,20 @@ static __inline__ long __strnlen_user(const char __user *__s, long __n) | |||
550 | " .long 1b,3b\n" | 533 | " .long 1b,3b\n" |
551 | ".previous" | 534 | ".previous" |
552 | : "=z" (res), "=&r" (__dummy) | 535 | : "=z" (res), "=&r" (__dummy) |
553 | : "0" (0), "r" (__s), "r" (__n), "i" (-EFAULT) | 536 | : "0" (0), "r" (__s), "r" (__n) |
554 | : "t"); | 537 | : "t"); |
555 | return res; | 538 | return res; |
556 | } | 539 | } |
557 | 540 | ||
558 | static __inline__ long strnlen_user(const char __user *s, long n) | 541 | static __inline__ long strnlen_user(const char __user *s, long n) |
559 | { | 542 | { |
560 | if (!access_ok(VERIFY_READ, s, n)) | 543 | if (!__addr_ok(s)) |
561 | return 0; | 544 | return 0; |
562 | else | 545 | else |
563 | return __strnlen_user(s, n); | 546 | return __strnlen_user(s, n); |
564 | } | 547 | } |
565 | 548 | ||
566 | static __inline__ long strlen_user(const char __user *s) | 549 | #define strlen_user(str) strnlen_user(str, ~0UL >> 1) |
567 | { | ||
568 | if (!access_ok(VERIFY_READ, s, 0)) | ||
569 | return 0; | ||
570 | else | ||
571 | return __strnlen_user(s, ~0UL >> 1); | ||
572 | } | ||
573 | 550 | ||
574 | /* | 551 | /* |
575 | * The exception table consists of pairs of addresses: the first is the | 552 | * The exception table consists of pairs of addresses: the first is the |
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index 76b5430cb458..5d5e9f94def5 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h | |||
@@ -292,25 +292,51 @@ | |||
292 | #define __NR_mq_getsetattr (__NR_mq_open+5) | 292 | #define __NR_mq_getsetattr (__NR_mq_open+5) |
293 | #define __NR_kexec_load 283 | 293 | #define __NR_kexec_load 283 |
294 | #define __NR_waitid 284 | 294 | #define __NR_waitid 284 |
295 | #define __NR_add_key 285 | 295 | /* #define __NR_sys_setaltroot 285 */ |
296 | #define __NR_request_key 286 | 296 | #define __NR_add_key 286 |
297 | #define __NR_keyctl 287 | 297 | #define __NR_request_key 287 |
298 | #define __NR_ioprio_set 288 | 298 | #define __NR_keyctl 288 |
299 | #define __NR_ioprio_get 289 | 299 | #define __NR_ioprio_set 289 |
300 | #define __NR_inotify_init 290 | 300 | #define __NR_ioprio_get 290 |
301 | #define __NR_inotify_add_watch 291 | 301 | #define __NR_inotify_init 291 |
302 | #define __NR_inotify_rm_watch 292 | 302 | #define __NR_inotify_add_watch 292 |
303 | #define __NR_inotify_rm_watch 293 | ||
304 | #define __NR_migrate_pages 294 | ||
305 | #define __NR_openat 295 | ||
306 | #define __NR_mkdirat 296 | ||
307 | #define __NR_mknodat 297 | ||
308 | #define __NR_fchownat 298 | ||
309 | #define __NR_futimesat 299 | ||
310 | #define __NR_newfstatat 300 | ||
311 | #define __NR_unlinkat 301 | ||
312 | #define __NR_renameat 302 | ||
313 | #define __NR_linkat 303 | ||
314 | #define __NR_symlinkat 304 | ||
315 | #define __NR_readlinkat 305 | ||
316 | #define __NR_fchmodat 306 | ||
317 | #define __NR_faccessat 307 | ||
318 | #define __NR_pselect6 308 | ||
319 | #define __NR_ppoll 309 | ||
320 | #define __NR_unshare 310 | ||
321 | #define __NR_set_robust_list 311 | ||
322 | #define __NR_get_robust_list 312 | ||
323 | #define __NR_splice 313 | ||
324 | #define __NR_sync_file_range 314 | ||
325 | #define __NR_tee 315 | ||
326 | #define __NR_vmsplice 316 | ||
303 | 327 | ||
304 | 328 | #define NR_syscalls 317 | |
305 | #define NR_syscalls 293 | ||
306 | 329 | ||
307 | #ifdef __KERNEL__ | 330 | #ifdef __KERNEL__ |
308 | 331 | ||
309 | /* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */ | 332 | #include <linux/err.h> |
333 | |||
334 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO: | ||
335 | * see <asm-sh/errno.h> */ | ||
310 | 336 | ||
311 | #define __syscall_return(type, res) \ | 337 | #define __syscall_return(type, res) \ |
312 | do { \ | 338 | do { \ |
313 | if ((unsigned long)(res) >= (unsigned long)(-124)) { \ | 339 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
314 | /* Avoid using "res" which is declared to be in register r0; \ | 340 | /* Avoid using "res" which is declared to be in register r0; \ |
315 | errno might expand to a function call and clobber it. */ \ | 341 | errno might expand to a function call and clobber it. */ \ |
316 | int __err = -(res); \ | 342 | int __err = -(res); \ |
@@ -444,6 +470,7 @@ __syscall_return(type,__sc0); \ | |||
444 | #define __ARCH_WANT_SYS_SIGPENDING | 470 | #define __ARCH_WANT_SYS_SIGPENDING |
445 | #define __ARCH_WANT_SYS_SIGPROCMASK | 471 | #define __ARCH_WANT_SYS_SIGPROCMASK |
446 | #define __ARCH_WANT_SYS_RT_SIGACTION | 472 | #define __ARCH_WANT_SYS_RT_SIGACTION |
473 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
447 | 474 | ||
448 | #ifdef __KERNEL_SYSCALLS__ | 475 | #ifdef __KERNEL_SYSCALLS__ |
449 | 476 | ||
diff --git a/include/asm-sh/rts7751r2d/voyagergx_reg.h b/include/asm-sh/voyagergx.h index f031b5d6cf54..99b0807d1c9f 100644 --- a/include/asm-sh/rts7751r2d/voyagergx_reg.h +++ b/include/asm-sh/voyagergx.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* -------------------------------------------------------------------- */ | 1 | /* -------------------------------------------------------------------- */ |
2 | /* voyagergx_reg.h */ | 2 | /* voyagergx.h */ |
3 | /* -------------------------------------------------------------------- */ | 3 | /* -------------------------------------------------------------------- */ |
4 | /* This program is free software; you can redistribute it and/or modify | 4 | /* This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
diff --git a/include/asm-sh/watchdog.h b/include/asm-sh/watchdog.h index 09ca41972a11..d19ea62ef8c6 100644 --- a/include/asm-sh/watchdog.h +++ b/include/asm-sh/watchdog.h | |||
@@ -62,7 +62,6 @@ | |||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * sh_wdt_read_cnt - Read from Counter | 64 | * sh_wdt_read_cnt - Read from Counter |
65 | * | ||
66 | * Reads back the WTCNT value. | 65 | * Reads back the WTCNT value. |
67 | */ | 66 | */ |
68 | static inline __u8 sh_wdt_read_cnt(void) | 67 | static inline __u8 sh_wdt_read_cnt(void) |
@@ -72,7 +71,6 @@ static inline __u8 sh_wdt_read_cnt(void) | |||
72 | 71 | ||
73 | /** | 72 | /** |
74 | * sh_wdt_write_cnt - Write to Counter | 73 | * sh_wdt_write_cnt - Write to Counter |
75 | * | ||
76 | * @val: Value to write | 74 | * @val: Value to write |
77 | * | 75 | * |
78 | * Writes the given value @val to the lower byte of the timer counter. | 76 | * Writes the given value @val to the lower byte of the timer counter. |
@@ -95,7 +93,6 @@ static inline __u8 sh_wdt_read_csr(void) | |||
95 | 93 | ||
96 | /** | 94 | /** |
97 | * sh_wdt_write_csr - Write to Control/Status Register | 95 | * sh_wdt_write_csr - Write to Control/Status Register |
98 | * | ||
99 | * @val: Value to write | 96 | * @val: Value to write |
100 | * | 97 | * |
101 | * Writes the given value @val to the lower byte of the control/status | 98 | * Writes the given value @val to the lower byte of the control/status |
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h index 54c7821893f5..6b97c4cb1d64 100644 --- a/include/asm-sh64/pgtable.h +++ b/include/asm-sh64/pgtable.h | |||
@@ -190,7 +190,9 @@ static inline int pgd_bad(pgd_t pgd) { return 0; } | |||
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | 192 | ||
193 | #define pgd_page(pgd_entry) ((unsigned long) (pgd_val(pgd_entry) & PAGE_MASK)) | 193 | #define pgd_page_vaddr(pgd_entry) ((unsigned long) (pgd_val(pgd_entry) & PAGE_MASK)) |
194 | #define pgd_page(pgd) (virt_to_page(pgd_val(pgd))) | ||
195 | |||
194 | 196 | ||
195 | /* | 197 | /* |
196 | * PMD defines. Middle level. | 198 | * PMD defines. Middle level. |
@@ -219,7 +221,7 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
219 | #define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY) | 221 | #define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY) |
220 | #define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | 222 | #define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) |
221 | 223 | ||
222 | #define pmd_page_kernel(pmd_entry) \ | 224 | #define pmd_page_vaddr(pmd_entry) \ |
223 | ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK)) | 225 | ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK)) |
224 | 226 | ||
225 | #define pmd_page(pmd) \ | 227 | #define pmd_page(pmd) \ |
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h index 9a1590fffc15..c113566bef33 100644 --- a/include/asm-sh64/unistd.h +++ b/include/asm-sh64/unistd.h | |||
@@ -347,8 +347,10 @@ | |||
347 | #ifdef __KERNEL__ | 347 | #ifdef __KERNEL__ |
348 | 348 | ||
349 | #define NR_syscalls 321 | 349 | #define NR_syscalls 321 |
350 | #include <linux/err.h> | ||
350 | 351 | ||
351 | /* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */ | 352 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO: |
353 | * see <asm-sh64/errno.h> */ | ||
352 | 354 | ||
353 | #define __syscall_return(type, res) \ | 355 | #define __syscall_return(type, res) \ |
354 | do { \ | 356 | do { \ |
@@ -358,7 +360,7 @@ do { \ | |||
358 | ** life easier in the system call epilogue (see entry.S) \ | 360 | ** life easier in the system call epilogue (see entry.S) \ |
359 | */ \ | 361 | */ \ |
360 | register unsigned long __sr2 __asm__ ("r2") = res; \ | 362 | register unsigned long __sr2 __asm__ ("r2") = res; \ |
361 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | 363 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
362 | errno = -(res); \ | 364 | errno = -(res); \ |
363 | __sr2 = -1; \ | 365 | __sr2 = -1; \ |
364 | } \ | 366 | } \ |
diff --git a/include/asm-sparc/libata-portmap.h b/include/asm-sparc/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-sparc/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 226c6475c9a2..4f0a5ba0d6a0 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h | |||
@@ -143,10 +143,10 @@ extern unsigned long empty_zero_page; | |||
143 | /* | 143 | /* |
144 | */ | 144 | */ |
145 | BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t) | 145 | BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t) |
146 | BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page, pgd_t) | 146 | BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t) |
147 | 147 | ||
148 | #define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) | 148 | #define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) |
149 | #define pgd_page(pgd) BTFIXUP_CALL(pgd_page)(pgd) | 149 | #define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd) |
150 | 150 | ||
151 | BTFIXUPDEF_SETHI(none_mask) | 151 | BTFIXUPDEF_SETHI(none_mask) |
152 | BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) | 152 | BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) |
diff --git a/include/asm-sparc64/libata-portmap.h b/include/asm-sparc64/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-sparc64/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index ebfe395cfb87..b12be7a869f6 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -630,8 +630,9 @@ static inline unsigned long pte_present(pte_t pte) | |||
630 | #define __pmd_page(pmd) \ | 630 | #define __pmd_page(pmd) \ |
631 | ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL))) | 631 | ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL))) |
632 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) | 632 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) |
633 | #define pud_page(pud) \ | 633 | #define pud_page_vaddr(pud) \ |
634 | ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) | 634 | ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) |
635 | #define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud)) | ||
635 | #define pmd_none(pmd) (!pmd_val(pmd)) | 636 | #define pmd_none(pmd) (!pmd_val(pmd)) |
636 | #define pmd_bad(pmd) (0) | 637 | #define pmd_bad(pmd) (0) |
637 | #define pmd_present(pmd) (pmd_val(pmd) != 0U) | 638 | #define pmd_present(pmd) (pmd_val(pmd) != 0U) |
@@ -653,7 +654,7 @@ static inline unsigned long pte_present(pte_t pte) | |||
653 | 654 | ||
654 | /* Find an entry in the second-level page table.. */ | 655 | /* Find an entry in the second-level page table.. */ |
655 | #define pmd_offset(pudp, address) \ | 656 | #define pmd_offset(pudp, address) \ |
656 | ((pmd_t *) pud_page(*(pudp)) + \ | 657 | ((pmd_t *) pud_page_vaddr(*(pudp)) + \ |
657 | (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) | 658 | (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) |
658 | 659 | ||
659 | /* Find an entry in the third-level page table.. */ | 660 | /* Find an entry in the third-level page table.. */ |
diff --git a/include/asm-um/alternative-asm.i b/include/asm-um/alternative-asm.i new file mode 100644 index 000000000000..cae9faca132f --- /dev/null +++ b/include/asm-um/alternative-asm.i | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_ALTERNATIVE_ASM_I | ||
2 | #define __UM_ALTERNATIVE_ASM_I | ||
3 | |||
4 | #include "asm/arch/alternative-asm.i" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/frame.i b/include/asm-um/frame.i new file mode 100644 index 000000000000..09d5dca5d928 --- /dev/null +++ b/include/asm-um/frame.i | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_FRAME_I | ||
2 | #define __UM_FRAME_I | ||
3 | |||
4 | #include "asm/arch/frame.i" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h index ffe017f6b64b..6050e0eb257e 100644 --- a/include/asm-um/pgtable-2level.h +++ b/include/asm-um/pgtable-2level.h | |||
@@ -41,7 +41,7 @@ static inline void pgd_mkuptodate(pgd_t pgd) { } | |||
41 | #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) | 41 | #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) |
42 | #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) | 42 | #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) |
43 | 43 | ||
44 | #define pmd_page_kernel(pmd) \ | 44 | #define pmd_page_vaddr(pmd) \ |
45 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 45 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
46 | 46 | ||
47 | /* | 47 | /* |
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index 786c25727289..ca0c2a92a112 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h | |||
@@ -74,11 +74,12 @@ extern inline void pud_clear (pud_t *pud) | |||
74 | set_pud(pud, __pud(0)); | 74 | set_pud(pud, __pud(0)); |
75 | } | 75 | } |
76 | 76 | ||
77 | #define pud_page(pud) \ | 77 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) |
78 | #define pud_page_vaddr(pud) \ | ||
78 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) | 79 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) |
79 | 80 | ||
80 | /* Find an entry in the second-level page table.. */ | 81 | /* Find an entry in the second-level page table.. */ |
81 | #define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \ | 82 | #define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ |
82 | pmd_index(address)) | 83 | pmd_index(address)) |
83 | 84 | ||
84 | static inline unsigned long pte_pfn(pte_t pte) | 85 | static inline unsigned long pte_pfn(pte_t pte) |
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index ac64eb955868..4862daf8b906 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h | |||
@@ -349,7 +349,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
349 | return pte; | 349 | return pte; |
350 | } | 350 | } |
351 | 351 | ||
352 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 352 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
353 | 353 | ||
354 | /* | 354 | /* |
355 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] | 355 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] |
@@ -389,7 +389,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
389 | */ | 389 | */ |
390 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 390 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
391 | #define pte_offset_kernel(dir, address) \ | 391 | #define pte_offset_kernel(dir, address) \ |
392 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 392 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
393 | #define pte_offset_map(dir, address) \ | 393 | #define pte_offset_map(dir, address) \ |
394 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) | 394 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) |
395 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | 395 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) |
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h index 824c28896382..d99bbddffdb9 100644 --- a/include/asm-um/processor-generic.h +++ b/include/asm-um/processor-generic.h | |||
@@ -13,6 +13,7 @@ struct task_struct; | |||
13 | #include "asm/ptrace.h" | 13 | #include "asm/ptrace.h" |
14 | #include "choose-mode.h" | 14 | #include "choose-mode.h" |
15 | #include "registers.h" | 15 | #include "registers.h" |
16 | #include "sysdep/archsetjmp.h" | ||
16 | 17 | ||
17 | struct mm_struct; | 18 | struct mm_struct; |
18 | 19 | ||
@@ -43,8 +44,7 @@ struct thread_struct { | |||
43 | #endif | 44 | #endif |
44 | #ifdef CONFIG_MODE_SKAS | 45 | #ifdef CONFIG_MODE_SKAS |
45 | struct { | 46 | struct { |
46 | void *switch_buf; | 47 | jmp_buf switch_buf; |
47 | void *fork_buf; | ||
48 | int mm_count; | 48 | int mm_count; |
49 | } skas; | 49 | } skas; |
50 | #endif | 50 | #endif |
@@ -138,9 +138,7 @@ extern struct cpuinfo_um cpu_data[]; | |||
138 | 138 | ||
139 | #ifdef CONFIG_MODE_SKAS | 139 | #ifdef CONFIG_MODE_SKAS |
140 | #define KSTK_REG(tsk, reg) \ | 140 | #define KSTK_REG(tsk, reg) \ |
141 | ({ union uml_pt_regs regs; \ | 141 | get_thread_reg(reg, &tsk->thread.mode.skas.switch_buf) |
142 | get_thread_regs(®s, tsk->thread.mode.skas.switch_buf); \ | ||
143 | UPT_REG(®s, reg); }) | ||
144 | #else | 142 | #else |
145 | #define KSTK_REG(tsk, reg) (0xbadbabe) | 143 | #define KSTK_REG(tsk, reg) (0xbadbabe) |
146 | #endif | 144 | #endif |
diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h index a36f5371b36b..99c87c5ce994 100644 --- a/include/asm-um/ptrace-generic.h +++ b/include/asm-um/ptrace-generic.h | |||
@@ -8,19 +8,7 @@ | |||
8 | 8 | ||
9 | #ifndef __ASSEMBLY__ | 9 | #ifndef __ASSEMBLY__ |
10 | 10 | ||
11 | 11 | #include "asm/arch/ptrace-abi.h" | |
12 | #define pt_regs pt_regs_subarch | ||
13 | #define show_regs show_regs_subarch | ||
14 | #define send_sigtrap send_sigtrap_subarch | ||
15 | |||
16 | #include "asm/arch/ptrace.h" | ||
17 | |||
18 | #undef pt_regs | ||
19 | #undef show_regs | ||
20 | #undef send_sigtrap | ||
21 | #undef user_mode | ||
22 | #undef instruction_pointer | ||
23 | |||
24 | #include "sysdep/ptrace.h" | 12 | #include "sysdep/ptrace.h" |
25 | 13 | ||
26 | struct pt_regs { | 14 | struct pt_regs { |
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h index c894e68b1f96..03b4af4ac09a 100644 --- a/include/asm-um/ptrace-x86_64.h +++ b/include/asm-um/ptrace-x86_64.h | |||
@@ -11,21 +11,20 @@ | |||
11 | #include "asm/errno.h" | 11 | #include "asm/errno.h" |
12 | #include "asm/host_ldt.h" | 12 | #include "asm/host_ldt.h" |
13 | 13 | ||
14 | #define signal_fault signal_fault_x86_64 | ||
15 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ | 14 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ |
16 | #include "asm/ptrace-generic.h" | 15 | #include "asm/ptrace-generic.h" |
17 | #undef signal_fault | ||
18 | 16 | ||
19 | #define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64 | 17 | #define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64 |
20 | 18 | ||
21 | void signal_fault(struct pt_regs_subarch *regs, void *frame, char *where); | 19 | /* Also defined in sysdep/ptrace.h, so may already be defined. */ |
22 | 20 | #ifndef FS_BASE | |
23 | #define FS_BASE (21 * sizeof(unsigned long)) | 21 | #define FS_BASE (21 * sizeof(unsigned long)) |
24 | #define GS_BASE (22 * sizeof(unsigned long)) | 22 | #define GS_BASE (22 * sizeof(unsigned long)) |
25 | #define DS (23 * sizeof(unsigned long)) | 23 | #define DS (23 * sizeof(unsigned long)) |
26 | #define ES (24 * sizeof(unsigned long)) | 24 | #define ES (24 * sizeof(unsigned long)) |
27 | #define FS (25 * sizeof(unsigned long)) | 25 | #define FS (25 * sizeof(unsigned long)) |
28 | #define GS (26 * sizeof(unsigned long)) | 26 | #define GS (26 * sizeof(unsigned long)) |
27 | #endif | ||
29 | 28 | ||
30 | #define PT_REGS_RBX(r) UPT_RBX(&(r)->regs) | 29 | #define PT_REGS_RBX(r) UPT_RBX(&(r)->regs) |
31 | #define PT_REGS_RCX(r) UPT_RCX(&(r)->regs) | 30 | #define PT_REGS_RCX(r) UPT_RCX(&(r)->regs) |
diff --git a/include/asm-v850/unistd.h b/include/asm-v850/unistd.h index bcb44bfe577a..552b7c873a57 100644 --- a/include/asm-v850/unistd.h +++ b/include/asm-v850/unistd.h | |||
@@ -238,12 +238,13 @@ | |||
238 | #ifdef __KERNEL__ | 238 | #ifdef __KERNEL__ |
239 | 239 | ||
240 | #include <asm/clinkage.h> | 240 | #include <asm/clinkage.h> |
241 | #include <linux/err.h> | ||
241 | 242 | ||
242 | #define __syscall_return(type, res) \ | 243 | #define __syscall_return(type, res) \ |
243 | do { \ | 244 | do { \ |
244 | /* user-visible error numbers are in the range -1 - -124: \ | 245 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO: \ |
245 | see <asm-v850/errno.h> */ \ | 246 | see <asm-v850/errno.h> */ \ |
246 | if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-125), 0)) { \ | 247 | if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO), 0)) { \ |
247 | errno = -(res); \ | 248 | errno = -(res); \ |
248 | res = -1; \ | 249 | res = -1; \ |
249 | } \ | 250 | } \ |
diff --git a/include/asm-x86_64/Kbuild b/include/asm-x86_64/Kbuild index 40f2f13fe174..1ee9b07f3fe6 100644 --- a/include/asm-x86_64/Kbuild +++ b/include/asm-x86_64/Kbuild | |||
@@ -11,6 +11,7 @@ header-y += debugreg.h | |||
11 | header-y += ldt.h | 11 | header-y += ldt.h |
12 | header-y += msr.h | 12 | header-y += msr.h |
13 | header-y += prctl.h | 13 | header-y += prctl.h |
14 | header-y += ptrace-abi.h | ||
14 | header-y += setup.h | 15 | header-y += setup.h |
15 | header-y += sigcontext32.h | 16 | header-y += sigcontext32.h |
16 | header-y += ucontext.h | 17 | header-y += ucontext.h |
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index 2c95a319c056..ed59aa4c6ff9 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h | |||
@@ -155,8 +155,6 @@ extern void acpi_reserve_bootmem(void); | |||
155 | 155 | ||
156 | #endif /*CONFIG_ACPI_SLEEP*/ | 156 | #endif /*CONFIG_ACPI_SLEEP*/ |
157 | 157 | ||
158 | #define boot_cpu_physical_apicid boot_cpu_id | ||
159 | |||
160 | extern int acpi_disabled; | 158 | extern int acpi_disabled; |
161 | extern int acpi_pci_disabled; | 159 | extern int acpi_pci_disabled; |
162 | 160 | ||
diff --git a/include/asm-x86_64/alternative-asm.i b/include/asm-x86_64/alternative-asm.i new file mode 100644 index 000000000000..e4041f4fa4dc --- /dev/null +++ b/include/asm-x86_64/alternative-asm.i | |||
@@ -0,0 +1,14 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
3 | #ifdef CONFIG_SMP | ||
4 | .macro LOCK_PREFIX | ||
5 | 1: lock | ||
6 | .section .smp_locks,"a" | ||
7 | .align 8 | ||
8 | .quad 1b | ||
9 | .previous | ||
10 | .endm | ||
11 | #else | ||
12 | .macro LOCK_PREFIX | ||
13 | .endm | ||
14 | #endif | ||
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index 9c96a0a8d1bd..9e66d32330c9 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h | |||
@@ -17,6 +17,8 @@ | |||
17 | 17 | ||
18 | extern int apic_verbosity; | 18 | extern int apic_verbosity; |
19 | extern int apic_runs_main_timer; | 19 | extern int apic_runs_main_timer; |
20 | extern int ioapic_force; | ||
21 | extern int apic_mapped; | ||
20 | 22 | ||
21 | /* | 23 | /* |
22 | * Define the default level of output to be very little | 24 | * Define the default level of output to be very little |
@@ -29,8 +31,6 @@ extern int apic_runs_main_timer; | |||
29 | printk(s, ##a); \ | 31 | printk(s, ##a); \ |
30 | } while (0) | 32 | } while (0) |
31 | 33 | ||
32 | #ifdef CONFIG_X86_LOCAL_APIC | ||
33 | |||
34 | struct pt_regs; | 34 | struct pt_regs; |
35 | 35 | ||
36 | /* | 36 | /* |
@@ -95,17 +95,12 @@ extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector, | |||
95 | #define K8_APIC_EXT_INT_MSG_EXT 0x7 | 95 | #define K8_APIC_EXT_INT_MSG_EXT 0x7 |
96 | #define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 | 96 | #define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 |
97 | 97 | ||
98 | extern int disable_timer_pin_1; | ||
99 | |||
100 | |||
101 | void smp_send_timer_broadcast_ipi(void); | 98 | void smp_send_timer_broadcast_ipi(void); |
102 | void switch_APIC_timer_to_ipi(void *cpumask); | 99 | void switch_APIC_timer_to_ipi(void *cpumask); |
103 | void switch_ipi_to_APIC_timer(void *cpumask); | 100 | void switch_ipi_to_APIC_timer(void *cpumask); |
104 | 101 | ||
105 | #define ARCH_APICTIMER_STOPS_ON_C3 1 | 102 | #define ARCH_APICTIMER_STOPS_ON_C3 1 |
106 | 103 | ||
107 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
108 | |||
109 | extern unsigned boot_cpu_id; | 104 | extern unsigned boot_cpu_id; |
110 | 105 | ||
111 | #endif /* __ASM_APIC_H */ | 106 | #endif /* __ASM_APIC_H */ |
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index f7ba57b1cc08..5b535eaf5309 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -399,6 +399,8 @@ static __inline__ int fls(int x) | |||
399 | return r+1; | 399 | return r+1; |
400 | } | 400 | } |
401 | 401 | ||
402 | #define ARCH_HAS_FAST_MULTIPLIER 1 | ||
403 | |||
402 | #include <asm-generic/bitops/hweight.h> | 404 | #include <asm-generic/bitops/hweight.h> |
403 | 405 | ||
404 | #endif /* __KERNEL__ */ | 406 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h index 4e3919524240..6b93f5a3a5c8 100644 --- a/include/asm-x86_64/calgary.h +++ b/include/asm-x86_64/calgary.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifndef _ASM_X86_64_CALGARY_H | 24 | #ifndef _ASM_X86_64_CALGARY_H |
25 | #define _ASM_X86_64_CALGARY_H | 25 | #define _ASM_X86_64_CALGARY_H |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
29 | #include <linux/device.h> | 28 | #include <linux/device.h> |
30 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
@@ -34,12 +33,12 @@ struct iommu_table { | |||
34 | unsigned long it_base; /* mapped address of tce table */ | 33 | unsigned long it_base; /* mapped address of tce table */ |
35 | unsigned long it_hint; /* Hint for next alloc */ | 34 | unsigned long it_hint; /* Hint for next alloc */ |
36 | unsigned long *it_map; /* A simple allocation bitmap for now */ | 35 | unsigned long *it_map; /* A simple allocation bitmap for now */ |
36 | void __iomem *bbar; /* Bridge BAR */ | ||
37 | u64 tar_val; /* Table Address Register */ | ||
38 | struct timer_list watchdog_timer; | ||
37 | spinlock_t it_lock; /* Protects it_map */ | 39 | spinlock_t it_lock; /* Protects it_map */ |
38 | unsigned int it_size; /* Size of iommu table in entries */ | 40 | unsigned int it_size; /* Size of iommu table in entries */ |
39 | unsigned char it_busno; /* Bus number this table belongs to */ | 41 | unsigned char it_busno; /* Bus number this table belongs to */ |
40 | void __iomem *bbar; | ||
41 | u64 tar_val; | ||
42 | struct timer_list watchdog_timer; | ||
43 | }; | 42 | }; |
44 | 43 | ||
45 | #define TCE_TABLE_SIZE_UNSPECIFIED ~0 | 44 | #define TCE_TABLE_SIZE_UNSPECIFIED ~0 |
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h index 0744db777676..eedc08526b0b 100644 --- a/include/asm-x86_64/dwarf2.h +++ b/include/asm-x86_64/dwarf2.h | |||
@@ -13,7 +13,7 @@ | |||
13 | away for older version. | 13 | away for older version. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifdef CONFIG_UNWIND_INFO | 16 | #ifdef CONFIG_AS_CFI |
17 | 17 | ||
18 | #define CFI_STARTPROC .cfi_startproc | 18 | #define CFI_STARTPROC .cfi_startproc |
19 | #define CFI_ENDPROC .cfi_endproc | 19 | #define CFI_ENDPROC .cfi_endproc |
@@ -28,6 +28,11 @@ | |||
28 | #define CFI_REMEMBER_STATE .cfi_remember_state | 28 | #define CFI_REMEMBER_STATE .cfi_remember_state |
29 | #define CFI_RESTORE_STATE .cfi_restore_state | 29 | #define CFI_RESTORE_STATE .cfi_restore_state |
30 | #define CFI_UNDEFINED .cfi_undefined | 30 | #define CFI_UNDEFINED .cfi_undefined |
31 | #ifdef CONFIG_AS_CFI_SIGNAL_FRAME | ||
32 | #define CFI_SIGNAL_FRAME .cfi_signal_frame | ||
33 | #else | ||
34 | #define CFI_SIGNAL_FRAME | ||
35 | #endif | ||
31 | 36 | ||
32 | #else | 37 | #else |
33 | 38 | ||
@@ -45,6 +50,7 @@ | |||
45 | #define CFI_REMEMBER_STATE # | 50 | #define CFI_REMEMBER_STATE # |
46 | #define CFI_RESTORE_STATE # | 51 | #define CFI_RESTORE_STATE # |
47 | #define CFI_UNDEFINED # | 52 | #define CFI_UNDEFINED # |
53 | #define CFI_SIGNAL_FRAME # | ||
48 | 54 | ||
49 | #endif | 55 | #endif |
50 | 56 | ||
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h index 670a3388e70a..fa2086774105 100644 --- a/include/asm-x86_64/e820.h +++ b/include/asm-x86_64/e820.h | |||
@@ -19,13 +19,9 @@ | |||
19 | 19 | ||
20 | #define E820_RAM 1 | 20 | #define E820_RAM 1 |
21 | #define E820_RESERVED 2 | 21 | #define E820_RESERVED 2 |
22 | #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ | 22 | #define E820_ACPI 3 |
23 | #define E820_NVS 4 | 23 | #define E820_NVS 4 |
24 | 24 | ||
25 | #define HIGH_MEMORY (1024*1024) | ||
26 | |||
27 | #define LOWMEMSIZE() (0x9f000) | ||
28 | |||
29 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
30 | struct e820entry { | 26 | struct e820entry { |
31 | u64 addr; /* start of memory segment */ | 27 | u64 addr; /* start of memory segment */ |
@@ -46,17 +42,16 @@ extern void setup_memory_region(void); | |||
46 | extern void contig_e820_setup(void); | 42 | extern void contig_e820_setup(void); |
47 | extern unsigned long e820_end_of_ram(void); | 43 | extern unsigned long e820_end_of_ram(void); |
48 | extern void e820_reserve_resources(void); | 44 | extern void e820_reserve_resources(void); |
45 | extern void e820_mark_nosave_regions(void); | ||
49 | extern void e820_print_map(char *who); | 46 | extern void e820_print_map(char *who); |
50 | extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type); | 47 | extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type); |
51 | extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type); | 48 | extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type); |
52 | 49 | ||
53 | extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end); | ||
54 | extern void e820_setup_gap(void); | 50 | extern void e820_setup_gap(void); |
55 | extern unsigned long e820_hole_size(unsigned long start_pfn, | 51 | extern void e820_register_active_regions(int nid, |
56 | unsigned long end_pfn); | 52 | unsigned long start_pfn, unsigned long end_pfn); |
57 | 53 | ||
58 | extern void __init parse_memopt(char *p, char **end); | 54 | extern void finish_e820_parsing(void); |
59 | extern void __init parse_memmapopt(char *p, char **end); | ||
60 | 55 | ||
61 | extern struct e820map e820; | 56 | extern struct e820map e820; |
62 | 57 | ||
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h index 0b4ffbd1a125..1b620db5b9e3 100644 --- a/include/asm-x86_64/fixmap.h +++ b/include/asm-x86_64/fixmap.h | |||
@@ -37,13 +37,9 @@ enum fixed_addresses { | |||
37 | VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, | 37 | VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, |
38 | VSYSCALL_HPET, | 38 | VSYSCALL_HPET, |
39 | FIX_HPET_BASE, | 39 | FIX_HPET_BASE, |
40 | #ifdef CONFIG_X86_LOCAL_APIC | ||
41 | FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ | 40 | FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ |
42 | #endif | ||
43 | #ifdef CONFIG_X86_IO_APIC | ||
44 | FIX_IO_APIC_BASE_0, | 41 | FIX_IO_APIC_BASE_0, |
45 | FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, | 42 | FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, |
46 | #endif | ||
47 | __end_of_fixed_addresses | 43 | __end_of_fixed_addresses |
48 | }; | 44 | }; |
49 | 45 | ||
diff --git a/include/asm-x86_64/genapic.h b/include/asm-x86_64/genapic.h index 50b38e7c58e4..81e714665344 100644 --- a/include/asm-x86_64/genapic.h +++ b/include/asm-x86_64/genapic.h | |||
@@ -16,7 +16,6 @@ struct genapic { | |||
16 | char *name; | 16 | char *name; |
17 | u32 int_delivery_mode; | 17 | u32 int_delivery_mode; |
18 | u32 int_dest_mode; | 18 | u32 int_dest_mode; |
19 | u32 int_delivery_dest; /* for quick IPIs */ | ||
20 | int (*apic_id_registered)(void); | 19 | int (*apic_id_registered)(void); |
21 | cpumask_t (*target_cpus)(void); | 20 | cpumask_t (*target_cpus)(void); |
22 | void (*init_apic_ldr)(void); | 21 | void (*init_apic_ldr)(void); |
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h index cba8a3b0cded..0217b74cc9fc 100644 --- a/include/asm-x86_64/i387.h +++ b/include/asm-x86_64/i387.h | |||
@@ -24,6 +24,7 @@ extern unsigned int mxcsr_feature_mask; | |||
24 | extern void mxcsr_feature_mask_init(void); | 24 | extern void mxcsr_feature_mask_init(void); |
25 | extern void init_fpu(struct task_struct *child); | 25 | extern void init_fpu(struct task_struct *child); |
26 | extern int save_i387(struct _fpstate __user *buf); | 26 | extern int save_i387(struct _fpstate __user *buf); |
27 | extern asmlinkage void math_state_restore(void); | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * FPU lazy state save handling... | 30 | * FPU lazy state save handling... |
@@ -31,7 +32,9 @@ extern int save_i387(struct _fpstate __user *buf); | |||
31 | 32 | ||
32 | #define unlazy_fpu(tsk) do { \ | 33 | #define unlazy_fpu(tsk) do { \ |
33 | if (task_thread_info(tsk)->status & TS_USEDFPU) \ | 34 | if (task_thread_info(tsk)->status & TS_USEDFPU) \ |
34 | save_init_fpu(tsk); \ | 35 | save_init_fpu(tsk); \ |
36 | else \ | ||
37 | tsk->fpu_counter = 0; \ | ||
35 | } while (0) | 38 | } while (0) |
36 | 39 | ||
37 | /* Ignore delayed exceptions from user space */ | 40 | /* Ignore delayed exceptions from user space */ |
@@ -134,8 +137,8 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | |||
134 | #else | 137 | #else |
135 | : [fx] "cdaSDb" (fx), "0" (0)); | 138 | : [fx] "cdaSDb" (fx), "0" (0)); |
136 | #endif | 139 | #endif |
137 | if (unlikely(err)) | 140 | if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct))) |
138 | __clear_user(fx, sizeof(struct i387_fxsave_struct)); | 141 | err = -EFAULT; |
139 | /* No need to clear here because the caller clears USED_MATH */ | 142 | /* No need to clear here because the caller clears USED_MATH */ |
140 | return err; | 143 | return err; |
141 | } | 144 | } |
diff --git a/include/asm-x86_64/intel_arch_perfmon.h b/include/asm-x86_64/intel_arch_perfmon.h index 59c396431569..8633331420ec 100644 --- a/include/asm-x86_64/intel_arch_perfmon.h +++ b/include/asm-x86_64/intel_arch_perfmon.h | |||
@@ -14,6 +14,18 @@ | |||
14 | 14 | ||
15 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) | 15 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) |
16 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) | 16 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) |
17 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT (1 << 0) | 17 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) |
18 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ | ||
19 | (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) | ||
20 | |||
21 | union cpuid10_eax { | ||
22 | struct { | ||
23 | unsigned int version_id:8; | ||
24 | unsigned int num_counters:8; | ||
25 | unsigned int bit_width:8; | ||
26 | unsigned int mask_length:8; | ||
27 | } split; | ||
28 | unsigned int full; | ||
29 | }; | ||
18 | 30 | ||
19 | #endif /* X86_64_INTEL_ARCH_PERFMON_H */ | 31 | #endif /* X86_64_INTEL_ARCH_PERFMON_H */ |
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h index fb7a0909a174..5d1b5c68e36e 100644 --- a/include/asm-x86_64/io_apic.h +++ b/include/asm-x86_64/io_apic.h | |||
@@ -10,8 +10,6 @@ | |||
10 | * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar | 10 | * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifdef CONFIG_X86_IO_APIC | ||
14 | |||
15 | #ifdef CONFIG_PCI_MSI | 13 | #ifdef CONFIG_PCI_MSI |
16 | static inline int use_pci_vector(void) {return 1;} | 14 | static inline int use_pci_vector(void) {return 1;} |
17 | static inline void disable_edge_ioapic_vector(unsigned int vector) { } | 15 | static inline void disable_edge_ioapic_vector(unsigned int vector) { } |
@@ -209,10 +207,6 @@ extern int timer_uses_ioapic_pin_0; | |||
209 | 207 | ||
210 | extern int sis_apic_bug; /* dummy */ | 208 | extern int sis_apic_bug; /* dummy */ |
211 | 209 | ||
212 | #else /* !CONFIG_X86_IO_APIC */ | ||
213 | #define io_apic_assign_pci_irqs 0 | ||
214 | #endif | ||
215 | |||
216 | extern int assign_irq_vector(int irq); | 210 | extern int assign_irq_vector(int irq); |
217 | 211 | ||
218 | void enable_NMI_through_LVT0 (void * dummy); | 212 | void enable_NMI_through_LVT0 (void * dummy); |
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index 9db5a1b4f7b1..43469d8ab71a 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h | |||
@@ -44,9 +44,7 @@ static __inline__ int irq_canonicalize(int irq) | |||
44 | return ((irq == 2) ? 9 : irq); | 44 | return ((irq == 2) ? 9 : irq); |
45 | } | 45 | } |
46 | 46 | ||
47 | #ifdef CONFIG_X86_LOCAL_APIC | ||
48 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ | 47 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ |
49 | #endif | ||
50 | 48 | ||
51 | #ifdef CONFIG_HOTPLUG_CPU | 49 | #ifdef CONFIG_HOTPLUG_CPU |
52 | #include <linux/cpumask.h> | 50 | #include <linux/cpumask.h> |
diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h index c564bae03433..5fab957e1091 100644 --- a/include/asm-x86_64/kexec.h +++ b/include/asm-x86_64/kexec.h | |||
@@ -1,6 +1,27 @@ | |||
1 | #ifndef _X86_64_KEXEC_H | 1 | #ifndef _X86_64_KEXEC_H |
2 | #define _X86_64_KEXEC_H | 2 | #define _X86_64_KEXEC_H |
3 | 3 | ||
4 | #define PA_CONTROL_PAGE 0 | ||
5 | #define VA_CONTROL_PAGE 1 | ||
6 | #define PA_PGD 2 | ||
7 | #define VA_PGD 3 | ||
8 | #define PA_PUD_0 4 | ||
9 | #define VA_PUD_0 5 | ||
10 | #define PA_PMD_0 6 | ||
11 | #define VA_PMD_0 7 | ||
12 | #define PA_PTE_0 8 | ||
13 | #define VA_PTE_0 9 | ||
14 | #define PA_PUD_1 10 | ||
15 | #define VA_PUD_1 11 | ||
16 | #define PA_PMD_1 12 | ||
17 | #define VA_PMD_1 13 | ||
18 | #define PA_PTE_1 14 | ||
19 | #define VA_PTE_1 15 | ||
20 | #define PA_TABLE_PAGE 16 | ||
21 | #define PAGES_NR 17 | ||
22 | |||
23 | #ifndef __ASSEMBLY__ | ||
24 | |||
4 | #include <linux/string.h> | 25 | #include <linux/string.h> |
5 | 26 | ||
6 | #include <asm/page.h> | 27 | #include <asm/page.h> |
@@ -64,4 +85,12 @@ static inline void crash_setup_regs(struct pt_regs *newregs, | |||
64 | newregs->rip = (unsigned long)current_text_addr(); | 85 | newregs->rip = (unsigned long)current_text_addr(); |
65 | } | 86 | } |
66 | } | 87 | } |
88 | |||
89 | NORET_TYPE void | ||
90 | relocate_kernel(unsigned long indirection_page, | ||
91 | unsigned long page_list, | ||
92 | unsigned long start_address) ATTRIB_NORET; | ||
93 | |||
94 | #endif /* __ASSEMBLY__ */ | ||
95 | |||
67 | #endif /* _X86_64_KEXEC_H */ | 96 | #endif /* _X86_64_KEXEC_H */ |
diff --git a/include/asm-x86_64/libata-portmap.h b/include/asm-x86_64/libata-portmap.h deleted file mode 100644 index 75484ef0c743..000000000000 --- a/include/asm-x86_64/libata-portmap.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/libata-portmap.h> | ||
diff --git a/include/asm-x86_64/linkage.h b/include/asm-x86_64/linkage.h index 291c2d01c44f..b5f39d0189ce 100644 --- a/include/asm-x86_64/linkage.h +++ b/include/asm-x86_64/linkage.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | 1 | #ifndef __ASM_LINKAGE_H |
2 | #define __ASM_LINKAGE_H | 2 | #define __ASM_LINKAGE_H |
3 | 3 | ||
4 | /* Nothing to see here... */ | 4 | #define __ALIGN .p2align 4,,15 |
5 | 5 | ||
6 | #endif | 6 | #endif |
diff --git a/include/asm-x86_64/mach_apic.h b/include/asm-x86_64/mach_apic.h index 0acea44c9377..d33422450c00 100644 --- a/include/asm-x86_64/mach_apic.h +++ b/include/asm-x86_64/mach_apic.h | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | 17 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) |
18 | #define INT_DEST_MODE (genapic->int_dest_mode) | 18 | #define INT_DEST_MODE (genapic->int_dest_mode) |
19 | #define INT_DELIVERY_DEST (genapic->int_delivery_dest) | ||
20 | #define TARGET_CPUS (genapic->target_cpus()) | 19 | #define TARGET_CPUS (genapic->target_cpus()) |
21 | #define apic_id_registered (genapic->apic_id_registered) | 20 | #define apic_id_registered (genapic->apic_id_registered) |
22 | #define init_apic_ldr (genapic->init_apic_ldr) | 21 | #define init_apic_ldr (genapic->init_apic_ldr) |
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h index d13687dfd691..5a11146d6d9c 100644 --- a/include/asm-x86_64/mce.h +++ b/include/asm-x86_64/mce.h | |||
@@ -99,6 +99,8 @@ static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) | |||
99 | } | 99 | } |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | void mce_log_therm_throt_event(unsigned int cpu, __u64 status); | ||
103 | |||
102 | extern atomic_t mce_entry; | 104 | extern atomic_t mce_entry; |
103 | 105 | ||
104 | #endif | 106 | #endif |
diff --git a/include/asm-x86_64/mmx.h b/include/asm-x86_64/mmx.h deleted file mode 100644 index 46b71da99869..000000000000 --- a/include/asm-x86_64/mmx.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #ifndef _ASM_MMX_H | ||
2 | #define _ASM_MMX_H | ||
3 | |||
4 | /* | ||
5 | * MMX 3Dnow! helper operations | ||
6 | */ | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | |||
10 | extern void *_mmx_memcpy(void *to, const void *from, size_t size); | ||
11 | extern void mmx_clear_page(void *page); | ||
12 | extern void mmx_copy_page(void *to, void *from); | ||
13 | |||
14 | #endif | ||
diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 14fc3ddd9031..017fddb61dc5 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h | |||
@@ -159,13 +159,7 @@ struct mpc_config_lintsrc | |||
159 | #define MAX_MP_BUSSES 256 | 159 | #define MAX_MP_BUSSES 256 |
160 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ | 160 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ |
161 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) | 161 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) |
162 | enum mp_bustype { | 162 | extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); |
163 | MP_BUS_ISA = 1, | ||
164 | MP_BUS_EISA, | ||
165 | MP_BUS_PCI, | ||
166 | MP_BUS_MCA | ||
167 | }; | ||
168 | extern unsigned char mp_bus_id_to_type [MAX_MP_BUSSES]; | ||
169 | extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; | 163 | extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; |
170 | 164 | ||
171 | extern unsigned int boot_cpu_physical_apicid; | 165 | extern unsigned int boot_cpu_physical_apicid; |
@@ -178,18 +172,15 @@ extern int mp_irq_entries; | |||
178 | extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; | 172 | extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; |
179 | extern int mpc_default_type; | 173 | extern int mpc_default_type; |
180 | extern unsigned long mp_lapic_addr; | 174 | extern unsigned long mp_lapic_addr; |
181 | extern int pic_mode; | ||
182 | 175 | ||
183 | #ifdef CONFIG_ACPI | 176 | #ifdef CONFIG_ACPI |
184 | extern void mp_register_lapic (u8 id, u8 enabled); | 177 | extern void mp_register_lapic (u8 id, u8 enabled); |
185 | extern void mp_register_lapic_address (u64 address); | 178 | extern void mp_register_lapic_address (u64 address); |
186 | 179 | ||
187 | #ifdef CONFIG_X86_IO_APIC | ||
188 | extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); | 180 | extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); |
189 | extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); | 181 | extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); |
190 | extern void mp_config_acpi_legacy_irqs (void); | 182 | extern void mp_config_acpi_legacy_irqs (void); |
191 | extern int mp_register_gsi (u32 gsi, int triggering, int polarity); | 183 | extern int mp_register_gsi (u32 gsi, int triggering, int polarity); |
192 | #endif /*CONFIG_X86_IO_APIC*/ | ||
193 | #endif | 184 | #endif |
194 | 185 | ||
195 | extern int using_apic_timer; | 186 | extern int using_apic_timer; |
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index 10f8b51cec8b..37e194169fac 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h | |||
@@ -66,14 +66,25 @@ | |||
66 | #define rdtscl(low) \ | 66 | #define rdtscl(low) \ |
67 | __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") | 67 | __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") |
68 | 68 | ||
69 | #define rdtscp(low,high,aux) \ | ||
70 | asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux)) | ||
71 | |||
69 | #define rdtscll(val) do { \ | 72 | #define rdtscll(val) do { \ |
70 | unsigned int __a,__d; \ | 73 | unsigned int __a,__d; \ |
71 | asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ | 74 | asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ |
72 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ | 75 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ |
73 | } while(0) | 76 | } while(0) |
74 | 77 | ||
78 | #define rdtscpll(val, aux) do { \ | ||
79 | unsigned long __a, __d; \ | ||
80 | asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \ | ||
81 | (val) = (__d << 32) | __a; \ | ||
82 | } while (0) | ||
83 | |||
75 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) | 84 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) |
76 | 85 | ||
86 | #define write_rdtscp_aux(val) wrmsr(0xc0000103, val, 0) | ||
87 | |||
77 | #define rdpmc(counter,low,high) \ | 88 | #define rdpmc(counter,low,high) \ |
78 | __asm__ __volatile__("rdpmc" \ | 89 | __asm__ __volatile__("rdpmc" \ |
79 | : "=a" (low), "=d" (high) \ | 90 | : "=a" (low), "=d" (high) \ |
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h index 06fab6de2a88..16396b1de3e4 100644 --- a/include/asm-x86_64/mutex.h +++ b/include/asm-x86_64/mutex.h | |||
@@ -25,13 +25,9 @@ do { \ | |||
25 | \ | 25 | \ |
26 | __asm__ __volatile__( \ | 26 | __asm__ __volatile__( \ |
27 | LOCK_PREFIX " decl (%%rdi) \n" \ | 27 | LOCK_PREFIX " decl (%%rdi) \n" \ |
28 | " js 2f \n" \ | 28 | " jns 1f \n" \ |
29 | "1: \n" \ | 29 | " call "#fail_fn" \n" \ |
30 | \ | 30 | "1:" \ |
31 | LOCK_SECTION_START("") \ | ||
32 | "2: call "#fail_fn" \n" \ | ||
33 | " jmp 1b \n" \ | ||
34 | LOCK_SECTION_END \ | ||
35 | \ | 31 | \ |
36 | :"=D" (dummy) \ | 32 | :"=D" (dummy) \ |
37 | : "D" (v) \ | 33 | : "D" (v) \ |
@@ -75,13 +71,9 @@ do { \ | |||
75 | \ | 71 | \ |
76 | __asm__ __volatile__( \ | 72 | __asm__ __volatile__( \ |
77 | LOCK_PREFIX " incl (%%rdi) \n" \ | 73 | LOCK_PREFIX " incl (%%rdi) \n" \ |
78 | " jle 2f \n" \ | 74 | " jg 1f \n" \ |
79 | "1: \n" \ | 75 | " call "#fail_fn" \n" \ |
80 | \ | 76 | "1: " \ |
81 | LOCK_SECTION_START("") \ | ||
82 | "2: call "#fail_fn" \n" \ | ||
83 | " jmp 1b \n" \ | ||
84 | LOCK_SECTION_END \ | ||
85 | \ | 77 | \ |
86 | :"=D" (dummy) \ | 78 | :"=D" (dummy) \ |
87 | : "D" (v) \ | 79 | : "D" (v) \ |
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h index efb45c894d76..cbf2669bca71 100644 --- a/include/asm-x86_64/nmi.h +++ b/include/asm-x86_64/nmi.h | |||
@@ -7,24 +7,13 @@ | |||
7 | #include <linux/pm.h> | 7 | #include <linux/pm.h> |
8 | #include <asm/io.h> | 8 | #include <asm/io.h> |
9 | 9 | ||
10 | struct pt_regs; | ||
11 | |||
12 | typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu); | ||
13 | |||
14 | /** | ||
15 | * set_nmi_callback | ||
16 | * | ||
17 | * Set a handler for an NMI. Only one handler may be | ||
18 | * set. Return 1 if the NMI was handled. | ||
19 | */ | ||
20 | void set_nmi_callback(nmi_callback_t callback); | ||
21 | |||
22 | /** | 10 | /** |
23 | * unset_nmi_callback | 11 | * do_nmi_callback |
24 | * | 12 | * |
25 | * Remove the handler previously set. | 13 | * Check to see if a callback exists and execute it. Return 1 |
14 | * if the handler exists and was handled successfully. | ||
26 | */ | 15 | */ |
27 | void unset_nmi_callback(void); | 16 | int do_nmi_callback(struct pt_regs *regs, int cpu); |
28 | 17 | ||
29 | #ifdef CONFIG_PM | 18 | #ifdef CONFIG_PM |
30 | 19 | ||
@@ -48,25 +37,32 @@ static inline void unset_nmi_pm_callback(struct pm_dev * dev) | |||
48 | #endif /* CONFIG_PM */ | 37 | #endif /* CONFIG_PM */ |
49 | 38 | ||
50 | extern void default_do_nmi(struct pt_regs *); | 39 | extern void default_do_nmi(struct pt_regs *); |
51 | extern void die_nmi(char *str, struct pt_regs *regs); | 40 | extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); |
52 | 41 | ||
53 | #define get_nmi_reason() inb(0x61) | 42 | #define get_nmi_reason() inb(0x61) |
54 | 43 | ||
55 | extern int panic_on_timeout; | 44 | extern int panic_on_timeout; |
56 | extern int unknown_nmi_panic; | 45 | extern int unknown_nmi_panic; |
46 | extern int nmi_watchdog_enabled; | ||
57 | 47 | ||
58 | extern int check_nmi_watchdog(void); | 48 | extern int check_nmi_watchdog(void); |
59 | 49 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); | |
60 | extern void setup_apic_nmi_watchdog (void); | 50 | extern int avail_to_resrv_perfctr_nmi(unsigned int); |
61 | extern int reserve_lapic_nmi(void); | 51 | extern int reserve_perfctr_nmi(unsigned int); |
62 | extern void release_lapic_nmi(void); | 52 | extern void release_perfctr_nmi(unsigned int); |
53 | extern int reserve_evntsel_nmi(unsigned int); | ||
54 | extern void release_evntsel_nmi(unsigned int); | ||
55 | |||
56 | extern void setup_apic_nmi_watchdog (void *); | ||
57 | extern void stop_apic_nmi_watchdog (void *); | ||
63 | extern void disable_timer_nmi_watchdog(void); | 58 | extern void disable_timer_nmi_watchdog(void); |
64 | extern void enable_timer_nmi_watchdog(void); | 59 | extern void enable_timer_nmi_watchdog(void); |
65 | extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); | 60 | extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); |
66 | 61 | ||
67 | extern void nmi_watchdog_default(void); | 62 | extern void nmi_watchdog_default(void); |
68 | extern int setup_nmi_watchdog(char *); | 63 | extern int setup_nmi_watchdog(char *); |
69 | 64 | ||
65 | extern atomic_t nmi_active; | ||
70 | extern unsigned int nmi_watchdog; | 66 | extern unsigned int nmi_watchdog; |
71 | #define NMI_DEFAULT -1 | 67 | #define NMI_DEFAULT -1 |
72 | #define NMI_NONE 0 | 68 | #define NMI_NONE 0 |
diff --git a/include/asm-x86_64/pci-direct.h b/include/asm-x86_64/pci-direct.h index 036b6ca5b53b..eba9cb471df3 100644 --- a/include/asm-x86_64/pci-direct.h +++ b/include/asm-x86_64/pci-direct.h | |||
@@ -2,47 +2,15 @@ | |||
2 | #define ASM_PCI_DIRECT_H 1 | 2 | #define ASM_PCI_DIRECT_H 1 |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/io.h> | ||
6 | 5 | ||
7 | /* Direct PCI access. This is used for PCI accesses in early boot before | 6 | /* Direct PCI access. This is used for PCI accesses in early boot before |
8 | the PCI subsystem works. */ | 7 | the PCI subsystem works. */ |
9 | 8 | ||
10 | #define PDprintk(x...) | 9 | extern u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset); |
10 | extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset); | ||
11 | extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset); | ||
12 | extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val); | ||
11 | 13 | ||
12 | static inline u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset) | 14 | extern int early_pci_allowed(void); |
13 | { | ||
14 | u32 v; | ||
15 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
16 | v = inl(0xcfc); | ||
17 | if (v != 0xffffffff) | ||
18 | PDprintk("%x reading 4 from %x: %x\n", slot, offset, v); | ||
19 | return v; | ||
20 | } | ||
21 | |||
22 | static inline u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset) | ||
23 | { | ||
24 | u8 v; | ||
25 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
26 | v = inb(0xcfc + (offset&3)); | ||
27 | PDprintk("%x reading 1 from %x: %x\n", slot, offset, v); | ||
28 | return v; | ||
29 | } | ||
30 | |||
31 | static inline u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset) | ||
32 | { | ||
33 | u16 v; | ||
34 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
35 | v = inw(0xcfc + (offset&2)); | ||
36 | PDprintk("%x reading 2 from %x: %x\n", slot, offset, v); | ||
37 | return v; | ||
38 | } | ||
39 | |||
40 | static inline void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, | ||
41 | u32 val) | ||
42 | { | ||
43 | PDprintk("%x writing to %x: %x\n", slot, offset, val); | ||
44 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
45 | outl(val, 0xcfc); | ||
46 | } | ||
47 | 15 | ||
48 | #endif | 16 | #endif |
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h index b47c3df9ed1d..14996d962bac 100644 --- a/include/asm-x86_64/pda.h +++ b/include/asm-x86_64/pda.h | |||
@@ -9,20 +9,24 @@ | |||
9 | 9 | ||
10 | /* Per processor datastructure. %gs points to it while the kernel runs */ | 10 | /* Per processor datastructure. %gs points to it while the kernel runs */ |
11 | struct x8664_pda { | 11 | struct x8664_pda { |
12 | struct task_struct *pcurrent; /* Current process */ | 12 | struct task_struct *pcurrent; /* 0 Current process */ |
13 | unsigned long data_offset; /* Per cpu data offset from linker address */ | 13 | unsigned long data_offset; /* 8 Per cpu data offset from linker |
14 | unsigned long kernelstack; /* top of kernel stack for current */ | 14 | address */ |
15 | unsigned long oldrsp; /* user rsp for system call */ | 15 | unsigned long kernelstack; /* 16 top of kernel stack for current */ |
16 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | 16 | unsigned long oldrsp; /* 24 user rsp for system call */ |
17 | unsigned long debugstack; /* #DB/#BP stack. */ | 17 | int irqcount; /* 32 Irq nesting counter. Starts with -1 */ |
18 | int cpunumber; /* 36 Logical CPU number */ | ||
19 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
20 | unsigned long stack_canary; /* 40 stack canary value */ | ||
21 | /* gcc-ABI: this canary MUST be at | ||
22 | offset 40!!! */ | ||
18 | #endif | 23 | #endif |
19 | int irqcount; /* Irq nesting counter. Starts with -1 */ | 24 | char *irqstackptr; |
20 | int cpunumber; /* Logical CPU number */ | ||
21 | char *irqstackptr; /* top of irqstack */ | ||
22 | int nodenumber; /* number of current node */ | 25 | int nodenumber; /* number of current node */ |
23 | unsigned int __softirq_pending; | 26 | unsigned int __softirq_pending; |
24 | unsigned int __nmi_count; /* number of NMI on this CPUs */ | 27 | unsigned int __nmi_count; /* number of NMI on this CPUs */ |
25 | int mmu_state; | 28 | short mmu_state; |
29 | short isidle; | ||
26 | struct mm_struct *active_mm; | 30 | struct mm_struct *active_mm; |
27 | unsigned apic_timer_irqs; | 31 | unsigned apic_timer_irqs; |
28 | } ____cacheline_aligned_in_smp; | 32 | } ____cacheline_aligned_in_smp; |
@@ -36,44 +40,69 @@ extern struct x8664_pda boot_cpu_pda[]; | |||
36 | * There is no fast way to get the base address of the PDA, all the accesses | 40 | * There is no fast way to get the base address of the PDA, all the accesses |
37 | * have to mention %fs/%gs. So it needs to be done this Torvaldian way. | 41 | * have to mention %fs/%gs. So it needs to be done this Torvaldian way. |
38 | */ | 42 | */ |
39 | #define sizeof_field(type,field) (sizeof(((type *)0)->field)) | 43 | extern void __bad_pda_field(void) __attribute__((noreturn)); |
40 | #define typeof_field(type,field) typeof(((type *)0)->field) | ||
41 | 44 | ||
42 | extern void __bad_pda_field(void); | 45 | /* |
46 | * proxy_pda doesn't actually exist, but tell gcc it is accessed for | ||
47 | * all PDA accesses so it gets read/write dependencies right. | ||
48 | */ | ||
49 | extern struct x8664_pda _proxy_pda; | ||
43 | 50 | ||
44 | #define pda_offset(field) offsetof(struct x8664_pda, field) | 51 | #define pda_offset(field) offsetof(struct x8664_pda, field) |
45 | 52 | ||
46 | #define pda_to_op(op,field,val) do { \ | 53 | #define pda_to_op(op,field,val) do { \ |
47 | typedef typeof_field(struct x8664_pda, field) T__; \ | 54 | typedef typeof(_proxy_pda.field) T__; \ |
48 | switch (sizeof_field(struct x8664_pda, field)) { \ | 55 | if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \ |
49 | case 2: \ | 56 | switch (sizeof(_proxy_pda.field)) { \ |
50 | asm volatile(op "w %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ | 57 | case 2: \ |
51 | case 4: \ | 58 | asm(op "w %1,%%gs:%c2" : \ |
52 | asm volatile(op "l %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ | 59 | "+m" (_proxy_pda.field) : \ |
53 | case 8: \ | 60 | "ri" ((T__)val), \ |
54 | asm volatile(op "q %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ | 61 | "i"(pda_offset(field))); \ |
55 | default: __bad_pda_field(); \ | 62 | break; \ |
56 | } \ | 63 | case 4: \ |
64 | asm(op "l %1,%%gs:%c2" : \ | ||
65 | "+m" (_proxy_pda.field) : \ | ||
66 | "ri" ((T__)val), \ | ||
67 | "i" (pda_offset(field))); \ | ||
68 | break; \ | ||
69 | case 8: \ | ||
70 | asm(op "q %1,%%gs:%c2": \ | ||
71 | "+m" (_proxy_pda.field) : \ | ||
72 | "ri" ((T__)val), \ | ||
73 | "i"(pda_offset(field))); \ | ||
74 | break; \ | ||
75 | default: \ | ||
76 | __bad_pda_field(); \ | ||
77 | } \ | ||
57 | } while (0) | 78 | } while (0) |
58 | 79 | ||
59 | /* | 80 | #define pda_from_op(op,field) ({ \ |
60 | * AK: PDA read accesses should be neither volatile nor have an memory clobber. | 81 | typeof(_proxy_pda.field) ret__; \ |
61 | * Unfortunately removing them causes all hell to break lose currently. | 82 | switch (sizeof(_proxy_pda.field)) { \ |
62 | */ | 83 | case 2: \ |
63 | #define pda_from_op(op,field) ({ \ | 84 | asm(op "w %%gs:%c1,%0" : \ |
64 | typeof_field(struct x8664_pda, field) ret__; \ | 85 | "=r" (ret__) : \ |
65 | switch (sizeof_field(struct x8664_pda, field)) { \ | 86 | "i" (pda_offset(field)), \ |
66 | case 2: \ | 87 | "m" (_proxy_pda.field)); \ |
67 | asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ | 88 | break; \ |
68 | case 4: \ | 89 | case 4: \ |
69 | asm volatile(op "l %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ | 90 | asm(op "l %%gs:%c1,%0": \ |
70 | case 8: \ | 91 | "=r" (ret__): \ |
71 | asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ | 92 | "i" (pda_offset(field)), \ |
72 | default: __bad_pda_field(); \ | 93 | "m" (_proxy_pda.field)); \ |
73 | } \ | 94 | break; \ |
95 | case 8: \ | ||
96 | asm(op "q %%gs:%c1,%0": \ | ||
97 | "=r" (ret__) : \ | ||
98 | "i" (pda_offset(field)), \ | ||
99 | "m" (_proxy_pda.field)); \ | ||
100 | break; \ | ||
101 | default: \ | ||
102 | __bad_pda_field(); \ | ||
103 | } \ | ||
74 | ret__; }) | 104 | ret__; }) |
75 | 105 | ||
76 | |||
77 | #define read_pda(field) pda_from_op("mov",field) | 106 | #define read_pda(field) pda_from_op("mov",field) |
78 | #define write_pda(field,val) pda_to_op("mov",field,val) | 107 | #define write_pda(field,val) pda_to_op("mov",field,val) |
79 | #define add_pda(field,val) pda_to_op("add",field,val) | 108 | #define add_pda(field,val) pda_to_op("add",field,val) |
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h index 08dd9f9dda81..285756010c51 100644 --- a/include/asm-x86_64/percpu.h +++ b/include/asm-x86_64/percpu.h | |||
@@ -11,6 +11,16 @@ | |||
11 | 11 | ||
12 | #include <asm/pda.h> | 12 | #include <asm/pda.h> |
13 | 13 | ||
14 | #ifdef CONFIG_MODULES | ||
15 | # define PERCPU_MODULE_RESERVE 8192 | ||
16 | #else | ||
17 | # define PERCPU_MODULE_RESERVE 0 | ||
18 | #endif | ||
19 | |||
20 | #define PERCPU_ENOUGH_ROOM \ | ||
21 | (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \ | ||
22 | PERCPU_MODULE_RESERVE) | ||
23 | |||
14 | #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) | 24 | #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) |
15 | #define __my_cpu_offset() read_pda(data_offset) | 25 | #define __my_cpu_offset() read_pda(data_offset) |
16 | 26 | ||
@@ -21,9 +31,15 @@ | |||
21 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name | 31 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name |
22 | 32 | ||
23 | /* var is in discarded region: offset to particular copy we want */ | 33 | /* var is in discarded region: offset to particular copy we want */ |
24 | #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) | 34 | #define per_cpu(var, cpu) (*({ \ |
25 | #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) | 35 | extern int simple_indentifier_##var(void); \ |
26 | #define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) | 36 | RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)); })) |
37 | #define __get_cpu_var(var) (*({ \ | ||
38 | extern int simple_indentifier_##var(void); \ | ||
39 | RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); })) | ||
40 | #define __raw_get_cpu_var(var) (*({ \ | ||
41 | extern int simple_indentifier_##var(void); \ | ||
42 | RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); })) | ||
27 | 43 | ||
28 | /* A macro to avoid #include hell... */ | 44 | /* A macro to avoid #include hell... */ |
29 | #define percpu_modcopy(pcpudst, src, size) \ | 45 | #define percpu_modcopy(pcpudst, src, size) \ |
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index a31ab4e68a9b..6899e770b173 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -21,12 +21,9 @@ extern unsigned long __supported_pte_mask; | |||
21 | 21 | ||
22 | #define swapper_pg_dir init_level4_pgt | 22 | #define swapper_pg_dir init_level4_pgt |
23 | 23 | ||
24 | extern int nonx_setup(char *str); | ||
25 | extern void paging_init(void); | 24 | extern void paging_init(void); |
26 | extern void clear_kernel_mapping(unsigned long addr, unsigned long size); | 25 | extern void clear_kernel_mapping(unsigned long addr, unsigned long size); |
27 | 26 | ||
28 | extern unsigned long pgkern_mask; | ||
29 | |||
30 | /* | 27 | /* |
31 | * ZERO_PAGE is a global shared page that is always zero: used | 28 | * ZERO_PAGE is a global shared page that is always zero: used |
32 | * for zero-mapped memory areas etc.. | 29 | * for zero-mapped memory areas etc.. |
@@ -101,9 +98,6 @@ static inline void pgd_clear (pgd_t * pgd) | |||
101 | set_pgd(pgd, __pgd(0)); | 98 | set_pgd(pgd, __pgd(0)); |
102 | } | 99 | } |
103 | 100 | ||
104 | #define pud_page(pud) \ | ||
105 | ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) | ||
106 | |||
107 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) | 101 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) |
108 | 102 | ||
109 | struct mm_struct; | 103 | struct mm_struct; |
@@ -268,7 +262,7 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) | |||
268 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) | 262 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) |
269 | static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 263 | static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } |
270 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 264 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } |
271 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 265 | static inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_NX); } |
272 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 266 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
273 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 267 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
274 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 268 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
@@ -281,11 +275,12 @@ static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & | |||
281 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } | 275 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } |
282 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } | 276 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } |
283 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } | 277 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } |
284 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } | 278 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; } |
285 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 279 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
286 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 280 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
287 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } | 281 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } |
288 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; } | 282 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; } |
283 | static inline pte_t pte_clrhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_PSE)); return pte; } | ||
289 | 284 | ||
290 | struct vm_area_struct; | 285 | struct vm_area_struct; |
291 | 286 | ||
@@ -326,7 +321,8 @@ static inline int pmd_large(pmd_t pte) { | |||
326 | /* | 321 | /* |
327 | * Level 4 access. | 322 | * Level 4 access. |
328 | */ | 323 | */ |
329 | #define pgd_page(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK)) | 324 | #define pgd_page_vaddr(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK)) |
325 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)) | ||
330 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 326 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
331 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) | 327 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) |
332 | #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) | 328 | #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) |
@@ -335,16 +331,18 @@ static inline int pmd_large(pmd_t pte) { | |||
335 | 331 | ||
336 | /* PUD - Level3 access */ | 332 | /* PUD - Level3 access */ |
337 | /* to find an entry in a page-table-directory. */ | 333 | /* to find an entry in a page-table-directory. */ |
334 | #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) | ||
335 | #define pud_page(pud) (pfn_to_page(pud_val(pud) >> PAGE_SHIFT)) | ||
338 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) | 336 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) |
339 | #define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address)) | 337 | #define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) |
340 | #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) | 338 | #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) |
341 | 339 | ||
342 | /* PMD - Level 2 access */ | 340 | /* PMD - Level 2 access */ |
343 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) | 341 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) |
344 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 342 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
345 | 343 | ||
346 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | 344 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) |
347 | #define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \ | 345 | #define pmd_offset(dir, address) ((pmd_t *) pud_page_vaddr(*(dir)) + \ |
348 | pmd_index(address)) | 346 | pmd_index(address)) |
349 | #define pmd_none(x) (!pmd_val(x)) | 347 | #define pmd_none(x) (!pmd_val(x)) |
350 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) | 348 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) |
@@ -382,7 +380,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
382 | 380 | ||
383 | #define pte_index(address) \ | 381 | #define pte_index(address) \ |
384 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 382 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
385 | #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ | 383 | #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \ |
386 | pte_index(address)) | 384 | pte_index(address)) |
387 | 385 | ||
388 | /* x86-64 always has all page tables mapped. */ | 386 | /* x86-64 always has all page tables mapped. */ |
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 038fe1f47e6f..c28fc2db2171 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -24,8 +24,6 @@ extern void mtrr_bp_init(void); | |||
24 | #define mtrr_bp_init() do {} while (0) | 24 | #define mtrr_bp_init() do {} while (0) |
25 | #endif | 25 | #endif |
26 | extern void init_memory_mapping(unsigned long start, unsigned long end); | 26 | extern void init_memory_mapping(unsigned long start, unsigned long end); |
27 | extern void size_zones(unsigned long *z, unsigned long *h, | ||
28 | unsigned long start_pfn, unsigned long end_pfn); | ||
29 | 27 | ||
30 | extern void system_call(void); | 28 | extern void system_call(void); |
31 | extern int kernel_syscall(void); | 29 | extern int kernel_syscall(void); |
@@ -51,10 +49,8 @@ extern unsigned long long monotonic_base; | |||
51 | extern int sysctl_vsyscall; | 49 | extern int sysctl_vsyscall; |
52 | extern int nohpet; | 50 | extern int nohpet; |
53 | extern unsigned long vxtime_hz; | 51 | extern unsigned long vxtime_hz; |
52 | extern void time_init_gtod(void); | ||
54 | 53 | ||
55 | extern int numa_setup(char *opt); | ||
56 | |||
57 | extern int setup_early_printk(char *); | ||
58 | extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); | 54 | extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); |
59 | 55 | ||
60 | extern void early_identify_cpu(struct cpuinfo_x86 *c); | 56 | extern void early_identify_cpu(struct cpuinfo_x86 *c); |
@@ -91,7 +87,7 @@ extern void syscall32_cpu_init(void); | |||
91 | 87 | ||
92 | extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); | 88 | extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); |
93 | 89 | ||
94 | extern void check_ioapic(void); | 90 | extern void early_quirks(void); |
95 | extern void check_efer(void); | 91 | extern void check_efer(void); |
96 | 92 | ||
97 | extern int unhandled_signal(struct task_struct *tsk, int sig); | 93 | extern int unhandled_signal(struct task_struct *tsk, int sig); |
@@ -103,13 +99,7 @@ extern void select_idle_routine(const struct cpuinfo_x86 *c); | |||
103 | extern unsigned long table_start, table_end; | 99 | extern unsigned long table_start, table_end; |
104 | 100 | ||
105 | extern int exception_trace; | 101 | extern int exception_trace; |
106 | extern int using_apic_timer; | ||
107 | extern int disable_apic; | ||
108 | extern unsigned cpu_khz; | 102 | extern unsigned cpu_khz; |
109 | extern int ioapic_force; | ||
110 | extern int skip_ioapic_setup; | ||
111 | extern int acpi_ht; | ||
112 | extern int acpi_disabled; | ||
113 | 103 | ||
114 | extern void no_iommu_init(void); | 104 | extern void no_iommu_init(void); |
115 | extern int force_iommu, no_iommu; | 105 | extern int force_iommu, no_iommu; |
@@ -131,7 +121,8 @@ extern int fix_aperture; | |||
131 | 121 | ||
132 | extern int reboot_force; | 122 | extern int reboot_force; |
133 | extern int notsc_setup(char *); | 123 | extern int notsc_setup(char *); |
134 | extern int setup_additional_cpus(char *); | 124 | |
125 | extern int gsi_irq_sharing(int gsi); | ||
135 | 126 | ||
136 | extern void smp_local_timer_interrupt(struct pt_regs * regs); | 127 | extern void smp_local_timer_interrupt(struct pt_regs * regs); |
137 | 128 | ||
diff --git a/include/asm-x86_64/ptrace-abi.h b/include/asm-x86_64/ptrace-abi.h new file mode 100644 index 000000000000..19184b0806b1 --- /dev/null +++ b/include/asm-x86_64/ptrace-abi.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef _X86_64_PTRACE_ABI_H | ||
2 | #define _X86_64_PTRACE_ABI_H | ||
3 | |||
4 | #if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) | ||
5 | #define R15 0 | ||
6 | #define R14 8 | ||
7 | #define R13 16 | ||
8 | #define R12 24 | ||
9 | #define RBP 32 | ||
10 | #define RBX 40 | ||
11 | /* arguments: interrupts/non tracing syscalls only save upto here*/ | ||
12 | #define R11 48 | ||
13 | #define R10 56 | ||
14 | #define R9 64 | ||
15 | #define R8 72 | ||
16 | #define RAX 80 | ||
17 | #define RCX 88 | ||
18 | #define RDX 96 | ||
19 | #define RSI 104 | ||
20 | #define RDI 112 | ||
21 | #define ORIG_RAX 120 /* = ERROR */ | ||
22 | /* end of arguments */ | ||
23 | /* cpu exception frame or undefined in case of fast syscall. */ | ||
24 | #define RIP 128 | ||
25 | #define CS 136 | ||
26 | #define EFLAGS 144 | ||
27 | #define RSP 152 | ||
28 | #define SS 160 | ||
29 | #define ARGOFFSET R11 | ||
30 | #endif /* __ASSEMBLY__ */ | ||
31 | |||
32 | /* top of stack page */ | ||
33 | #define FRAME_SIZE 168 | ||
34 | |||
35 | #define PTRACE_OLDSETOPTIONS 21 | ||
36 | |||
37 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
38 | #define PTRACE_GETREGS 12 | ||
39 | #define PTRACE_SETREGS 13 | ||
40 | #define PTRACE_GETFPREGS 14 | ||
41 | #define PTRACE_SETFPREGS 15 | ||
42 | #define PTRACE_GETFPXREGS 18 | ||
43 | #define PTRACE_SETFPXREGS 19 | ||
44 | |||
45 | /* only useful for access 32bit programs */ | ||
46 | #define PTRACE_GET_THREAD_AREA 25 | ||
47 | #define PTRACE_SET_THREAD_AREA 26 | ||
48 | |||
49 | #define PTRACE_ARCH_PRCTL 30 /* arch_prctl for child */ | ||
50 | |||
51 | #endif | ||
diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h index ca6f15ff61d4..ab827dc381d7 100644 --- a/include/asm-x86_64/ptrace.h +++ b/include/asm-x86_64/ptrace.h | |||
@@ -1,40 +1,9 @@ | |||
1 | #ifndef _X86_64_PTRACE_H | 1 | #ifndef _X86_64_PTRACE_H |
2 | #define _X86_64_PTRACE_H | 2 | #define _X86_64_PTRACE_H |
3 | 3 | ||
4 | #if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) | 4 | #include <asm/ptrace-abi.h> |
5 | #define R15 0 | ||
6 | #define R14 8 | ||
7 | #define R13 16 | ||
8 | #define R12 24 | ||
9 | #define RBP 32 | ||
10 | #define RBX 40 | ||
11 | /* arguments: interrupts/non tracing syscalls only save upto here*/ | ||
12 | #define R11 48 | ||
13 | #define R10 56 | ||
14 | #define R9 64 | ||
15 | #define R8 72 | ||
16 | #define RAX 80 | ||
17 | #define RCX 88 | ||
18 | #define RDX 96 | ||
19 | #define RSI 104 | ||
20 | #define RDI 112 | ||
21 | #define ORIG_RAX 120 /* = ERROR */ | ||
22 | /* end of arguments */ | ||
23 | /* cpu exception frame or undefined in case of fast syscall. */ | ||
24 | #define RIP 128 | ||
25 | #define CS 136 | ||
26 | #define EFLAGS 144 | ||
27 | #define RSP 152 | ||
28 | #define SS 160 | ||
29 | #define ARGOFFSET R11 | ||
30 | #endif /* __ASSEMBLY__ */ | ||
31 | 5 | ||
32 | /* top of stack page */ | 6 | #ifndef __ASSEMBLY__ |
33 | #define FRAME_SIZE 168 | ||
34 | |||
35 | #define PTRACE_OLDSETOPTIONS 21 | ||
36 | |||
37 | #ifndef __ASSEMBLY__ | ||
38 | 7 | ||
39 | struct pt_regs { | 8 | struct pt_regs { |
40 | unsigned long r15; | 9 | unsigned long r15; |
@@ -45,7 +14,7 @@ struct pt_regs { | |||
45 | unsigned long rbx; | 14 | unsigned long rbx; |
46 | /* arguments: non interrupts/non tracing syscalls only save upto here*/ | 15 | /* arguments: non interrupts/non tracing syscalls only save upto here*/ |
47 | unsigned long r11; | 16 | unsigned long r11; |
48 | unsigned long r10; | 17 | unsigned long r10; |
49 | unsigned long r9; | 18 | unsigned long r9; |
50 | unsigned long r8; | 19 | unsigned long r8; |
51 | unsigned long rax; | 20 | unsigned long rax; |
@@ -54,32 +23,18 @@ struct pt_regs { | |||
54 | unsigned long rsi; | 23 | unsigned long rsi; |
55 | unsigned long rdi; | 24 | unsigned long rdi; |
56 | unsigned long orig_rax; | 25 | unsigned long orig_rax; |
57 | /* end of arguments */ | 26 | /* end of arguments */ |
58 | /* cpu exception frame or undefined */ | 27 | /* cpu exception frame or undefined */ |
59 | unsigned long rip; | 28 | unsigned long rip; |
60 | unsigned long cs; | 29 | unsigned long cs; |
61 | unsigned long eflags; | 30 | unsigned long eflags; |
62 | unsigned long rsp; | 31 | unsigned long rsp; |
63 | unsigned long ss; | 32 | unsigned long ss; |
64 | /* top of stack page */ | 33 | /* top of stack page */ |
65 | }; | 34 | }; |
66 | 35 | ||
67 | #endif | 36 | #endif |
68 | 37 | ||
69 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
70 | #define PTRACE_GETREGS 12 | ||
71 | #define PTRACE_SETREGS 13 | ||
72 | #define PTRACE_GETFPREGS 14 | ||
73 | #define PTRACE_SETFPREGS 15 | ||
74 | #define PTRACE_GETFPXREGS 18 | ||
75 | #define PTRACE_SETFPXREGS 19 | ||
76 | |||
77 | /* only useful for access 32bit programs */ | ||
78 | #define PTRACE_GET_THREAD_AREA 25 | ||
79 | #define PTRACE_SET_THREAD_AREA 26 | ||
80 | |||
81 | #define PTRACE_ARCH_PRCTL 30 /* arch_prctl for child */ | ||
82 | |||
83 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 38 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
84 | #define user_mode(regs) (!!((regs)->cs & 3)) | 39 | #define user_mode(regs) (!!((regs)->cs & 3)) |
85 | #define user_mode_vm(regs) user_mode(regs) | 40 | #define user_mode_vm(regs) user_mode(regs) |
diff --git a/include/asm-x86_64/rwlock.h b/include/asm-x86_64/rwlock.h index dea0e9459264..72aeebed920b 100644 --- a/include/asm-x86_64/rwlock.h +++ b/include/asm-x86_64/rwlock.h | |||
@@ -18,69 +18,9 @@ | |||
18 | #ifndef _ASM_X86_64_RWLOCK_H | 18 | #ifndef _ASM_X86_64_RWLOCK_H |
19 | #define _ASM_X86_64_RWLOCK_H | 19 | #define _ASM_X86_64_RWLOCK_H |
20 | 20 | ||
21 | #include <linux/stringify.h> | ||
22 | |||
23 | #define RW_LOCK_BIAS 0x01000000 | 21 | #define RW_LOCK_BIAS 0x01000000 |
24 | #define RW_LOCK_BIAS_STR "0x01000000" | 22 | #define RW_LOCK_BIAS_STR "0x01000000" |
25 | |||
26 | #define __build_read_lock_ptr(rw, helper) \ | ||
27 | asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t" \ | ||
28 | "js 2f\n" \ | ||
29 | "1:\n" \ | ||
30 | LOCK_SECTION_START("") \ | ||
31 | "2:\tcall " helper "\n\t" \ | ||
32 | "jmp 1b\n" \ | ||
33 | LOCK_SECTION_END \ | ||
34 | ::"a" (rw) : "memory") | ||
35 | |||
36 | #define __build_read_lock_const(rw, helper) \ | ||
37 | asm volatile(LOCK_PREFIX "subl $1,%0\n\t" \ | ||
38 | "js 2f\n" \ | ||
39 | "1:\n" \ | ||
40 | LOCK_SECTION_START("") \ | ||
41 | "2:\tpushq %%rax\n\t" \ | ||
42 | "leaq %0,%%rax\n\t" \ | ||
43 | "call " helper "\n\t" \ | ||
44 | "popq %%rax\n\t" \ | ||
45 | "jmp 1b\n" \ | ||
46 | LOCK_SECTION_END \ | ||
47 | :"=m" (*((volatile int *)rw))::"memory") | ||
48 | |||
49 | #define __build_read_lock(rw, helper) do { \ | ||
50 | if (__builtin_constant_p(rw)) \ | ||
51 | __build_read_lock_const(rw, helper); \ | ||
52 | else \ | ||
53 | __build_read_lock_ptr(rw, helper); \ | ||
54 | } while (0) | ||
55 | |||
56 | #define __build_write_lock_ptr(rw, helper) \ | ||
57 | asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ | ||
58 | "jnz 2f\n" \ | ||
59 | "1:\n" \ | ||
60 | LOCK_SECTION_START("") \ | ||
61 | "2:\tcall " helper "\n\t" \ | ||
62 | "jmp 1b\n" \ | ||
63 | LOCK_SECTION_END \ | ||
64 | ::"a" (rw) : "memory") | ||
65 | |||
66 | #define __build_write_lock_const(rw, helper) \ | ||
67 | asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ | ||
68 | "jnz 2f\n" \ | ||
69 | "1:\n" \ | ||
70 | LOCK_SECTION_START("") \ | ||
71 | "2:\tpushq %%rax\n\t" \ | ||
72 | "leaq %0,%%rax\n\t" \ | ||
73 | "call " helper "\n\t" \ | ||
74 | "popq %%rax\n\t" \ | ||
75 | "jmp 1b\n" \ | ||
76 | LOCK_SECTION_END \ | ||
77 | :"=m" (*((volatile long *)rw))::"memory") | ||
78 | 23 | ||
79 | #define __build_write_lock(rw, helper) do { \ | 24 | /* Actual code is in asm/spinlock.h or in arch/x86_64/lib/rwlock.S */ |
80 | if (__builtin_constant_p(rw)) \ | ||
81 | __build_write_lock_const(rw, helper); \ | ||
82 | else \ | ||
83 | __build_write_lock_ptr(rw, helper); \ | ||
84 | } while (0) | ||
85 | 25 | ||
86 | #endif | 26 | #endif |
diff --git a/include/asm-x86_64/segment.h b/include/asm-x86_64/segment.h index d4bed33fb32c..334ddcdd8f92 100644 --- a/include/asm-x86_64/segment.h +++ b/include/asm-x86_64/segment.h | |||
@@ -20,15 +20,16 @@ | |||
20 | #define __USER_CS 0x33 /* 6*8+3 */ | 20 | #define __USER_CS 0x33 /* 6*8+3 */ |
21 | #define __USER32_DS __USER_DS | 21 | #define __USER32_DS __USER_DS |
22 | 22 | ||
23 | #define GDT_ENTRY_TLS 1 | ||
24 | #define GDT_ENTRY_TSS 8 /* needs two entries */ | 23 | #define GDT_ENTRY_TSS 8 /* needs two entries */ |
25 | #define GDT_ENTRY_LDT 10 /* needs two entries */ | 24 | #define GDT_ENTRY_LDT 10 /* needs two entries */ |
26 | #define GDT_ENTRY_TLS_MIN 12 | 25 | #define GDT_ENTRY_TLS_MIN 12 |
27 | #define GDT_ENTRY_TLS_MAX 14 | 26 | #define GDT_ENTRY_TLS_MAX 14 |
28 | /* 15 free */ | ||
29 | 27 | ||
30 | #define GDT_ENTRY_TLS_ENTRIES 3 | 28 | #define GDT_ENTRY_TLS_ENTRIES 3 |
31 | 29 | ||
30 | #define GDT_ENTRY_PER_CPU 15 /* Abused to load per CPU data from limit */ | ||
31 | #define __PER_CPU_SEG (GDT_ENTRY_PER_CPU * 8 + 3) | ||
32 | |||
32 | /* TLS indexes for 64bit - hardcoded in arch_prctl */ | 33 | /* TLS indexes for 64bit - hardcoded in arch_prctl */ |
33 | #define FS_TLS 0 | 34 | #define FS_TLS 0 |
34 | #define GS_TLS 1 | 35 | #define GS_TLS 1 |
diff --git a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h index 064df08b9a0f..107bd90429e8 100644 --- a/include/asm-x86_64/semaphore.h +++ b/include/asm-x86_64/semaphore.h | |||
@@ -107,12 +107,9 @@ static inline void down(struct semaphore * sem) | |||
107 | __asm__ __volatile__( | 107 | __asm__ __volatile__( |
108 | "# atomic down operation\n\t" | 108 | "# atomic down operation\n\t" |
109 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ | 109 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ |
110 | "js 2f\n" | 110 | "jns 1f\n\t" |
111 | "1:\n" | 111 | "call __down_failed\n" |
112 | LOCK_SECTION_START("") | 112 | "1:" |
113 | "2:\tcall __down_failed\n\t" | ||
114 | "jmp 1b\n" | ||
115 | LOCK_SECTION_END | ||
116 | :"=m" (sem->count) | 113 | :"=m" (sem->count) |
117 | :"D" (sem) | 114 | :"D" (sem) |
118 | :"memory"); | 115 | :"memory"); |
@@ -130,14 +127,11 @@ static inline int down_interruptible(struct semaphore * sem) | |||
130 | 127 | ||
131 | __asm__ __volatile__( | 128 | __asm__ __volatile__( |
132 | "# atomic interruptible down operation\n\t" | 129 | "# atomic interruptible down operation\n\t" |
130 | "xorl %0,%0\n\t" | ||
133 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 131 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
134 | "js 2f\n\t" | 132 | "jns 2f\n\t" |
135 | "xorl %0,%0\n" | 133 | "call __down_failed_interruptible\n" |
136 | "1:\n" | 134 | "2:\n" |
137 | LOCK_SECTION_START("") | ||
138 | "2:\tcall __down_failed_interruptible\n\t" | ||
139 | "jmp 1b\n" | ||
140 | LOCK_SECTION_END | ||
141 | :"=a" (result), "=m" (sem->count) | 135 | :"=a" (result), "=m" (sem->count) |
142 | :"D" (sem) | 136 | :"D" (sem) |
143 | :"memory"); | 137 | :"memory"); |
@@ -154,14 +148,11 @@ static inline int down_trylock(struct semaphore * sem) | |||
154 | 148 | ||
155 | __asm__ __volatile__( | 149 | __asm__ __volatile__( |
156 | "# atomic interruptible down operation\n\t" | 150 | "# atomic interruptible down operation\n\t" |
151 | "xorl %0,%0\n\t" | ||
157 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 152 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
158 | "js 2f\n\t" | 153 | "jns 2f\n\t" |
159 | "xorl %0,%0\n" | 154 | "call __down_failed_trylock\n\t" |
160 | "1:\n" | 155 | "2:\n" |
161 | LOCK_SECTION_START("") | ||
162 | "2:\tcall __down_failed_trylock\n\t" | ||
163 | "jmp 1b\n" | ||
164 | LOCK_SECTION_END | ||
165 | :"=a" (result), "=m" (sem->count) | 156 | :"=a" (result), "=m" (sem->count) |
166 | :"D" (sem) | 157 | :"D" (sem) |
167 | :"memory","cc"); | 158 | :"memory","cc"); |
@@ -179,12 +170,9 @@ static inline void up(struct semaphore * sem) | |||
179 | __asm__ __volatile__( | 170 | __asm__ __volatile__( |
180 | "# atomic up operation\n\t" | 171 | "# atomic up operation\n\t" |
181 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ | 172 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ |
182 | "jle 2f\n" | 173 | "jg 1f\n\t" |
183 | "1:\n" | 174 | "call __up_wakeup\n" |
184 | LOCK_SECTION_START("") | 175 | "1:" |
185 | "2:\tcall __up_wakeup\n\t" | ||
186 | "jmp 1b\n" | ||
187 | LOCK_SECTION_END | ||
188 | :"=m" (sem->count) | 176 | :"=m" (sem->count) |
189 | :"D" (sem) | 177 | :"D" (sem) |
190 | :"memory"); | 178 | :"memory"); |
diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h index 3ede2a61973a..4581f978b299 100644 --- a/include/asm-x86_64/signal.h +++ b/include/asm-x86_64/signal.h | |||
@@ -24,10 +24,6 @@ typedef struct { | |||
24 | } sigset_t; | 24 | } sigset_t; |
25 | 25 | ||
26 | 26 | ||
27 | struct pt_regs; | ||
28 | asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset); | ||
29 | |||
30 | |||
31 | #else | 27 | #else |
32 | /* Here we must cater to libcs that poke about in kernel headers. */ | 28 | /* Here we must cater to libcs that poke about in kernel headers. */ |
33 | 29 | ||
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index 6805e1feb300..d6b7c057edba 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
@@ -4,27 +4,18 @@ | |||
4 | /* | 4 | /* |
5 | * We need the APIC definitions automatically as part of 'smp.h' | 5 | * We need the APIC definitions automatically as part of 'smp.h' |
6 | */ | 6 | */ |
7 | #ifndef __ASSEMBLY__ | ||
8 | #include <linux/threads.h> | 7 | #include <linux/threads.h> |
9 | #include <linux/cpumask.h> | 8 | #include <linux/cpumask.h> |
10 | #include <linux/bitops.h> | 9 | #include <linux/bitops.h> |
11 | extern int disable_apic; | 10 | extern int disable_apic; |
12 | #endif | ||
13 | 11 | ||
14 | #ifdef CONFIG_X86_LOCAL_APIC | ||
15 | #ifndef __ASSEMBLY__ | ||
16 | #include <asm/fixmap.h> | 12 | #include <asm/fixmap.h> |
17 | #include <asm/mpspec.h> | 13 | #include <asm/mpspec.h> |
18 | #ifdef CONFIG_X86_IO_APIC | ||
19 | #include <asm/io_apic.h> | 14 | #include <asm/io_apic.h> |
20 | #endif | ||
21 | #include <asm/apic.h> | 15 | #include <asm/apic.h> |
22 | #include <asm/thread_info.h> | 16 | #include <asm/thread_info.h> |
23 | #endif | ||
24 | #endif | ||
25 | 17 | ||
26 | #ifdef CONFIG_SMP | 18 | #ifdef CONFIG_SMP |
27 | #ifndef ASSEMBLY | ||
28 | 19 | ||
29 | #include <asm/pda.h> | 20 | #include <asm/pda.h> |
30 | 21 | ||
@@ -42,14 +33,11 @@ extern cpumask_t cpu_initialized; | |||
42 | 33 | ||
43 | extern void smp_alloc_memory(void); | 34 | extern void smp_alloc_memory(void); |
44 | extern volatile unsigned long smp_invalidate_needed; | 35 | extern volatile unsigned long smp_invalidate_needed; |
45 | extern int pic_mode; | ||
46 | extern void lock_ipi_call_lock(void); | 36 | extern void lock_ipi_call_lock(void); |
47 | extern void unlock_ipi_call_lock(void); | 37 | extern void unlock_ipi_call_lock(void); |
48 | extern int smp_num_siblings; | 38 | extern int smp_num_siblings; |
49 | extern void smp_send_reschedule(int cpu); | 39 | extern void smp_send_reschedule(int cpu); |
50 | void smp_stop_cpu(void); | 40 | void smp_stop_cpu(void); |
51 | extern int smp_call_function_single(int cpuid, void (*func) (void *info), | ||
52 | void *info, int retry, int wait); | ||
53 | 41 | ||
54 | extern cpumask_t cpu_sibling_map[NR_CPUS]; | 42 | extern cpumask_t cpu_sibling_map[NR_CPUS]; |
55 | extern cpumask_t cpu_core_map[NR_CPUS]; | 43 | extern cpumask_t cpu_core_map[NR_CPUS]; |
@@ -76,20 +64,16 @@ static inline int hard_smp_processor_id(void) | |||
76 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); | 64 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); |
77 | } | 65 | } |
78 | 66 | ||
79 | extern int safe_smp_processor_id(void); | ||
80 | extern int __cpu_disable(void); | 67 | extern int __cpu_disable(void); |
81 | extern void __cpu_die(unsigned int cpu); | 68 | extern void __cpu_die(unsigned int cpu); |
82 | extern void prefill_possible_map(void); | 69 | extern void prefill_possible_map(void); |
83 | extern unsigned num_processors; | 70 | extern unsigned num_processors; |
84 | extern unsigned disabled_cpus; | 71 | extern unsigned disabled_cpus; |
85 | 72 | ||
86 | #endif /* !ASSEMBLY */ | ||
87 | |||
88 | #define NO_PROC_ID 0xFF /* No processor magic marker */ | 73 | #define NO_PROC_ID 0xFF /* No processor magic marker */ |
89 | 74 | ||
90 | #endif | 75 | #endif |
91 | 76 | ||
92 | #ifndef ASSEMBLY | ||
93 | /* | 77 | /* |
94 | * Some lowlevel functions might want to know about | 78 | * Some lowlevel functions might want to know about |
95 | * the real APIC ID <-> CPU # mapping. | 79 | * the real APIC ID <-> CPU # mapping. |
@@ -111,11 +95,8 @@ static inline int cpu_present_to_apicid(int mps_cpu) | |||
111 | return BAD_APICID; | 95 | return BAD_APICID; |
112 | } | 96 | } |
113 | 97 | ||
114 | #endif /* !ASSEMBLY */ | ||
115 | |||
116 | #ifndef CONFIG_SMP | 98 | #ifndef CONFIG_SMP |
117 | #define stack_smp_processor_id() 0 | 99 | #define stack_smp_processor_id() 0 |
118 | #define safe_smp_processor_id() 0 | ||
119 | #define cpu_logical_map(x) (x) | 100 | #define cpu_logical_map(x) (x) |
120 | #else | 101 | #else |
121 | #include <asm/thread_info.h> | 102 | #include <asm/thread_info.h> |
@@ -127,19 +108,23 @@ static inline int cpu_present_to_apicid(int mps_cpu) | |||
127 | }) | 108 | }) |
128 | #endif | 109 | #endif |
129 | 110 | ||
130 | #ifndef __ASSEMBLY__ | ||
131 | static __inline int logical_smp_processor_id(void) | 111 | static __inline int logical_smp_processor_id(void) |
132 | { | 112 | { |
133 | /* we don't want to mark this access volatile - bad code generation */ | 113 | /* we don't want to mark this access volatile - bad code generation */ |
134 | return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); | 114 | return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); |
135 | } | 115 | } |
136 | #endif | ||
137 | 116 | ||
138 | #ifdef CONFIG_SMP | 117 | #ifdef CONFIG_SMP |
139 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] | 118 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] |
140 | #else | 119 | #else |
141 | #define cpu_physical_id(cpu) boot_cpu_id | 120 | #define cpu_physical_id(cpu) boot_cpu_id |
142 | #endif | 121 | static inline int smp_call_function_single(int cpuid, void (*func) (void *info), |
143 | 122 | void *info, int retry, int wait) | |
123 | { | ||
124 | /* Disable interrupts here? */ | ||
125 | func(info); | ||
126 | return 0; | ||
127 | } | ||
128 | #endif /* !CONFIG_SMP */ | ||
144 | #endif | 129 | #endif |
145 | 130 | ||
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h index 248a79f0eaff..3daf5b005905 100644 --- a/include/asm-x86_64/spinlock.h +++ b/include/asm-x86_64/spinlock.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <asm/atomic.h> | 4 | #include <asm/atomic.h> |
5 | #include <asm/rwlock.h> | 5 | #include <asm/rwlock.h> |
6 | #include <asm/page.h> | 6 | #include <asm/page.h> |
7 | #include <asm/processor.h> | ||
7 | 8 | ||
8 | /* | 9 | /* |
9 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 10 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
@@ -16,31 +17,23 @@ | |||
16 | * (the type definitions are in asm/spinlock_types.h) | 17 | * (the type definitions are in asm/spinlock_types.h) |
17 | */ | 18 | */ |
18 | 19 | ||
19 | #define __raw_spin_is_locked(x) \ | 20 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) |
20 | (*(volatile signed int *)(&(x)->slock) <= 0) | 21 | { |
21 | 22 | return *(volatile signed int *)(&(lock)->slock) <= 0; | |
22 | #define __raw_spin_lock_string \ | 23 | } |
23 | "\n1:\t" \ | ||
24 | LOCK_PREFIX " ; decl %0\n\t" \ | ||
25 | "js 2f\n" \ | ||
26 | LOCK_SECTION_START("") \ | ||
27 | "2:\t" \ | ||
28 | "rep;nop\n\t" \ | ||
29 | "cmpl $0,%0\n\t" \ | ||
30 | "jle 2b\n\t" \ | ||
31 | "jmp 1b\n" \ | ||
32 | LOCK_SECTION_END | ||
33 | |||
34 | #define __raw_spin_lock_string_up \ | ||
35 | "\n\tdecl %0" | ||
36 | |||
37 | #define __raw_spin_unlock_string \ | ||
38 | "movl $1,%0" \ | ||
39 | :"=m" (lock->slock) : : "memory" | ||
40 | 24 | ||
41 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 25 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
42 | { | 26 | { |
43 | asm volatile(__raw_spin_lock_string : "=m" (lock->slock) : : "memory"); | 27 | asm volatile( |
28 | "\n1:\t" | ||
29 | LOCK_PREFIX " ; decl %0\n\t" | ||
30 | "jns 2f\n" | ||
31 | "3:\n" | ||
32 | "rep;nop\n\t" | ||
33 | "cmpl $0,%0\n\t" | ||
34 | "jle 3b\n\t" | ||
35 | "jmp 1b\n" | ||
36 | "2:\t" : "=m" (lock->slock) : : "memory"); | ||
44 | } | 37 | } |
45 | 38 | ||
46 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) | 39 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
@@ -49,7 +42,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
49 | { | 42 | { |
50 | int oldval; | 43 | int oldval; |
51 | 44 | ||
52 | __asm__ __volatile__( | 45 | asm volatile( |
53 | "xchgl %0,%1" | 46 | "xchgl %0,%1" |
54 | :"=q" (oldval), "=m" (lock->slock) | 47 | :"=q" (oldval), "=m" (lock->slock) |
55 | :"0" (0) : "memory"); | 48 | :"0" (0) : "memory"); |
@@ -59,13 +52,14 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
59 | 52 | ||
60 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 53 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
61 | { | 54 | { |
62 | __asm__ __volatile__( | 55 | asm volatile("movl $1,%0" :"=m" (lock->slock) :: "memory"); |
63 | __raw_spin_unlock_string | ||
64 | ); | ||
65 | } | 56 | } |
66 | 57 | ||
67 | #define __raw_spin_unlock_wait(lock) \ | 58 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) |
68 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | 59 | { |
60 | while (__raw_spin_is_locked(lock)) | ||
61 | cpu_relax(); | ||
62 | } | ||
69 | 63 | ||
70 | /* | 64 | /* |
71 | * Read-write spinlocks, allowing multiple readers | 65 | * Read-write spinlocks, allowing multiple readers |
@@ -79,26 +73,34 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
79 | * | 73 | * |
80 | * On x86, we implement read-write locks as a 32-bit counter | 74 | * On x86, we implement read-write locks as a 32-bit counter |
81 | * with the high bit (sign) being the "contended" bit. | 75 | * with the high bit (sign) being the "contended" bit. |
82 | * | ||
83 | * The inline assembly is non-obvious. Think about it. | ||
84 | * | ||
85 | * Changed to use the same technique as rw semaphores. See | ||
86 | * semaphore.h for details. -ben | ||
87 | * | ||
88 | * the helpers are in arch/i386/kernel/semaphore.c | ||
89 | */ | 76 | */ |
90 | 77 | ||
91 | #define __raw_read_can_lock(x) ((int)(x)->lock > 0) | 78 | static inline int __raw_read_can_lock(raw_rwlock_t *lock) |
92 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | 79 | { |
80 | return (int)(lock)->lock > 0; | ||
81 | } | ||
82 | |||
83 | static inline int __raw_write_can_lock(raw_rwlock_t *lock) | ||
84 | { | ||
85 | return (lock)->lock == RW_LOCK_BIAS; | ||
86 | } | ||
93 | 87 | ||
94 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 88 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
95 | { | 89 | { |
96 | __build_read_lock(rw, "__read_lock_failed"); | 90 | asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t" |
91 | "jns 1f\n" | ||
92 | "call __read_lock_failed\n" | ||
93 | "1:\n" | ||
94 | ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory"); | ||
97 | } | 95 | } |
98 | 96 | ||
99 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 97 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
100 | { | 98 | { |
101 | __build_write_lock(rw, "__write_lock_failed"); | 99 | asm volatile(LOCK_PREFIX "subl %1,(%0)\n\t" |
100 | "jz 1f\n" | ||
101 | "\tcall __write_lock_failed\n\t" | ||
102 | "1:\n" | ||
103 | ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory"); | ||
102 | } | 104 | } |
103 | 105 | ||
104 | static inline int __raw_read_trylock(raw_rwlock_t *lock) | 106 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
diff --git a/include/asm-x86_64/stacktrace.h b/include/asm-x86_64/stacktrace.h new file mode 100644 index 000000000000..5eb9799bef76 --- /dev/null +++ b/include/asm-x86_64/stacktrace.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _ASM_STACKTRACE_H | ||
2 | #define _ASM_STACKTRACE_H 1 | ||
3 | |||
4 | /* Generic stack tracer with callbacks */ | ||
5 | |||
6 | struct stacktrace_ops { | ||
7 | void (*warning)(void *data, char *msg); | ||
8 | /* msg must contain %s for the symbol */ | ||
9 | void (*warning_symbol)(void *data, char *msg, unsigned long symbol); | ||
10 | void (*address)(void *data, unsigned long address); | ||
11 | /* On negative return stop dumping */ | ||
12 | int (*stack)(void *data, char *name); | ||
13 | }; | ||
14 | |||
15 | void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, | ||
16 | struct stacktrace_ops *ops, void *data); | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 6bf170bceae1..bd376bc8c4ab 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h | |||
@@ -14,12 +14,13 @@ | |||
14 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" | 14 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" |
15 | 15 | ||
16 | /* frame pointer must be last for get_wchan */ | 16 | /* frame pointer must be last for get_wchan */ |
17 | #define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" | 17 | #define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" |
18 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" | 18 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" |
19 | 19 | ||
20 | #define __EXTRA_CLOBBER \ | 20 | #define __EXTRA_CLOBBER \ |
21 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" | 21 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" |
22 | 22 | ||
23 | /* Save restore flags to clear handle leaking NT */ | ||
23 | #define switch_to(prev,next,last) \ | 24 | #define switch_to(prev,next,last) \ |
24 | asm volatile(SAVE_CONTEXT \ | 25 | asm volatile(SAVE_CONTEXT \ |
25 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ | 26 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ |
diff --git a/include/asm-x86_64/tce.h b/include/asm-x86_64/tce.h index 53e9a68b3336..dbb047febc5e 100644 --- a/include/asm-x86_64/tce.h +++ b/include/asm-x86_64/tce.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifndef _ASM_X86_64_TCE_H | 24 | #ifndef _ASM_X86_64_TCE_H |
25 | #define _ASM_X86_64_TCE_H | 25 | #define _ASM_X86_64_TCE_H |
26 | 26 | ||
27 | extern void* tce_table_kva[]; | ||
28 | extern unsigned int specified_table_size; | 27 | extern unsigned int specified_table_size; |
29 | struct iommu_table; | 28 | struct iommu_table; |
30 | 29 | ||
diff --git a/include/asm-x86_64/therm_throt.h b/include/asm-x86_64/therm_throt.h new file mode 100644 index 000000000000..5aac059007ba --- /dev/null +++ b/include/asm-x86_64/therm_throt.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-i386/therm_throt.h> | |||
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index 2029b00351f3..787a08114b48 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h | |||
@@ -114,11 +114,14 @@ static inline struct thread_info *stack_thread_info(void) | |||
114 | #define TIF_IRET 5 /* force IRET */ | 114 | #define TIF_IRET 5 /* force IRET */ |
115 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ | 115 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ |
116 | #define TIF_SECCOMP 8 /* secure computing */ | 116 | #define TIF_SECCOMP 8 /* secure computing */ |
117 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */ | ||
117 | /* 16 free */ | 118 | /* 16 free */ |
118 | #define TIF_IA32 17 /* 32bit process */ | 119 | #define TIF_IA32 17 /* 32bit process */ |
119 | #define TIF_FORK 18 /* ret_from_fork */ | 120 | #define TIF_FORK 18 /* ret_from_fork */ |
120 | #define TIF_ABI_PENDING 19 | 121 | #define TIF_ABI_PENDING 19 |
121 | #define TIF_MEMDIE 20 | 122 | #define TIF_MEMDIE 20 |
123 | #define TIF_DEBUG 21 /* uses debug registers */ | ||
124 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ | ||
122 | 125 | ||
123 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 126 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
124 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 127 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
@@ -128,9 +131,12 @@ static inline struct thread_info *stack_thread_info(void) | |||
128 | #define _TIF_IRET (1<<TIF_IRET) | 131 | #define _TIF_IRET (1<<TIF_IRET) |
129 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 132 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
130 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 133 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
134 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
131 | #define _TIF_IA32 (1<<TIF_IA32) | 135 | #define _TIF_IA32 (1<<TIF_IA32) |
132 | #define _TIF_FORK (1<<TIF_FORK) | 136 | #define _TIF_FORK (1<<TIF_FORK) |
133 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) | 137 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) |
138 | #define _TIF_DEBUG (1<<TIF_DEBUG) | ||
139 | #define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) | ||
134 | 140 | ||
135 | /* work to do on interrupt/exception return */ | 141 | /* work to do on interrupt/exception return */ |
136 | #define _TIF_WORK_MASK \ | 142 | #define _TIF_WORK_MASK \ |
@@ -138,6 +144,9 @@ static inline struct thread_info *stack_thread_info(void) | |||
138 | /* work to do on any return to user space */ | 144 | /* work to do on any return to user space */ |
139 | #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) | 145 | #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) |
140 | 146 | ||
147 | /* flags to check in __switch_to() */ | ||
148 | #define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP) | ||
149 | |||
141 | #define PREEMPT_ACTIVE 0x10000000 | 150 | #define PREEMPT_ACTIVE 0x10000000 |
142 | 151 | ||
143 | /* | 152 | /* |
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h index d16d5b60f419..983bd296c81a 100644 --- a/include/asm-x86_64/tlbflush.h +++ b/include/asm-x86_64/tlbflush.h | |||
@@ -4,44 +4,44 @@ | |||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <asm/processor.h> | 5 | #include <asm/processor.h> |
6 | 6 | ||
7 | #define __flush_tlb() \ | 7 | static inline unsigned long get_cr3(void) |
8 | do { \ | 8 | { |
9 | unsigned long tmpreg; \ | 9 | unsigned long cr3; |
10 | \ | 10 | asm volatile("mov %%cr3,%0" : "=r" (cr3)); |
11 | __asm__ __volatile__( \ | 11 | return cr3; |
12 | "movq %%cr3, %0; # flush TLB \n" \ | 12 | } |
13 | "movq %0, %%cr3; \n" \ | ||
14 | : "=r" (tmpreg) \ | ||
15 | :: "memory"); \ | ||
16 | } while (0) | ||
17 | 13 | ||
18 | /* | 14 | static inline void set_cr3(unsigned long cr3) |
19 | * Global pages have to be flushed a bit differently. Not a real | 15 | { |
20 | * performance problem because this does not happen often. | 16 | asm volatile("mov %0,%%cr3" :: "r" (cr3) : "memory"); |
21 | */ | 17 | } |
22 | #define __flush_tlb_global() \ | 18 | |
23 | do { \ | 19 | static inline void __flush_tlb(void) |
24 | unsigned long tmpreg, cr4, cr4_orig; \ | 20 | { |
25 | \ | 21 | set_cr3(get_cr3()); |
26 | __asm__ __volatile__( \ | 22 | } |
27 | "movq %%cr4, %2; # turn off PGE \n" \ | 23 | |
28 | "movq %2, %1; \n" \ | 24 | static inline unsigned long get_cr4(void) |
29 | "andq %3, %1; \n" \ | 25 | { |
30 | "movq %1, %%cr4; \n" \ | 26 | unsigned long cr4; |
31 | "movq %%cr3, %0; # flush TLB \n" \ | 27 | asm volatile("mov %%cr4,%0" : "=r" (cr4)); |
32 | "movq %0, %%cr3; \n" \ | 28 | return cr4; |
33 | "movq %2, %%cr4; # turn PGE back on \n" \ | 29 | } |
34 | : "=&r" (tmpreg), "=&r" (cr4), "=&r" (cr4_orig) \ | 30 | |
35 | : "i" (~X86_CR4_PGE) \ | 31 | static inline void set_cr4(unsigned long cr4) |
36 | : "memory"); \ | 32 | { |
37 | } while (0) | 33 | asm volatile("mov %0,%%cr4" :: "r" (cr4) : "memory"); |
38 | 34 | } | |
39 | extern unsigned long pgkern_mask; | 35 | |
40 | 36 | static inline void __flush_tlb_all(void) | |
41 | #define __flush_tlb_all() __flush_tlb_global() | 37 | { |
38 | unsigned long cr4 = get_cr4(); | ||
39 | set_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */ | ||
40 | set_cr4(cr4); /* write old PGE again and flush TLBs */ | ||
41 | } | ||
42 | 42 | ||
43 | #define __flush_tlb_one(addr) \ | 43 | #define __flush_tlb_one(addr) \ |
44 | __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) | 44 | __asm__ __volatile__("invlpg (%0)" :: "r" (addr) : "memory") |
45 | 45 | ||
46 | 46 | ||
47 | /* | 47 | /* |
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h index 1e1fa003daa3..e856570c0689 100644 --- a/include/asm-x86_64/uaccess.h +++ b/include/asm-x86_64/uaccess.h | |||
@@ -84,7 +84,7 @@ struct exception_table_entry | |||
84 | */ | 84 | */ |
85 | 85 | ||
86 | #define __get_user_x(size,ret,x,ptr) \ | 86 | #define __get_user_x(size,ret,x,ptr) \ |
87 | __asm__ __volatile__("call __get_user_" #size \ | 87 | asm volatile("call __get_user_" #size \ |
88 | :"=a" (ret),"=d" (x) \ | 88 | :"=a" (ret),"=d" (x) \ |
89 | :"c" (ptr) \ | 89 | :"c" (ptr) \ |
90 | :"r8") | 90 | :"r8") |
@@ -101,7 +101,7 @@ struct exception_table_entry | |||
101 | case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \ | 101 | case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \ |
102 | default: __get_user_bad(); break; \ | 102 | default: __get_user_bad(); break; \ |
103 | } \ | 103 | } \ |
104 | (x) = (__typeof__(*(ptr)))__val_gu; \ | 104 | (x) = (typeof(*(ptr)))__val_gu; \ |
105 | __ret_gu; \ | 105 | __ret_gu; \ |
106 | }) | 106 | }) |
107 | 107 | ||
@@ -112,7 +112,7 @@ extern void __put_user_8(void); | |||
112 | extern void __put_user_bad(void); | 112 | extern void __put_user_bad(void); |
113 | 113 | ||
114 | #define __put_user_x(size,ret,x,ptr) \ | 114 | #define __put_user_x(size,ret,x,ptr) \ |
115 | __asm__ __volatile__("call __put_user_" #size \ | 115 | asm volatile("call __put_user_" #size \ |
116 | :"=a" (ret) \ | 116 | :"=a" (ret) \ |
117 | :"c" (ptr),"d" (x) \ | 117 | :"c" (ptr),"d" (x) \ |
118 | :"r8") | 118 | :"r8") |
@@ -139,7 +139,7 @@ extern void __put_user_bad(void); | |||
139 | #define __put_user_check(x,ptr,size) \ | 139 | #define __put_user_check(x,ptr,size) \ |
140 | ({ \ | 140 | ({ \ |
141 | int __pu_err; \ | 141 | int __pu_err; \ |
142 | __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ | 142 | typeof(*(ptr)) __user *__pu_addr = (ptr); \ |
143 | switch (size) { \ | 143 | switch (size) { \ |
144 | case 1: __put_user_x(1,__pu_err,x,__pu_addr); break; \ | 144 | case 1: __put_user_x(1,__pu_err,x,__pu_addr); break; \ |
145 | case 2: __put_user_x(2,__pu_err,x,__pu_addr); break; \ | 145 | case 2: __put_user_x(2,__pu_err,x,__pu_addr); break; \ |
@@ -173,7 +173,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
173 | * aliasing issues. | 173 | * aliasing issues. |
174 | */ | 174 | */ |
175 | #define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \ | 175 | #define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \ |
176 | __asm__ __volatile__( \ | 176 | asm volatile( \ |
177 | "1: mov"itype" %"rtype"1,%2\n" \ | 177 | "1: mov"itype" %"rtype"1,%2\n" \ |
178 | "2:\n" \ | 178 | "2:\n" \ |
179 | ".section .fixup,\"ax\"\n" \ | 179 | ".section .fixup,\"ax\"\n" \ |
@@ -193,7 +193,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
193 | int __gu_err; \ | 193 | int __gu_err; \ |
194 | unsigned long __gu_val; \ | 194 | unsigned long __gu_val; \ |
195 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ | 195 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ |
196 | (x) = (__typeof__(*(ptr)))__gu_val; \ | 196 | (x) = (typeof(*(ptr)))__gu_val; \ |
197 | __gu_err; \ | 197 | __gu_err; \ |
198 | }) | 198 | }) |
199 | 199 | ||
@@ -217,7 +217,7 @@ do { \ | |||
217 | } while (0) | 217 | } while (0) |
218 | 218 | ||
219 | #define __get_user_asm(x, addr, err, itype, rtype, ltype, errno) \ | 219 | #define __get_user_asm(x, addr, err, itype, rtype, ltype, errno) \ |
220 | __asm__ __volatile__( \ | 220 | asm volatile( \ |
221 | "1: mov"itype" %2,%"rtype"1\n" \ | 221 | "1: mov"itype" %2,%"rtype"1\n" \ |
222 | "2:\n" \ | 222 | "2:\n" \ |
223 | ".section .fixup,\"ax\"\n" \ | 223 | ".section .fixup,\"ax\"\n" \ |
@@ -237,15 +237,20 @@ do { \ | |||
237 | */ | 237 | */ |
238 | 238 | ||
239 | /* Handles exceptions in both to and from, but doesn't do access_ok */ | 239 | /* Handles exceptions in both to and from, but doesn't do access_ok */ |
240 | extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); | 240 | __must_check unsigned long |
241 | 241 | copy_user_generic(void *to, const void *from, unsigned len); | |
242 | extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); | 242 | |
243 | extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); | 243 | __must_check unsigned long |
244 | extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); | 244 | copy_to_user(void __user *to, const void *from, unsigned len); |
245 | 245 | __must_check unsigned long | |
246 | static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) | 246 | copy_from_user(void *to, const void __user *from, unsigned len); |
247 | __must_check unsigned long | ||
248 | copy_in_user(void __user *to, const void __user *from, unsigned len); | ||
249 | |||
250 | static __always_inline __must_check | ||
251 | int __copy_from_user(void *dst, const void __user *src, unsigned size) | ||
247 | { | 252 | { |
248 | int ret = 0; | 253 | int ret = 0; |
249 | if (!__builtin_constant_p(size)) | 254 | if (!__builtin_constant_p(size)) |
250 | return copy_user_generic(dst,(__force void *)src,size); | 255 | return copy_user_generic(dst,(__force void *)src,size); |
251 | switch (size) { | 256 | switch (size) { |
@@ -272,9 +277,10 @@ static __always_inline int __copy_from_user(void *dst, const void __user *src, u | |||
272 | } | 277 | } |
273 | } | 278 | } |
274 | 279 | ||
275 | static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) | 280 | static __always_inline __must_check |
281 | int __copy_to_user(void __user *dst, const void *src, unsigned size) | ||
276 | { | 282 | { |
277 | int ret = 0; | 283 | int ret = 0; |
278 | if (!__builtin_constant_p(size)) | 284 | if (!__builtin_constant_p(size)) |
279 | return copy_user_generic((__force void *)dst,src,size); | 285 | return copy_user_generic((__force void *)dst,src,size); |
280 | switch (size) { | 286 | switch (size) { |
@@ -303,10 +309,10 @@ static __always_inline int __copy_to_user(void __user *dst, const void *src, uns | |||
303 | } | 309 | } |
304 | } | 310 | } |
305 | 311 | ||
306 | 312 | static __always_inline __must_check | |
307 | static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) | 313 | int __copy_in_user(void __user *dst, const void __user *src, unsigned size) |
308 | { | 314 | { |
309 | int ret = 0; | 315 | int ret = 0; |
310 | if (!__builtin_constant_p(size)) | 316 | if (!__builtin_constant_p(size)) |
311 | return copy_user_generic((__force void *)dst,(__force void *)src,size); | 317 | return copy_user_generic((__force void *)dst,(__force void *)src,size); |
312 | switch (size) { | 318 | switch (size) { |
@@ -344,15 +350,17 @@ static __always_inline int __copy_in_user(void __user *dst, const void __user *s | |||
344 | } | 350 | } |
345 | } | 351 | } |
346 | 352 | ||
347 | long strncpy_from_user(char *dst, const char __user *src, long count); | 353 | __must_check long |
348 | long __strncpy_from_user(char *dst, const char __user *src, long count); | 354 | strncpy_from_user(char *dst, const char __user *src, long count); |
349 | long strnlen_user(const char __user *str, long n); | 355 | __must_check long |
350 | long __strnlen_user(const char __user *str, long n); | 356 | __strncpy_from_user(char *dst, const char __user *src, long count); |
351 | long strlen_user(const char __user *str); | 357 | __must_check long strnlen_user(const char __user *str, long n); |
352 | unsigned long clear_user(void __user *mem, unsigned long len); | 358 | __must_check long __strnlen_user(const char __user *str, long n); |
353 | unsigned long __clear_user(void __user *mem, unsigned long len); | 359 | __must_check long strlen_user(const char __user *str); |
354 | 360 | __must_check unsigned long clear_user(void __user *mem, unsigned long len); | |
355 | #define __copy_to_user_inatomic __copy_to_user | 361 | __must_check unsigned long __clear_user(void __user *mem, unsigned long len); |
356 | #define __copy_from_user_inatomic __copy_from_user | 362 | |
363 | __must_check long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size); | ||
364 | #define __copy_to_user_inatomic copy_user_generic | ||
357 | 365 | ||
358 | #endif /* __X86_64_UACCESS_H */ | 366 | #endif /* __X86_64_UACCESS_H */ |
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 80fd48e84bbb..6137146516d3 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h | |||
@@ -600,9 +600,9 @@ __SYSCALL(__NR_fchmodat, sys_fchmodat) | |||
600 | #define __NR_faccessat 269 | 600 | #define __NR_faccessat 269 |
601 | __SYSCALL(__NR_faccessat, sys_faccessat) | 601 | __SYSCALL(__NR_faccessat, sys_faccessat) |
602 | #define __NR_pselect6 270 | 602 | #define __NR_pselect6 270 |
603 | __SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */ | 603 | __SYSCALL(__NR_pselect6, sys_pselect6) |
604 | #define __NR_ppoll 271 | 604 | #define __NR_ppoll 271 |
605 | __SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ | 605 | __SYSCALL(__NR_ppoll, sys_ppoll) |
606 | #define __NR_unshare 272 | 606 | #define __NR_unshare 272 |
607 | __SYSCALL(__NR_unshare, sys_unshare) | 607 | __SYSCALL(__NR_unshare, sys_unshare) |
608 | #define __NR_set_robust_list 273 | 608 | #define __NR_set_robust_list 273 |
@@ -623,16 +623,17 @@ __SYSCALL(__NR_move_pages, sys_move_pages) | |||
623 | #ifdef __KERNEL__ | 623 | #ifdef __KERNEL__ |
624 | 624 | ||
625 | #define __NR_syscall_max __NR_move_pages | 625 | #define __NR_syscall_max __NR_move_pages |
626 | #include <linux/err.h> | ||
626 | 627 | ||
627 | #ifndef __NO_STUBS | 628 | #ifndef __NO_STUBS |
628 | 629 | ||
629 | /* user-visible error numbers are in the range -1 - -4095 */ | 630 | /* user-visible error numbers are in the range -1 - -MAX_ERRNO */ |
630 | 631 | ||
631 | #define __syscall_clobber "r11","rcx","memory" | 632 | #define __syscall_clobber "r11","rcx","memory" |
632 | 633 | ||
633 | #define __syscall_return(type, res) \ | 634 | #define __syscall_return(type, res) \ |
634 | do { \ | 635 | do { \ |
635 | if ((unsigned long)(res) >= (unsigned long)(-127)) { \ | 636 | if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ |
636 | errno = -(res); \ | 637 | errno = -(res); \ |
637 | res = -1; \ | 638 | res = -1; \ |
638 | } \ | 639 | } \ |
@@ -658,6 +659,7 @@ do { \ | |||
658 | #define __ARCH_WANT_SYS_SIGPENDING | 659 | #define __ARCH_WANT_SYS_SIGPENDING |
659 | #define __ARCH_WANT_SYS_SIGPROCMASK | 660 | #define __ARCH_WANT_SYS_SIGPROCMASK |
660 | #define __ARCH_WANT_SYS_RT_SIGACTION | 661 | #define __ARCH_WANT_SYS_RT_SIGACTION |
662 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
661 | #define __ARCH_WANT_SYS_TIME | 663 | #define __ARCH_WANT_SYS_TIME |
662 | #define __ARCH_WANT_COMPAT_SYS_TIME | 664 | #define __ARCH_WANT_COMPAT_SYS_TIME |
663 | 665 | ||
diff --git a/include/asm-x86_64/unwind.h b/include/asm-x86_64/unwind.h index 1f6e9bfb569e..2e7ff10fd775 100644 --- a/include/asm-x86_64/unwind.h +++ b/include/asm-x86_64/unwind.h | |||
@@ -18,6 +18,7 @@ struct unwind_frame_info | |||
18 | { | 18 | { |
19 | struct pt_regs regs; | 19 | struct pt_regs regs; |
20 | struct task_struct *task; | 20 | struct task_struct *task; |
21 | unsigned call_frame:1; | ||
21 | }; | 22 | }; |
22 | 23 | ||
23 | #define UNW_PC(frame) (frame)->regs.rip | 24 | #define UNW_PC(frame) (frame)->regs.rip |
@@ -57,6 +58,10 @@ struct unwind_frame_info | |||
57 | PTREGS_INFO(r15), \ | 58 | PTREGS_INFO(r15), \ |
58 | PTREGS_INFO(rip) | 59 | PTREGS_INFO(rip) |
59 | 60 | ||
61 | #define UNW_DEFAULT_RA(raItem, dataAlign) \ | ||
62 | ((raItem).where == Memory && \ | ||
63 | !((raItem).value * (dataAlign) + 8)) | ||
64 | |||
60 | static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, | 65 | static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, |
61 | /*const*/ struct pt_regs *regs) | 66 | /*const*/ struct pt_regs *regs) |
62 | { | 67 | { |
@@ -94,8 +99,8 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info) | |||
94 | 99 | ||
95 | #else | 100 | #else |
96 | 101 | ||
97 | #define UNW_PC(frame) ((void)(frame), 0) | 102 | #define UNW_PC(frame) ((void)(frame), 0UL) |
98 | #define UNW_SP(frame) ((void)(frame), 0) | 103 | #define UNW_SP(frame) ((void)(frame), 0UL) |
99 | 104 | ||
100 | static inline int arch_unw_user_mode(const void *info) | 105 | static inline int arch_unw_user_mode(const void *info) |
101 | { | 106 | { |
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h index 146b24402a5f..2281e9399b96 100644 --- a/include/asm-x86_64/vsyscall.h +++ b/include/asm-x86_64/vsyscall.h | |||
@@ -4,6 +4,7 @@ | |||
4 | enum vsyscall_num { | 4 | enum vsyscall_num { |
5 | __NR_vgettimeofday, | 5 | __NR_vgettimeofday, |
6 | __NR_vtime, | 6 | __NR_vtime, |
7 | __NR_vgetcpu, | ||
7 | }; | 8 | }; |
8 | 9 | ||
9 | #define VSYSCALL_START (-10UL << 20) | 10 | #define VSYSCALL_START (-10UL << 20) |
@@ -15,6 +16,7 @@ enum vsyscall_num { | |||
15 | #include <linux/seqlock.h> | 16 | #include <linux/seqlock.h> |
16 | 17 | ||
17 | #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) | 18 | #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) |
19 | #define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16))) | ||
18 | #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) | 20 | #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) |
19 | #define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) | 21 | #define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) |
20 | #define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) | 22 | #define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) |
@@ -26,6 +28,9 @@ enum vsyscall_num { | |||
26 | #define VXTIME_HPET 2 | 28 | #define VXTIME_HPET 2 |
27 | #define VXTIME_PMTMR 3 | 29 | #define VXTIME_PMTMR 3 |
28 | 30 | ||
31 | #define VGETCPU_RDTSCP 1 | ||
32 | #define VGETCPU_LSL 2 | ||
33 | |||
29 | struct vxtime_data { | 34 | struct vxtime_data { |
30 | long hpet_address; /* HPET base address */ | 35 | long hpet_address; /* HPET base address */ |
31 | int last; | 36 | int last; |
@@ -40,6 +45,7 @@ struct vxtime_data { | |||
40 | 45 | ||
41 | /* vsyscall space (readonly) */ | 46 | /* vsyscall space (readonly) */ |
42 | extern struct vxtime_data __vxtime; | 47 | extern struct vxtime_data __vxtime; |
48 | extern int __vgetcpu_mode; | ||
43 | extern struct timespec __xtime; | 49 | extern struct timespec __xtime; |
44 | extern volatile unsigned long __jiffies; | 50 | extern volatile unsigned long __jiffies; |
45 | extern unsigned long __wall_jiffies; | 51 | extern unsigned long __wall_jiffies; |
@@ -48,6 +54,7 @@ extern seqlock_t __xtime_lock; | |||
48 | 54 | ||
49 | /* kernel space (writeable) */ | 55 | /* kernel space (writeable) */ |
50 | extern struct vxtime_data vxtime; | 56 | extern struct vxtime_data vxtime; |
57 | extern int vgetcpu_mode; | ||
51 | extern unsigned long wall_jiffies; | 58 | extern unsigned long wall_jiffies; |
52 | extern struct timezone sys_tz; | 59 | extern struct timezone sys_tz; |
53 | extern int sysctl_vsyscall; | 60 | extern int sysctl_vsyscall; |
@@ -55,6 +62,8 @@ extern seqlock_t xtime_lock; | |||
55 | 62 | ||
56 | extern int sysctl_vsyscall; | 63 | extern int sysctl_vsyscall; |
57 | 64 | ||
65 | extern void vsyscall_set_cpu(int cpu); | ||
66 | |||
58 | #define ARCH_HAVE_XTIME_LOCK 1 | 67 | #define ARCH_HAVE_XTIME_LOCK 1 |
59 | 68 | ||
60 | #endif /* __KERNEL__ */ | 69 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h index 7b15afb70c56..a47cc734c20c 100644 --- a/include/asm-xtensa/pgtable.h +++ b/include/asm-xtensa/pgtable.h | |||
@@ -218,7 +218,7 @@ extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; | |||
218 | /* | 218 | /* |
219 | * The pmd contains the kernel virtual address of the pte page. | 219 | * The pmd contains the kernel virtual address of the pte page. |
220 | */ | 220 | */ |
221 | #define pmd_page_kernel(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK)) | 221 | #define pmd_page_vaddr(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK)) |
222 | #define pmd_page(pmd) virt_to_page(pmd_val(pmd)) | 222 | #define pmd_page(pmd) virt_to_page(pmd_val(pmd)) |
223 | 223 | ||
224 | /* | 224 | /* |
@@ -349,7 +349,7 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | |||
349 | /* Find an entry in the third-level page table.. */ | 349 | /* Find an entry in the third-level page table.. */ |
350 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 350 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
351 | #define pte_offset_kernel(dir,addr) \ | 351 | #define pte_offset_kernel(dir,addr) \ |
352 | ((pte_t*) pmd_page_kernel(*(dir)) + pte_index(addr)) | 352 | ((pte_t*) pmd_page_vaddr(*(dir)) + pte_index(addr)) |
353 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) | 353 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) |
354 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr)) | 354 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr)) |
355 | 355 | ||
diff --git a/include/linux/aer.h b/include/linux/aer.h new file mode 100644 index 000000000000..402e178b38eb --- /dev/null +++ b/include/linux/aer.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Intel Corp. | ||
3 | * Tom Long Nguyen (tom.l.nguyen@intel.com) | ||
4 | * Zhang Yanmin (yanmin.zhang@intel.com) | ||
5 | */ | ||
6 | |||
7 | #ifndef _AER_H_ | ||
8 | #define _AER_H_ | ||
9 | |||
10 | #if defined(CONFIG_PCIEAER) | ||
11 | /* pci-e port driver needs this function to enable aer */ | ||
12 | extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); | ||
13 | extern int pci_find_aer_capability(struct pci_dev *dev); | ||
14 | extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); | ||
15 | extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); | ||
16 | #else | ||
17 | #define pci_enable_pcie_error_reporting(dev) do { } while (0) | ||
18 | #define pci_find_aer_capability(dev) do { } while (0) | ||
19 | #define pci_disable_pcie_error_reporting(dev) do { } while (0) | ||
20 | #define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0) | ||
21 | #endif | ||
22 | |||
23 | #endif //_AER_H_ | ||
24 | |||
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index e319c649e4fd..31e9abb6d977 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -4,11 +4,8 @@ | |||
4 | #ifndef _LINUX_BOOTMEM_H | 4 | #ifndef _LINUX_BOOTMEM_H |
5 | #define _LINUX_BOOTMEM_H | 5 | #define _LINUX_BOOTMEM_H |
6 | 6 | ||
7 | #include <asm/pgtable.h> | ||
8 | #include <asm/dma.h> | ||
9 | #include <linux/cache.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/mmzone.h> | 7 | #include <linux/mmzone.h> |
8 | #include <asm/dma.h> | ||
12 | 9 | ||
13 | /* | 10 | /* |
14 | * simple boot-time physical memory area allocator. | 11 | * simple boot-time physical memory area allocator. |
@@ -41,45 +38,64 @@ typedef struct bootmem_data { | |||
41 | struct list_head list; | 38 | struct list_head list; |
42 | } bootmem_data_t; | 39 | } bootmem_data_t; |
43 | 40 | ||
44 | extern unsigned long __init bootmem_bootmap_pages (unsigned long); | 41 | extern unsigned long bootmem_bootmap_pages(unsigned long); |
45 | extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); | 42 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
46 | extern void __init free_bootmem (unsigned long addr, unsigned long size); | 43 | extern void free_bootmem(unsigned long addr, unsigned long size); |
47 | extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); | 44 | extern void *__alloc_bootmem(unsigned long size, |
48 | extern void * __init __alloc_bootmem_nopanic (unsigned long size, unsigned long align, unsigned long goal); | 45 | unsigned long align, |
49 | extern void * __init __alloc_bootmem_low(unsigned long size, | 46 | unsigned long goal); |
50 | unsigned long align, | 47 | extern void *__alloc_bootmem_nopanic(unsigned long size, |
51 | unsigned long goal); | 48 | unsigned long align, |
52 | extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, | 49 | unsigned long goal); |
53 | unsigned long size, | 50 | extern void *__alloc_bootmem_low(unsigned long size, |
54 | unsigned long align, | 51 | unsigned long align, |
55 | unsigned long goal); | 52 | unsigned long goal); |
56 | extern void * __init __alloc_bootmem_core(struct bootmem_data *bdata, | 53 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, |
57 | unsigned long size, unsigned long align, unsigned long goal, | 54 | unsigned long size, |
58 | unsigned long limit); | 55 | unsigned long align, |
56 | unsigned long goal); | ||
57 | extern void *__alloc_bootmem_core(struct bootmem_data *bdata, | ||
58 | unsigned long size, | ||
59 | unsigned long align, | ||
60 | unsigned long goal, | ||
61 | unsigned long limit); | ||
62 | |||
59 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 63 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
60 | extern void __init reserve_bootmem (unsigned long addr, unsigned long size); | 64 | extern void reserve_bootmem(unsigned long addr, unsigned long size); |
61 | #define alloc_bootmem(x) \ | 65 | #define alloc_bootmem(x) \ |
62 | __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 66 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
63 | #define alloc_bootmem_low(x) \ | 67 | #define alloc_bootmem_low(x) \ |
64 | __alloc_bootmem_low((x), SMP_CACHE_BYTES, 0) | 68 | __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) |
65 | #define alloc_bootmem_pages(x) \ | 69 | #define alloc_bootmem_pages(x) \ |
66 | __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 70 | __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
67 | #define alloc_bootmem_low_pages(x) \ | 71 | #define alloc_bootmem_low_pages(x) \ |
68 | __alloc_bootmem_low((x), PAGE_SIZE, 0) | 72 | __alloc_bootmem_low(x, PAGE_SIZE, 0) |
69 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 73 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
70 | extern unsigned long __init free_all_bootmem (void); | 74 | |
71 | extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); | 75 | extern unsigned long free_all_bootmem(void); |
72 | extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); | 76 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); |
73 | extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); | 77 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, |
74 | extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); | 78 | unsigned long size, |
75 | extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); | 79 | unsigned long align, |
80 | unsigned long goal); | ||
81 | extern unsigned long init_bootmem_node(pg_data_t *pgdat, | ||
82 | unsigned long freepfn, | ||
83 | unsigned long startpfn, | ||
84 | unsigned long endpfn); | ||
85 | extern void reserve_bootmem_node(pg_data_t *pgdat, | ||
86 | unsigned long physaddr, | ||
87 | unsigned long size); | ||
88 | extern void free_bootmem_node(pg_data_t *pgdat, | ||
89 | unsigned long addr, | ||
90 | unsigned long size); | ||
91 | |||
76 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 92 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
77 | #define alloc_bootmem_node(pgdat, x) \ | 93 | #define alloc_bootmem_node(pgdat, x) \ |
78 | __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 94 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
79 | #define alloc_bootmem_pages_node(pgdat, x) \ | 95 | #define alloc_bootmem_pages_node(pgdat, x) \ |
80 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 96 | __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
81 | #define alloc_bootmem_low_pages_node(pgdat, x) \ | 97 | #define alloc_bootmem_low_pages_node(pgdat, x) \ |
82 | __alloc_bootmem_low_node((pgdat), (x), PAGE_SIZE, 0) | 98 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) |
83 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 99 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
84 | 100 | ||
85 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP | 101 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP |
@@ -89,19 +105,19 @@ static inline void *alloc_remap(int nid, unsigned long size) | |||
89 | { | 105 | { |
90 | return NULL; | 106 | return NULL; |
91 | } | 107 | } |
92 | #endif | 108 | #endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ |
93 | 109 | ||
94 | extern unsigned long __meminitdata nr_kernel_pages; | 110 | extern unsigned long __meminitdata nr_kernel_pages; |
95 | extern unsigned long nr_all_pages; | 111 | extern unsigned long nr_all_pages; |
96 | 112 | ||
97 | extern void *__init alloc_large_system_hash(const char *tablename, | 113 | extern void *alloc_large_system_hash(const char *tablename, |
98 | unsigned long bucketsize, | 114 | unsigned long bucketsize, |
99 | unsigned long numentries, | 115 | unsigned long numentries, |
100 | int scale, | 116 | int scale, |
101 | int flags, | 117 | int flags, |
102 | unsigned int *_hash_shift, | 118 | unsigned int *_hash_shift, |
103 | unsigned int *_hash_mask, | 119 | unsigned int *_hash_mask, |
104 | unsigned long limit); | 120 | unsigned long limit); |
105 | 121 | ||
106 | #define HASH_HIGHMEM 0x00000001 /* Consider highmem? */ | 122 | #define HASH_HIGHMEM 0x00000001 /* Consider highmem? */ |
107 | #define HASH_EARLY 0x00000002 /* Allocating during early boot? */ | 123 | #define HASH_EARLY 0x00000002 /* Allocating during early boot? */ |
diff --git a/include/linux/cdev.h b/include/linux/cdev.h index 2216638962d2..ee5f53f2ca15 100644 --- a/include/linux/cdev.h +++ b/include/linux/cdev.h | |||
@@ -23,5 +23,7 @@ void cdev_del(struct cdev *); | |||
23 | 23 | ||
24 | void cd_forget(struct inode *); | 24 | void cd_forget(struct inode *); |
25 | 25 | ||
26 | extern struct backing_dev_info directly_mappable_cdev_bdi; | ||
27 | |||
26 | #endif | 28 | #endif |
27 | #endif | 29 | #endif |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 9b4f11094937..060b96112ec6 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -99,6 +99,11 @@ extern void __chk_io_ptr(void __iomem *); | |||
99 | #define __must_check | 99 | #define __must_check |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | #ifndef CONFIG_ENABLE_MUST_CHECK | ||
103 | #undef __must_check | ||
104 | #define __must_check | ||
105 | #endif | ||
106 | |||
102 | /* | 107 | /* |
103 | * Allow us to avoid 'defined but not used' warnings on functions and data, | 108 | * Allow us to avoid 'defined but not used' warnings on functions and data, |
104 | * as well as force them to be emitted to the assembly file. | 109 | * as well as force them to be emitted to the assembly file. |
diff --git a/include/linux/console.h b/include/linux/console.h index 3bdf2155e565..76a1807726eb 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -120,9 +120,14 @@ extern void console_stop(struct console *); | |||
120 | extern void console_start(struct console *); | 120 | extern void console_start(struct console *); |
121 | extern int is_console_locked(void); | 121 | extern int is_console_locked(void); |
122 | 122 | ||
123 | #ifndef CONFIG_DISABLE_CONSOLE_SUSPEND | ||
123 | /* Suspend and resume console messages over PM events */ | 124 | /* Suspend and resume console messages over PM events */ |
124 | extern void suspend_console(void); | 125 | extern void suspend_console(void); |
125 | extern void resume_console(void); | 126 | extern void resume_console(void); |
127 | #else | ||
128 | static inline void suspend_console(void) {} | ||
129 | static inline void resume_console(void) {} | ||
130 | #endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */ | ||
126 | 131 | ||
127 | /* Some debug stub to catch some of the obvious races in the VT code */ | 132 | /* Some debug stub to catch some of the obvious races in the VT code */ |
128 | #if 1 | 133 | #if 1 |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 8fb344a9abd8..3fef7d67aedc 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -89,4 +89,12 @@ int cpu_down(unsigned int cpu); | |||
89 | static inline int cpu_is_offline(int cpu) { return 0; } | 89 | static inline int cpu_is_offline(int cpu) { return 0; } |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | #ifdef CONFIG_SUSPEND_SMP | ||
93 | extern int disable_nonboot_cpus(void); | ||
94 | extern void enable_nonboot_cpus(void); | ||
95 | #else | ||
96 | static inline int disable_nonboot_cpus(void) { return 0; } | ||
97 | static inline void enable_nonboot_cpus(void) {} | ||
98 | #endif | ||
99 | |||
92 | #endif /* _LINUX_CPU_H_ */ | 100 | #endif /* _LINUX_CPU_H_ */ |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 2d7671c92c0b..d6f4ec467a4b 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -169,6 +169,12 @@ enum { | |||
169 | DCCPO_MAX_CCID_SPECIFIC = 255, | 169 | DCCPO_MAX_CCID_SPECIFIC = 255, |
170 | }; | 170 | }; |
171 | 171 | ||
172 | /* DCCP CCIDS */ | ||
173 | enum { | ||
174 | DCCPC_CCID2 = 2, | ||
175 | DCCPC_CCID3 = 3, | ||
176 | }; | ||
177 | |||
172 | /* DCCP features */ | 178 | /* DCCP features */ |
173 | enum { | 179 | enum { |
174 | DCCPF_RESERVED = 0, | 180 | DCCPF_RESERVED = 0, |
@@ -320,7 +326,7 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
320 | /* initial values for each feature */ | 326 | /* initial values for each feature */ |
321 | #define DCCPF_INITIAL_SEQUENCE_WINDOW 100 | 327 | #define DCCPF_INITIAL_SEQUENCE_WINDOW 100 |
322 | #define DCCPF_INITIAL_ACK_RATIO 2 | 328 | #define DCCPF_INITIAL_ACK_RATIO 2 |
323 | #define DCCPF_INITIAL_CCID 2 | 329 | #define DCCPF_INITIAL_CCID DCCPC_CCID2 |
324 | #define DCCPF_INITIAL_SEND_ACK_VECTOR 1 | 330 | #define DCCPF_INITIAL_SEND_ACK_VECTOR 1 |
325 | /* FIXME: for now we're default to 1 but it should really be 0 */ | 331 | /* FIXME: for now we're default to 1 but it should really be 0 */ |
326 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 | 332 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 |
@@ -404,6 +410,7 @@ struct dccp_service_list { | |||
404 | }; | 410 | }; |
405 | 411 | ||
406 | #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) | 412 | #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) |
413 | #define DCCP_SERVICE_CODE_IS_ABSENT 0 | ||
407 | 414 | ||
408 | static inline int dccp_list_has_service(const struct dccp_service_list *sl, | 415 | static inline int dccp_list_has_service(const struct dccp_service_list *sl, |
409 | const __be32 service) | 416 | const __be32 service) |
@@ -484,11 +491,6 @@ static inline struct dccp_minisock *dccp_msk(const struct sock *sk) | |||
484 | return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock; | 491 | return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock; |
485 | } | 492 | } |
486 | 493 | ||
487 | static inline int dccp_service_not_initialized(const struct sock *sk) | ||
488 | { | ||
489 | return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE; | ||
490 | } | ||
491 | |||
492 | static inline const char *dccp_role(const struct sock *sk) | 494 | static inline const char *dccp_role(const struct sock *sk) |
493 | { | 495 | { |
494 | switch (dccp_sk(sk)->dccps_role) { | 496 | switch (dccp_sk(sk)->dccps_role) { |
diff --git a/include/linux/device.h b/include/linux/device.h index 1e5f30da98bc..662e6a10144e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kobject.h> | 15 | #include <linux/kobject.h> |
16 | #include <linux/klist.h> | 16 | #include <linux/klist.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/compiler.h> | ||
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
20 | #include <linux/pm.h> | 21 | #include <linux/pm.h> |
@@ -51,14 +52,17 @@ struct bus_type { | |||
51 | int (*probe)(struct device * dev); | 52 | int (*probe)(struct device * dev); |
52 | int (*remove)(struct device * dev); | 53 | int (*remove)(struct device * dev); |
53 | void (*shutdown)(struct device * dev); | 54 | void (*shutdown)(struct device * dev); |
54 | int (*suspend)(struct device * dev, pm_message_t state); | 55 | |
55 | int (*resume)(struct device * dev); | 56 | int (*suspend)(struct device * dev, pm_message_t state); |
57 | int (*suspend_late)(struct device * dev, pm_message_t state); | ||
58 | int (*resume_early)(struct device * dev); | ||
59 | int (*resume)(struct device * dev); | ||
56 | }; | 60 | }; |
57 | 61 | ||
58 | extern int bus_register(struct bus_type * bus); | 62 | extern int __must_check bus_register(struct bus_type * bus); |
59 | extern void bus_unregister(struct bus_type * bus); | 63 | extern void bus_unregister(struct bus_type * bus); |
60 | 64 | ||
61 | extern void bus_rescan_devices(struct bus_type * bus); | 65 | extern int __must_check bus_rescan_devices(struct bus_type * bus); |
62 | 66 | ||
63 | /* iterator helpers for buses */ | 67 | /* iterator helpers for buses */ |
64 | 68 | ||
@@ -67,9 +71,9 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, | |||
67 | struct device * bus_find_device(struct bus_type *bus, struct device *start, | 71 | struct device * bus_find_device(struct bus_type *bus, struct device *start, |
68 | void *data, int (*match)(struct device *, void *)); | 72 | void *data, int (*match)(struct device *, void *)); |
69 | 73 | ||
70 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, | 74 | int __must_check bus_for_each_drv(struct bus_type *bus, |
71 | void * data, int (*fn)(struct device_driver *, void *)); | 75 | struct device_driver *start, void *data, |
72 | 76 | int (*fn)(struct device_driver *, void *)); | |
73 | 77 | ||
74 | /* driverfs interface for exporting bus attributes */ | 78 | /* driverfs interface for exporting bus attributes */ |
75 | 79 | ||
@@ -82,7 +86,8 @@ struct bus_attribute { | |||
82 | #define BUS_ATTR(_name,_mode,_show,_store) \ | 86 | #define BUS_ATTR(_name,_mode,_show,_store) \ |
83 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | 87 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) |
84 | 88 | ||
85 | extern int bus_create_file(struct bus_type *, struct bus_attribute *); | 89 | extern int __must_check bus_create_file(struct bus_type *, |
90 | struct bus_attribute *); | ||
86 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | 91 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); |
87 | 92 | ||
88 | struct device_driver { | 93 | struct device_driver { |
@@ -101,16 +106,18 @@ struct device_driver { | |||
101 | void (*shutdown) (struct device * dev); | 106 | void (*shutdown) (struct device * dev); |
102 | int (*suspend) (struct device * dev, pm_message_t state); | 107 | int (*suspend) (struct device * dev, pm_message_t state); |
103 | int (*resume) (struct device * dev); | 108 | int (*resume) (struct device * dev); |
109 | |||
110 | unsigned int multithread_probe:1; | ||
104 | }; | 111 | }; |
105 | 112 | ||
106 | 113 | ||
107 | extern int driver_register(struct device_driver * drv); | 114 | extern int __must_check driver_register(struct device_driver * drv); |
108 | extern void driver_unregister(struct device_driver * drv); | 115 | extern void driver_unregister(struct device_driver * drv); |
109 | 116 | ||
110 | extern struct device_driver * get_driver(struct device_driver * drv); | 117 | extern struct device_driver * get_driver(struct device_driver * drv); |
111 | extern void put_driver(struct device_driver * drv); | 118 | extern void put_driver(struct device_driver * drv); |
112 | extern struct device_driver *driver_find(const char *name, struct bus_type *bus); | 119 | extern struct device_driver *driver_find(const char *name, struct bus_type *bus); |
113 | 120 | extern int driver_probe_done(void); | |
114 | 121 | ||
115 | /* driverfs interface for exporting driver attributes */ | 122 | /* driverfs interface for exporting driver attributes */ |
116 | 123 | ||
@@ -123,16 +130,17 @@ struct driver_attribute { | |||
123 | #define DRIVER_ATTR(_name,_mode,_show,_store) \ | 130 | #define DRIVER_ATTR(_name,_mode,_show,_store) \ |
124 | struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) | 131 | struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) |
125 | 132 | ||
126 | extern int driver_create_file(struct device_driver *, struct driver_attribute *); | 133 | extern int __must_check driver_create_file(struct device_driver *, |
134 | struct driver_attribute *); | ||
127 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); | 135 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); |
128 | 136 | ||
129 | extern int driver_for_each_device(struct device_driver * drv, struct device * start, | 137 | extern int __must_check driver_for_each_device(struct device_driver * drv, |
130 | void * data, int (*fn)(struct device *, void *)); | 138 | struct device *start, void *data, |
139 | int (*fn)(struct device *, void *)); | ||
131 | struct device * driver_find_device(struct device_driver *drv, | 140 | struct device * driver_find_device(struct device_driver *drv, |
132 | struct device *start, void *data, | 141 | struct device *start, void *data, |
133 | int (*match)(struct device *, void *)); | 142 | int (*match)(struct device *, void *)); |
134 | 143 | ||
135 | |||
136 | /* | 144 | /* |
137 | * device classes | 145 | * device classes |
138 | */ | 146 | */ |
@@ -146,17 +154,26 @@ struct class { | |||
146 | struct list_head interfaces; | 154 | struct list_head interfaces; |
147 | struct semaphore sem; /* locks both the children and interfaces lists */ | 155 | struct semaphore sem; /* locks both the children and interfaces lists */ |
148 | 156 | ||
157 | struct kobject *virtual_dir; | ||
158 | |||
149 | struct class_attribute * class_attrs; | 159 | struct class_attribute * class_attrs; |
150 | struct class_device_attribute * class_dev_attrs; | 160 | struct class_device_attribute * class_dev_attrs; |
161 | struct device_attribute * dev_attrs; | ||
151 | 162 | ||
152 | int (*uevent)(struct class_device *dev, char **envp, | 163 | int (*uevent)(struct class_device *dev, char **envp, |
153 | int num_envp, char *buffer, int buffer_size); | 164 | int num_envp, char *buffer, int buffer_size); |
165 | int (*dev_uevent)(struct device *dev, char **envp, int num_envp, | ||
166 | char *buffer, int buffer_size); | ||
154 | 167 | ||
155 | void (*release)(struct class_device *dev); | 168 | void (*release)(struct class_device *dev); |
156 | void (*class_release)(struct class *class); | 169 | void (*class_release)(struct class *class); |
170 | void (*dev_release)(struct device *dev); | ||
171 | |||
172 | int (*suspend)(struct device *, pm_message_t state); | ||
173 | int (*resume)(struct device *); | ||
157 | }; | 174 | }; |
158 | 175 | ||
159 | extern int class_register(struct class *); | 176 | extern int __must_check class_register(struct class *); |
160 | extern void class_unregister(struct class *); | 177 | extern void class_unregister(struct class *); |
161 | 178 | ||
162 | 179 | ||
@@ -169,7 +186,8 @@ struct class_attribute { | |||
169 | #define CLASS_ATTR(_name,_mode,_show,_store) \ | 186 | #define CLASS_ATTR(_name,_mode,_show,_store) \ |
170 | struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) | 187 | struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) |
171 | 188 | ||
172 | extern int class_create_file(struct class *, const struct class_attribute *); | 189 | extern int __must_check class_create_file(struct class *, |
190 | const struct class_attribute *); | ||
173 | extern void class_remove_file(struct class *, const struct class_attribute *); | 191 | extern void class_remove_file(struct class *, const struct class_attribute *); |
174 | 192 | ||
175 | struct class_device_attribute { | 193 | struct class_device_attribute { |
@@ -182,7 +200,7 @@ struct class_device_attribute { | |||
182 | struct class_device_attribute class_device_attr_##_name = \ | 200 | struct class_device_attribute class_device_attr_##_name = \ |
183 | __ATTR(_name,_mode,_show,_store) | 201 | __ATTR(_name,_mode,_show,_store) |
184 | 202 | ||
185 | extern int class_device_create_file(struct class_device *, | 203 | extern int __must_check class_device_create_file(struct class_device *, |
186 | const struct class_device_attribute *); | 204 | const struct class_device_attribute *); |
187 | 205 | ||
188 | /** | 206 | /** |
@@ -242,10 +260,10 @@ class_set_devdata (struct class_device *dev, void *data) | |||
242 | } | 260 | } |
243 | 261 | ||
244 | 262 | ||
245 | extern int class_device_register(struct class_device *); | 263 | extern int __must_check class_device_register(struct class_device *); |
246 | extern void class_device_unregister(struct class_device *); | 264 | extern void class_device_unregister(struct class_device *); |
247 | extern void class_device_initialize(struct class_device *); | 265 | extern void class_device_initialize(struct class_device *); |
248 | extern int class_device_add(struct class_device *); | 266 | extern int __must_check class_device_add(struct class_device *); |
249 | extern void class_device_del(struct class_device *); | 267 | extern void class_device_del(struct class_device *); |
250 | 268 | ||
251 | extern int class_device_rename(struct class_device *, char *); | 269 | extern int class_device_rename(struct class_device *, char *); |
@@ -255,7 +273,7 @@ extern void class_device_put(struct class_device *); | |||
255 | 273 | ||
256 | extern void class_device_remove_file(struct class_device *, | 274 | extern void class_device_remove_file(struct class_device *, |
257 | const struct class_device_attribute *); | 275 | const struct class_device_attribute *); |
258 | extern int class_device_create_bin_file(struct class_device *, | 276 | extern int __must_check class_device_create_bin_file(struct class_device *, |
259 | struct bin_attribute *); | 277 | struct bin_attribute *); |
260 | extern void class_device_remove_bin_file(struct class_device *, | 278 | extern void class_device_remove_bin_file(struct class_device *, |
261 | struct bin_attribute *); | 279 | struct bin_attribute *); |
@@ -266,22 +284,23 @@ struct class_interface { | |||
266 | 284 | ||
267 | int (*add) (struct class_device *, struct class_interface *); | 285 | int (*add) (struct class_device *, struct class_interface *); |
268 | void (*remove) (struct class_device *, struct class_interface *); | 286 | void (*remove) (struct class_device *, struct class_interface *); |
287 | int (*add_dev) (struct device *, struct class_interface *); | ||
288 | void (*remove_dev) (struct device *, struct class_interface *); | ||
269 | }; | 289 | }; |
270 | 290 | ||
271 | extern int class_interface_register(struct class_interface *); | 291 | extern int __must_check class_interface_register(struct class_interface *); |
272 | extern void class_interface_unregister(struct class_interface *); | 292 | extern void class_interface_unregister(struct class_interface *); |
273 | 293 | ||
274 | extern struct class *class_create(struct module *owner, char *name); | 294 | extern struct class *class_create(struct module *owner, const char *name); |
275 | extern void class_destroy(struct class *cls); | 295 | extern void class_destroy(struct class *cls); |
276 | extern struct class_device *class_device_create(struct class *cls, | 296 | extern struct class_device *class_device_create(struct class *cls, |
277 | struct class_device *parent, | 297 | struct class_device *parent, |
278 | dev_t devt, | 298 | dev_t devt, |
279 | struct device *device, | 299 | struct device *device, |
280 | char *fmt, ...) | 300 | const char *fmt, ...) |
281 | __attribute__((format(printf,5,6))); | 301 | __attribute__((format(printf,5,6))); |
282 | extern void class_device_destroy(struct class *cls, dev_t devt); | 302 | extern void class_device_destroy(struct class *cls, dev_t devt); |
283 | 303 | ||
284 | |||
285 | /* interface for exporting device attributes */ | 304 | /* interface for exporting device attributes */ |
286 | struct device_attribute { | 305 | struct device_attribute { |
287 | struct attribute attr; | 306 | struct attribute attr; |
@@ -294,8 +313,13 @@ struct device_attribute { | |||
294 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ | 313 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ |
295 | struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) | 314 | struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) |
296 | 315 | ||
297 | extern int device_create_file(struct device *device, struct device_attribute * entry); | 316 | extern int __must_check device_create_file(struct device *device, |
317 | struct device_attribute * entry); | ||
298 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); | 318 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); |
319 | extern int __must_check device_create_bin_file(struct device *dev, | ||
320 | struct bin_attribute *attr); | ||
321 | extern void device_remove_bin_file(struct device *dev, | ||
322 | struct bin_attribute *attr); | ||
299 | struct device { | 323 | struct device { |
300 | struct klist klist_children; | 324 | struct klist klist_children; |
301 | struct klist_node knode_parent; /* node in sibling list */ | 325 | struct klist_node knode_parent; /* node in sibling list */ |
@@ -305,6 +329,7 @@ struct device { | |||
305 | 329 | ||
306 | struct kobject kobj; | 330 | struct kobject kobj; |
307 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 331 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
332 | unsigned is_registered:1; | ||
308 | struct device_attribute uevent_attr; | 333 | struct device_attribute uevent_attr; |
309 | struct device_attribute *devt_attr; | 334 | struct device_attribute *devt_attr; |
310 | 335 | ||
@@ -338,6 +363,7 @@ struct device { | |||
338 | struct list_head node; | 363 | struct list_head node; |
339 | struct class *class; /* optional*/ | 364 | struct class *class; /* optional*/ |
340 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 365 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
366 | struct attribute_group **groups; /* optional groups */ | ||
341 | 367 | ||
342 | void (*release)(struct device * dev); | 368 | void (*release)(struct device * dev); |
343 | }; | 369 | }; |
@@ -356,38 +382,41 @@ dev_set_drvdata (struct device *dev, void *data) | |||
356 | 382 | ||
357 | static inline int device_is_registered(struct device *dev) | 383 | static inline int device_is_registered(struct device *dev) |
358 | { | 384 | { |
359 | return klist_node_attached(&dev->knode_bus); | 385 | return dev->is_registered; |
360 | } | 386 | } |
361 | 387 | ||
362 | /* | 388 | /* |
363 | * High level routines for use by the bus drivers | 389 | * High level routines for use by the bus drivers |
364 | */ | 390 | */ |
365 | extern int device_register(struct device * dev); | 391 | extern int __must_check device_register(struct device * dev); |
366 | extern void device_unregister(struct device * dev); | 392 | extern void device_unregister(struct device * dev); |
367 | extern void device_initialize(struct device * dev); | 393 | extern void device_initialize(struct device * dev); |
368 | extern int device_add(struct device * dev); | 394 | extern int __must_check device_add(struct device * dev); |
369 | extern void device_del(struct device * dev); | 395 | extern void device_del(struct device * dev); |
370 | extern int device_for_each_child(struct device *, void *, | 396 | extern int __must_check device_for_each_child(struct device *, void *, |
371 | int (*fn)(struct device *, void *)); | 397 | int (*fn)(struct device *, void *)); |
398 | extern int device_rename(struct device *dev, char *new_name); | ||
372 | 399 | ||
373 | /* | 400 | /* |
374 | * Manual binding of a device to driver. See drivers/base/bus.c | 401 | * Manual binding of a device to driver. See drivers/base/bus.c |
375 | * for information on use. | 402 | * for information on use. |
376 | */ | 403 | */ |
377 | extern void device_bind_driver(struct device * dev); | 404 | extern int __must_check device_bind_driver(struct device *dev); |
378 | extern void device_release_driver(struct device * dev); | 405 | extern void device_release_driver(struct device * dev); |
379 | extern int device_attach(struct device * dev); | 406 | extern int __must_check device_attach(struct device * dev); |
380 | extern void driver_attach(struct device_driver * drv); | 407 | extern int __must_check driver_attach(struct device_driver *drv); |
381 | extern void device_reprobe(struct device *dev); | 408 | extern int __must_check device_reprobe(struct device *dev); |
382 | 409 | ||
383 | /* | 410 | /* |
384 | * Easy functions for dynamically creating devices on the fly | 411 | * Easy functions for dynamically creating devices on the fly |
385 | */ | 412 | */ |
386 | extern struct device *device_create(struct class *cls, struct device *parent, | 413 | extern struct device *device_create(struct class *cls, struct device *parent, |
387 | dev_t devt, char *fmt, ...) | 414 | dev_t devt, const char *fmt, ...) |
388 | __attribute__((format(printf,4,5))); | 415 | __attribute__((format(printf,4,5))); |
389 | extern void device_destroy(struct class *cls, dev_t devt); | 416 | extern void device_destroy(struct class *cls, dev_t devt); |
390 | 417 | ||
418 | extern int virtual_device_parent(struct device *dev); | ||
419 | |||
391 | /* | 420 | /* |
392 | * Platform "fixup" functions - allow the platform to have their say | 421 | * Platform "fixup" functions - allow the platform to have their say |
393 | * about devices and actions that the general device layer doesn't | 422 | * about devices and actions that the general device layer doesn't |
@@ -412,7 +441,7 @@ extern void device_shutdown(void); | |||
412 | 441 | ||
413 | 442 | ||
414 | /* drivers/base/firmware.c */ | 443 | /* drivers/base/firmware.c */ |
415 | extern int firmware_register(struct subsystem *); | 444 | extern int __must_check firmware_register(struct subsystem *); |
416 | extern void firmware_unregister(struct subsystem *); | 445 | extern void firmware_unregister(struct subsystem *); |
417 | 446 | ||
418 | /* debugging and troubleshooting/diagnostic helpers. */ | 447 | /* debugging and troubleshooting/diagnostic helpers. */ |
diff --git a/include/linux/edd.h b/include/linux/edd.h index 162512b886f7..b2b3e68aa512 100644 --- a/include/linux/edd.h +++ b/include/linux/edd.h | |||
@@ -52,6 +52,7 @@ | |||
52 | #define EDD_CL_EQUALS 0x3d646465 /* "edd=" */ | 52 | #define EDD_CL_EQUALS 0x3d646465 /* "edd=" */ |
53 | #define EDD_CL_OFF 0x666f /* "of" for off */ | 53 | #define EDD_CL_OFF 0x666f /* "of" for off */ |
54 | #define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */ | 54 | #define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */ |
55 | #define EDD_CL_ON 0x6e6f /* "on" for on */ | ||
55 | 56 | ||
56 | #ifndef __ASSEMBLY__ | 57 | #ifndef __ASSEMBLY__ |
57 | 58 | ||
diff --git a/include/linux/eisa.h b/include/linux/eisa.h index 4079242dced8..1ff7c1392525 100644 --- a/include/linux/eisa.h +++ b/include/linux/eisa.h | |||
@@ -3,8 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/ioport.h> | 4 | #include <linux/ioport.h> |
5 | #include <linux/device.h> | 5 | #include <linux/device.h> |
6 | #include <linux/mod_devicetable.h> | ||
6 | 7 | ||
7 | #define EISA_SIG_LEN 8 | ||
8 | #define EISA_MAX_SLOTS 8 | 8 | #define EISA_MAX_SLOTS 8 |
9 | 9 | ||
10 | #define EISA_MAX_RESOURCES 4 | 10 | #define EISA_MAX_RESOURCES 4 |
@@ -27,12 +27,6 @@ | |||
27 | #define EISA_CONFIG_ENABLED 1 | 27 | #define EISA_CONFIG_ENABLED 1 |
28 | #define EISA_CONFIG_FORCED 2 | 28 | #define EISA_CONFIG_FORCED 2 |
29 | 29 | ||
30 | /* The EISA signature, in ASCII form, null terminated */ | ||
31 | struct eisa_device_id { | ||
32 | char sig[EISA_SIG_LEN]; | ||
33 | unsigned long driver_data; | ||
34 | }; | ||
35 | |||
36 | /* There is not much we can say about an EISA device, apart from | 30 | /* There is not much we can say about an EISA device, apart from |
37 | * signature, slot number, and base address. dma_mask is set by | 31 | * signature, slot number, and base address. dma_mask is set by |
38 | * default to parent device mask..*/ | 32 | * default to parent device mask..*/ |
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h index 6a5796c81c90..666e0a5f00fc 100644 --- a/include/linux/elf-em.h +++ b/include/linux/elf-em.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #define EM_M32R 88 /* Renesas M32R */ | 31 | #define EM_M32R 88 /* Renesas M32R */ |
32 | #define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ | 32 | #define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ |
33 | #define EM_FRV 0x5441 /* Fujitsu FR-V */ | 33 | #define EM_FRV 0x5441 /* Fujitsu FR-V */ |
34 | #define EM_AVR32 0x18ad /* Atmel AVR32 */ | ||
34 | 35 | ||
35 | /* | 36 | /* |
36 | * This is an interim value that we will use until the committee comes | 37 | * This is an interim value that we will use until the committee comes |
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h new file mode 100644 index 000000000000..67396db141e8 --- /dev/null +++ b/include/linux/elfnote.h | |||
@@ -0,0 +1,90 @@ | |||
1 | #ifndef _LINUX_ELFNOTE_H | ||
2 | #define _LINUX_ELFNOTE_H | ||
3 | /* | ||
4 | * Helper macros to generate ELF Note structures, which are put into a | ||
5 | * PT_NOTE segment of the final vmlinux image. These are useful for | ||
6 | * including name-value pairs of metadata into the kernel binary (or | ||
7 | * modules?) for use by external programs. | ||
8 | * | ||
9 | * Each note has three parts: a name, a type and a desc. The name is | ||
10 | * intended to distinguish the note's originator, so it would be a | ||
11 | * company, project, subsystem, etc; it must be in a suitable form for | ||
12 | * use in a section name. The type is an integer which is used to tag | ||
13 | * the data, and is considered to be within the "name" namespace (so | ||
14 | * "FooCo"'s type 42 is distinct from "BarProj"'s type 42). The | ||
15 | * "desc" field is the actual data. There are no constraints on the | ||
16 | * desc field's contents, though typically they're fairly small. | ||
17 | * | ||
18 | * All notes from a given NAME are put into a section named | ||
19 | * .note.NAME. When the kernel image is finally linked, all the notes | ||
20 | * are packed into a single .notes section, which is mapped into the | ||
21 | * PT_NOTE segment. Because notes for a given name are grouped into | ||
22 | * the same section, they'll all be adjacent the output file. | ||
23 | * | ||
24 | * This file defines macros for both C and assembler use. Their | ||
25 | * syntax is slightly different, but they're semantically similar. | ||
26 | * | ||
27 | * See the ELF specification for more detail about ELF notes. | ||
28 | */ | ||
29 | |||
30 | #ifdef __ASSEMBLER__ | ||
31 | /* | ||
32 | * Generate a structure with the same shape as Elf{32,64}_Nhdr (which | ||
33 | * turn out to be the same size and shape), followed by the name and | ||
34 | * desc data with appropriate padding. The 'desctype' argument is the | ||
35 | * assembler pseudo op defining the type of the data e.g. .asciz while | ||
36 | * 'descdata' is the data itself e.g. "hello, world". | ||
37 | * | ||
38 | * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two") | ||
39 | * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef) | ||
40 | */ | ||
41 | #define ELFNOTE(name, type, desctype, descdata) \ | ||
42 | .pushsection .note.name ; \ | ||
43 | .align 4 ; \ | ||
44 | .long 2f - 1f /* namesz */ ; \ | ||
45 | .long 4f - 3f /* descsz */ ; \ | ||
46 | .long type ; \ | ||
47 | 1:.asciz "name" ; \ | ||
48 | 2:.align 4 ; \ | ||
49 | 3:desctype descdata ; \ | ||
50 | 4:.align 4 ; \ | ||
51 | .popsection ; | ||
52 | #else /* !__ASSEMBLER__ */ | ||
53 | #include <linux/elf.h> | ||
54 | /* | ||
55 | * Use an anonymous structure which matches the shape of | ||
56 | * Elf{32,64}_Nhdr, but includes the name and desc data. The size and | ||
57 | * type of name and desc depend on the macro arguments. "name" must | ||
58 | * be a literal string, and "desc" must be passed by value. You may | ||
59 | * only define one note per line, since __LINE__ is used to generate | ||
60 | * unique symbols. | ||
61 | */ | ||
62 | #define _ELFNOTE_PASTE(a,b) a##b | ||
63 | #define _ELFNOTE(size, name, unique, type, desc) \ | ||
64 | static const struct { \ | ||
65 | struct elf##size##_note _nhdr; \ | ||
66 | unsigned char _name[sizeof(name)] \ | ||
67 | __attribute__((aligned(sizeof(Elf##size##_Word)))); \ | ||
68 | typeof(desc) _desc \ | ||
69 | __attribute__((aligned(sizeof(Elf##size##_Word)))); \ | ||
70 | } _ELFNOTE_PASTE(_note_, unique) \ | ||
71 | __attribute_used__ \ | ||
72 | __attribute__((section(".note." name), \ | ||
73 | aligned(sizeof(Elf##size##_Word)), \ | ||
74 | unused)) = { \ | ||
75 | { \ | ||
76 | sizeof(name), \ | ||
77 | sizeof(desc), \ | ||
78 | type, \ | ||
79 | }, \ | ||
80 | name, \ | ||
81 | desc \ | ||
82 | } | ||
83 | #define ELFNOTE(size, name, type, desc) \ | ||
84 | _ELFNOTE(size, name, __LINE__, type, desc) | ||
85 | |||
86 | #define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc) | ||
87 | #define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc) | ||
88 | #endif /* __ASSEMBLER__ */ | ||
89 | |||
90 | #endif /* _LINUX_ELFNOTE_H */ | ||
diff --git a/include/linux/err.h b/include/linux/err.h index cd3b367f7445..1ab1d44f8d3b 100644 --- a/include/linux/err.h +++ b/include/linux/err.h | |||
@@ -15,6 +15,8 @@ | |||
15 | */ | 15 | */ |
16 | #define MAX_ERRNO 4095 | 16 | #define MAX_ERRNO 4095 |
17 | 17 | ||
18 | #ifndef __ASSEMBLY__ | ||
19 | |||
18 | #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | 20 | #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) |
19 | 21 | ||
20 | static inline void *ERR_PTR(long error) | 22 | static inline void *ERR_PTR(long error) |
@@ -32,4 +34,6 @@ static inline long IS_ERR(const void *ptr) | |||
32 | return IS_ERR_VALUE((unsigned long)ptr); | 34 | return IS_ERR_VALUE((unsigned long)ptr); |
33 | } | 35 | } |
34 | 36 | ||
37 | #endif | ||
38 | |||
35 | #endif /* _LINUX_ERR_H */ | 39 | #endif /* _LINUX_ERR_H */ |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 0eed918b3816..cc08f56750da 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -460,7 +460,7 @@ struct ext3_super_block { | |||
460 | */ | 460 | */ |
461 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ | 461 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ |
462 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ | 462 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ |
463 | __u16 s_reserved_gdt_blocks; /* Per group desc for online growth */ | 463 | __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */ |
464 | /* | 464 | /* |
465 | * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. | 465 | * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. |
466 | */ | 466 | */ |
@@ -473,7 +473,7 @@ struct ext3_super_block { | |||
473 | __u8 s_reserved_char_pad; | 473 | __u8 s_reserved_char_pad; |
474 | __u16 s_reserved_word_pad; | 474 | __u16 s_reserved_word_pad; |
475 | __le32 s_default_mount_opts; | 475 | __le32 s_default_mount_opts; |
476 | __le32 s_first_meta_bg; /* First metablock block group */ | 476 | __le32 s_first_meta_bg; /* First metablock block group */ |
477 | __u32 s_reserved[190]; /* Padding to the end of the block */ | 477 | __u32 s_reserved[190]; /* Padding to the end of the block */ |
478 | }; | 478 | }; |
479 | 479 | ||
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h index 2f18b9511f21..4395e5206746 100644 --- a/include/linux/ext3_fs_i.h +++ b/include/linux/ext3_fs_i.h | |||
@@ -35,7 +35,7 @@ struct ext3_reserve_window { | |||
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct ext3_reserve_window_node { | 37 | struct ext3_reserve_window_node { |
38 | struct rb_node rsv_node; | 38 | struct rb_node rsv_node; |
39 | __u32 rsv_goal_size; | 39 | __u32 rsv_goal_size; |
40 | __u32 rsv_alloc_hit; | 40 | __u32 rsv_alloc_hit; |
41 | struct ext3_reserve_window rsv_window; | 41 | struct ext3_reserve_window rsv_window; |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index c8307c02dd07..ce0e6109aff0 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | /* Define the number of blocks we need to account to a transaction to | 24 | /* Define the number of blocks we need to account to a transaction to |
25 | * modify one block of data. | 25 | * modify one block of data. |
26 | * | 26 | * |
27 | * We may have to touch one inode, one bitmap buffer, up to three | 27 | * We may have to touch one inode, one bitmap buffer, up to three |
28 | * indirection blocks, the group and superblock summaries, and the data | 28 | * indirection blocks, the group and superblock summaries, and the data |
29 | * block to complete the transaction. */ | 29 | * block to complete the transaction. */ |
@@ -88,16 +88,16 @@ | |||
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | int | 90 | int |
91 | ext3_mark_iloc_dirty(handle_t *handle, | 91 | ext3_mark_iloc_dirty(handle_t *handle, |
92 | struct inode *inode, | 92 | struct inode *inode, |
93 | struct ext3_iloc *iloc); | 93 | struct ext3_iloc *iloc); |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * On success, We end up with an outstanding reference count against | 96 | * On success, We end up with an outstanding reference count against |
97 | * iloc->bh. This _must_ be cleaned up later. | 97 | * iloc->bh. This _must_ be cleaned up later. |
98 | */ | 98 | */ |
99 | 99 | ||
100 | int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, | 100 | int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, |
101 | struct ext3_iloc *iloc); | 101 | struct ext3_iloc *iloc); |
102 | 102 | ||
103 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); | 103 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 1d3e601ece73..8f74dfbb2edd 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -512,7 +512,6 @@ struct inode { | |||
512 | struct timespec i_mtime; | 512 | struct timespec i_mtime; |
513 | struct timespec i_ctime; | 513 | struct timespec i_ctime; |
514 | unsigned int i_blkbits; | 514 | unsigned int i_blkbits; |
515 | unsigned long i_blksize; | ||
516 | unsigned long i_version; | 515 | unsigned long i_version; |
517 | blkcnt_t i_blocks; | 516 | blkcnt_t i_blocks; |
518 | unsigned short i_bytes; | 517 | unsigned short i_bytes; |
@@ -528,11 +527,12 @@ struct inode { | |||
528 | #ifdef CONFIG_QUOTA | 527 | #ifdef CONFIG_QUOTA |
529 | struct dquot *i_dquot[MAXQUOTAS]; | 528 | struct dquot *i_dquot[MAXQUOTAS]; |
530 | #endif | 529 | #endif |
531 | /* These three should probably be a union */ | ||
532 | struct list_head i_devices; | 530 | struct list_head i_devices; |
533 | struct pipe_inode_info *i_pipe; | 531 | union { |
534 | struct block_device *i_bdev; | 532 | struct pipe_inode_info *i_pipe; |
535 | struct cdev *i_cdev; | 533 | struct block_device *i_bdev; |
534 | struct cdev *i_cdev; | ||
535 | }; | ||
536 | int i_cindex; | 536 | int i_cindex; |
537 | 537 | ||
538 | __u32 i_generation; | 538 | __u32 i_generation; |
@@ -554,9 +554,7 @@ struct inode { | |||
554 | 554 | ||
555 | atomic_t i_writecount; | 555 | atomic_t i_writecount; |
556 | void *i_security; | 556 | void *i_security; |
557 | union { | 557 | void *i_private; /* fs or device private pointer */ |
558 | void *generic_ip; | ||
559 | } u; | ||
560 | #ifdef __NEED_I_SIZE_ORDERED | 558 | #ifdef __NEED_I_SIZE_ORDERED |
561 | seqcount_t i_size_seqcount; | 559 | seqcount_t i_size_seqcount; |
562 | #endif | 560 | #endif |
diff --git a/include/linux/getcpu.h b/include/linux/getcpu.h new file mode 100644 index 000000000000..031ed3780e45 --- /dev/null +++ b/include/linux/getcpu.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _LINUX_GETCPU_H | ||
2 | #define _LINUX_GETCPU_H 1 | ||
3 | |||
4 | /* Cache for getcpu() to speed it up. Results might be upto a jiffie | ||
5 | out of date, but will be faster. | ||
6 | User programs should not refer to the contents of this structure. | ||
7 | It is only a cache for vgetcpu(). It might change in future kernels. | ||
8 | The user program must store this information per thread (__thread) | ||
9 | If you want 100% accurate information pass NULL instead. */ | ||
10 | struct getcpu_cache { | ||
11 | unsigned long t0; | ||
12 | unsigned long t1; | ||
13 | unsigned long res[4]; | ||
14 | }; | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index cc9e60844484..bf2b6bc3f6fd 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -9,17 +9,16 @@ struct vm_area_struct; | |||
9 | 9 | ||
10 | /* | 10 | /* |
11 | * GFP bitmasks.. | 11 | * GFP bitmasks.. |
12 | * | ||
13 | * Zone modifiers (see linux/mmzone.h - low three bits) | ||
14 | * | ||
15 | * Do not put any conditional on these. If necessary modify the definitions | ||
16 | * without the underscores and use the consistently. The definitions here may | ||
17 | * be used in bit comparisons. | ||
12 | */ | 18 | */ |
13 | /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */ | ||
14 | #define __GFP_DMA ((__force gfp_t)0x01u) | 19 | #define __GFP_DMA ((__force gfp_t)0x01u) |
15 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) | 20 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) |
16 | #ifdef CONFIG_DMA_IS_DMA32 | 21 | #define __GFP_DMA32 ((__force gfp_t)0x04u) |
17 | #define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */ | ||
18 | #elif BITS_PER_LONG < 64 | ||
19 | #define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */ | ||
20 | #else | ||
21 | #define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */ | ||
22 | #endif | ||
23 | 22 | ||
24 | /* | 23 | /* |
25 | * Action modifiers - doesn't change the zoning | 24 | * Action modifiers - doesn't change the zoning |
@@ -46,6 +45,7 @@ struct vm_area_struct; | |||
46 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ | 45 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ |
47 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ | 46 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ |
48 | #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ | 47 | #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ |
48 | #define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ | ||
49 | 49 | ||
50 | #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ | 50 | #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ |
51 | #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) | 51 | #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) |
@@ -54,7 +54,7 @@ struct vm_area_struct; | |||
54 | #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ | 54 | #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ |
55 | __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ | 55 | __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ |
56 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ | 56 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ |
57 | __GFP_NOMEMALLOC|__GFP_HARDWALL) | 57 | __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE) |
58 | 58 | ||
59 | /* This equals 0, but use constants in case they ever change */ | 59 | /* This equals 0, but use constants in case they ever change */ |
60 | #define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) | 60 | #define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) |
@@ -67,6 +67,13 @@ struct vm_area_struct; | |||
67 | #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ | 67 | #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ |
68 | __GFP_HIGHMEM) | 68 | __GFP_HIGHMEM) |
69 | 69 | ||
70 | #ifdef CONFIG_NUMA | ||
71 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) | ||
72 | #else | ||
73 | #define GFP_THISNODE 0 | ||
74 | #endif | ||
75 | |||
76 | |||
70 | /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some | 77 | /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some |
71 | platforms, used as appropriate on others */ | 78 | platforms, used as appropriate on others */ |
72 | 79 | ||
@@ -76,11 +83,19 @@ struct vm_area_struct; | |||
76 | #define GFP_DMA32 __GFP_DMA32 | 83 | #define GFP_DMA32 __GFP_DMA32 |
77 | 84 | ||
78 | 85 | ||
79 | static inline int gfp_zone(gfp_t gfp) | 86 | static inline enum zone_type gfp_zone(gfp_t flags) |
80 | { | 87 | { |
81 | int zone = GFP_ZONEMASK & (__force int) gfp; | 88 | if (flags & __GFP_DMA) |
82 | BUG_ON(zone >= GFP_ZONETYPES); | 89 | return ZONE_DMA; |
83 | return zone; | 90 | #ifdef CONFIG_ZONE_DMA32 |
91 | if (flags & __GFP_DMA32) | ||
92 | return ZONE_DMA32; | ||
93 | #endif | ||
94 | #ifdef CONFIG_HIGHMEM | ||
95 | if (flags & __GFP_HIGHMEM) | ||
96 | return ZONE_HIGHMEM; | ||
97 | #endif | ||
98 | return ZONE_NORMAL; | ||
84 | } | 99 | } |
85 | 100 | ||
86 | /* | 101 | /* |
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h index d5ebbb29aeae..d4b333938f73 100644 --- a/include/linux/hdlc.h +++ b/include/linux/hdlc.h | |||
@@ -11,95 +11,46 @@ | |||
11 | #ifndef __HDLC_H | 11 | #ifndef __HDLC_H |
12 | #define __HDLC_H | 12 | #define __HDLC_H |
13 | 13 | ||
14 | #define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ | ||
15 | |||
16 | #define CLOCK_DEFAULT 0 /* Default setting */ | ||
17 | #define CLOCK_EXT 1 /* External TX and RX clock - DTE */ | ||
18 | #define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ | ||
19 | #define CLOCK_TXINT 3 /* Internal TX and external RX clock */ | ||
20 | #define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ | ||
21 | |||
22 | |||
23 | #define ENCODING_DEFAULT 0 /* Default setting */ | ||
24 | #define ENCODING_NRZ 1 | ||
25 | #define ENCODING_NRZI 2 | ||
26 | #define ENCODING_FM_MARK 3 | ||
27 | #define ENCODING_FM_SPACE 4 | ||
28 | #define ENCODING_MANCHESTER 5 | ||
29 | |||
30 | |||
31 | #define PARITY_DEFAULT 0 /* Default setting */ | ||
32 | #define PARITY_NONE 1 /* No parity */ | ||
33 | #define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ | ||
34 | #define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ | ||
35 | #define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ | ||
36 | #define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ | ||
37 | #define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ | ||
38 | #define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ | ||
39 | |||
40 | #define LMI_DEFAULT 0 /* Default setting */ | ||
41 | #define LMI_NONE 1 /* No LMI, all PVCs are static */ | ||
42 | #define LMI_ANSI 2 /* ANSI Annex D */ | ||
43 | #define LMI_CCITT 3 /* ITU-T Annex A */ | ||
44 | #define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ | ||
45 | 14 | ||
46 | #define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ | 15 | #define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ |
16 | #if 0 | ||
47 | #define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ | 17 | #define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ |
18 | #else | ||
19 | #define HDLC_MAX_MRU 1600 /* as required for FR network */ | ||
20 | #endif | ||
48 | 21 | ||
49 | 22 | ||
50 | #ifdef __KERNEL__ | 23 | #ifdef __KERNEL__ |
51 | 24 | ||
52 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
53 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
54 | #include <net/syncppp.h> | ||
55 | #include <linux/hdlc/ioctl.h> | 27 | #include <linux/hdlc/ioctl.h> |
56 | 28 | ||
57 | 29 | ||
58 | typedef struct { /* Used in Cisco and PPP mode */ | 30 | /* Used by all network devices here, pointed to by netdev_priv(dev) */ |
59 | u8 address; | 31 | struct hdlc_device_desc { |
60 | u8 control; | 32 | int (*netif_rx)(struct sk_buff *skb); |
61 | u16 protocol; | ||
62 | }__attribute__ ((packed)) hdlc_header; | ||
63 | |||
64 | |||
65 | |||
66 | typedef struct { | ||
67 | u32 type; /* code */ | ||
68 | u32 par1; | ||
69 | u32 par2; | ||
70 | u16 rel; /* reliability */ | ||
71 | u32 time; | ||
72 | }__attribute__ ((packed)) cisco_packet; | ||
73 | #define CISCO_PACKET_LEN 18 | ||
74 | #define CISCO_BIG_PACKET_LEN 20 | ||
75 | |||
76 | |||
77 | |||
78 | typedef struct pvc_device_struct { | ||
79 | struct net_device *master; | ||
80 | struct net_device *main; | ||
81 | struct net_device *ether; /* bridged Ethernet interface */ | ||
82 | struct pvc_device_struct *next; /* Sorted in ascending DLCI order */ | ||
83 | int dlci; | ||
84 | int open_count; | ||
85 | |||
86 | struct { | ||
87 | unsigned int new: 1; | ||
88 | unsigned int active: 1; | ||
89 | unsigned int exist: 1; | ||
90 | unsigned int deleted: 1; | ||
91 | unsigned int fecn: 1; | ||
92 | unsigned int becn: 1; | ||
93 | unsigned int bandwidth; /* Cisco LMI reporting only */ | ||
94 | }state; | ||
95 | }pvc_device; | ||
96 | |||
97 | |||
98 | |||
99 | typedef struct hdlc_device_struct { | ||
100 | /* To be initialized by hardware driver */ | ||
101 | struct net_device_stats stats; | 33 | struct net_device_stats stats; |
102 | 34 | }; | |
35 | |||
36 | /* This structure is a private property of HDLC protocols. | ||
37 | Hardware drivers have no interest here */ | ||
38 | |||
39 | struct hdlc_proto { | ||
40 | int (*open)(struct net_device *dev); | ||
41 | void (*close)(struct net_device *dev); | ||
42 | void (*start)(struct net_device *dev); /* if open & DCD */ | ||
43 | void (*stop)(struct net_device *dev); /* if open & !DCD */ | ||
44 | void (*detach)(struct net_device *dev); | ||
45 | int (*ioctl)(struct net_device *dev, struct ifreq *ifr); | ||
46 | unsigned short (*type_trans)(struct sk_buff *skb, | ||
47 | struct net_device *dev); | ||
48 | struct module *module; | ||
49 | struct hdlc_proto *next; /* next protocol in the list */ | ||
50 | }; | ||
51 | |||
52 | |||
53 | typedef struct hdlc_device { | ||
103 | /* used by HDLC layer to take control over HDLC device from hw driver*/ | 54 | /* used by HDLC layer to take control over HDLC device from hw driver*/ |
104 | int (*attach)(struct net_device *dev, | 55 | int (*attach)(struct net_device *dev, |
105 | unsigned short encoding, unsigned short parity); | 56 | unsigned short encoding, unsigned short parity); |
@@ -107,82 +58,18 @@ typedef struct hdlc_device_struct { | |||
107 | /* hardware driver must handle this instead of dev->hard_start_xmit */ | 58 | /* hardware driver must handle this instead of dev->hard_start_xmit */ |
108 | int (*xmit)(struct sk_buff *skb, struct net_device *dev); | 59 | int (*xmit)(struct sk_buff *skb, struct net_device *dev); |
109 | 60 | ||
110 | |||
111 | /* Things below are for HDLC layer internal use only */ | 61 | /* Things below are for HDLC layer internal use only */ |
112 | struct { | 62 | const struct hdlc_proto *proto; |
113 | int (*open)(struct net_device *dev); | ||
114 | void (*close)(struct net_device *dev); | ||
115 | |||
116 | /* if open & DCD */ | ||
117 | void (*start)(struct net_device *dev); | ||
118 | /* if open & !DCD */ | ||
119 | void (*stop)(struct net_device *dev); | ||
120 | |||
121 | void (*detach)(struct hdlc_device_struct *hdlc); | ||
122 | int (*netif_rx)(struct sk_buff *skb); | ||
123 | unsigned short (*type_trans)(struct sk_buff *skb, | ||
124 | struct net_device *dev); | ||
125 | int id; /* IF_PROTO_HDLC/CISCO/FR/etc. */ | ||
126 | }proto; | ||
127 | |||
128 | int carrier; | 63 | int carrier; |
129 | int open; | 64 | int open; |
130 | spinlock_t state_lock; | 65 | spinlock_t state_lock; |
131 | 66 | void *state; | |
132 | union { | ||
133 | struct { | ||
134 | fr_proto settings; | ||
135 | pvc_device *first_pvc; | ||
136 | int dce_pvc_count; | ||
137 | |||
138 | struct timer_list timer; | ||
139 | unsigned long last_poll; | ||
140 | int reliable; | ||
141 | int dce_changed; | ||
142 | int request; | ||
143 | int fullrep_sent; | ||
144 | u32 last_errors; /* last errors bit list */ | ||
145 | u8 n391cnt; | ||
146 | u8 txseq; /* TX sequence number */ | ||
147 | u8 rxseq; /* RX sequence number */ | ||
148 | }fr; | ||
149 | |||
150 | struct { | ||
151 | cisco_proto settings; | ||
152 | |||
153 | struct timer_list timer; | ||
154 | unsigned long last_poll; | ||
155 | int up; | ||
156 | int request_sent; | ||
157 | u32 txseq; /* TX sequence number */ | ||
158 | u32 rxseq; /* RX sequence number */ | ||
159 | }cisco; | ||
160 | |||
161 | struct { | ||
162 | raw_hdlc_proto settings; | ||
163 | }raw_hdlc; | ||
164 | |||
165 | struct { | ||
166 | struct ppp_device pppdev; | ||
167 | struct ppp_device *syncppp_ptr; | ||
168 | int (*old_change_mtu)(struct net_device *dev, | ||
169 | int new_mtu); | ||
170 | }ppp; | ||
171 | }state; | ||
172 | void *priv; | 67 | void *priv; |
173 | }hdlc_device; | 68 | }hdlc_device; |
174 | 69 | ||
175 | 70 | ||
176 | 71 | ||
177 | int hdlc_raw_ioctl(struct net_device *dev, struct ifreq *ifr); | 72 | /* Exported from hdlc module */ |
178 | int hdlc_raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr); | ||
179 | int hdlc_cisco_ioctl(struct net_device *dev, struct ifreq *ifr); | ||
180 | int hdlc_ppp_ioctl(struct net_device *dev, struct ifreq *ifr); | ||
181 | int hdlc_fr_ioctl(struct net_device *dev, struct ifreq *ifr); | ||
182 | int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr); | ||
183 | |||
184 | |||
185 | /* Exported from hdlc.o */ | ||
186 | 73 | ||
187 | /* Called by hardware driver when a user requests HDLC service */ | 74 | /* Called by hardware driver when a user requests HDLC service */ |
188 | int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | 75 | int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); |
@@ -191,17 +78,21 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | |||
191 | #define register_hdlc_device(dev) register_netdev(dev) | 78 | #define register_hdlc_device(dev) register_netdev(dev) |
192 | void unregister_hdlc_device(struct net_device *dev); | 79 | void unregister_hdlc_device(struct net_device *dev); |
193 | 80 | ||
81 | |||
82 | void register_hdlc_protocol(struct hdlc_proto *proto); | ||
83 | void unregister_hdlc_protocol(struct hdlc_proto *proto); | ||
84 | |||
194 | struct net_device *alloc_hdlcdev(void *priv); | 85 | struct net_device *alloc_hdlcdev(void *priv); |
195 | 86 | ||
196 | static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev) | 87 | |
88 | static __inline__ struct hdlc_device_desc* dev_to_desc(struct net_device *dev) | ||
197 | { | 89 | { |
198 | return netdev_priv(dev); | 90 | return netdev_priv(dev); |
199 | } | 91 | } |
200 | 92 | ||
201 | 93 | static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev) | |
202 | static __inline__ pvc_device* dev_to_pvc(struct net_device *dev) | ||
203 | { | 94 | { |
204 | return (pvc_device*)dev->priv; | 95 | return netdev_priv(dev) + sizeof(struct hdlc_device_desc); |
205 | } | 96 | } |
206 | 97 | ||
207 | 98 | ||
@@ -225,18 +116,14 @@ int hdlc_open(struct net_device *dev); | |||
225 | /* Must be called by hardware driver when HDLC device is being closed */ | 116 | /* Must be called by hardware driver when HDLC device is being closed */ |
226 | void hdlc_close(struct net_device *dev); | 117 | void hdlc_close(struct net_device *dev); |
227 | 118 | ||
119 | int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, | ||
120 | int (*rx)(struct sk_buff *skb), size_t size); | ||
228 | /* May be used by hardware driver to gain control over HDLC device */ | 121 | /* May be used by hardware driver to gain control over HDLC device */ |
229 | static __inline__ void hdlc_proto_detach(hdlc_device *hdlc) | 122 | void detach_hdlc_protocol(struct net_device *dev); |
230 | { | ||
231 | if (hdlc->proto.detach) | ||
232 | hdlc->proto.detach(hdlc); | ||
233 | hdlc->proto.detach = NULL; | ||
234 | } | ||
235 | |||
236 | 123 | ||
237 | static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) | 124 | static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) |
238 | { | 125 | { |
239 | return &dev_to_hdlc(dev)->stats; | 126 | return &dev_to_desc(dev)->stats; |
240 | } | 127 | } |
241 | 128 | ||
242 | 129 | ||
@@ -248,8 +135,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, | |||
248 | skb->mac.raw = skb->data; | 135 | skb->mac.raw = skb->data; |
249 | skb->dev = dev; | 136 | skb->dev = dev; |
250 | 137 | ||
251 | if (hdlc->proto.type_trans) | 138 | if (hdlc->proto->type_trans) |
252 | return hdlc->proto.type_trans(skb, dev); | 139 | return hdlc->proto->type_trans(skb, dev); |
253 | else | 140 | else |
254 | return htons(ETH_P_HDLC); | 141 | return htons(ETH_P_HDLC); |
255 | } | 142 | } |
diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h index 78430ba3ea69..583972364357 100644 --- a/include/linux/hdlc/ioctl.h +++ b/include/linux/hdlc/ioctl.h | |||
@@ -1,6 +1,39 @@ | |||
1 | #ifndef __HDLC_IOCTL_H__ | 1 | #ifndef __HDLC_IOCTL_H__ |
2 | #define __HDLC_IOCTL_H__ | 2 | #define __HDLC_IOCTL_H__ |
3 | 3 | ||
4 | |||
5 | #define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ | ||
6 | |||
7 | #define CLOCK_DEFAULT 0 /* Default setting */ | ||
8 | #define CLOCK_EXT 1 /* External TX and RX clock - DTE */ | ||
9 | #define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ | ||
10 | #define CLOCK_TXINT 3 /* Internal TX and external RX clock */ | ||
11 | #define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ | ||
12 | |||
13 | |||
14 | #define ENCODING_DEFAULT 0 /* Default setting */ | ||
15 | #define ENCODING_NRZ 1 | ||
16 | #define ENCODING_NRZI 2 | ||
17 | #define ENCODING_FM_MARK 3 | ||
18 | #define ENCODING_FM_SPACE 4 | ||
19 | #define ENCODING_MANCHESTER 5 | ||
20 | |||
21 | |||
22 | #define PARITY_DEFAULT 0 /* Default setting */ | ||
23 | #define PARITY_NONE 1 /* No parity */ | ||
24 | #define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ | ||
25 | #define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ | ||
26 | #define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ | ||
27 | #define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ | ||
28 | #define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ | ||
29 | #define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ | ||
30 | |||
31 | #define LMI_DEFAULT 0 /* Default setting */ | ||
32 | #define LMI_NONE 1 /* No LMI, all PVCs are static */ | ||
33 | #define LMI_ANSI 2 /* ANSI Annex D */ | ||
34 | #define LMI_CCITT 3 /* ITU-T Annex A */ | ||
35 | #define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ | ||
36 | |||
4 | typedef struct { | 37 | typedef struct { |
5 | unsigned int clock_rate; /* bits per second */ | 38 | unsigned int clock_rate; /* bits per second */ |
6 | unsigned int clock_type; /* internal, external, TX-internal etc. */ | 39 | unsigned int clock_type; /* internal, external, TX-internal etc. */ |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 85ce7ef9a512..fd7d12daa94f 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -24,11 +24,15 @@ static inline void flush_kernel_dcache_page(struct page *page) | |||
24 | 24 | ||
25 | /* declarations for linux/mm/highmem.c */ | 25 | /* declarations for linux/mm/highmem.c */ |
26 | unsigned int nr_free_highpages(void); | 26 | unsigned int nr_free_highpages(void); |
27 | extern unsigned long totalhigh_pages; | ||
27 | 28 | ||
28 | #else /* CONFIG_HIGHMEM */ | 29 | #else /* CONFIG_HIGHMEM */ |
29 | 30 | ||
30 | static inline unsigned int nr_free_highpages(void) { return 0; } | 31 | static inline unsigned int nr_free_highpages(void) { return 0; } |
31 | 32 | ||
33 | #define totalhigh_pages 0 | ||
34 | |||
35 | #ifndef ARCH_HAS_KMAP | ||
32 | static inline void *kmap(struct page *page) | 36 | static inline void *kmap(struct page *page) |
33 | { | 37 | { |
34 | might_sleep(); | 38 | might_sleep(); |
@@ -41,6 +45,7 @@ static inline void *kmap(struct page *page) | |||
41 | #define kunmap_atomic(addr, idx) do { } while (0) | 45 | #define kunmap_atomic(addr, idx) do { } while (0) |
42 | #define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) | 46 | #define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) |
43 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) | 47 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) |
48 | #endif | ||
44 | 49 | ||
45 | #endif /* CONFIG_HIGHMEM */ | 50 | #endif /* CONFIG_HIGHMEM */ |
46 | 51 | ||
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h index c0e7fab28ce3..c8f8df25c7e0 100644 --- a/include/linux/i2c-algo-bit.h +++ b/include/linux/i2c-algo-bit.h | |||
@@ -40,7 +40,6 @@ struct i2c_algo_bit_data { | |||
40 | /* local settings */ | 40 | /* local settings */ |
41 | int udelay; /* half-clock-cycle time in microsecs */ | 41 | int udelay; /* half-clock-cycle time in microsecs */ |
42 | /* i.e. clock is (500 / udelay) KHz */ | 42 | /* i.e. clock is (500 / udelay) KHz */ |
43 | int mdelay; /* in millisecs, unused */ | ||
44 | int timeout; /* in jiffies */ | 43 | int timeout; /* in jiffies */ |
45 | }; | 44 | }; |
46 | 45 | ||
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h index 18b0adf57a3d..9908f3fc4839 100644 --- a/include/linux/i2c-algo-pcf.h +++ b/include/linux/i2c-algo-pcf.h | |||
@@ -35,7 +35,6 @@ struct i2c_algo_pcf_data { | |||
35 | 35 | ||
36 | /* local settings */ | 36 | /* local settings */ |
37 | int udelay; | 37 | int udelay; |
38 | int mdelay; | ||
39 | int timeout; | 38 | int timeout; |
40 | }; | 39 | }; |
41 | 40 | ||
diff --git a/include/linux/i2c-algo-sibyte.h b/include/linux/i2c-algo-sibyte.h deleted file mode 100644 index 03914ded8614..000000000000 --- a/include/linux/i2c-algo-sibyte.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001,2002,2003 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version 2 | ||
7 | * of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef I2C_ALGO_SIBYTE_H | ||
20 | #define I2C_ALGO_SIBYTE_H 1 | ||
21 | |||
22 | #include <linux/i2c.h> | ||
23 | |||
24 | struct i2c_algo_sibyte_data { | ||
25 | void *data; /* private data */ | ||
26 | int bus; /* which bus */ | ||
27 | void *reg_base; /* CSR base */ | ||
28 | }; | ||
29 | |||
30 | int i2c_sibyte_add_bus(struct i2c_adapter *, int speed); | ||
31 | int i2c_sibyte_del_bus(struct i2c_adapter *); | ||
32 | |||
33 | #endif /* I2C_ALGO_SIBYTE_H */ | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index eb0628a7ecc6..9b5d04768c2c 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -64,14 +64,6 @@ extern int i2c_master_recv(struct i2c_client *,char* ,int); | |||
64 | */ | 64 | */ |
65 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); | 65 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); |
66 | 66 | ||
67 | /* | ||
68 | * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor. | ||
69 | * This is not tested/implemented yet and will change in the future. | ||
70 | */ | ||
71 | extern int i2c_slave_send(struct i2c_client *,char*,int); | ||
72 | extern int i2c_slave_recv(struct i2c_client *,char*,int); | ||
73 | |||
74 | |||
75 | 67 | ||
76 | /* This is the very generalized SMBus access routine. You probably do not | 68 | /* This is the very generalized SMBus access routine. You probably do not |
77 | want to use this, though; one of the functions below may be much easier, | 69 | want to use this, though; one of the functions below may be much easier, |
@@ -201,10 +193,6 @@ struct i2c_algorithm { | |||
201 | unsigned short flags, char read_write, | 193 | unsigned short flags, char read_write, |
202 | u8 command, int size, union i2c_smbus_data * data); | 194 | u8 command, int size, union i2c_smbus_data * data); |
203 | 195 | ||
204 | /* --- these optional/future use for some adapter types.*/ | ||
205 | int (*slave_send)(struct i2c_adapter *,char*,int); | ||
206 | int (*slave_recv)(struct i2c_adapter *,char*,int); | ||
207 | |||
208 | /* --- ioctl like call to set div. parameters. */ | 196 | /* --- ioctl like call to set div. parameters. */ |
209 | int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long); | 197 | int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long); |
210 | 198 | ||
@@ -220,7 +208,7 @@ struct i2c_adapter { | |||
220 | struct module *owner; | 208 | struct module *owner; |
221 | unsigned int id; | 209 | unsigned int id; |
222 | unsigned int class; | 210 | unsigned int class; |
223 | struct i2c_algorithm *algo;/* the algorithm to access the bus */ | 211 | const struct i2c_algorithm *algo; /* the algorithm to access the bus */ |
224 | void *algo_data; | 212 | void *algo_data; |
225 | 213 | ||
226 | /* --- administration stuff. */ | 214 | /* --- administration stuff. */ |
diff --git a/include/linux/if.h b/include/linux/if.h index cd080d765324..8018c2e22c0c 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -59,6 +59,8 @@ | |||
59 | #define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ | 59 | #define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ |
60 | #define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ | 60 | #define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ |
61 | #define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ | 61 | #define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ |
62 | #define IFF_BONDING 0x20 /* bonding master or slave */ | ||
63 | #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ | ||
62 | 64 | ||
63 | #define IF_GET_IFACE 0x0001 /* for querying only */ | 65 | #define IF_GET_IFACE 0x0001 /* for querying only */ |
64 | #define IF_GET_PROTO 0x0002 | 66 | #define IF_GET_PROTO 0x0002 |
diff --git a/include/linux/init.h b/include/linux/init.h index 6667785dd1ff..e92b1455d7af 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -68,6 +68,7 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[]; | |||
68 | 68 | ||
69 | /* Defined in init/main.c */ | 69 | /* Defined in init/main.c */ |
70 | extern char saved_command_line[]; | 70 | extern char saved_command_line[]; |
71 | extern unsigned int reset_devices; | ||
71 | 72 | ||
72 | /* used by init/main.c */ | 73 | /* used by init/main.c */ |
73 | extern void setup_arch(char **); | 74 | extern void setup_arch(char **); |
diff --git a/include/linux/irq.h b/include/linux/irq.h index fbf6d901e9c2..48d3cb3b6a47 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -320,7 +320,9 @@ handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *, | |||
320 | * Monolithic do_IRQ implementation. | 320 | * Monolithic do_IRQ implementation. |
321 | * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) | 321 | * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) |
322 | */ | 322 | */ |
323 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | ||
323 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); | 324 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); |
325 | #endif | ||
324 | 326 | ||
325 | /* | 327 | /* |
326 | * Architectures call this to let the generic IRQ layer | 328 | * Architectures call this to let the generic IRQ layer |
@@ -332,10 +334,14 @@ static inline void generic_handle_irq(unsigned int irq, struct pt_regs *regs) | |||
332 | { | 334 | { |
333 | struct irq_desc *desc = irq_desc + irq; | 335 | struct irq_desc *desc = irq_desc + irq; |
334 | 336 | ||
337 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | ||
338 | desc->handle_irq(irq, desc, regs); | ||
339 | #else | ||
335 | if (likely(desc->handle_irq)) | 340 | if (likely(desc->handle_irq)) |
336 | desc->handle_irq(irq, desc, regs); | 341 | desc->handle_irq(irq, desc, regs); |
337 | else | 342 | else |
338 | __do_IRQ(irq, regs); | 343 | __do_IRQ(irq, regs); |
344 | #endif | ||
339 | } | 345 | } |
340 | 346 | ||
341 | /* Handling of unhandled and spurious interrupts: */ | 347 | /* Handling of unhandled and spurious interrupts: */ |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index a04c154c5207..a6d9daa38c6d 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/jbd.h | 2 | * linux/include/linux/jbd.h |
3 | * | 3 | * |
4 | * Written by Stephen C. Tweedie <sct@redhat.com> | 4 | * Written by Stephen C. Tweedie <sct@redhat.com> |
5 | * | 5 | * |
6 | * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved | 6 | * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved |
@@ -64,7 +64,7 @@ extern int journal_enable_debug; | |||
64 | if ((n) <= journal_enable_debug) { \ | 64 | if ((n) <= journal_enable_debug) { \ |
65 | printk (KERN_DEBUG "(%s, %d): %s: ", \ | 65 | printk (KERN_DEBUG "(%s, %d): %s: ", \ |
66 | __FILE__, __LINE__, __FUNCTION__); \ | 66 | __FILE__, __LINE__, __FUNCTION__); \ |
67 | printk (f, ## a); \ | 67 | printk (f, ## a); \ |
68 | } \ | 68 | } \ |
69 | } while (0) | 69 | } while (0) |
70 | #else | 70 | #else |
@@ -97,8 +97,8 @@ extern void jbd_slab_free(void *ptr, size_t size); | |||
97 | * number of outstanding buffers possible at any time. When the | 97 | * number of outstanding buffers possible at any time. When the |
98 | * operation completes, any buffer credits not used are credited back to | 98 | * operation completes, any buffer credits not used are credited back to |
99 | * the transaction, so that at all times we know how many buffers the | 99 | * the transaction, so that at all times we know how many buffers the |
100 | * outstanding updates on a transaction might possibly touch. | 100 | * outstanding updates on a transaction might possibly touch. |
101 | * | 101 | * |
102 | * This is an opaque datatype. | 102 | * This is an opaque datatype. |
103 | **/ | 103 | **/ |
104 | typedef struct handle_s handle_t; /* Atomic operation type */ | 104 | typedef struct handle_s handle_t; /* Atomic operation type */ |
@@ -108,7 +108,7 @@ typedef struct handle_s handle_t; /* Atomic operation type */ | |||
108 | * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem. | 108 | * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem. |
109 | * | 109 | * |
110 | * journal_t is linked to from the fs superblock structure. | 110 | * journal_t is linked to from the fs superblock structure. |
111 | * | 111 | * |
112 | * We use the journal_t to keep track of all outstanding transaction | 112 | * We use the journal_t to keep track of all outstanding transaction |
113 | * activity on the filesystem, and to manage the state of the log | 113 | * activity on the filesystem, and to manage the state of the log |
114 | * writing process. | 114 | * writing process. |
@@ -128,7 +128,7 @@ typedef struct journal_s journal_t; /* Journal control structure */ | |||
128 | * On-disk structures | 128 | * On-disk structures |
129 | */ | 129 | */ |
130 | 130 | ||
131 | /* | 131 | /* |
132 | * Descriptor block types: | 132 | * Descriptor block types: |
133 | */ | 133 | */ |
134 | 134 | ||
@@ -149,8 +149,8 @@ typedef struct journal_header_s | |||
149 | } journal_header_t; | 149 | } journal_header_t; |
150 | 150 | ||
151 | 151 | ||
152 | /* | 152 | /* |
153 | * The block tag: used to describe a single buffer in the journal | 153 | * The block tag: used to describe a single buffer in the journal |
154 | */ | 154 | */ |
155 | typedef struct journal_block_tag_s | 155 | typedef struct journal_block_tag_s |
156 | { | 156 | { |
@@ -158,9 +158,9 @@ typedef struct journal_block_tag_s | |||
158 | __be32 t_flags; /* See below */ | 158 | __be32 t_flags; /* See below */ |
159 | } journal_block_tag_t; | 159 | } journal_block_tag_t; |
160 | 160 | ||
161 | /* | 161 | /* |
162 | * The revoke descriptor: used on disk to describe a series of blocks to | 162 | * The revoke descriptor: used on disk to describe a series of blocks to |
163 | * be revoked from the log | 163 | * be revoked from the log |
164 | */ | 164 | */ |
165 | typedef struct journal_revoke_header_s | 165 | typedef struct journal_revoke_header_s |
166 | { | 166 | { |
@@ -201,9 +201,9 @@ typedef struct journal_superblock_s | |||
201 | 201 | ||
202 | /* 0x0024 */ | 202 | /* 0x0024 */ |
203 | /* Remaining fields are only valid in a version-2 superblock */ | 203 | /* Remaining fields are only valid in a version-2 superblock */ |
204 | __be32 s_feature_compat; /* compatible feature set */ | 204 | __be32 s_feature_compat; /* compatible feature set */ |
205 | __be32 s_feature_incompat; /* incompatible feature set */ | 205 | __be32 s_feature_incompat; /* incompatible feature set */ |
206 | __be32 s_feature_ro_compat; /* readonly-compatible feature set */ | 206 | __be32 s_feature_ro_compat; /* readonly-compatible feature set */ |
207 | /* 0x0030 */ | 207 | /* 0x0030 */ |
208 | __u8 s_uuid[16]; /* 128-bit uuid for journal */ | 208 | __u8 s_uuid[16]; /* 128-bit uuid for journal */ |
209 | 209 | ||
@@ -374,10 +374,10 @@ struct jbd_revoke_table_s; | |||
374 | **/ | 374 | **/ |
375 | 375 | ||
376 | /* Docbook can't yet cope with the bit fields, but will leave the documentation | 376 | /* Docbook can't yet cope with the bit fields, but will leave the documentation |
377 | * in so it can be fixed later. | 377 | * in so it can be fixed later. |
378 | */ | 378 | */ |
379 | 379 | ||
380 | struct handle_s | 380 | struct handle_s |
381 | { | 381 | { |
382 | /* Which compound transaction is this update a part of? */ | 382 | /* Which compound transaction is this update a part of? */ |
383 | transaction_t *h_transaction; | 383 | transaction_t *h_transaction; |
@@ -435,7 +435,7 @@ struct handle_s | |||
435 | * | 435 | * |
436 | */ | 436 | */ |
437 | 437 | ||
438 | struct transaction_s | 438 | struct transaction_s |
439 | { | 439 | { |
440 | /* Pointer to the journal for this transaction. [no locking] */ | 440 | /* Pointer to the journal for this transaction. [no locking] */ |
441 | journal_t *t_journal; | 441 | journal_t *t_journal; |
@@ -455,7 +455,7 @@ struct transaction_s | |||
455 | T_RUNDOWN, | 455 | T_RUNDOWN, |
456 | T_FLUSH, | 456 | T_FLUSH, |
457 | T_COMMIT, | 457 | T_COMMIT, |
458 | T_FINISHED | 458 | T_FINISHED |
459 | } t_state; | 459 | } t_state; |
460 | 460 | ||
461 | /* | 461 | /* |
@@ -569,7 +569,7 @@ struct transaction_s | |||
569 | * journal_t. | 569 | * journal_t. |
570 | * @j_flags: General journaling state flags | 570 | * @j_flags: General journaling state flags |
571 | * @j_errno: Is there an outstanding uncleared error on the journal (from a | 571 | * @j_errno: Is there an outstanding uncleared error on the journal (from a |
572 | * prior abort)? | 572 | * prior abort)? |
573 | * @j_sb_buffer: First part of superblock buffer | 573 | * @j_sb_buffer: First part of superblock buffer |
574 | * @j_superblock: Second part of superblock buffer | 574 | * @j_superblock: Second part of superblock buffer |
575 | * @j_format_version: Version of the superblock format | 575 | * @j_format_version: Version of the superblock format |
@@ -583,7 +583,7 @@ struct transaction_s | |||
583 | * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction | 583 | * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction |
584 | * to start committing, or for a barrier lock to be released | 584 | * to start committing, or for a barrier lock to be released |
585 | * @j_wait_logspace: Wait queue for waiting for checkpointing to complete | 585 | * @j_wait_logspace: Wait queue for waiting for checkpointing to complete |
586 | * @j_wait_done_commit: Wait queue for waiting for commit to complete | 586 | * @j_wait_done_commit: Wait queue for waiting for commit to complete |
587 | * @j_wait_checkpoint: Wait queue to trigger checkpointing | 587 | * @j_wait_checkpoint: Wait queue to trigger checkpointing |
588 | * @j_wait_commit: Wait queue to trigger commit | 588 | * @j_wait_commit: Wait queue to trigger commit |
589 | * @j_wait_updates: Wait queue to wait for updates to complete | 589 | * @j_wait_updates: Wait queue to wait for updates to complete |
@@ -592,7 +592,7 @@ struct transaction_s | |||
592 | * @j_tail: Journal tail - identifies the oldest still-used block in the | 592 | * @j_tail: Journal tail - identifies the oldest still-used block in the |
593 | * journal. | 593 | * journal. |
594 | * @j_free: Journal free - how many free blocks are there in the journal? | 594 | * @j_free: Journal free - how many free blocks are there in the journal? |
595 | * @j_first: The block number of the first usable block | 595 | * @j_first: The block number of the first usable block |
596 | * @j_last: The block number one beyond the last usable block | 596 | * @j_last: The block number one beyond the last usable block |
597 | * @j_dev: Device where we store the journal | 597 | * @j_dev: Device where we store the journal |
598 | * @j_blocksize: blocksize for the location where we store the journal. | 598 | * @j_blocksize: blocksize for the location where we store the journal. |
@@ -604,12 +604,12 @@ struct transaction_s | |||
604 | * @j_list_lock: Protects the buffer lists and internal buffer state. | 604 | * @j_list_lock: Protects the buffer lists and internal buffer state. |
605 | * @j_inode: Optional inode where we store the journal. If present, all journal | 605 | * @j_inode: Optional inode where we store the journal. If present, all journal |
606 | * block numbers are mapped into this inode via bmap(). | 606 | * block numbers are mapped into this inode via bmap(). |
607 | * @j_tail_sequence: Sequence number of the oldest transaction in the log | 607 | * @j_tail_sequence: Sequence number of the oldest transaction in the log |
608 | * @j_transaction_sequence: Sequence number of the next transaction to grant | 608 | * @j_transaction_sequence: Sequence number of the next transaction to grant |
609 | * @j_commit_sequence: Sequence number of the most recently committed | 609 | * @j_commit_sequence: Sequence number of the most recently committed |
610 | * transaction | 610 | * transaction |
611 | * @j_commit_request: Sequence number of the most recent transaction wanting | 611 | * @j_commit_request: Sequence number of the most recent transaction wanting |
612 | * commit | 612 | * commit |
613 | * @j_uuid: Uuid of client object. | 613 | * @j_uuid: Uuid of client object. |
614 | * @j_task: Pointer to the current commit thread for this journal | 614 | * @j_task: Pointer to the current commit thread for this journal |
615 | * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a | 615 | * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a |
@@ -699,7 +699,7 @@ struct journal_s | |||
699 | wait_queue_head_t j_wait_updates; | 699 | wait_queue_head_t j_wait_updates; |
700 | 700 | ||
701 | /* Semaphore for locking against concurrent checkpoints */ | 701 | /* Semaphore for locking against concurrent checkpoints */ |
702 | struct mutex j_checkpoint_mutex; | 702 | struct mutex j_checkpoint_mutex; |
703 | 703 | ||
704 | /* | 704 | /* |
705 | * Journal head: identifies the first unused block in the journal. | 705 | * Journal head: identifies the first unused block in the journal. |
@@ -732,7 +732,7 @@ struct journal_s | |||
732 | */ | 732 | */ |
733 | struct block_device *j_dev; | 733 | struct block_device *j_dev; |
734 | int j_blocksize; | 734 | int j_blocksize; |
735 | unsigned int j_blk_offset; | 735 | unsigned long j_blk_offset; |
736 | 736 | ||
737 | /* | 737 | /* |
738 | * Device which holds the client fs. For internal journal this will be | 738 | * Device which holds the client fs. For internal journal this will be |
@@ -823,8 +823,8 @@ struct journal_s | |||
823 | void *j_private; | 823 | void *j_private; |
824 | }; | 824 | }; |
825 | 825 | ||
826 | /* | 826 | /* |
827 | * Journal flag definitions | 827 | * Journal flag definitions |
828 | */ | 828 | */ |
829 | #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ | 829 | #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ |
830 | #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ | 830 | #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ |
@@ -833,7 +833,7 @@ struct journal_s | |||
833 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ | 833 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ |
834 | #define JFS_BARRIER 0x020 /* Use IDE barriers */ | 834 | #define JFS_BARRIER 0x020 /* Use IDE barriers */ |
835 | 835 | ||
836 | /* | 836 | /* |
837 | * Function declarations for the journaling transaction and buffer | 837 | * Function declarations for the journaling transaction and buffer |
838 | * management | 838 | * management |
839 | */ | 839 | */ |
@@ -862,11 +862,11 @@ int __journal_remove_checkpoint(struct journal_head *); | |||
862 | void __journal_insert_checkpoint(struct journal_head *, transaction_t *); | 862 | void __journal_insert_checkpoint(struct journal_head *, transaction_t *); |
863 | 863 | ||
864 | /* Buffer IO */ | 864 | /* Buffer IO */ |
865 | extern int | 865 | extern int |
866 | journal_write_metadata_buffer(transaction_t *transaction, | 866 | journal_write_metadata_buffer(transaction_t *transaction, |
867 | struct journal_head *jh_in, | 867 | struct journal_head *jh_in, |
868 | struct journal_head **jh_out, | 868 | struct journal_head **jh_out, |
869 | int blocknr); | 869 | unsigned long blocknr); |
870 | 870 | ||
871 | /* Transaction locking */ | 871 | /* Transaction locking */ |
872 | extern void __wait_on_journal (journal_t *); | 872 | extern void __wait_on_journal (journal_t *); |
@@ -890,7 +890,7 @@ static inline handle_t *journal_current_handle(void) | |||
890 | /* The journaling code user interface: | 890 | /* The journaling code user interface: |
891 | * | 891 | * |
892 | * Create and destroy handles | 892 | * Create and destroy handles |
893 | * Register buffer modifications against the current transaction. | 893 | * Register buffer modifications against the current transaction. |
894 | */ | 894 | */ |
895 | 895 | ||
896 | extern handle_t *journal_start(journal_t *, int nblocks); | 896 | extern handle_t *journal_start(journal_t *, int nblocks); |
@@ -917,11 +917,11 @@ extern journal_t * journal_init_dev(struct block_device *bdev, | |||
917 | int start, int len, int bsize); | 917 | int start, int len, int bsize); |
918 | extern journal_t * journal_init_inode (struct inode *); | 918 | extern journal_t * journal_init_inode (struct inode *); |
919 | extern int journal_update_format (journal_t *); | 919 | extern int journal_update_format (journal_t *); |
920 | extern int journal_check_used_features | 920 | extern int journal_check_used_features |
921 | (journal_t *, unsigned long, unsigned long, unsigned long); | 921 | (journal_t *, unsigned long, unsigned long, unsigned long); |
922 | extern int journal_check_available_features | 922 | extern int journal_check_available_features |
923 | (journal_t *, unsigned long, unsigned long, unsigned long); | 923 | (journal_t *, unsigned long, unsigned long, unsigned long); |
924 | extern int journal_set_features | 924 | extern int journal_set_features |
925 | (journal_t *, unsigned long, unsigned long, unsigned long); | 925 | (journal_t *, unsigned long, unsigned long, unsigned long); |
926 | extern int journal_create (journal_t *); | 926 | extern int journal_create (journal_t *); |
927 | extern int journal_load (journal_t *journal); | 927 | extern int journal_load (journal_t *journal); |
@@ -1015,7 +1015,7 @@ do { \ | |||
1015 | * bit, when set, indicates that we have had a fatal error somewhere, | 1015 | * bit, when set, indicates that we have had a fatal error somewhere, |
1016 | * either inside the journaling layer or indicated to us by the client | 1016 | * either inside the journaling layer or indicated to us by the client |
1017 | * (eg. ext3), and that we and should not commit any further | 1017 | * (eg. ext3), and that we and should not commit any further |
1018 | * transactions. | 1018 | * transactions. |
1019 | */ | 1019 | */ |
1020 | 1020 | ||
1021 | static inline int is_journal_aborted(journal_t *journal) | 1021 | static inline int is_journal_aborted(journal_t *journal) |
@@ -1082,7 +1082,7 @@ static inline int jbd_space_needed(journal_t *journal) | |||
1082 | #define BJ_Reserved 7 /* Buffer is reserved for access by journal */ | 1082 | #define BJ_Reserved 7 /* Buffer is reserved for access by journal */ |
1083 | #define BJ_Locked 8 /* Locked for I/O during commit */ | 1083 | #define BJ_Locked 8 /* Locked for I/O during commit */ |
1084 | #define BJ_Types 9 | 1084 | #define BJ_Types 9 |
1085 | 1085 | ||
1086 | extern int jbd_blocks_per_page(struct inode *inode); | 1086 | extern int jbd_blocks_per_page(struct inode *inode); |
1087 | 1087 | ||
1088 | #ifdef __KERNEL__ | 1088 | #ifdef __KERNEL__ |
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 329ebcffa106..c8d5f207c3d4 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -115,6 +115,21 @@ static inline u64 get_jiffies_64(void) | |||
115 | ((long)(a) - (long)(b) >= 0)) | 115 | ((long)(a) - (long)(b) >= 0)) |
116 | #define time_before_eq(a,b) time_after_eq(b,a) | 116 | #define time_before_eq(a,b) time_after_eq(b,a) |
117 | 117 | ||
118 | /* Same as above, but does so with platform independent 64bit types. | ||
119 | * These must be used when utilizing jiffies_64 (i.e. return value of | ||
120 | * get_jiffies_64() */ | ||
121 | #define time_after64(a,b) \ | ||
122 | (typecheck(__u64, a) && \ | ||
123 | typecheck(__u64, b) && \ | ||
124 | ((__s64)(b) - (__s64)(a) < 0)) | ||
125 | #define time_before64(a,b) time_after64(b,a) | ||
126 | |||
127 | #define time_after_eq64(a,b) \ | ||
128 | (typecheck(__u64, a) && \ | ||
129 | typecheck(__u64, b) && \ | ||
130 | ((__s64)(a) - (__s64)(b) >= 0)) | ||
131 | #define time_before_eq64(a,b) time_after_eq64(b,a) | ||
132 | |||
118 | /* | 133 | /* |
119 | * Have the 32 bit jiffies value wrap 5 minutes after boot | 134 | * Have the 32 bit jiffies value wrap 5 minutes after boot |
120 | * so jiffies wrap bugs show up earlier. | 135 | * so jiffies wrap bugs show up earlier. |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e44a37e2c71c..4d00988dad03 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -187,6 +187,7 @@ extern void bust_spinlocks(int yes); | |||
187 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ | 187 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ |
188 | extern int panic_timeout; | 188 | extern int panic_timeout; |
189 | extern int panic_on_oops; | 189 | extern int panic_on_oops; |
190 | extern int panic_on_unrecovered_nmi; | ||
190 | extern int tainted; | 191 | extern int tainted; |
191 | extern const char *print_tainted(void); | 192 | extern const char *print_tainted(void); |
192 | extern void add_taint(unsigned); | 193 | extern void add_taint(unsigned); |
@@ -349,4 +350,11 @@ struct sysinfo { | |||
349 | /* Trap pasters of __FUNCTION__ at compile-time */ | 350 | /* Trap pasters of __FUNCTION__ at compile-time */ |
350 | #define __FUNCTION__ (__func__) | 351 | #define __FUNCTION__ (__func__) |
351 | 352 | ||
353 | /* This helps us to avoid #ifdef CONFIG_NUMA */ | ||
354 | #ifdef CONFIG_NUMA | ||
355 | #define NUMA_BUILD 1 | ||
356 | #else | ||
357 | #define NUMA_BUILD 0 | ||
358 | #endif | ||
359 | |||
352 | #endif | 360 | #endif |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 2d229327959e..bcd9cd173c2c 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/sysfs.h> | 22 | #include <linux/sysfs.h> |
23 | #include <linux/compiler.h> | ||
23 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
24 | #include <linux/rwsem.h> | 25 | #include <linux/rwsem.h> |
25 | #include <linux/kref.h> | 26 | #include <linux/kref.h> |
@@ -71,12 +72,12 @@ static inline const char * kobject_name(const struct kobject * kobj) | |||
71 | extern void kobject_init(struct kobject *); | 72 | extern void kobject_init(struct kobject *); |
72 | extern void kobject_cleanup(struct kobject *); | 73 | extern void kobject_cleanup(struct kobject *); |
73 | 74 | ||
74 | extern int kobject_add(struct kobject *); | 75 | extern int __must_check kobject_add(struct kobject *); |
75 | extern void kobject_del(struct kobject *); | 76 | extern void kobject_del(struct kobject *); |
76 | 77 | ||
77 | extern int kobject_rename(struct kobject *, const char *new_name); | 78 | extern int __must_check kobject_rename(struct kobject *, const char *new_name); |
78 | 79 | ||
79 | extern int kobject_register(struct kobject *); | 80 | extern int __must_check kobject_register(struct kobject *); |
80 | extern void kobject_unregister(struct kobject *); | 81 | extern void kobject_unregister(struct kobject *); |
81 | 82 | ||
82 | extern struct kobject * kobject_get(struct kobject *); | 83 | extern struct kobject * kobject_get(struct kobject *); |
@@ -128,8 +129,8 @@ struct kset { | |||
128 | 129 | ||
129 | 130 | ||
130 | extern void kset_init(struct kset * k); | 131 | extern void kset_init(struct kset * k); |
131 | extern int kset_add(struct kset * k); | 132 | extern int __must_check kset_add(struct kset * k); |
132 | extern int kset_register(struct kset * k); | 133 | extern int __must_check kset_register(struct kset * k); |
133 | extern void kset_unregister(struct kset * k); | 134 | extern void kset_unregister(struct kset * k); |
134 | 135 | ||
135 | static inline struct kset * to_kset(struct kobject * kobj) | 136 | static inline struct kset * to_kset(struct kobject * kobj) |
@@ -239,7 +240,7 @@ extern struct subsystem hypervisor_subsys; | |||
239 | (obj)->subsys.kset.kobj.kset = &(_subsys).kset | 240 | (obj)->subsys.kset.kobj.kset = &(_subsys).kset |
240 | 241 | ||
241 | extern void subsystem_init(struct subsystem *); | 242 | extern void subsystem_init(struct subsystem *); |
242 | extern int subsystem_register(struct subsystem *); | 243 | extern int __must_check subsystem_register(struct subsystem *); |
243 | extern void subsystem_unregister(struct subsystem *); | 244 | extern void subsystem_unregister(struct subsystem *); |
244 | 245 | ||
245 | static inline struct subsystem * subsys_get(struct subsystem * s) | 246 | static inline struct subsystem * subsys_get(struct subsystem * s) |
@@ -258,7 +259,8 @@ struct subsys_attribute { | |||
258 | ssize_t (*store)(struct subsystem *, const char *, size_t); | 259 | ssize_t (*store)(struct subsystem *, const char *, size_t); |
259 | }; | 260 | }; |
260 | 261 | ||
261 | extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); | 262 | extern int __must_check subsys_create_file(struct subsystem * , |
263 | struct subsys_attribute *); | ||
262 | 264 | ||
263 | #if defined(CONFIG_HOTPLUG) | 265 | #if defined(CONFIG_HOTPLUG) |
264 | void kobject_uevent(struct kobject *kobj, enum kobject_action action); | 266 | void kobject_uevent(struct kobject *kobj, enum kobject_action action); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 1ef3d3901b47..d6a3d4b345fc 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -36,7 +36,15 @@ | |||
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | #include <scsi/scsi_host.h> | 37 | #include <scsi/scsi_host.h> |
38 | 38 | ||
39 | /* | ||
40 | * Define if arch has non-standard setup. This is a _PCI_ standard | ||
41 | * not a legacy or ISA standard. | ||
42 | */ | ||
43 | #ifdef CONFIG_ATA_NONSTANDARD | ||
39 | #include <asm/libata-portmap.h> | 44 | #include <asm/libata-portmap.h> |
45 | #else | ||
46 | #include <asm-generic/libata-portmap.h> | ||
47 | #endif | ||
40 | 48 | ||
41 | /* | 49 | /* |
42 | * compile-time options: to be removed as soon as all the drivers are | 50 | * compile-time options: to be removed as soon as all the drivers are |
diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 932021f872d5..6c9873f88287 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h | |||
@@ -35,9 +35,13 @@ | |||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #define KPROBE_ENTRY(name) \ | 37 | #define KPROBE_ENTRY(name) \ |
38 | .section .kprobes.text, "ax"; \ | 38 | .pushsection .kprobes.text, "ax"; \ |
39 | ENTRY(name) | 39 | ENTRY(name) |
40 | 40 | ||
41 | #define KPROBE_END(name) \ | ||
42 | END(name); \ | ||
43 | .popsection | ||
44 | |||
41 | #ifndef END | 45 | #ifndef END |
42 | #define END(name) \ | 46 | #define END(name) \ |
43 | .size name, .-name | 47 | .size name, .-name |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 72440f0a443d..09f0f575ddff 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -162,9 +162,9 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, | |||
162 | unsigned long addr); | 162 | unsigned long addr); |
163 | extern unsigned slab_node(struct mempolicy *policy); | 163 | extern unsigned slab_node(struct mempolicy *policy); |
164 | 164 | ||
165 | extern int policy_zone; | 165 | extern enum zone_type policy_zone; |
166 | 166 | ||
167 | static inline void check_highest_zone(int k) | 167 | static inline void check_highest_zone(enum zone_type k) |
168 | { | 168 | { |
169 | if (k > policy_zone) | 169 | if (k > policy_zone) |
170 | policy_zone = k; | 170 | policy_zone = k; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 224178a000d2..7b703b6d4358 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/debug_locks.h> | 17 | #include <linux/debug_locks.h> |
18 | #include <linux/backing-dev.h> | ||
19 | #include <linux/mm_types.h> | ||
18 | 20 | ||
19 | struct mempolicy; | 21 | struct mempolicy; |
20 | struct anon_vma; | 22 | struct anon_vma; |
@@ -197,6 +199,7 @@ struct vm_operations_struct { | |||
197 | void (*open)(struct vm_area_struct * area); | 199 | void (*open)(struct vm_area_struct * area); |
198 | void (*close)(struct vm_area_struct * area); | 200 | void (*close)(struct vm_area_struct * area); |
199 | struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); | 201 | struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); |
202 | unsigned long (*nopfn)(struct vm_area_struct * area, unsigned long address); | ||
200 | int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); | 203 | int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); |
201 | 204 | ||
202 | /* notification that a previously read-only page is about to become | 205 | /* notification that a previously read-only page is about to become |
@@ -214,61 +217,6 @@ struct vm_operations_struct { | |||
214 | struct mmu_gather; | 217 | struct mmu_gather; |
215 | struct inode; | 218 | struct inode; |
216 | 219 | ||
217 | /* | ||
218 | * Each physical page in the system has a struct page associated with | ||
219 | * it to keep track of whatever it is we are using the page for at the | ||
220 | * moment. Note that we have no way to track which tasks are using | ||
221 | * a page. | ||
222 | */ | ||
223 | struct page { | ||
224 | unsigned long flags; /* Atomic flags, some possibly | ||
225 | * updated asynchronously */ | ||
226 | atomic_t _count; /* Usage count, see below. */ | ||
227 | atomic_t _mapcount; /* Count of ptes mapped in mms, | ||
228 | * to show when page is mapped | ||
229 | * & limit reverse map searches. | ||
230 | */ | ||
231 | union { | ||
232 | struct { | ||
233 | unsigned long private; /* Mapping-private opaque data: | ||
234 | * usually used for buffer_heads | ||
235 | * if PagePrivate set; used for | ||
236 | * swp_entry_t if PageSwapCache; | ||
237 | * indicates order in the buddy | ||
238 | * system if PG_buddy is set. | ||
239 | */ | ||
240 | struct address_space *mapping; /* If low bit clear, points to | ||
241 | * inode address_space, or NULL. | ||
242 | * If page mapped as anonymous | ||
243 | * memory, low bit is set, and | ||
244 | * it points to anon_vma object: | ||
245 | * see PAGE_MAPPING_ANON below. | ||
246 | */ | ||
247 | }; | ||
248 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | ||
249 | spinlock_t ptl; | ||
250 | #endif | ||
251 | }; | ||
252 | pgoff_t index; /* Our offset within mapping. */ | ||
253 | struct list_head lru; /* Pageout list, eg. active_list | ||
254 | * protected by zone->lru_lock ! | ||
255 | */ | ||
256 | /* | ||
257 | * On machines where all RAM is mapped into kernel address space, | ||
258 | * we can simply calculate the virtual address. On machines with | ||
259 | * highmem some memory is mapped into kernel virtual memory | ||
260 | * dynamically, so we need a place to store that address. | ||
261 | * Note that this field could be 16 bits on x86 ... ;) | ||
262 | * | ||
263 | * Architectures with slow multiplication can define | ||
264 | * WANT_PAGE_VIRTUAL in asm/page.h | ||
265 | */ | ||
266 | #if defined(WANT_PAGE_VIRTUAL) | ||
267 | void *virtual; /* Kernel virtual address (NULL if | ||
268 | not kmapped, ie. highmem) */ | ||
269 | #endif /* WANT_PAGE_VIRTUAL */ | ||
270 | }; | ||
271 | |||
272 | #define page_private(page) ((page)->private) | 220 | #define page_private(page) ((page)->private) |
273 | #define set_page_private(page, v) ((page)->private = (v)) | 221 | #define set_page_private(page, v) ((page)->private = (v)) |
274 | 222 | ||
@@ -278,6 +226,12 @@ struct page { | |||
278 | */ | 226 | */ |
279 | #include <linux/page-flags.h> | 227 | #include <linux/page-flags.h> |
280 | 228 | ||
229 | #ifdef CONFIG_DEBUG_VM | ||
230 | #define VM_BUG_ON(cond) BUG_ON(cond) | ||
231 | #else | ||
232 | #define VM_BUG_ON(condition) do { } while(0) | ||
233 | #endif | ||
234 | |||
281 | /* | 235 | /* |
282 | * Methods to modify the page usage count. | 236 | * Methods to modify the page usage count. |
283 | * | 237 | * |
@@ -292,12 +246,11 @@ struct page { | |||
292 | */ | 246 | */ |
293 | 247 | ||
294 | /* | 248 | /* |
295 | * Drop a ref, return true if the logical refcount fell to zero (the page has | 249 | * Drop a ref, return true if the refcount fell to zero (the page has no users) |
296 | * no users) | ||
297 | */ | 250 | */ |
298 | static inline int put_page_testzero(struct page *page) | 251 | static inline int put_page_testzero(struct page *page) |
299 | { | 252 | { |
300 | BUG_ON(atomic_read(&page->_count) == 0); | 253 | VM_BUG_ON(atomic_read(&page->_count) == 0); |
301 | return atomic_dec_and_test(&page->_count); | 254 | return atomic_dec_and_test(&page->_count); |
302 | } | 255 | } |
303 | 256 | ||
@@ -307,11 +260,10 @@ static inline int put_page_testzero(struct page *page) | |||
307 | */ | 260 | */ |
308 | static inline int get_page_unless_zero(struct page *page) | 261 | static inline int get_page_unless_zero(struct page *page) |
309 | { | 262 | { |
263 | VM_BUG_ON(PageCompound(page)); | ||
310 | return atomic_inc_not_zero(&page->_count); | 264 | return atomic_inc_not_zero(&page->_count); |
311 | } | 265 | } |
312 | 266 | ||
313 | extern void FASTCALL(__page_cache_release(struct page *)); | ||
314 | |||
315 | static inline int page_count(struct page *page) | 267 | static inline int page_count(struct page *page) |
316 | { | 268 | { |
317 | if (unlikely(PageCompound(page))) | 269 | if (unlikely(PageCompound(page))) |
@@ -323,6 +275,7 @@ static inline void get_page(struct page *page) | |||
323 | { | 275 | { |
324 | if (unlikely(PageCompound(page))) | 276 | if (unlikely(PageCompound(page))) |
325 | page = (struct page *)page_private(page); | 277 | page = (struct page *)page_private(page); |
278 | VM_BUG_ON(atomic_read(&page->_count) == 0); | ||
326 | atomic_inc(&page->_count); | 279 | atomic_inc(&page->_count); |
327 | } | 280 | } |
328 | 281 | ||
@@ -349,43 +302,55 @@ void split_page(struct page *page, unsigned int order); | |||
349 | * For the non-reserved pages, page_count(page) denotes a reference count. | 302 | * For the non-reserved pages, page_count(page) denotes a reference count. |
350 | * page_count() == 0 means the page is free. page->lru is then used for | 303 | * page_count() == 0 means the page is free. page->lru is then used for |
351 | * freelist management in the buddy allocator. | 304 | * freelist management in the buddy allocator. |
352 | * page_count() == 1 means the page is used for exactly one purpose | 305 | * page_count() > 0 means the page has been allocated. |
353 | * (e.g. a private data page of one process). | 306 | * |
307 | * Pages are allocated by the slab allocator in order to provide memory | ||
308 | * to kmalloc and kmem_cache_alloc. In this case, the management of the | ||
309 | * page, and the fields in 'struct page' are the responsibility of mm/slab.c | ||
310 | * unless a particular usage is carefully commented. (the responsibility of | ||
311 | * freeing the kmalloc memory is the caller's, of course). | ||
354 | * | 312 | * |
355 | * A page may be used for kmalloc() or anyone else who does a | 313 | * A page may be used by anyone else who does a __get_free_page(). |
356 | * __get_free_page(). In this case the page_count() is at least 1, and | 314 | * In this case, page_count still tracks the references, and should only |
357 | * all other fields are unused but should be 0 or NULL. The | 315 | * be used through the normal accessor functions. The top bits of page->flags |
358 | * management of this page is the responsibility of the one who uses | 316 | * and page->virtual store page management information, but all other fields |
359 | * it. | 317 | * are unused and could be used privately, carefully. The management of this |
318 | * page is the responsibility of the one who allocated it, and those who have | ||
319 | * subsequently been given references to it. | ||
360 | * | 320 | * |
361 | * The other pages (we may call them "process pages") are completely | 321 | * The other pages (we may call them "pagecache pages") are completely |
362 | * managed by the Linux memory manager: I/O, buffers, swapping etc. | 322 | * managed by the Linux memory manager: I/O, buffers, swapping etc. |
363 | * The following discussion applies only to them. | 323 | * The following discussion applies only to them. |
364 | * | 324 | * |
365 | * A page may belong to an inode's memory mapping. In this case, | 325 | * A pagecache page contains an opaque `private' member, which belongs to the |
366 | * page->mapping is the pointer to the inode, and page->index is the | 326 | * page's address_space. Usually, this is the address of a circular list of |
367 | * file offset of the page, in units of PAGE_CACHE_SIZE. | 327 | * the page's disk buffers. PG_private must be set to tell the VM to call |
328 | * into the filesystem to release these pages. | ||
368 | * | 329 | * |
369 | * A page contains an opaque `private' member, which belongs to the | 330 | * A page may belong to an inode's memory mapping. In this case, page->mapping |
370 | * page's address_space. Usually, this is the address of a circular | 331 | * is the pointer to the inode, and page->index is the file offset of the page, |
371 | * list of the page's disk buffers. | 332 | * in units of PAGE_CACHE_SIZE. |
372 | * | 333 | * |
373 | * For pages belonging to inodes, the page_count() is the number of | 334 | * If pagecache pages are not associated with an inode, they are said to be |
374 | * attaches, plus 1 if `private' contains something, plus one for | 335 | * anonymous pages. These may become associated with the swapcache, and in that |
375 | * the page cache itself. | 336 | * case PG_swapcache is set, and page->private is an offset into the swapcache. |
376 | * | 337 | * |
377 | * Instead of keeping dirty/clean pages in per address-space lists, we instead | 338 | * In either case (swapcache or inode backed), the pagecache itself holds one |
378 | * now tag pages as dirty/under writeback in the radix tree. | 339 | * reference to the page. Setting PG_private should also increment the |
340 | * refcount. The each user mapping also has a reference to the page. | ||
379 | * | 341 | * |
380 | * There is also a per-mapping radix tree mapping index to the page | 342 | * The pagecache pages are stored in a per-mapping radix tree, which is |
381 | * in memory if present. The tree is rooted at mapping->root. | 343 | * rooted at mapping->page_tree, and indexed by offset. |
344 | * Where 2.4 and early 2.6 kernels kept dirty/clean pages in per-address_space | ||
345 | * lists, we instead now tag pages as dirty/writeback in the radix tree. | ||
382 | * | 346 | * |
383 | * All process pages can do I/O: | 347 | * All pagecache pages may be subject to I/O: |
384 | * - inode pages may need to be read from disk, | 348 | * - inode pages may need to be read from disk, |
385 | * - inode pages which have been modified and are MAP_SHARED may need | 349 | * - inode pages which have been modified and are MAP_SHARED may need |
386 | * to be written to disk, | 350 | * to be written back to the inode on disk, |
387 | * - private pages which have been modified may need to be swapped out | 351 | * - anonymous pages (including MAP_PRIVATE file mappings) which have been |
388 | * to swap space and (later) to be read back into memory. | 352 | * modified may need to be swapped out to swap space and (later) to be read |
353 | * back into memory. | ||
389 | */ | 354 | */ |
390 | 355 | ||
391 | /* | 356 | /* |
@@ -463,7 +428,7 @@ void split_page(struct page *page, unsigned int order); | |||
463 | #define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) | 428 | #define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) |
464 | #define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) | 429 | #define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) |
465 | 430 | ||
466 | static inline unsigned long page_zonenum(struct page *page) | 431 | static inline enum zone_type page_zonenum(struct page *page) |
467 | { | 432 | { |
468 | return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; | 433 | return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; |
469 | } | 434 | } |
@@ -480,23 +445,33 @@ static inline struct zone *page_zone(struct page *page) | |||
480 | return zone_table[page_zone_id(page)]; | 445 | return zone_table[page_zone_id(page)]; |
481 | } | 446 | } |
482 | 447 | ||
448 | static inline unsigned long zone_to_nid(struct zone *zone) | ||
449 | { | ||
450 | #ifdef CONFIG_NUMA | ||
451 | return zone->node; | ||
452 | #else | ||
453 | return 0; | ||
454 | #endif | ||
455 | } | ||
456 | |||
483 | static inline unsigned long page_to_nid(struct page *page) | 457 | static inline unsigned long page_to_nid(struct page *page) |
484 | { | 458 | { |
485 | if (FLAGS_HAS_NODE) | 459 | if (FLAGS_HAS_NODE) |
486 | return (page->flags >> NODES_PGSHIFT) & NODES_MASK; | 460 | return (page->flags >> NODES_PGSHIFT) & NODES_MASK; |
487 | else | 461 | else |
488 | return page_zone(page)->zone_pgdat->node_id; | 462 | return zone_to_nid(page_zone(page)); |
489 | } | 463 | } |
490 | static inline unsigned long page_to_section(struct page *page) | 464 | static inline unsigned long page_to_section(struct page *page) |
491 | { | 465 | { |
492 | return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; | 466 | return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; |
493 | } | 467 | } |
494 | 468 | ||
495 | static inline void set_page_zone(struct page *page, unsigned long zone) | 469 | static inline void set_page_zone(struct page *page, enum zone_type zone) |
496 | { | 470 | { |
497 | page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); | 471 | page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); |
498 | page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; | 472 | page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; |
499 | } | 473 | } |
474 | |||
500 | static inline void set_page_node(struct page *page, unsigned long node) | 475 | static inline void set_page_node(struct page *page, unsigned long node) |
501 | { | 476 | { |
502 | page->flags &= ~(NODES_MASK << NODES_PGSHIFT); | 477 | page->flags &= ~(NODES_MASK << NODES_PGSHIFT); |
@@ -508,7 +483,7 @@ static inline void set_page_section(struct page *page, unsigned long section) | |||
508 | page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; | 483 | page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; |
509 | } | 484 | } |
510 | 485 | ||
511 | static inline void set_page_links(struct page *page, unsigned long zone, | 486 | static inline void set_page_links(struct page *page, enum zone_type zone, |
512 | unsigned long node, unsigned long pfn) | 487 | unsigned long node, unsigned long pfn) |
513 | { | 488 | { |
514 | set_page_zone(page, zone); | 489 | set_page_zone(page, zone); |
@@ -521,11 +496,6 @@ static inline void set_page_links(struct page *page, unsigned long zone, | |||
521 | */ | 496 | */ |
522 | #include <linux/vmstat.h> | 497 | #include <linux/vmstat.h> |
523 | 498 | ||
524 | #ifndef CONFIG_DISCONTIGMEM | ||
525 | /* The array of struct pages - for discontigmem use pgdat->lmem_map */ | ||
526 | extern struct page *mem_map; | ||
527 | #endif | ||
528 | |||
529 | static __always_inline void *lowmem_page_address(struct page *page) | 499 | static __always_inline void *lowmem_page_address(struct page *page) |
530 | { | 500 | { |
531 | return __va(page_to_pfn(page) << PAGE_SHIFT); | 501 | return __va(page_to_pfn(page) << PAGE_SHIFT); |
@@ -625,6 +595,12 @@ static inline int page_mapped(struct page *page) | |||
625 | #define NOPAGE_OOM ((struct page *) (-1)) | 595 | #define NOPAGE_OOM ((struct page *) (-1)) |
626 | 596 | ||
627 | /* | 597 | /* |
598 | * Error return values for the *_nopfn functions | ||
599 | */ | ||
600 | #define NOPFN_SIGBUS ((unsigned long) -1) | ||
601 | #define NOPFN_OOM ((unsigned long) -2) | ||
602 | |||
603 | /* | ||
628 | * Different kinds of faults, as returned by handle_mm_fault(). | 604 | * Different kinds of faults, as returned by handle_mm_fault(). |
629 | * Used to decide whether a process gets delivered SIGBUS or | 605 | * Used to decide whether a process gets delivered SIGBUS or |
630 | * just gets major/minor fault counters bumped up. | 606 | * just gets major/minor fault counters bumped up. |
@@ -802,6 +778,39 @@ struct shrinker; | |||
802 | extern struct shrinker *set_shrinker(int, shrinker_t); | 778 | extern struct shrinker *set_shrinker(int, shrinker_t); |
803 | extern void remove_shrinker(struct shrinker *shrinker); | 779 | extern void remove_shrinker(struct shrinker *shrinker); |
804 | 780 | ||
781 | /* | ||
782 | * Some shared mappigns will want the pages marked read-only | ||
783 | * to track write events. If so, we'll downgrade vm_page_prot | ||
784 | * to the private version (using protection_map[] without the | ||
785 | * VM_SHARED bit). | ||
786 | */ | ||
787 | static inline int vma_wants_writenotify(struct vm_area_struct *vma) | ||
788 | { | ||
789 | unsigned int vm_flags = vma->vm_flags; | ||
790 | |||
791 | /* If it was private or non-writable, the write bit is already clear */ | ||
792 | if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED))) | ||
793 | return 0; | ||
794 | |||
795 | /* The backer wishes to know when pages are first written to? */ | ||
796 | if (vma->vm_ops && vma->vm_ops->page_mkwrite) | ||
797 | return 1; | ||
798 | |||
799 | /* The open routine did something to the protections already? */ | ||
800 | if (pgprot_val(vma->vm_page_prot) != | ||
801 | pgprot_val(protection_map[vm_flags & | ||
802 | (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)])) | ||
803 | return 0; | ||
804 | |||
805 | /* Specialty mapping? */ | ||
806 | if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE)) | ||
807 | return 0; | ||
808 | |||
809 | /* Can the mapping track the dirty pages? */ | ||
810 | return vma->vm_file && vma->vm_file->f_mapping && | ||
811 | mapping_cap_account_dirty(vma->vm_file->f_mapping); | ||
812 | } | ||
813 | |||
805 | extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); | 814 | extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); |
806 | 815 | ||
807 | int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); | 816 | int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); |
@@ -879,6 +888,56 @@ extern void free_area_init(unsigned long * zones_size); | |||
879 | extern void free_area_init_node(int nid, pg_data_t *pgdat, | 888 | extern void free_area_init_node(int nid, pg_data_t *pgdat, |
880 | unsigned long * zones_size, unsigned long zone_start_pfn, | 889 | unsigned long * zones_size, unsigned long zone_start_pfn, |
881 | unsigned long *zholes_size); | 890 | unsigned long *zholes_size); |
891 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP | ||
892 | /* | ||
893 | * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its | ||
894 | * zones, allocate the backing mem_map and account for memory holes in a more | ||
895 | * architecture independent manner. This is a substitute for creating the | ||
896 | * zone_sizes[] and zholes_size[] arrays and passing them to | ||
897 | * free_area_init_node() | ||
898 | * | ||
899 | * An architecture is expected to register range of page frames backed by | ||
900 | * physical memory with add_active_range() before calling | ||
901 | * free_area_init_nodes() passing in the PFN each zone ends at. At a basic | ||
902 | * usage, an architecture is expected to do something like | ||
903 | * | ||
904 | * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn, | ||
905 | * max_highmem_pfn}; | ||
906 | * for_each_valid_physical_page_range() | ||
907 | * add_active_range(node_id, start_pfn, end_pfn) | ||
908 | * free_area_init_nodes(max_zone_pfns); | ||
909 | * | ||
910 | * If the architecture guarantees that there are no holes in the ranges | ||
911 | * registered with add_active_range(), free_bootmem_active_regions() | ||
912 | * will call free_bootmem_node() for each registered physical page range. | ||
913 | * Similarly sparse_memory_present_with_active_regions() calls | ||
914 | * memory_present() for each range when SPARSEMEM is enabled. | ||
915 | * | ||
916 | * See mm/page_alloc.c for more information on each function exposed by | ||
917 | * CONFIG_ARCH_POPULATES_NODE_MAP | ||
918 | */ | ||
919 | extern void free_area_init_nodes(unsigned long *max_zone_pfn); | ||
920 | extern void add_active_range(unsigned int nid, unsigned long start_pfn, | ||
921 | unsigned long end_pfn); | ||
922 | extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn, | ||
923 | unsigned long new_end_pfn); | ||
924 | extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn, | ||
925 | unsigned long end_pfn); | ||
926 | extern void remove_all_active_ranges(void); | ||
927 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, | ||
928 | unsigned long end_pfn); | ||
929 | extern void get_pfn_range_for_nid(unsigned int nid, | ||
930 | unsigned long *start_pfn, unsigned long *end_pfn); | ||
931 | extern unsigned long find_min_pfn_with_active_regions(void); | ||
932 | extern unsigned long find_max_pfn_with_active_regions(void); | ||
933 | extern void free_bootmem_with_active_regions(int nid, | ||
934 | unsigned long max_low_pfn); | ||
935 | extern void sparse_memory_present_with_active_regions(int nid); | ||
936 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
937 | extern int early_pfn_to_nid(unsigned long pfn); | ||
938 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | ||
939 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | ||
940 | extern void set_dma_reserve(unsigned long new_dma_reserve); | ||
882 | extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); | 941 | extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); |
883 | extern void setup_per_zone_pages_min(void); | 942 | extern void setup_per_zone_pages_min(void); |
884 | extern void mem_init(void); | 943 | extern void mem_init(void); |
@@ -1072,7 +1131,7 @@ void drop_slab(void); | |||
1072 | extern int randomize_va_space; | 1131 | extern int randomize_va_space; |
1073 | #endif | 1132 | #endif |
1074 | 1133 | ||
1075 | const char *arch_vma_name(struct vm_area_struct *vma); | 1134 | __attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma); |
1076 | 1135 | ||
1077 | #endif /* __KERNEL__ */ | 1136 | #endif /* __KERNEL__ */ |
1078 | #endif /* _LINUX_MM_H */ | 1137 | #endif /* _LINUX_MM_H */ |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h new file mode 100644 index 000000000000..c3852fd4a1cc --- /dev/null +++ b/include/linux/mm_types.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef _LINUX_MM_TYPES_H | ||
2 | #define _LINUX_MM_TYPES_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/list.h> | ||
7 | #include <linux/spinlock.h> | ||
8 | |||
9 | struct address_space; | ||
10 | |||
11 | /* | ||
12 | * Each physical page in the system has a struct page associated with | ||
13 | * it to keep track of whatever it is we are using the page for at the | ||
14 | * moment. Note that we have no way to track which tasks are using | ||
15 | * a page, though if it is a pagecache page, rmap structures can tell us | ||
16 | * who is mapping it. | ||
17 | */ | ||
18 | struct page { | ||
19 | unsigned long flags; /* Atomic flags, some possibly | ||
20 | * updated asynchronously */ | ||
21 | atomic_t _count; /* Usage count, see below. */ | ||
22 | atomic_t _mapcount; /* Count of ptes mapped in mms, | ||
23 | * to show when page is mapped | ||
24 | * & limit reverse map searches. | ||
25 | */ | ||
26 | union { | ||
27 | struct { | ||
28 | unsigned long private; /* Mapping-private opaque data: | ||
29 | * usually used for buffer_heads | ||
30 | * if PagePrivate set; used for | ||
31 | * swp_entry_t if PageSwapCache; | ||
32 | * indicates order in the buddy | ||
33 | * system if PG_buddy is set. | ||
34 | */ | ||
35 | struct address_space *mapping; /* If low bit clear, points to | ||
36 | * inode address_space, or NULL. | ||
37 | * If page mapped as anonymous | ||
38 | * memory, low bit is set, and | ||
39 | * it points to anon_vma object: | ||
40 | * see PAGE_MAPPING_ANON below. | ||
41 | */ | ||
42 | }; | ||
43 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | ||
44 | spinlock_t ptl; | ||
45 | #endif | ||
46 | }; | ||
47 | pgoff_t index; /* Our offset within mapping. */ | ||
48 | struct list_head lru; /* Pageout list, eg. active_list | ||
49 | * protected by zone->lru_lock ! | ||
50 | */ | ||
51 | /* | ||
52 | * On machines where all RAM is mapped into kernel address space, | ||
53 | * we can simply calculate the virtual address. On machines with | ||
54 | * highmem some memory is mapped into kernel virtual memory | ||
55 | * dynamically, so we need a place to store that address. | ||
56 | * Note that this field could be 16 bits on x86 ... ;) | ||
57 | * | ||
58 | * Architectures with slow multiplication can define | ||
59 | * WANT_PAGE_VIRTUAL in asm/page.h | ||
60 | */ | ||
61 | #if defined(WANT_PAGE_VIRTUAL) | ||
62 | void *virtual; /* Kernel virtual address (NULL if | ||
63 | not kmapped, ie. highmem) */ | ||
64 | #endif /* WANT_PAGE_VIRTUAL */ | ||
65 | }; | ||
66 | |||
67 | #endif /* _LINUX_MM_TYPES_H */ | ||
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index f45163c528e8..59855b8718a0 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -51,12 +51,14 @@ enum zone_stat_item { | |||
51 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. | 51 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. |
52 | only modified from process context */ | 52 | only modified from process context */ |
53 | NR_FILE_PAGES, | 53 | NR_FILE_PAGES, |
54 | NR_SLAB, /* Pages used by slab allocator */ | 54 | NR_SLAB_RECLAIMABLE, |
55 | NR_SLAB_UNRECLAIMABLE, | ||
55 | NR_PAGETABLE, /* used for pagetables */ | 56 | NR_PAGETABLE, /* used for pagetables */ |
56 | NR_FILE_DIRTY, | 57 | NR_FILE_DIRTY, |
57 | NR_WRITEBACK, | 58 | NR_WRITEBACK, |
58 | NR_UNSTABLE_NFS, /* NFS unstable pages */ | 59 | NR_UNSTABLE_NFS, /* NFS unstable pages */ |
59 | NR_BOUNCE, | 60 | NR_BOUNCE, |
61 | NR_VMSCAN_WRITE, | ||
60 | #ifdef CONFIG_NUMA | 62 | #ifdef CONFIG_NUMA |
61 | NUMA_HIT, /* allocated in intended node */ | 63 | NUMA_HIT, /* allocated in intended node */ |
62 | NUMA_MISS, /* allocated in non intended node */ | 64 | NUMA_MISS, /* allocated in non intended node */ |
@@ -88,53 +90,68 @@ struct per_cpu_pageset { | |||
88 | #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) | 90 | #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) |
89 | #endif | 91 | #endif |
90 | 92 | ||
91 | #define ZONE_DMA 0 | 93 | enum zone_type { |
92 | #define ZONE_DMA32 1 | 94 | /* |
93 | #define ZONE_NORMAL 2 | 95 | * ZONE_DMA is used when there are devices that are not able |
94 | #define ZONE_HIGHMEM 3 | 96 | * to do DMA to all of addressable memory (ZONE_NORMAL). Then we |
95 | 97 | * carve out the portion of memory that is needed for these devices. | |
96 | #define MAX_NR_ZONES 4 /* Sync this with ZONES_SHIFT */ | 98 | * The range is arch specific. |
97 | #define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ | 99 | * |
98 | 100 | * Some examples | |
101 | * | ||
102 | * Architecture Limit | ||
103 | * --------------------------- | ||
104 | * parisc, ia64, sparc <4G | ||
105 | * s390 <2G | ||
106 | * arm26 <48M | ||
107 | * arm Various | ||
108 | * alpha Unlimited or 0-16MB. | ||
109 | * | ||
110 | * i386, x86_64 and multiple other arches | ||
111 | * <16M. | ||
112 | */ | ||
113 | ZONE_DMA, | ||
114 | #ifdef CONFIG_ZONE_DMA32 | ||
115 | /* | ||
116 | * x86_64 needs two ZONE_DMAs because it supports devices that are | ||
117 | * only able to do DMA to the lower 16M but also 32 bit devices that | ||
118 | * can only do DMA areas below 4G. | ||
119 | */ | ||
120 | ZONE_DMA32, | ||
121 | #endif | ||
122 | /* | ||
123 | * Normal addressable memory is in ZONE_NORMAL. DMA operations can be | ||
124 | * performed on pages in ZONE_NORMAL if the DMA devices support | ||
125 | * transfers to all addressable memory. | ||
126 | */ | ||
127 | ZONE_NORMAL, | ||
128 | #ifdef CONFIG_HIGHMEM | ||
129 | /* | ||
130 | * A memory area that is only addressable by the kernel through | ||
131 | * mapping portions into its own address space. This is for example | ||
132 | * used by i386 to allow the kernel to address the memory beyond | ||
133 | * 900MB. The kernel will set up special mappings (page | ||
134 | * table entries on i386) for each page that the kernel needs to | ||
135 | * access. | ||
136 | */ | ||
137 | ZONE_HIGHMEM, | ||
138 | #endif | ||
139 | MAX_NR_ZONES | ||
140 | }; | ||
99 | 141 | ||
100 | /* | 142 | /* |
101 | * When a memory allocation must conform to specific limitations (such | 143 | * When a memory allocation must conform to specific limitations (such |
102 | * as being suitable for DMA) the caller will pass in hints to the | 144 | * as being suitable for DMA) the caller will pass in hints to the |
103 | * allocator in the gfp_mask, in the zone modifier bits. These bits | 145 | * allocator in the gfp_mask, in the zone modifier bits. These bits |
104 | * are used to select a priority ordered list of memory zones which | 146 | * are used to select a priority ordered list of memory zones which |
105 | * match the requested limits. GFP_ZONEMASK defines which bits within | 147 | * match the requested limits. See gfp_zone() in include/linux/gfp.h |
106 | * the gfp_mask should be considered as zone modifiers. Each valid | ||
107 | * combination of the zone modifier bits has a corresponding list | ||
108 | * of zones (in node_zonelists). Thus for two zone modifiers there | ||
109 | * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will | ||
110 | * be 8 (2 ** 3) zonelists. GFP_ZONETYPES defines the number of possible | ||
111 | * combinations of zone modifiers in "zone modifier space". | ||
112 | * | ||
113 | * As an optimisation any zone modifier bits which are only valid when | ||
114 | * no other zone modifier bits are set (loners) should be placed in | ||
115 | * the highest order bits of this field. This allows us to reduce the | ||
116 | * extent of the zonelists thus saving space. For example in the case | ||
117 | * of three zone modifier bits, we could require up to eight zonelists. | ||
118 | * If the left most zone modifier is a "loner" then the highest valid | ||
119 | * zonelist would be four allowing us to allocate only five zonelists. | ||
120 | * Use the first form for GFP_ZONETYPES when the left most bit is not | ||
121 | * a "loner", otherwise use the second. | ||
122 | * | ||
123 | * NOTE! Make sure this matches the zones in <linux/gfp.h> | ||
124 | */ | 148 | */ |
125 | #define GFP_ZONEMASK 0x07 | ||
126 | /* #define GFP_ZONETYPES (GFP_ZONEMASK + 1) */ /* Non-loner */ | ||
127 | #define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */ | ||
128 | 149 | ||
129 | /* | 150 | #if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM) |
130 | * On machines where it is needed (eg PCs) we divide physical memory | 151 | #define ZONES_SHIFT 1 |
131 | * into multiple physical zones. On a 32bit PC we have 4 zones: | 152 | #else |
132 | * | 153 | #define ZONES_SHIFT 2 |
133 | * ZONE_DMA < 16 MB ISA DMA capable memory | 154 | #endif |
134 | * ZONE_DMA32 0 MB Empty | ||
135 | * ZONE_NORMAL 16-896 MB direct mapped by the kernel | ||
136 | * ZONE_HIGHMEM > 896 MB only page cache and user processes | ||
137 | */ | ||
138 | 155 | ||
139 | struct zone { | 156 | struct zone { |
140 | /* Fields commonly accessed by the page allocator */ | 157 | /* Fields commonly accessed by the page allocator */ |
@@ -151,10 +168,12 @@ struct zone { | |||
151 | unsigned long lowmem_reserve[MAX_NR_ZONES]; | 168 | unsigned long lowmem_reserve[MAX_NR_ZONES]; |
152 | 169 | ||
153 | #ifdef CONFIG_NUMA | 170 | #ifdef CONFIG_NUMA |
171 | int node; | ||
154 | /* | 172 | /* |
155 | * zone reclaim becomes active if more unmapped pages exist. | 173 | * zone reclaim becomes active if more unmapped pages exist. |
156 | */ | 174 | */ |
157 | unsigned long min_unmapped_ratio; | 175 | unsigned long min_unmapped_pages; |
176 | unsigned long min_slab_pages; | ||
158 | struct per_cpu_pageset *pageset[NR_CPUS]; | 177 | struct per_cpu_pageset *pageset[NR_CPUS]; |
159 | #else | 178 | #else |
160 | struct per_cpu_pageset pageset[NR_CPUS]; | 179 | struct per_cpu_pageset pageset[NR_CPUS]; |
@@ -266,7 +285,6 @@ struct zone { | |||
266 | char *name; | 285 | char *name; |
267 | } ____cacheline_internodealigned_in_smp; | 286 | } ____cacheline_internodealigned_in_smp; |
268 | 287 | ||
269 | |||
270 | /* | 288 | /* |
271 | * The "priority" of VM scanning is how much of the queues we will scan in one | 289 | * The "priority" of VM scanning is how much of the queues we will scan in one |
272 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the | 290 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the |
@@ -289,6 +307,18 @@ struct zonelist { | |||
289 | struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited | 307 | struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited |
290 | }; | 308 | }; |
291 | 309 | ||
310 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP | ||
311 | struct node_active_region { | ||
312 | unsigned long start_pfn; | ||
313 | unsigned long end_pfn; | ||
314 | int nid; | ||
315 | }; | ||
316 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | ||
317 | |||
318 | #ifndef CONFIG_DISCONTIGMEM | ||
319 | /* The array of struct pages - for discontigmem use pgdat->lmem_map */ | ||
320 | extern struct page *mem_map; | ||
321 | #endif | ||
292 | 322 | ||
293 | /* | 323 | /* |
294 | * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM | 324 | * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM |
@@ -304,7 +334,7 @@ struct zonelist { | |||
304 | struct bootmem_data; | 334 | struct bootmem_data; |
305 | typedef struct pglist_data { | 335 | typedef struct pglist_data { |
306 | struct zone node_zones[MAX_NR_ZONES]; | 336 | struct zone node_zones[MAX_NR_ZONES]; |
307 | struct zonelist node_zonelists[GFP_ZONETYPES]; | 337 | struct zonelist node_zonelists[MAX_NR_ZONES]; |
308 | int nr_zones; | 338 | int nr_zones; |
309 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | 339 | #ifdef CONFIG_FLAT_NODE_MEM_MAP |
310 | struct page *node_mem_map; | 340 | struct page *node_mem_map; |
@@ -373,12 +403,16 @@ static inline int populated_zone(struct zone *zone) | |||
373 | return (!!zone->present_pages); | 403 | return (!!zone->present_pages); |
374 | } | 404 | } |
375 | 405 | ||
376 | static inline int is_highmem_idx(int idx) | 406 | static inline int is_highmem_idx(enum zone_type idx) |
377 | { | 407 | { |
408 | #ifdef CONFIG_HIGHMEM | ||
378 | return (idx == ZONE_HIGHMEM); | 409 | return (idx == ZONE_HIGHMEM); |
410 | #else | ||
411 | return 0; | ||
412 | #endif | ||
379 | } | 413 | } |
380 | 414 | ||
381 | static inline int is_normal_idx(int idx) | 415 | static inline int is_normal_idx(enum zone_type idx) |
382 | { | 416 | { |
383 | return (idx == ZONE_NORMAL); | 417 | return (idx == ZONE_NORMAL); |
384 | } | 418 | } |
@@ -391,7 +425,11 @@ static inline int is_normal_idx(int idx) | |||
391 | */ | 425 | */ |
392 | static inline int is_highmem(struct zone *zone) | 426 | static inline int is_highmem(struct zone *zone) |
393 | { | 427 | { |
428 | #ifdef CONFIG_HIGHMEM | ||
394 | return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; | 429 | return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; |
430 | #else | ||
431 | return 0; | ||
432 | #endif | ||
395 | } | 433 | } |
396 | 434 | ||
397 | static inline int is_normal(struct zone *zone) | 435 | static inline int is_normal(struct zone *zone) |
@@ -401,7 +439,11 @@ static inline int is_normal(struct zone *zone) | |||
401 | 439 | ||
402 | static inline int is_dma32(struct zone *zone) | 440 | static inline int is_dma32(struct zone *zone) |
403 | { | 441 | { |
442 | #ifdef CONFIG_ZONE_DMA32 | ||
404 | return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; | 443 | return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; |
444 | #else | ||
445 | return 0; | ||
446 | #endif | ||
405 | } | 447 | } |
406 | 448 | ||
407 | static inline int is_dma(struct zone *zone) | 449 | static inline int is_dma(struct zone *zone) |
@@ -421,6 +463,8 @@ int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file | |||
421 | void __user *, size_t *, loff_t *); | 463 | void __user *, size_t *, loff_t *); |
422 | int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int, | 464 | int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int, |
423 | struct file *, void __user *, size_t *, loff_t *); | 465 | struct file *, void __user *, size_t *, loff_t *); |
466 | int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, | ||
467 | struct file *, void __user *, size_t *, loff_t *); | ||
424 | 468 | ||
425 | #include <linux/topology.h> | 469 | #include <linux/topology.h> |
426 | /* Returns the number of the current Node. */ | 470 | /* Returns the number of the current Node. */ |
@@ -488,7 +532,8 @@ extern struct zone *next_zone(struct zone *zone); | |||
488 | 532 | ||
489 | #endif | 533 | #endif |
490 | 534 | ||
491 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | 535 | #if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ |
536 | !defined(CONFIG_ARCH_POPULATES_NODE_MAP) | ||
492 | #define early_pfn_to_nid(nid) (0UL) | 537 | #define early_pfn_to_nid(nid) (0UL) |
493 | #endif | 538 | #endif |
494 | 539 | ||
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index f7ca0b09075d..e0c393cc7240 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -308,4 +308,16 @@ struct input_device_id { | |||
308 | kernel_ulong_t driver_info; | 308 | kernel_ulong_t driver_info; |
309 | }; | 309 | }; |
310 | 310 | ||
311 | /* EISA */ | ||
312 | |||
313 | #define EISA_SIG_LEN 8 | ||
314 | |||
315 | /* The EISA signature, in ASCII form, null terminated */ | ||
316 | struct eisa_device_id { | ||
317 | char sig[EISA_SIG_LEN]; | ||
318 | kernel_ulong_t driver_data; | ||
319 | }; | ||
320 | |||
321 | #define EISA_DEVICE_MODALIAS_FMT "eisa:s%s" | ||
322 | |||
311 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 323 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 43289127b458..13d6d4eb8b3a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -334,7 +334,6 @@ struct net_device | |||
334 | 334 | ||
335 | 335 | ||
336 | struct net_device_stats* (*get_stats)(struct net_device *dev); | 336 | struct net_device_stats* (*get_stats)(struct net_device *dev); |
337 | struct iw_statistics* (*get_wireless_stats)(struct net_device *dev); | ||
338 | 337 | ||
339 | /* List of functions to handle Wireless Extensions (instead of ioctl). | 338 | /* List of functions to handle Wireless Extensions (instead of ioctl). |
340 | * See <net/iw_handler.h> for details. Jean II */ | 339 | * See <net/iw_handler.h> for details. Jean II */ |
@@ -1016,7 +1015,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | |||
1016 | } | 1015 | } |
1017 | 1016 | ||
1018 | /* On bonding slaves other than the currently active slave, suppress | 1017 | /* On bonding slaves other than the currently active slave, suppress |
1019 | * duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast. | 1018 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and |
1019 | * ARP on active-backup slaves with arp_validate enabled. | ||
1020 | */ | 1020 | */ |
1021 | static inline int skb_bond_should_drop(struct sk_buff *skb) | 1021 | static inline int skb_bond_should_drop(struct sk_buff *skb) |
1022 | { | 1022 | { |
@@ -1025,6 +1025,10 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
1025 | 1025 | ||
1026 | if (master && | 1026 | if (master && |
1027 | (dev->priv_flags & IFF_SLAVE_INACTIVE)) { | 1027 | (dev->priv_flags & IFF_SLAVE_INACTIVE)) { |
1028 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | ||
1029 | skb->protocol == __constant_htons(ETH_P_ARP)) | ||
1030 | return 0; | ||
1031 | |||
1028 | if (master->priv_flags & IFF_MASTER_ALB) { | 1032 | if (master->priv_flags & IFF_MASTER_ALB) { |
1029 | if (skb->pkt_type != PACKET_BROADCAST && | 1033 | if (skb->pkt_type != PACKET_BROADCAST && |
1030 | skb->pkt_type != PACKET_MULTICAST) | 1034 | skb->pkt_type != PACKET_MULTICAST) |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index 9a285cecf249..312bd2ffee33 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
@@ -10,6 +10,8 @@ header-y += xt_connmark.h | |||
10 | header-y += xt_CONNMARK.h | 10 | header-y += xt_CONNMARK.h |
11 | header-y += xt_conntrack.h | 11 | header-y += xt_conntrack.h |
12 | header-y += xt_dccp.h | 12 | header-y += xt_dccp.h |
13 | header-y += xt_dscp.h | ||
14 | header-y += xt_DSCP.h | ||
13 | header-y += xt_esp.h | 15 | header-y += xt_esp.h |
14 | header-y += xt_helper.h | 16 | header-y += xt_helper.h |
15 | header-y += xt_length.h | 17 | header-y += xt_length.h |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 36f5bcf513b0..98c9b9f667a5 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -315,10 +315,6 @@ extern void nfs_end_data_update(struct inode *); | |||
315 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 315 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
316 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 316 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
317 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); | 317 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); |
318 | extern struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent, | ||
319 | const struct dentry *dentry, | ||
320 | struct nfs_fh *fh, | ||
321 | struct nfs_fattr *fattr); | ||
322 | 318 | ||
323 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 319 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
324 | extern u32 root_nfs_parse_addr(char *name); /*__init*/ | 320 | extern u32 root_nfs_parse_addr(char *name); /*__init*/ |
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index f9edcd2ff3c8..31a3cb617ce0 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h | |||
@@ -269,14 +269,8 @@ fill_post_wcc(struct svc_fh *fhp) | |||
269 | fhp->fh_post_uid = inode->i_uid; | 269 | fhp->fh_post_uid = inode->i_uid; |
270 | fhp->fh_post_gid = inode->i_gid; | 270 | fhp->fh_post_gid = inode->i_gid; |
271 | fhp->fh_post_size = inode->i_size; | 271 | fhp->fh_post_size = inode->i_size; |
272 | if (inode->i_blksize) { | 272 | fhp->fh_post_blksize = BLOCK_SIZE; |
273 | fhp->fh_post_blksize = inode->i_blksize; | 273 | fhp->fh_post_blocks = inode->i_blocks; |
274 | fhp->fh_post_blocks = inode->i_blocks; | ||
275 | } else { | ||
276 | fhp->fh_post_blksize = BLOCK_SIZE; | ||
277 | /* how much do we care for accuracy with MinixFS? */ | ||
278 | fhp->fh_post_blocks = (inode->i_size+511) >> 9; | ||
279 | } | ||
280 | fhp->fh_post_rdev[0] = htonl((u32)imajor(inode)); | 274 | fhp->fh_post_rdev[0] = htonl((u32)imajor(inode)); |
281 | fhp->fh_post_rdev[1] = htonl((u32)iminor(inode)); | 275 | fhp->fh_post_rdev[1] = htonl((u32)iminor(inode)); |
282 | fhp->fh_post_atime = inode->i_atime; | 276 | fhp->fh_post_atime = inode->i_atime; |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 5748642e9f36..9d7921dd50f0 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -13,24 +13,25 @@ | |||
13 | * PG_reserved is set for special pages, which can never be swapped out. Some | 13 | * PG_reserved is set for special pages, which can never be swapped out. Some |
14 | * of them might not even exist (eg empty_bad_page)... | 14 | * of them might not even exist (eg empty_bad_page)... |
15 | * | 15 | * |
16 | * The PG_private bitflag is set if page->private contains a valid value. | 16 | * The PG_private bitflag is set on pagecache pages if they contain filesystem |
17 | * specific data (which is normally at page->private). It can be used by | ||
18 | * private allocations for its own usage. | ||
17 | * | 19 | * |
18 | * During disk I/O, PG_locked is used. This bit is set before I/O and | 20 | * During initiation of disk I/O, PG_locked is set. This bit is set before I/O |
19 | * reset when I/O completes. page_waitqueue(page) is a wait queue of all tasks | 21 | * and cleared when writeback _starts_ or when read _completes_. PG_writeback |
20 | * waiting for the I/O on this page to complete. | 22 | * is set before writeback starts and cleared when it finishes. |
23 | * | ||
24 | * PG_locked also pins a page in pagecache, and blocks truncation of the file | ||
25 | * while it is held. | ||
26 | * | ||
27 | * page_waitqueue(page) is a wait queue of all tasks waiting for the page | ||
28 | * to become unlocked. | ||
21 | * | 29 | * |
22 | * PG_uptodate tells whether the page's contents is valid. When a read | 30 | * PG_uptodate tells whether the page's contents is valid. When a read |
23 | * completes, the page becomes uptodate, unless a disk I/O error happened. | 31 | * completes, the page becomes uptodate, unless a disk I/O error happened. |
24 | * | 32 | * |
25 | * For choosing which pages to swap out, inode pages carry a PG_referenced bit, | 33 | * PG_referenced, PG_reclaim are used for page reclaim for anonymous and |
26 | * which is set any time the system accesses that page through the (mapping, | 34 | * file-backed pagecache (see mm/vmscan.c). |
27 | * index) hash table. This referenced bit, together with the referenced bit | ||
28 | * in the page tables, is used to manipulate page->age and move the page across | ||
29 | * the active, inactive_dirty and inactive_clean lists. | ||
30 | * | ||
31 | * Note that the referenced bit, the page->lru list_head and the active, | ||
32 | * inactive_dirty and inactive_clean lists are protected by the | ||
33 | * zone->lru_lock, and *NOT* by the usual PG_locked bit! | ||
34 | * | 35 | * |
35 | * PG_error is set to indicate that an I/O error occurred on this page. | 36 | * PG_error is set to indicate that an I/O error occurred on this page. |
36 | * | 37 | * |
@@ -42,6 +43,10 @@ | |||
42 | * space, they need to be kmapped separately for doing IO on the pages. The | 43 | * space, they need to be kmapped separately for doing IO on the pages. The |
43 | * struct page (these bits with information) are always mapped into kernel | 44 | * struct page (these bits with information) are always mapped into kernel |
44 | * address space... | 45 | * address space... |
46 | * | ||
47 | * PG_buddy is set to indicate that the page is free and in the buddy system | ||
48 | * (see mm/page_alloc.c). | ||
49 | * | ||
45 | */ | 50 | */ |
46 | 51 | ||
47 | /* | 52 | /* |
@@ -74,7 +79,7 @@ | |||
74 | #define PG_checked 8 /* kill me in 2.5.<early>. */ | 79 | #define PG_checked 8 /* kill me in 2.5.<early>. */ |
75 | #define PG_arch_1 9 | 80 | #define PG_arch_1 9 |
76 | #define PG_reserved 10 | 81 | #define PG_reserved 10 |
77 | #define PG_private 11 /* Has something at ->private */ | 82 | #define PG_private 11 /* If pagecache, has fs-private data */ |
78 | 83 | ||
79 | #define PG_writeback 12 /* Page is under writeback */ | 84 | #define PG_writeback 12 /* Page is under writeback */ |
80 | #define PG_nosave 13 /* Used for system suspend/resume */ | 85 | #define PG_nosave 13 /* Used for system suspend/resume */ |
@@ -83,7 +88,7 @@ | |||
83 | 88 | ||
84 | #define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ | 89 | #define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ |
85 | #define PG_reclaim 17 /* To be reclaimed asap */ | 90 | #define PG_reclaim 17 /* To be reclaimed asap */ |
86 | #define PG_nosave_free 18 /* Free, should not be written */ | 91 | #define PG_nosave_free 18 /* Used for system suspend/resume */ |
87 | #define PG_buddy 19 /* Page is free, on buddy lists */ | 92 | #define PG_buddy 19 /* Page is free, on buddy lists */ |
88 | 93 | ||
89 | 94 | ||
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 0a2f5d27f60e..64f950925151 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -130,14 +130,29 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma, | |||
130 | } | 130 | } |
131 | 131 | ||
132 | extern void FASTCALL(__lock_page(struct page *page)); | 132 | extern void FASTCALL(__lock_page(struct page *page)); |
133 | extern void FASTCALL(__lock_page_nosync(struct page *page)); | ||
133 | extern void FASTCALL(unlock_page(struct page *page)); | 134 | extern void FASTCALL(unlock_page(struct page *page)); |
134 | 135 | ||
136 | /* | ||
137 | * lock_page may only be called if we have the page's inode pinned. | ||
138 | */ | ||
135 | static inline void lock_page(struct page *page) | 139 | static inline void lock_page(struct page *page) |
136 | { | 140 | { |
137 | might_sleep(); | 141 | might_sleep(); |
138 | if (TestSetPageLocked(page)) | 142 | if (TestSetPageLocked(page)) |
139 | __lock_page(page); | 143 | __lock_page(page); |
140 | } | 144 | } |
145 | |||
146 | /* | ||
147 | * lock_page_nosync should only be used if we can't pin the page's inode. | ||
148 | * Doesn't play quite so well with block device plugging. | ||
149 | */ | ||
150 | static inline void lock_page_nosync(struct page *page) | ||
151 | { | ||
152 | might_sleep(); | ||
153 | if (TestSetPageLocked(page)) | ||
154 | __lock_page_nosync(page); | ||
155 | } | ||
141 | 156 | ||
142 | /* | 157 | /* |
143 | * This is exported only for wait_on_page_locked/wait_on_page_writeback. | 158 | * This is exported only for wait_on_page_locked/wait_on_page_writeback. |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 8565b81d7fbc..5c3a4176eb64 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/types.h> | 49 | #include <linux/types.h> |
50 | #include <linux/ioport.h> | 50 | #include <linux/ioport.h> |
51 | #include <linux/list.h> | 51 | #include <linux/list.h> |
52 | #include <linux/compiler.h> | ||
52 | #include <linux/errno.h> | 53 | #include <linux/errno.h> |
53 | #include <linux/device.h> | 54 | #include <linux/device.h> |
54 | 55 | ||
@@ -346,6 +347,8 @@ struct pci_driver { | |||
346 | int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ | 347 | int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ |
347 | void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ | 348 | void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ |
348 | int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ | 349 | int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ |
350 | int (*suspend_late) (struct pci_dev *dev, pm_message_t state); | ||
351 | int (*resume_early) (struct pci_dev *dev); | ||
349 | int (*resume) (struct pci_dev *dev); /* Device woken up */ | 352 | int (*resume) (struct pci_dev *dev); /* Device woken up */ |
350 | int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ | 353 | int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ |
351 | void (*shutdown) (struct pci_dev *dev); | 354 | void (*shutdown) (struct pci_dev *dev); |
@@ -353,6 +356,8 @@ struct pci_driver { | |||
353 | struct pci_error_handlers *err_handler; | 356 | struct pci_error_handlers *err_handler; |
354 | struct device_driver driver; | 357 | struct device_driver driver; |
355 | struct pci_dynids dynids; | 358 | struct pci_dynids dynids; |
359 | |||
360 | int multithread_probe; | ||
356 | }; | 361 | }; |
357 | 362 | ||
358 | #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) | 363 | #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) |
@@ -401,7 +406,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */ | |||
401 | extern struct list_head pci_devices; /* list of all devices */ | 406 | extern struct list_head pci_devices; /* list of all devices */ |
402 | 407 | ||
403 | void pcibios_fixup_bus(struct pci_bus *); | 408 | void pcibios_fixup_bus(struct pci_bus *); |
404 | int pcibios_enable_device(struct pci_dev *, int mask); | 409 | int __must_check pcibios_enable_device(struct pci_dev *, int mask); |
405 | char *pcibios_setup (char *str); | 410 | char *pcibios_setup (char *str); |
406 | 411 | ||
407 | /* Used only when drivers/pci/setup.c is used */ | 412 | /* Used only when drivers/pci/setup.c is used */ |
@@ -428,7 +433,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn); | |||
428 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); | 433 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); |
429 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 434 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
430 | unsigned int pci_scan_child_bus(struct pci_bus *bus); | 435 | unsigned int pci_scan_child_bus(struct pci_bus *bus); |
431 | void pci_bus_add_device(struct pci_dev *dev); | 436 | int __must_check pci_bus_add_device(struct pci_dev *dev); |
432 | void pci_read_bridge_bases(struct pci_bus *child); | 437 | void pci_read_bridge_bases(struct pci_bus *child); |
433 | struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); | 438 | struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); |
434 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); | 439 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); |
@@ -436,6 +441,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | |||
436 | extern void pci_dev_put(struct pci_dev *dev); | 441 | extern void pci_dev_put(struct pci_dev *dev); |
437 | extern void pci_remove_bus(struct pci_bus *b); | 442 | extern void pci_remove_bus(struct pci_bus *b); |
438 | extern void pci_remove_bus_device(struct pci_dev *dev); | 443 | extern void pci_remove_bus_device(struct pci_dev *dev); |
444 | extern void pci_stop_bus_device(struct pci_dev *dev); | ||
439 | void pci_setup_cardbus(struct pci_bus *bus); | 445 | void pci_setup_cardbus(struct pci_bus *bus); |
440 | 446 | ||
441 | /* Generic PCI functions exported to card drivers */ | 447 | /* Generic PCI functions exported to card drivers */ |
@@ -488,19 +494,19 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val | |||
488 | return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); | 494 | return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); |
489 | } | 495 | } |
490 | 496 | ||
491 | int pci_enable_device(struct pci_dev *dev); | 497 | int __must_check pci_enable_device(struct pci_dev *dev); |
492 | int pci_enable_device_bars(struct pci_dev *dev, int mask); | 498 | int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); |
493 | void pci_disable_device(struct pci_dev *dev); | 499 | void pci_disable_device(struct pci_dev *dev); |
494 | void pci_set_master(struct pci_dev *dev); | 500 | void pci_set_master(struct pci_dev *dev); |
495 | #define HAVE_PCI_SET_MWI | 501 | #define HAVE_PCI_SET_MWI |
496 | int pci_set_mwi(struct pci_dev *dev); | 502 | int __must_check pci_set_mwi(struct pci_dev *dev); |
497 | void pci_clear_mwi(struct pci_dev *dev); | 503 | void pci_clear_mwi(struct pci_dev *dev); |
498 | void pci_intx(struct pci_dev *dev, int enable); | 504 | void pci_intx(struct pci_dev *dev, int enable); |
499 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); | 505 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); |
500 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); | 506 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); |
501 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 507 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
502 | int pci_assign_resource(struct pci_dev *dev, int i); | 508 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
503 | int pci_assign_resource_fixed(struct pci_dev *dev, int i); | 509 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); |
504 | void pci_restore_bars(struct pci_dev *dev); | 510 | void pci_restore_bars(struct pci_dev *dev); |
505 | 511 | ||
506 | /* ROM control related routines */ | 512 | /* ROM control related routines */ |
@@ -526,23 +532,24 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *); | |||
526 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 532 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
527 | int (*)(struct pci_dev *, u8, u8)); | 533 | int (*)(struct pci_dev *, u8, u8)); |
528 | #define HAVE_PCI_REQ_REGIONS 2 | 534 | #define HAVE_PCI_REQ_REGIONS 2 |
529 | int pci_request_regions(struct pci_dev *, const char *); | 535 | int __must_check pci_request_regions(struct pci_dev *, const char *); |
530 | void pci_release_regions(struct pci_dev *); | 536 | void pci_release_regions(struct pci_dev *); |
531 | int pci_request_region(struct pci_dev *, int, const char *); | 537 | int __must_check pci_request_region(struct pci_dev *, int, const char *); |
532 | void pci_release_region(struct pci_dev *, int); | 538 | void pci_release_region(struct pci_dev *, int); |
533 | 539 | ||
534 | /* drivers/pci/bus.c */ | 540 | /* drivers/pci/bus.c */ |
535 | int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | 541 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, |
536 | resource_size_t size, resource_size_t align, | 542 | struct resource *res, resource_size_t size, |
537 | resource_size_t min, unsigned int type_mask, | 543 | resource_size_t align, resource_size_t min, |
538 | void (*alignf)(void *, struct resource *, | 544 | unsigned int type_mask, |
539 | resource_size_t, resource_size_t), | 545 | void (*alignf)(void *, struct resource *, |
540 | void *alignf_data); | 546 | resource_size_t, resource_size_t), |
547 | void *alignf_data); | ||
541 | void pci_enable_bridges(struct pci_bus *bus); | 548 | void pci_enable_bridges(struct pci_bus *bus); |
542 | 549 | ||
543 | /* Proper probing supporting hot-pluggable devices */ | 550 | /* Proper probing supporting hot-pluggable devices */ |
544 | int __pci_register_driver(struct pci_driver *, struct module *); | 551 | int __must_check __pci_register_driver(struct pci_driver *, struct module *); |
545 | static inline int pci_register_driver(struct pci_driver *driver) | 552 | static inline int __must_check pci_register_driver(struct pci_driver *driver) |
546 | { | 553 | { |
547 | return __pci_register_driver(driver, THIS_MODULE); | 554 | return __pci_register_driver(driver, THIS_MODULE); |
548 | } | 555 | } |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 6a1e09834559..ab032ceafa84 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1411,6 +1411,7 @@ | |||
1411 | #define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 | 1411 | #define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 |
1412 | #define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 | 1412 | #define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 |
1413 | #define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 | 1413 | #define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 |
1414 | #define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132 | ||
1414 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 | 1415 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 |
1415 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 | 1416 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 |
1416 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 | 1417 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 |
@@ -1482,9 +1483,6 @@ | |||
1482 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 | 1483 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 |
1483 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 | 1484 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 |
1484 | #define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 | 1485 | #define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 |
1485 | #define PCI_DEVICE_ID_MARVELL_GT96100 0x9652 | ||
1486 | #define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653 | ||
1487 | |||
1488 | 1486 | ||
1489 | #define PCI_VENDOR_ID_V3 0x11b0 | 1487 | #define PCI_VENDOR_ID_V3 0x11b0 |
1490 | #define PCI_DEVICE_ID_V3_V960 0x0001 | 1488 | #define PCI_DEVICE_ID_V3_V960 0x0001 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 96930cb5927c..7d0e26cba420 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -196,7 +196,7 @@ | |||
196 | #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ | 196 | #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ |
197 | #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ | 197 | #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ |
198 | #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ | 198 | #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ |
199 | #define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ | 199 | #define PCI_CAP_ID_HT 0x08 /* HyperTransport */ |
200 | #define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ | 200 | #define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ |
201 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ | 201 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ |
202 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ | 202 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ |
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index b44e01a70914..6cd91e3f9820 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h | |||
@@ -62,6 +62,12 @@ struct pcie_port_service_driver { | |||
62 | int (*suspend) (struct pcie_device *dev, pm_message_t state); | 62 | int (*suspend) (struct pcie_device *dev, pm_message_t state); |
63 | int (*resume) (struct pcie_device *dev); | 63 | int (*resume) (struct pcie_device *dev); |
64 | 64 | ||
65 | /* Service Error Recovery Handler */ | ||
66 | struct pci_error_handlers *err_handler; | ||
67 | |||
68 | /* Link Reset Capability - AER service driver specific */ | ||
69 | pci_ers_result_t (*reset_link) (struct pci_dev *dev); | ||
70 | |||
65 | const struct pcie_port_service_id *id_table; | 71 | const struct pcie_port_service_id *id_table; |
66 | struct device_driver driver; | 72 | struct device_driver driver; |
67 | }; | 73 | }; |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index cb9039a21f2a..3835a9642f13 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -1,9 +1,12 @@ | |||
1 | #ifndef __LINUX_PERCPU_H | 1 | #ifndef __LINUX_PERCPU_H |
2 | #define __LINUX_PERCPU_H | 2 | #define __LINUX_PERCPU_H |
3 | |||
3 | #include <linux/spinlock.h> /* For preempt_disable() */ | 4 | #include <linux/spinlock.h> /* For preempt_disable() */ |
4 | #include <linux/slab.h> /* For kmalloc() */ | 5 | #include <linux/slab.h> /* For kmalloc() */ |
5 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
6 | #include <linux/string.h> /* For memset() */ | 7 | #include <linux/string.h> /* For memset() */ |
8 | #include <linux/cpumask.h> | ||
9 | |||
7 | #include <asm/percpu.h> | 10 | #include <asm/percpu.h> |
8 | 11 | ||
9 | /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ | 12 | /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ |
@@ -11,8 +14,14 @@ | |||
11 | #define PERCPU_ENOUGH_ROOM 32768 | 14 | #define PERCPU_ENOUGH_ROOM 32768 |
12 | #endif | 15 | #endif |
13 | 16 | ||
14 | /* Must be an lvalue. */ | 17 | /* |
15 | #define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); })) | 18 | * Must be an lvalue. Since @var must be a simple identifier, |
19 | * we force a syntax error here if it isn't. | ||
20 | */ | ||
21 | #define get_cpu_var(var) (*({ \ | ||
22 | extern int simple_indentifier_##var(void); \ | ||
23 | preempt_disable(); \ | ||
24 | &__get_cpu_var(var); })) | ||
16 | #define put_cpu_var(var) preempt_enable() | 25 | #define put_cpu_var(var) preempt_enable() |
17 | 26 | ||
18 | #ifdef CONFIG_SMP | 27 | #ifdef CONFIG_SMP |
@@ -21,39 +30,77 @@ struct percpu_data { | |||
21 | void *ptrs[NR_CPUS]; | 30 | void *ptrs[NR_CPUS]; |
22 | }; | 31 | }; |
23 | 32 | ||
33 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) | ||
24 | /* | 34 | /* |
25 | * Use this to get to a cpu's version of the per-cpu object allocated using | 35 | * Use this to get to a cpu's version of the per-cpu object dynamically |
26 | * alloc_percpu. Non-atomic access to the current CPU's version should | 36 | * allocated. Non-atomic access to the current CPU's version should |
27 | * probably be combined with get_cpu()/put_cpu(). | 37 | * probably be combined with get_cpu()/put_cpu(). |
28 | */ | 38 | */ |
29 | #define per_cpu_ptr(ptr, cpu) \ | 39 | #define percpu_ptr(ptr, cpu) \ |
30 | ({ \ | 40 | ({ \ |
31 | struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \ | 41 | struct percpu_data *__p = __percpu_disguise(ptr); \ |
32 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ | 42 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ |
33 | }) | 43 | }) |
34 | 44 | ||
35 | extern void *__alloc_percpu(size_t size); | 45 | extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu); |
36 | extern void free_percpu(const void *); | 46 | extern void percpu_depopulate(void *__pdata, int cpu); |
47 | extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, | ||
48 | cpumask_t *mask); | ||
49 | extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask); | ||
50 | extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); | ||
51 | extern void percpu_free(void *__pdata); | ||
37 | 52 | ||
38 | #else /* CONFIG_SMP */ | 53 | #else /* CONFIG_SMP */ |
39 | 54 | ||
40 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | 55 | #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) |
56 | |||
57 | static inline void percpu_depopulate(void *__pdata, int cpu) | ||
58 | { | ||
59 | } | ||
60 | |||
61 | static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask) | ||
62 | { | ||
63 | } | ||
41 | 64 | ||
42 | static inline void *__alloc_percpu(size_t size) | 65 | static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, |
66 | int cpu) | ||
43 | { | 67 | { |
44 | void *ret = kmalloc(size, GFP_KERNEL); | 68 | return percpu_ptr(__pdata, cpu); |
45 | if (ret) | ||
46 | memset(ret, 0, size); | ||
47 | return ret; | ||
48 | } | 69 | } |
49 | static inline void free_percpu(const void *ptr) | 70 | |
50 | { | 71 | static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, |
51 | kfree(ptr); | 72 | cpumask_t *mask) |
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) | ||
78 | { | ||
79 | return kzalloc(size, gfp); | ||
80 | } | ||
81 | |||
82 | static inline void percpu_free(void *__pdata) | ||
83 | { | ||
84 | kfree(__pdata); | ||
52 | } | 85 | } |
53 | 86 | ||
54 | #endif /* CONFIG_SMP */ | 87 | #endif /* CONFIG_SMP */ |
55 | 88 | ||
56 | /* Simple wrapper for the common case: zeros memory. */ | 89 | #define percpu_populate_mask(__pdata, size, gfp, mask) \ |
57 | #define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type)))) | 90 | __percpu_populate_mask((__pdata), (size), (gfp), &(mask)) |
91 | #define percpu_depopulate_mask(__pdata, mask) \ | ||
92 | __percpu_depopulate_mask((__pdata), &(mask)) | ||
93 | #define percpu_alloc_mask(size, gfp, mask) \ | ||
94 | __percpu_alloc_mask((size), (gfp), &(mask)) | ||
95 | |||
96 | #define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map) | ||
97 | |||
98 | /* (legacy) interface for use without CPU hotplug handling */ | ||
99 | |||
100 | #define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \ | ||
101 | cpu_possible_map) | ||
102 | #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type)) | ||
103 | #define free_percpu(ptr) percpu_free((ptr)) | ||
104 | #define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu)) | ||
58 | 105 | ||
59 | #endif /* __LINUX_PERCPU_H */ | 106 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/pid.h b/include/linux/pid.h index 29960b03bef7..93da7e2d9f30 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
@@ -76,6 +76,8 @@ extern int FASTCALL(attach_pid(struct task_struct *task, | |||
76 | enum pid_type type, int nr)); | 76 | enum pid_type type, int nr)); |
77 | 77 | ||
78 | extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); | 78 | extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); |
79 | extern void FASTCALL(transfer_pid(struct task_struct *old, | ||
80 | struct task_struct *new, enum pid_type)); | ||
79 | 81 | ||
80 | /* | 82 | /* |
81 | * look up a PID in the hash table. Must be called with the tasklist_lock | 83 | * look up a PID in the hash table. Must be called with the tasklist_lock |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 782090c68932..29cd6dee13db 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -49,6 +49,8 @@ struct platform_driver { | |||
49 | int (*remove)(struct platform_device *); | 49 | int (*remove)(struct platform_device *); |
50 | void (*shutdown)(struct platform_device *); | 50 | void (*shutdown)(struct platform_device *); |
51 | int (*suspend)(struct platform_device *, pm_message_t state); | 51 | int (*suspend)(struct platform_device *, pm_message_t state); |
52 | int (*suspend_late)(struct platform_device *, pm_message_t state); | ||
53 | int (*resume_early)(struct platform_device *); | ||
52 | int (*resume)(struct platform_device *); | 54 | int (*resume)(struct platform_device *); |
53 | struct device_driver driver; | 55 | struct device_driver driver; |
54 | }; | 56 | }; |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 658c1b93d5bb..6b27e07aef19 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -142,29 +142,61 @@ typedef struct pm_message { | |||
142 | } pm_message_t; | 142 | } pm_message_t; |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * There are 4 important states driver can be in: | 145 | * Several driver power state transitions are externally visible, affecting |
146 | * ON -- driver is working | 146 | * the state of pending I/O queues and (for drivers that touch hardware) |
147 | * FREEZE -- stop operations and apply whatever policy is applicable to a | 147 | * interrupts, wakeups, DMA, and other hardware state. There may also be |
148 | * suspended driver of that class, freeze queues for block like IDE | 148 | * internal transitions to various low power modes, which are transparent |
149 | * does, drop packets for ethernet, etc... stop DMA engine too etc... | 149 | * to the rest of the driver stack (such as a driver that's ON gating off |
150 | * so a consistent image can be saved; but do not power any hardware | 150 | * clocks which are not in active use). |
151 | * down. | ||
152 | * SUSPEND - like FREEZE, but hardware is doing as much powersaving as | ||
153 | * possible. Roughly pci D3. | ||
154 | * | 151 | * |
155 | * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3 | 152 | * One transition is triggered by resume(), after a suspend() call; the |
156 | * (SUSPEND). We'll need to fix the drivers. So yes, putting 3 to all different | 153 | * message is implicit: |
157 | * defines is intentional, and will go away as soon as drivers are fixed. Also | 154 | * |
158 | * note that typedef is neccessary, we'll probably want to switch to | 155 | * ON Driver starts working again, responding to hardware events |
159 | * typedef struct pm_message_t { int event; int flags; } pm_message_t | 156 | * and software requests. The hardware may have gone through |
160 | * or something similar soon. | 157 | * a power-off reset, or it may have maintained state from the |
158 | * previous suspend() which the driver will rely on while | ||
159 | * resuming. On most platforms, there are no restrictions on | ||
160 | * availability of resources like clocks during resume(). | ||
161 | * | ||
162 | * Other transitions are triggered by messages sent using suspend(). All | ||
163 | * these transitions quiesce the driver, so that I/O queues are inactive. | ||
164 | * That commonly entails turning off IRQs and DMA; there may be rules | ||
165 | * about how to quiesce that are specific to the bus or the device's type. | ||
166 | * (For example, network drivers mark the link state.) Other details may | ||
167 | * differ according to the message: | ||
168 | * | ||
169 | * SUSPEND Quiesce, enter a low power device state appropriate for | ||
170 | * the upcoming system state (such as PCI_D3hot), and enable | ||
171 | * wakeup events as appropriate. | ||
172 | * | ||
173 | * FREEZE Quiesce operations so that a consistent image can be saved; | ||
174 | * but do NOT otherwise enter a low power device state, and do | ||
175 | * NOT emit system wakeup events. | ||
176 | * | ||
177 | * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring | ||
178 | * the system from a snapshot taken after an earlier FREEZE. | ||
179 | * Some drivers will need to reset their hardware state instead | ||
180 | * of preserving it, to ensure that it's never mistaken for the | ||
181 | * state which that earlier snapshot had set up. | ||
182 | * | ||
183 | * A minimally power-aware driver treats all messages as SUSPEND, fully | ||
184 | * reinitializes its device during resume() -- whether or not it was reset | ||
185 | * during the suspend/resume cycle -- and can't issue wakeup events. | ||
186 | * | ||
187 | * More power-aware drivers may also use low power states at runtime as | ||
188 | * well as during system sleep states like PM_SUSPEND_STANDBY. They may | ||
189 | * be able to use wakeup events to exit from runtime low-power states, | ||
190 | * or from system low-power states such as standby or suspend-to-RAM. | ||
161 | */ | 191 | */ |
162 | 192 | ||
163 | #define PM_EVENT_ON 0 | 193 | #define PM_EVENT_ON 0 |
164 | #define PM_EVENT_FREEZE 1 | 194 | #define PM_EVENT_FREEZE 1 |
165 | #define PM_EVENT_SUSPEND 2 | 195 | #define PM_EVENT_SUSPEND 2 |
196 | #define PM_EVENT_PRETHAW 3 | ||
166 | 197 | ||
167 | #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) | 198 | #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) |
199 | #define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, }) | ||
168 | #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) | 200 | #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) |
169 | #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) | 201 | #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) |
170 | 202 | ||
@@ -190,6 +222,7 @@ extern void device_resume(void); | |||
190 | extern suspend_disk_method_t pm_disk_mode; | 222 | extern suspend_disk_method_t pm_disk_mode; |
191 | 223 | ||
192 | extern int device_suspend(pm_message_t state); | 224 | extern int device_suspend(pm_message_t state); |
225 | extern int device_prepare_suspend(pm_message_t state); | ||
193 | 226 | ||
194 | #define device_set_wakeup_enable(dev,val) \ | 227 | #define device_set_wakeup_enable(dev,val) \ |
195 | ((dev)->power.should_wakeup = !!(val)) | 228 | ((dev)->power.should_wakeup = !!(val)) |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 3435ca38dd14..57f70bc8b24b 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -268,7 +268,9 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode) | |||
268 | struct proc_maps_private { | 268 | struct proc_maps_private { |
269 | struct pid *pid; | 269 | struct pid *pid; |
270 | struct task_struct *task; | 270 | struct task_struct *task; |
271 | #ifdef CONFIG_MMU | ||
271 | struct vm_area_struct *tail_vma; | 272 | struct vm_area_struct *tail_vma; |
273 | #endif | ||
272 | }; | 274 | }; |
273 | 275 | ||
274 | #endif /* _LINUX_PROC_FS_H */ | 276 | #endif /* _LINUX_PROC_FS_H */ |
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h index a376bd4ade39..81e9299ca148 100644 --- a/include/linux/resume-trace.h +++ b/include/linux/resume-trace.h | |||
@@ -3,21 +3,25 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_PM_TRACE | 4 | #ifdef CONFIG_PM_TRACE |
5 | 5 | ||
6 | extern int pm_trace_enabled; | ||
7 | |||
6 | struct device; | 8 | struct device; |
7 | extern void set_trace_device(struct device *); | 9 | extern void set_trace_device(struct device *); |
8 | extern void generate_resume_trace(void *tracedata, unsigned int user); | 10 | extern void generate_resume_trace(void *tracedata, unsigned int user); |
9 | 11 | ||
10 | #define TRACE_DEVICE(dev) set_trace_device(dev) | 12 | #define TRACE_DEVICE(dev) set_trace_device(dev) |
11 | #define TRACE_RESUME(user) do { \ | 13 | #define TRACE_RESUME(user) do { \ |
12 | void *tracedata; \ | 14 | if (pm_trace_enabled) { \ |
13 | asm volatile("movl $1f,%0\n" \ | 15 | void *tracedata; \ |
14 | ".section .tracedata,\"a\"\n" \ | 16 | asm volatile("movl $1f,%0\n" \ |
15 | "1:\t.word %c1\n" \ | 17 | ".section .tracedata,\"a\"\n" \ |
16 | "\t.long %c2\n" \ | 18 | "1:\t.word %c1\n" \ |
17 | ".previous" \ | 19 | "\t.long %c2\n" \ |
18 | :"=r" (tracedata) \ | 20 | ".previous" \ |
19 | : "i" (__LINE__), "i" (__FILE__)); \ | 21 | :"=r" (tracedata) \ |
20 | generate_resume_trace(tracedata, user); \ | 22 | : "i" (__LINE__), "i" (__FILE__)); \ |
23 | generate_resume_trace(tracedata, user); \ | ||
24 | } \ | ||
21 | } while (0) | 25 | } while (0) |
22 | 26 | ||
23 | #else | 27 | #else |
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index bf97b0900014..db2c1df4fef9 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -103,6 +103,14 @@ pte_t *page_check_address(struct page *, struct mm_struct *, | |||
103 | */ | 103 | */ |
104 | unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); | 104 | unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); |
105 | 105 | ||
106 | /* | ||
107 | * Cleans the PTEs of shared mappings. | ||
108 | * (and since clean PTEs should also be readonly, write protects them too) | ||
109 | * | ||
110 | * returns the number of cleaned PTEs. | ||
111 | */ | ||
112 | int page_mkclean(struct page *); | ||
113 | |||
106 | #else /* !CONFIG_MMU */ | 114 | #else /* !CONFIG_MMU */ |
107 | 115 | ||
108 | #define anon_vma_init() do {} while (0) | 116 | #define anon_vma_init() do {} while (0) |
@@ -112,6 +120,12 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); | |||
112 | #define page_referenced(page,l) TestClearPageReferenced(page) | 120 | #define page_referenced(page,l) TestClearPageReferenced(page) |
113 | #define try_to_unmap(page, refs) SWAP_FAIL | 121 | #define try_to_unmap(page, refs) SWAP_FAIL |
114 | 122 | ||
123 | static inline int page_mkclean(struct page *page) | ||
124 | { | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | |||
115 | #endif /* CONFIG_MMU */ | 129 | #endif /* CONFIG_MMU */ |
116 | 130 | ||
117 | /* | 131 | /* |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 34ed0d99b1bd..9d4aa7f95bc8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -819,6 +819,11 @@ struct task_struct { | |||
819 | unsigned did_exec:1; | 819 | unsigned did_exec:1; |
820 | pid_t pid; | 820 | pid_t pid; |
821 | pid_t tgid; | 821 | pid_t tgid; |
822 | |||
823 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
824 | /* Canary value for the -fstack-protector gcc feature */ | ||
825 | unsigned long stack_canary; | ||
826 | #endif | ||
822 | /* | 827 | /* |
823 | * pointers to (original) parent process, youngest child, younger sibling, | 828 | * pointers to (original) parent process, youngest child, younger sibling, |
824 | * older sibling, respectively. (p->father can be replaced with | 829 | * older sibling, respectively. (p->father can be replaced with |
@@ -865,6 +870,15 @@ struct task_struct { | |||
865 | struct key *thread_keyring; /* keyring private to this thread */ | 870 | struct key *thread_keyring; /* keyring private to this thread */ |
866 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ | 871 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ |
867 | #endif | 872 | #endif |
873 | /* | ||
874 | * fpu_counter contains the number of consecutive context switches | ||
875 | * that the FPU is used. If this is over a threshold, the lazy fpu | ||
876 | * saving becomes unlazy to save the trap. This is an unsigned char | ||
877 | * so that after 256 times the counter wraps and the behavior turns | ||
878 | * lazy again; this to deal with bursty apps that only use FPU for | ||
879 | * a short time | ||
880 | */ | ||
881 | unsigned char fpu_counter; | ||
868 | int oomkilladj; /* OOM kill score adjustment (bit shift). */ | 882 | int oomkilladj; /* OOM kill score adjustment (bit shift). */ |
869 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 883 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
870 | - access with [gs]et_task_comm (which lock | 884 | - access with [gs]et_task_comm (which lock |
diff --git a/include/linux/selinux.h b/include/linux/selinux.h index aad4e390d6a5..d1b7ca6c1c57 100644 --- a/include/linux/selinux.h +++ b/include/linux/selinux.h | |||
@@ -46,7 +46,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule); | |||
46 | 46 | ||
47 | /** | 47 | /** |
48 | * selinux_audit_rule_match - determine if a context ID matches a rule. | 48 | * selinux_audit_rule_match - determine if a context ID matches a rule. |
49 | * @ctxid: the context ID to check | 49 | * @sid: the context ID to check |
50 | * @field: the field this rule refers to | 50 | * @field: the field this rule refers to |
51 | * @op: the operater the rule uses | 51 | * @op: the operater the rule uses |
52 | * @rule: pointer to the audit rule to check against | 52 | * @rule: pointer to the audit rule to check against |
@@ -55,7 +55,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule); | |||
55 | * Returns 1 if the context id matches the rule, 0 if it does not, and | 55 | * Returns 1 if the context id matches the rule, 0 if it does not, and |
56 | * -errno on failure. | 56 | * -errno on failure. |
57 | */ | 57 | */ |
58 | int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, | 58 | int selinux_audit_rule_match(u32 sid, u32 field, u32 op, |
59 | struct selinux_audit_rule *rule, | 59 | struct selinux_audit_rule *rule, |
60 | struct audit_context *actx); | 60 | struct audit_context *actx); |
61 | 61 | ||
@@ -70,18 +70,8 @@ int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, | |||
70 | void selinux_audit_set_callback(int (*callback)(void)); | 70 | void selinux_audit_set_callback(int (*callback)(void)); |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * selinux_task_ctxid - determine a context ID for a process. | 73 | * selinux_sid_to_string - map a security context ID to a string |
74 | * @tsk: the task object | 74 | * @sid: security context ID to be converted. |
75 | * @ctxid: ID value returned via this | ||
76 | * | ||
77 | * On return, ctxid will contain an ID for the context. This value | ||
78 | * should only be used opaquely. | ||
79 | */ | ||
80 | void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid); | ||
81 | |||
82 | /** | ||
83 | * selinux_ctxid_to_string - map a security context ID to a string | ||
84 | * @ctxid: security context ID to be converted. | ||
85 | * @ctx: address of context string to be returned | 75 | * @ctx: address of context string to be returned |
86 | * @ctxlen: length of returned context string. | 76 | * @ctxlen: length of returned context string. |
87 | * | 77 | * |
@@ -89,7 +79,7 @@ void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid); | |||
89 | * string will be allocated internally, and the caller must call | 79 | * string will be allocated internally, and the caller must call |
90 | * kfree() on it after use. | 80 | * kfree() on it after use. |
91 | */ | 81 | */ |
92 | int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen); | 82 | int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen); |
93 | 83 | ||
94 | /** | 84 | /** |
95 | * selinux_get_inode_sid - get the inode's security context ID | 85 | * selinux_get_inode_sid - get the inode's security context ID |
@@ -154,7 +144,7 @@ static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule) | |||
154 | return; | 144 | return; |
155 | } | 145 | } |
156 | 146 | ||
157 | static inline int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, | 147 | static inline int selinux_audit_rule_match(u32 sid, u32 field, u32 op, |
158 | struct selinux_audit_rule *rule, | 148 | struct selinux_audit_rule *rule, |
159 | struct audit_context *actx) | 149 | struct audit_context *actx) |
160 | { | 150 | { |
@@ -166,12 +156,7 @@ static inline void selinux_audit_set_callback(int (*callback)(void)) | |||
166 | return; | 156 | return; |
167 | } | 157 | } |
168 | 158 | ||
169 | static inline void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid) | 159 | static inline int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen) |
170 | { | ||
171 | *ctxid = 0; | ||
172 | } | ||
173 | |||
174 | static inline int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen) | ||
175 | { | 160 | { |
176 | *ctx = NULL; | 161 | *ctx = NULL; |
177 | *ctxlen = 0; | 162 | *ctxlen = 0; |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 45ad55b70d1c..a96fd9310d55 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -60,14 +60,13 @@ extern void __init kmem_cache_init(void); | |||
60 | extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, | 60 | extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, |
61 | void (*)(void *, kmem_cache_t *, unsigned long), | 61 | void (*)(void *, kmem_cache_t *, unsigned long), |
62 | void (*)(void *, kmem_cache_t *, unsigned long)); | 62 | void (*)(void *, kmem_cache_t *, unsigned long)); |
63 | extern int kmem_cache_destroy(kmem_cache_t *); | 63 | extern void kmem_cache_destroy(kmem_cache_t *); |
64 | extern int kmem_cache_shrink(kmem_cache_t *); | 64 | extern int kmem_cache_shrink(kmem_cache_t *); |
65 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); | 65 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); |
66 | extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | 66 | extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); |
67 | extern void kmem_cache_free(kmem_cache_t *, void *); | 67 | extern void kmem_cache_free(kmem_cache_t *, void *); |
68 | extern unsigned int kmem_cache_size(kmem_cache_t *); | 68 | extern unsigned int kmem_cache_size(kmem_cache_t *); |
69 | extern const char *kmem_cache_name(kmem_cache_t *); | 69 | extern const char *kmem_cache_name(kmem_cache_t *); |
70 | extern kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags); | ||
71 | 70 | ||
72 | /* Size description struct for general caches. */ | 71 | /* Size description struct for general caches. */ |
73 | struct cache_sizes { | 72 | struct cache_sizes { |
@@ -203,7 +202,30 @@ extern int slab_is_available(void); | |||
203 | 202 | ||
204 | #ifdef CONFIG_NUMA | 203 | #ifdef CONFIG_NUMA |
205 | extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); | 204 | extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); |
206 | extern void *kmalloc_node(size_t size, gfp_t flags, int node); | 205 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); |
206 | |||
207 | static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | ||
208 | { | ||
209 | if (__builtin_constant_p(size)) { | ||
210 | int i = 0; | ||
211 | #define CACHE(x) \ | ||
212 | if (size <= x) \ | ||
213 | goto found; \ | ||
214 | else \ | ||
215 | i++; | ||
216 | #include "kmalloc_sizes.h" | ||
217 | #undef CACHE | ||
218 | { | ||
219 | extern void __you_cannot_kmalloc_that_much(void); | ||
220 | __you_cannot_kmalloc_that_much(); | ||
221 | } | ||
222 | found: | ||
223 | return kmem_cache_alloc_node((flags & GFP_DMA) ? | ||
224 | malloc_sizes[i].cs_dmacachep : | ||
225 | malloc_sizes[i].cs_cachep, flags, node); | ||
226 | } | ||
227 | return __kmalloc_node(size, flags, node); | ||
228 | } | ||
207 | #else | 229 | #else |
208 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) | 230 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) |
209 | { | 231 | { |
@@ -223,12 +245,11 @@ extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr)); | |||
223 | /* SLOB allocator routines */ | 245 | /* SLOB allocator routines */ |
224 | 246 | ||
225 | void kmem_cache_init(void); | 247 | void kmem_cache_init(void); |
226 | struct kmem_cache *kmem_find_general_cachep(size_t, gfp_t gfpflags); | ||
227 | struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, | 248 | struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, |
228 | unsigned long, | 249 | unsigned long, |
229 | void (*)(void *, struct kmem_cache *, unsigned long), | 250 | void (*)(void *, struct kmem_cache *, unsigned long), |
230 | void (*)(void *, struct kmem_cache *, unsigned long)); | 251 | void (*)(void *, struct kmem_cache *, unsigned long)); |
231 | int kmem_cache_destroy(struct kmem_cache *c); | 252 | void kmem_cache_destroy(struct kmem_cache *c); |
232 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); | 253 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); |
233 | void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | 254 | void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); |
234 | void kmem_cache_free(struct kmem_cache *c, void *b); | 255 | void kmem_cache_free(struct kmem_cache *c, void *b); |
@@ -263,8 +284,6 @@ extern kmem_cache_t *fs_cachep; | |||
263 | extern kmem_cache_t *sighand_cachep; | 284 | extern kmem_cache_t *sighand_cachep; |
264 | extern kmem_cache_t *bio_cachep; | 285 | extern kmem_cache_t *bio_cachep; |
265 | 286 | ||
266 | extern atomic_t slab_reclaim_pages; | ||
267 | |||
268 | #endif /* __KERNEL__ */ | 287 | #endif /* __KERNEL__ */ |
269 | 288 | ||
270 | #endif /* _LINUX_SLAB_H */ | 289 | #endif /* _LINUX_SLAB_H */ |
diff --git a/include/linux/smb.h b/include/linux/smb.h index 6df3b1501559..f098dff93f6b 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h | |||
@@ -89,7 +89,6 @@ struct smb_fattr { | |||
89 | struct timespec f_atime; | 89 | struct timespec f_atime; |
90 | struct timespec f_mtime; | 90 | struct timespec f_mtime; |
91 | struct timespec f_ctime; | 91 | struct timespec f_ctime; |
92 | unsigned long f_blksize; | ||
93 | unsigned long f_blocks; | 92 | unsigned long f_blocks; |
94 | int f_unix; | 93 | int f_unix; |
95 | }; | 94 | }; |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 837e8bce1349..51649987f691 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -53,6 +53,9 @@ extern void smp_cpus_done(unsigned int max_cpus); | |||
53 | */ | 53 | */ |
54 | int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); | 54 | int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); |
55 | 55 | ||
56 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | ||
57 | int retry, int wait); | ||
58 | |||
56 | /* | 59 | /* |
57 | * Call a function on all processors | 60 | * Call a function on all processors |
58 | */ | 61 | */ |
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 9cc81e572224..50e2b01e517c 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h | |||
@@ -5,15 +5,16 @@ | |||
5 | struct stack_trace { | 5 | struct stack_trace { |
6 | unsigned int nr_entries, max_entries; | 6 | unsigned int nr_entries, max_entries; |
7 | unsigned long *entries; | 7 | unsigned long *entries; |
8 | int skip; /* input argument: How many entries to skip */ | ||
9 | int all_contexts; /* input argument: if true do than one stack */ | ||
8 | }; | 10 | }; |
9 | 11 | ||
10 | extern void save_stack_trace(struct stack_trace *trace, | 12 | extern void save_stack_trace(struct stack_trace *trace, |
11 | struct task_struct *task, int all_contexts, | 13 | struct task_struct *task); |
12 | unsigned int skip); | ||
13 | 14 | ||
14 | extern void print_stack_trace(struct stack_trace *trace, int spaces); | 15 | extern void print_stack_trace(struct stack_trace *trace, int spaces); |
15 | #else | 16 | #else |
16 | # define save_stack_trace(trace, task, all, skip) do { } while (0) | 17 | # define save_stack_trace(trace, task) do { } while (0) |
17 | # define print_stack_trace(trace) do { } while (0) | 18 | # define print_stack_trace(trace) do { } while (0) |
18 | #endif | 19 | #endif |
19 | 20 | ||
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 96e31aa64cc7..b1237f16ecde 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -10,29 +10,11 @@ | |||
10 | #include <linux/pm.h> | 10 | #include <linux/pm.h> |
11 | 11 | ||
12 | /* page backup entry */ | 12 | /* page backup entry */ |
13 | typedef struct pbe { | 13 | struct pbe { |
14 | unsigned long address; /* address of the copy */ | 14 | unsigned long address; /* address of the copy */ |
15 | unsigned long orig_address; /* original address of page */ | 15 | unsigned long orig_address; /* original address of page */ |
16 | struct pbe *next; | 16 | struct pbe *next; |
17 | } suspend_pagedir_t; | 17 | }; |
18 | |||
19 | #define for_each_pbe(pbe, pblist) \ | ||
20 | for (pbe = pblist ; pbe ; pbe = pbe->next) | ||
21 | |||
22 | #define PBES_PER_PAGE (PAGE_SIZE/sizeof(struct pbe)) | ||
23 | #define PB_PAGE_SKIP (PBES_PER_PAGE-1) | ||
24 | |||
25 | #define for_each_pb_page(pbe, pblist) \ | ||
26 | for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next) | ||
27 | |||
28 | |||
29 | #define SWAP_FILENAME_MAXLENGTH 32 | ||
30 | |||
31 | |||
32 | extern dev_t swsusp_resume_device; | ||
33 | |||
34 | /* mm/vmscan.c */ | ||
35 | extern int shrink_mem(void); | ||
36 | 18 | ||
37 | /* mm/page_alloc.c */ | 19 | /* mm/page_alloc.c */ |
38 | extern void drain_local_pages(void); | 20 | extern void drain_local_pages(void); |
@@ -53,18 +35,10 @@ static inline void pm_restore_console(void) {} | |||
53 | static inline int software_suspend(void) | 35 | static inline int software_suspend(void) |
54 | { | 36 | { |
55 | printk("Warning: fake suspend called\n"); | 37 | printk("Warning: fake suspend called\n"); |
56 | return -EPERM; | 38 | return -ENOSYS; |
57 | } | 39 | } |
58 | #endif /* CONFIG_PM */ | 40 | #endif /* CONFIG_PM */ |
59 | 41 | ||
60 | #ifdef CONFIG_SUSPEND_SMP | ||
61 | extern void disable_nonboot_cpus(void); | ||
62 | extern void enable_nonboot_cpus(void); | ||
63 | #else | ||
64 | static inline void disable_nonboot_cpus(void) {} | ||
65 | static inline void enable_nonboot_cpus(void) {} | ||
66 | #endif | ||
67 | |||
68 | void save_processor_state(void); | 42 | void save_processor_state(void); |
69 | void restore_processor_state(void); | 43 | void restore_processor_state(void); |
70 | struct saved_context; | 44 | struct saved_context; |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 5e59184c9096..e7c36ba2a2db 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -10,6 +10,10 @@ | |||
10 | #include <asm/atomic.h> | 10 | #include <asm/atomic.h> |
11 | #include <asm/page.h> | 11 | #include <asm/page.h> |
12 | 12 | ||
13 | struct notifier_block; | ||
14 | |||
15 | struct bio; | ||
16 | |||
13 | #define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ | 17 | #define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ |
14 | #define SWAP_FLAG_PRIO_MASK 0x7fff | 18 | #define SWAP_FLAG_PRIO_MASK 0x7fff |
15 | #define SWAP_FLAG_PRIO_SHIFT 0 | 19 | #define SWAP_FLAG_PRIO_SHIFT 0 |
@@ -156,13 +160,14 @@ struct swap_list_t { | |||
156 | 160 | ||
157 | /* linux/mm/oom_kill.c */ | 161 | /* linux/mm/oom_kill.c */ |
158 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); | 162 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); |
163 | extern int register_oom_notifier(struct notifier_block *nb); | ||
164 | extern int unregister_oom_notifier(struct notifier_block *nb); | ||
159 | 165 | ||
160 | /* linux/mm/memory.c */ | 166 | /* linux/mm/memory.c */ |
161 | extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); | 167 | extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); |
162 | 168 | ||
163 | /* linux/mm/page_alloc.c */ | 169 | /* linux/mm/page_alloc.c */ |
164 | extern unsigned long totalram_pages; | 170 | extern unsigned long totalram_pages; |
165 | extern unsigned long totalhigh_pages; | ||
166 | extern unsigned long totalreserve_pages; | 171 | extern unsigned long totalreserve_pages; |
167 | extern long nr_swap_pages; | 172 | extern long nr_swap_pages; |
168 | extern unsigned int nr_free_pages(void); | 173 | extern unsigned int nr_free_pages(void); |
@@ -190,6 +195,7 @@ extern long vm_total_pages; | |||
190 | #ifdef CONFIG_NUMA | 195 | #ifdef CONFIG_NUMA |
191 | extern int zone_reclaim_mode; | 196 | extern int zone_reclaim_mode; |
192 | extern int sysctl_min_unmapped_ratio; | 197 | extern int sysctl_min_unmapped_ratio; |
198 | extern int sysctl_min_slab_ratio; | ||
193 | extern int zone_reclaim(struct zone *, gfp_t, unsigned int); | 199 | extern int zone_reclaim(struct zone *, gfp_t, unsigned int); |
194 | #else | 200 | #else |
195 | #define zone_reclaim_mode 0 | 201 | #define zone_reclaim_mode 0 |
@@ -212,7 +218,9 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); | |||
212 | /* linux/mm/page_io.c */ | 218 | /* linux/mm/page_io.c */ |
213 | extern int swap_readpage(struct file *, struct page *); | 219 | extern int swap_readpage(struct file *, struct page *); |
214 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); | 220 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); |
215 | extern int rw_swap_page_sync(int, swp_entry_t, struct page *); | 221 | extern int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page, |
222 | struct bio **bio_chain); | ||
223 | extern int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err); | ||
216 | 224 | ||
217 | /* linux/mm/swap_state.c */ | 225 | /* linux/mm/swap_state.c */ |
218 | extern struct address_space swapper_space; | 226 | extern struct address_space swapper_space; |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 008f04c56737..3f0f716225ec 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -53,6 +53,7 @@ struct mq_attr; | |||
53 | struct compat_stat; | 53 | struct compat_stat; |
54 | struct compat_timeval; | 54 | struct compat_timeval; |
55 | struct robust_list_head; | 55 | struct robust_list_head; |
56 | struct getcpu_cache; | ||
56 | 57 | ||
57 | #include <linux/types.h> | 58 | #include <linux/types.h> |
58 | #include <linux/aio_abi.h> | 59 | #include <linux/aio_abi.h> |
@@ -596,5 +597,6 @@ asmlinkage long sys_get_robust_list(int pid, | |||
596 | size_t __user *len_ptr); | 597 | size_t __user *len_ptr); |
597 | asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, | 598 | asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, |
598 | size_t len); | 599 | size_t len); |
600 | asmlinkage long sys_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *cache); | ||
599 | 601 | ||
600 | #endif | 602 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 736ed917a4f8..1b24bd45e080 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -150,6 +150,8 @@ enum | |||
150 | KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ | 150 | KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ |
151 | KERN_COMPAT_LOG=73, /* int: print compat layer messages */ | 151 | KERN_COMPAT_LOG=73, /* int: print compat layer messages */ |
152 | KERN_MAX_LOCK_DEPTH=74, | 152 | KERN_MAX_LOCK_DEPTH=74, |
153 | KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ | ||
154 | KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ | ||
153 | }; | 155 | }; |
154 | 156 | ||
155 | 157 | ||
@@ -191,6 +193,7 @@ enum | |||
191 | VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */ | 193 | VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */ |
192 | VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ | 194 | VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ |
193 | VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ | 195 | VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ |
196 | VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ | ||
194 | }; | 197 | }; |
195 | 198 | ||
196 | 199 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 1ea5d3cda6ae..6d5c43d31dec 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef _SYSFS_H_ | 10 | #ifndef _SYSFS_H_ |
11 | #define _SYSFS_H_ | 11 | #define _SYSFS_H_ |
12 | 12 | ||
13 | #include <linux/compiler.h> | ||
13 | #include <asm/atomic.h> | 14 | #include <asm/atomic.h> |
14 | 15 | ||
15 | struct kobject; | 16 | struct kobject; |
@@ -86,40 +87,44 @@ struct sysfs_dirent { | |||
86 | 87 | ||
87 | #ifdef CONFIG_SYSFS | 88 | #ifdef CONFIG_SYSFS |
88 | 89 | ||
89 | extern int | 90 | extern int __must_check |
90 | sysfs_create_dir(struct kobject *); | 91 | sysfs_create_dir(struct kobject *); |
91 | 92 | ||
92 | extern void | 93 | extern void |
93 | sysfs_remove_dir(struct kobject *); | 94 | sysfs_remove_dir(struct kobject *); |
94 | 95 | ||
95 | extern int | 96 | extern int __must_check |
96 | sysfs_rename_dir(struct kobject *, const char *new_name); | 97 | sysfs_rename_dir(struct kobject *, const char *new_name); |
97 | 98 | ||
98 | extern int | 99 | extern int __must_check |
99 | sysfs_create_file(struct kobject *, const struct attribute *); | 100 | sysfs_create_file(struct kobject *, const struct attribute *); |
100 | 101 | ||
101 | extern int | 102 | extern int __must_check |
102 | sysfs_update_file(struct kobject *, const struct attribute *); | 103 | sysfs_update_file(struct kobject *, const struct attribute *); |
103 | 104 | ||
104 | extern int | 105 | extern int __must_check |
105 | sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); | 106 | sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); |
106 | 107 | ||
107 | extern void | 108 | extern void |
108 | sysfs_remove_file(struct kobject *, const struct attribute *); | 109 | sysfs_remove_file(struct kobject *, const struct attribute *); |
109 | 110 | ||
110 | extern int | 111 | extern int __must_check |
111 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); | 112 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); |
112 | 113 | ||
113 | extern void | 114 | extern void |
114 | sysfs_remove_link(struct kobject *, const char * name); | 115 | sysfs_remove_link(struct kobject *, const char * name); |
115 | 116 | ||
116 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); | 117 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
117 | int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); | 118 | struct bin_attribute *attr); |
119 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | ||
118 | 120 | ||
119 | int sysfs_create_group(struct kobject *, const struct attribute_group *); | 121 | int __must_check sysfs_create_group(struct kobject *, |
122 | const struct attribute_group *); | ||
120 | void sysfs_remove_group(struct kobject *, const struct attribute_group *); | 123 | void sysfs_remove_group(struct kobject *, const struct attribute_group *); |
121 | void sysfs_notify(struct kobject * k, char *dir, char *attr); | 124 | void sysfs_notify(struct kobject * k, char *dir, char *attr); |
122 | 125 | ||
126 | extern int __must_check sysfs_init(void); | ||
127 | |||
123 | #else /* CONFIG_SYSFS */ | 128 | #else /* CONFIG_SYSFS */ |
124 | 129 | ||
125 | static inline int sysfs_create_dir(struct kobject * k) | 130 | static inline int sysfs_create_dir(struct kobject * k) |
@@ -191,6 +196,11 @@ static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) | |||
191 | { | 196 | { |
192 | } | 197 | } |
193 | 198 | ||
199 | static inline int __must_check sysfs_init(void) | ||
200 | { | ||
201 | return 0; | ||
202 | } | ||
203 | |||
194 | #endif /* CONFIG_SYSFS */ | 204 | #endif /* CONFIG_SYSFS */ |
195 | 205 | ||
196 | #endif /* _SYSFS_H_ */ | 206 | #endif /* _SYSFS_H_ */ |
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 391e7ed1eb3f..a48d7f11c7be 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
@@ -19,4 +19,26 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
19 | 19 | ||
20 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ | 20 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ |
21 | 21 | ||
22 | /** | ||
23 | * probe_kernel_address(): safely attempt to read from a location | ||
24 | * @addr: address to read from - its type is type typeof(retval)* | ||
25 | * @retval: read into this variable | ||
26 | * | ||
27 | * Safely read from address @addr into variable @revtal. If a kernel fault | ||
28 | * happens, handle that and return -EFAULT. | ||
29 | * We ensure that the __get_user() is executed in atomic context so that | ||
30 | * do_page_fault() doesn't attempt to take mmap_sem. This makes | ||
31 | * probe_kernel_address() suitable for use within regions where the caller | ||
32 | * already holds mmap_sem, or other locks which nest inside mmap_sem. | ||
33 | */ | ||
34 | #define probe_kernel_address(addr, retval) \ | ||
35 | ({ \ | ||
36 | long ret; \ | ||
37 | \ | ||
38 | inc_preempt_count(); \ | ||
39 | ret = __get_user(retval, addr); \ | ||
40 | dec_preempt_count(); \ | ||
41 | ret; \ | ||
42 | }) | ||
43 | |||
22 | #endif /* __LINUX_UACCESS_H__ */ | 44 | #endif /* __LINUX_UACCESS_H__ */ |
diff --git a/include/linux/usb.h b/include/linux/usb.h index d2bd0c8e0154..0da15b0b02be 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> /* for struct file_operations */ | 19 | #include <linux/fs.h> /* for struct file_operations */ |
20 | #include <linux/completion.h> /* for struct completion */ | 20 | #include <linux/completion.h> /* for struct completion */ |
21 | #include <linux/sched.h> /* for current && schedule_timeout */ | 21 | #include <linux/sched.h> /* for current && schedule_timeout */ |
22 | #include <linux/mutex.h> /* for struct mutex */ | ||
22 | 23 | ||
23 | struct usb_device; | 24 | struct usb_device; |
24 | struct usb_driver; | 25 | struct usb_driver; |
@@ -102,8 +103,13 @@ enum usb_interface_condition { | |||
102 | * number from the USB core by calling usb_register_dev(). | 103 | * number from the USB core by calling usb_register_dev(). |
103 | * @condition: binding state of the interface: not bound, binding | 104 | * @condition: binding state of the interface: not bound, binding |
104 | * (in probe()), bound to a driver, or unbinding (in disconnect()) | 105 | * (in probe()), bound to a driver, or unbinding (in disconnect()) |
106 | * @is_active: flag set when the interface is bound and not suspended. | ||
107 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup | ||
108 | * capability during autosuspend. | ||
105 | * @dev: driver model's view of this device | 109 | * @dev: driver model's view of this device |
106 | * @class_dev: driver model's class view of this device. | 110 | * @class_dev: driver model's class view of this device. |
111 | * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not | ||
112 | * allowed unless the counter is 0. | ||
107 | * | 113 | * |
108 | * USB device drivers attach to interfaces on a physical device. Each | 114 | * USB device drivers attach to interfaces on a physical device. Each |
109 | * interface encapsulates a single high level function, such as feeding | 115 | * interface encapsulates a single high level function, such as feeding |
@@ -142,8 +148,12 @@ struct usb_interface { | |||
142 | int minor; /* minor number this interface is | 148 | int minor; /* minor number this interface is |
143 | * bound to */ | 149 | * bound to */ |
144 | enum usb_interface_condition condition; /* state of binding */ | 150 | enum usb_interface_condition condition; /* state of binding */ |
151 | unsigned is_active:1; /* the interface is not suspended */ | ||
152 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ | ||
153 | |||
145 | struct device dev; /* interface specific device info */ | 154 | struct device dev; /* interface specific device info */ |
146 | struct class_device *class_dev; | 155 | struct class_device *class_dev; |
156 | int pm_usage_cnt; /* usage counter for autosuspend */ | ||
147 | }; | 157 | }; |
148 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) | 158 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
149 | #define interface_to_usbdev(intf) \ | 159 | #define interface_to_usbdev(intf) \ |
@@ -254,8 +264,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, | |||
254 | 264 | ||
255 | /* ----------------------------------------------------------------------- */ | 265 | /* ----------------------------------------------------------------------- */ |
256 | 266 | ||
257 | struct usb_operations; | ||
258 | |||
259 | /* USB device number allocation bitmap */ | 267 | /* USB device number allocation bitmap */ |
260 | struct usb_devmap { | 268 | struct usb_devmap { |
261 | unsigned long devicemap[128 / (8*sizeof(unsigned long))]; | 269 | unsigned long devicemap[128 / (8*sizeof(unsigned long))]; |
@@ -268,6 +276,7 @@ struct usb_bus { | |||
268 | struct device *controller; /* host/master side hardware */ | 276 | struct device *controller; /* host/master side hardware */ |
269 | int busnum; /* Bus number (in order of reg) */ | 277 | int busnum; /* Bus number (in order of reg) */ |
270 | char *bus_name; /* stable id (PCI slot_name etc) */ | 278 | char *bus_name; /* stable id (PCI slot_name etc) */ |
279 | u8 uses_dma; /* Does the host controller use DMA? */ | ||
271 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 280 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
272 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 281 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
273 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ | 282 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ |
@@ -276,10 +285,8 @@ struct usb_bus { | |||
276 | * round-robin allocation */ | 285 | * round-robin allocation */ |
277 | 286 | ||
278 | struct usb_devmap devmap; /* device address allocation map */ | 287 | struct usb_devmap devmap; /* device address allocation map */ |
279 | struct usb_operations *op; /* Operations (specific to the HC) */ | ||
280 | struct usb_device *root_hub; /* Root hub */ | 288 | struct usb_device *root_hub; /* Root hub */ |
281 | struct list_head bus_list; /* list of busses */ | 289 | struct list_head bus_list; /* list of busses */ |
282 | void *hcpriv; /* Host Controller private data */ | ||
283 | 290 | ||
284 | int bandwidth_allocated; /* on this bus: how much of the time | 291 | int bandwidth_allocated; /* on this bus: how much of the time |
285 | * reserved for periodic (intr/iso) | 292 | * reserved for periodic (intr/iso) |
@@ -294,8 +301,6 @@ struct usb_bus { | |||
294 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 301 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
295 | 302 | ||
296 | struct class_device *class_dev; /* class device for this bus */ | 303 | struct class_device *class_dev; /* class device for this bus */ |
297 | struct kref kref; /* reference counting for this bus */ | ||
298 | void (*release)(struct usb_bus *bus); | ||
299 | 304 | ||
300 | #if defined(CONFIG_USB_MON) | 305 | #if defined(CONFIG_USB_MON) |
301 | struct mon_bus *mon_bus; /* non-null when associated */ | 306 | struct mon_bus *mon_bus; /* non-null when associated */ |
@@ -350,6 +355,7 @@ struct usb_device { | |||
350 | 355 | ||
351 | unsigned short bus_mA; /* Current available from the bus */ | 356 | unsigned short bus_mA; /* Current available from the bus */ |
352 | u8 portnum; /* Parent port number (origin 1) */ | 357 | u8 portnum; /* Parent port number (origin 1) */ |
358 | u8 level; /* Number of USB hub ancestors */ | ||
353 | 359 | ||
354 | int have_langid; /* whether string_langid is valid */ | 360 | int have_langid; /* whether string_langid is valid */ |
355 | int string_langid; /* language ID for strings */ | 361 | int string_langid; /* language ID for strings */ |
@@ -373,6 +379,15 @@ struct usb_device { | |||
373 | 379 | ||
374 | int maxchild; /* Number of ports if hub */ | 380 | int maxchild; /* Number of ports if hub */ |
375 | struct usb_device *children[USB_MAXCHILDREN]; | 381 | struct usb_device *children[USB_MAXCHILDREN]; |
382 | |||
383 | #ifdef CONFIG_PM | ||
384 | struct work_struct autosuspend; /* for delayed autosuspends */ | ||
385 | struct mutex pm_mutex; /* protects PM operations */ | ||
386 | int pm_usage_cnt; /* usage counter for autosuspend */ | ||
387 | |||
388 | unsigned auto_pm:1; /* autosuspend/resume in progress */ | ||
389 | unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ | ||
390 | #endif | ||
376 | }; | 391 | }; |
377 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 392 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
378 | 393 | ||
@@ -384,7 +399,7 @@ extern void usb_put_dev(struct usb_device *dev); | |||
384 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) | 399 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) |
385 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) | 400 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) |
386 | extern int usb_lock_device_for_reset(struct usb_device *udev, | 401 | extern int usb_lock_device_for_reset(struct usb_device *udev, |
387 | struct usb_interface *iface); | 402 | const struct usb_interface *iface); |
388 | 403 | ||
389 | /* USB port reset for device reinitialization */ | 404 | /* USB port reset for device reinitialization */ |
390 | extern int usb_reset_device(struct usb_device *dev); | 405 | extern int usb_reset_device(struct usb_device *dev); |
@@ -393,6 +408,17 @@ extern int usb_reset_composite_device(struct usb_device *dev, | |||
393 | 408 | ||
394 | extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | 409 | extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); |
395 | 410 | ||
411 | /* USB autosuspend and autoresume */ | ||
412 | #ifdef CONFIG_USB_SUSPEND | ||
413 | extern int usb_autopm_get_interface(struct usb_interface *intf); | ||
414 | extern void usb_autopm_put_interface(struct usb_interface *intf); | ||
415 | |||
416 | #else | ||
417 | #define usb_autopm_get_interface(intf) 0 | ||
418 | #define usb_autopm_put_interface(intf) do {} while (0) | ||
419 | #endif | ||
420 | |||
421 | |||
396 | /*-------------------------------------------------------------------------*/ | 422 | /*-------------------------------------------------------------------------*/ |
397 | 423 | ||
398 | /* for drivers using iso endpoints */ | 424 | /* for drivers using iso endpoints */ |
@@ -423,10 +449,10 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface, | |||
423 | 449 | ||
424 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, | 450 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, |
425 | int minor); | 451 | int minor); |
426 | extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, | 452 | extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, |
427 | unsigned ifnum); | 453 | unsigned ifnum); |
428 | extern struct usb_host_interface *usb_altnum_to_altsetting( | 454 | extern struct usb_host_interface *usb_altnum_to_altsetting( |
429 | struct usb_interface *intf, unsigned int altnum); | 455 | const struct usb_interface *intf, unsigned int altnum); |
430 | 456 | ||
431 | 457 | ||
432 | /** | 458 | /** |
@@ -464,6 +490,20 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, | |||
464 | 490 | ||
465 | /*-------------------------------------------------------------------------*/ | 491 | /*-------------------------------------------------------------------------*/ |
466 | 492 | ||
493 | extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd); | ||
494 | extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd); | ||
495 | extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd); | ||
496 | extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd); | ||
497 | extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd); | ||
498 | extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd); | ||
499 | extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd); | ||
500 | extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd); | ||
501 | extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd); | ||
502 | extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd); | ||
503 | extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd); | ||
504 | |||
505 | /*-------------------------------------------------------------------------*/ | ||
506 | |||
467 | #define USB_DEVICE_ID_MATCH_DEVICE \ | 507 | #define USB_DEVICE_ID_MATCH_DEVICE \ |
468 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) | 508 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) |
469 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ | 509 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ |
@@ -540,7 +580,17 @@ struct usb_dynids { | |||
540 | }; | 580 | }; |
541 | 581 | ||
542 | /** | 582 | /** |
543 | * struct usb_driver - identifies USB driver to usbcore | 583 | * struct usbdrv_wrap - wrapper for driver-model structure |
584 | * @driver: The driver-model core driver structure. | ||
585 | * @for_devices: Non-zero for device drivers, 0 for interface drivers. | ||
586 | */ | ||
587 | struct usbdrv_wrap { | ||
588 | struct device_driver driver; | ||
589 | int for_devices; | ||
590 | }; | ||
591 | |||
592 | /** | ||
593 | * struct usb_driver - identifies USB interface driver to usbcore | ||
544 | * @name: The driver name should be unique among USB drivers, | 594 | * @name: The driver name should be unique among USB drivers, |
545 | * and should normally be the same as the module name. | 595 | * and should normally be the same as the module name. |
546 | * @probe: Called to see if the driver is willing to manage a particular | 596 | * @probe: Called to see if the driver is willing to manage a particular |
@@ -567,12 +617,14 @@ struct usb_dynids { | |||
567 | * or your driver's probe function will never get called. | 617 | * or your driver's probe function will never get called. |
568 | * @dynids: used internally to hold the list of dynamically added device | 618 | * @dynids: used internally to hold the list of dynamically added device |
569 | * ids for this driver. | 619 | * ids for this driver. |
570 | * @driver: the driver model core driver structure. | 620 | * @drvwrap: Driver-model core structure wrapper. |
571 | * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be | 621 | * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be |
572 | * added to this driver by preventing the sysfs file from being created. | 622 | * added to this driver by preventing the sysfs file from being created. |
623 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend | ||
624 | * for interfaces bound to this driver. | ||
573 | * | 625 | * |
574 | * USB drivers must provide a name, probe() and disconnect() methods, | 626 | * USB interface drivers must provide a name, probe() and disconnect() |
575 | * and an id_table. Other driver fields are optional. | 627 | * methods, and an id_table. Other driver fields are optional. |
576 | * | 628 | * |
577 | * The id_table is used in hotplugging. It holds a set of descriptors, | 629 | * The id_table is used in hotplugging. It holds a set of descriptors, |
578 | * and specialized data may be associated with each entry. That table | 630 | * and specialized data may be associated with each entry. That table |
@@ -606,10 +658,44 @@ struct usb_driver { | |||
606 | const struct usb_device_id *id_table; | 658 | const struct usb_device_id *id_table; |
607 | 659 | ||
608 | struct usb_dynids dynids; | 660 | struct usb_dynids dynids; |
609 | struct device_driver driver; | 661 | struct usbdrv_wrap drvwrap; |
610 | unsigned int no_dynamic_id:1; | 662 | unsigned int no_dynamic_id:1; |
663 | unsigned int supports_autosuspend:1; | ||
611 | }; | 664 | }; |
612 | #define to_usb_driver(d) container_of(d, struct usb_driver, driver) | 665 | #define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) |
666 | |||
667 | /** | ||
668 | * struct usb_device_driver - identifies USB device driver to usbcore | ||
669 | * @name: The driver name should be unique among USB drivers, | ||
670 | * and should normally be the same as the module name. | ||
671 | * @probe: Called to see if the driver is willing to manage a particular | ||
672 | * device. If it is, probe returns zero and uses dev_set_drvdata() | ||
673 | * to associate driver-specific data with the device. If unwilling | ||
674 | * to manage the device, return a negative errno value. | ||
675 | * @disconnect: Called when the device is no longer accessible, usually | ||
676 | * because it has been (or is being) disconnected or the driver's | ||
677 | * module is being unloaded. | ||
678 | * @suspend: Called when the device is going to be suspended by the system. | ||
679 | * @resume: Called when the device is being resumed by the system. | ||
680 | * @drvwrap: Driver-model core structure wrapper. | ||
681 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend | ||
682 | * for devices bound to this driver. | ||
683 | * | ||
684 | * USB drivers must provide all the fields listed above except drvwrap. | ||
685 | */ | ||
686 | struct usb_device_driver { | ||
687 | const char *name; | ||
688 | |||
689 | int (*probe) (struct usb_device *udev); | ||
690 | void (*disconnect) (struct usb_device *udev); | ||
691 | |||
692 | int (*suspend) (struct usb_device *udev, pm_message_t message); | ||
693 | int (*resume) (struct usb_device *udev); | ||
694 | struct usbdrv_wrap drvwrap; | ||
695 | unsigned int supports_autosuspend:1; | ||
696 | }; | ||
697 | #define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \ | ||
698 | drvwrap.driver) | ||
613 | 699 | ||
614 | extern struct bus_type usb_bus_type; | 700 | extern struct bus_type usb_bus_type; |
615 | 701 | ||
@@ -633,13 +719,17 @@ struct usb_class_driver { | |||
633 | * use these in module_init()/module_exit() | 719 | * use these in module_init()/module_exit() |
634 | * and don't forget MODULE_DEVICE_TABLE(usb, ...) | 720 | * and don't forget MODULE_DEVICE_TABLE(usb, ...) |
635 | */ | 721 | */ |
636 | int usb_register_driver(struct usb_driver *, struct module *); | 722 | extern int usb_register_driver(struct usb_driver *, struct module *); |
637 | static inline int usb_register(struct usb_driver *driver) | 723 | static inline int usb_register(struct usb_driver *driver) |
638 | { | 724 | { |
639 | return usb_register_driver(driver, THIS_MODULE); | 725 | return usb_register_driver(driver, THIS_MODULE); |
640 | } | 726 | } |
641 | extern void usb_deregister(struct usb_driver *); | 727 | extern void usb_deregister(struct usb_driver *); |
642 | 728 | ||
729 | extern int usb_register_device_driver(struct usb_device_driver *, | ||
730 | struct module *); | ||
731 | extern void usb_deregister_device_driver(struct usb_device_driver *); | ||
732 | |||
643 | extern int usb_register_dev(struct usb_interface *intf, | 733 | extern int usb_register_dev(struct usb_interface *intf, |
644 | struct usb_class_driver *class_driver); | 734 | struct usb_class_driver *class_driver); |
645 | extern void usb_deregister_dev(struct usb_interface *intf, | 735 | extern void usb_deregister_dev(struct usb_interface *intf, |
@@ -885,7 +975,7 @@ struct urb | |||
885 | * @setup_packet: pointer to the setup_packet buffer | 975 | * @setup_packet: pointer to the setup_packet buffer |
886 | * @transfer_buffer: pointer to the transfer buffer | 976 | * @transfer_buffer: pointer to the transfer buffer |
887 | * @buffer_length: length of the transfer buffer | 977 | * @buffer_length: length of the transfer buffer |
888 | * @complete: pointer to the usb_complete_t function | 978 | * @complete_fn: pointer to the usb_complete_t function |
889 | * @context: what to set the urb context to. | 979 | * @context: what to set the urb context to. |
890 | * | 980 | * |
891 | * Initializes a control urb with the proper information needed to submit | 981 | * Initializes a control urb with the proper information needed to submit |
@@ -897,7 +987,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
897 | unsigned char *setup_packet, | 987 | unsigned char *setup_packet, |
898 | void *transfer_buffer, | 988 | void *transfer_buffer, |
899 | int buffer_length, | 989 | int buffer_length, |
900 | usb_complete_t complete, | 990 | usb_complete_t complete_fn, |
901 | void *context) | 991 | void *context) |
902 | { | 992 | { |
903 | spin_lock_init(&urb->lock); | 993 | spin_lock_init(&urb->lock); |
@@ -906,7 +996,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
906 | urb->setup_packet = setup_packet; | 996 | urb->setup_packet = setup_packet; |
907 | urb->transfer_buffer = transfer_buffer; | 997 | urb->transfer_buffer = transfer_buffer; |
908 | urb->transfer_buffer_length = buffer_length; | 998 | urb->transfer_buffer_length = buffer_length; |
909 | urb->complete = complete; | 999 | urb->complete = complete_fn; |
910 | urb->context = context; | 1000 | urb->context = context; |
911 | } | 1001 | } |
912 | 1002 | ||
@@ -917,7 +1007,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
917 | * @pipe: the endpoint pipe | 1007 | * @pipe: the endpoint pipe |
918 | * @transfer_buffer: pointer to the transfer buffer | 1008 | * @transfer_buffer: pointer to the transfer buffer |
919 | * @buffer_length: length of the transfer buffer | 1009 | * @buffer_length: length of the transfer buffer |
920 | * @complete: pointer to the usb_complete_t function | 1010 | * @complete_fn: pointer to the usb_complete_t function |
921 | * @context: what to set the urb context to. | 1011 | * @context: what to set the urb context to. |
922 | * | 1012 | * |
923 | * Initializes a bulk urb with the proper information needed to submit it | 1013 | * Initializes a bulk urb with the proper information needed to submit it |
@@ -928,7 +1018,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
928 | unsigned int pipe, | 1018 | unsigned int pipe, |
929 | void *transfer_buffer, | 1019 | void *transfer_buffer, |
930 | int buffer_length, | 1020 | int buffer_length, |
931 | usb_complete_t complete, | 1021 | usb_complete_t complete_fn, |
932 | void *context) | 1022 | void *context) |
933 | { | 1023 | { |
934 | spin_lock_init(&urb->lock); | 1024 | spin_lock_init(&urb->lock); |
@@ -936,7 +1026,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
936 | urb->pipe = pipe; | 1026 | urb->pipe = pipe; |
937 | urb->transfer_buffer = transfer_buffer; | 1027 | urb->transfer_buffer = transfer_buffer; |
938 | urb->transfer_buffer_length = buffer_length; | 1028 | urb->transfer_buffer_length = buffer_length; |
939 | urb->complete = complete; | 1029 | urb->complete = complete_fn; |
940 | urb->context = context; | 1030 | urb->context = context; |
941 | } | 1031 | } |
942 | 1032 | ||
@@ -947,7 +1037,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
947 | * @pipe: the endpoint pipe | 1037 | * @pipe: the endpoint pipe |
948 | * @transfer_buffer: pointer to the transfer buffer | 1038 | * @transfer_buffer: pointer to the transfer buffer |
949 | * @buffer_length: length of the transfer buffer | 1039 | * @buffer_length: length of the transfer buffer |
950 | * @complete: pointer to the usb_complete_t function | 1040 | * @complete_fn: pointer to the usb_complete_t function |
951 | * @context: what to set the urb context to. | 1041 | * @context: what to set the urb context to. |
952 | * @interval: what to set the urb interval to, encoded like | 1042 | * @interval: what to set the urb interval to, encoded like |
953 | * the endpoint descriptor's bInterval value. | 1043 | * the endpoint descriptor's bInterval value. |
@@ -963,7 +1053,7 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
963 | unsigned int pipe, | 1053 | unsigned int pipe, |
964 | void *transfer_buffer, | 1054 | void *transfer_buffer, |
965 | int buffer_length, | 1055 | int buffer_length, |
966 | usb_complete_t complete, | 1056 | usb_complete_t complete_fn, |
967 | void *context, | 1057 | void *context, |
968 | int interval) | 1058 | int interval) |
969 | { | 1059 | { |
@@ -972,7 +1062,7 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
972 | urb->pipe = pipe; | 1062 | urb->pipe = pipe; |
973 | urb->transfer_buffer = transfer_buffer; | 1063 | urb->transfer_buffer = transfer_buffer; |
974 | urb->transfer_buffer_length = buffer_length; | 1064 | urb->transfer_buffer_length = buffer_length; |
975 | urb->complete = complete; | 1065 | urb->complete = complete_fn; |
976 | urb->context = context; | 1066 | urb->context = context; |
977 | if (dev->speed == USB_SPEED_HIGH) | 1067 | if (dev->speed == USB_SPEED_HIGH) |
978 | urb->interval = 1 << (interval - 1); | 1068 | urb->interval = 1 << (interval - 1); |
@@ -990,7 +1080,6 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); | |||
990 | extern int usb_unlink_urb(struct urb *urb); | 1080 | extern int usb_unlink_urb(struct urb *urb); |
991 | extern void usb_kill_urb(struct urb *urb); | 1081 | extern void usb_kill_urb(struct urb *urb); |
992 | 1082 | ||
993 | #define HAVE_USB_BUFFERS | ||
994 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 1083 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, |
995 | gfp_t mem_flags, dma_addr_t *dma); | 1084 | gfp_t mem_flags, dma_addr_t *dma); |
996 | void usb_buffer_free (struct usb_device *dev, size_t size, | 1085 | void usb_buffer_free (struct usb_device *dev, size_t size, |
@@ -1003,14 +1092,14 @@ void usb_buffer_unmap (struct urb *urb); | |||
1003 | #endif | 1092 | #endif |
1004 | 1093 | ||
1005 | struct scatterlist; | 1094 | struct scatterlist; |
1006 | int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, | 1095 | int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, |
1007 | struct scatterlist *sg, int nents); | 1096 | struct scatterlist *sg, int nents); |
1008 | #if 0 | 1097 | #if 0 |
1009 | void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe, | 1098 | void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, |
1010 | struct scatterlist *sg, int n_hw_ents); | 1099 | struct scatterlist *sg, int n_hw_ents); |
1011 | #endif | 1100 | #endif |
1012 | void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, | 1101 | void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, |
1013 | struct scatterlist *sg, int n_hw_ents); | 1102 | struct scatterlist *sg, int n_hw_ents); |
1014 | 1103 | ||
1015 | /*-------------------------------------------------------------------* | 1104 | /*-------------------------------------------------------------------* |
1016 | * SYNCHRONOUS CALL SUPPORT * | 1105 | * SYNCHRONOUS CALL SUPPORT * |
@@ -1038,6 +1127,9 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe); | |||
1038 | extern int usb_reset_configuration(struct usb_device *dev); | 1127 | extern int usb_reset_configuration(struct usb_device *dev); |
1039 | extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); | 1128 | extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); |
1040 | 1129 | ||
1130 | /* this request isn't really synchronous, but it belongs with the others */ | ||
1131 | extern int usb_driver_set_configuration(struct usb_device *udev, int config); | ||
1132 | |||
1041 | /* | 1133 | /* |
1042 | * timeouts, in milliseconds, used for sending/receiving control messages | 1134 | * timeouts, in milliseconds, used for sending/receiving control messages |
1043 | * they typically complete within a few frames (msec) after they're issued | 1135 | * they typically complete within a few frames (msec) after they're issued |
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h new file mode 100644 index 000000000000..6bd235994dc2 --- /dev/null +++ b/include/linux/usb/audio.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * <linux/usb/audio.h> -- USB Audio definitions. | ||
3 | * | ||
4 | * Copyright (C) 2006 Thumtronics Pty Ltd. | ||
5 | * Developed for Thumtronics by Grey Innovation | ||
6 | * Ben Williamson <ben.williamson@greyinnovation.com> | ||
7 | * | ||
8 | * This software is distributed under the terms of the GNU General Public | ||
9 | * License ("GPL") version 2, as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This file holds USB constants and structures defined | ||
12 | * by the USB Device Class Definition for Audio Devices. | ||
13 | * Comments below reference relevant sections of that document: | ||
14 | * | ||
15 | * http://www.usb.org/developers/devclass_docs/audio10.pdf | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_AUDIO_H | ||
19 | #define __LINUX_USB_AUDIO_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | /* A.2 Audio Interface Subclass Codes */ | ||
24 | #define USB_SUBCLASS_AUDIOCONTROL 0x01 | ||
25 | #define USB_SUBCLASS_AUDIOSTREAMING 0x02 | ||
26 | #define USB_SUBCLASS_MIDISTREAMING 0x03 | ||
27 | |||
28 | /* 4.3.2 Class-Specific AC Interface Descriptor */ | ||
29 | struct usb_ac_header_descriptor { | ||
30 | __u8 bLength; // 8+n | ||
31 | __u8 bDescriptorType; // USB_DT_CS_INTERFACE | ||
32 | __u8 bDescriptorSubtype; // USB_MS_HEADER | ||
33 | __le16 bcdADC; // 0x0100 | ||
34 | __le16 wTotalLength; // includes Unit and Terminal desc. | ||
35 | __u8 bInCollection; // n | ||
36 | __u8 baInterfaceNr[]; // [n] | ||
37 | } __attribute__ ((packed)); | ||
38 | |||
39 | #define USB_DT_AC_HEADER_SIZE(n) (8+(n)) | ||
40 | |||
41 | /* As above, but more useful for defining your own descriptors: */ | ||
42 | #define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ | ||
43 | struct usb_ac_header_descriptor_##n { \ | ||
44 | __u8 bLength; \ | ||
45 | __u8 bDescriptorType; \ | ||
46 | __u8 bDescriptorSubtype; \ | ||
47 | __le16 bcdADC; \ | ||
48 | __le16 wTotalLength; \ | ||
49 | __u8 bInCollection; \ | ||
50 | __u8 baInterfaceNr[n]; \ | ||
51 | } __attribute__ ((packed)) | ||
52 | |||
53 | #endif | ||
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h new file mode 100644 index 000000000000..11a97d5ffd34 --- /dev/null +++ b/include/linux/usb/midi.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * <linux/usb/midi.h> -- USB MIDI definitions. | ||
3 | * | ||
4 | * Copyright (C) 2006 Thumtronics Pty Ltd. | ||
5 | * Developed for Thumtronics by Grey Innovation | ||
6 | * Ben Williamson <ben.williamson@greyinnovation.com> | ||
7 | * | ||
8 | * This software is distributed under the terms of the GNU General Public | ||
9 | * License ("GPL") version 2, as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This file holds USB constants and structures defined | ||
12 | * by the USB Device Class Definition for MIDI Devices. | ||
13 | * Comments below reference relevant sections of that document: | ||
14 | * | ||
15 | * http://www.usb.org/developers/devclass_docs/midi10.pdf | ||
16 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_MIDI_H | ||
19 | #define __LINUX_USB_MIDI_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | /* A.1 MS Class-Specific Interface Descriptor Subtypes */ | ||
24 | #define USB_MS_HEADER 0x01 | ||
25 | #define USB_MS_MIDI_IN_JACK 0x02 | ||
26 | #define USB_MS_MIDI_OUT_JACK 0x03 | ||
27 | #define USB_MS_ELEMENT 0x04 | ||
28 | |||
29 | /* A.2 MS Class-Specific Endpoint Descriptor Subtypes */ | ||
30 | #define USB_MS_GENERAL 0x01 | ||
31 | |||
32 | /* A.3 MS MIDI IN and OUT Jack Types */ | ||
33 | #define USB_MS_EMBEDDED 0x01 | ||
34 | #define USB_MS_EXTERNAL 0x02 | ||
35 | |||
36 | /* 6.1.2.1 Class-Specific MS Interface Header Descriptor */ | ||
37 | struct usb_ms_header_descriptor { | ||
38 | __u8 bLength; | ||
39 | __u8 bDescriptorType; | ||
40 | __u8 bDescriptorSubtype; | ||
41 | __le16 bcdMSC; | ||
42 | __le16 wTotalLength; | ||
43 | } __attribute__ ((packed)); | ||
44 | |||
45 | #define USB_DT_MS_HEADER_SIZE 7 | ||
46 | |||
47 | /* 6.1.2.2 MIDI IN Jack Descriptor */ | ||
48 | struct usb_midi_in_jack_descriptor { | ||
49 | __u8 bLength; | ||
50 | __u8 bDescriptorType; // USB_DT_CS_INTERFACE | ||
51 | __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK | ||
52 | __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL | ||
53 | __u8 bJackID; | ||
54 | __u8 iJack; | ||
55 | } __attribute__ ((packed)); | ||
56 | |||
57 | #define USB_DT_MIDI_IN_SIZE 6 | ||
58 | |||
59 | struct usb_midi_source_pin { | ||
60 | __u8 baSourceID; | ||
61 | __u8 baSourcePin; | ||
62 | } __attribute__ ((packed)); | ||
63 | |||
64 | /* 6.1.2.3 MIDI OUT Jack Descriptor */ | ||
65 | struct usb_midi_out_jack_descriptor { | ||
66 | __u8 bLength; | ||
67 | __u8 bDescriptorType; // USB_DT_CS_INTERFACE | ||
68 | __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK | ||
69 | __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL | ||
70 | __u8 bJackID; | ||
71 | __u8 bNrInputPins; // p | ||
72 | struct usb_midi_source_pin pins[]; // [p] | ||
73 | /*__u8 iJack; -- ommitted due to variable-sized pins[] */ | ||
74 | } __attribute__ ((packed)); | ||
75 | |||
76 | #define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p)) | ||
77 | |||
78 | /* As above, but more useful for defining your own descriptors: */ | ||
79 | #define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \ | ||
80 | struct usb_midi_out_jack_descriptor_##p { \ | ||
81 | __u8 bLength; \ | ||
82 | __u8 bDescriptorType; \ | ||
83 | __u8 bDescriptorSubtype; \ | ||
84 | __u8 bJackType; \ | ||
85 | __u8 bJackID; \ | ||
86 | __u8 bNrInputPins; \ | ||
87 | struct usb_midi_source_pin pins[p]; \ | ||
88 | __u8 iJack; \ | ||
89 | } __attribute__ ((packed)) | ||
90 | |||
91 | /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ | ||
92 | struct usb_ms_endpoint_descriptor { | ||
93 | __u8 bLength; // 4+n | ||
94 | __u8 bDescriptorType; // USB_DT_CS_ENDPOINT | ||
95 | __u8 bDescriptorSubtype; // USB_MS_GENERAL | ||
96 | __u8 bNumEmbMIDIJack; // n | ||
97 | __u8 baAssocJackID[]; // [n] | ||
98 | } __attribute__ ((packed)); | ||
99 | |||
100 | #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) | ||
101 | |||
102 | /* As above, but more useful for defining your own descriptors: */ | ||
103 | #define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \ | ||
104 | struct usb_ms_endpoint_descriptor_##n { \ | ||
105 | __u8 bLength; \ | ||
106 | __u8 bDescriptorType; \ | ||
107 | __u8 bDescriptorSubtype; \ | ||
108 | __u8 bNumEmbMIDIJack; \ | ||
109 | __u8 baAssocJackID[n]; \ | ||
110 | } __attribute__ ((packed)) | ||
111 | |||
112 | #endif | ||
diff --git a/include/linux/usb_otg.h b/include/linux/usb/otg.h index f827f6e203c2..9897f7a818c5 100644 --- a/include/linux/usb_otg.h +++ b/include/linux/usb/otg.h | |||
@@ -1,4 +1,4 @@ | |||
1 | // include/linux/usb_otg.h | 1 | // include/linux/usb/otg.h |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * These APIs may be used between USB controllers. USB device drivers | 4 | * These APIs may be used between USB controllers. USB device drivers |
@@ -52,7 +52,7 @@ struct otg_transceiver { | |||
52 | u16 port_change; | 52 | u16 port_change; |
53 | 53 | ||
54 | /* bind/unbind the host controller */ | 54 | /* bind/unbind the host controller */ |
55 | int (*set_host)(struct otg_transceiver *otg, | 55 | int (*set_host)(struct otg_transceiver *otg, |
56 | struct usb_bus *host); | 56 | struct usb_bus *host); |
57 | 57 | ||
58 | /* bind/unbind the peripheral controller */ | 58 | /* bind/unbind the peripheral controller */ |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index e7fc5fed5b98..2ae76fe52ff7 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -108,6 +108,9 @@ enum { US_DO_ALL_FLAGS }; | |||
108 | #ifdef CONFIG_USB_STORAGE_ALAUDA | 108 | #ifdef CONFIG_USB_STORAGE_ALAUDA |
109 | #define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ | 109 | #define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ |
110 | #endif | 110 | #endif |
111 | #ifdef CONFIG_USB_STORAGE_KARMA | ||
112 | #define US_PR_KARMA 0xf5 /* Rio Karma */ | ||
113 | #endif | ||
111 | 114 | ||
112 | #define US_PR_DEVICE 0xff /* Use device's value */ | 115 | #define US_PR_DEVICE 0xff /* Use device's value */ |
113 | 116 | ||
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 46919f9f5eb3..4d0909e53595 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h | |||
@@ -24,5 +24,5 @@ | |||
24 | #define VERMAGIC_STRING \ | 24 | #define VERMAGIC_STRING \ |
25 | UTS_RELEASE " " \ | 25 | UTS_RELEASE " " \ |
26 | MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ | 26 | MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ |
27 | MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC \ | 27 | MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC |
28 | "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) | 28 | |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 71b6363caaaf..ce5f1482e6be 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -44,8 +44,6 @@ extern void *vmalloc_32_user(unsigned long size); | |||
44 | extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); | 44 | extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); |
45 | extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, | 45 | extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, |
46 | pgprot_t prot); | 46 | pgprot_t prot); |
47 | extern void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, | ||
48 | pgprot_t prot, int node); | ||
49 | extern void vfree(void *addr); | 47 | extern void vfree(void *addr); |
50 | 48 | ||
51 | extern void *vmap(struct page **pages, unsigned int count, | 49 | extern void *vmap(struct page **pages, unsigned int count, |
@@ -64,7 +62,6 @@ extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, | |||
64 | extern struct vm_struct *get_vm_area_node(unsigned long size, | 62 | extern struct vm_struct *get_vm_area_node(unsigned long size, |
65 | unsigned long flags, int node); | 63 | unsigned long flags, int node); |
66 | extern struct vm_struct *remove_vm_area(void *addr); | 64 | extern struct vm_struct *remove_vm_area(void *addr); |
67 | extern struct vm_struct *__remove_vm_area(void *addr); | ||
68 | extern int map_vm_area(struct vm_struct *area, pgprot_t prot, | 65 | extern int map_vm_area(struct vm_struct *area, pgprot_t prot, |
69 | struct page ***pages); | 66 | struct page ***pages); |
70 | extern void unmap_vm_area(struct vm_struct *area); | 67 | extern void unmap_vm_area(struct vm_struct *area); |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 2d9b1b60798a..176c7f797339 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -18,7 +18,19 @@ | |||
18 | * generated will simply be the increment of a global address. | 18 | * generated will simply be the increment of a global address. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define FOR_ALL_ZONES(x) x##_DMA, x##_DMA32, x##_NORMAL, x##_HIGH | 21 | #ifdef CONFIG_ZONE_DMA32 |
22 | #define DMA32_ZONE(xx) xx##_DMA32, | ||
23 | #else | ||
24 | #define DMA32_ZONE(xx) | ||
25 | #endif | ||
26 | |||
27 | #ifdef CONFIG_HIGHMEM | ||
28 | #define HIGHMEM_ZONE(xx) , xx##_HIGH | ||
29 | #else | ||
30 | #define HIGHMEM_ZONE(xx) | ||
31 | #endif | ||
32 | |||
33 | #define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) | ||
22 | 34 | ||
23 | enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | 35 | enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, |
24 | FOR_ALL_ZONES(PGALLOC), | 36 | FOR_ALL_ZONES(PGALLOC), |
@@ -124,12 +136,10 @@ static inline unsigned long node_page_state(int node, | |||
124 | struct zone *zones = NODE_DATA(node)->node_zones; | 136 | struct zone *zones = NODE_DATA(node)->node_zones; |
125 | 137 | ||
126 | return | 138 | return |
127 | #ifndef CONFIG_DMA_IS_NORMAL | 139 | #ifdef CONFIG_ZONE_DMA32 |
128 | #if !defined(CONFIG_DMA_IS_DMA32) && BITS_PER_LONG >= 64 | ||
129 | zone_page_state(&zones[ZONE_DMA32], item) + | 140 | zone_page_state(&zones[ZONE_DMA32], item) + |
130 | #endif | 141 | #endif |
131 | zone_page_state(&zones[ZONE_NORMAL], item) + | 142 | zone_page_state(&zones[ZONE_NORMAL], item) + |
132 | #endif | ||
133 | #ifdef CONFIG_HIGHMEM | 143 | #ifdef CONFIG_HIGHMEM |
134 | zone_page_state(&zones[ZONE_HIGHMEM], item) + | 144 | zone_page_state(&zones[ZONE_HIGHMEM], item) + |
135 | #endif | 145 | #endif |
diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 13588564b42b..a50a0130fd9e 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This file define a set of standard wireless extensions | 2 | * This file define a set of standard wireless extensions |
3 | * | 3 | * |
4 | * Version : 20 17.2.06 | 4 | * Version : 21 14.3.06 |
5 | * | 5 | * |
6 | * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> | 6 | * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> |
7 | * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. | 7 | * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. |
@@ -69,9 +69,14 @@ | |||
69 | 69 | ||
70 | /***************************** INCLUDES *****************************/ | 70 | /***************************** INCLUDES *****************************/ |
71 | 71 | ||
72 | /* This header is used in user-space, therefore need to be sanitised | ||
73 | * for that purpose. Those includes are usually not compatible with glibc. | ||
74 | * To know which includes to use in user-space, check iwlib.h. */ | ||
75 | #ifdef __KERNEL__ | ||
72 | #include <linux/types.h> /* for "caddr_t" et al */ | 76 | #include <linux/types.h> /* for "caddr_t" et al */ |
73 | #include <linux/socket.h> /* for "struct sockaddr" et al */ | 77 | #include <linux/socket.h> /* for "struct sockaddr" et al */ |
74 | #include <linux/if.h> /* for IFNAMSIZ and co... */ | 78 | #include <linux/if.h> /* for IFNAMSIZ and co... */ |
79 | #endif /* __KERNEL__ */ | ||
75 | 80 | ||
76 | /***************************** VERSION *****************************/ | 81 | /***************************** VERSION *****************************/ |
77 | /* | 82 | /* |
@@ -80,7 +85,7 @@ | |||
80 | * (there is some stuff that will be added in the future...) | 85 | * (there is some stuff that will be added in the future...) |
81 | * I just plan to increment with each new version. | 86 | * I just plan to increment with each new version. |
82 | */ | 87 | */ |
83 | #define WIRELESS_EXT 20 | 88 | #define WIRELESS_EXT 21 |
84 | 89 | ||
85 | /* | 90 | /* |
86 | * Changes : | 91 | * Changes : |
@@ -208,6 +213,14 @@ | |||
208 | * V19 to V20 | 213 | * V19 to V20 |
209 | * ---------- | 214 | * ---------- |
210 | * - RtNetlink requests support (SET/GET) | 215 | * - RtNetlink requests support (SET/GET) |
216 | * | ||
217 | * V20 to V21 | ||
218 | * ---------- | ||
219 | * - Remove (struct net_device *)->get_wireless_stats() | ||
220 | * - Change length in ESSID and NICK to strlen() instead of strlen()+1 | ||
221 | * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers | ||
222 | * - Power/Retry relative values no longer * 100000 | ||
223 | * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI | ||
211 | */ | 224 | */ |
212 | 225 | ||
213 | /**************************** CONSTANTS ****************************/ | 226 | /**************************** CONSTANTS ****************************/ |
@@ -448,6 +461,7 @@ | |||
448 | #define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ | 461 | #define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ |
449 | #define IW_QUAL_LEVEL_INVALID 0x20 | 462 | #define IW_QUAL_LEVEL_INVALID 0x20 |
450 | #define IW_QUAL_NOISE_INVALID 0x40 | 463 | #define IW_QUAL_NOISE_INVALID 0x40 |
464 | #define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */ | ||
451 | #define IW_QUAL_ALL_INVALID 0x70 | 465 | #define IW_QUAL_ALL_INVALID 0x70 |
452 | 466 | ||
453 | /* Frequency flags */ | 467 | /* Frequency flags */ |
@@ -500,10 +514,12 @@ | |||
500 | #define IW_RETRY_TYPE 0xF000 /* Type of parameter */ | 514 | #define IW_RETRY_TYPE 0xF000 /* Type of parameter */ |
501 | #define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ | 515 | #define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ |
502 | #define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ | 516 | #define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ |
503 | #define IW_RETRY_MODIFIER 0x000F /* Modify a parameter */ | 517 | #define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */ |
504 | #define IW_RETRY_MIN 0x0001 /* Value is a minimum */ | 518 | #define IW_RETRY_MIN 0x0001 /* Value is a minimum */ |
505 | #define IW_RETRY_MAX 0x0002 /* Value is a maximum */ | 519 | #define IW_RETRY_MAX 0x0002 /* Value is a maximum */ |
506 | #define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ | 520 | #define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ |
521 | #define IW_RETRY_SHORT 0x0010 /* Value is for short packets */ | ||
522 | #define IW_RETRY_LONG 0x0020 /* Value is for long packets */ | ||
507 | 523 | ||
508 | /* Scanning request flags */ | 524 | /* Scanning request flags */ |
509 | #define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ | 525 | #define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ |
@@ -1017,7 +1033,7 @@ struct iw_range | |||
1017 | /* Note : this frequency list doesn't need to fit channel numbers, | 1033 | /* Note : this frequency list doesn't need to fit channel numbers, |
1018 | * because each entry contain its channel index */ | 1034 | * because each entry contain its channel index */ |
1019 | 1035 | ||
1020 | __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ | 1036 | __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ |
1021 | }; | 1037 | }; |
1022 | 1038 | ||
1023 | /* | 1039 | /* |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 0422036af4eb..56a23a0e7f2e 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -116,6 +116,7 @@ int sync_page_range(struct inode *inode, struct address_space *mapping, | |||
116 | loff_t pos, loff_t count); | 116 | loff_t pos, loff_t count); |
117 | int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, | 117 | int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, |
118 | loff_t pos, loff_t count); | 118 | loff_t pos, loff_t count); |
119 | void set_page_dirty_balance(struct page *page); | ||
119 | 120 | ||
120 | /* pdflush.c */ | 121 | /* pdflush.c */ |
121 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl | 122 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 810462f8a374..bb495b7f4680 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -341,7 +341,7 @@ extern int video_usercopy(struct inode *inode, struct file *file, | |||
341 | extern struct video_device* video_devdata(struct file*); | 341 | extern struct video_device* video_devdata(struct file*); |
342 | 342 | ||
343 | #define to_video_device(cd) container_of(cd, struct video_device, class_dev) | 343 | #define to_video_device(cd) container_of(cd, struct video_device, class_dev) |
344 | static inline int | 344 | static inline int __must_check |
345 | video_device_create_file(struct video_device *vfd, | 345 | video_device_create_file(struct video_device *vfd, |
346 | struct class_device_attribute *attr) | 346 | struct class_device_attribute *attr) |
347 | { | 347 | { |
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h index 59406e0dc5b2..2d72496c2029 100644 --- a/include/net/cipso_ipv4.h +++ b/include/net/cipso_ipv4.h | |||
@@ -130,8 +130,9 @@ extern int cipso_v4_rbm_strictvalid; | |||
130 | int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); | 130 | int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); |
131 | int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)); | 131 | int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)); |
132 | struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); | 132 | struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); |
133 | struct sk_buff *cipso_v4_doi_dump_all(size_t headroom); | 133 | int cipso_v4_doi_walk(u32 *skip_cnt, |
134 | struct sk_buff *cipso_v4_doi_dump(u32 doi, size_t headroom); | 134 | int (*callback) (struct cipso_v4_doi *doi_def, void *arg), |
135 | void *cb_arg); | ||
135 | int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain); | 136 | int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain); |
136 | int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def, | 137 | int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def, |
137 | const char *domain); | 138 | const char *domain); |
@@ -152,14 +153,11 @@ static inline struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi) | |||
152 | return NULL; | 153 | return NULL; |
153 | } | 154 | } |
154 | 155 | ||
155 | static inline struct sk_buff *cipso_v4_doi_dump_all(size_t headroom) | 156 | static inline int cipso_v4_doi_walk(u32 *skip_cnt, |
157 | int (*callback) (struct cipso_v4_doi *doi_def, void *arg), | ||
158 | void *cb_arg) | ||
156 | { | 159 | { |
157 | return NULL; | 160 | return 0; |
158 | } | ||
159 | |||
160 | static inline struct sk_buff *cipso_v4_doi_dump(u32 doi, size_t headroom) | ||
161 | { | ||
162 | return NULL; | ||
163 | } | 161 | } |
164 | 162 | ||
165 | static inline int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, | 163 | static inline int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, |
@@ -205,6 +203,7 @@ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway); | |||
205 | int cipso_v4_socket_setattr(const struct socket *sock, | 203 | int cipso_v4_socket_setattr(const struct socket *sock, |
206 | const struct cipso_v4_doi *doi_def, | 204 | const struct cipso_v4_doi *doi_def, |
207 | const struct netlbl_lsm_secattr *secattr); | 205 | const struct netlbl_lsm_secattr *secattr); |
206 | int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr); | ||
208 | int cipso_v4_socket_getattr(const struct socket *sock, | 207 | int cipso_v4_socket_getattr(const struct socket *sock, |
209 | struct netlbl_lsm_secattr *secattr); | 208 | struct netlbl_lsm_secattr *secattr); |
210 | int cipso_v4_skbuff_getattr(const struct sk_buff *skb, | 209 | int cipso_v4_skbuff_getattr(const struct sk_buff *skb, |
@@ -225,6 +224,12 @@ static inline int cipso_v4_socket_setattr(const struct socket *sock, | |||
225 | return -ENOSYS; | 224 | return -ENOSYS; |
226 | } | 225 | } |
227 | 226 | ||
227 | static inline int cipso_v4_sock_getattr(struct sock *sk, | ||
228 | struct netlbl_lsm_secattr *secattr) | ||
229 | { | ||
230 | return -ENOSYS; | ||
231 | } | ||
232 | |||
228 | static inline int cipso_v4_socket_getattr(const struct socket *sock, | 233 | static inline int cipso_v4_socket_getattr(const struct socket *sock, |
229 | struct netlbl_lsm_secattr *secattr) | 234 | struct netlbl_lsm_secattr *secattr) |
230 | { | 235 | { |
diff --git a/include/net/netlabel.h b/include/net/netlabel.h index dd5780b36919..6692430063fd 100644 --- a/include/net/netlabel.h +++ b/include/net/netlabel.h | |||
@@ -57,9 +57,8 @@ | |||
57 | * The payload is dependent on the subsystem specified in the | 57 | * The payload is dependent on the subsystem specified in the |
58 | * 'nlmsghdr->nlmsg_type' and should be defined below, supporting functions | 58 | * 'nlmsghdr->nlmsg_type' and should be defined below, supporting functions |
59 | * should be defined in the corresponding net/netlabel/netlabel_<subsys>.h|c | 59 | * should be defined in the corresponding net/netlabel/netlabel_<subsys>.h|c |
60 | * file. All of the fields in the NetLabel payload are NETLINK attributes, the | 60 | * file. All of the fields in the NetLabel payload are NETLINK attributes, see |
61 | * length of each field is the length of the NETLINK attribute payload, see | 61 | * the include/net/netlink.h file for more information on NETLINK attributes. |
62 | * include/net/netlink.h for more information on NETLINK attributes. | ||
63 | * | 62 | * |
64 | */ | 63 | */ |
65 | 64 | ||
@@ -82,50 +81,6 @@ | |||
82 | #define NETLBL_NLTYPE_UNLABELED 5 | 81 | #define NETLBL_NLTYPE_UNLABELED 5 |
83 | #define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL" | 82 | #define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL" |
84 | 83 | ||
85 | /* NetLabel return codes */ | ||
86 | #define NETLBL_E_OK 0 | ||
87 | |||
88 | /* | ||
89 | * Helper functions | ||
90 | */ | ||
91 | |||
92 | #define NETLBL_LEN_U8 nla_total_size(sizeof(u8)) | ||
93 | #define NETLBL_LEN_U16 nla_total_size(sizeof(u16)) | ||
94 | #define NETLBL_LEN_U32 nla_total_size(sizeof(u32)) | ||
95 | |||
96 | /** | ||
97 | * netlbl_netlink_alloc_skb - Allocate a NETLINK message buffer | ||
98 | * @head: the amount of headroom in bytes | ||
99 | * @body: the desired size (minus headroom) in bytes | ||
100 | * @gfp_flags: the alloc flags to pass to alloc_skb() | ||
101 | * | ||
102 | * Description: | ||
103 | * Allocate a NETLINK message buffer based on the sizes given in @head and | ||
104 | * @body. If @head is greater than zero skb_reserve() is called to reserve | ||
105 | * @head bytes at the start of the buffer. Returns a valid sk_buff pointer on | ||
106 | * success, NULL on failure. | ||
107 | * | ||
108 | */ | ||
109 | static inline struct sk_buff *netlbl_netlink_alloc_skb(size_t head, | ||
110 | size_t body, | ||
111 | gfp_t gfp_flags) | ||
112 | { | ||
113 | struct sk_buff *skb; | ||
114 | |||
115 | skb = alloc_skb(NLMSG_ALIGN(head + body), gfp_flags); | ||
116 | if (skb == NULL) | ||
117 | return NULL; | ||
118 | if (head > 0) { | ||
119 | skb_reserve(skb, head); | ||
120 | if (skb_tailroom(skb) < body) { | ||
121 | kfree_skb(skb); | ||
122 | return NULL; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | return skb; | ||
127 | } | ||
128 | |||
129 | /* | 84 | /* |
130 | * NetLabel - Kernel API for accessing the network packet label mappings. | 85 | * NetLabel - Kernel API for accessing the network packet label mappings. |
131 | * | 86 | * |
@@ -238,6 +193,8 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr, | |||
238 | #ifdef CONFIG_NETLABEL | 193 | #ifdef CONFIG_NETLABEL |
239 | int netlbl_socket_setattr(const struct socket *sock, | 194 | int netlbl_socket_setattr(const struct socket *sock, |
240 | const struct netlbl_lsm_secattr *secattr); | 195 | const struct netlbl_lsm_secattr *secattr); |
196 | int netlbl_sock_getattr(struct sock *sk, | ||
197 | struct netlbl_lsm_secattr *secattr); | ||
241 | int netlbl_socket_getattr(const struct socket *sock, | 198 | int netlbl_socket_getattr(const struct socket *sock, |
242 | struct netlbl_lsm_secattr *secattr); | 199 | struct netlbl_lsm_secattr *secattr); |
243 | int netlbl_skbuff_getattr(const struct sk_buff *skb, | 200 | int netlbl_skbuff_getattr(const struct sk_buff *skb, |
@@ -250,6 +207,12 @@ static inline int netlbl_socket_setattr(const struct socket *sock, | |||
250 | return -ENOSYS; | 207 | return -ENOSYS; |
251 | } | 208 | } |
252 | 209 | ||
210 | static inline int netlbl_sock_getattr(struct sock *sk, | ||
211 | struct netlbl_lsm_secattr *secattr) | ||
212 | { | ||
213 | return -ENOSYS; | ||
214 | } | ||
215 | |||
253 | static inline int netlbl_socket_getattr(const struct socket *sock, | 216 | static inline int netlbl_socket_getattr(const struct socket *sock, |
254 | struct netlbl_lsm_secattr *secattr) | 217 | struct netlbl_lsm_secattr *secattr) |
255 | { | 218 | { |
diff --git a/include/net/netlink.h b/include/net/netlink.h index 11dc2e7f679a..4ab68a7a636a 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -146,11 +146,13 @@ | |||
146 | * nla_ok(nla, remaining) does nla fit into remaining bytes? | 146 | * nla_ok(nla, remaining) does nla fit into remaining bytes? |
147 | * nla_next(nla, remaining) get next netlink attribute | 147 | * nla_next(nla, remaining) get next netlink attribute |
148 | * nla_validate() validate a stream of attributes | 148 | * nla_validate() validate a stream of attributes |
149 | * nla_validate_nested() validate a stream of nested attributes | ||
149 | * nla_find() find attribute in stream of attributes | 150 | * nla_find() find attribute in stream of attributes |
150 | * nla_find_nested() find attribute in nested attributes | 151 | * nla_find_nested() find attribute in nested attributes |
151 | * nla_parse() parse and validate stream of attrs | 152 | * nla_parse() parse and validate stream of attrs |
152 | * nla_parse_nested() parse nested attribuets | 153 | * nla_parse_nested() parse nested attribuets |
153 | * nla_for_each_attr() loop over all attributes | 154 | * nla_for_each_attr() loop over all attributes |
155 | * nla_for_each_nested() loop over the nested attributes | ||
154 | *========================================================================= | 156 | *========================================================================= |
155 | */ | 157 | */ |
156 | 158 | ||
@@ -950,6 +952,24 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | |||
950 | } | 952 | } |
951 | 953 | ||
952 | /** | 954 | /** |
955 | * nla_validate_nested - Validate a stream of nested attributes | ||
956 | * @start: container attribute | ||
957 | * @maxtype: maximum attribute type to be expected | ||
958 | * @policy: validation policy | ||
959 | * | ||
960 | * Validates all attributes in the nested attribute stream against the | ||
961 | * specified policy. Attributes with a type exceeding maxtype will be | ||
962 | * ignored. See documenation of struct nla_policy for more details. | ||
963 | * | ||
964 | * Returns 0 on success or a negative error code. | ||
965 | */ | ||
966 | static inline int nla_validate_nested(struct nlattr *start, int maxtype, | ||
967 | struct nla_policy *policy) | ||
968 | { | ||
969 | return nla_validate(nla_data(start), nla_len(start), maxtype, policy); | ||
970 | } | ||
971 | |||
972 | /** | ||
953 | * nla_for_each_attr - iterate over a stream of attributes | 973 | * nla_for_each_attr - iterate over a stream of attributes |
954 | * @pos: loop counter, set to current attribute | 974 | * @pos: loop counter, set to current attribute |
955 | * @head: head of attribute stream | 975 | * @head: head of attribute stream |