diff options
author | Thomas Gleixner <tglx@tglx.tec.linutronix.de> | 2005-06-26 17:20:36 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-06-26 17:20:36 -0400 |
commit | 7ca6448dbfb398bba36eda3c01bc14b86c3675be (patch) | |
tree | 82d934ebf07f22a2c64c3b6d82ec24082878b43a /include | |
parent | f1f67a9874f1a4bba1adff6d694aa52e5f52ff1a (diff) | |
parent | 7d681b23d6cc14a8c026ea6756242cb522cbbcae (diff) |
Merge with rsync://fileserver/linux
Update to Linus latest
Diffstat (limited to 'include')
589 files changed, 22961 insertions, 4901 deletions
diff --git a/include/asm-alpha/agp.h b/include/asm-alpha/agp.h index c99dbbb5bcb5..ef855a3bc0f5 100644 --- a/include/asm-alpha/agp.h +++ b/include/asm-alpha/agp.h | |||
@@ -10,4 +10,14 @@ | |||
10 | #define flush_agp_mappings() | 10 | #define flush_agp_mappings() |
11 | #define flush_agp_cache() mb() | 11 | #define flush_agp_cache() mb() |
12 | 12 | ||
13 | /* Convert a physical address to an address suitable for the GART. */ | ||
14 | #define phys_to_gart(x) (x) | ||
15 | #define gart_to_phys(x) (x) | ||
16 | |||
17 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ | ||
18 | #define alloc_gatt_pages(order) \ | ||
19 | ((char *)__get_free_pages(GFP_KERNEL, (order))) | ||
20 | #define free_gatt_pages(table, order) \ | ||
21 | free_pages((unsigned long)(table), (order)) | ||
22 | |||
13 | #endif | 23 | #endif |
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h index 726c150dcbe4..a011ef4cf3d3 100644 --- a/include/asm-alpha/mmzone.h +++ b/include/asm-alpha/mmzone.h | |||
@@ -57,7 +57,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
57 | * Given a kernel address, find the home node of the underlying memory. | 57 | * Given a kernel address, find the home node of the underlying memory. |
58 | */ | 58 | */ |
59 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | 59 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) |
60 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
61 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 60 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
62 | 61 | ||
63 | #define local_mapnr(kvaddr) \ | 62 | #define local_mapnr(kvaddr) \ |
@@ -108,7 +107,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
108 | #define pfn_to_page(pfn) \ | 107 | #define pfn_to_page(pfn) \ |
109 | ({ \ | 108 | ({ \ |
110 | unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \ | 109 | unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \ |
111 | (node_mem_map(kvaddr_to_nid(kaddr)) + local_mapnr(kaddr)); \ | 110 | (NODE_DATA(kvaddr_to_nid(kaddr))->node_mem_map + local_mapnr(kaddr)); \ |
112 | }) | 111 | }) |
113 | 112 | ||
114 | #define page_to_pfn(page) \ | 113 | #define page_to_pfn(page) \ |
diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h index cbc173ae45aa..9950706abdf8 100644 --- a/include/asm-alpha/smp.h +++ b/include/asm-alpha/smp.h | |||
@@ -43,7 +43,7 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS]; | |||
43 | #define PROC_CHANGE_PENALTY 20 | 43 | #define PROC_CHANGE_PENALTY 20 |
44 | 44 | ||
45 | #define hard_smp_processor_id() __hard_smp_processor_id() | 45 | #define hard_smp_processor_id() __hard_smp_processor_id() |
46 | #define smp_processor_id() (current_thread_info()->cpu) | 46 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
47 | 47 | ||
48 | extern cpumask_t cpu_present_mask; | 48 | extern cpumask_t cpu_present_mask; |
49 | extern cpumask_t cpu_online_map; | 49 | extern cpumask_t cpu_online_map; |
diff --git a/include/asm-arm/arch-aaec2000/aaec2000.h b/include/asm-arm/arch-aaec2000/aaec2000.h new file mode 100644 index 000000000000..0e9b7e18af05 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/aaec2000.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/aaec2000.h | ||
3 | * | ||
4 | * AAEC-2000 registers definition | ||
5 | * | ||
6 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
13 | #ifndef __ASM_ARCH_AAEC2000_H | ||
14 | #define __ASM_ARCH_AAEC2000_H | ||
15 | |||
16 | #ifndef __ASM_ARCH_HARDWARE_H | ||
17 | #error You must include hardware.h not this file | ||
18 | #endif /* __ASM_ARCH_HARDWARE_H */ | ||
19 | |||
20 | /* Interrupt controller */ | ||
21 | #define IRQ_BASE __REG(0x80000500) | ||
22 | #define IRQ_INTSR __REG(0x80000500) /* Int Status Register */ | ||
23 | #define IRQ_INTRSR __REG(0x80000504) /* Int Raw (unmasked) Status */ | ||
24 | #define IRQ_INTENS __REG(0x80000508) /* Int Enable Set */ | ||
25 | #define IRQ_INTENC __REG(0x8000050c) /* Int Enable Clear */ | ||
26 | |||
27 | /* UART 1 */ | ||
28 | #define UART1_BASE __REG(0x80000600) | ||
29 | #define UART1_DR __REG(0x80000600) /* Data/FIFO Register */ | ||
30 | #define UART1_LCR __REG(0x80000604) /* Link Control Register */ | ||
31 | #define UART1_BRCR __REG(0x80000608) /* Baud Rate Control Register */ | ||
32 | #define UART1_CR __REG(0x8000060c) /* Control Register */ | ||
33 | #define UART1_SR __REG(0x80000610) /* Status Register */ | ||
34 | #define UART1_INT __REG(0x80000614) /* Interrupt Status Register */ | ||
35 | #define UART1_INTM __REG(0x80000618) /* Interrupt Mask Register */ | ||
36 | #define UART1_INTRES __REG(0x8000061c) /* Int Result (masked status) Register */ | ||
37 | |||
38 | /* UART 2 */ | ||
39 | #define UART2_BASE __REG(0x80000700) | ||
40 | #define UART2_DR __REG(0x80000700) /* Data/FIFO Register */ | ||
41 | #define UART2_LCR __REG(0x80000704) /* Link Control Register */ | ||
42 | #define UART2_BRCR __REG(0x80000708) /* Baud Rate Control Register */ | ||
43 | #define UART2_CR __REG(0x8000070c) /* Control Register */ | ||
44 | #define UART2_SR __REG(0x80000710) /* Status Register */ | ||
45 | #define UART2_INT __REG(0x80000714) /* Interrupt Status Register */ | ||
46 | #define UART2_INTM __REG(0x80000718) /* Interrupt Mask Register */ | ||
47 | #define UART2_INTRES __REG(0x8000071c) /* Int Result (masked status) Register */ | ||
48 | |||
49 | /* UART 3 */ | ||
50 | #define UART3_BASE __REG(0x80000800) | ||
51 | #define UART3_DR __REG(0x80000800) /* Data/FIFO Register */ | ||
52 | #define UART3_LCR __REG(0x80000804) /* Link Control Register */ | ||
53 | #define UART3_BRCR __REG(0x80000808) /* Baud Rate Control Register */ | ||
54 | #define UART3_CR __REG(0x8000080c) /* Control Register */ | ||
55 | #define UART3_SR __REG(0x80000810) /* Status Register */ | ||
56 | #define UART3_INT __REG(0x80000814) /* Interrupt Status Register */ | ||
57 | #define UART3_INTM __REG(0x80000818) /* Interrupt Mask Register */ | ||
58 | #define UART3_INTRES __REG(0x8000081c) /* Int Result (masked status) Register */ | ||
59 | |||
60 | /* These are used in some places */ | ||
61 | #define _UART1_BASE __PREG(UART1_BASE) | ||
62 | #define _UART2_BASE __PREG(UART2_BASE) | ||
63 | #define _UART3_BASE __PREG(UART3_BASE) | ||
64 | |||
65 | /* UART Registers Offsets */ | ||
66 | #define UART_DR 0x00 | ||
67 | #define UART_LCR 0x04 | ||
68 | #define UART_BRCR 0x08 | ||
69 | #define UART_CR 0x0c | ||
70 | #define UART_SR 0x10 | ||
71 | #define UART_INT 0x14 | ||
72 | #define UART_INTM 0x18 | ||
73 | #define UART_INTRES 0x1c | ||
74 | |||
75 | /* UART_LCR Bitmask */ | ||
76 | #define UART_LCR_BRK (1 << 0) /* Send Break */ | ||
77 | #define UART_LCR_PEN (1 << 1) /* Parity Enable */ | ||
78 | #define UART_LCR_EP (1 << 2) /* Even/Odd Parity */ | ||
79 | #define UART_LCR_S2 (1 << 3) /* One/Two Stop bits */ | ||
80 | #define UART_LCR_FIFO (1 << 4) /* FIFO Enable */ | ||
81 | #define UART_LCR_WL5 (0 << 5) /* Word Length - 5 bits */ | ||
82 | #define UART_LCR_WL6 (1 << 5) /* Word Length - 6 bits */ | ||
83 | #define UART_LCR_WL7 (1 << 6) /* Word Length - 7 bits */ | ||
84 | #define UART_LCR_WL8 (1 << 7) /* Word Length - 8 bits */ | ||
85 | |||
86 | /* UART_CR Bitmask */ | ||
87 | #define UART_CR_EN (1 << 0) /* UART Enable */ | ||
88 | #define UART_CR_SIR (1 << 1) /* IrDA SIR Enable */ | ||
89 | #define UART_CR_SIRLP (1 << 2) /* Low Power IrDA Enable */ | ||
90 | #define UART_CR_RXP (1 << 3) /* Receive Pin Polarity */ | ||
91 | #define UART_CR_TXP (1 << 4) /* Transmit Pin Polarity */ | ||
92 | #define UART_CR_MXP (1 << 5) /* Modem Pin Polarity */ | ||
93 | #define UART_CR_LOOP (1 << 6) /* Loopback Mode */ | ||
94 | |||
95 | /* UART_SR Bitmask */ | ||
96 | #define UART_SR_CTS (1 << 0) /* Clear To Send Status */ | ||
97 | #define UART_SR_DSR (1 << 1) /* Data Set Ready Status */ | ||
98 | #define UART_SR_DCD (1 << 2) /* Data Carrier Detect Status */ | ||
99 | #define UART_SR_TxBSY (1 << 3) /* Transmitter Busy Status */ | ||
100 | #define UART_SR_RxFE (1 << 4) /* Receive FIFO Empty Status */ | ||
101 | #define UART_SR_TxFF (1 << 5) /* Transmit FIFO Full Status */ | ||
102 | #define UART_SR_RxFF (1 << 6) /* Receive FIFO Full Status */ | ||
103 | #define UART_SR_TxFE (1 << 7) /* Transmit FIFO Empty Status */ | ||
104 | |||
105 | /* UART_INT Bitmask */ | ||
106 | #define UART_INT_RIS (1 << 0) /* Rx Interrupt */ | ||
107 | #define UART_INT_TIS (1 << 1) /* Tx Interrupt */ | ||
108 | #define UART_INT_MIS (1 << 2) /* Modem Interrupt */ | ||
109 | #define UART_INT_RTIS (1 << 3) /* Receive Timeout Interrupt */ | ||
110 | |||
111 | /* Timer 1 */ | ||
112 | #define TIMER1_BASE __REG(0x80000c00) | ||
113 | #define TIMER1_LOAD __REG(0x80000c00) /* Timer 1 Load Register */ | ||
114 | #define TIMER1_VAL __REG(0x80000c04) /* Timer 1 Value Register */ | ||
115 | #define TIMER1_CTRL __REG(0x80000c08) /* Timer 1 Control Register */ | ||
116 | #define TIMER1_CLEAR __REG(0x80000c0c) /* Timer 1 Clear Register */ | ||
117 | |||
118 | /* Timer 2 */ | ||
119 | #define TIMER2_BASE __REG(0x80000d00) | ||
120 | #define TIMER2_LOAD __REG(0x80000d00) /* Timer 2 Load Register */ | ||
121 | #define TIMER2_VAL __REG(0x80000d04) /* Timer 2 Value Register */ | ||
122 | #define TIMER2_CTRL __REG(0x80000d08) /* Timer 2 Control Register */ | ||
123 | #define TIMER2_CLEAR __REG(0x80000d0c) /* Timer 2 Clear Register */ | ||
124 | |||
125 | /* Timer 3 */ | ||
126 | #define TIMER3_BASE __REG(0x80000e00) | ||
127 | #define TIMER3_LOAD __REG(0x80000e00) /* Timer 3 Load Register */ | ||
128 | #define TIMER3_VAL __REG(0x80000e04) /* Timer 3 Value Register */ | ||
129 | #define TIMER3_CTRL __REG(0x80000e08) /* Timer 3 Control Register */ | ||
130 | #define TIMER3_CLEAR __REG(0x80000e0c) /* Timer 3 Clear Register */ | ||
131 | |||
132 | /* Timer Control register bits */ | ||
133 | #define TIMER_CTRL_ENABLE (1 << 7) /* Enable (Start° Timer */ | ||
134 | #define TIMER_CTRL_PERIODIC (1 << 6) /* Periodic Running Mode */ | ||
135 | #define TIMER_CTRL_FREE_RUNNING (0 << 6) /* Normal Running Mode */ | ||
136 | #define TIMER_CTRL_CLKSEL_508K (1 << 3) /* 508KHz Clock select (Timer 1, 2) */ | ||
137 | #define TIMER_CTRL_CLKSEL_2K (0 << 3) /* 2KHz Clock Select (Timer 1, 2)*/ | ||
138 | |||
139 | /* Power and State Control */ | ||
140 | #define POWER_BASE __REG(0x80000400) | ||
141 | #define POWER_PWRSR __REG(0x80000400) /* Power Status Register */ | ||
142 | #define POWER_PWRCNT __REG(0x80000404) /* Power/Clock control */ | ||
143 | #define POWER_HALT __REG(0x80000408) /* Power Idle Mode */ | ||
144 | #define POWER_STDBY __REG(0x8000040c) /* Power Standby Mode */ | ||
145 | #define POWER_BLEOI __REG(0x80000410) /* Battery Low End of Interrupt */ | ||
146 | #define POWER_MCEOI __REG(0x80000414) /* Media Changed EoI */ | ||
147 | #define POWER_TEOI __REG(0x80000418) /* Tick EoI */ | ||
148 | #define POWER_STFCLR __REG(0x8000041c) /* NbFlg, RSTFlg, PFFlg, CLDFlg Clear */ | ||
149 | #define POWER_CLKSET __REG(0x80000420) /* Clock Speed Control */ | ||
150 | |||
151 | #endif /* __ARM_ARCH_AAEC2000_H */ | ||
diff --git a/include/asm-arm/arch-aaec2000/debug-macro.S b/include/asm-arm/arch-aaec2000/debug-macro.S new file mode 100644 index 000000000000..e4f1fa539a74 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/debug-macro.S | |||
@@ -0,0 +1,36 @@ | |||
1 | /* linux/include/asm-arm/arch-aaec2000/debug-macro.S | ||
2 | * | ||
3 | * Debugging macro include header | ||
4 | * | ||
5 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
12 | .macro addruart,rx | ||
13 | mrc p15, 0, \rx, c1, c0 | ||
14 | tst \rx, #1 @ MMU enabled? | ||
15 | moveq \rx, #0x80000000 @ physical | ||
16 | movne \rx, #io_p2v(0x80000000) @ virtual | ||
17 | orr \rx, \rx, #0x00000800 | ||
18 | .endm | ||
19 | |||
20 | .macro senduart,rd,rx | ||
21 | str \rd, [\rx, #0] | ||
22 | .endm | ||
23 | |||
24 | .macro busyuart,rd,rx | ||
25 | 1002: ldr \rd, [\rx, #0x10] | ||
26 | tst \rd, #(1 << 7) | ||
27 | beq 1002b | ||
28 | .endm | ||
29 | |||
30 | .macro waituart,rd,rx | ||
31 | #if 0 | ||
32 | 1001: ldr \rd, [\rx, #0x10] | ||
33 | tst \rd, #(1 << 5) | ||
34 | beq 1001b | ||
35 | #endif | ||
36 | .endm | ||
diff --git a/include/asm-arm/arch-aaec2000/dma.h b/include/asm-arm/arch-aaec2000/dma.h new file mode 100644 index 000000000000..28c890b4a1d3 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/dma.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/dma.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_DMA_H | ||
12 | #define __ASM_ARCH_DMA_H | ||
13 | |||
14 | #define MAX_DMA_ADDRESS 0xffffffff | ||
15 | #define MAX_DMA_CHANNELS 0 | ||
16 | |||
17 | #endif | ||
diff --git a/include/asm-arm/arch-aaec2000/entry-macro.S b/include/asm-arm/arch-aaec2000/entry-macro.S new file mode 100644 index 000000000000..df31313ab07e --- /dev/null +++ b/include/asm-arm/arch-aaec2000/entry-macro.S | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/entry-macro.S | ||
3 | * | ||
4 | * Low-level IRQ helper for aaec-2000 based platforms | ||
5 | * | ||
6 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | */ | ||
13 | |||
14 | .macro disable_fiq | ||
15 | .endm | ||
16 | |||
17 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
18 | mov r4, #0xf8000000 | ||
19 | add r4, r4, #0x00000500 | ||
20 | mov \base, r4 | ||
21 | ldr \irqstat, [\base, #0] | ||
22 | cmp \irqstat, #0 | ||
23 | bne 1001f | ||
24 | ldr \irqnr, =NR_IRQS+1 | ||
25 | b 1003f | ||
26 | 1001: mov \irqnr, #0 | ||
27 | 1002: ands \tmp, \irqstat, #1 | ||
28 | mov \irqstat, \irqstat, LSR #1 | ||
29 | add \irqnr, \irqnr, #1 | ||
30 | beq 1002b | ||
31 | sub \irqnr, \irqnr, #1 | ||
32 | 1003: | ||
33 | .endm | ||
diff --git a/include/asm-arm/arch-aaec2000/hardware.h b/include/asm-arm/arch-aaec2000/hardware.h new file mode 100644 index 000000000000..4c37219e030e --- /dev/null +++ b/include/asm-arm/arch-aaec2000/hardware.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/hardware.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_HARDWARE_H | ||
12 | #define __ASM_ARCH_HARDWARE_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | |||
16 | /* The kernel is loaded at physical address 0xf8000000. | ||
17 | * We map the IO space a bit after | ||
18 | */ | ||
19 | #define PIO_APB_BASE 0x80000000 | ||
20 | #define VIO_APB_BASE 0xf8000000 | ||
21 | #define IO_APB_LENGTH 0x2000 | ||
22 | #define PIO_AHB_BASE 0x80002000 | ||
23 | #define VIO_AHB_BASE 0xf8002000 | ||
24 | #define IO_AHB_LENGTH 0x2000 | ||
25 | |||
26 | #define VIO_BASE VIO_APB_BASE | ||
27 | #define PIO_BASE PIO_APB_BASE | ||
28 | |||
29 | #define io_p2v(x) ( (x) - PIO_BASE + VIO_BASE ) | ||
30 | #define io_v2p(x) ( (x) + PIO_BASE - VIO_BASE ) | ||
31 | |||
32 | #ifndef __ASSEMBLY__ | ||
33 | |||
34 | #include <asm/types.h> | ||
35 | |||
36 | /* FIXME: Is it needed to optimize this a la pxa ?? */ | ||
37 | #define __REG(x) (*((volatile u32 *)io_p2v(x))) | ||
38 | #define __PREG(x) (io_v2p((u32)&(x))) | ||
39 | |||
40 | #else /* __ASSEMBLY__ */ | ||
41 | |||
42 | #define __REG(x) io_p2v(x) | ||
43 | #define __PREG(x) io_v2p(x) | ||
44 | |||
45 | #endif | ||
46 | |||
47 | #include "aaec2000.h" | ||
48 | |||
49 | #endif /* __ASM_ARCH_HARDWARE_H */ | ||
diff --git a/include/asm-arm/arch-aaec2000/io.h b/include/asm-arm/arch-aaec2000/io.h new file mode 100644 index 000000000000..c58a8d10425a --- /dev/null +++ b/include/asm-arm/arch-aaec2000/io.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/io.h | ||
3 | * | ||
4 | * Copied from asm/arch/sa1100/io.h | ||
5 | */ | ||
6 | #ifndef __ASM_ARM_ARCH_IO_H | ||
7 | #define __ASM_ARM_ARCH_IO_H | ||
8 | |||
9 | #define IO_SPACE_LIMIT 0xffffffff | ||
10 | |||
11 | /* | ||
12 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
13 | * drivers out there that might just work if we fake them... | ||
14 | */ | ||
15 | #define __io(a) ((void __iomem *)(a)) | ||
16 | #define __mem_pci(a) (a) | ||
17 | #define __mem_isa(a) (a) | ||
18 | |||
19 | #endif | ||
diff --git a/include/asm-arm/arch-aaec2000/irqs.h b/include/asm-arm/arch-aaec2000/irqs.h new file mode 100644 index 000000000000..de252220e806 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/irqs.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/irqs.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_IRQS_H | ||
12 | #define __ASM_ARCH_IRQS_H | ||
13 | |||
14 | |||
15 | #define INT_GPIOF0_FIQ 0 /* External GPIO Port F O Fast Interrupt Input */ | ||
16 | #define INT_BL_FIQ 1 /* Battery Low Fast Interrupt */ | ||
17 | #define INT_WE_FIQ 2 /* Watchdog Expired Fast Interrupt */ | ||
18 | #define INT_MV_FIQ 3 /* Media Changed Interrupt */ | ||
19 | #define INT_SC 4 /* Sound Codec Interrupt */ | ||
20 | #define INT_GPIO1 5 /* GPIO Port F Configurable Int 1 */ | ||
21 | #define INT_GPIO2 6 /* GPIO Port F Configurable Int 2 */ | ||
22 | #define INT_GPIO3 7 /* GPIO Port F Configurable Int 3 */ | ||
23 | #define INT_TMR1_OFL 8 /* Timer 1 Overflow Interrupt */ | ||
24 | #define INT_TMR2_OFL 9 /* Timer 2 Overflow Interrupt */ | ||
25 | #define INT_RTC_CM 10 /* RTC Compare Match Interrupt */ | ||
26 | #define INT_TICK 11 /* 64Hz Tick Interrupt */ | ||
27 | #define INT_UART1 12 /* UART1 Interrupt */ | ||
28 | #define INT_UART2 13 /* UART2 & Modem State Changed Interrupt */ | ||
29 | #define INT_LCD 14 /* LCD Interrupt */ | ||
30 | #define INT_SSI 15 /* SSI End of Transfer Interrupt */ | ||
31 | #define INT_UART3 16 /* UART3 Interrupt */ | ||
32 | #define INT_SCI 17 /* SCI Interrupt */ | ||
33 | #define INT_AAC 18 /* Advanced Audio Codec Interrupt */ | ||
34 | #define INT_MMC 19 /* MMC Interrupt */ | ||
35 | #define INT_USB 20 /* USB Interrupt */ | ||
36 | #define INT_DMA 21 /* DMA Interrupt */ | ||
37 | #define INT_TMR3_UOFL 22 /* Timer 3 Underflow Interrupt */ | ||
38 | #define INT_GPIO4 23 /* GPIO Port F Configurable Int 4 */ | ||
39 | #define INT_GPIO5 24 /* GPIO Port F Configurable Int 4 */ | ||
40 | #define INT_GPIO6 25 /* GPIO Port F Configurable Int 4 */ | ||
41 | #define INT_GPIO7 26 /* GPIO Port F Configurable Int 4 */ | ||
42 | #define INT_BMI 27 /* BMI Interrupt */ | ||
43 | |||
44 | #define NR_IRQS (INT_BMI + 1) | ||
45 | |||
46 | #endif /* __ASM_ARCH_IRQS_H */ | ||
diff --git a/include/asm-arm/arch-aaec2000/memory.h b/include/asm-arm/arch-aaec2000/memory.h new file mode 100644 index 000000000000..681b6a6171a1 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/memory.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/memory.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_MEMORY_H | ||
12 | #define __ASM_ARCH_MEMORY_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | |||
16 | #define PHYS_OFFSET (0xf0000000UL) | ||
17 | |||
18 | #define __virt_to_bus(x) __virt_to_phys(x) | ||
19 | #define __bus_to_virt(x) __phys_to_virt(x) | ||
20 | |||
21 | #ifdef CONFIG_DISCONTIGMEM | ||
22 | |||
23 | /* | ||
24 | * The nodes are the followings: | ||
25 | * | ||
26 | * node 0: 0xf000.0000 - 0xf3ff.ffff | ||
27 | * node 1: 0xf400.0000 - 0xf7ff.ffff | ||
28 | * node 2: 0xf800.0000 - 0xfbff.ffff | ||
29 | * node 3: 0xfc00.0000 - 0xffff.ffff | ||
30 | */ | ||
31 | |||
32 | /* | ||
33 | * Given a kernel address, find the home node of the underlying memory. | ||
34 | */ | ||
35 | #define KVADDR_TO_NID(addr) \ | ||
36 | (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MAX_MEM_SHIFT) | ||
37 | |||
38 | /* | ||
39 | * Given a page frame number, convert it to a node id. | ||
40 | */ | ||
41 | #define PFN_TO_NID(pfn) \ | ||
42 | (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MAX_MEM_SHIFT - PAGE_SHIFT)) | ||
43 | |||
44 | /* | ||
45 | * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory | ||
46 | * and return the mem_map of that node. | ||
47 | */ | ||
48 | #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr)) | ||
49 | |||
50 | /* | ||
51 | * Given a page frame number, find the owning node of the memory | ||
52 | * and return the mem_map of that node. | ||
53 | */ | ||
54 | #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn)) | ||
55 | |||
56 | /* | ||
57 | * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory | ||
58 | * and returns the index corresponding to the appropriate page in the | ||
59 | * node's mem_map. | ||
60 | */ | ||
61 | #define LOCAL_MAP_NR(addr) \ | ||
62 | (((unsigned long)(addr) & (NODE_MAX_MEM_SIZE - 1)) >> PAGE_SHIFT) | ||
63 | |||
64 | #define NODE_MAX_MEM_SHIFT 26 | ||
65 | #define NODE_MAX_MEM_SIZE (1 << NODE_MAX_MEM_SHIFT) | ||
66 | |||
67 | #else | ||
68 | |||
69 | #define PFN_TO_NID(addr) (0) | ||
70 | |||
71 | #endif /* CONFIG_DISCONTIGMEM */ | ||
72 | |||
73 | #endif /* __ASM_ARCH_MEMORY_H */ | ||
diff --git a/include/asm-arm/arch-aaec2000/param.h b/include/asm-arm/arch-aaec2000/param.h new file mode 100644 index 000000000000..139936c2faf2 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/param.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/param.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_PARAM_H | ||
12 | #define __ASM_ARCH_PARAM_H | ||
13 | |||
14 | #endif /* __ASM_ARCH_PARAM_H */ | ||
15 | |||
diff --git a/include/asm-arm/arch-aaec2000/system.h b/include/asm-arm/arch-aaec2000/system.h new file mode 100644 index 000000000000..08de97b407a8 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/system.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaed2000/system.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_SYSTEM_H | ||
12 | #define __ASM_ARCH_SYSTEM_H | ||
13 | |||
14 | static inline void arch_idle(void) | ||
15 | { | ||
16 | cpu_do_idle(); | ||
17 | } | ||
18 | |||
19 | static inline void arch_reset(char mode) | ||
20 | { | ||
21 | cpu_reset(0); | ||
22 | } | ||
23 | |||
24 | #endif /* __ASM_ARCH_SYSTEM_H */ | ||
diff --git a/include/asm-arm/arch-aaec2000/timex.h b/include/asm-arm/arch-aaec2000/timex.h new file mode 100644 index 000000000000..f5708b38fb7f --- /dev/null +++ b/include/asm-arm/arch-aaec2000/timex.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/timex.h | ||
3 | * | ||
4 | * AAEC-2000 Architecture timex specification | ||
5 | * | ||
6 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
13 | #ifndef __ASM_ARCH_TIMEX_H | ||
14 | #define __ASM_ARCH_TIMEX_H | ||
15 | |||
16 | #define CLOCK_TICK_RATE 508000 | ||
17 | |||
18 | #endif /* __ASM_ARCH_TIMEX_H */ | ||
diff --git a/include/asm-arm/arch-aaec2000/uncompress.h b/include/asm-arm/arch-aaec2000/uncompress.h new file mode 100644 index 000000000000..fff0c94b75c4 --- /dev/null +++ b/include/asm-arm/arch-aaec2000/uncompress.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/uncompress.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_UNCOMPRESS_H | ||
12 | #define __ASM_ARCH_UNCOMPRESS_H | ||
13 | |||
14 | #include "hardware.h" | ||
15 | |||
16 | #define UART(x) (*(volatile unsigned long *)(serial_port + (x))) | ||
17 | |||
18 | static void putstr( const char *s ) | ||
19 | { | ||
20 | unsigned long serial_port; | ||
21 | do { | ||
22 | serial_port = _UART3_BASE; | ||
23 | if (UART(UART_CR) & UART_CR_EN) break; | ||
24 | serial_port = _UART1_BASE; | ||
25 | if (UART(UART_CR) & UART_CR_EN) break; | ||
26 | serial_port = _UART2_BASE; | ||
27 | if (UART(UART_CR) & UART_CR_EN) break; | ||
28 | return; | ||
29 | } while (0); | ||
30 | |||
31 | for (; *s; s++) { | ||
32 | /* wait for space in the UART's transmitter */ | ||
33 | while ((UART(UART_SR) & UART_SR_TxFF)); | ||
34 | /* send the character out. */ | ||
35 | UART(UART_DR) = *s; | ||
36 | /* if a LF, also do CR... */ | ||
37 | if (*s == 10) { | ||
38 | while ((UART(UART_SR) & UART_SR_TxFF)); | ||
39 | UART(UART_DR) = 13; | ||
40 | } | ||
41 | } | ||
42 | } | ||
43 | |||
44 | #define arch_decomp_setup() | ||
45 | #define arch_decomp_wdog() | ||
46 | |||
47 | #endif /* __ASM_ARCH_UNCOMPRESS_H */ | ||
diff --git a/include/asm-arm/arch-aaec2000/vmalloc.h b/include/asm-arm/arch-aaec2000/vmalloc.h new file mode 100644 index 000000000000..ecb991e2e4ff --- /dev/null +++ b/include/asm-arm/arch-aaec2000/vmalloc.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/arch-aaec2000/vmalloc.h | ||
3 | * | ||
4 | * Copyright (c) 2005 Nicolas Bellido Y Ortega | ||
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 | |||
11 | #ifndef __ASM_ARCH_VMALLOC_H | ||
12 | #define __ASM_ARCH_VMALLOC_H | ||
13 | |||
14 | #define VMALLOC_END (PAGE_OFFSET + 0x10000000) | ||
15 | |||
16 | #endif /* __ASM_ARCH_VMALLOC_H */ | ||
diff --git a/include/asm-arm/arch-integrator/platform.h b/include/asm-arm/arch-integrator/platform.h index bd364f5a99bc..96ad3d2a66d1 100644 --- a/include/asm-arm/arch-integrator/platform.h +++ b/include/asm-arm/arch-integrator/platform.h | |||
@@ -293,7 +293,11 @@ | |||
293 | #define INTEGRATOR_DBG_SWITCH (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_SWITCH_OFFSET) | 293 | #define INTEGRATOR_DBG_SWITCH (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_SWITCH_OFFSET) |
294 | 294 | ||
295 | 295 | ||
296 | #if defined(CONFIG_ARCH_INTEGRATOR_AP) | ||
296 | #define INTEGRATOR_GPIO_BASE 0x1B000000 /* GPIO */ | 297 | #define INTEGRATOR_GPIO_BASE 0x1B000000 /* GPIO */ |
298 | #elif defined(CONFIG_ARCH_INTEGRATOR_CP) | ||
299 | #define INTEGRATOR_GPIO_BASE 0xC9000000 /* GPIO */ | ||
300 | #endif | ||
297 | 301 | ||
298 | /* ------------------------------------------------------------------------ | 302 | /* ------------------------------------------------------------------------ |
299 | * KMI keyboard/mouse definitions | 303 | * KMI keyboard/mouse definitions |
diff --git a/include/asm-arm/arch-integrator/smp.h b/include/asm-arm/arch-integrator/smp.h new file mode 100644 index 000000000000..0ec7093f7c37 --- /dev/null +++ b/include/asm-arm/arch-integrator/smp.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef ASMARM_ARCH_SMP_H | ||
2 | #define ASMARM_ARCH_SMP_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | #include <asm/arch/hardware.h> | ||
7 | #include <asm/io.h> | ||
8 | |||
9 | #define hard_smp_processor_id() \ | ||
10 | ({ \ | ||
11 | unsigned int cpunum; \ | ||
12 | __asm__("mrc p15, 0, %0, c0, c0, 5" \ | ||
13 | : "=r" (cpunum)); \ | ||
14 | cpunum &= 0x0F; \ | ||
15 | }) | ||
16 | |||
17 | extern void secondary_scan_irqs(void); | ||
18 | |||
19 | #endif | ||
diff --git a/include/asm-arm/arch-ixp2000/gpio.h b/include/asm-arm/arch-ixp2000/gpio.h index 84634af5cc64..03cbbe1fd9d8 100644 --- a/include/asm-arm/arch-ixp2000/gpio.h +++ b/include/asm-arm/arch-ixp2000/gpio.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * include/asm-arm/arch-ixp2000/ixp2000-gpio.h | 2 | * include/asm-arm/arch-ixp2000/gpio.h |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Intel Corporation. | 4 | * Copyright (C) 2002 Intel Corporation. |
5 | * | 5 | * |
@@ -16,26 +16,18 @@ | |||
16 | * Use this instead of directly setting the GPIO registers. | 16 | * Use this instead of directly setting the GPIO registers. |
17 | * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb) | 17 | * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb) |
18 | */ | 18 | */ |
19 | #ifndef _ASM_ARCH_IXP2000_GPIO_H_ | 19 | #ifndef __ASM_ARCH_GPIO_H |
20 | #define _ASM_ARCH_IXP2000_GPIO_H_ | 20 | #define __ASM_ARCH_GPIO_H |
21 | 21 | ||
22 | #ifndef __ASSEMBLY__ | 22 | #ifndef __ASSEMBLY__ |
23 | #define GPIO_OUT 0x0 | 23 | |
24 | #define GPIO_IN 0x80 | 24 | #define GPIO_IN 0 |
25 | #define GPIO_OUT 1 | ||
25 | 26 | ||
26 | #define IXP2000_GPIO_LOW 0 | 27 | #define IXP2000_GPIO_LOW 0 |
27 | #define IXP2000_GPIO_HIGH 1 | 28 | #define IXP2000_GPIO_HIGH 1 |
28 | 29 | ||
29 | #define GPIO_NO_EDGES 0 | 30 | extern void gpio_line_config(int line, int direction); |
30 | #define GPIO_FALLING_EDGE 1 | ||
31 | #define GPIO_RISING_EDGE 2 | ||
32 | #define GPIO_BOTH_EDGES 3 | ||
33 | #define GPIO_LEVEL_LOW 4 | ||
34 | #define GPIO_LEVEL_HIGH 8 | ||
35 | |||
36 | extern void set_GPIO_IRQ_edge(int gpio_nr, int edge); | ||
37 | extern void set_GPIO_IRQ_level(int gpio_nr, int level); | ||
38 | extern void gpio_line_config(int line, int style); | ||
39 | 31 | ||
40 | static inline int gpio_line_get(int line) | 32 | static inline int gpio_line_get(int line) |
41 | { | 33 | { |
@@ -45,11 +37,12 @@ static inline int gpio_line_get(int line) | |||
45 | static inline void gpio_line_set(int line, int value) | 37 | static inline void gpio_line_set(int line, int value) |
46 | { | 38 | { |
47 | if (value == IXP2000_GPIO_HIGH) { | 39 | if (value == IXP2000_GPIO_HIGH) { |
48 | ixp_reg_write(IXP2000_GPIO_POSR, BIT(line)); | 40 | ixp2000_reg_write(IXP2000_GPIO_POSR, 1 << line); |
49 | } else if (value == IXP2000_GPIO_LOW) | 41 | } else if (value == IXP2000_GPIO_LOW) { |
50 | ixp_reg_write(IXP2000_GPIO_POCR, BIT(line)); | 42 | ixp2000_reg_write(IXP2000_GPIO_POCR, 1 << line); |
43 | } | ||
51 | } | 44 | } |
52 | 45 | ||
53 | #endif /* !__ASSEMBLY__ */ | 46 | #endif /* !__ASSEMBLY__ */ |
54 | #endif /* ASM_ARCH_IXP2000_GPIO_H_ */ | ||
55 | 47 | ||
48 | #endif /* ASM_ARCH_IXP2000_GPIO_H_ */ | ||
diff --git a/include/asm-arm/arch-ixp2000/io.h b/include/asm-arm/arch-ixp2000/io.h index a8e3c2daefd6..3241cd6f0778 100644 --- a/include/asm-arm/arch-ixp2000/io.h +++ b/include/asm-arm/arch-ixp2000/io.h | |||
@@ -17,18 +17,23 @@ | |||
17 | 17 | ||
18 | #define IO_SPACE_LIMIT 0xffffffff | 18 | #define IO_SPACE_LIMIT 0xffffffff |
19 | #define __mem_pci(a) (a) | 19 | #define __mem_pci(a) (a) |
20 | #define ___io(p) ((void __iomem *)((p)+IXP2000_PCI_IO_VIRT_BASE)) | ||
21 | 20 | ||
22 | /* | 21 | /* |
23 | * The IXP2400 before revision B0 asserts byte lanes for PCI I/O | 22 | * The A? revisions of the IXP2000s assert byte lanes for PCI I/O |
24 | * transactions the other way round (MEM transactions don't have this | 23 | * transactions the other way round (MEM transactions don't have this |
25 | * issue), so we need to override the standard functions. B0 and later | 24 | * issue), so if we want to support those models, we need to override |
26 | * have a bit that can be set to 1 to get the 'proper' behavior, but | 25 | * the standard I/O functions. |
27 | * since that isn't available on the A? revisions we just keep doing | 26 | * |
28 | * things manually. | 27 | * B0 and later have a bit that can be set to 1 to get the proper |
28 | * behavior for I/O transactions, which then allows us to use the | ||
29 | * standard I/O functions. This is what we do if the user does not | ||
30 | * explicitly ask for support for pre-B0. | ||
29 | */ | 31 | */ |
30 | #define alignb(addr) (void __iomem *)((unsigned long)addr ^ 3) | 32 | #ifdef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO |
31 | #define alignw(addr) (void __iomem *)((unsigned long)addr ^ 2) | 33 | #define ___io(p) ((void __iomem *)((p)+IXP2000_PCI_IO_VIRT_BASE)) |
34 | |||
35 | #define alignb(addr) (void __iomem *)((unsigned long)(addr) ^ 3) | ||
36 | #define alignw(addr) (void __iomem *)((unsigned long)(addr) ^ 2) | ||
32 | 37 | ||
33 | #define outb(v,p) __raw_writeb((v),alignb(___io(p))) | 38 | #define outb(v,p) __raw_writeb((v),alignb(___io(p))) |
34 | #define outw(v,p) __raw_writew((v),alignw(___io(p))) | 39 | #define outw(v,p) __raw_writew((v),alignw(___io(p))) |
@@ -48,6 +53,81 @@ | |||
48 | #define insw(p,d,l) __raw_readsw(alignw(___io(p)),d,l) | 53 | #define insw(p,d,l) __raw_readsw(alignw(___io(p)),d,l) |
49 | #define insl(p,d,l) __raw_readsl(___io(p),d,l) | 54 | #define insl(p,d,l) __raw_readsl(___io(p),d,l) |
50 | 55 | ||
56 | #define __is_io_address(p) ((((unsigned long)(p)) & ~(IXP2000_PCI_IO_SIZE - 1)) == IXP2000_PCI_IO_VIRT_BASE) | ||
57 | |||
58 | #define ioread8(p) \ | ||
59 | ({ \ | ||
60 | unsigned int __v; \ | ||
61 | \ | ||
62 | if (__is_io_address(p)) { \ | ||
63 | __v = __raw_readb(alignb(p)); \ | ||
64 | } else { \ | ||
65 | __v = __raw_readb(p); \ | ||
66 | } \ | ||
67 | \ | ||
68 | __v; \ | ||
69 | }) \ | ||
70 | |||
71 | #define ioread16(p) \ | ||
72 | ({ \ | ||
73 | unsigned int __v; \ | ||
74 | \ | ||
75 | if (__is_io_address(p)) { \ | ||
76 | __v = __raw_readw(alignw(p)); \ | ||
77 | } else { \ | ||
78 | __v = le16_to_cpu(__raw_readw(p)); \ | ||
79 | } \ | ||
80 | \ | ||
81 | __v; \ | ||
82 | }) | ||
83 | |||
84 | #define ioread32(p) \ | ||
85 | ({ \ | ||
86 | unsigned int __v; \ | ||
87 | \ | ||
88 | if (__is_io_address(p)) { \ | ||
89 | __v = __raw_readl(p); \ | ||
90 | } else { \ | ||
91 | __v = le32_to_cpu(__raw_readl(p)); \ | ||
92 | } \ | ||
93 | \ | ||
94 | __v; \ | ||
95 | }) | ||
96 | |||
97 | #define iowrite8(v,p) \ | ||
98 | ({ \ | ||
99 | if (__is_io_address(p)) { \ | ||
100 | __raw_writeb((v), alignb(p)); \ | ||
101 | } else { \ | ||
102 | __raw_writeb((v), p); \ | ||
103 | } \ | ||
104 | }) | ||
105 | |||
106 | #define iowrite16(v,p) \ | ||
107 | ({ \ | ||
108 | if (__is_io_address(p)) { \ | ||
109 | __raw_writew((v), alignw(p)); \ | ||
110 | } else { \ | ||
111 | __raw_writew(cpu_to_le16(v), p); \ | ||
112 | } \ | ||
113 | }) | ||
114 | |||
115 | #define iowrite32(v,p) \ | ||
116 | ({ \ | ||
117 | if (__is_io_address(p)) { \ | ||
118 | __raw_writel((v), p); \ | ||
119 | } else { \ | ||
120 | __raw_writel(cpu_to_le32(v), p); \ | ||
121 | } \ | ||
122 | }) | ||
123 | |||
124 | #define ioport_map(port, nr) ___io(port) | ||
125 | |||
126 | #define ioport_unmap(addr) | ||
127 | #else | ||
128 | #define __io(p) ((void __iomem *)((p)+IXP2000_PCI_IO_VIRT_BASE)) | ||
129 | #endif | ||
130 | |||
51 | 131 | ||
52 | #ifdef CONFIG_ARCH_IXDP2X01 | 132 | #ifdef CONFIG_ARCH_IXDP2X01 |
53 | /* | 133 | /* |
@@ -75,8 +155,8 @@ static inline void insw(u32 ptr, void *buf, int length) | |||
75 | * Is this cycle meant for the CS8900? | 155 | * Is this cycle meant for the CS8900? |
76 | */ | 156 | */ |
77 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && | 157 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && |
78 | ((port >= IXDP2X01_CS8900_VIRT_BASE) && | 158 | (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) && |
79 | (port <= IXDP2X01_CS8900_VIRT_END))) { | 159 | ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) { |
80 | u8 *buf8 = (u8*)buf; | 160 | u8 *buf8 = (u8*)buf; |
81 | register u32 tmp32; | 161 | register u32 tmp32; |
82 | 162 | ||
@@ -100,8 +180,8 @@ static inline void outsw(u32 ptr, void *buf, int length) | |||
100 | * Is this cycle meant for the CS8900? | 180 | * Is this cycle meant for the CS8900? |
101 | */ | 181 | */ |
102 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && | 182 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && |
103 | ((port >= IXDP2X01_CS8900_VIRT_BASE) && | 183 | (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) && |
104 | (port <= IXDP2X01_CS8900_VIRT_END))) { | 184 | ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) { |
105 | register u32 tmp32; | 185 | register u32 tmp32; |
106 | u8 *buf8 = (u8*)buf; | 186 | u8 *buf8 = (u8*)buf; |
107 | do { | 187 | do { |
@@ -124,8 +204,8 @@ static inline u16 inw(u32 ptr) | |||
124 | * Is this cycle meant for the CS8900? | 204 | * Is this cycle meant for the CS8900? |
125 | */ | 205 | */ |
126 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && | 206 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && |
127 | ((port >= IXDP2X01_CS8900_VIRT_BASE) && | 207 | (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) && |
128 | (port <= IXDP2X01_CS8900_VIRT_END))) { | 208 | ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) { |
129 | return (u16)(*port); | 209 | return (u16)(*port); |
130 | } | 210 | } |
131 | 211 | ||
@@ -137,8 +217,8 @@ static inline void outw(u16 value, u32 ptr) | |||
137 | register volatile u32 *port = (volatile u32 *)ptr; | 217 | register volatile u32 *port = (volatile u32 *)ptr; |
138 | 218 | ||
139 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && | 219 | if ((machine_is_ixdp2401() || machine_is_ixdp2801()) && |
140 | ((port >= IXDP2X01_CS8900_VIRT_BASE) && | 220 | (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) && |
141 | (port <= IXDP2X01_CS8900_VIRT_END))) { | 221 | ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) { |
142 | *port = value; | 222 | *port = value; |
143 | return; | 223 | return; |
144 | } | 224 | } |
diff --git a/include/asm-arm/arch-ixp2000/ixp2000-regs.h b/include/asm-arm/arch-ixp2000/ixp2000-regs.h index 6c56708d0ff0..5eb47d4bfbf6 100644 --- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h +++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h | |||
@@ -241,7 +241,7 @@ | |||
241 | #define PCI_CONTROL_BE_DEI (1 << 21) /* Big Endian Data Enable In */ | 241 | #define PCI_CONTROL_BE_DEI (1 << 21) /* Big Endian Data Enable In */ |
242 | #define PCI_CONTROL_BE_BEO (1 << 20) /* Big Endian Byte Enable Out */ | 242 | #define PCI_CONTROL_BE_BEO (1 << 20) /* Big Endian Byte Enable Out */ |
243 | #define PCI_CONTROL_BE_BEI (1 << 19) /* Big Endian Byte Enable In */ | 243 | #define PCI_CONTROL_BE_BEI (1 << 19) /* Big Endian Byte Enable In */ |
244 | #define PCI_CONTROL_PNR (1 << 17) /* PCI Not Reset bit */ | 244 | #define PCI_CONTROL_IEE (1 << 17) /* I/O cycle Endian swap Enable */ |
245 | 245 | ||
246 | #define IXP2000_PCI_RST_REL (1 << 2) | 246 | #define IXP2000_PCI_RST_REL (1 << 2) |
247 | #define CFG_RST_DIR (*IXP2000_PCI_CONTROL & IXP2000_PCICNTL_PCF) | 247 | #define CFG_RST_DIR (*IXP2000_PCI_CONTROL & IXP2000_PCICNTL_PCF) |
@@ -363,6 +363,7 @@ | |||
363 | #define IXP2000_MIN_REV_MASK 0x0000000F | 363 | #define IXP2000_MIN_REV_MASK 0x0000000F |
364 | #define IXP2000_PROD_ID_MASK 0xFFFFFFFF | 364 | #define IXP2000_PROD_ID_MASK 0xFFFFFFFF |
365 | 365 | ||
366 | #define IXP2000_PRODUCT_ID GLOBAL_REG(0x00) | ||
366 | #define IXP2000_MISC_CONTROL GLOBAL_REG(0x04) | 367 | #define IXP2000_MISC_CONTROL GLOBAL_REG(0x04) |
367 | #define IXP2000_MSF_CLK_CNTRL GLOBAL_REG(0x08) | 368 | #define IXP2000_MSF_CLK_CNTRL GLOBAL_REG(0x08) |
368 | #define IXP2000_RESET0 GLOBAL_REG(0x0c) | 369 | #define IXP2000_RESET0 GLOBAL_REG(0x0c) |
diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h index 901bba6d02b4..52ded516ea5c 100644 --- a/include/asm-arm/arch-ixp2000/platform.h +++ b/include/asm-arm/arch-ixp2000/platform.h | |||
@@ -138,30 +138,10 @@ struct ixp2000_flash_data { | |||
138 | unsigned long (*bank_setup)(unsigned long); | 138 | unsigned long (*bank_setup)(unsigned long); |
139 | }; | 139 | }; |
140 | 140 | ||
141 | /* | ||
142 | * GPIO helper functions | ||
143 | */ | ||
144 | #define GPIO_IN 0 | ||
145 | #define GPIO_OUT 1 | ||
146 | |||
147 | extern void gpio_line_config(int line, int style); | ||
148 | |||
149 | static inline int gpio_line_get(int line) | ||
150 | { | ||
151 | return (((*IXP2000_GPIO_PLR) >> line) & 1); | ||
152 | } | ||
153 | |||
154 | static inline void gpio_line_set(int line, int value) | ||
155 | { | ||
156 | if (value) | ||
157 | ixp2000_reg_write(IXP2000_GPIO_POSR, (1 << line)); | ||
158 | else | ||
159 | ixp2000_reg_write(IXP2000_GPIO_POCR, (1 << line)); | ||
160 | } | ||
161 | |||
162 | struct ixp2000_i2c_pins { | 141 | struct ixp2000_i2c_pins { |
163 | unsigned long sda_pin; | 142 | unsigned long sda_pin; |
164 | unsigned long scl_pin; | 143 | unsigned long scl_pin; |
165 | }; | 144 | }; |
166 | 145 | ||
146 | |||
167 | #endif /* !__ASSEMBLY__ */ | 147 | #endif /* !__ASSEMBLY__ */ |
diff --git a/include/asm-arm/arch-ixp4xx/debug-macro.S b/include/asm-arm/arch-ixp4xx/debug-macro.S index 4499ae8e4b44..45a6c6cc29d5 100644 --- a/include/asm-arm/arch-ixp4xx/debug-macro.S +++ b/include/asm-arm/arch-ixp4xx/debug-macro.S | |||
@@ -14,6 +14,7 @@ | |||
14 | mrc p15, 0, \rx, c1, c0 | 14 | mrc p15, 0, \rx, c1, c0 |
15 | tst \rx, #1 @ MMU enabled? | 15 | tst \rx, #1 @ MMU enabled? |
16 | moveq \rx, #0xc8000000 | 16 | moveq \rx, #0xc8000000 |
17 | orrne \rx, \rx, #0x00b00000 | ||
17 | movne \rx, #0xff000000 | 18 | movne \rx, #0xff000000 |
18 | add \rx,\rx,#3 @ Uart regs are at off set of 3 if | 19 | add \rx,\rx,#3 @ Uart regs are at off set of 3 if |
19 | @ byte writes used - Big Endian. | 20 | @ byte writes used - Big Endian. |
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h index 8eeb1db6309d..004696a95bdb 100644 --- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h +++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h | |||
@@ -69,6 +69,16 @@ | |||
69 | #define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBF2000) | 69 | #define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBF2000) |
70 | #define IXP4XX_PERIPHERAL_REGION_SIZE (0x0000C000) | 70 | #define IXP4XX_PERIPHERAL_REGION_SIZE (0x0000C000) |
71 | 71 | ||
72 | /* | ||
73 | * Debug UART | ||
74 | * | ||
75 | * This is basically a remap of UART1 into a region that is section | ||
76 | * aligned so that it * can be used with the low-level debug code. | ||
77 | */ | ||
78 | #define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000) | ||
79 | #define IXP4XX_DEBUG_UART_BASE_VIRT (0xffb00000) | ||
80 | #define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000) | ||
81 | |||
72 | #define IXP4XX_EXP_CS0_OFFSET 0x00 | 82 | #define IXP4XX_EXP_CS0_OFFSET 0x00 |
73 | #define IXP4XX_EXP_CS1_OFFSET 0x04 | 83 | #define IXP4XX_EXP_CS1_OFFSET 0x04 |
74 | #define IXP4XX_EXP_CS2_OFFSET 0x08 | 84 | #define IXP4XX_EXP_CS2_OFFSET 0x08 |
diff --git a/include/asm-arm/arch-omap/tps65010.h b/include/asm-arm/arch-omap/tps65010.h index 0f97bb2e8fce..b9aa2b3a3909 100644 --- a/include/asm-arm/arch-omap/tps65010.h +++ b/include/asm-arm/arch-omap/tps65010.h | |||
@@ -30,6 +30,66 @@ | |||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * ---------------------------------------------------------------------------- | 32 | * ---------------------------------------------------------------------------- |
33 | * Registers, all 8 bits | ||
34 | * ---------------------------------------------------------------------------- | ||
35 | */ | ||
36 | |||
37 | #define TPS_CHGSTATUS 0x01 | ||
38 | # define TPS_CHG_USB (1 << 7) | ||
39 | # define TPS_CHG_AC (1 << 6) | ||
40 | # define TPS_CHG_THERM (1 << 5) | ||
41 | # define TPS_CHG_TERM (1 << 4) | ||
42 | # define TPS_CHG_TAPER_TMO (1 << 3) | ||
43 | # define TPS_CHG_CHG_TMO (1 << 2) | ||
44 | # define TPS_CHG_PRECHG_TMO (1 << 1) | ||
45 | # define TPS_CHG_TEMP_ERR (1 << 0) | ||
46 | #define TPS_REGSTATUS 0x02 | ||
47 | # define TPS_REG_ONOFF (1 << 7) | ||
48 | # define TPS_REG_COVER (1 << 6) | ||
49 | # define TPS_REG_UVLO (1 << 5) | ||
50 | # define TPS_REG_NO_CHG (1 << 4) /* tps65013 */ | ||
51 | # define TPS_REG_PG_LD02 (1 << 3) | ||
52 | # define TPS_REG_PG_LD01 (1 << 2) | ||
53 | # define TPS_REG_PG_MAIN (1 << 1) | ||
54 | # define TPS_REG_PG_CORE (1 << 0) | ||
55 | #define TPS_MASK1 0x03 | ||
56 | #define TPS_MASK2 0x04 | ||
57 | #define TPS_ACKINT1 0x05 | ||
58 | #define TPS_ACKINT2 0x06 | ||
59 | #define TPS_CHGCONFIG 0x07 | ||
60 | # define TPS_CHARGE_POR (1 << 7) /* 65010/65012 */ | ||
61 | # define TPS65013_AUA (1 << 7) /* 65011/65013 */ | ||
62 | # define TPS_CHARGE_RESET (1 << 6) | ||
63 | # define TPS_CHARGE_FAST (1 << 5) | ||
64 | # define TPS_CHARGE_CURRENT (3 << 3) | ||
65 | # define TPS_VBUS_500MA (1 << 2) | ||
66 | # define TPS_VBUS_CHARGING (1 << 1) | ||
67 | # define TPS_CHARGE_ENABLE (1 << 0) | ||
68 | #define TPS_LED1_ON 0x08 | ||
69 | #define TPS_LED1_PER 0x09 | ||
70 | #define TPS_LED2_ON 0x0a | ||
71 | #define TPS_LED2_PER 0x0b | ||
72 | #define TPS_VDCDC1 0x0c | ||
73 | # define TPS_ENABLE_LP (1 << 3) | ||
74 | #define TPS_VDCDC2 0x0d | ||
75 | #define TPS_VREGS1 0x0e | ||
76 | # define TPS_LDO2_ENABLE (1 << 7) | ||
77 | # define TPS_LDO2_OFF (1 << 6) | ||
78 | # define TPS_VLDO2_3_0V (3 << 4) | ||
79 | # define TPS_VLDO2_2_75V (2 << 4) | ||
80 | # define TPS_VLDO2_2_5V (1 << 4) | ||
81 | # define TPS_VLDO2_1_8V (0 << 4) | ||
82 | # define TPS_LDO1_ENABLE (1 << 3) | ||
83 | # define TPS_LDO1_OFF (1 << 2) | ||
84 | # define TPS_VLDO1_3_0V (3 << 0) | ||
85 | # define TPS_VLDO1_2_75V (2 << 0) | ||
86 | # define TPS_VLDO1_2_5V (1 << 0) | ||
87 | # define TPS_VLDO1_ADJ (0 << 0) | ||
88 | #define TPS_MASK3 0x0f | ||
89 | #define TPS_DEFGPIO 0x10 | ||
90 | |||
91 | /* | ||
92 | * ---------------------------------------------------------------------------- | ||
33 | * Macros used by exported functions | 93 | * Macros used by exported functions |
34 | * ---------------------------------------------------------------------------- | 94 | * ---------------------------------------------------------------------------- |
35 | */ | 95 | */ |
@@ -71,10 +131,26 @@ extern int tps65010_set_gpio_out_value(unsigned gpio, unsigned value); | |||
71 | */ | 131 | */ |
72 | extern int tps65010_set_led(unsigned led, unsigned mode); | 132 | extern int tps65010_set_led(unsigned led, unsigned mode); |
73 | 133 | ||
134 | /* tps65010_set_vib parameter: | ||
135 | * value: ON or OFF | ||
136 | */ | ||
137 | extern int tps65010_set_vib(unsigned value); | ||
138 | |||
74 | /* tps65010_set_low_pwr parameter: | 139 | /* tps65010_set_low_pwr parameter: |
75 | * mode: ON or OFF | 140 | * mode: ON or OFF |
76 | */ | 141 | */ |
77 | extern int tps65010_set_low_pwr(unsigned mode); | 142 | extern int tps65010_set_low_pwr(unsigned mode); |
78 | 143 | ||
144 | /* tps65010_config_vregs1 parameter: | ||
145 | * value to be written to VREGS1 register | ||
146 | * Note: The complete register is written, set all bits you need | ||
147 | */ | ||
148 | extern int tps65010_config_vregs1(unsigned value); | ||
149 | |||
150 | /* tps65013_set_low_pwr parameter: | ||
151 | * mode: ON or OFF | ||
152 | */ | ||
153 | extern int tps65013_set_low_pwr(unsigned mode); | ||
154 | |||
79 | #endif /* __ASM_ARCH_TPS65010_H */ | 155 | #endif /* __ASM_ARCH_TPS65010_H */ |
80 | 156 | ||
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h index 39741d3c9a34..b5e54a9e9fa7 100644 --- a/include/asm-arm/arch-pxa/pxa-regs.h +++ b/include/asm-arm/arch-pxa/pxa-regs.h | |||
@@ -1296,6 +1296,7 @@ | |||
1296 | #define GPIO111_MMCDAT3 111 /* MMC DAT3 (PXA27x) */ | 1296 | #define GPIO111_MMCDAT3 111 /* MMC DAT3 (PXA27x) */ |
1297 | #define GPIO111_MMCCS1 111 /* MMC Chip Select 1 (PXA27x) */ | 1297 | #define GPIO111_MMCCS1 111 /* MMC Chip Select 1 (PXA27x) */ |
1298 | #define GPIO112_MMCCMD 112 /* MMC CMD (PXA27x) */ | 1298 | #define GPIO112_MMCCMD 112 /* MMC CMD (PXA27x) */ |
1299 | #define GPIO113_I2S_SYSCLK 113 /* I2S System Clock (PXA27x) */ | ||
1299 | #define GPIO113_AC97_RESET_N 113 /* AC97 NRESET on (PXA27x) */ | 1300 | #define GPIO113_AC97_RESET_N 113 /* AC97 NRESET on (PXA27x) */ |
1300 | 1301 | ||
1301 | /* GPIO alternate function mode & direction */ | 1302 | /* GPIO alternate function mode & direction */ |
@@ -1428,6 +1429,7 @@ | |||
1428 | #define GPIO111_MMCDAT3_MD (111 | GPIO_ALT_FN_1_OUT) | 1429 | #define GPIO111_MMCDAT3_MD (111 | GPIO_ALT_FN_1_OUT) |
1429 | #define GPIO110_MMCCS1_MD (111 | GPIO_ALT_FN_1_OUT) | 1430 | #define GPIO110_MMCCS1_MD (111 | GPIO_ALT_FN_1_OUT) |
1430 | #define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT) | 1431 | #define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT) |
1432 | #define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT) | ||
1431 | #define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT) | 1433 | #define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT) |
1432 | #define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_OUT) | 1434 | #define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_OUT) |
1433 | #define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN) | 1435 | #define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN) |
diff --git a/include/asm-arm/arch-versatile/hardware.h b/include/asm-arm/arch-versatile/hardware.h index d5fb4a251e7f..41c1bee342ad 100644 --- a/include/asm-arm/arch-versatile/hardware.h +++ b/include/asm-arm/arch-versatile/hardware.h | |||
@@ -25,19 +25,26 @@ | |||
25 | #include <asm/sizes.h> | 25 | #include <asm/sizes.h> |
26 | #include <asm/arch/platform.h> | 26 | #include <asm/arch/platform.h> |
27 | 27 | ||
28 | // FIXME = PCI settings need to be fixed!!!!! | ||
29 | |||
30 | /* | 28 | /* |
31 | * Similar to above, but for PCI addresses (memory, IO, Config and the | 29 | * PCI space virtual addresses |
32 | * V3 chip itself). WARNING: this has to mirror definitions in platform.h | ||
33 | */ | 30 | */ |
34 | #define PCI_MEMORY_VADDR 0xe8000000 | 31 | #define VERSATILE_PCI_VIRT_BASE 0xe8000000 |
35 | #define PCI_CONFIG_VADDR 0xec000000 | 32 | #define VERSATILE_PCI_CFG_VIRT_BASE 0xe9000000 |
36 | #define PCI_V3_VADDR 0xed000000 | 33 | |
37 | #define PCI_IO_VADDR 0xee000000 | 34 | #if 0 |
35 | #define VERSATILE_PCI_VIRT_MEM_BASE0 0xf4000000 | ||
36 | #define VERSATILE_PCI_VIRT_MEM_BASE1 0xf5000000 | ||
37 | #define VERSATILE_PCI_VIRT_MEM_BASE2 0xf6000000 | ||
38 | |||
39 | #define PCIO_BASE VERSATILE_PCI_VIRT_MEM_BASE0 | ||
40 | #define PCIMEM_BASE VERSATILE_PCI_VIRT_MEM_BASE1 | ||
41 | #endif | ||
42 | |||
43 | /* CIK guesswork */ | ||
44 | #define PCIBIOS_MIN_IO 0x44000000 | ||
45 | #define PCIBIOS_MIN_MEM 0x50000000 | ||
38 | 46 | ||
39 | #define PCIO_BASE PCI_IO_VADDR | 47 | #define pcibios_assign_all_busses() 1 |
40 | #define PCIMEM_BASE PCI_MEMORY_VADDR | ||
41 | 48 | ||
42 | /* macro to get at IO space when running virtually */ | 49 | /* macro to get at IO space when running virtually */ |
43 | #define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) | 50 | #define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) |
diff --git a/include/asm-arm/arch-versatile/io.h b/include/asm-arm/arch-versatile/io.h index dbb7158788fc..9f895bf61494 100644 --- a/include/asm-arm/arch-versatile/io.h +++ b/include/asm-arm/arch-versatile/io.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #ifndef __ASM_ARM_ARCH_IO_H | 20 | #ifndef __ASM_ARM_ARCH_IO_H |
21 | #define __ASM_ARM_ARCH_IO_H | 21 | #define __ASM_ARM_ARCH_IO_H |
22 | 22 | ||
23 | #define IO_SPACE_LIMIT 0xffff | 23 | #define IO_SPACE_LIMIT 0xffffffff |
24 | 24 | ||
25 | #define __io(a) ((void __iomem *)(a)) | 25 | #define __io(a) ((void __iomem *)(a)) |
26 | #define __mem_pci(a) (a) | 26 | #define __mem_pci(a) (a) |
diff --git a/include/asm-arm/arch-versatile/platform.h b/include/asm-arm/arch-versatile/platform.h index 2598d1f08548..cbdd9fb96332 100644 --- a/include/asm-arm/arch-versatile/platform.h +++ b/include/asm-arm/arch-versatile/platform.h | |||
@@ -76,7 +76,7 @@ | |||
76 | #define VERSATILE_SYS_NVFLAGSSET_OFFSET 0x38 | 76 | #define VERSATILE_SYS_NVFLAGSSET_OFFSET 0x38 |
77 | #define VERSATILE_SYS_NVFLAGSCLR_OFFSET 0x3C | 77 | #define VERSATILE_SYS_NVFLAGSCLR_OFFSET 0x3C |
78 | #define VERSATILE_SYS_RESETCTL_OFFSET 0x40 | 78 | #define VERSATILE_SYS_RESETCTL_OFFSET 0x40 |
79 | #define VERSATILE_SYS_PICCTL_OFFSET 0x44 | 79 | #define VERSATILE_SYS_PCICTL_OFFSET 0x44 |
80 | #define VERSATILE_SYS_MCI_OFFSET 0x48 | 80 | #define VERSATILE_SYS_MCI_OFFSET 0x48 |
81 | #define VERSATILE_SYS_FLASH_OFFSET 0x4C | 81 | #define VERSATILE_SYS_FLASH_OFFSET 0x4C |
82 | #define VERSATILE_SYS_CLCD_OFFSET 0x50 | 82 | #define VERSATILE_SYS_CLCD_OFFSET 0x50 |
@@ -114,7 +114,7 @@ | |||
114 | #define VERSATILE_SYS_NVFLAGSSET (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSSET_OFFSET) | 114 | #define VERSATILE_SYS_NVFLAGSSET (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSSET_OFFSET) |
115 | #define VERSATILE_SYS_NVFLAGSCLR (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSCLR_OFFSET) | 115 | #define VERSATILE_SYS_NVFLAGSCLR (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSCLR_OFFSET) |
116 | #define VERSATILE_SYS_RESETCTL (VERSATILE_SYS_BASE + VERSATILE_SYS_RESETCTL_OFFSET) | 116 | #define VERSATILE_SYS_RESETCTL (VERSATILE_SYS_BASE + VERSATILE_SYS_RESETCTL_OFFSET) |
117 | #define VERSATILE_SYS_PICCTL (VERSATILE_SYS_BASE + VERSATILE_SYS_PICCTL_OFFSET) | 117 | #define VERSATILE_SYS_PCICTL (VERSATILE_SYS_BASE + VERSATILE_SYS_PCICTL_OFFSET) |
118 | #define VERSATILE_SYS_MCI (VERSATILE_SYS_BASE + VERSATILE_SYS_MCI_OFFSET) | 118 | #define VERSATILE_SYS_MCI (VERSATILE_SYS_BASE + VERSATILE_SYS_MCI_OFFSET) |
119 | #define VERSATILE_SYS_FLASH (VERSATILE_SYS_BASE + VERSATILE_SYS_FLASH_OFFSET) | 119 | #define VERSATILE_SYS_FLASH (VERSATILE_SYS_BASE + VERSATILE_SYS_FLASH_OFFSET) |
120 | #define VERSATILE_SYS_CLCD (VERSATILE_SYS_BASE + VERSATILE_SYS_CLCD_OFFSET) | 120 | #define VERSATILE_SYS_CLCD (VERSATILE_SYS_BASE + VERSATILE_SYS_CLCD_OFFSET) |
@@ -225,7 +225,20 @@ | |||
225 | #define VERSATILE_SSMC_BASE 0x20000000 /* SSMC */ | 225 | #define VERSATILE_SSMC_BASE 0x20000000 /* SSMC */ |
226 | #define VERSATILE_IB2_BASE 0x24000000 /* IB2 module */ | 226 | #define VERSATILE_IB2_BASE 0x24000000 /* IB2 module */ |
227 | #define VERSATILE_MBX_BASE 0x40000000 /* MBX */ | 227 | #define VERSATILE_MBX_BASE 0x40000000 /* MBX */ |
228 | |||
229 | /* PCI space */ | ||
228 | #define VERSATILE_PCI_BASE 0x41000000 /* PCI Interface */ | 230 | #define VERSATILE_PCI_BASE 0x41000000 /* PCI Interface */ |
231 | #define VERSATILE_PCI_CFG_BASE 0x42000000 | ||
232 | #define VERSATILE_PCI_MEM_BASE0 0x44000000 | ||
233 | #define VERSATILE_PCI_MEM_BASE1 0x50000000 | ||
234 | #define VERSATILE_PCI_MEM_BASE2 0x60000000 | ||
235 | /* Sizes of above maps */ | ||
236 | #define VERSATILE_PCI_BASE_SIZE 0x01000000 | ||
237 | #define VERSATILE_PCI_CFG_BASE_SIZE 0x02000000 | ||
238 | #define VERSATILE_PCI_MEM_BASE0_SIZE 0x0c000000 /* 32Mb */ | ||
239 | #define VERSATILE_PCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */ | ||
240 | #define VERSATILE_PCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */ | ||
241 | |||
229 | #define VERSATILE_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */ | 242 | #define VERSATILE_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */ |
230 | #define VERSATILE_LT_BASE 0x80000000 /* Logic Tile expansion */ | 243 | #define VERSATILE_LT_BASE 0x80000000 /* Logic Tile expansion */ |
231 | 244 | ||
@@ -498,11 +511,17 @@ | |||
498 | /* | 511 | /* |
499 | * IB2 Versatile/AB expansion board definitions | 512 | * IB2 Versatile/AB expansion board definitions |
500 | */ | 513 | */ |
501 | #define VERSATILE_IB2_CAMERA_BANK 0x24000000 | 514 | #define VERSATILE_IB2_CAMERA_BANK VERSATILE_IB2_BASE |
502 | #define VERSATILE_IB2_KBD_DATAREG 0x25000000 | 515 | #define VERSATILE_IB2_KBD_DATAREG (VERSATILE_IB2_BASE + 0x01000000) |
503 | #define VERSATILE_IB2_IER 0x26000000 /* for VICINTSOURCE27 */ | 516 | |
504 | #define VERSATILE_IB2_CTRL 0x27000000 | 517 | /* VICINTSOURCE27 */ |
505 | #define VERSATILE_IB2_STAT 0x27000004 | 518 | #define VERSATILE_IB2_INT_BASE (VERSATILE_IB2_BASE + 0x02000000) |
519 | #define VERSATILE_IB2_IER (VERSATILE_IB2_INT_BASE + 0) | ||
520 | #define VERSATILE_IB2_ISR (VERSATILE_IB2_INT_BASE + 4) | ||
521 | |||
522 | #define VERSATILE_IB2_CTL_BASE (VERSATILE_IB2_BASE + 0x03000000) | ||
523 | #define VERSATILE_IB2_CTRL (VERSATILE_IB2_CTL_BASE + 0) | ||
524 | #define VERSATILE_IB2_STAT (VERSATILE_IB2_CTL_BASE + 4) | ||
506 | #endif | 525 | #endif |
507 | 526 | ||
508 | #endif | 527 | #endif |
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h index 09ffeed507c2..035cdcff43d2 100644 --- a/include/asm-arm/cacheflush.h +++ b/include/asm-arm/cacheflush.h | |||
@@ -16,6 +16,9 @@ | |||
16 | 16 | ||
17 | #include <asm/mman.h> | 17 | #include <asm/mman.h> |
18 | #include <asm/glue.h> | 18 | #include <asm/glue.h> |
19 | #include <asm/shmparam.h> | ||
20 | |||
21 | #define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT) | ||
19 | 22 | ||
20 | /* | 23 | /* |
21 | * Cache Model | 24 | * Cache Model |
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index cbceacbe5afa..a1696ba238d3 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h | |||
@@ -38,9 +38,9 @@ typedef struct user_fp elf_fpregset_t; | |||
38 | */ | 38 | */ |
39 | #define ELF_CLASS ELFCLASS32 | 39 | #define ELF_CLASS ELFCLASS32 |
40 | #ifdef __ARMEB__ | 40 | #ifdef __ARMEB__ |
41 | #define ELF_DATA ELFDATA2MSB; | 41 | #define ELF_DATA ELFDATA2MSB |
42 | #else | 42 | #else |
43 | #define ELF_DATA ELFDATA2LSB; | 43 | #define ELF_DATA ELFDATA2LSB |
44 | #endif | 44 | #endif |
45 | #define ELF_ARCH EM_ARM | 45 | #define ELF_ARCH EM_ARM |
46 | 46 | ||
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 658ffa384fda..cc4b5f5dbfcf 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h | |||
@@ -273,6 +273,35 @@ extern void __iounmap(void __iomem *addr); | |||
273 | #endif | 273 | #endif |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * io{read,write}{8,16,32} macros | ||
277 | */ | ||
278 | #ifndef ioread8 | ||
279 | #define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) | ||
280 | #define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) | ||
281 | #define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) | ||
282 | |||
283 | #define iowrite8(v,p) __raw_writeb(v, p) | ||
284 | #define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p) | ||
285 | #define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p) | ||
286 | |||
287 | #define ioread8_rep(p,d,c) __raw_readsb(p,d,c) | ||
288 | #define ioread16_rep(p,d,c) __raw_readsw(p,d,c) | ||
289 | #define ioread32_rep(p,d,c) __raw_readsl(p,d,c) | ||
290 | |||
291 | #define iowrite8_rep(p,s,c) __raw_writesb(p,s,c) | ||
292 | #define iowrite16_rep(p,s,c) __raw_writesw(p,s,c) | ||
293 | #define iowrite32_rep(p,s,c) __raw_writesl(p,s,c) | ||
294 | |||
295 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | ||
296 | extern void ioport_unmap(void __iomem *addr); | ||
297 | #endif | ||
298 | |||
299 | struct pci_dev; | ||
300 | |||
301 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen); | ||
302 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); | ||
303 | |||
304 | /* | ||
276 | * can the hardware map this into one segment or not, given no other | 305 | * can the hardware map this into one segment or not, given no other |
277 | * constraints. | 306 | * constraints. |
278 | */ | 307 | */ |
diff --git a/include/asm-arm/mach/time.h b/include/asm-arm/mach/time.h index 5cf4fd659fd5..047980ad18d1 100644 --- a/include/asm-arm/mach/time.h +++ b/include/asm-arm/mach/time.h | |||
@@ -39,8 +39,29 @@ struct sys_timer { | |||
39 | void (*suspend)(void); | 39 | void (*suspend)(void); |
40 | void (*resume)(void); | 40 | void (*resume)(void); |
41 | unsigned long (*offset)(void); | 41 | unsigned long (*offset)(void); |
42 | |||
43 | #ifdef CONFIG_NO_IDLE_HZ | ||
44 | struct dyn_tick_timer *dyn_tick; | ||
45 | #endif | ||
46 | }; | ||
47 | |||
48 | #ifdef CONFIG_NO_IDLE_HZ | ||
49 | |||
50 | #define DYN_TICK_SKIPPING (1 << 2) | ||
51 | #define DYN_TICK_ENABLED (1 << 1) | ||
52 | #define DYN_TICK_SUITABLE (1 << 0) | ||
53 | |||
54 | struct dyn_tick_timer { | ||
55 | unsigned int state; /* Current state */ | ||
56 | int (*enable)(void); /* Enables dynamic tick */ | ||
57 | int (*disable)(void); /* Disables dynamic tick */ | ||
58 | void (*reprogram)(unsigned long); /* Reprograms the timer */ | ||
59 | int (*handler)(int, void *, struct pt_regs *); | ||
42 | }; | 60 | }; |
43 | 61 | ||
62 | void timer_dyn_reprogram(void); | ||
63 | #endif | ||
64 | |||
44 | extern struct sys_timer *system_timer; | 65 | extern struct sys_timer *system_timer; |
45 | extern void timer_tick(struct pt_regs *); | 66 | extern void timer_tick(struct pt_regs *); |
46 | 67 | ||
diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h index e814f8144f8b..bc18ff405181 100644 --- a/include/asm-arm/pgalloc.h +++ b/include/asm-arm/pgalloc.h | |||
@@ -89,6 +89,13 @@ static inline void pte_free(struct page *pte) | |||
89 | __free_page(pte); | 89 | __free_page(pte); |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void __pmd_populate(pmd_t *pmdp, unsigned long pmdval) | ||
93 | { | ||
94 | pmdp[0] = __pmd(pmdval); | ||
95 | pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); | ||
96 | flush_pmd_entry(pmdp); | ||
97 | } | ||
98 | |||
92 | /* | 99 | /* |
93 | * Populate the pmdp entry with a pointer to the pte. This pmd is part | 100 | * Populate the pmdp entry with a pointer to the pte. This pmd is part |
94 | * of the mm address space. | 101 | * of the mm address space. |
@@ -99,32 +106,19 @@ static inline void | |||
99 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) | 106 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) |
100 | { | 107 | { |
101 | unsigned long pte_ptr = (unsigned long)ptep; | 108 | unsigned long pte_ptr = (unsigned long)ptep; |
102 | unsigned long pmdval; | ||
103 | |||
104 | BUG_ON(mm != &init_mm); | ||
105 | 109 | ||
106 | /* | 110 | /* |
107 | * The pmd must be loaded with the physical | 111 | * The pmd must be loaded with the physical |
108 | * address of the PTE table | 112 | * address of the PTE table |
109 | */ | 113 | */ |
110 | pte_ptr -= PTRS_PER_PTE * sizeof(void *); | 114 | pte_ptr -= PTRS_PER_PTE * sizeof(void *); |
111 | pmdval = __pa(pte_ptr) | _PAGE_KERNEL_TABLE; | 115 | __pmd_populate(pmdp, __pa(pte_ptr) | _PAGE_KERNEL_TABLE); |
112 | pmdp[0] = __pmd(pmdval); | ||
113 | pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); | ||
114 | flush_pmd_entry(pmdp); | ||
115 | } | 116 | } |
116 | 117 | ||
117 | static inline void | 118 | static inline void |
118 | pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep) | 119 | pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep) |
119 | { | 120 | { |
120 | unsigned long pmdval; | 121 | __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE); |
121 | |||
122 | BUG_ON(mm == &init_mm); | ||
123 | |||
124 | pmdval = page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE; | ||
125 | pmdp[0] = __pmd(pmdval); | ||
126 | pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); | ||
127 | flush_pmd_entry(pmdp); | ||
128 | } | 122 | } |
129 | 123 | ||
130 | #endif | 124 | #endif |
diff --git a/include/asm-arm/signal.h b/include/asm-arm/signal.h index 46e69ae395af..760f6e65af05 100644 --- a/include/asm-arm/signal.h +++ b/include/asm-arm/signal.h | |||
@@ -114,6 +114,7 @@ typedef unsigned long sigset_t; | |||
114 | #define SIGSTKSZ 8192 | 114 | #define SIGSTKSZ 8192 |
115 | 115 | ||
116 | #ifdef __KERNEL__ | 116 | #ifdef __KERNEL__ |
117 | #define SA_TIMER 0x40000000 | ||
117 | #define SA_IRQNOMASK 0x08000000 | 118 | #define SA_IRQNOMASK 0x08000000 |
118 | #endif | 119 | #endif |
119 | 120 | ||
diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index f21fd8f6bcdd..6c6c60adbbaa 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h | |||
@@ -21,7 +21,7 @@ | |||
21 | # error "<asm-arm/smp.h> included in non-SMP build" | 21 | # error "<asm-arm/smp.h> included in non-SMP build" |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #define smp_processor_id() (current_thread_info()->cpu) | 24 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
25 | 25 | ||
26 | extern cpumask_t cpu_present_mask; | 26 | extern cpumask_t cpu_present_mask; |
27 | #define cpu_possible_map cpu_present_mask | 27 | #define cpu_possible_map cpu_present_mask |
@@ -55,4 +55,18 @@ extern void smp_cross_call(cpumask_t callmap); | |||
55 | */ | 55 | */ |
56 | extern int boot_secondary(unsigned int cpu, struct task_struct *); | 56 | extern int boot_secondary(unsigned int cpu, struct task_struct *); |
57 | 57 | ||
58 | /* | ||
59 | * Perform platform specific initialisation of the specified CPU. | ||
60 | */ | ||
61 | extern void platform_secondary_init(unsigned int cpu); | ||
62 | |||
63 | /* | ||
64 | * Initial data for bringing up a secondary CPU. | ||
65 | */ | ||
66 | struct secondary_data { | ||
67 | unsigned long pgdir; | ||
68 | void *stack; | ||
69 | }; | ||
70 | extern struct secondary_data secondary_data; | ||
71 | |||
58 | #endif /* ifndef __ASM_ARM_SMP_H */ | 72 | #endif /* ifndef __ASM_ARM_SMP_H */ |
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index b13a8da4847b..3d0d2860b6db 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h | |||
@@ -104,6 +104,7 @@ extern void show_pte(struct mm_struct *mm, unsigned long addr); | |||
104 | extern void __show_regs(struct pt_regs *); | 104 | extern void __show_regs(struct pt_regs *); |
105 | 105 | ||
106 | extern int cpu_architecture(void); | 106 | extern int cpu_architecture(void); |
107 | extern void cpu_init(void); | ||
107 | 108 | ||
108 | #define set_cr(x) \ | 109 | #define set_cr(x) \ |
109 | __asm__ __volatile__( \ | 110 | __asm__ __volatile__( \ |
@@ -144,34 +145,12 @@ extern unsigned int user_debug; | |||
144 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | 145 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) |
145 | #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); | 146 | #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); |
146 | 147 | ||
147 | #ifdef CONFIG_SMP | ||
148 | /* | 148 | /* |
149 | * Define our own context switch locking. This allows us to enable | 149 | * switch_mm() may do a full cache flush over the context switch, |
150 | * interrupts over the context switch, otherwise we end up with high | 150 | * so enable interrupts over the context switch to avoid high |
151 | * interrupt latency. The real problem area is switch_mm() which may | 151 | * latency. |
152 | * do a full cache flush. | ||
153 | */ | 152 | */ |
154 | #define prepare_arch_switch(rq,next) \ | 153 | #define __ARCH_WANT_INTERRUPTS_ON_CTXSW |
155 | do { \ | ||
156 | spin_lock(&(next)->switch_lock); \ | ||
157 | spin_unlock_irq(&(rq)->lock); \ | ||
158 | } while (0) | ||
159 | |||
160 | #define finish_arch_switch(rq,prev) \ | ||
161 | spin_unlock(&(prev)->switch_lock) | ||
162 | |||
163 | #define task_running(rq,p) \ | ||
164 | ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock)) | ||
165 | #else | ||
166 | /* | ||
167 | * Our UP-case is more simple, but we assume knowledge of how | ||
168 | * spin_unlock_irq() and friends are implemented. This avoids | ||
169 | * us needlessly decrementing and incrementing the preempt count. | ||
170 | */ | ||
171 | #define prepare_arch_switch(rq,next) local_irq_enable() | ||
172 | #define finish_arch_switch(rq,prev) spin_unlock(&(rq)->lock) | ||
173 | #define task_running(rq,p) ((rq)->curr == (p)) | ||
174 | #endif | ||
175 | 154 | ||
176 | /* | 155 | /* |
177 | * switch_to(prev, next) should switch from task `prev' to `next' | 156 | * switch_to(prev, next) should switch from task `prev' to `next' |
@@ -307,7 +286,7 @@ do { \ | |||
307 | ({ \ | 286 | ({ \ |
308 | unsigned long flags; \ | 287 | unsigned long flags; \ |
309 | local_save_flags(flags); \ | 288 | local_save_flags(flags); \ |
310 | flags & PSR_I_BIT; \ | 289 | (int)(flags & PSR_I_BIT); \ |
311 | }) | 290 | }) |
312 | 291 | ||
313 | #ifdef CONFIG_SMP | 292 | #ifdef CONFIG_SMP |
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h index 66c585c50cf9..8252a4cd860f 100644 --- a/include/asm-arm/thread_info.h +++ b/include/asm-arm/thread_info.h | |||
@@ -49,7 +49,7 @@ struct cpu_context_save { | |||
49 | */ | 49 | */ |
50 | struct thread_info { | 50 | struct thread_info { |
51 | unsigned long flags; /* low level flags */ | 51 | unsigned long flags; /* low level flags */ |
52 | __s32 preempt_count; /* 0 => preemptable, <0 => bug */ | 52 | int preempt_count; /* 0 => preemptable, <0 => bug */ |
53 | mm_segment_t addr_limit; /* address limit */ | 53 | mm_segment_t addr_limit; /* address limit */ |
54 | struct task_struct *task; /* main task structure */ | 54 | struct task_struct *task; /* main task structure */ |
55 | struct exec_domain *exec_domain; /* execution domain */ | 55 | struct exec_domain *exec_domain; /* execution domain */ |
diff --git a/include/asm-arm26/elf.h b/include/asm-arm26/elf.h index 8b149474db24..5a47fdb3015d 100644 --- a/include/asm-arm26/elf.h +++ b/include/asm-arm26/elf.h | |||
@@ -36,7 +36,7 @@ typedef struct { void *null; } elf_fpregset_t; | |||
36 | * These are used to set parameters in the core dumps. | 36 | * These are used to set parameters in the core dumps. |
37 | */ | 37 | */ |
38 | #define ELF_CLASS ELFCLASS32 | 38 | #define ELF_CLASS ELFCLASS32 |
39 | #define ELF_DATA ELFDATA2LSB; | 39 | #define ELF_DATA ELFDATA2LSB |
40 | #define ELF_ARCH EM_ARM | 40 | #define ELF_ARCH EM_ARM |
41 | 41 | ||
42 | #define USE_ELF_CORE_DUMP | 42 | #define USE_ELF_CORE_DUMP |
diff --git a/include/asm-arm26/signal.h b/include/asm-arm26/signal.h index dedb29280303..37ad25355591 100644 --- a/include/asm-arm26/signal.h +++ b/include/asm-arm26/signal.h | |||
@@ -166,9 +166,6 @@ typedef struct sigaltstack { | |||
166 | #include <asm/sigcontext.h> | 166 | #include <asm/sigcontext.h> |
167 | 167 | ||
168 | #define sigmask(sig) (1UL << ((sig) - 1)) | 168 | #define sigmask(sig) (1UL << ((sig) - 1)) |
169 | //FIXME!!! | ||
170 | //#define HAVE_ARCH_GET_SIGNAL_TO_DELIVER | ||
171 | |||
172 | #endif | 169 | #endif |
173 | 170 | ||
174 | 171 | ||
diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h index 50f41b50268a..aff3e5699c64 100644 --- a/include/asm-arm26/thread_info.h +++ b/include/asm-arm26/thread_info.h | |||
@@ -44,7 +44,7 @@ struct cpu_context_save { | |||
44 | */ | 44 | */ |
45 | struct thread_info { | 45 | struct thread_info { |
46 | unsigned long flags; /* low level flags */ | 46 | unsigned long flags; /* low level flags */ |
47 | __s32 preempt_count; /* 0 => preemptable, <0 => bug */ | 47 | int preempt_count; /* 0 => preemptable, <0 => bug */ |
48 | mm_segment_t addr_limit; /* address limit */ | 48 | mm_segment_t addr_limit; /* address limit */ |
49 | struct task_struct *task; /* main task structure */ | 49 | struct task_struct *task; /* main task structure */ |
50 | struct exec_domain *exec_domain; /* execution domain */ | 50 | struct exec_domain *exec_domain; /* execution domain */ |
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h index 53193feb0826..5ba4b7865cc5 100644 --- a/include/asm-cris/thread_info.h +++ b/include/asm-cris/thread_info.h | |||
@@ -31,7 +31,7 @@ struct thread_info { | |||
31 | struct exec_domain *exec_domain; /* execution domain */ | 31 | struct exec_domain *exec_domain; /* execution domain */ |
32 | unsigned long flags; /* low level flags */ | 32 | unsigned long flags; /* low level flags */ |
33 | __u32 cpu; /* current CPU */ | 33 | __u32 cpu; /* current CPU */ |
34 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 34 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
35 | 35 | ||
36 | mm_segment_t addr_limit; /* thread address space: | 36 | mm_segment_t addr_limit; /* thread address space: |
37 | 0-0xBFFFFFFF for user-thead | 37 | 0-0xBFFFFFFF for user-thead |
diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h index b80a97f50af6..c8cba7836f0d 100644 --- a/include/asm-frv/thread_info.h +++ b/include/asm-frv/thread_info.h | |||
@@ -33,7 +33,7 @@ struct thread_info { | |||
33 | unsigned long flags; /* low level flags */ | 33 | unsigned long flags; /* low level flags */ |
34 | unsigned long status; /* thread-synchronous flags */ | 34 | unsigned long status; /* thread-synchronous flags */ |
35 | __u32 cpu; /* current CPU */ | 35 | __u32 cpu; /* current CPU */ |
36 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 36 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
37 | 37 | ||
38 | mm_segment_t addr_limit; /* thread address space: | 38 | mm_segment_t addr_limit; /* thread address space: |
39 | 0-0xBFFFFFFF for user-thead | 39 | 0-0xBFFFFFFF for user-thead |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 3b709b84934f..9044aeb37828 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -29,7 +29,7 @@ do { \ | |||
29 | #define DEFINE_PER_CPU(type, name) \ | 29 | #define DEFINE_PER_CPU(type, name) \ |
30 | __typeof__(type) per_cpu__##name | 30 | __typeof__(type) per_cpu__##name |
31 | 31 | ||
32 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) | 32 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) |
33 | #define __get_cpu_var(var) per_cpu__##var | 33 | #define __get_cpu_var(var) per_cpu__##var |
34 | 34 | ||
35 | #endif /* SMP */ | 35 | #endif /* SMP */ |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 1f4ec7b70270..f40593565173 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -125,6 +125,9 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres | |||
125 | 125 | ||
126 | #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY | 126 | #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY |
127 | #define page_test_and_clear_dirty(page) (0) | 127 | #define page_test_and_clear_dirty(page) (0) |
128 | #define pte_maybe_dirty(pte) pte_dirty(pte) | ||
129 | #else | ||
130 | #define pte_maybe_dirty(pte) (1) | ||
128 | #endif | 131 | #endif |
129 | 132 | ||
130 | #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG | 133 | #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG |
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h index ec96e8b0f190..5d9d70cd17fc 100644 --- a/include/asm-generic/topology.h +++ b/include/asm-generic/topology.h | |||
@@ -41,8 +41,15 @@ | |||
41 | #ifndef node_to_first_cpu | 41 | #ifndef node_to_first_cpu |
42 | #define node_to_first_cpu(node) (0) | 42 | #define node_to_first_cpu(node) (0) |
43 | #endif | 43 | #endif |
44 | #ifndef pcibus_to_node | ||
45 | #define pcibus_to_node(node) (-1) | ||
46 | #endif | ||
47 | |||
44 | #ifndef pcibus_to_cpumask | 48 | #ifndef pcibus_to_cpumask |
45 | #define pcibus_to_cpumask(bus) (cpu_online_map) | 49 | #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ |
50 | CPU_MASK_ALL : \ | ||
51 | node_to_cpumask(pcibus_to_node(bus)) \ | ||
52 | ) | ||
46 | #endif | 53 | #endif |
47 | 54 | ||
48 | #endif /* _ASM_GENERIC_TOPOLOGY_H */ | 55 | #endif /* _ASM_GENERIC_TOPOLOGY_H */ |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 99cef06a364a..b3bb326ae5b6 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -73,7 +73,7 @@ | |||
73 | } | 73 | } |
74 | 74 | ||
75 | #define SECURITY_INIT \ | 75 | #define SECURITY_INIT \ |
76 | .security_initcall.init : { \ | 76 | .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ |
77 | VMLINUX_SYMBOL(__security_initcall_start) = .; \ | 77 | VMLINUX_SYMBOL(__security_initcall_start) = .; \ |
78 | *(.security_initcall.init) \ | 78 | *(.security_initcall.init) \ |
79 | VMLINUX_SYMBOL(__security_initcall_end) = .; \ | 79 | VMLINUX_SYMBOL(__security_initcall_end) = .; \ |
diff --git a/include/asm-h8300/kmap_types.h b/include/asm-h8300/kmap_types.h index 82431edeb2a1..1ec8a3427120 100644 --- a/include/asm-h8300/kmap_types.h +++ b/include/asm-h8300/kmap_types.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _ASM_KMAP_TYPES_H | 1 | #ifndef _ASM_H8300_KMAP_TYPES_H |
2 | #define _ASM_KMAP_TYPES_H | 2 | #define _ASM_H8300_KMAP_TYPES_H |
3 | 3 | ||
4 | enum km_type { | 4 | enum km_type { |
5 | KM_BOUNCE_READ, | 5 | KM_BOUNCE_READ, |
@@ -13,6 +13,8 @@ enum km_type { | |||
13 | KM_PTE1, | 13 | KM_PTE1, |
14 | KM_IRQ0, | 14 | KM_IRQ0, |
15 | KM_IRQ1, | 15 | KM_IRQ1, |
16 | KM_SOFTIRQ0, | ||
17 | KM_SOFTIRQ1, | ||
16 | KM_TYPE_NR | 18 | KM_TYPE_NR |
17 | }; | 19 | }; |
18 | 20 | ||
diff --git a/include/asm-h8300/mman.h b/include/asm-h8300/mman.h index abe08856c84f..63f727a59850 100644 --- a/include/asm-h8300/mman.h +++ b/include/asm-h8300/mman.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #define PROT_READ 0x1 /* page can be read */ | 4 | #define PROT_READ 0x1 /* page can be read */ |
5 | #define PROT_WRITE 0x2 /* page can be written */ | 5 | #define PROT_WRITE 0x2 /* page can be written */ |
6 | #define PROT_EXEC 0x4 /* page can be executed */ | 6 | #define PROT_EXEC 0x4 /* page can be executed */ |
7 | #define PROT_SEM 0x8 /* page may be used for atomic ops */ | ||
7 | #define PROT_NONE 0x0 /* page can not be accessed */ | 8 | #define PROT_NONE 0x0 /* page can not be accessed */ |
8 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ | 9 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ |
9 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ | 10 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ |
@@ -19,6 +20,8 @@ | |||
19 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | 20 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ |
20 | #define MAP_LOCKED 0x2000 /* pages are locked */ | 21 | #define MAP_LOCKED 0x2000 /* pages are locked */ |
21 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 22 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
23 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
24 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
22 | 25 | ||
23 | #define MS_ASYNC 1 /* sync memory asynchronously */ | 26 | #define MS_ASYNC 1 /* sync memory asynchronously */ |
24 | #define MS_INVALIDATE 2 /* invalidate the caches */ | 27 | #define MS_INVALIDATE 2 /* invalidate the caches */ |
diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h index b07c9344776f..bfcc755c3bb1 100644 --- a/include/asm-h8300/thread_info.h +++ b/include/asm-h8300/thread_info.h | |||
@@ -23,7 +23,7 @@ struct thread_info { | |||
23 | struct exec_domain *exec_domain; /* execution domain */ | 23 | struct exec_domain *exec_domain; /* execution domain */ |
24 | unsigned long flags; /* low level flags */ | 24 | unsigned long flags; /* low level flags */ |
25 | int cpu; /* cpu we're on */ | 25 | int cpu; /* cpu we're on */ |
26 | int preempt_count; /* 0 => preemptable, <0 => BUG*/ | 26 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
27 | struct restart_block restart_block; | 27 | struct restart_block restart_block; |
28 | }; | 28 | }; |
29 | 29 | ||
diff --git a/include/asm-i386/agp.h b/include/asm-i386/agp.h index a917ff50354f..b82f5f3ab887 100644 --- a/include/asm-i386/agp.h +++ b/include/asm-i386/agp.h | |||
@@ -21,4 +21,14 @@ int unmap_page_from_agp(struct page *page); | |||
21 | worth it. Would need a page for it. */ | 21 | worth it. Would need a page for it. */ |
22 | #define flush_agp_cache() asm volatile("wbinvd":::"memory") | 22 | #define flush_agp_cache() asm volatile("wbinvd":::"memory") |
23 | 23 | ||
24 | /* Convert a physical address to an address suitable for the GART. */ | ||
25 | #define phys_to_gart(x) (x) | ||
26 | #define gart_to_phys(x) (x) | ||
27 | |||
28 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ | ||
29 | #define alloc_gatt_pages(order) \ | ||
30 | ((char *)__get_free_pages(GFP_KERNEL, (order))) | ||
31 | #define free_gatt_pages(table, order) \ | ||
32 | free_pages((unsigned long)(table), (order)) | ||
33 | |||
24 | #endif | 34 | #endif |
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index a5810cf7b578..6a1b1882285c 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/pm.h> | 5 | #include <linux/pm.h> |
6 | #include <asm/fixmap.h> | 6 | #include <asm/fixmap.h> |
7 | #include <asm/apicdef.h> | 7 | #include <asm/apicdef.h> |
8 | #include <asm/processor.h> | ||
8 | #include <asm/system.h> | 9 | #include <asm/system.h> |
9 | 10 | ||
10 | #define Dprintk(x...) | 11 | #define Dprintk(x...) |
@@ -16,8 +17,20 @@ | |||
16 | #define APIC_VERBOSE 1 | 17 | #define APIC_VERBOSE 1 |
17 | #define APIC_DEBUG 2 | 18 | #define APIC_DEBUG 2 |
18 | 19 | ||
20 | extern int enable_local_apic; | ||
19 | extern int apic_verbosity; | 21 | extern int apic_verbosity; |
20 | 22 | ||
23 | static inline void lapic_disable(void) | ||
24 | { | ||
25 | enable_local_apic = -1; | ||
26 | clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); | ||
27 | } | ||
28 | |||
29 | static inline void lapic_enable(void) | ||
30 | { | ||
31 | enable_local_apic = 1; | ||
32 | } | ||
33 | |||
21 | /* | 34 | /* |
22 | * Define the default level of output to be very little | 35 | * Define the default level of output to be very little |
23 | * This can be turned up by using apic=verbose for more | 36 | * This can be turned up by using apic=verbose for more |
@@ -87,7 +100,7 @@ extern void (*wait_timer_tick)(void); | |||
87 | extern int get_maxlvt(void); | 100 | extern int get_maxlvt(void); |
88 | extern void clear_local_APIC(void); | 101 | extern void clear_local_APIC(void); |
89 | extern void connect_bsp_APIC (void); | 102 | extern void connect_bsp_APIC (void); |
90 | extern void disconnect_bsp_APIC (void); | 103 | extern void disconnect_bsp_APIC (int virt_wire_setup); |
91 | extern void disable_local_APIC (void); | 104 | extern void disable_local_APIC (void); |
92 | extern void lapic_shutdown (void); | 105 | extern void lapic_shutdown (void); |
93 | extern int verify_local_APIC (void); | 106 | extern int verify_local_APIC (void); |
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h index c689554ad5b9..0fed5e3c699c 100644 --- a/include/asm-i386/apicdef.h +++ b/include/asm-i386/apicdef.h | |||
@@ -86,11 +86,12 @@ | |||
86 | #define APIC_LVT_REMOTE_IRR (1<<14) | 86 | #define APIC_LVT_REMOTE_IRR (1<<14) |
87 | #define APIC_INPUT_POLARITY (1<<13) | 87 | #define APIC_INPUT_POLARITY (1<<13) |
88 | #define APIC_SEND_PENDING (1<<12) | 88 | #define APIC_SEND_PENDING (1<<12) |
89 | #define APIC_MODE_MASK 0x700 | ||
89 | #define GET_APIC_DELIVERY_MODE(x) (((x)>>8)&0x7) | 90 | #define GET_APIC_DELIVERY_MODE(x) (((x)>>8)&0x7) |
90 | #define SET_APIC_DELIVERY_MODE(x,y) (((x)&~0x700)|((y)<<8)) | 91 | #define SET_APIC_DELIVERY_MODE(x,y) (((x)&~0x700)|((y)<<8)) |
91 | #define APIC_MODE_FIXED 0x0 | 92 | #define APIC_MODE_FIXED 0x0 |
92 | #define APIC_MODE_NMI 0x4 | 93 | #define APIC_MODE_NMI 0x4 |
93 | #define APIC_MODE_EXINT 0x7 | 94 | #define APIC_MODE_EXTINT 0x7 |
94 | #define APIC_LVT1 0x360 | 95 | #define APIC_LVT1 0x360 |
95 | #define APIC_LVTERR 0x370 | 96 | #define APIC_LVTERR 0x370 |
96 | #define APIC_TMICT 0x380 | 97 | #define APIC_TMICT 0x380 |
diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h index 641342002bcd..f949e44c2a35 100644 --- a/include/asm-i386/checksum.h +++ b/include/asm-i386/checksum.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/in6.h> | 4 | #include <linux/in6.h> |
5 | 5 | ||
6 | #include <asm/uaccess.h> | ||
7 | |||
6 | /* | 8 | /* |
7 | * computes the checksum of a memory block at buff, length len, | 9 | * computes the checksum of a memory block at buff, length len, |
8 | * and adds in "sum" (32-bit) | 10 | * and adds in "sum" (32-bit) |
diff --git a/include/asm-i386/cpu.h b/include/asm-i386/cpu.h index 002740b21951..e7252c216ca8 100644 --- a/include/asm-i386/cpu.h +++ b/include/asm-i386/cpu.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/cpu.h> | 5 | #include <linux/cpu.h> |
6 | #include <linux/topology.h> | 6 | #include <linux/topology.h> |
7 | #include <linux/nodemask.h> | 7 | #include <linux/nodemask.h> |
8 | #include <linux/percpu.h> | ||
8 | 9 | ||
9 | #include <asm/node.h> | 10 | #include <asm/node.h> |
10 | 11 | ||
@@ -16,4 +17,5 @@ extern int arch_register_cpu(int num); | |||
16 | extern void arch_unregister_cpu(int); | 17 | extern void arch_unregister_cpu(int); |
17 | #endif | 18 | #endif |
18 | 19 | ||
20 | DECLARE_PER_CPU(int, cpu_state); | ||
19 | #endif /* _ASM_I386_CPU_H_ */ | 21 | #endif /* _ASM_I386_CPU_H_ */ |
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h index fc813b2e8274..b3783a32abee 100644 --- a/include/asm-i386/genapic.h +++ b/include/asm-i386/genapic.h | |||
@@ -78,7 +78,6 @@ struct genapic { | |||
78 | .int_delivery_mode = INT_DELIVERY_MODE, \ | 78 | .int_delivery_mode = INT_DELIVERY_MODE, \ |
79 | .int_dest_mode = INT_DEST_MODE, \ | 79 | .int_dest_mode = INT_DEST_MODE, \ |
80 | .no_balance_irq = NO_BALANCE_IRQ, \ | 80 | .no_balance_irq = NO_BALANCE_IRQ, \ |
81 | .no_ioapic_check = NO_IOAPIC_CHECK, \ | ||
82 | .ESR_DISABLE = esr_disable, \ | 81 | .ESR_DISABLE = esr_disable, \ |
83 | .apic_destination_logical = APIC_DEST_LOGICAL, \ | 82 | .apic_destination_logical = APIC_DEST_LOGICAL, \ |
84 | APICFUNC(apic_id_registered), \ | 83 | APICFUNC(apic_id_registered), \ |
diff --git a/include/asm-i386/highmem.h b/include/asm-i386/highmem.h index 1df42bf347df..0fd331306b60 100644 --- a/include/asm-i386/highmem.h +++ b/include/asm-i386/highmem.h | |||
@@ -70,6 +70,7 @@ void *kmap(struct page *page); | |||
70 | void kunmap(struct page *page); | 70 | void kunmap(struct page *page); |
71 | void *kmap_atomic(struct page *page, enum km_type type); | 71 | void *kmap_atomic(struct page *page, enum km_type type); |
72 | void kunmap_atomic(void *kvaddr, enum km_type type); | 72 | void kunmap_atomic(void *kvaddr, enum km_type type); |
73 | void *kmap_atomic_pfn(unsigned long pfn, enum km_type type); | ||
73 | struct page *kmap_atomic_to_page(void *ptr); | 74 | struct page *kmap_atomic_to_page(void *ptr); |
74 | 75 | ||
75 | #define flush_cache_kmaps() do { } while (0) | 76 | #define flush_cache_kmaps() do { } while (0) |
diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h index 05b9e61b0a72..270f1986b19f 100644 --- a/include/asm-i386/irq.h +++ b/include/asm-i386/irq.h | |||
@@ -29,13 +29,19 @@ extern void release_vm86_irqs(struct task_struct *); | |||
29 | 29 | ||
30 | #ifdef CONFIG_4KSTACKS | 30 | #ifdef CONFIG_4KSTACKS |
31 | extern void irq_ctx_init(int cpu); | 31 | extern void irq_ctx_init(int cpu); |
32 | extern void irq_ctx_exit(int cpu); | ||
32 | # define __ARCH_HAS_DO_SOFTIRQ | 33 | # define __ARCH_HAS_DO_SOFTIRQ |
33 | #else | 34 | #else |
34 | # define irq_ctx_init(cpu) do { } while (0) | 35 | # define irq_ctx_init(cpu) do { } while (0) |
36 | # define irq_ctx_exit(cpu) do { } while (0) | ||
35 | #endif | 37 | #endif |
36 | 38 | ||
37 | #ifdef CONFIG_IRQBALANCE | 39 | #ifdef CONFIG_IRQBALANCE |
38 | extern int irqbalance_disable(char *str); | 40 | extern int irqbalance_disable(char *str); |
39 | #endif | 41 | #endif |
40 | 42 | ||
43 | #ifdef CONFIG_HOTPLUG_CPU | ||
44 | extern void fixup_irqs(cpumask_t map); | ||
45 | #endif | ||
46 | |||
41 | #endif /* _ASM_IRQ_H */ | 47 | #endif /* _ASM_IRQ_H */ |
diff --git a/include/asm-i386/kdebug.h b/include/asm-i386/kdebug.h index de6498b0d493..b3f8d5f59d5d 100644 --- a/include/asm-i386/kdebug.h +++ b/include/asm-i386/kdebug.h | |||
@@ -18,7 +18,7 @@ struct die_args { | |||
18 | }; | 18 | }; |
19 | 19 | ||
20 | /* Note - you should never unregister because that can race with NMIs. | 20 | /* Note - you should never unregister because that can race with NMIs. |
21 | If you really want to do it first unregister - then synchronize_kernel - then free. | 21 | If you really want to do it first unregister - then synchronize_sched - then free. |
22 | */ | 22 | */ |
23 | int register_die_notifier(struct notifier_block *nb); | 23 | int register_die_notifier(struct notifier_block *nb); |
24 | extern struct notifier_block *i386die_chain; | 24 | extern struct notifier_block *i386die_chain; |
diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h new file mode 100644 index 000000000000..6ed2a03e37b3 --- /dev/null +++ b/include/asm-i386/kexec.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _I386_KEXEC_H | ||
2 | #define _I386_KEXEC_H | ||
3 | |||
4 | #include <asm/fixmap.h> | ||
5 | |||
6 | /* | ||
7 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | ||
8 | * I.e. Maximum page that is mapped directly into kernel memory, | ||
9 | * and kmap is not required. | ||
10 | * | ||
11 | * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct | ||
12 | * calculation for the amount of memory directly mappable into the | ||
13 | * kernel memory space. | ||
14 | */ | ||
15 | |||
16 | /* Maximum physical address we can use pages from */ | ||
17 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) | ||
18 | /* Maximum address we can reach in physical address mode */ | ||
19 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) | ||
20 | /* Maximum address we can use for the control code buffer */ | ||
21 | #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE | ||
22 | |||
23 | #define KEXEC_CONTROL_CODE_SIZE 4096 | ||
24 | |||
25 | /* The native architecture */ | ||
26 | #define KEXEC_ARCH KEXEC_ARCH_386 | ||
27 | |||
28 | #define MAX_NOTE_BYTES 1024 | ||
29 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
30 | |||
31 | extern note_buf_t crash_notes[]; | ||
32 | |||
33 | #endif /* _I386_KEXEC_H */ | ||
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h index 4092f68d123a..8b6d3a90cd78 100644 --- a/include/asm-i386/kprobes.h +++ b/include/asm-i386/kprobes.h | |||
@@ -39,6 +39,9 @@ typedef u8 kprobe_opcode_t; | |||
39 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) | 39 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) |
40 | 40 | ||
41 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 41 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
42 | #define ARCH_SUPPORTS_KRETPROBES | ||
43 | |||
44 | void kretprobe_trampoline(void); | ||
42 | 45 | ||
43 | /* Architecture specific copy of original instruction*/ | 46 | /* Architecture specific copy of original instruction*/ |
44 | struct arch_specific_insn { | 47 | struct arch_specific_insn { |
diff --git a/include/asm-i386/linkage.h b/include/asm-i386/linkage.h index af3d8571c5c7..f4a6ebac0247 100644 --- a/include/asm-i386/linkage.h +++ b/include/asm-i386/linkage.h | |||
@@ -5,9 +5,7 @@ | |||
5 | #define FASTCALL(x) x __attribute__((regparm(3))) | 5 | #define FASTCALL(x) x __attribute__((regparm(3))) |
6 | #define fastcall __attribute__((regparm(3))) | 6 | #define fastcall __attribute__((regparm(3))) |
7 | 7 | ||
8 | #ifdef CONFIG_REGPARM | 8 | #define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret)) |
9 | # define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret)) | ||
10 | #endif | ||
11 | 9 | ||
12 | #ifdef CONFIG_X86_ALIGNMENT_16 | 10 | #ifdef CONFIG_X86_ALIGNMENT_16 |
13 | #define __ALIGN .align 16,0x90 | 11 | #define __ALIGN .align 16,0x90 |
diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h index 2339868270ef..ba936d4daedb 100644 --- a/include/asm-i386/mach-bigsmp/mach_apic.h +++ b/include/asm-i386/mach-bigsmp/mach_apic.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #define NO_BALANCE_IRQ (1) | 14 | #define NO_BALANCE_IRQ (1) |
15 | #define esr_disable (1) | 15 | #define esr_disable (1) |
16 | 16 | ||
17 | #define NO_IOAPIC_CHECK (0) | ||
18 | |||
19 | static inline int apic_id_registered(void) | 17 | static inline int apic_id_registered(void) |
20 | { | 18 | { |
21 | return (1); | 19 | return (1); |
diff --git a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h index 627f1cd084ba..3ef6292db780 100644 --- a/include/asm-i386/mach-default/mach_apic.h +++ b/include/asm-i386/mach-default/mach_apic.h | |||
@@ -19,8 +19,6 @@ static inline cpumask_t target_cpus(void) | |||
19 | #define NO_BALANCE_IRQ (0) | 19 | #define NO_BALANCE_IRQ (0) |
20 | #define esr_disable (0) | 20 | #define esr_disable (0) |
21 | 21 | ||
22 | #define NO_IOAPIC_CHECK (0) | ||
23 | |||
24 | #define INT_DELIVERY_MODE dest_LowestPrio | 22 | #define INT_DELIVERY_MODE dest_LowestPrio |
25 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | 23 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ |
26 | 24 | ||
diff --git a/include/asm-i386/mach-default/mach_ipi.h b/include/asm-i386/mach-default/mach_ipi.h index 6f2b17a20089..cc756a67cd63 100644 --- a/include/asm-i386/mach-default/mach_ipi.h +++ b/include/asm-i386/mach-default/mach_ipi.h | |||
@@ -4,11 +4,34 @@ | |||
4 | void send_IPI_mask_bitmask(cpumask_t mask, int vector); | 4 | void send_IPI_mask_bitmask(cpumask_t mask, int vector); |
5 | void __send_IPI_shortcut(unsigned int shortcut, int vector); | 5 | void __send_IPI_shortcut(unsigned int shortcut, int vector); |
6 | 6 | ||
7 | extern int no_broadcast; | ||
8 | |||
7 | static inline void send_IPI_mask(cpumask_t mask, int vector) | 9 | static inline void send_IPI_mask(cpumask_t mask, int vector) |
8 | { | 10 | { |
9 | send_IPI_mask_bitmask(mask, vector); | 11 | send_IPI_mask_bitmask(mask, vector); |
10 | } | 12 | } |
11 | 13 | ||
14 | static inline void __local_send_IPI_allbutself(int vector) | ||
15 | { | ||
16 | if (no_broadcast) { | ||
17 | cpumask_t mask = cpu_online_map; | ||
18 | int this_cpu = get_cpu(); | ||
19 | |||
20 | cpu_clear(this_cpu, mask); | ||
21 | send_IPI_mask(mask, vector); | ||
22 | put_cpu(); | ||
23 | } else | ||
24 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); | ||
25 | } | ||
26 | |||
27 | static inline void __local_send_IPI_all(int vector) | ||
28 | { | ||
29 | if (no_broadcast) | ||
30 | send_IPI_mask(cpu_online_map, vector); | ||
31 | else | ||
32 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector); | ||
33 | } | ||
34 | |||
12 | static inline void send_IPI_allbutself(int vector) | 35 | static inline void send_IPI_allbutself(int vector) |
13 | { | 36 | { |
14 | /* | 37 | /* |
@@ -18,13 +41,13 @@ static inline void send_IPI_allbutself(int vector) | |||
18 | if (!(num_online_cpus() > 1)) | 41 | if (!(num_online_cpus() > 1)) |
19 | return; | 42 | return; |
20 | 43 | ||
21 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); | 44 | __local_send_IPI_allbutself(vector); |
22 | return; | 45 | return; |
23 | } | 46 | } |
24 | 47 | ||
25 | static inline void send_IPI_all(int vector) | 48 | static inline void send_IPI_all(int vector) |
26 | { | 49 | { |
27 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector); | 50 | __local_send_IPI_all(vector); |
28 | } | 51 | } |
29 | 52 | ||
30 | #endif /* __ASM_MACH_IPI_H */ | 53 | #endif /* __ASM_MACH_IPI_H */ |
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h index ceab2c464b13..b5f3f0d0b2bc 100644 --- a/include/asm-i386/mach-es7000/mach_apic.h +++ b/include/asm-i386/mach-es7000/mach_apic.h | |||
@@ -38,8 +38,6 @@ static inline cpumask_t target_cpus(void) | |||
38 | #define WAKE_SECONDARY_VIA_INIT | 38 | #define WAKE_SECONDARY_VIA_INIT |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #define NO_IOAPIC_CHECK (1) | ||
42 | |||
43 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | 41 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) |
44 | { | 42 | { |
45 | return 0; | 43 | return 0; |
diff --git a/include/asm-i386/mach-generic/mach_apic.h b/include/asm-i386/mach-generic/mach_apic.h index ab36d02ebede..b13767a4e934 100644 --- a/include/asm-i386/mach-generic/mach_apic.h +++ b/include/asm-i386/mach-generic/mach_apic.h | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | #define esr_disable (genapic->ESR_DISABLE) | 6 | #define esr_disable (genapic->ESR_DISABLE) |
7 | #define NO_BALANCE_IRQ (genapic->no_balance_irq) | 7 | #define NO_BALANCE_IRQ (genapic->no_balance_irq) |
8 | #define NO_IOAPIC_CHECK (genapic->no_ioapic_check) | ||
9 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | 8 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) |
10 | #define INT_DEST_MODE (genapic->int_dest_mode) | 9 | #define INT_DEST_MODE (genapic->int_dest_mode) |
11 | #undef APIC_DEST_LOGICAL | 10 | #undef APIC_DEST_LOGICAL |
diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h index e1a04494764a..9d158095da82 100644 --- a/include/asm-i386/mach-numaq/mach_apic.h +++ b/include/asm-i386/mach-numaq/mach_apic.h | |||
@@ -17,8 +17,6 @@ static inline cpumask_t target_cpus(void) | |||
17 | #define NO_BALANCE_IRQ (1) | 17 | #define NO_BALANCE_IRQ (1) |
18 | #define esr_disable (1) | 18 | #define esr_disable (1) |
19 | 19 | ||
20 | #define NO_IOAPIC_CHECK (0) | ||
21 | |||
22 | #define INT_DELIVERY_MODE dest_LowestPrio | 20 | #define INT_DELIVERY_MODE dest_LowestPrio |
23 | #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */ | 21 | #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */ |
24 | 22 | ||
diff --git a/include/asm-i386/mach-numaq/mach_ipi.h b/include/asm-i386/mach-numaq/mach_ipi.h index 1b46fd3f2ae3..c6044488e9e6 100644 --- a/include/asm-i386/mach-numaq/mach_ipi.h +++ b/include/asm-i386/mach-numaq/mach_ipi.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __ASM_MACH_IPI_H | 1 | #ifndef __ASM_MACH_IPI_H |
2 | #define __ASM_MACH_IPI_H | 2 | #define __ASM_MACH_IPI_H |
3 | 3 | ||
4 | inline void send_IPI_mask_sequence(cpumask_t, int vector); | 4 | void send_IPI_mask_sequence(cpumask_t, int vector); |
5 | 5 | ||
6 | static inline void send_IPI_mask(cpumask_t mask, int vector) | 6 | static inline void send_IPI_mask(cpumask_t mask, int vector) |
7 | { | 7 | { |
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h index 74e9cbc8c01b..3d6d12937e1f 100644 --- a/include/asm-i386/mach-summit/mach_apic.h +++ b/include/asm-i386/mach-summit/mach_apic.h | |||
@@ -7,8 +7,6 @@ | |||
7 | #define esr_disable (1) | 7 | #define esr_disable (1) |
8 | #define NO_BALANCE_IRQ (0) | 8 | #define NO_BALANCE_IRQ (0) |
9 | 9 | ||
10 | #define NO_IOAPIC_CHECK (1) /* Don't check I/O APIC ID for xAPIC */ | ||
11 | |||
12 | /* In clustered mode, the high nibble of APIC ID is a cluster number. | 10 | /* In clustered mode, the high nibble of APIC ID is a cluster number. |
13 | * The low nibble is a 4-bit bitmap. */ | 11 | * The low nibble is a 4-bit bitmap. */ |
14 | #define XAPIC_DEST_CPUS_SHIFT 4 | 12 | #define XAPIC_DEST_CPUS_SHIFT 4 |
diff --git a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h index 4e6cdfb8b091..de438c7147a8 100644 --- a/include/asm-i386/mach-visws/mach_apic.h +++ b/include/asm-i386/mach-visws/mach_apic.h | |||
@@ -9,8 +9,6 @@ | |||
9 | #define no_balance_irq (0) | 9 | #define no_balance_irq (0) |
10 | #define esr_disable (0) | 10 | #define esr_disable (0) |
11 | 11 | ||
12 | #define NO_IOAPIC_CHECK (0) | ||
13 | |||
14 | #define INT_DELIVERY_MODE dest_LowestPrio | 12 | #define INT_DELIVERY_MODE dest_LowestPrio |
15 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | 13 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ |
16 | 14 | ||
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 13830ae67cac..33ce5d37e894 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h | |||
@@ -8,7 +8,9 @@ | |||
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | 10 | ||
11 | #ifdef CONFIG_DISCONTIGMEM | 11 | #if CONFIG_NUMA |
12 | extern struct pglist_data *node_data[]; | ||
13 | #define NODE_DATA(nid) (node_data[nid]) | ||
12 | 14 | ||
13 | #ifdef CONFIG_NUMA | 15 | #ifdef CONFIG_NUMA |
14 | #ifdef CONFIG_X86_NUMAQ | 16 | #ifdef CONFIG_X86_NUMAQ |
@@ -21,8 +23,28 @@ | |||
21 | #define get_zholes_size(n) (0) | 23 | #define get_zholes_size(n) (0) |
22 | #endif /* CONFIG_NUMA */ | 24 | #endif /* CONFIG_NUMA */ |
23 | 25 | ||
24 | extern struct pglist_data *node_data[]; | 26 | extern int get_memcfg_numa_flat(void ); |
25 | #define NODE_DATA(nid) (node_data[nid]) | 27 | /* |
28 | * This allows any one NUMA architecture to be compiled | ||
29 | * for, and still fall back to the flat function if it | ||
30 | * fails. | ||
31 | */ | ||
32 | static inline void get_memcfg_numa(void) | ||
33 | { | ||
34 | #ifdef CONFIG_X86_NUMAQ | ||
35 | if (get_memcfg_numaq()) | ||
36 | return; | ||
37 | #elif CONFIG_ACPI_SRAT | ||
38 | if (get_memcfg_from_srat()) | ||
39 | return; | ||
40 | #endif | ||
41 | |||
42 | get_memcfg_numa_flat(); | ||
43 | } | ||
44 | |||
45 | #endif /* CONFIG_NUMA */ | ||
46 | |||
47 | #ifdef CONFIG_DISCONTIGMEM | ||
26 | 48 | ||
27 | /* | 49 | /* |
28 | * generic node memory support, the following assumptions apply: | 50 | * generic node memory support, the following assumptions apply: |
@@ -48,26 +70,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
48 | #endif | 70 | #endif |
49 | } | 71 | } |
50 | 72 | ||
51 | /* | ||
52 | * Following are macros that are specific to this numa platform. | ||
53 | */ | ||
54 | #define reserve_bootmem(addr, size) \ | ||
55 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) | ||
56 | #define alloc_bootmem(x) \ | ||
57 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
58 | #define alloc_bootmem_low(x) \ | ||
59 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) | ||
60 | #define alloc_bootmem_pages(x) \ | ||
61 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
62 | #define alloc_bootmem_low_pages(x) \ | ||
63 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
64 | #define alloc_bootmem_node(ignore, x) \ | ||
65 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
66 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
67 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
68 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
69 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
70 | |||
71 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) | 73 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) |
72 | 74 | ||
73 | /* | 75 | /* |
@@ -79,7 +81,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
79 | */ | 81 | */ |
80 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) | 82 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) |
81 | 83 | ||
82 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
83 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 84 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
84 | #define node_end_pfn(nid) \ | 85 | #define node_end_pfn(nid) \ |
85 | ({ \ | 86 | ({ \ |
@@ -100,7 +101,7 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
100 | ({ \ | 101 | ({ \ |
101 | unsigned long __pfn = pfn; \ | 102 | unsigned long __pfn = pfn; \ |
102 | int __node = pfn_to_nid(__pfn); \ | 103 | int __node = pfn_to_nid(__pfn); \ |
103 | &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ | 104 | &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ |
104 | }) | 105 | }) |
105 | 106 | ||
106 | #define page_to_pfn(pg) \ | 107 | #define page_to_pfn(pg) \ |
@@ -122,26 +123,34 @@ static inline int pfn_valid(int pfn) | |||
122 | return (pfn < node_end_pfn(nid)); | 123 | return (pfn < node_end_pfn(nid)); |
123 | return 0; | 124 | return 0; |
124 | } | 125 | } |
125 | #endif | 126 | #endif /* CONFIG_X86_NUMAQ */ |
127 | |||
128 | #endif /* CONFIG_DISCONTIGMEM */ | ||
129 | |||
130 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
126 | 131 | ||
127 | extern int get_memcfg_numa_flat(void ); | ||
128 | /* | 132 | /* |
129 | * This allows any one NUMA architecture to be compiled | 133 | * Following are macros that are specific to this numa platform. |
130 | * for, and still fall back to the flat function if it | ||
131 | * fails. | ||
132 | */ | 134 | */ |
133 | static inline void get_memcfg_numa(void) | 135 | #define reserve_bootmem(addr, size) \ |
134 | { | 136 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) |
135 | #ifdef CONFIG_X86_NUMAQ | 137 | #define alloc_bootmem(x) \ |
136 | if (get_memcfg_numaq()) | 138 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
137 | return; | 139 | #define alloc_bootmem_low(x) \ |
138 | #elif CONFIG_ACPI_SRAT | 140 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) |
139 | if (get_memcfg_from_srat()) | 141 | #define alloc_bootmem_pages(x) \ |
140 | return; | 142 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
141 | #endif | 143 | #define alloc_bootmem_low_pages(x) \ |
144 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
145 | #define alloc_bootmem_node(ignore, x) \ | ||
146 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
147 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
148 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
149 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
150 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
142 | 151 | ||
143 | get_memcfg_numa_flat(); | 152 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ |
144 | } | 153 | |
154 | extern int early_pfn_to_nid(unsigned long pfn); | ||
145 | 155 | ||
146 | #endif /* CONFIG_DISCONTIGMEM */ | ||
147 | #endif /* _ASM_MMZONE_H_ */ | 156 | #endif /* _ASM_MMZONE_H_ */ |
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index ed13969fa2d6..8d93f732d72d 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h | |||
@@ -68,6 +68,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
68 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 68 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
69 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 69 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
70 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | 70 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
71 | #define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE | ||
71 | #endif | 72 | #endif |
72 | 73 | ||
73 | #define pgd_val(x) ((x).pgd) | 74 | #define pgd_val(x) ((x).pgd) |
@@ -119,13 +120,18 @@ static __inline__ int get_order(unsigned long size) | |||
119 | 120 | ||
120 | extern int sysctl_legacy_va_layout; | 121 | extern int sysctl_legacy_va_layout; |
121 | 122 | ||
123 | extern int page_is_ram(unsigned long pagenr); | ||
124 | |||
122 | #endif /* __ASSEMBLY__ */ | 125 | #endif /* __ASSEMBLY__ */ |
123 | 126 | ||
124 | #ifdef __ASSEMBLY__ | 127 | #ifdef __ASSEMBLY__ |
125 | #define __PAGE_OFFSET (0xC0000000) | 128 | #define __PAGE_OFFSET (0xC0000000) |
129 | #define __PHYSICAL_START CONFIG_PHYSICAL_START | ||
126 | #else | 130 | #else |
127 | #define __PAGE_OFFSET (0xC0000000UL) | 131 | #define __PAGE_OFFSET (0xC0000000UL) |
132 | #define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START) | ||
128 | #endif | 133 | #endif |
134 | #define __KERNEL_START (__PAGE_OFFSET + __PHYSICAL_START) | ||
129 | 135 | ||
130 | 136 | ||
131 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) | 137 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) |
@@ -134,11 +140,11 @@ extern int sysctl_legacy_va_layout; | |||
134 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | 140 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) |
135 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 141 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
136 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 142 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
137 | #ifndef CONFIG_DISCONTIGMEM | 143 | #ifdef CONFIG_FLATMEM |
138 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 144 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
139 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 145 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
140 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 146 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
141 | #endif /* !CONFIG_DISCONTIGMEM */ | 147 | #endif /* CONFIG_FLATMEM */ |
142 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 148 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
143 | 149 | ||
144 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 150 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/include/asm-i386/param.h b/include/asm-i386/param.h index b6440526e42a..fa02e67ea86b 100644 --- a/include/asm-i386/param.h +++ b/include/asm-i386/param.h | |||
@@ -1,8 +1,10 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
1 | #ifndef _ASMi386_PARAM_H | 3 | #ifndef _ASMi386_PARAM_H |
2 | #define _ASMi386_PARAM_H | 4 | #define _ASMi386_PARAM_H |
3 | 5 | ||
4 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
5 | # define HZ 1000 /* Internal kernel timer frequency */ | 7 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ |
6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | 8 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ |
7 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | 9 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ |
8 | #endif | 10 | #endif |
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 8d60c2b4b003..77c6497f416e 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h | |||
@@ -236,6 +236,7 @@ static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return | |||
236 | static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } | 236 | static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } |
237 | static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } | 237 | static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } |
238 | static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } | 238 | static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } |
239 | static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PRESENT | _PAGE_PSE; return pte; } | ||
239 | 240 | ||
240 | #ifdef CONFIG_X86_PAE | 241 | #ifdef CONFIG_X86_PAE |
241 | # include <asm/pgtable-3level.h> | 242 | # include <asm/pgtable-3level.h> |
@@ -275,7 +276,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
275 | */ | 276 | */ |
276 | 277 | ||
277 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | 278 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) |
278 | #define mk_pte_huge(entry) ((entry).pte_low |= _PAGE_PRESENT | _PAGE_PSE) | ||
279 | 279 | ||
280 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 280 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
281 | { | 281 | { |
@@ -398,9 +398,9 @@ extern void noexec_setup(const char *str); | |||
398 | 398 | ||
399 | #endif /* !__ASSEMBLY__ */ | 399 | #endif /* !__ASSEMBLY__ */ |
400 | 400 | ||
401 | #ifndef CONFIG_DISCONTIGMEM | 401 | #ifdef CONFIG_FLATMEM |
402 | #define kern_addr_valid(addr) (1) | 402 | #define kern_addr_valid(addr) (1) |
403 | #endif /* !CONFIG_DISCONTIGMEM */ | 403 | #endif /* CONFIG_FLATMEM */ |
404 | 404 | ||
405 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ | 405 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ |
406 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) | 406 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) |
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 359bb0151742..6f0f93d0d417 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
@@ -501,12 +501,16 @@ static inline void load_esp0(struct tss_struct *tss, struct thread_struct *threa | |||
501 | } while (0) | 501 | } while (0) |
502 | 502 | ||
503 | /* | 503 | /* |
504 | * This special macro can be used to load a debugging register | 504 | * These special macros can be used to get or set a debugging register |
505 | */ | 505 | */ |
506 | #define loaddebug(thread,register) \ | 506 | #define get_debugreg(var, register) \ |
507 | __asm__("movl %0,%%db" #register \ | 507 | __asm__("movl %%db" #register ", %0" \ |
508 | : /* no output */ \ | 508 | :"=r" (var)) |
509 | :"r" ((thread)->debugreg[register])) | 509 | #define set_debugreg(value, register) \ |
510 | __asm__("movl %0,%%db" #register \ | ||
511 | : /* no output */ \ | ||
512 | :"r" (value)) | ||
513 | |||
510 | 514 | ||
511 | /* Forward declaration, a strange C thing */ | 515 | /* Forward declaration, a strange C thing */ |
512 | struct task_struct; | 516 | struct task_struct; |
@@ -687,5 +691,7 @@ extern void select_idle_routine(const struct cpuinfo_x86 *c); | |||
687 | #define cache_line_size() (boot_cpu_data.x86_cache_alignment) | 691 | #define cache_line_size() (boot_cpu_data.x86_cache_alignment) |
688 | 692 | ||
689 | extern unsigned long boot_option_idle_override; | 693 | extern unsigned long boot_option_idle_override; |
694 | extern void enable_sep_cpu(void); | ||
695 | extern int sysenter_setup(void); | ||
690 | 696 | ||
691 | #endif /* __ASM_I386_PROCESSOR_H */ | 697 | #endif /* __ASM_I386_PROCESSOR_H */ |
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h index 8618914b3521..eef9f93870d4 100644 --- a/include/asm-i386/ptrace.h +++ b/include/asm-i386/ptrace.h | |||
@@ -57,7 +57,8 @@ struct pt_regs { | |||
57 | #ifdef __KERNEL__ | 57 | #ifdef __KERNEL__ |
58 | struct task_struct; | 58 | struct task_struct; |
59 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); | 59 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); |
60 | #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs)) | 60 | #define user_mode(regs) (3 & (regs)->xcs) |
61 | #define user_mode_vm(regs) ((VM_MASK & (regs)->eflags) || user_mode(regs)) | ||
61 | #define instruction_pointer(regs) ((regs)->eip) | 62 | #define instruction_pointer(regs) ((regs)->eip) |
62 | #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) | 63 | #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) |
63 | extern unsigned long profile_pc(struct pt_regs *regs); | 64 | extern unsigned long profile_pc(struct pt_regs *regs); |
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index e03a206dfa36..edad9b4712fa 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h | |||
@@ -42,16 +42,23 @@ extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); | |||
42 | extern void smp_invalidate_rcv(void); /* Process an NMI */ | 42 | extern void smp_invalidate_rcv(void); /* Process an NMI */ |
43 | extern void (*mtrr_hook) (void); | 43 | extern void (*mtrr_hook) (void); |
44 | extern void zap_low_mappings (void); | 44 | extern void zap_low_mappings (void); |
45 | extern void lock_ipi_call_lock(void); | ||
46 | extern void unlock_ipi_call_lock(void); | ||
45 | 47 | ||
46 | #define MAX_APICID 256 | 48 | #define MAX_APICID 256 |
47 | extern u8 x86_cpu_to_apicid[]; | 49 | extern u8 x86_cpu_to_apicid[]; |
48 | 50 | ||
51 | #ifdef CONFIG_HOTPLUG_CPU | ||
52 | extern void cpu_exit_clear(void); | ||
53 | extern void cpu_uninit(void); | ||
54 | #endif | ||
55 | |||
49 | /* | 56 | /* |
50 | * This function is needed by all SMP systems. It must _always_ be valid | 57 | * This function is needed by all SMP systems. It must _always_ be valid |
51 | * from the initial startup. We map APIC_BASE very early in page_setup(), | 58 | * from the initial startup. We map APIC_BASE very early in page_setup(), |
52 | * so this is correct in the x86 case. | 59 | * so this is correct in the x86 case. |
53 | */ | 60 | */ |
54 | #define __smp_processor_id() (current_thread_info()->cpu) | 61 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
55 | 62 | ||
56 | extern cpumask_t cpu_callout_map; | 63 | extern cpumask_t cpu_callout_map; |
57 | extern cpumask_t cpu_callin_map; | 64 | extern cpumask_t cpu_callin_map; |
@@ -83,6 +90,9 @@ static __inline int logical_smp_processor_id(void) | |||
83 | } | 90 | } |
84 | 91 | ||
85 | #endif | 92 | #endif |
93 | |||
94 | extern int __cpu_disable(void); | ||
95 | extern void __cpu_die(unsigned int cpu); | ||
86 | #endif /* !__ASSEMBLY__ */ | 96 | #endif /* !__ASSEMBLY__ */ |
87 | 97 | ||
88 | #define NO_PROC_ID 0xFF /* No processor magic marker */ | 98 | #define NO_PROC_ID 0xFF /* No processor magic marker */ |
diff --git a/include/asm-i386/sparsemem.h b/include/asm-i386/sparsemem.h new file mode 100644 index 000000000000..cfeed990585f --- /dev/null +++ b/include/asm-i386/sparsemem.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _I386_SPARSEMEM_H | ||
2 | #define _I386_SPARSEMEM_H | ||
3 | #ifdef CONFIG_SPARSEMEM | ||
4 | |||
5 | /* | ||
6 | * generic non-linear memory support: | ||
7 | * | ||
8 | * 1) we will not split memory into more chunks than will fit into the | ||
9 | * flags field of the struct page | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * SECTION_SIZE_BITS 2^N: how big each section will be | ||
14 | * MAX_PHYSADDR_BITS 2^N: how much physical address space we have | ||
15 | * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space | ||
16 | */ | ||
17 | #ifdef CONFIG_X86_PAE | ||
18 | #define SECTION_SIZE_BITS 30 | ||
19 | #define MAX_PHYSADDR_BITS 36 | ||
20 | #define MAX_PHYSMEM_BITS 36 | ||
21 | #else | ||
22 | #define SECTION_SIZE_BITS 26 | ||
23 | #define MAX_PHYSADDR_BITS 32 | ||
24 | #define MAX_PHYSMEM_BITS 32 | ||
25 | #endif | ||
26 | |||
27 | /* XXX: FIXME -- wli */ | ||
28 | #define kern_addr_valid(kaddr) (0) | ||
29 | |||
30 | #endif /* CONFIG_SPARSEMEM */ | ||
31 | #endif /* _I386_SPARSEMEM_H */ | ||
diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index 6a78ac58c194..02c8f5d22065 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h | |||
@@ -116,7 +116,8 @@ __asm__ __volatile__( | |||
116 | "orb $1,%%al\n" | 116 | "orb $1,%%al\n" |
117 | "3:" | 117 | "3:" |
118 | :"=a" (__res), "=&S" (d0), "=&D" (d1) | 118 | :"=a" (__res), "=&S" (d0), "=&D" (d1) |
119 | :"1" (cs),"2" (ct)); | 119 | :"1" (cs),"2" (ct) |
120 | :"memory"); | ||
120 | return __res; | 121 | return __res; |
121 | } | 122 | } |
122 | 123 | ||
@@ -138,8 +139,9 @@ __asm__ __volatile__( | |||
138 | "3:\tsbbl %%eax,%%eax\n\t" | 139 | "3:\tsbbl %%eax,%%eax\n\t" |
139 | "orb $1,%%al\n" | 140 | "orb $1,%%al\n" |
140 | "4:" | 141 | "4:" |
141 | :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) | 142 | :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) |
142 | :"1" (cs),"2" (ct),"3" (count)); | 143 | :"1" (cs),"2" (ct),"3" (count) |
144 | :"memory"); | ||
143 | return __res; | 145 | return __res; |
144 | } | 146 | } |
145 | 147 | ||
@@ -158,7 +160,9 @@ __asm__ __volatile__( | |||
158 | "movl $1,%1\n" | 160 | "movl $1,%1\n" |
159 | "2:\tmovl %1,%0\n\t" | 161 | "2:\tmovl %1,%0\n\t" |
160 | "decl %0" | 162 | "decl %0" |
161 | :"=a" (__res), "=&S" (d0) : "1" (s),"0" (c)); | 163 | :"=a" (__res), "=&S" (d0) |
164 | :"1" (s),"0" (c) | ||
165 | :"memory"); | ||
162 | return __res; | 166 | return __res; |
163 | } | 167 | } |
164 | 168 | ||
@@ -175,7 +179,9 @@ __asm__ __volatile__( | |||
175 | "leal -1(%%esi),%0\n" | 179 | "leal -1(%%esi),%0\n" |
176 | "2:\ttestb %%al,%%al\n\t" | 180 | "2:\ttestb %%al,%%al\n\t" |
177 | "jne 1b" | 181 | "jne 1b" |
178 | :"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c)); | 182 | :"=g" (__res), "=&S" (d0), "=&a" (d1) |
183 | :"0" (0),"1" (s),"2" (c) | ||
184 | :"memory"); | ||
179 | return __res; | 185 | return __res; |
180 | } | 186 | } |
181 | 187 | ||
@@ -189,7 +195,9 @@ __asm__ __volatile__( | |||
189 | "scasb\n\t" | 195 | "scasb\n\t" |
190 | "notl %0\n\t" | 196 | "notl %0\n\t" |
191 | "decl %0" | 197 | "decl %0" |
192 | :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffffu)); | 198 | :"=c" (__res), "=&D" (d0) |
199 | :"1" (s),"a" (0), "0" (0xffffffffu) | ||
200 | :"memory"); | ||
193 | return __res; | 201 | return __res; |
194 | } | 202 | } |
195 | 203 | ||
@@ -333,7 +341,9 @@ __asm__ __volatile__( | |||
333 | "je 1f\n\t" | 341 | "je 1f\n\t" |
334 | "movl $1,%0\n" | 342 | "movl $1,%0\n" |
335 | "1:\tdecl %0" | 343 | "1:\tdecl %0" |
336 | :"=D" (__res), "=&c" (d0) : "a" (c),"0" (cs),"1" (count)); | 344 | :"=D" (__res), "=&c" (d0) |
345 | :"a" (c),"0" (cs),"1" (count) | ||
346 | :"memory"); | ||
337 | return __res; | 347 | return __res; |
338 | } | 348 | } |
339 | 349 | ||
@@ -369,7 +379,7 @@ __asm__ __volatile__( | |||
369 | "je 2f\n\t" | 379 | "je 2f\n\t" |
370 | "stosb\n" | 380 | "stosb\n" |
371 | "2:" | 381 | "2:" |
372 | : "=&c" (d0), "=&D" (d1) | 382 | :"=&c" (d0), "=&D" (d1) |
373 | :"a" (c), "q" (count), "0" (count/4), "1" ((long) s) | 383 | :"a" (c), "q" (count), "0" (count/4), "1" ((long) s) |
374 | :"memory"); | 384 | :"memory"); |
375 | return (s); | 385 | return (s); |
@@ -392,7 +402,8 @@ __asm__ __volatile__( | |||
392 | "jne 1b\n" | 402 | "jne 1b\n" |
393 | "3:\tsubl %2,%0" | 403 | "3:\tsubl %2,%0" |
394 | :"=a" (__res), "=&d" (d0) | 404 | :"=a" (__res), "=&d" (d0) |
395 | :"c" (s),"1" (count)); | 405 | :"c" (s),"1" (count) |
406 | :"memory"); | ||
396 | return __res; | 407 | return __res; |
397 | } | 408 | } |
398 | /* end of additional stuff */ | 409 | /* end of additional stuff */ |
@@ -473,7 +484,8 @@ static inline void * memscan(void * addr, int c, size_t size) | |||
473 | "dec %%edi\n" | 484 | "dec %%edi\n" |
474 | "1:" | 485 | "1:" |
475 | : "=D" (addr), "=c" (size) | 486 | : "=D" (addr), "=c" (size) |
476 | : "0" (addr), "1" (size), "a" (c)); | 487 | : "0" (addr), "1" (size), "a" (c) |
488 | : "memory"); | ||
477 | return addr; | 489 | return addr; |
478 | } | 490 | } |
479 | 491 | ||
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h index 2cd57271801d..95add81237ea 100644 --- a/include/asm-i386/thread_info.h +++ b/include/asm-i386/thread_info.h | |||
@@ -31,7 +31,7 @@ struct thread_info { | |||
31 | unsigned long flags; /* low level flags */ | 31 | unsigned long flags; /* low level flags */ |
32 | unsigned long status; /* thread-synchronous flags */ | 32 | unsigned long status; /* thread-synchronous flags */ |
33 | __u32 cpu; /* current CPU */ | 33 | __u32 cpu; /* current CPU */ |
34 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 34 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
35 | 35 | ||
36 | 36 | ||
37 | mm_segment_t addr_limit; /* thread address space: | 37 | mm_segment_t addr_limit; /* thread address space: |
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h index 40c54f69780e..dcf1e07db08a 100644 --- a/include/asm-i386/timer.h +++ b/include/asm-i386/timer.h | |||
@@ -22,6 +22,7 @@ struct timer_opts { | |||
22 | unsigned long (*get_offset)(void); | 22 | unsigned long (*get_offset)(void); |
23 | unsigned long long (*monotonic_clock)(void); | 23 | unsigned long long (*monotonic_clock)(void); |
24 | void (*delay)(unsigned long); | 24 | void (*delay)(unsigned long); |
25 | unsigned long (*read_timer)(void); | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | struct init_timer_opts { | 28 | struct init_timer_opts { |
@@ -52,7 +53,9 @@ extern struct init_timer_opts timer_cyclone_init; | |||
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | extern unsigned long calibrate_tsc(void); | 55 | extern unsigned long calibrate_tsc(void); |
56 | extern unsigned long read_timer_tsc(void); | ||
55 | extern void init_cpu_khz(void); | 57 | extern void init_cpu_khz(void); |
58 | extern int recalibrate_cpu_khz(void); | ||
56 | #ifdef CONFIG_HPET_TIMER | 59 | #ifdef CONFIG_HPET_TIMER |
57 | extern struct init_timer_opts timer_hpet_init; | 60 | extern struct init_timer_opts timer_hpet_init; |
58 | extern unsigned long calibrate_tsc_hpet(unsigned long *tsc_hpet_quotient_ptr); | 61 | extern unsigned long calibrate_tsc_hpet(unsigned long *tsc_hpet_quotient_ptr); |
diff --git a/include/asm-i386/timex.h b/include/asm-i386/timex.h index b41e484c3445..292b5a68f627 100644 --- a/include/asm-i386/timex.h +++ b/include/asm-i386/timex.h | |||
@@ -47,6 +47,9 @@ static inline cycles_t get_cycles (void) | |||
47 | return ret; | 47 | return ret; |
48 | } | 48 | } |
49 | 49 | ||
50 | extern unsigned long cpu_khz; | 50 | extern unsigned int cpu_khz; |
51 | |||
52 | extern int read_current_timer(unsigned long *timer_value); | ||
53 | #define ARCH_HAS_READ_CURRENT_TIMER 1 | ||
51 | 54 | ||
52 | #endif | 55 | #endif |
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index 98f9e6850cba..2461b731781e 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h | |||
@@ -60,12 +60,8 @@ static inline int node_to_first_cpu(int node) | |||
60 | return first_cpu(mask); | 60 | return first_cpu(mask); |
61 | } | 61 | } |
62 | 62 | ||
63 | /* Returns the number of the node containing PCI bus number 'busnr' */ | 63 | #define pcibus_to_node(bus) mp_bus_id_to_node[(bus)->number] |
64 | static inline cpumask_t __pcibus_to_cpumask(int busnr) | 64 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) |
65 | { | ||
66 | return node_to_cpumask(mp_bus_id_to_node[busnr]); | ||
67 | } | ||
68 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number) | ||
69 | 65 | ||
70 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ | 66 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ |
71 | #define SD_NODE_INIT (struct sched_domain) { \ | 67 | #define SD_NODE_INIT (struct sched_domain) { \ |
@@ -78,11 +74,14 @@ static inline cpumask_t __pcibus_to_cpumask(int busnr) | |||
78 | .imbalance_pct = 125, \ | 74 | .imbalance_pct = 125, \ |
79 | .cache_hot_time = (10*1000000), \ | 75 | .cache_hot_time = (10*1000000), \ |
80 | .cache_nice_tries = 1, \ | 76 | .cache_nice_tries = 1, \ |
77 | .busy_idx = 3, \ | ||
78 | .idle_idx = 1, \ | ||
79 | .newidle_idx = 2, \ | ||
80 | .wake_idx = 1, \ | ||
81 | .per_cpu_gain = 100, \ | 81 | .per_cpu_gain = 100, \ |
82 | .flags = SD_LOAD_BALANCE \ | 82 | .flags = SD_LOAD_BALANCE \ |
83 | | SD_BALANCE_EXEC \ | 83 | | SD_BALANCE_EXEC \ |
84 | | SD_BALANCE_NEWIDLE \ | 84 | | SD_BALANCE_FORK \ |
85 | | SD_WAKE_IDLE \ | ||
86 | | SD_WAKE_BALANCE, \ | 85 | | SD_WAKE_BALANCE, \ |
87 | .last_balance = jiffies, \ | 86 | .last_balance = jiffies, \ |
88 | .balance_interval = 1, \ | 87 | .balance_interval = 1, \ |
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 61bcc1b1e3f4..176413fb9ae3 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h | |||
@@ -256,7 +256,7 @@ | |||
256 | #define __NR_io_submit 248 | 256 | #define __NR_io_submit 248 |
257 | #define __NR_io_cancel 249 | 257 | #define __NR_io_cancel 249 |
258 | #define __NR_fadvise64 250 | 258 | #define __NR_fadvise64 250 |
259 | 259 | #define __NR_set_zone_reclaim 251 | |
260 | #define __NR_exit_group 252 | 260 | #define __NR_exit_group 252 |
261 | #define __NR_lookup_dcookie 253 | 261 | #define __NR_lookup_dcookie 253 |
262 | #define __NR_epoll_create 254 | 262 | #define __NR_epoll_create 254 |
diff --git a/include/asm-ia64/agp.h b/include/asm-ia64/agp.h index d1316f1e6ee1..4e517f0e6afa 100644 --- a/include/asm-ia64/agp.h +++ b/include/asm-ia64/agp.h | |||
@@ -18,4 +18,14 @@ | |||
18 | #define flush_agp_mappings() /* nothing */ | 18 | #define flush_agp_mappings() /* nothing */ |
19 | #define flush_agp_cache() mb() | 19 | #define flush_agp_cache() mb() |
20 | 20 | ||
21 | /* Convert a physical address to an address suitable for the GART. */ | ||
22 | #define phys_to_gart(x) (x) | ||
23 | #define gart_to_phys(x) (x) | ||
24 | |||
25 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ | ||
26 | #define alloc_gatt_pages(order) \ | ||
27 | ((char *)__get_free_pages(GFP_KERNEL, (order))) | ||
28 | #define free_gatt_pages(table, order) \ | ||
29 | free_pages((unsigned long)(table), (order)) | ||
30 | |||
21 | #endif /* _ASM_IA64_AGP_H */ | 31 | #endif /* _ASM_IA64_AGP_H */ |
diff --git a/include/asm-ia64/break.h b/include/asm-ia64/break.h index 97c7b2d79600..8167828edc4b 100644 --- a/include/asm-ia64/break.h +++ b/include/asm-ia64/break.h | |||
@@ -12,6 +12,8 @@ | |||
12 | * OS-specific debug break numbers: | 12 | * OS-specific debug break numbers: |
13 | */ | 13 | */ |
14 | #define __IA64_BREAK_KDB 0x80100 | 14 | #define __IA64_BREAK_KDB 0x80100 |
15 | #define __IA64_BREAK_KPROBE 0x80200 | ||
16 | #define __IA64_BREAK_JPROBE 0x80300 | ||
15 | 17 | ||
16 | /* | 18 | /* |
17 | * OS-specific break numbers: | 19 | * OS-specific break numbers: |
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h index cc0ff0a4bdd0..0c05e5bad8a0 100644 --- a/include/asm-ia64/compat.h +++ b/include/asm-ia64/compat.h | |||
@@ -27,6 +27,7 @@ typedef u16 compat_ipc_pid_t; | |||
27 | typedef s32 compat_daddr_t; | 27 | typedef s32 compat_daddr_t; |
28 | typedef u32 compat_caddr_t; | 28 | typedef u32 compat_caddr_t; |
29 | typedef __kernel_fsid_t compat_fsid_t; | 29 | typedef __kernel_fsid_t compat_fsid_t; |
30 | typedef s32 compat_timer_t; | ||
30 | 31 | ||
31 | typedef s32 compat_int_t; | 32 | typedef s32 compat_int_t; |
32 | typedef s32 compat_long_t; | 33 | typedef s32 compat_long_t; |
diff --git a/include/asm-ia64/fcntl.h b/include/asm-ia64/fcntl.h index d193981bb1d8..c9f8d835d0cc 100644 --- a/include/asm-ia64/fcntl.h +++ b/include/asm-ia64/fcntl.h | |||
@@ -81,4 +81,6 @@ struct flock { | |||
81 | 81 | ||
82 | #define F_LINUX_SPECIFIC_BASE 1024 | 82 | #define F_LINUX_SPECIFIC_BASE 1024 |
83 | 83 | ||
84 | #define force_o_largefile() ( ! (current->personality & PER_LINUX32) ) | ||
85 | |||
84 | #endif /* _ASM_IA64_FCNTL_H */ | 86 | #endif /* _ASM_IA64_FCNTL_H */ |
diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h new file mode 100644 index 000000000000..4d376e1663f7 --- /dev/null +++ b/include/asm-ia64/kdebug.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _IA64_KDEBUG_H | ||
2 | #define _IA64_KDEBUG_H 1 | ||
3 | /* | ||
4 | * include/asm-ia64/kdebug.h | ||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | * | ||
20 | * Copyright (C) Intel Corporation, 2005 | ||
21 | * | ||
22 | * 2005-Apr Rusty Lynch <rusty.lynch@intel.com> and Anil S Keshavamurthy | ||
23 | * <anil.s.keshavamurthy@intel.com> adopted from | ||
24 | * include/asm-x86_64/kdebug.h | ||
25 | */ | ||
26 | #include <linux/notifier.h> | ||
27 | |||
28 | struct pt_regs; | ||
29 | |||
30 | struct die_args { | ||
31 | struct pt_regs *regs; | ||
32 | const char *str; | ||
33 | long err; | ||
34 | int trapnr; | ||
35 | int signr; | ||
36 | }; | ||
37 | |||
38 | int register_die_notifier(struct notifier_block *nb); | ||
39 | extern struct notifier_block *ia64die_chain; | ||
40 | |||
41 | enum die_val { | ||
42 | DIE_BREAK = 1, | ||
43 | DIE_SS, | ||
44 | DIE_PAGE_FAULT, | ||
45 | }; | ||
46 | |||
47 | static inline int notify_die(enum die_val val, char *str, struct pt_regs *regs, | ||
48 | long err, int trap, int sig) | ||
49 | { | ||
50 | struct die_args args = { | ||
51 | .regs = regs, | ||
52 | .str = str, | ||
53 | .err = err, | ||
54 | .trapnr = trap, | ||
55 | .signr = sig | ||
56 | }; | ||
57 | |||
58 | return notifier_call_chain(&ia64die_chain, val, &args); | ||
59 | } | ||
60 | |||
61 | #endif | ||
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h new file mode 100644 index 000000000000..7b700035e36d --- /dev/null +++ b/include/asm-ia64/kprobes.h | |||
@@ -0,0 +1,116 @@ | |||
1 | #ifndef _ASM_KPROBES_H | ||
2 | #define _ASM_KPROBES_H | ||
3 | /* | ||
4 | * Kernel Probes (KProbes) | ||
5 | * include/asm-ia64/kprobes.h | ||
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 as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | * | ||
21 | * Copyright (C) IBM Corporation, 2002, 2004 | ||
22 | * Copyright (C) Intel Corporation, 2005 | ||
23 | * | ||
24 | * 2005-Apr Rusty Lynch <rusty.lynch@intel.com> and Anil S Keshavamurthy | ||
25 | * <anil.s.keshavamurthy@intel.com> adapted from i386 | ||
26 | */ | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/ptrace.h> | ||
29 | #include <asm/break.h> | ||
30 | |||
31 | #define BREAK_INST (long)(__IA64_BREAK_KPROBE << 6) | ||
32 | |||
33 | typedef union cmp_inst { | ||
34 | struct { | ||
35 | unsigned long long qp : 6; | ||
36 | unsigned long long p1 : 6; | ||
37 | unsigned long long c : 1; | ||
38 | unsigned long long r2 : 7; | ||
39 | unsigned long long r3 : 7; | ||
40 | unsigned long long p2 : 6; | ||
41 | unsigned long long ta : 1; | ||
42 | unsigned long long x2 : 2; | ||
43 | unsigned long long tb : 1; | ||
44 | unsigned long long opcode : 4; | ||
45 | unsigned long long reserved : 23; | ||
46 | }f; | ||
47 | unsigned long long l; | ||
48 | } cmp_inst_t; | ||
49 | |||
50 | struct kprobe; | ||
51 | |||
52 | typedef struct _bundle { | ||
53 | struct { | ||
54 | unsigned long long template : 5; | ||
55 | unsigned long long slot0 : 41; | ||
56 | unsigned long long slot1_p0 : 64-46; | ||
57 | } quad0; | ||
58 | struct { | ||
59 | unsigned long long slot1_p1 : 41 - (64-46); | ||
60 | unsigned long long slot2 : 41; | ||
61 | } quad1; | ||
62 | } __attribute__((__aligned__(16))) bundle_t; | ||
63 | |||
64 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | ||
65 | |||
66 | #define SLOT0_OPCODE_SHIFT (37) | ||
67 | #define SLOT1_p1_OPCODE_SHIFT (37 - (64-46)) | ||
68 | #define SLOT2_OPCODE_SHIFT (37) | ||
69 | |||
70 | #define INDIRECT_CALL_OPCODE (1) | ||
71 | #define IP_RELATIVE_CALL_OPCODE (5) | ||
72 | #define IP_RELATIVE_BRANCH_OPCODE (4) | ||
73 | #define IP_RELATIVE_PREDICT_OPCODE (7) | ||
74 | #define LONG_BRANCH_OPCODE (0xC) | ||
75 | #define LONG_CALL_OPCODE (0xD) | ||
76 | |||
77 | typedef struct kprobe_opcode { | ||
78 | bundle_t bundle; | ||
79 | } kprobe_opcode_t; | ||
80 | |||
81 | struct fnptr { | ||
82 | unsigned long ip; | ||
83 | unsigned long gp; | ||
84 | }; | ||
85 | |||
86 | /* Architecture specific copy of original instruction*/ | ||
87 | struct arch_specific_insn { | ||
88 | /* copy of the instruction to be emulated */ | ||
89 | kprobe_opcode_t insn; | ||
90 | #define INST_FLAG_FIX_RELATIVE_IP_ADDR 1 | ||
91 | #define INST_FLAG_FIX_BRANCH_REG 2 | ||
92 | unsigned long inst_flag; | ||
93 | unsigned short target_br_reg; | ||
94 | }; | ||
95 | |||
96 | /* ia64 does not need this */ | ||
97 | static inline void jprobe_return(void) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | /* ia64 does not need this */ | ||
102 | static inline void arch_copy_kprobe(struct kprobe *p) | ||
103 | { | ||
104 | } | ||
105 | |||
106 | #ifdef CONFIG_KPROBES | ||
107 | extern int kprobe_exceptions_notify(struct notifier_block *self, | ||
108 | unsigned long val, void *data); | ||
109 | #else /* !CONFIG_KPROBES */ | ||
110 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
111 | unsigned long val, void *data) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | #endif | ||
116 | #endif /* _ASM_KPROBES_H */ | ||
diff --git a/include/asm-ia64/mmzone.h b/include/asm-ia64/mmzone.h index 9491dacc89cf..d32f51e3d6c2 100644 --- a/include/asm-ia64/mmzone.h +++ b/include/asm-ia64/mmzone.h | |||
@@ -17,6 +17,20 @@ | |||
17 | 17 | ||
18 | #ifdef CONFIG_DISCONTIGMEM | 18 | #ifdef CONFIG_DISCONTIGMEM |
19 | 19 | ||
20 | static inline int pfn_to_nid(unsigned long pfn) | ||
21 | { | ||
22 | #ifdef CONFIG_NUMA | ||
23 | extern int paddr_to_nid(unsigned long); | ||
24 | int nid = paddr_to_nid(pfn << PAGE_SHIFT); | ||
25 | if (nid < 0) | ||
26 | return 0; | ||
27 | else | ||
28 | return nid; | ||
29 | #else | ||
30 | return 0; | ||
31 | #endif | ||
32 | } | ||
33 | |||
20 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ | 34 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ |
21 | # define MAX_PHYSNODE_ID 8 | 35 | # define MAX_PHYSNODE_ID 8 |
22 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) | 36 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) |
diff --git a/include/asm-ia64/param.h b/include/asm-ia64/param.h index 6c6b679b7a9e..5e1e0d2d7baf 100644 --- a/include/asm-ia64/param.h +++ b/include/asm-ia64/param.h | |||
@@ -27,7 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | # define HZ 32 | 28 | # define HZ 32 |
29 | # else | 29 | # else |
30 | # define HZ 1024 | 30 | # define HZ CONFIG_HZ |
31 | # endif | 31 | # endif |
32 | # define USER_HZ HZ | 32 | # define USER_HZ HZ |
33 | # define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ | 33 | # define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ |
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h index 1e87f19dad56..2b14dee29ce7 100644 --- a/include/asm-ia64/percpu.h +++ b/include/asm-ia64/percpu.h | |||
@@ -50,7 +50,7 @@ extern void *per_cpu_init(void); | |||
50 | 50 | ||
51 | #else /* ! SMP */ | 51 | #else /* ! SMP */ |
52 | 52 | ||
53 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) | 53 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) |
54 | #define __get_cpu_var(var) per_cpu__##var | 54 | #define __get_cpu_var(var) per_cpu__##var |
55 | #define per_cpu_init() (__phys_per_cpu_start) | 55 | #define per_cpu_init() (__phys_per_cpu_start) |
56 | 56 | ||
diff --git a/include/asm-ia64/perfmon.h b/include/asm-ia64/perfmon.h index ed5416c5b1ac..7f3333dd00e4 100644 --- a/include/asm-ia64/perfmon.h +++ b/include/asm-ia64/perfmon.h | |||
@@ -177,6 +177,10 @@ typedef union { | |||
177 | 177 | ||
178 | extern long perfmonctl(int fd, int cmd, void *arg, int narg); | 178 | extern long perfmonctl(int fd, int cmd, void *arg, int narg); |
179 | 179 | ||
180 | typedef struct { | ||
181 | void (*handler)(int irq, void *arg, struct pt_regs *regs); | ||
182 | } pfm_intr_handler_desc_t; | ||
183 | |||
180 | extern void pfm_save_regs (struct task_struct *); | 184 | extern void pfm_save_regs (struct task_struct *); |
181 | extern void pfm_load_regs (struct task_struct *); | 185 | extern void pfm_load_regs (struct task_struct *); |
182 | 186 | ||
@@ -187,6 +191,10 @@ extern void pfm_syst_wide_update_task(struct task_struct *, unsigned long info, | |||
187 | extern void pfm_inherit(struct task_struct *task, struct pt_regs *regs); | 191 | extern void pfm_inherit(struct task_struct *task, struct pt_regs *regs); |
188 | extern void pfm_init_percpu(void); | 192 | extern void pfm_init_percpu(void); |
189 | extern void pfm_handle_work(void); | 193 | extern void pfm_handle_work(void); |
194 | extern int pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *h); | ||
195 | extern int pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *h); | ||
196 | |||
197 | |||
190 | 198 | ||
191 | /* | 199 | /* |
192 | * Reset PMD register flags | 200 | * Reset PMD register flags |
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index ea121a002309..48586e08f432 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h | |||
@@ -8,7 +8,7 @@ | |||
8 | * This hopefully works with any (fixed) IA-64 page-size, as defined | 8 | * This hopefully works with any (fixed) IA-64 page-size, as defined |
9 | * in <asm/page.h>. | 9 | * in <asm/page.h>. |
10 | * | 10 | * |
11 | * Copyright (C) 1998-2004 Hewlett-Packard Co | 11 | * Copyright (C) 1998-2005 Hewlett-Packard Co |
12 | * David Mosberger-Tang <davidm@hpl.hp.com> | 12 | * David Mosberger-Tang <davidm@hpl.hp.com> |
13 | */ | 13 | */ |
14 | 14 | ||
@@ -283,6 +283,7 @@ ia64_phys_addr_valid (unsigned long addr) | |||
283 | #define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A)) | 283 | #define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A)) |
284 | #define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) | 284 | #define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) |
285 | #define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D)) | 285 | #define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D)) |
286 | #define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_P)) | ||
286 | 287 | ||
287 | /* | 288 | /* |
288 | * Macro to a page protection value as "uncacheable". Note that "protection" is really a | 289 | * Macro to a page protection value as "uncacheable". Note that "protection" is really a |
@@ -551,7 +552,11 @@ do { \ | |||
551 | 552 | ||
552 | /* These tell get_user_pages() that the first gate page is accessible from user-level. */ | 553 | /* These tell get_user_pages() that the first gate page is accessible from user-level. */ |
553 | #define FIXADDR_USER_START GATE_ADDR | 554 | #define FIXADDR_USER_START GATE_ADDR |
554 | #define FIXADDR_USER_END (GATE_ADDR + 2*PERCPU_PAGE_SIZE) | 555 | #ifdef HAVE_BUGGY_SEGREL |
556 | # define FIXADDR_USER_END (GATE_ADDR + 2*PAGE_SIZE) | ||
557 | #else | ||
558 | # define FIXADDR_USER_END (GATE_ADDR + 2*PERCPU_PAGE_SIZE) | ||
559 | #endif | ||
555 | 560 | ||
556 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | 561 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG |
557 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | 562 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY |
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 9e1ba8b7fb68..91bbd1f22461 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h | |||
@@ -403,7 +403,10 @@ extern void ia64_setreg_unknown_kr (void); | |||
403 | * task_struct at this point. | 403 | * task_struct at this point. |
404 | */ | 404 | */ |
405 | 405 | ||
406 | /* Return TRUE if task T owns the fph partition of the CPU we're running on. */ | 406 | /* |
407 | * Return TRUE if task T owns the fph partition of the CPU we're running on. | ||
408 | * Must be called from code that has preemption disabled. | ||
409 | */ | ||
407 | #define ia64_is_local_fpu_owner(t) \ | 410 | #define ia64_is_local_fpu_owner(t) \ |
408 | ({ \ | 411 | ({ \ |
409 | struct task_struct *__ia64_islfo_task = (t); \ | 412 | struct task_struct *__ia64_islfo_task = (t); \ |
@@ -411,7 +414,10 @@ extern void ia64_setreg_unknown_kr (void); | |||
411 | && __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER)); \ | 414 | && __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER)); \ |
412 | }) | 415 | }) |
413 | 416 | ||
414 | /* Mark task T as owning the fph partition of the CPU we're running on. */ | 417 | /* |
418 | * Mark task T as owning the fph partition of the CPU we're running on. | ||
419 | * Must be called from code that has preemption disabled. | ||
420 | */ | ||
415 | #define ia64_set_local_fpu_owner(t) do { \ | 421 | #define ia64_set_local_fpu_owner(t) do { \ |
416 | struct task_struct *__ia64_slfo_task = (t); \ | 422 | struct task_struct *__ia64_slfo_task = (t); \ |
417 | __ia64_slfo_task->thread.last_fph_cpu = smp_processor_id(); \ | 423 | __ia64_slfo_task->thread.last_fph_cpu = smp_processor_id(); \ |
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h index 3ba1a061e4ae..a3914352c995 100644 --- a/include/asm-ia64/smp.h +++ b/include/asm-ia64/smp.h | |||
@@ -46,7 +46,7 @@ ia64_get_lid (void) | |||
46 | #define SMP_IRQ_REDIRECTION (1 << 0) | 46 | #define SMP_IRQ_REDIRECTION (1 << 0) |
47 | #define SMP_IPI_REDIRECTION (1 << 1) | 47 | #define SMP_IPI_REDIRECTION (1 << 1) |
48 | 48 | ||
49 | #define smp_processor_id() (current_thread_info()->cpu) | 49 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
50 | 50 | ||
51 | extern struct smp_boot_data { | 51 | extern struct smp_boot_data { |
52 | int cpu_count; | 52 | int cpu_count; |
diff --git a/include/asm-ia64/sn/mspec.h b/include/asm-ia64/sn/mspec.h new file mode 100644 index 000000000000..dbe13c6121a8 --- /dev/null +++ b/include/asm-ia64/sn/mspec.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * | ||
3 | * This file is subject to the terms and conditions of the GNU General Public | ||
4 | * License. See the file "COPYING" in the main directory of this archive | ||
5 | * for more details. | ||
6 | * | ||
7 | * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_IA64_SN_MSPEC_H | ||
11 | #define _ASM_IA64_SN_MSPEC_H | ||
12 | |||
13 | #define FETCHOP_VAR_SIZE 64 /* 64 byte per fetchop variable */ | ||
14 | |||
15 | #define FETCHOP_LOAD 0 | ||
16 | #define FETCHOP_INCREMENT 8 | ||
17 | #define FETCHOP_DECREMENT 16 | ||
18 | #define FETCHOP_CLEAR 24 | ||
19 | |||
20 | #define FETCHOP_STORE 0 | ||
21 | #define FETCHOP_AND 24 | ||
22 | #define FETCHOP_OR 32 | ||
23 | |||
24 | #define FETCHOP_CLEAR_CACHE 56 | ||
25 | |||
26 | #define FETCHOP_LOAD_OP(addr, op) ( \ | ||
27 | *(volatile long *)((char*) (addr) + (op))) | ||
28 | |||
29 | #define FETCHOP_STORE_OP(addr, op, x) ( \ | ||
30 | *(volatile long *)((char*) (addr) + (op)) = (long) (x)) | ||
31 | |||
32 | #ifdef __KERNEL__ | ||
33 | |||
34 | /* | ||
35 | * Each Atomic Memory Operation (AMO formerly known as fetchop) | ||
36 | * variable is 64 bytes long. The first 8 bytes are used. The | ||
37 | * remaining 56 bytes are unaddressable due to the operation taking | ||
38 | * that portion of the address. | ||
39 | * | ||
40 | * NOTE: The AMO_t _MUST_ be placed in either the first or second half | ||
41 | * of the cache line. The cache line _MUST NOT_ be used for anything | ||
42 | * other than additional AMO_t entries. This is because there are two | ||
43 | * addresses which reference the same physical cache line. One will | ||
44 | * be a cached entry with the memory type bits all set. This address | ||
45 | * may be loaded into processor cache. The AMO_t will be referenced | ||
46 | * uncached via the memory special memory type. If any portion of the | ||
47 | * cached cache-line is modified, when that line is flushed, it will | ||
48 | * overwrite the uncached value in physical memory and lead to | ||
49 | * inconsistency. | ||
50 | */ | ||
51 | typedef struct { | ||
52 | u64 variable; | ||
53 | u64 unused[7]; | ||
54 | } AMO_t; | ||
55 | |||
56 | |||
57 | #endif /* __KERNEL__ */ | ||
58 | |||
59 | #endif /* _ASM_IA64_SN_MSPEC_H */ | ||
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h index 56d74ca76b5d..eb0395ad0d6a 100644 --- a/include/asm-ia64/sn/sn_sal.h +++ b/include/asm-ia64/sn/sn_sal.h | |||
@@ -115,6 +115,13 @@ | |||
115 | #define SAL_IROUTER_INTR_XMIT SAL_CONSOLE_INTR_XMIT | 115 | #define SAL_IROUTER_INTR_XMIT SAL_CONSOLE_INTR_XMIT |
116 | #define SAL_IROUTER_INTR_RECV SAL_CONSOLE_INTR_RECV | 116 | #define SAL_IROUTER_INTR_RECV SAL_CONSOLE_INTR_RECV |
117 | 117 | ||
118 | /* | ||
119 | * Error Handling Features | ||
120 | */ | ||
121 | #define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV 0x1 | ||
122 | #define SAL_ERR_FEAT_LOG_SBES 0x2 | ||
123 | #define SAL_ERR_FEAT_MFR_OVERRIDE 0x4 | ||
124 | #define SAL_ERR_FEAT_SBE_THRESHOLD 0xffff0000 | ||
118 | 125 | ||
119 | /* | 126 | /* |
120 | * SAL Error Codes | 127 | * SAL Error Codes |
@@ -342,6 +349,25 @@ ia64_sn_plat_cpei_handler(void) | |||
342 | } | 349 | } |
343 | 350 | ||
344 | /* | 351 | /* |
352 | * Set Error Handling Features | ||
353 | */ | ||
354 | static inline u64 | ||
355 | ia64_sn_plat_set_error_handling_features(void) | ||
356 | { | ||
357 | struct ia64_sal_retval ret_stuff; | ||
358 | |||
359 | ret_stuff.status = 0; | ||
360 | ret_stuff.v0 = 0; | ||
361 | ret_stuff.v1 = 0; | ||
362 | ret_stuff.v2 = 0; | ||
363 | SAL_CALL_REENTRANT(ret_stuff, SN_SAL_SET_ERROR_HANDLING_FEATURES, | ||
364 | (SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV | SAL_ERR_FEAT_LOG_SBES), | ||
365 | 0, 0, 0, 0, 0, 0); | ||
366 | |||
367 | return ret_stuff.status; | ||
368 | } | ||
369 | |||
370 | /* | ||
345 | * Checks for console input. | 371 | * Checks for console input. |
346 | */ | 372 | */ |
347 | static inline u64 | 373 | static inline u64 |
@@ -472,7 +498,7 @@ static inline u64 | |||
472 | ia64_sn_pod_mode(void) | 498 | ia64_sn_pod_mode(void) |
473 | { | 499 | { |
474 | struct ia64_sal_retval isrv; | 500 | struct ia64_sal_retval isrv; |
475 | SAL_CALL(isrv, SN_SAL_POD_MODE, 0, 0, 0, 0, 0, 0, 0); | 501 | SAL_CALL_REENTRANT(isrv, SN_SAL_POD_MODE, 0, 0, 0, 0, 0, 0, 0); |
476 | if (isrv.status) | 502 | if (isrv.status) |
477 | return 0; | 503 | return 0; |
478 | return isrv.v0; | 504 | return isrv.v0; |
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 6f516e76d1f0..cd2cf76b2db1 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h | |||
@@ -183,8 +183,6 @@ do { \ | |||
183 | 183 | ||
184 | #ifdef __KERNEL__ | 184 | #ifdef __KERNEL__ |
185 | 185 | ||
186 | #define prepare_to_switch() do { } while(0) | ||
187 | |||
188 | #ifdef CONFIG_IA32_SUPPORT | 186 | #ifdef CONFIG_IA32_SUPPORT |
189 | # define IS_IA32_PROCESS(regs) (ia64_psr(regs)->is != 0) | 187 | # define IS_IA32_PROCESS(regs) (ia64_psr(regs)->is != 0) |
190 | #else | 188 | #else |
@@ -274,13 +272,7 @@ extern void ia64_load_extra (struct task_struct *task); | |||
274 | * of that CPU which will not be released, because there we wait for the | 272 | * of that CPU which will not be released, because there we wait for the |
275 | * tasklist_lock to become available. | 273 | * tasklist_lock to become available. |
276 | */ | 274 | */ |
277 | #define prepare_arch_switch(rq, next) \ | 275 | #define __ARCH_WANT_UNLOCKED_CTXSW |
278 | do { \ | ||
279 | spin_lock(&(next)->switch_lock); \ | ||
280 | spin_unlock(&(rq)->lock); \ | ||
281 | } while (0) | ||
282 | #define finish_arch_switch(rq, prev) spin_unlock_irq(&(prev)->switch_lock) | ||
283 | #define task_running(rq, p) ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock)) | ||
284 | 276 | ||
285 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) | 277 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) |
286 | 278 | ||
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 8d5b7e77028c..7dc8951708a3 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h | |||
@@ -25,7 +25,7 @@ struct thread_info { | |||
25 | __u32 flags; /* thread_info flags (see TIF_*) */ | 25 | __u32 flags; /* thread_info flags (see TIF_*) */ |
26 | __u32 cpu; /* current CPU */ | 26 | __u32 cpu; /* current CPU */ |
27 | mm_segment_t addr_limit; /* user-level address space limit */ | 27 | mm_segment_t addr_limit; /* user-level address space limit */ |
28 | __s32 preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ | 28 | int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ |
29 | struct restart_block restart_block; | 29 | struct restart_block restart_block; |
30 | struct { | 30 | struct { |
31 | int signo; | 31 | int signo; |
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h index 21cf351fd05c..4e64c2a6b369 100644 --- a/include/asm-ia64/topology.h +++ b/include/asm-ia64/topology.h | |||
@@ -42,25 +42,54 @@ | |||
42 | 42 | ||
43 | void build_cpu_to_node_map(void); | 43 | void build_cpu_to_node_map(void); |
44 | 44 | ||
45 | #define SD_CPU_INIT (struct sched_domain) { \ | ||
46 | .span = CPU_MASK_NONE, \ | ||
47 | .parent = NULL, \ | ||
48 | .groups = NULL, \ | ||
49 | .min_interval = 1, \ | ||
50 | .max_interval = 4, \ | ||
51 | .busy_factor = 64, \ | ||
52 | .imbalance_pct = 125, \ | ||
53 | .cache_hot_time = (10*1000000), \ | ||
54 | .per_cpu_gain = 100, \ | ||
55 | .cache_nice_tries = 2, \ | ||
56 | .busy_idx = 2, \ | ||
57 | .idle_idx = 1, \ | ||
58 | .newidle_idx = 2, \ | ||
59 | .wake_idx = 1, \ | ||
60 | .forkexec_idx = 1, \ | ||
61 | .flags = SD_LOAD_BALANCE \ | ||
62 | | SD_BALANCE_NEWIDLE \ | ||
63 | | SD_BALANCE_EXEC \ | ||
64 | | SD_WAKE_AFFINE, \ | ||
65 | .last_balance = jiffies, \ | ||
66 | .balance_interval = 1, \ | ||
67 | .nr_balance_failed = 0, \ | ||
68 | } | ||
69 | |||
45 | /* sched_domains SD_NODE_INIT for IA64 NUMA machines */ | 70 | /* sched_domains SD_NODE_INIT for IA64 NUMA machines */ |
46 | #define SD_NODE_INIT (struct sched_domain) { \ | 71 | #define SD_NODE_INIT (struct sched_domain) { \ |
47 | .span = CPU_MASK_NONE, \ | 72 | .span = CPU_MASK_NONE, \ |
48 | .parent = NULL, \ | 73 | .parent = NULL, \ |
49 | .groups = NULL, \ | 74 | .groups = NULL, \ |
50 | .min_interval = 80, \ | 75 | .min_interval = 8, \ |
51 | .max_interval = 320, \ | 76 | .max_interval = 8*(min(num_online_cpus(), 32)), \ |
52 | .busy_factor = 320, \ | 77 | .busy_factor = 64, \ |
53 | .imbalance_pct = 125, \ | 78 | .imbalance_pct = 125, \ |
54 | .cache_hot_time = (10*1000000), \ | 79 | .cache_hot_time = (10*1000000), \ |
55 | .cache_nice_tries = 1, \ | 80 | .cache_nice_tries = 2, \ |
81 | .busy_idx = 3, \ | ||
82 | .idle_idx = 2, \ | ||
83 | .newidle_idx = 0, /* unused */ \ | ||
84 | .wake_idx = 1, \ | ||
85 | .forkexec_idx = 1, \ | ||
56 | .per_cpu_gain = 100, \ | 86 | .per_cpu_gain = 100, \ |
57 | .flags = SD_LOAD_BALANCE \ | 87 | .flags = SD_LOAD_BALANCE \ |
58 | | SD_BALANCE_EXEC \ | 88 | | SD_BALANCE_EXEC \ |
59 | | SD_BALANCE_NEWIDLE \ | 89 | | SD_BALANCE_FORK \ |
60 | | SD_WAKE_IDLE \ | ||
61 | | SD_WAKE_BALANCE, \ | 90 | | SD_WAKE_BALANCE, \ |
62 | .last_balance = jiffies, \ | 91 | .last_balance = jiffies, \ |
63 | .balance_interval = 1, \ | 92 | .balance_interval = 64, \ |
64 | .nr_balance_failed = 0, \ | 93 | .nr_balance_failed = 0, \ |
65 | } | 94 | } |
66 | 95 | ||
@@ -69,17 +98,21 @@ void build_cpu_to_node_map(void); | |||
69 | .span = CPU_MASK_NONE, \ | 98 | .span = CPU_MASK_NONE, \ |
70 | .parent = NULL, \ | 99 | .parent = NULL, \ |
71 | .groups = NULL, \ | 100 | .groups = NULL, \ |
72 | .min_interval = 80, \ | 101 | .min_interval = 64, \ |
73 | .max_interval = 320, \ | 102 | .max_interval = 64*num_online_cpus(), \ |
74 | .busy_factor = 320, \ | 103 | .busy_factor = 128, \ |
75 | .imbalance_pct = 125, \ | 104 | .imbalance_pct = 133, \ |
76 | .cache_hot_time = (10*1000000), \ | 105 | .cache_hot_time = (10*1000000), \ |
77 | .cache_nice_tries = 1, \ | 106 | .cache_nice_tries = 1, \ |
107 | .busy_idx = 3, \ | ||
108 | .idle_idx = 3, \ | ||
109 | .newidle_idx = 0, /* unused */ \ | ||
110 | .wake_idx = 0, /* unused */ \ | ||
111 | .forkexec_idx = 0, /* unused */ \ | ||
78 | .per_cpu_gain = 100, \ | 112 | .per_cpu_gain = 100, \ |
79 | .flags = SD_LOAD_BALANCE \ | 113 | .flags = SD_LOAD_BALANCE, \ |
80 | | SD_BALANCE_EXEC, \ | ||
81 | .last_balance = jiffies, \ | 114 | .last_balance = jiffies, \ |
82 | .balance_interval = 100*(63+num_online_cpus())/64, \ | 115 | .balance_interval = 64, \ |
83 | .nr_balance_failed = 0, \ | 116 | .nr_balance_failed = 0, \ |
84 | } | 117 | } |
85 | 118 | ||
diff --git a/include/asm-ia64/uncached.h b/include/asm-ia64/uncached.h new file mode 100644 index 000000000000..b82d923b73c1 --- /dev/null +++ b/include/asm-ia64/uncached.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001-2005 Silicon Graphics, Inc. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of version 2 of the GNU General Public License | ||
6 | * as published by the Free Software Foundation. | ||
7 | * | ||
8 | * Prototypes for the uncached page allocator | ||
9 | */ | ||
10 | |||
11 | extern unsigned long uncached_alloc_page(int nid); | ||
12 | extern void uncached_free_page(unsigned long); | ||
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index 33e26c557c5c..f7f43ec2483a 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h | |||
@@ -263,6 +263,7 @@ | |||
263 | #define __NR_add_key 1271 | 263 | #define __NR_add_key 1271 |
264 | #define __NR_request_key 1272 | 264 | #define __NR_request_key 1272 |
265 | #define __NR_keyctl 1273 | 265 | #define __NR_keyctl 1273 |
266 | #define __NR_set_zone_reclaim 1276 | ||
266 | 267 | ||
267 | #ifdef __KERNEL__ | 268 | #ifdef __KERNEL__ |
268 | 269 | ||
diff --git a/include/asm-m32r/div64.h b/include/asm-m32r/div64.h index 417a51bd552d..6cd978cefb28 100644 --- a/include/asm-m32r/div64.h +++ b/include/asm-m32r/div64.h | |||
@@ -1,38 +1 @@ | |||
1 | #ifndef _ASM_M32R_DIV64 | #include <asm-generic/div64.h> | |
2 | #define _ASM_M32R_DIV64 | ||
3 | |||
4 | /* $Id$ */ | ||
5 | |||
6 | /* unsigned long long division. | ||
7 | * Input: | ||
8 | * unsigned long long n | ||
9 | * unsigned long base | ||
10 | * Output: | ||
11 | * n = n / base; | ||
12 | * return value = n % base; | ||
13 | */ | ||
14 | #define do_div(n, base) \ | ||
15 | ({ \ | ||
16 | unsigned long _res, _high, _mid, _low; \ | ||
17 | \ | ||
18 | _low = (n) & 0xffffffffUL; \ | ||
19 | _high = (n) >> 32; \ | ||
20 | if (_high) { \ | ||
21 | _mid = (_high % (unsigned long)(base)) << 16; \ | ||
22 | _high = _high / (unsigned long)(base); \ | ||
23 | _mid += _low >> 16; \ | ||
24 | _low &= 0x0000ffffUL; \ | ||
25 | _low += (_mid % (unsigned long)(base)) << 16; \ | ||
26 | _mid = _mid / (unsigned long)(base); \ | ||
27 | _res = _low % (unsigned long)(base); \ | ||
28 | _low = _low / (unsigned long)(base); \ | ||
29 | n = _low + ((long long)_mid << 16) + \ | ||
30 | ((long long)_high << 32); \ | ||
31 | } else { \ | ||
32 | _res = _low % (unsigned long)(base); \ | ||
33 | n = (_low / (unsigned long)(base)); \ | ||
34 | } \ | ||
35 | _res; \ | ||
36 | }) | ||
37 | |||
38 | #endif /* _ASM_M32R_DIV64 */ | ||
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h index be64f24e37ee..194393bd8beb 100644 --- a/include/asm-m32r/ide.h +++ b/include/asm-m32r/ide.h | |||
@@ -35,7 +35,7 @@ | |||
35 | static __inline__ int ide_default_irq(unsigned long base) | 35 | static __inline__ int ide_default_irq(unsigned long base) |
36 | { | 36 | { |
37 | switch (base) { | 37 | switch (base) { |
38 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) | 38 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3) |
39 | case 0x1f0: return PLD_IRQ_CFIREQ; | 39 | case 0x1f0: return PLD_IRQ_CFIREQ; |
40 | default: | 40 | default: |
41 | return 0; | 41 | return 0; |
diff --git a/include/asm-m32r/m32102.h b/include/asm-m32r/m32102.h index b56034026bf8..cb98101f4f6e 100644 --- a/include/asm-m32r/m32102.h +++ b/include/asm-m32r/m32102.h | |||
@@ -175,6 +175,7 @@ | |||
175 | #define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ | 175 | #define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ |
176 | #define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ | 176 | #define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ |
177 | #define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ | 177 | #define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ |
178 | #define M32R_ICU_CR8_PORTL (0x219+M32R_ICU_OFFSET) /* INT7 */ | ||
178 | #define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */ | 179 | #define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */ |
179 | #define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */ | 180 | #define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */ |
180 | #define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */ | 181 | #define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */ |
diff --git a/include/asm-m32r/m32102peri.h b/include/asm-m32r/m32102peri.h deleted file mode 100644 index 3c12955ad0f0..000000000000 --- a/include/asm-m32r/m32102peri.h +++ /dev/null | |||
@@ -1,468 +0,0 @@ | |||
1 | /* $Id$ | ||
2 | * | ||
3 | * This file is subject to the terms and conditions of the GNU General Public | ||
4 | * License. See the file "COPYING" in the main directory of this archive | ||
5 | * for more details. | ||
6 | * | ||
7 | * Copyright (C) 2000,2001 by Hiroyuki Kondo | ||
8 | */ | ||
9 | |||
10 | #ifndef __ASSEMBLY__ | ||
11 | |||
12 | typedef void V; | ||
13 | typedef char B; | ||
14 | typedef short S; | ||
15 | typedef int W; | ||
16 | typedef long L; | ||
17 | typedef float F; | ||
18 | typedef double D; | ||
19 | typedef unsigned char UB; | ||
20 | typedef unsigned short US; | ||
21 | typedef unsigned int UW; | ||
22 | typedef unsigned long UL; | ||
23 | typedef const unsigned int CUW; | ||
24 | |||
25 | /********************************* | ||
26 | |||
27 | M32102 ICU | ||
28 | |||
29 | *********************************/ | ||
30 | #define ICUISTS (UW *)0xa0EFF004 | ||
31 | #define ICUIREQ0 (UW *)0xa0EFF008 | ||
32 | #define ICUIREQ1 (UW *)0xa0EFF00C | ||
33 | |||
34 | #define ICUSBICR (UW *)0xa0EFF018 | ||
35 | #define ICUIMASK (UW *)0xa0EFF01C | ||
36 | |||
37 | #define ICUCR1 (UW *)0xa0EFF200 /* INT0 */ | ||
38 | #define ICUCR2 (UW *)0xa0EFF204 /* INT1 */ | ||
39 | #define ICUCR3 (UW *)0xa0EFF208 /* INT2 */ | ||
40 | #define ICUCR4 (UW *)0xa0EFF20C /* INT3 */ | ||
41 | #define ICUCR5 (UW *)0xa0EFF210 /* INT4 */ | ||
42 | #define ICUCR6 (UW *)0xa0EFF214 /* INT5 */ | ||
43 | #define ICUCR7 (UW *)0xa0EFF218 /* INT6 */ | ||
44 | |||
45 | #define ICUCR16 (UW *)0xa0EFF23C /* MFT0 */ | ||
46 | #define ICUCR17 (UW *)0xa0EFF240 /* MFT1 */ | ||
47 | #define ICUCR18 (UW *)0xa0EFF244 /* MFT2 */ | ||
48 | #define ICUCR19 (UW *)0xa0EFF248 /* MFT3 */ | ||
49 | #define ICUCR20 (UW *)0xa0EFF24C /* MFT4 */ | ||
50 | #define ICUCR21 (UW *)0xa0EFF250 /* MFT5 */ | ||
51 | |||
52 | #define ICUCR32 (UW *)0xa0EFF27C /* DMA0 */ | ||
53 | #define ICUCR33 (UW *)0xa0EFF280 /* DMA1 */ | ||
54 | |||
55 | #define ICUCR48 (UW *)0xa0EFF2BC /* SIO0R */ | ||
56 | #define ICUCR49 (UW *)0xa0EFF2C0 /* SIO0S */ | ||
57 | #define ICUCR50 (UW *)0xa0EFF2C4 /* SIO1R */ | ||
58 | #define ICUCR51 (UW *)0xa0EFF2C8 /* SIO1S */ | ||
59 | #define ICUCR52 (UW *)0xa0EFF2CC /* SIO2R */ | ||
60 | #define ICUCR53 (UW *)0xa0EFF2D0 /* SIO2S */ | ||
61 | #define ICUCR54 (UW *)0xa0EFF2D4 /* SIO3R */ | ||
62 | #define ICUCR55 (UW *)0xa0EFF2D8 /* SIO3S */ | ||
63 | #define ICUCR56 (UW *)0xa0EFF2DC /* SIO4R */ | ||
64 | #define ICUCR57 (UW *)0xa0EFF2E0 /* SIO4S */ | ||
65 | |||
66 | /********************************* | ||
67 | |||
68 | M32102 MFT | ||
69 | |||
70 | *********************************/ | ||
71 | #define MFTCR (US *)0xa0EFC002 | ||
72 | #define MFTRPR (UB *)0xa0EFC006 | ||
73 | |||
74 | #define MFT0MOD (US *)0xa0EFC102 | ||
75 | #define MFT0BOS (US *)0xa0EFC106 | ||
76 | #define MFT0CUT (US *)0xa0EFC10A | ||
77 | #define MFT0RLD (US *)0xa0EFC10E | ||
78 | #define MFT0CRLD (US *)0xa0EFC112 | ||
79 | |||
80 | #define MFT1MOD (US *)0xa0EFC202 | ||
81 | #define MFT1BOS (US *)0xa0EFC206 | ||
82 | #define MFT1CUT (US *)0xa0EFC20A | ||
83 | #define MFT1RLD (US *)0xa0EFC20E | ||
84 | #define MFT1CRLD (US *)0xa0EFC212 | ||
85 | |||
86 | #define MFT2MOD (US *)0xa0EFC302 | ||
87 | #define MFT2BOS (US *)0xa0EFC306 | ||
88 | #define MFT2CUT (US *)0xa0EFC30A | ||
89 | #define MFT2RLD (US *)0xa0EFC30E | ||
90 | #define MFT2CRLD (US *)0xa0EFC312 | ||
91 | |||
92 | #define MFT3MOD (US *)0xa0EFC402 | ||
93 | #define MFT3CUT (US *)0xa0EFC40A | ||
94 | #define MFT3RLD (US *)0xa0EFC40E | ||
95 | #define MFT3CRLD (US *)0xa0EFC412 | ||
96 | |||
97 | #define MFT4MOD (US *)0xa0EFC502 | ||
98 | #define MFT4CUT (US *)0xa0EFC50A | ||
99 | #define MFT4RLD (US *)0xa0EFC50E | ||
100 | #define MFT4CRLD (US *)0xa0EFC512 | ||
101 | |||
102 | #define MFT5MOD (US *)0xa0EFC602 | ||
103 | #define MFT5CUT (US *)0xa0EFC60A | ||
104 | #define MFT5RLD (US *)0xa0EFC60E | ||
105 | #define MFT5CRLD (US *)0xa0EFC612 | ||
106 | |||
107 | /********************************* | ||
108 | |||
109 | M32102 SIO | ||
110 | |||
111 | *********************************/ | ||
112 | |||
113 | #define SIO0CR (volatile int *)0xa0efd000 | ||
114 | #define SIO0MOD0 (volatile int *)0xa0efd004 | ||
115 | #define SIO0MOD1 (volatile int *)0xa0efd008 | ||
116 | #define SIO0STS (volatile int *)0xa0efd00c | ||
117 | #define SIO0IMASK (volatile int *)0xa0efd010 | ||
118 | #define SIO0BAUR (volatile int *)0xa0efd014 | ||
119 | #define SIO0RBAUR (volatile int *)0xa0efd018 | ||
120 | #define SIO0TXB (volatile int *)0xa0efd01c | ||
121 | #define SIO0RXB (volatile int *)0xa0efd020 | ||
122 | |||
123 | #define SIO1CR (volatile int *)0xa0efd100 | ||
124 | #define SIO1MOD0 (volatile int *)0xa0efd104 | ||
125 | #define SIO1MOD1 (volatile int *)0xa0efd108 | ||
126 | #define SIO1STS (volatile int *)0xa0efd10c | ||
127 | #define SIO1IMASK (volatile int *)0xa0efd110 | ||
128 | #define SIO1BAUR (volatile int *)0xa0efd114 | ||
129 | #define SIO1RBAUR (volatile int *)0xa0efd118 | ||
130 | #define SIO1TXB (volatile int *)0xa0efd11c | ||
131 | #define SIO1RXB (volatile int *)0xa0efd120 | ||
132 | /********************************* | ||
133 | |||
134 | M32102 PORT | ||
135 | |||
136 | *********************************/ | ||
137 | #define PIEN (UB *)0xa0EF1003 /* input enable */ | ||
138 | |||
139 | #define P0DATA (UB *)0xa0EF1020 /* data */ | ||
140 | #define P1DATA (UB *)0xa0EF1021 | ||
141 | #define P2DATA (UB *)0xa0EF1022 | ||
142 | #define P3DATA (UB *)0xa0EF1023 | ||
143 | #define P4DATA (UB *)0xa0EF1024 | ||
144 | #define P5DATA (UB *)0xa0EF1025 | ||
145 | #define P6DATA (UB *)0xa0EF1026 | ||
146 | #define P7DATA (UB *)0xa0EF1027 | ||
147 | |||
148 | #define P0DIR (UB *)0xa0EF1040 /* direction */ | ||
149 | #define P1DIR (UB *)0xa0EF1041 | ||
150 | #define P2DIR (UB *)0xa0EF1042 | ||
151 | #define P3DIR (UB *)0xa0EF1043 | ||
152 | #define P4DIR (UB *)0xa0EF1044 | ||
153 | #define P5DIR (UB *)0xa0EF1045 | ||
154 | #define P6DIR (UB *)0xa0EF1046 | ||
155 | #define P7DIR (UB *)0xa0EF1047 | ||
156 | |||
157 | #define P0MOD (US *)0xa0EF1060 /* mode control */ | ||
158 | #define P1MOD (US *)0xa0EF1062 | ||
159 | #define P2MOD (US *)0xa0EF1064 | ||
160 | #define P3MOD (US *)0xa0EF1066 | ||
161 | #define P4MOD (US *)0xa0EF1068 | ||
162 | #define P5MOD (US *)0xa0EF106A | ||
163 | #define P6MOD (US *)0xa0EF106C | ||
164 | #define P7MOD (US *)0xa0EF106E | ||
165 | |||
166 | #define P0ODCR (UB *)0xa0EF1080 /* open-drain control */ | ||
167 | #define P1ODCR (UB *)0xa0EF1081 | ||
168 | #define P2ODCR (UB *)0xa0EF1082 | ||
169 | #define P3ODCR (UB *)0xa0EF1083 | ||
170 | #define P4ODCR (UB *)0xa0EF1084 | ||
171 | #define P5ODCR (UB *)0xa0EF1085 | ||
172 | #define P6ODCR (UB *)0xa0EF1086 | ||
173 | #define P7ODCR (UB *)0xa0EF1087 | ||
174 | |||
175 | /********************************* | ||
176 | |||
177 | M32102 Cache | ||
178 | |||
179 | ********************************/ | ||
180 | |||
181 | #define MCCR (US *)0xFFFFFFFE | ||
182 | |||
183 | |||
184 | #else /* __ASSEMBLY__ */ | ||
185 | |||
186 | ;; | ||
187 | ;; PIO 0x80ef1000 | ||
188 | ;; | ||
189 | |||
190 | #define PIEN 0xa0ef1000 | ||
191 | |||
192 | #define P0DATA 0xa0ef1020 | ||
193 | #define P1DATA 0xa0ef1021 | ||
194 | #define P2DATA 0xa0ef1022 | ||
195 | #define P3DATA 0xa0ef1023 | ||
196 | #define P4DATA 0xa0ef1024 | ||
197 | #define P5DATA 0xa0ef1025 | ||
198 | #define P6DATA 0xa0ef1026 | ||
199 | #define P7DATA 0xa0ef1027 | ||
200 | |||
201 | #define P0DIR 0xa0ef1040 | ||
202 | #define P1DIR 0xa0ef1041 | ||
203 | #define P2DIR 0xa0ef1042 | ||
204 | #define P3DIR 0xa0ef1043 | ||
205 | #define P4DIR 0xa0ef1044 | ||
206 | #define P5DIR 0xa0ef1045 | ||
207 | #define P6DIR 0xa0ef1046 | ||
208 | #define P7DIR 0xa0ef1047 | ||
209 | |||
210 | #define P0MOD 0xa0ef1060 | ||
211 | #define P1MOD 0xa0ef1062 | ||
212 | #define P2MOD 0xa0ef1064 | ||
213 | #define P3MOD 0xa0ef1066 | ||
214 | #define P4MOD 0xa0ef1068 | ||
215 | #define P5MOD 0xa0ef106a | ||
216 | #define P6MOD 0xa0ef106c | ||
217 | #define P7MOD 0xa0ef106e | ||
218 | ; | ||
219 | #define P0ODCR 0xa0ef1080 | ||
220 | #define P1ODCR 0xa0ef1081 | ||
221 | #define P2ODCR 0xa0ef1082 | ||
222 | #define P3ODCR 0xa0ef1083 | ||
223 | #define P4ODCR 0xa0ef1084 | ||
224 | #define P5ODCR 0xa0ef1085 | ||
225 | #define P6ODCR 0xa0ef1086 | ||
226 | #define P7ODCR 0xa0ef1087 | ||
227 | |||
228 | ;; | ||
229 | ;; WDT 0xa0ef2000 | ||
230 | ;; | ||
231 | |||
232 | #define WDTCR 0xa0ef2000 | ||
233 | |||
234 | |||
235 | ;; | ||
236 | ;; CLK 0xa0ef4000 | ||
237 | ;; | ||
238 | |||
239 | #define CPUCLKCR 0xa0ef4000 | ||
240 | #define CLKMOD 0xa0ef4004 | ||
241 | #define PLLCR 0xa0ef4008 | ||
242 | |||
243 | |||
244 | ;; | ||
245 | ;; BSEL 0xa0ef5000 | ||
246 | ;; | ||
247 | |||
248 | #define BSEL0CR 0xa0ef5000 | ||
249 | #define BSEL1CR 0xa0ef5004 | ||
250 | #define BSEL2CR 0xa0ef5008 | ||
251 | #define BSEL3CR 0xa0ef500c | ||
252 | #define BSEL4CR 0xa0ef5010 | ||
253 | #define BSEL5CR 0xa0ef5014 | ||
254 | |||
255 | |||
256 | ;; | ||
257 | ;; SDRAMC 0xa0ef6000 | ||
258 | ;; | ||
259 | |||
260 | #define SDRF0 0xa0ef6000 | ||
261 | #define SDRF1 0xa0ef6004 | ||
262 | #define SDIR0 0xa0ef6008 | ||
263 | #define SDIR1 0xa0ef600c | ||
264 | #define SDBR 0xa0ef6010 | ||
265 | |||
266 | ;; CH0 | ||
267 | #define SD0ADR 0xa0ef6020 | ||
268 | #define SD0SZ 0xa0ef6022 | ||
269 | #define SD0ER 0xa0ef6024 | ||
270 | #define SD0TR 0xa0ef6028 | ||
271 | #define SD0MOD 0xa0ef602c | ||
272 | |||
273 | ;; CH1 | ||
274 | #define SD1ADR 0xa0ef6040 | ||
275 | #define SD1SZ 0xa0ef6042 | ||
276 | #define SD1ER 0xa0ef6044 | ||
277 | #define SD1TR 0xa0ef6048 | ||
278 | #define SD1MOD 0xa0ef604c | ||
279 | |||
280 | |||
281 | ;; | ||
282 | ;; DMAC 0xa0ef8000 | ||
283 | ;; | ||
284 | |||
285 | #define DMAEN 0xa0ef8000 | ||
286 | #define DMAISTS 0xa0ef8004 | ||
287 | #define DMAEDET 0xa0ef8008 | ||
288 | #define DMAASTS 0xa0ef800c | ||
289 | |||
290 | ;; CH0 | ||
291 | #define DMA0CR0 0xa0ef8100 | ||
292 | #define DMA0CR1 0xa0ef8104 | ||
293 | #define DMA0CSA 0xa0ef8108 | ||
294 | #define DMA0RSA 0xa0ef810c | ||
295 | #define DMA0CDA 0xa0ef8110 | ||
296 | #define DMA0RDA 0xa0ef8114 | ||
297 | #define DMA0CBCUT 0xa0ef8118 | ||
298 | #define DMA0RBCUT 0xa0ef811c | ||
299 | |||
300 | ;; CH1 | ||
301 | #define DMA1CR0 0xa0ef8200 | ||
302 | #define DMA1CR1 0xa0ef8204 | ||
303 | #define DMA1CSA 0xa0ef8208 | ||
304 | #define DMA1RSA 0xa0ef820c | ||
305 | #define DMA1CDA 0xa0ef8210 | ||
306 | #define DMA1RDA 0xa0ef8214 | ||
307 | #define DMA1CBCUT 0xa0ef8218 | ||
308 | #define DMA1RBCUT 0xa0ef821c | ||
309 | |||
310 | |||
311 | ;; | ||
312 | ;; MFT 0xa0efc000 | ||
313 | ;; | ||
314 | |||
315 | #define MFTCR 0xa0efc000 | ||
316 | #define MFTRPR 0xa0efc004 | ||
317 | |||
318 | ;; CH0 | ||
319 | #define MFT0MOD 0xa0efc100 | ||
320 | #define MFT0BOS 0xa0efc104 | ||
321 | #define MFT0CUT 0xa0efc108 | ||
322 | #define MFT0RLD 0xa0efc10c | ||
323 | #define MFT0CMPRLD 0xa0efc110 | ||
324 | |||
325 | ;; CH1 | ||
326 | #define MFT1MOD 0xa0efc200 | ||
327 | #define MFT1BOS 0xa0efc204 | ||
328 | #define MFT1CUT 0xa0efc208 | ||
329 | #define MFT1RLD 0xa0efc20c | ||
330 | #define MFT1CMPRLD 0xa0efc210 | ||
331 | |||
332 | ;; CH2 | ||
333 | #define MFT2MOD 0xa0efc300 | ||
334 | #define MFT2BOS 0xa0efc304 | ||
335 | #define MFT2CUT 0xa0efc308 | ||
336 | #define MFT2RLD 0xa0efc30c | ||
337 | #define MFT2CMPRLD 0xa0efc310 | ||
338 | |||
339 | ;; CH3 | ||
340 | #define MFT3MOD 0xa0efc400 | ||
341 | #define MFT3BOS 0xa0efc404 | ||
342 | #define MFT3CUT 0xa0efc408 | ||
343 | #define MFT3RLD 0xa0efc40c | ||
344 | #define MFT3CMPRLD 0xa0efc410 | ||
345 | |||
346 | ;; CH4 | ||
347 | #define MFT4MOD 0xa0efc500 | ||
348 | #define MFT4BOS 0xa0efc504 | ||
349 | #define MFT4CUT 0xa0efc508 | ||
350 | #define MFT4RLD 0xa0efc50c | ||
351 | #define MFT4CMPRLD 0xa0efc510 | ||
352 | |||
353 | ;; CH5 | ||
354 | #define MFT5MOD 0xa0efc600 | ||
355 | #define MFT5BOS 0xa0efc604 | ||
356 | #define MFT5CUT 0xa0efc608 | ||
357 | #define MFT5RLD 0xa0efc60c | ||
358 | #define MFT5CMPRLD 0xa0efc610 | ||
359 | |||
360 | |||
361 | ;; | ||
362 | ;; SIO 0xa0efd000 | ||
363 | ;; | ||
364 | |||
365 | ;; CH0 | ||
366 | #define SIO0CR 0xa0efd000 | ||
367 | #define SIO0MOD0 0xa0efd004 | ||
368 | #define SIO0MOD1 0xa0efd008 | ||
369 | #define SIO0STS 0xa0efd00c | ||
370 | #define SIO0IMASK 0xa0efd010 | ||
371 | #define SIO0BAUR 0xa0efd014 | ||
372 | #define SIO0RBAUR 0xa0efd018 | ||
373 | #define SIO0TXB 0xa0efd01c | ||
374 | #define SIO0RXB 0xa0efd020 | ||
375 | |||
376 | ;; CH1 | ||
377 | #define SIO1CR 0xa0efd100 | ||
378 | #define SIO1MOD0 0xa0efd104 | ||
379 | #define SIO1MOD1 0xa0efd108 | ||
380 | #define SIO1STS 0xa0efd10c | ||
381 | #define SIO1IMASK 0xa0efd110 | ||
382 | #define SIO1BAUR 0xa0efd114 | ||
383 | #define SIO1RBAUR 0xa0efd118 | ||
384 | #define SIO1TXB 0xa0efd11c | ||
385 | #define SIO1RXB 0xa0efd120 | ||
386 | |||
387 | ;; CH2 | ||
388 | #define SIO2CR 0xa0efd200 | ||
389 | #define SIO2MOD0 0xa0efd204 | ||
390 | #define SIO2MOD1 0xa0efd208 | ||
391 | #define SIO2STS 0xa0efd20c | ||
392 | #define SIO2IMASK 0xa0efd210 | ||
393 | #define SIO2BAUR 0xa0efd214 | ||
394 | #define SIO2RBAUR 0xa0efd218 | ||
395 | #define SIO2TXB 0xa0efd21c | ||
396 | #define SIO2RXB 0xa0efd220 | ||
397 | |||
398 | ;; CH3 | ||
399 | #define SIO3CR 0xa0efd300 | ||
400 | #define SIO3MOD0 0xa0efd304 | ||
401 | #define SIO3MOD1 0xa0efd308 | ||
402 | #define SIO3STS 0xa0efd30c | ||
403 | #define SIO3IMASK 0xa0efd310 | ||
404 | #define SIO3BAUR 0xa0efd314 | ||
405 | #define SIO3RBAUR 0xa0efd318 | ||
406 | #define SIO3TXB 0xa0efd31c | ||
407 | #define SIO3RXB 0xa0efd320 | ||
408 | |||
409 | ;; CH4 | ||
410 | #define SIO4CR 0xa0efd400 | ||
411 | #define SIO4MOD0 0xa0efd404 | ||
412 | #define SIO4MOD1 0xa0efd408 | ||
413 | #define SIO4STS 0xa0efd40c | ||
414 | #define SIO4IMASK 0xa0efd410 | ||
415 | #define SIO4BAUR 0xa0efd414 | ||
416 | #define SIO4RBAUR 0xa0efd418 | ||
417 | #define SIO4TXB 0xa0efd41c | ||
418 | #define SIO4RXB 0xa0efd420 | ||
419 | |||
420 | |||
421 | ;; | ||
422 | ;; ICU 0xa0eff000 | ||
423 | ;; | ||
424 | |||
425 | #define ICUISTS 0xa0eff004 | ||
426 | #define ICUIREQ0 0xa0eff008 | ||
427 | #define ICUIREQ1 0xa0eff00c | ||
428 | |||
429 | #define ICUSBICR 0xa0eff018 | ||
430 | #define ICUIMASK 0xa0eff01c | ||
431 | |||
432 | #define ICUCR1 0xa0eff200 | ||
433 | #define ICUCR2 0xa0eff204 | ||
434 | #define ICUCR3 0xa0eff208 | ||
435 | #define ICUCR4 0xa0eff20c | ||
436 | #define ICUCR5 0xa0eff210 | ||
437 | #define ICUCR6 0xa0eff214 | ||
438 | #define ICUCR7 0xa0eff218 | ||
439 | |||
440 | #define ICUCR16 0xa0eff23c | ||
441 | #define ICUCR17 0xa0eff240 | ||
442 | #define ICUCR18 0xa0eff244 | ||
443 | #define ICUCR19 0xa0eff248 | ||
444 | #define ICUCR20 0xa0eff24c | ||
445 | #define ICUCR21 0xa0eff250 | ||
446 | |||
447 | #define ICUCR32 0xa0eff27c | ||
448 | #define ICUCR33 0xa0eff280 | ||
449 | |||
450 | #define ICUCR48 0xa0eff2bc | ||
451 | #define ICUCR49 0xa0eff2c0 | ||
452 | #define ICUCR50 0xa0eff2c4 | ||
453 | #define ICUCR51 0xa0eff2c8 | ||
454 | #define ICUCR52 0xa0eff2cc | ||
455 | #define ICUCR53 0xa0eff2d0 | ||
456 | #define ICUCR54 0xa0eff2d4 | ||
457 | #define ICUCR55 0xa0eff2d8 | ||
458 | #define ICUCR56 0xa0eff2dc | ||
459 | #define ICUCR57 0xa0eff2e0 | ||
460 | |||
461 | ;; | ||
462 | ;; CACHE | ||
463 | ;; | ||
464 | |||
465 | #define MCCR 0xfffffffc | ||
466 | |||
467 | |||
468 | #endif /* __ASSEMBLY__ */ | ||
diff --git a/include/asm-m32r/m32r.h b/include/asm-m32r/m32r.h index f116649bbef3..ec142be00862 100644 --- a/include/asm-m32r/m32r.h +++ b/include/asm-m32r/m32r.h | |||
@@ -16,7 +16,6 @@ | |||
16 | || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ | 16 | || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ |
17 | || defined(CONFIG_CHIP_OPSP) | 17 | || defined(CONFIG_CHIP_OPSP) |
18 | #include <asm/m32102.h> | 18 | #include <asm/m32102.h> |
19 | #include <asm/m32102peri.h> | ||
20 | #endif | 19 | #endif |
21 | 20 | ||
22 | /* Platform type */ | 21 | /* Platform type */ |
@@ -36,6 +35,10 @@ | |||
36 | #include <asm/mappi2/mappi2_pld.h> | 35 | #include <asm/mappi2/mappi2_pld.h> |
37 | #endif /* CONFIG_PLAT_MAPPI2 */ | 36 | #endif /* CONFIG_PLAT_MAPPI2 */ |
38 | 37 | ||
38 | #if defined(CONFIG_PLAT_MAPPI3) | ||
39 | #include <asm/mappi3/mappi3_pld.h> | ||
40 | #endif /* CONFIG_PLAT_MAPPI3 */ | ||
41 | |||
39 | #if defined(CONFIG_PLAT_USRV) | 42 | #if defined(CONFIG_PLAT_USRV) |
40 | #include <asm/m32700ut/m32700ut_pld.h> | 43 | #include <asm/m32700ut/m32700ut_pld.h> |
41 | #endif | 44 | #endif |
diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h new file mode 100644 index 000000000000..3f1551f7f01f --- /dev/null +++ b/include/asm-m32r/mappi3/mappi3_pld.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * include/asm/mappi3/mappi3_pld.h | ||
3 | * | ||
4 | * Definitions for Extended IO Logic on MAPPI3 board. | ||
5 | * based on m32700ut_pld.h | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General | ||
8 | * Public License. See the file "COPYING" in the main directory of | ||
9 | * this archive for more details. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef _MAPPI3_PLD_H | ||
14 | #define _MAPPI3_PLD_H | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | /* FIXME: | ||
18 | * Some C functions use non-cache address, so can't define non-cache address. | ||
19 | */ | ||
20 | #define PLD_BASE (0x1c000000 /* + NONCACHE_OFFSET */) | ||
21 | #define __reg8 (volatile unsigned char *) | ||
22 | #define __reg16 (volatile unsigned short *) | ||
23 | #define __reg32 (volatile unsigned int *) | ||
24 | #else | ||
25 | #define PLD_BASE (0x1c000000 + NONCACHE_OFFSET) | ||
26 | #define __reg8 | ||
27 | #define __reg16 | ||
28 | #define __reg32 | ||
29 | #endif /* __ASSEMBLY__ */ | ||
30 | |||
31 | /* CFC */ | ||
32 | #define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) | ||
33 | #define PLD_CFSTS __reg16(PLD_BASE + 0x0002) | ||
34 | #define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) | ||
35 | #define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) | ||
36 | #define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) | ||
37 | #define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) | ||
38 | |||
39 | /* MMC */ | ||
40 | #define PLD_MMCCR __reg16(PLD_BASE + 0x4000) | ||
41 | #define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) | ||
42 | #define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) | ||
43 | #define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) | ||
44 | #define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) | ||
45 | #define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) | ||
46 | #define PLD_MMCDET __reg16(PLD_BASE + 0x4010) | ||
47 | #define PLD_MMCWP __reg16(PLD_BASE + 0x4012) | ||
48 | #define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) | ||
49 | #define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) | ||
50 | #define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) | ||
51 | #define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) | ||
52 | |||
53 | /* Power Control of MMC and CF */ | ||
54 | #define PLD_CPCR __reg16(PLD_BASE + 0x14000) | ||
55 | |||
56 | |||
57 | /*==== ICU ====*/ | ||
58 | #define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ | ||
59 | #define M32R_IRQ_I2C (28) /* I2C-BUS */ | ||
60 | #define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ | ||
61 | #define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */ | ||
62 | #define PLD_IRQ_CFC_EJECT (8) /* INT7 CFC Card Eject */ | ||
63 | #define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ | ||
64 | #define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ | ||
65 | |||
66 | |||
67 | #if 0 | ||
68 | /* LED Control | ||
69 | * | ||
70 | * 1: DIP swich side | ||
71 | * 2: Reset switch side | ||
72 | */ | ||
73 | #define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) | ||
74 | #define PLD_IOLED_1_ON 0x001 | ||
75 | #define PLD_IOLED_1_OFF 0x000 | ||
76 | #define PLD_IOLED_2_ON 0x002 | ||
77 | #define PLD_IOLED_2_OFF 0x000 | ||
78 | |||
79 | /* DIP Switch | ||
80 | * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) | ||
81 | * 1: - | ||
82 | * 2: - | ||
83 | * 3: - | ||
84 | */ | ||
85 | #define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) | ||
86 | #define PLD_IOSWSTS_IOSW2 0x0200 | ||
87 | #define PLD_IOSWSTS_IOSW1 0x0100 | ||
88 | #define PLD_IOSWSTS_IOWP0 0x0001 | ||
89 | |||
90 | #endif | ||
91 | |||
92 | /* CRC */ | ||
93 | #define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) | ||
94 | #define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) | ||
95 | #define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) | ||
96 | #define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) | ||
97 | #define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) | ||
98 | #define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) | ||
99 | |||
100 | |||
101 | #if 0 | ||
102 | /* RTC */ | ||
103 | #define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) | ||
104 | #define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) | ||
105 | #define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) | ||
106 | #define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) | ||
107 | #define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) | ||
108 | |||
109 | /* SIO0 */ | ||
110 | #define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) | ||
111 | #define PLD_ESIO0CR_TXEN 0x0001 | ||
112 | #define PLD_ESIO0CR_RXEN 0x0002 | ||
113 | #define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) | ||
114 | #define PLD_ESIO0MOD0_CTSS 0x0040 | ||
115 | #define PLD_ESIO0MOD0_RTSS 0x0080 | ||
116 | #define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) | ||
117 | #define PLD_ESIO0MOD1_LMFS 0x0010 | ||
118 | #define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) | ||
119 | #define PLD_ESIO0STS_TEMP 0x0001 | ||
120 | #define PLD_ESIO0STS_TXCP 0x0002 | ||
121 | #define PLD_ESIO0STS_RXCP 0x0004 | ||
122 | #define PLD_ESIO0STS_TXSC 0x0100 | ||
123 | #define PLD_ESIO0STS_RXSC 0x0200 | ||
124 | #define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) | ||
125 | #define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) | ||
126 | #define PLD_ESIO0INTCR_TXIEN 0x0002 | ||
127 | #define PLD_ESIO0INTCR_RXCEN 0x0004 | ||
128 | #define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) | ||
129 | #define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) | ||
130 | #define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) | ||
131 | |||
132 | /* SIM Card */ | ||
133 | #define PLD_SCCR __reg16(PLD_BASE + 0x38000) | ||
134 | #define PLD_SCMOD __reg16(PLD_BASE + 0x38004) | ||
135 | #define PLD_SCSTS __reg16(PLD_BASE + 0x38006) | ||
136 | #define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) | ||
137 | #define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) | ||
138 | #define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) | ||
139 | #define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) | ||
140 | |||
141 | #endif | ||
142 | |||
143 | #endif /* _MAPPI3_PLD.H */ | ||
diff --git a/include/asm-m32r/mmzone.h b/include/asm-m32r/mmzone.h index ebf0228fec42..d58878ec899e 100644 --- a/include/asm-m32r/mmzone.h +++ b/include/asm-m32r/mmzone.h | |||
@@ -14,7 +14,6 @@ extern struct pglist_data *node_data[]; | |||
14 | #define NODE_DATA(nid) (node_data[nid]) | 14 | #define NODE_DATA(nid) (node_data[nid]) |
15 | 15 | ||
16 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) | 16 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) |
17 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
18 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 17 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
19 | #define node_end_pfn(nid) \ | 18 | #define node_end_pfn(nid) \ |
20 | ({ \ | 19 | ({ \ |
@@ -32,7 +31,7 @@ extern struct pglist_data *node_data[]; | |||
32 | ({ \ | 31 | ({ \ |
33 | unsigned long __pfn = pfn; \ | 32 | unsigned long __pfn = pfn; \ |
34 | int __node = pfn_to_nid(__pfn); \ | 33 | int __node = pfn_to_nid(__pfn); \ |
35 | &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ | 34 | &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ |
36 | }) | 35 | }) |
37 | 36 | ||
38 | #define page_to_pfn(pg) \ | 37 | #define page_to_pfn(pg) \ |
diff --git a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h index 8cd4d0da4be1..b9a20cdad65f 100644 --- a/include/asm-m32r/smp.h +++ b/include/asm-m32r/smp.h | |||
@@ -66,7 +66,7 @@ extern volatile int cpu_2_physid[NR_CPUS]; | |||
66 | #define physid_to_cpu(physid) physid_2_cpu[physid] | 66 | #define physid_to_cpu(physid) physid_2_cpu[physid] |
67 | #define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id] | 67 | #define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id] |
68 | 68 | ||
69 | #define smp_processor_id() (current_thread_info()->cpu) | 69 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
70 | 70 | ||
71 | extern cpumask_t cpu_callout_map; | 71 | extern cpumask_t cpu_callout_map; |
72 | #define cpu_possible_map cpu_callout_map | 72 | #define cpu_possible_map cpu_callout_map |
diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h index 9f3a0fcf6e2b..7a6be7727a92 100644 --- a/include/asm-m32r/thread_info.h +++ b/include/asm-m32r/thread_info.h | |||
@@ -28,7 +28,7 @@ struct thread_info { | |||
28 | unsigned long flags; /* low level flags */ | 28 | unsigned long flags; /* low level flags */ |
29 | unsigned long status; /* thread-synchronous flags */ | 29 | unsigned long status; /* thread-synchronous flags */ |
30 | __u32 cpu; /* current CPU */ | 30 | __u32 cpu; /* current CPU */ |
31 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 31 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
32 | 32 | ||
33 | mm_segment_t addr_limit; /* thread address space: | 33 | mm_segment_t addr_limit; /* thread address space: |
34 | 0-0xBFFFFFFF for user-thread | 34 | 0-0xBFFFFFFF for user-thread |
diff --git a/include/asm-m32r/topology.h b/include/asm-m32r/topology.h index 299a89d91bde..d607eb32bd7e 100644 --- a/include/asm-m32r/topology.h +++ b/include/asm-m32r/topology.h | |||
@@ -1,48 +1,6 @@ | |||
1 | /* | ||
2 | * linux/include/asm-generic/topology.h | ||
3 | * | ||
4 | * Written by: Matthew Dobson, IBM Corporation | ||
5 | * | ||
6 | * Copyright (C) 2002, IBM Corp. | ||
7 | * | ||
8 | * All rights reserved. | ||
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 | * This program is distributed in the hope that it will be useful, but | ||
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
18 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
19 | * details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | * | ||
25 | * Send feedback to <colpatch@us.ibm.com> | ||
26 | */ | ||
27 | #ifndef _ASM_M32R_TOPOLOGY_H | 1 | #ifndef _ASM_M32R_TOPOLOGY_H |
28 | #define _ASM_M32R_TOPOLOGY_H | 2 | #define _ASM_M32R_TOPOLOGY_H |
29 | 3 | ||
30 | /* Other architectures wishing to use this simple topology API should fill | 4 | #include <asm-generic/topology.h> |
31 | in the below functions as appropriate in their own <asm/topology.h> file. */ | ||
32 | |||
33 | #define cpu_to_node(cpu) (0) | ||
34 | |||
35 | #ifndef parent_node | ||
36 | #define parent_node(node) (0) | ||
37 | #endif | ||
38 | #ifndef node_to_cpumask | ||
39 | #define node_to_cpumask(node) (cpu_online_map) | ||
40 | #endif | ||
41 | #ifndef node_to_first_cpu | ||
42 | #define node_to_first_cpu(node) (0) | ||
43 | #endif | ||
44 | #ifndef pcibus_to_cpumask | ||
45 | #define pcibus_to_cpumask(bus) (cpu_online_map) | ||
46 | #endif | ||
47 | 5 | ||
48 | #endif /* _ASM_M32R_TOPOLOGY_H */ | 6 | #endif /* _ASM_M32R_TOPOLOGY_H */ |
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h index 5f58939c59db..2aed24f6fd2e 100644 --- a/include/asm-m68k/thread_info.h +++ b/include/asm-m68k/thread_info.h | |||
@@ -8,7 +8,7 @@ | |||
8 | struct thread_info { | 8 | struct thread_info { |
9 | struct task_struct *task; /* main task structure */ | 9 | struct task_struct *task; /* main task structure */ |
10 | struct exec_domain *exec_domain; /* execution domain */ | 10 | struct exec_domain *exec_domain; /* execution domain */ |
11 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 11 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
12 | __u32 cpu; /* should always be 0 on m68k */ | 12 | __u32 cpu; /* should always be 0 on m68k */ |
13 | struct restart_block restart_block; | 13 | struct restart_block restart_block; |
14 | 14 | ||
diff --git a/include/asm-m68knommu/thread_info.h b/include/asm-m68knommu/thread_info.h index c8153b7c1f5c..7b9a3fa3af5d 100644 --- a/include/asm-m68knommu/thread_info.h +++ b/include/asm-m68knommu/thread_info.h | |||
@@ -36,7 +36,7 @@ struct thread_info { | |||
36 | struct exec_domain *exec_domain; /* execution domain */ | 36 | struct exec_domain *exec_domain; /* execution domain */ |
37 | unsigned long flags; /* low level flags */ | 37 | unsigned long flags; /* low level flags */ |
38 | int cpu; /* cpu we're on */ | 38 | int cpu; /* cpu we're on */ |
39 | int preempt_count; /* 0 => preemptable, <0 => BUG*/ | 39 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
40 | struct restart_block restart_block; | 40 | struct restart_block restart_block; |
41 | }; | 41 | }; |
42 | 42 | ||
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h index dce92079e7fc..d78002afb1e1 100644 --- a/include/asm-mips/compat.h +++ b/include/asm-mips/compat.h | |||
@@ -29,6 +29,7 @@ typedef s32 compat_caddr_t; | |||
29 | typedef struct { | 29 | typedef struct { |
30 | s32 val[2]; | 30 | s32 val[2]; |
31 | } compat_fsid_t; | 31 | } compat_fsid_t; |
32 | typedef s32 compat_timer_t; | ||
32 | 33 | ||
33 | typedef s32 compat_int_t; | 34 | typedef s32 compat_int_t; |
34 | typedef s32 compat_long_t; | 35 | typedef s32 compat_long_t; |
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h index 29ee13be0b2a..d721143dbd47 100644 --- a/include/asm-mips/mmzone.h +++ b/include/asm-mips/mmzone.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <asm/page.h> | 8 | #include <asm/page.h> |
9 | #include <mmzone.h> | 9 | #include <mmzone.h> |
10 | 10 | ||
11 | #ifdef CONFIG_DISCONTIGMEM | ||
12 | |||
11 | #define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr)) | 13 | #define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr)) |
12 | #define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) | 14 | #define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) |
13 | 15 | ||
@@ -36,4 +38,6 @@ | |||
36 | /* XXX: FIXME -- wli */ | 38 | /* XXX: FIXME -- wli */ |
37 | #define kern_addr_valid(addr) (0) | 39 | #define kern_addr_valid(addr) (0) |
38 | 40 | ||
41 | #endif /* CONFIG_DISCONTIGMEM */ | ||
42 | |||
39 | #endif /* _ASM_MMZONE_H_ */ | 43 | #endif /* _ASM_MMZONE_H_ */ |
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index d1bf8240e73b..5cae35cd9ba9 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h | |||
@@ -127,7 +127,7 @@ static __inline__ int get_order(unsigned long size) | |||
127 | 127 | ||
128 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 128 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
129 | 129 | ||
130 | #ifndef CONFIG_DISCONTIGMEM | 130 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
131 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 131 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
132 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 132 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
133 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 133 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 878843203d67..e76ccd6e3a5d 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -350,7 +350,7 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, | |||
350 | __update_cache(vma, address, pte); | 350 | __update_cache(vma, address, pte); |
351 | } | 351 | } |
352 | 352 | ||
353 | #ifndef CONFIG_DISCONTIGMEM | 353 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
354 | #define kern_addr_valid(addr) (1) | 354 | #define kern_addr_valid(addr) (1) |
355 | #endif | 355 | #endif |
356 | 356 | ||
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h index 8ba370ecfd4c..5618f1e12f40 100644 --- a/include/asm-mips/smp.h +++ b/include/asm-mips/smp.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/cpumask.h> | 21 | #include <linux/cpumask.h> |
22 | #include <asm/atomic.h> | 22 | #include <asm/atomic.h> |
23 | 23 | ||
24 | #define smp_processor_id() (current_thread_info()->cpu) | 24 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
25 | 25 | ||
26 | /* Map from cpu id to sequential logical cpu number. This will only | 26 | /* Map from cpu id to sequential logical cpu number. This will only |
27 | not be idempotent when cpus failed to come on-line. */ | 27 | not be idempotent when cpus failed to come on-line. */ |
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index 888fd8908467..169f3d4265b1 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h | |||
@@ -422,16 +422,10 @@ extern void __die_if_kernel(const char *, struct pt_regs *, const char *file, | |||
422 | extern int stop_a_enabled; | 422 | extern int stop_a_enabled; |
423 | 423 | ||
424 | /* | 424 | /* |
425 | * Taken from include/asm-ia64/system.h; prevents deadlock on SMP | 425 | * See include/asm-ia64/system.h; prevents deadlock on SMP |
426 | * systems. | 426 | * systems. |
427 | */ | 427 | */ |
428 | #define prepare_arch_switch(rq, next) \ | 428 | #define __ARCH_WANT_UNLOCKED_CTXSW |
429 | do { \ | ||
430 | spin_lock(&(next)->switch_lock); \ | ||
431 | spin_unlock(&(rq)->lock); \ | ||
432 | } while (0) | ||
433 | #define finish_arch_switch(rq, prev) spin_unlock_irq(&(prev)->switch_lock) | ||
434 | #define task_running(rq, p) ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock)) | ||
435 | 429 | ||
436 | #define arch_align_stack(x) (x) | 430 | #define arch_align_stack(x) (x) |
437 | 431 | ||
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h index 768900305e2f..42fcd6f2c206 100644 --- a/include/asm-mips/thread_info.h +++ b/include/asm-mips/thread_info.h | |||
@@ -27,7 +27,7 @@ struct thread_info { | |||
27 | struct exec_domain *exec_domain; /* execution domain */ | 27 | struct exec_domain *exec_domain; /* execution domain */ |
28 | unsigned long flags; /* low level flags */ | 28 | unsigned long flags; /* low level flags */ |
29 | __u32 cpu; /* current CPU */ | 29 | __u32 cpu; /* current CPU */ |
30 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 30 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
31 | 31 | ||
32 | mm_segment_t addr_limit; /* thread address space: | 32 | mm_segment_t addr_limit; /* thread address space: |
33 | 0-0xBFFFFFFF for user-thead | 33 | 0-0xBFFFFFFF for user-thead |
diff --git a/include/asm-mips/vr41xx/giu.h b/include/asm-mips/vr41xx/giu.h new file mode 100644 index 000000000000..8590885a7638 --- /dev/null +++ b/include/asm-mips/vr41xx/giu.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Include file for NEC VR4100 series General-purpose I/O Unit. | ||
3 | * | ||
4 | * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> | ||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __NEC_VR41XX_GIU_H | ||
21 | #define __NEC_VR41XX_GIU_H | ||
22 | |||
23 | typedef enum { | ||
24 | IRQ_TRIGGER_LEVEL, | ||
25 | IRQ_TRIGGER_EDGE, | ||
26 | IRQ_TRIGGER_EDGE_FALLING, | ||
27 | IRQ_TRIGGER_EDGE_RISING, | ||
28 | } irq_trigger_t; | ||
29 | |||
30 | typedef enum { | ||
31 | IRQ_SIGNAL_THROUGH, | ||
32 | IRQ_SIGNAL_HOLD, | ||
33 | } irq_signal_t; | ||
34 | |||
35 | extern void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_t signal); | ||
36 | |||
37 | typedef enum { | ||
38 | IRQ_LEVEL_LOW, | ||
39 | IRQ_LEVEL_HIGH, | ||
40 | } irq_level_t; | ||
41 | |||
42 | extern void vr41xx_set_irq_level(unsigned int pin, irq_level_t level); | ||
43 | |||
44 | typedef enum { | ||
45 | GPIO_DATA_LOW, | ||
46 | GPIO_DATA_HIGH, | ||
47 | GPIO_DATA_INVAL, | ||
48 | } gpio_data_t; | ||
49 | |||
50 | extern gpio_data_t vr41xx_gpio_get_pin(unsigned int pin); | ||
51 | extern int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data); | ||
52 | |||
53 | typedef enum { | ||
54 | GPIO_INPUT, | ||
55 | GPIO_OUTPUT, | ||
56 | GPIO_OUTPUT_DISABLE, | ||
57 | } gpio_direction_t; | ||
58 | |||
59 | extern int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir); | ||
60 | |||
61 | typedef enum { | ||
62 | GPIO_PULL_DOWN, | ||
63 | GPIO_PULL_UP, | ||
64 | GPIO_PULL_DISABLE, | ||
65 | } gpio_pull_t; | ||
66 | |||
67 | extern int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull); | ||
68 | |||
69 | #endif /* __NEC_VR41XX_GIU_H */ | ||
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h index ad0d1ea144f0..7d41e44463f9 100644 --- a/include/asm-mips/vr41xx/vr41xx.h +++ b/include/asm-mips/vr41xx/vr41xx.h | |||
@@ -126,7 +126,6 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock); | |||
126 | #define GIU_IRQ_BASE 40 | 126 | #define GIU_IRQ_BASE 40 |
127 | #define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */ | 127 | #define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */ |
128 | #define GIU_IRQ_LAST GIU_IRQ(31) | 128 | #define GIU_IRQ_LAST GIU_IRQ(31) |
129 | #define GIU_IRQ_TO_PIN(x) ((x) - GIU_IRQ_BASE) /* Pin 0-31 */ | ||
130 | 129 | ||
131 | extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); | 130 | extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); |
132 | extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq)); | 131 | extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq)); |
@@ -197,38 +196,4 @@ extern void vr41xx_disable_csiint(uint16_t mask); | |||
197 | extern void vr41xx_enable_bcuint(void); | 196 | extern void vr41xx_enable_bcuint(void); |
198 | extern void vr41xx_disable_bcuint(void); | 197 | extern void vr41xx_disable_bcuint(void); |
199 | 198 | ||
200 | /* | ||
201 | * General-Purpose I/O Unit | ||
202 | */ | ||
203 | enum { | ||
204 | TRIGGER_LEVEL, | ||
205 | TRIGGER_EDGE, | ||
206 | TRIGGER_EDGE_FALLING, | ||
207 | TRIGGER_EDGE_RISING | ||
208 | }; | ||
209 | |||
210 | enum { | ||
211 | SIGNAL_THROUGH, | ||
212 | SIGNAL_HOLD | ||
213 | }; | ||
214 | |||
215 | extern void vr41xx_set_irq_trigger(int pin, int trigger, int hold); | ||
216 | |||
217 | enum { | ||
218 | LEVEL_LOW, | ||
219 | LEVEL_HIGH | ||
220 | }; | ||
221 | |||
222 | extern void vr41xx_set_irq_level(int pin, int level); | ||
223 | |||
224 | enum { | ||
225 | PIO_INPUT, | ||
226 | PIO_OUTPUT | ||
227 | }; | ||
228 | |||
229 | enum { | ||
230 | DATA_LOW, | ||
231 | DATA_HIGH | ||
232 | }; | ||
233 | |||
234 | #endif /* __NEC_VR41XX_H */ | 199 | #endif /* __NEC_VR41XX_H */ |
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h index ca0eac647a05..7630d1ad2391 100644 --- a/include/asm-parisc/compat.h +++ b/include/asm-parisc/compat.h | |||
@@ -24,7 +24,7 @@ typedef u16 compat_nlink_t; | |||
24 | typedef u16 compat_ipc_pid_t; | 24 | typedef u16 compat_ipc_pid_t; |
25 | typedef s32 compat_daddr_t; | 25 | typedef s32 compat_daddr_t; |
26 | typedef u32 compat_caddr_t; | 26 | typedef u32 compat_caddr_t; |
27 | typedef u32 compat_timer_t; | 27 | typedef s32 compat_timer_t; |
28 | 28 | ||
29 | typedef s32 compat_int_t; | 29 | typedef s32 compat_int_t; |
30 | typedef s32 compat_long_t; | 30 | typedef s32 compat_long_t; |
diff --git a/include/asm-parisc/mmzone.h b/include/asm-parisc/mmzone.h index 928bf50c4693..595d3dce120a 100644 --- a/include/asm-parisc/mmzone.h +++ b/include/asm-parisc/mmzone.h | |||
@@ -19,7 +19,6 @@ extern struct node_map_data node_data[]; | |||
19 | */ | 19 | */ |
20 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) | 20 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) |
21 | 21 | ||
22 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
23 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 22 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
24 | #define node_end_pfn(nid) \ | 23 | #define node_end_pfn(nid) \ |
25 | ({ \ | 24 | ({ \ |
@@ -38,7 +37,7 @@ extern struct node_map_data node_data[]; | |||
38 | ({ \ | 37 | ({ \ |
39 | unsigned long __pfn = (pfn); \ | 38 | unsigned long __pfn = (pfn); \ |
40 | int __node = pfn_to_nid(__pfn); \ | 39 | int __node = pfn_to_nid(__pfn); \ |
41 | &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ | 40 | &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ |
42 | }) | 41 | }) |
43 | 42 | ||
44 | #define page_to_pfn(pg) \ | 43 | #define page_to_pfn(pg) \ |
diff --git a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h index fde77ac35463..9413f67a540b 100644 --- a/include/asm-parisc/smp.h +++ b/include/asm-parisc/smp.h | |||
@@ -51,7 +51,7 @@ extern void smp_send_reschedule(int cpu); | |||
51 | 51 | ||
52 | extern unsigned long cpu_present_mask; | 52 | extern unsigned long cpu_present_mask; |
53 | 53 | ||
54 | #define smp_processor_id() (current_thread_info()->cpu) | 54 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
55 | 55 | ||
56 | #endif /* CONFIG_SMP */ | 56 | #endif /* CONFIG_SMP */ |
57 | 57 | ||
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h index fe9b7f8ae4c6..57bbb76cb6c1 100644 --- a/include/asm-parisc/thread_info.h +++ b/include/asm-parisc/thread_info.h | |||
@@ -12,7 +12,7 @@ struct thread_info { | |||
12 | unsigned long flags; /* thread_info flags (see TIF_*) */ | 12 | unsigned long flags; /* thread_info flags (see TIF_*) */ |
13 | mm_segment_t addr_limit; /* user-level address space limit */ | 13 | mm_segment_t addr_limit; /* user-level address space limit */ |
14 | __u32 cpu; /* current CPU */ | 14 | __u32 cpu; /* current CPU */ |
15 | __s32 preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ | 15 | int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ |
16 | struct restart_block restart_block; | 16 | struct restart_block restart_block; |
17 | }; | 17 | }; |
18 | 18 | ||
diff --git a/include/asm-ppc/agp.h b/include/asm-ppc/agp.h index be27cfa8c5b0..ca9e423307f4 100644 --- a/include/asm-ppc/agp.h +++ b/include/asm-ppc/agp.h | |||
@@ -10,4 +10,14 @@ | |||
10 | #define flush_agp_mappings() | 10 | #define flush_agp_mappings() |
11 | #define flush_agp_cache() mb() | 11 | #define flush_agp_cache() mb() |
12 | 12 | ||
13 | /* Convert a physical address to an address suitable for the GART. */ | ||
14 | #define phys_to_gart(x) (x) | ||
15 | #define gart_to_phys(x) (x) | ||
16 | |||
17 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ | ||
18 | #define alloc_gatt_pages(order) \ | ||
19 | ((char *)__get_free_pages(GFP_KERNEL, (order))) | ||
20 | #define free_gatt_pages(table, order) \ | ||
21 | free_pages((unsigned long)(table), (order)) | ||
22 | |||
13 | #endif | 23 | #endif |
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h index 42fd1068cf2a..c5883dbed63f 100644 --- a/include/asm-ppc/cpm2.h +++ b/include/asm-ppc/cpm2.h | |||
@@ -1039,6 +1039,52 @@ typedef struct im_idma { | |||
1039 | #define CMXSCR_TS4CS_CLK7 0x00000006 /* SCC4 Tx Clock Source is CLK7 */ | 1039 | #define CMXSCR_TS4CS_CLK7 0x00000006 /* SCC4 Tx Clock Source is CLK7 */ |
1040 | #define CMXSCR_TS4CS_CLK8 0x00000007 /* SCC4 Tx Clock Source is CLK8 */ | 1040 | #define CMXSCR_TS4CS_CLK8 0x00000007 /* SCC4 Tx Clock Source is CLK8 */ |
1041 | 1041 | ||
1042 | /*----------------------------------------------------------------------- | ||
1043 | * SIUMCR - SIU Module Configuration Register 4-31 | ||
1044 | */ | ||
1045 | #define SIUMCR_BBD 0x80000000 /* Bus Busy Disable */ | ||
1046 | #define SIUMCR_ESE 0x40000000 /* External Snoop Enable */ | ||
1047 | #define SIUMCR_PBSE 0x20000000 /* Parity Byte Select Enable */ | ||
1048 | #define SIUMCR_CDIS 0x10000000 /* Core Disable */ | ||
1049 | #define SIUMCR_DPPC00 0x00000000 /* Data Parity Pins Configuration*/ | ||
1050 | #define SIUMCR_DPPC01 0x04000000 /* - " - */ | ||
1051 | #define SIUMCR_DPPC10 0x08000000 /* - " - */ | ||
1052 | #define SIUMCR_DPPC11 0x0c000000 /* - " - */ | ||
1053 | #define SIUMCR_L2CPC00 0x00000000 /* L2 Cache Pins Configuration */ | ||
1054 | #define SIUMCR_L2CPC01 0x01000000 /* - " - */ | ||
1055 | #define SIUMCR_L2CPC10 0x02000000 /* - " - */ | ||
1056 | #define SIUMCR_L2CPC11 0x03000000 /* - " - */ | ||
1057 | #define SIUMCR_LBPC00 0x00000000 /* Local Bus Pins Configuration */ | ||
1058 | #define SIUMCR_LBPC01 0x00400000 /* - " - */ | ||
1059 | #define SIUMCR_LBPC10 0x00800000 /* - " - */ | ||
1060 | #define SIUMCR_LBPC11 0x00c00000 /* - " - */ | ||
1061 | #define SIUMCR_APPC00 0x00000000 /* Address Parity Pins Configuration*/ | ||
1062 | #define SIUMCR_APPC01 0x00100000 /* - " - */ | ||
1063 | #define SIUMCR_APPC10 0x00200000 /* - " - */ | ||
1064 | #define SIUMCR_APPC11 0x00300000 /* - " - */ | ||
1065 | #define SIUMCR_CS10PC00 0x00000000 /* CS10 Pin Configuration */ | ||
1066 | #define SIUMCR_CS10PC01 0x00040000 /* - " - */ | ||
1067 | #define SIUMCR_CS10PC10 0x00080000 /* - " - */ | ||
1068 | #define SIUMCR_CS10PC11 0x000c0000 /* - " - */ | ||
1069 | #define SIUMCR_BCTLC00 0x00000000 /* Buffer Control Configuration */ | ||
1070 | #define SIUMCR_BCTLC01 0x00010000 /* - " - */ | ||
1071 | #define SIUMCR_BCTLC10 0x00020000 /* - " - */ | ||
1072 | #define SIUMCR_BCTLC11 0x00030000 /* - " - */ | ||
1073 | #define SIUMCR_MMR00 0x00000000 /* Mask Masters Requests */ | ||
1074 | #define SIUMCR_MMR01 0x00004000 /* - " - */ | ||
1075 | #define SIUMCR_MMR10 0x00008000 /* - " - */ | ||
1076 | #define SIUMCR_MMR11 0x0000c000 /* - " - */ | ||
1077 | #define SIUMCR_LPBSE 0x00002000 /* LocalBus Parity Byte Select Enable*/ | ||
1078 | |||
1079 | /*----------------------------------------------------------------------- | ||
1080 | * SCCR - System Clock Control Register 9-8 | ||
1081 | */ | ||
1082 | #define SCCR_PCI_MODE 0x00000100 /* PCI Mode */ | ||
1083 | #define SCCR_PCI_MODCK 0x00000080 /* Value of PCI_MODCK pin */ | ||
1084 | #define SCCR_PCIDF_MSK 0x00000078 /* PCI division factor */ | ||
1085 | #define SCCR_PCIDF_SHIFT 3 | ||
1086 | |||
1087 | |||
1042 | #endif /* __CPM2__ */ | 1088 | #endif /* __CPM2__ */ |
1043 | #endif /* __KERNEL__ */ | 1089 | #endif /* __KERNEL__ */ |
1044 | 1090 | ||
diff --git a/include/asm-ppc/fsl_ocp.h b/include/asm-ppc/fsl_ocp.h deleted file mode 100644 index 050fbba8d049..000000000000 --- a/include/asm-ppc/fsl_ocp.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-ppc/fsl_ocp.h | ||
3 | * | ||
4 | * Definitions for the on-chip peripherals on Freescale PPC processors | ||
5 | * | ||
6 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
7 | * | ||
8 | * Copyright 2004 Freescale Semiconductor, Inc | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | #ifndef __ASM_FS_OCP_H__ | ||
18 | #define __ASM_FS_OCP_H__ | ||
19 | |||
20 | /* A table of information for supporting the Gianfar Ethernet Controller | ||
21 | * This helps identify which enet controller we are dealing with, | ||
22 | * and what type of enet controller it is | ||
23 | */ | ||
24 | struct ocp_gfar_data { | ||
25 | uint interruptTransmit; | ||
26 | uint interruptError; | ||
27 | uint interruptReceive; | ||
28 | uint interruptPHY; | ||
29 | uint flags; | ||
30 | uint phyid; | ||
31 | uint phyregidx; | ||
32 | unsigned char mac_addr[6]; | ||
33 | }; | ||
34 | |||
35 | /* Flags in the flags field */ | ||
36 | #define GFAR_HAS_COALESCE 0x20 | ||
37 | #define GFAR_HAS_RMON 0x10 | ||
38 | #define GFAR_HAS_MULTI_INTR 0x08 | ||
39 | #define GFAR_FIRM_SET_MACADDR 0x04 | ||
40 | #define GFAR_HAS_PHY_INTR 0x02 /* if not set use a timer */ | ||
41 | #define GFAR_HAS_GIGABIT 0x01 | ||
42 | |||
43 | /* Data structure for I2C support. Just contains a couple flags | ||
44 | * to distinguish various I2C implementations*/ | ||
45 | struct ocp_fs_i2c_data { | ||
46 | uint flags; | ||
47 | }; | ||
48 | |||
49 | /* Flags for I2C */ | ||
50 | #define FS_I2C_SEPARATE_DFSRR 0x02 | ||
51 | #define FS_I2C_CLOCK_5200 0x01 | ||
52 | |||
53 | #endif /* __ASM_FS_OCP_H__ */ | ||
54 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index 06b86be61ed1..a9b33324f562 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h | |||
@@ -176,7 +176,7 @@ static __inline__ int irq_canonicalize(int irq) | |||
176 | */ | 176 | */ |
177 | #include <asm/mpc85xx.h> | 177 | #include <asm/mpc85xx.h> |
178 | 178 | ||
179 | /* The MPC8560 openpic has 32 internal interrupts and 12 external | 179 | /* The MPC8548 openpic has 48 internal interrupts and 12 external |
180 | * interrupts. | 180 | * interrupts. |
181 | * | 181 | * |
182 | * We are "flattening" the interrupt vectors of the cascaded CPM | 182 | * We are "flattening" the interrupt vectors of the cascaded CPM |
@@ -184,7 +184,7 @@ static __inline__ int irq_canonicalize(int irq) | |||
184 | * single integer. | 184 | * single integer. |
185 | */ | 185 | */ |
186 | #define NR_CPM_INTS 64 | 186 | #define NR_CPM_INTS 64 |
187 | #define NR_EPIC_INTS 44 | 187 | #define NR_EPIC_INTS 60 |
188 | #ifndef NR_8259_INTS | 188 | #ifndef NR_8259_INTS |
189 | #define NR_8259_INTS 0 | 189 | #define NR_8259_INTS 0 |
190 | #endif | 190 | #endif |
@@ -223,9 +223,15 @@ static __inline__ int irq_canonicalize(int irq) | |||
223 | #define MPC85xx_IRQ_RIO_RX (12 + MPC85xx_OPENPIC_IRQ_OFFSET) | 223 | #define MPC85xx_IRQ_RIO_RX (12 + MPC85xx_OPENPIC_IRQ_OFFSET) |
224 | #define MPC85xx_IRQ_TSEC1_TX (13 + MPC85xx_OPENPIC_IRQ_OFFSET) | 224 | #define MPC85xx_IRQ_TSEC1_TX (13 + MPC85xx_OPENPIC_IRQ_OFFSET) |
225 | #define MPC85xx_IRQ_TSEC1_RX (14 + MPC85xx_OPENPIC_IRQ_OFFSET) | 225 | #define MPC85xx_IRQ_TSEC1_RX (14 + MPC85xx_OPENPIC_IRQ_OFFSET) |
226 | #define MPC85xx_IRQ_TSEC3_TX (15 + MPC85xx_OPENPIC_IRQ_OFFSET) | ||
227 | #define MPC85xx_IRQ_TSEC3_RX (16 + MPC85xx_OPENPIC_IRQ_OFFSET) | ||
228 | #define MPC85xx_IRQ_TSEC3_ERROR (17 + MPC85xx_OPENPIC_IRQ_OFFSET) | ||
226 | #define MPC85xx_IRQ_TSEC1_ERROR (18 + MPC85xx_OPENPIC_IRQ_OFFSET) | 229 | #define MPC85xx_IRQ_TSEC1_ERROR (18 + MPC85xx_OPENPIC_IRQ_OFFSET) |
227 | #define MPC85xx_IRQ_TSEC2_TX (19 + MPC85xx_OPENPIC_IRQ_OFFSET) | 230 | #define MPC85xx_IRQ_TSEC2_TX (19 + MPC85xx_OPENPIC_IRQ_OFFSET) |
228 | #define MPC85xx_IRQ_TSEC2_RX (20 + MPC85xx_OPENPIC_IRQ_OFFSET) | 231 | #define MPC85xx_IRQ_TSEC2_RX (20 + MPC85xx_OPENPIC_IRQ_OFFSET) |
232 | #define MPC85xx_IRQ_TSEC4_TX (21 + MPC85xx_OPENPIC_IRQ_OFFSET) | ||
233 | #define MPC85xx_IRQ_TSEC4_RX (22 + MPC85xx_OPENPIC_IRQ_OFFSET) | ||
234 | #define MPC85xx_IRQ_TSEC4_ERROR (23 + MPC85xx_OPENPIC_IRQ_OFFSET) | ||
229 | #define MPC85xx_IRQ_TSEC2_ERROR (24 + MPC85xx_OPENPIC_IRQ_OFFSET) | 235 | #define MPC85xx_IRQ_TSEC2_ERROR (24 + MPC85xx_OPENPIC_IRQ_OFFSET) |
230 | #define MPC85xx_IRQ_FEC (25 + MPC85xx_OPENPIC_IRQ_OFFSET) | 236 | #define MPC85xx_IRQ_FEC (25 + MPC85xx_OPENPIC_IRQ_OFFSET) |
231 | #define MPC85xx_IRQ_DUART (26 + MPC85xx_OPENPIC_IRQ_OFFSET) | 237 | #define MPC85xx_IRQ_DUART (26 + MPC85xx_OPENPIC_IRQ_OFFSET) |
@@ -235,18 +241,18 @@ static __inline__ int irq_canonicalize(int irq) | |||
235 | #define MPC85xx_IRQ_CPM (30 + MPC85xx_OPENPIC_IRQ_OFFSET) | 241 | #define MPC85xx_IRQ_CPM (30 + MPC85xx_OPENPIC_IRQ_OFFSET) |
236 | 242 | ||
237 | /* The 12 external interrupt lines */ | 243 | /* The 12 external interrupt lines */ |
238 | #define MPC85xx_IRQ_EXT0 (32 + MPC85xx_OPENPIC_IRQ_OFFSET) | 244 | #define MPC85xx_IRQ_EXT0 (48 + MPC85xx_OPENPIC_IRQ_OFFSET) |
239 | #define MPC85xx_IRQ_EXT1 (33 + MPC85xx_OPENPIC_IRQ_OFFSET) | 245 | #define MPC85xx_IRQ_EXT1 (49 + MPC85xx_OPENPIC_IRQ_OFFSET) |
240 | #define MPC85xx_IRQ_EXT2 (34 + MPC85xx_OPENPIC_IRQ_OFFSET) | 246 | #define MPC85xx_IRQ_EXT2 (50 + MPC85xx_OPENPIC_IRQ_OFFSET) |
241 | #define MPC85xx_IRQ_EXT3 (35 + MPC85xx_OPENPIC_IRQ_OFFSET) | 247 | #define MPC85xx_IRQ_EXT3 (51 + MPC85xx_OPENPIC_IRQ_OFFSET) |
242 | #define MPC85xx_IRQ_EXT4 (36 + MPC85xx_OPENPIC_IRQ_OFFSET) | 248 | #define MPC85xx_IRQ_EXT4 (52 + MPC85xx_OPENPIC_IRQ_OFFSET) |
243 | #define MPC85xx_IRQ_EXT5 (37 + MPC85xx_OPENPIC_IRQ_OFFSET) | 249 | #define MPC85xx_IRQ_EXT5 (53 + MPC85xx_OPENPIC_IRQ_OFFSET) |
244 | #define MPC85xx_IRQ_EXT6 (38 + MPC85xx_OPENPIC_IRQ_OFFSET) | 250 | #define MPC85xx_IRQ_EXT6 (54 + MPC85xx_OPENPIC_IRQ_OFFSET) |
245 | #define MPC85xx_IRQ_EXT7 (39 + MPC85xx_OPENPIC_IRQ_OFFSET) | 251 | #define MPC85xx_IRQ_EXT7 (55 + MPC85xx_OPENPIC_IRQ_OFFSET) |
246 | #define MPC85xx_IRQ_EXT8 (40 + MPC85xx_OPENPIC_IRQ_OFFSET) | 252 | #define MPC85xx_IRQ_EXT8 (56 + MPC85xx_OPENPIC_IRQ_OFFSET) |
247 | #define MPC85xx_IRQ_EXT9 (41 + MPC85xx_OPENPIC_IRQ_OFFSET) | 253 | #define MPC85xx_IRQ_EXT9 (57 + MPC85xx_OPENPIC_IRQ_OFFSET) |
248 | #define MPC85xx_IRQ_EXT10 (42 + MPC85xx_OPENPIC_IRQ_OFFSET) | 254 | #define MPC85xx_IRQ_EXT10 (58 + MPC85xx_OPENPIC_IRQ_OFFSET) |
249 | #define MPC85xx_IRQ_EXT11 (43 + MPC85xx_OPENPIC_IRQ_OFFSET) | 255 | #define MPC85xx_IRQ_EXT11 (59 + MPC85xx_OPENPIC_IRQ_OFFSET) |
250 | 256 | ||
251 | /* CPM related interrupts */ | 257 | /* CPM related interrupts */ |
252 | #define SIU_INT_ERROR ((uint)0x00+CPM_IRQ_OFFSET) | 258 | #define SIU_INT_ERROR ((uint)0x00+CPM_IRQ_OFFSET) |
diff --git a/include/asm-ppc/kexec.h b/include/asm-ppc/kexec.h new file mode 100644 index 000000000000..73191310d8db --- /dev/null +++ b/include/asm-ppc/kexec.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef _PPC_KEXEC_H | ||
2 | #define _PPC_KEXEC_H | ||
3 | |||
4 | #ifdef CONFIG_KEXEC | ||
5 | |||
6 | /* | ||
7 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | ||
8 | * I.e. Maximum page that is mapped directly into kernel memory, | ||
9 | * and kmap is not required. | ||
10 | * | ||
11 | * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct | ||
12 | * calculation for the amount of memory directly mappable into the | ||
13 | * kernel memory space. | ||
14 | */ | ||
15 | |||
16 | /* Maximum physical address we can use pages from */ | ||
17 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) | ||
18 | /* Maximum address we can reach in physical address mode */ | ||
19 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) | ||
20 | /* Maximum address we can use for the control code buffer */ | ||
21 | #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE | ||
22 | |||
23 | #define KEXEC_CONTROL_CODE_SIZE 4096 | ||
24 | |||
25 | /* The native architecture */ | ||
26 | #define KEXEC_ARCH KEXEC_ARCH_PPC | ||
27 | |||
28 | #ifndef __ASSEMBLY__ | ||
29 | |||
30 | struct kimage; | ||
31 | |||
32 | extern void machine_kexec_simple(struct kimage *image); | ||
33 | |||
34 | #endif /* __ASSEMBLY__ */ | ||
35 | |||
36 | #endif /* CONFIG_KEXEC */ | ||
37 | |||
38 | #endif /* _PPC_KEXEC_H */ | ||
diff --git a/include/asm-ppc/m8260_pci.h b/include/asm-ppc/m8260_pci.h index 163a6b91d5b2..bf9e05dd54b5 100644 --- a/include/asm-ppc/m8260_pci.h +++ b/include/asm-ppc/m8260_pci.h | |||
@@ -19,6 +19,7 @@ | |||
19 | * Define the vendor/device ID for the MPC8265. | 19 | * Define the vendor/device ID for the MPC8265. |
20 | */ | 20 | */ |
21 | #define PCI_DEVICE_ID_MPC8265 ((0x18C0 << 16) | PCI_VENDOR_ID_MOTOROLA) | 21 | #define PCI_DEVICE_ID_MPC8265 ((0x18C0 << 16) | PCI_VENDOR_ID_MOTOROLA) |
22 | #define PCI_DEVICE_ID_MPC8272 ((0x18C1 << 16) | PCI_VENDOR_ID_MOTOROLA) | ||
22 | 23 | ||
23 | #define M8265_PCIBR0 0x101ac | 24 | #define M8265_PCIBR0 0x101ac |
24 | #define M8265_PCIBR1 0x101b0 | 25 | #define M8265_PCIBR1 0x101b0 |
diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h index b78d40870c95..1d4ab70a56f3 100644 --- a/include/asm-ppc/machdep.h +++ b/include/asm-ppc/machdep.h | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include <linux/config.h> | 5 | #include <linux/config.h> |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/kexec.h> | ||
7 | 8 | ||
8 | #include <asm/setup.h> | 9 | #include <asm/setup.h> |
9 | #include <asm/page.h> | 10 | #include <asm/page.h> |
@@ -114,6 +115,36 @@ struct machdep_calls { | |||
114 | /* functions for dealing with other cpus */ | 115 | /* functions for dealing with other cpus */ |
115 | struct smp_ops_t *smp_ops; | 116 | struct smp_ops_t *smp_ops; |
116 | #endif /* CONFIG_SMP */ | 117 | #endif /* CONFIG_SMP */ |
118 | |||
119 | #ifdef CONFIG_KEXEC | ||
120 | /* Called to shutdown machine specific hardware not already controlled | ||
121 | * by other drivers. | ||
122 | * XXX Should we move this one out of kexec scope? | ||
123 | */ | ||
124 | void (*machine_shutdown)(void); | ||
125 | |||
126 | /* Called to do the minimal shutdown needed to run a kexec'd kernel | ||
127 | * to run successfully. | ||
128 | * XXX Should we move this one out of kexec scope? | ||
129 | */ | ||
130 | void (*machine_crash_shutdown)(void); | ||
131 | |||
132 | /* Called to do what every setup is needed on image and the | ||
133 | * reboot code buffer. Returns 0 on success. | ||
134 | * Provide your own (maybe dummy) implementation if your platform | ||
135 | * claims to support kexec. | ||
136 | */ | ||
137 | int (*machine_kexec_prepare)(struct kimage *image); | ||
138 | |||
139 | /* Called to handle any machine specific cleanup on image */ | ||
140 | void (*machine_kexec_cleanup)(struct kimage *image); | ||
141 | |||
142 | /* Called to perform the _real_ kexec. | ||
143 | * Do NOT allocate memory or fail here. We are past the point of | ||
144 | * no return. | ||
145 | */ | ||
146 | void (*machine_kexec)(struct kimage *image); | ||
147 | #endif /* CONFIG_KEXEC */ | ||
117 | }; | 148 | }; |
118 | 149 | ||
119 | extern struct machdep_calls ppc_md; | 150 | extern struct machdep_calls ppc_md; |
diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index d465aee1c82e..9205db404c7a 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h | |||
@@ -405,7 +405,7 @@ typedef struct _P601_BAT { | |||
405 | 405 | ||
406 | #define MAS0_TLBSEL(x) ((x << 28) & 0x30000000) | 406 | #define MAS0_TLBSEL(x) ((x << 28) & 0x30000000) |
407 | #define MAS0_ESEL(x) ((x << 16) & 0x0FFF0000) | 407 | #define MAS0_ESEL(x) ((x << 16) & 0x0FFF0000) |
408 | #define MAS0_NV 0x00000FFF | 408 | #define MAS0_NV(x) ((x) & 0x00000FFF) |
409 | 409 | ||
410 | #define MAS1_VALID 0x80000000 | 410 | #define MAS1_VALID 0x80000000 |
411 | #define MAS1_IPROT 0x40000000 | 411 | #define MAS1_IPROT 0x40000000 |
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h index 9222fa6ca172..ccabbce39d85 100644 --- a/include/asm-ppc/mmu_context.h +++ b/include/asm-ppc/mmu_context.h | |||
@@ -63,7 +63,7 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | |||
63 | #define LAST_CONTEXT 255 | 63 | #define LAST_CONTEXT 255 |
64 | #define FIRST_CONTEXT 1 | 64 | #define FIRST_CONTEXT 1 |
65 | 65 | ||
66 | #elif defined(CONFIG_E500) | 66 | #elif defined(CONFIG_E200) || defined(CONFIG_E500) |
67 | #define NO_CONTEXT 256 | 67 | #define NO_CONTEXT 256 |
68 | #define LAST_CONTEXT 255 | 68 | #define LAST_CONTEXT 255 |
69 | #define FIRST_CONTEXT 1 | 69 | #define FIRST_CONTEXT 1 |
diff --git a/include/asm-ppc/mpc10x.h b/include/asm-ppc/mpc10x.h index d8e7e2d6128e..f5196a4efbe0 100644 --- a/include/asm-ppc/mpc10x.h +++ b/include/asm-ppc/mpc10x.h | |||
@@ -159,6 +159,12 @@ extern unsigned long ioremap_base; | |||
159 | #define MPC10X_MAPA_EUMB_BASE (ioremap_base - MPC10X_EUMB_SIZE) | 159 | #define MPC10X_MAPA_EUMB_BASE (ioremap_base - MPC10X_EUMB_SIZE) |
160 | #define MPC10X_MAPB_EUMB_BASE MPC10X_MAPA_EUMB_BASE | 160 | #define MPC10X_MAPB_EUMB_BASE MPC10X_MAPA_EUMB_BASE |
161 | 161 | ||
162 | enum ppc_sys_devices { | ||
163 | MPC10X_IIC1, | ||
164 | MPC10X_DMA0, | ||
165 | MPC10X_DMA1, | ||
166 | MPC10X_DUART, | ||
167 | }; | ||
162 | 168 | ||
163 | int mpc10x_bridge_init(struct pci_controller *hose, | 169 | int mpc10x_bridge_init(struct pci_controller *hose, |
164 | uint current_map, | 170 | uint current_map, |
diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h index d820894e5991..89eb8a2ac693 100644 --- a/include/asm-ppc/mpc8260.h +++ b/include/asm-ppc/mpc8260.h | |||
@@ -41,7 +41,7 @@ | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifdef CONFIG_PCI_8260 | 43 | #ifdef CONFIG_PCI_8260 |
44 | #include <syslib/m8260_pci.h> | 44 | #include <syslib/m82xx_pci.h> |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | /* Make sure the memory translation stuff is there if PCI not used. | 47 | /* Make sure the memory translation stuff is there if PCI not used. |
diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h index 22713e331585..516984ee14b5 100644 --- a/include/asm-ppc/mpc85xx.h +++ b/include/asm-ppc/mpc85xx.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #ifdef CONFIG_MPC8540_ADS | 25 | #ifdef CONFIG_MPC8540_ADS |
26 | #include <platforms/85xx/mpc8540_ads.h> | 26 | #include <platforms/85xx/mpc8540_ads.h> |
27 | #endif | 27 | #endif |
28 | #ifdef CONFIG_MPC8555_CDS | 28 | #if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS) |
29 | #include <platforms/85xx/mpc8555_cds.h> | 29 | #include <platforms/85xx/mpc8555_cds.h> |
30 | #endif | 30 | #endif |
31 | #ifdef CONFIG_MPC8560_ADS | 31 | #ifdef CONFIG_MPC8560_ADS |
@@ -74,7 +74,7 @@ extern unsigned char __res[]; | |||
74 | #define MPC85xx_GUTS_OFFSET (0xe0000) | 74 | #define MPC85xx_GUTS_OFFSET (0xe0000) |
75 | #define MPC85xx_GUTS_SIZE (0x01000) | 75 | #define MPC85xx_GUTS_SIZE (0x01000) |
76 | #define MPC85xx_IIC1_OFFSET (0x03000) | 76 | #define MPC85xx_IIC1_OFFSET (0x03000) |
77 | #define MPC85xx_IIC1_SIZE (0x01000) | 77 | #define MPC85xx_IIC1_SIZE (0x00100) |
78 | #define MPC85xx_OPENPIC_OFFSET (0x40000) | 78 | #define MPC85xx_OPENPIC_OFFSET (0x40000) |
79 | #define MPC85xx_OPENPIC_SIZE (0x40000) | 79 | #define MPC85xx_OPENPIC_SIZE (0x40000) |
80 | #define MPC85xx_PCI1_OFFSET (0x08000) | 80 | #define MPC85xx_PCI1_OFFSET (0x08000) |
@@ -127,8 +127,64 @@ enum ppc_sys_devices { | |||
127 | MPC85xx_CPM_MCC2, | 127 | MPC85xx_CPM_MCC2, |
128 | MPC85xx_CPM_SMC1, | 128 | MPC85xx_CPM_SMC1, |
129 | MPC85xx_CPM_SMC2, | 129 | MPC85xx_CPM_SMC2, |
130 | MPC85xx_eTSEC1, | ||
131 | MPC85xx_eTSEC2, | ||
132 | MPC85xx_eTSEC3, | ||
133 | MPC85xx_eTSEC4, | ||
134 | MPC85xx_IIC2, | ||
130 | }; | 135 | }; |
131 | 136 | ||
137 | /* Internal interrupts are all Level Sensitive, and Positive Polarity */ | ||
138 | #define MPC85XX_INTERNAL_IRQ_SENSES \ | ||
139 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0 */ \ | ||
140 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1 */ \ | ||
141 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2 */ \ | ||
142 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3 */ \ | ||
143 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4 */ \ | ||
144 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5 */ \ | ||
145 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6 */ \ | ||
146 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7 */ \ | ||
147 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8 */ \ | ||
148 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9 */ \ | ||
149 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10 */ \ | ||
150 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11 */ \ | ||
151 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12 */ \ | ||
152 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13 */ \ | ||
153 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14 */ \ | ||
154 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15 */ \ | ||
155 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16 */ \ | ||
156 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17 */ \ | ||
157 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18 */ \ | ||
158 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19 */ \ | ||
159 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20 */ \ | ||
160 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21 */ \ | ||
161 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22 */ \ | ||
162 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23 */ \ | ||
163 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24 */ \ | ||
164 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25 */ \ | ||
165 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26 */ \ | ||
166 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27 */ \ | ||
167 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28 */ \ | ||
168 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29 */ \ | ||
169 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30 */ \ | ||
170 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31 */ \ | ||
171 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 32 */ \ | ||
172 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 33 */ \ | ||
173 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 34 */ \ | ||
174 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 35 */ \ | ||
175 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 36 */ \ | ||
176 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 37 */ \ | ||
177 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 38 */ \ | ||
178 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 39 */ \ | ||
179 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 40 */ \ | ||
180 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 41 */ \ | ||
181 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 42 */ \ | ||
182 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 43 */ \ | ||
183 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 44 */ \ | ||
184 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 45 */ \ | ||
185 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 46 */ \ | ||
186 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE) /* Internal 47 */ | ||
187 | |||
132 | #endif /* CONFIG_85xx */ | 188 | #endif /* CONFIG_85xx */ |
133 | #endif /* __ASM_MPC85xx_H__ */ | 189 | #endif /* __ASM_MPC85xx_H__ */ |
134 | #endif /* __KERNEL__ */ | 190 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-ppc/ocp.h b/include/asm-ppc/ocp.h index b98db3cdae83..983116f59d90 100644 --- a/include/asm-ppc/ocp.h +++ b/include/asm-ppc/ocp.h | |||
@@ -189,7 +189,7 @@ extern void ocp_for_each_device(void(*callback)(struct ocp_device *, void *arg), | |||
189 | /* Sysfs support */ | 189 | /* Sysfs support */ |
190 | #define OCP_SYSFS_ADDTL(type, format, name, field) \ | 190 | #define OCP_SYSFS_ADDTL(type, format, name, field) \ |
191 | static ssize_t \ | 191 | static ssize_t \ |
192 | show_##name##_##field(struct device *dev, char *buf) \ | 192 | show_##name##_##field(struct device *dev, struct device_attribute *attr, char *buf) \ |
193 | { \ | 193 | { \ |
194 | struct ocp_device *odev = to_ocp_dev(dev); \ | 194 | struct ocp_device *odev = to_ocp_dev(dev); \ |
195 | type *add = odev->def->additions; \ | 195 | type *add = odev->def->additions; \ |
@@ -202,10 +202,6 @@ static DEVICE_ATTR(name##_##field, S_IRUGO, show_##name##_##field, NULL); | |||
202 | #include <asm/ibm_ocp.h> | 202 | #include <asm/ibm_ocp.h> |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | #ifdef CONFIG_FSL_OCP | ||
206 | #include <asm/fsl_ocp.h> | ||
207 | #endif | ||
208 | |||
209 | #endif /* CONFIG_PPC_OCP */ | 205 | #endif /* CONFIG_PPC_OCP */ |
210 | #endif /* __OCP_H__ */ | 206 | #endif /* __OCP_H__ */ |
211 | #endif /* __KERNEL__ */ | 207 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index a38606d15549..4d4b20c9de78 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h | |||
@@ -267,8 +267,6 @@ extern unsigned long ioremap_bot, ioremap_base; | |||
267 | #define _PMD_PRESENT_MASK (PAGE_MASK) | 267 | #define _PMD_PRESENT_MASK (PAGE_MASK) |
268 | #define _PMD_BAD (~PAGE_MASK) | 268 | #define _PMD_BAD (~PAGE_MASK) |
269 | 269 | ||
270 | #define NUM_TLBCAMS (16) | ||
271 | |||
272 | #elif defined(CONFIG_8xx) | 270 | #elif defined(CONFIG_8xx) |
273 | /* Definitions for 8xx embedded chips. */ | 271 | /* Definitions for 8xx embedded chips. */ |
274 | #define _PAGE_PRESENT 0x0001 /* Page is valid */ | 272 | #define _PAGE_PRESENT 0x0001 /* Page is valid */ |
diff --git a/include/asm-ppc/ppc_asm.h b/include/asm-ppc/ppc_asm.h index 13fa8e7483c1..f76221def484 100644 --- a/include/asm-ppc/ppc_asm.h +++ b/include/asm-ppc/ppc_asm.h | |||
@@ -174,6 +174,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
174 | #define CLR_TOP32(r) | 174 | #define CLR_TOP32(r) |
175 | #endif /* CONFIG_PPC64BRIDGE */ | 175 | #endif /* CONFIG_PPC64BRIDGE */ |
176 | 176 | ||
177 | #define RFCI .long 0x4c000066 /* rfci instruction */ | ||
178 | #define RFDI .long 0x4c00004e /* rfdi instruction */ | ||
177 | #define RFMCI .long 0x4c00004c /* rfmci instruction */ | 179 | #define RFMCI .long 0x4c00004c /* rfmci instruction */ |
178 | 180 | ||
179 | #ifdef CONFIG_IBM405_ERR77 | 181 | #ifdef CONFIG_IBM405_ERR77 |
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h index 24b991c42769..8ea624566231 100644 --- a/include/asm-ppc/ppc_sys.h +++ b/include/asm-ppc/ppc_sys.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <asm/mpc85xx.h> | 27 | #include <asm/mpc85xx.h> |
28 | #elif defined(CONFIG_PPC_MPC52xx) | 28 | #elif defined(CONFIG_PPC_MPC52xx) |
29 | #include <asm/mpc52xx.h> | 29 | #include <asm/mpc52xx.h> |
30 | #elif defined(CONFIG_MPC10X_BRIDGE) | ||
31 | #include <asm/mpc10x.h> | ||
30 | #else | 32 | #else |
31 | #error "need definition of ppc_sys_devices" | 33 | #error "need definition of ppc_sys_devices" |
32 | #endif | 34 | #endif |
diff --git a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h index c418aab7cd34..88b4222154d4 100644 --- a/include/asm-ppc/reg.h +++ b/include/asm-ppc/reg.h | |||
@@ -160,6 +160,7 @@ | |||
160 | #define HID0_ICFI (1<<11) /* Instr. Cache Flash Invalidate */ | 160 | #define HID0_ICFI (1<<11) /* Instr. Cache Flash Invalidate */ |
161 | #define HID0_DCI (1<<10) /* Data Cache Invalidate */ | 161 | #define HID0_DCI (1<<10) /* Data Cache Invalidate */ |
162 | #define HID0_SPD (1<<9) /* Speculative disable */ | 162 | #define HID0_SPD (1<<9) /* Speculative disable */ |
163 | #define HID0_DAPUEN (1<<8) /* Debug APU enable */ | ||
163 | #define HID0_SGE (1<<7) /* Store Gathering Enable */ | 164 | #define HID0_SGE (1<<7) /* Store Gathering Enable */ |
164 | #define HID0_SIED (1<<7) /* Serial Instr. Execution [Disable] */ | 165 | #define HID0_SIED (1<<7) /* Serial Instr. Execution [Disable] */ |
165 | #define HID0_DFCA (1<<6) /* Data Cache Flush Assist */ | 166 | #define HID0_DFCA (1<<6) /* Data Cache Flush Assist */ |
diff --git a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h index 45c5e6f2b7ab..00ad9c754c78 100644 --- a/include/asm-ppc/reg_booke.h +++ b/include/asm-ppc/reg_booke.h | |||
@@ -165,6 +165,8 @@ do { \ | |||
165 | #define SPRN_MCSRR1 0x23B /* Machine Check Save and Restore Register 1 */ | 165 | #define SPRN_MCSRR1 0x23B /* Machine Check Save and Restore Register 1 */ |
166 | #define SPRN_MCSR 0x23C /* Machine Check Status Register */ | 166 | #define SPRN_MCSR 0x23C /* Machine Check Status Register */ |
167 | #define SPRN_MCAR 0x23D /* Machine Check Address Register */ | 167 | #define SPRN_MCAR 0x23D /* Machine Check Address Register */ |
168 | #define SPRN_DSRR0 0x23E /* Debug Save and Restore Register 0 */ | ||
169 | #define SPRN_DSRR1 0x23F /* Debug Save and Restore Register 1 */ | ||
168 | #define SPRN_MAS0 0x270 /* MMU Assist Register 0 */ | 170 | #define SPRN_MAS0 0x270 /* MMU Assist Register 0 */ |
169 | #define SPRN_MAS1 0x271 /* MMU Assist Register 1 */ | 171 | #define SPRN_MAS1 0x271 /* MMU Assist Register 1 */ |
170 | #define SPRN_MAS2 0x272 /* MMU Assist Register 2 */ | 172 | #define SPRN_MAS2 0x272 /* MMU Assist Register 2 */ |
@@ -264,6 +266,17 @@ do { \ | |||
264 | #define MCSR_BUS_IPERR 0x00000002UL /* Instruction parity Error */ | 266 | #define MCSR_BUS_IPERR 0x00000002UL /* Instruction parity Error */ |
265 | #define MCSR_BUS_RPERR 0x00000001UL /* Read parity Error */ | 267 | #define MCSR_BUS_RPERR 0x00000001UL /* Read parity Error */ |
266 | #endif | 268 | #endif |
269 | #ifdef CONFIG_E200 | ||
270 | #define MCSR_MCP 0x80000000UL /* Machine Check Input Pin */ | ||
271 | #define MCSR_CP_PERR 0x20000000UL /* Cache Push Parity Error */ | ||
272 | #define MCSR_CPERR 0x10000000UL /* Cache Parity Error */ | ||
273 | #define MCSR_EXCP_ERR 0x08000000UL /* ISI, ITLB, or Bus Error on 1st insn | ||
274 | fetch for an exception handler */ | ||
275 | #define MCSR_BUS_IRERR 0x00000010UL /* Read Bus Error on instruction fetch*/ | ||
276 | #define MCSR_BUS_DRERR 0x00000008UL /* Read Bus Error on data load */ | ||
277 | #define MCSR_BUS_WRERR 0x00000004UL /* Write Bus Error on buffered | ||
278 | store or cache line push */ | ||
279 | #endif | ||
267 | 280 | ||
268 | /* Bit definitions for the DBSR. */ | 281 | /* Bit definitions for the DBSR. */ |
269 | /* | 282 | /* |
@@ -311,6 +324,7 @@ do { \ | |||
311 | #define ESR_ST 0x00800000 /* Store Operation */ | 324 | #define ESR_ST 0x00800000 /* Store Operation */ |
312 | #define ESR_DLK 0x00200000 /* Data Cache Locking */ | 325 | #define ESR_DLK 0x00200000 /* Data Cache Locking */ |
313 | #define ESR_ILK 0x00100000 /* Instr. Cache Locking */ | 326 | #define ESR_ILK 0x00100000 /* Instr. Cache Locking */ |
327 | #define ESR_PUO 0x00040000 /* Unimplemented Operation exception */ | ||
314 | #define ESR_BO 0x00020000 /* Byte Ordering */ | 328 | #define ESR_BO 0x00020000 /* Byte Ordering */ |
315 | 329 | ||
316 | /* Bit definitions related to the DBCR0. */ | 330 | /* Bit definitions related to the DBCR0. */ |
@@ -387,10 +401,12 @@ do { \ | |||
387 | #define ICCR_CACHE 1 /* Cacheable */ | 401 | #define ICCR_CACHE 1 /* Cacheable */ |
388 | 402 | ||
389 | /* Bit definitions for L1CSR0. */ | 403 | /* Bit definitions for L1CSR0. */ |
404 | #define L1CSR0_CLFC 0x00000100 /* Cache Lock Bits Flash Clear */ | ||
390 | #define L1CSR0_DCFI 0x00000002 /* Data Cache Flash Invalidate */ | 405 | #define L1CSR0_DCFI 0x00000002 /* Data Cache Flash Invalidate */ |
406 | #define L1CSR0_CFI 0x00000002 /* Cache Flash Invalidate */ | ||
391 | #define L1CSR0_DCE 0x00000001 /* Data Cache Enable */ | 407 | #define L1CSR0_DCE 0x00000001 /* Data Cache Enable */ |
392 | 408 | ||
393 | /* Bit definitions for L1CSR0. */ | 409 | /* Bit definitions for L1CSR1. */ |
394 | #define L1CSR1_ICLFR 0x00000100 /* Instr Cache Lock Bits Flash Reset */ | 410 | #define L1CSR1_ICLFR 0x00000100 /* Instr Cache Lock Bits Flash Reset */ |
395 | #define L1CSR1_ICFI 0x00000002 /* Instr Cache Flash Invalidate */ | 411 | #define L1CSR1_ICFI 0x00000002 /* Instr Cache Flash Invalidate */ |
396 | #define L1CSR1_ICE 0x00000001 /* Instr Cache Enable */ | 412 | #define L1CSR1_ICE 0x00000001 /* Instr Cache Enable */ |
diff --git a/include/asm-ppc/seccomp.h b/include/asm-ppc/seccomp.h new file mode 100644 index 000000000000..666c4da96d87 --- /dev/null +++ b/include/asm-ppc/seccomp.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _ASM_SECCOMP_H | ||
2 | |||
3 | #include <linux/unistd.h> | ||
4 | |||
5 | #define __NR_seccomp_read __NR_read | ||
6 | #define __NR_seccomp_write __NR_write | ||
7 | #define __NR_seccomp_exit __NR_exit | ||
8 | #define __NR_seccomp_sigreturn __NR_rt_sigreturn | ||
9 | |||
10 | #endif /* _ASM_SECCOMP_H */ | ||
diff --git a/include/asm-ppc/sigcontext.h b/include/asm-ppc/sigcontext.h index f82dcccdee1e..b7a417e0a921 100644 --- a/include/asm-ppc/sigcontext.h +++ b/include/asm-ppc/sigcontext.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _ASM_PPC_SIGCONTEXT_H | 2 | #define _ASM_PPC_SIGCONTEXT_H |
3 | 3 | ||
4 | #include <asm/ptrace.h> | 4 | #include <asm/ptrace.h> |
5 | 5 | #include <linux/compiler.h> | |
6 | 6 | ||
7 | struct sigcontext { | 7 | struct sigcontext { |
8 | unsigned long _unused[4]; | 8 | unsigned long _unused[4]; |
diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index ebfb614f55f6..17530c232c76 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h | |||
@@ -44,7 +44,7 @@ extern void smp_message_recv(int, struct pt_regs *); | |||
44 | #define NO_PROC_ID 0xFF /* No processor magic marker */ | 44 | #define NO_PROC_ID 0xFF /* No processor magic marker */ |
45 | #define PROC_CHANGE_PENALTY 20 | 45 | #define PROC_CHANGE_PENALTY 20 |
46 | 46 | ||
47 | #define smp_processor_id() (current_thread_info()->cpu) | 47 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
48 | 48 | ||
49 | extern int __cpu_up(unsigned int cpu); | 49 | extern int __cpu_up(unsigned int cpu); |
50 | 50 | ||
diff --git a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h index f7f01524e8a8..27903db42efc 100644 --- a/include/asm-ppc/thread_info.h +++ b/include/asm-ppc/thread_info.h | |||
@@ -20,7 +20,8 @@ struct thread_info { | |||
20 | unsigned long flags; /* low level flags */ | 20 | unsigned long flags; /* low level flags */ |
21 | unsigned long local_flags; /* non-racy flags */ | 21 | unsigned long local_flags; /* non-racy flags */ |
22 | int cpu; /* cpu we're on */ | 22 | int cpu; /* cpu we're on */ |
23 | int preempt_count; | 23 | int preempt_count; /* 0 => preemptable, |
24 | <0 => BUG */ | ||
24 | struct restart_block restart_block; | 25 | struct restart_block restart_block; |
25 | }; | 26 | }; |
26 | 27 | ||
@@ -77,12 +78,19 @@ static inline struct thread_info *current_thread_info(void) | |||
77 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling | 78 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling |
78 | TIF_NEED_RESCHED */ | 79 | TIF_NEED_RESCHED */ |
79 | #define TIF_MEMDIE 5 | 80 | #define TIF_MEMDIE 5 |
81 | #define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */ | ||
82 | #define TIF_SECCOMP 7 /* secure computing */ | ||
83 | |||
80 | /* as above, but as bit values */ | 84 | /* as above, but as bit values */ |
81 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 85 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
82 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 86 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
83 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 87 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
84 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 88 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
85 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 89 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
90 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | ||
91 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | ||
92 | |||
93 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) | ||
86 | 94 | ||
87 | /* | 95 | /* |
88 | * Non racy (local) flags bit numbers | 96 | * Non racy (local) flags bit numbers |
diff --git a/include/asm-ppc64/agp.h b/include/asm-ppc64/agp.h index be27cfa8c5b0..ca9e423307f4 100644 --- a/include/asm-ppc64/agp.h +++ b/include/asm-ppc64/agp.h | |||
@@ -10,4 +10,14 @@ | |||
10 | #define flush_agp_mappings() | 10 | #define flush_agp_mappings() |
11 | #define flush_agp_cache() mb() | 11 | #define flush_agp_cache() mb() |
12 | 12 | ||
13 | /* Convert a physical address to an address suitable for the GART. */ | ||
14 | #define phys_to_gart(x) (x) | ||
15 | #define gart_to_phys(x) (x) | ||
16 | |||
17 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ | ||
18 | #define alloc_gatt_pages(order) \ | ||
19 | ((char *)__get_free_pages(GFP_KERNEL, (order))) | ||
20 | #define free_gatt_pages(table, order) \ | ||
21 | free_pages((unsigned long)(table), (order)) | ||
22 | |||
13 | #endif | 23 | #endif |
diff --git a/include/asm-ppc64/compat.h b/include/asm-ppc64/compat.h index 09c28d28ce6c..12414f5fc666 100644 --- a/include/asm-ppc64/compat.h +++ b/include/asm-ppc64/compat.h | |||
@@ -26,6 +26,7 @@ typedef s32 compat_daddr_t; | |||
26 | typedef u32 compat_caddr_t; | 26 | typedef u32 compat_caddr_t; |
27 | typedef __kernel_fsid_t compat_fsid_t; | 27 | typedef __kernel_fsid_t compat_fsid_t; |
28 | typedef s32 compat_key_t; | 28 | typedef s32 compat_key_t; |
29 | typedef s32 compat_timer_t; | ||
29 | 30 | ||
30 | typedef s32 compat_int_t; | 31 | typedef s32 compat_int_t; |
31 | typedef s32 compat_long_t; | 32 | typedef s32 compat_long_t; |
diff --git a/include/asm-ppc64/dma.h b/include/asm-ppc64/dma.h index d693b8026bc3..dfd1f69059ba 100644 --- a/include/asm-ppc64/dma.h +++ b/include/asm-ppc64/dma.h | |||
@@ -27,6 +27,8 @@ | |||
27 | /* Doesn't really apply... */ | 27 | /* Doesn't really apply... */ |
28 | #define MAX_DMA_ADDRESS (~0UL) | 28 | #define MAX_DMA_ADDRESS (~0UL) |
29 | 29 | ||
30 | #if !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) | ||
31 | |||
30 | #define dma_outb outb | 32 | #define dma_outb outb |
31 | #define dma_inb inb | 33 | #define dma_inb inb |
32 | 34 | ||
@@ -323,4 +325,5 @@ extern int isa_dma_bridge_buggy; | |||
323 | #else | 325 | #else |
324 | #define isa_dma_bridge_buggy (0) | 326 | #define isa_dma_bridge_buggy (0) |
325 | #endif | 327 | #endif |
328 | #endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */ | ||
326 | #endif /* _ASM_DMA_H */ | 329 | #endif /* _ASM_DMA_H */ |
diff --git a/include/asm-ppc64/elf.h b/include/asm-ppc64/elf.h index 6c42d61bedd1..085eedb956fe 100644 --- a/include/asm-ppc64/elf.h +++ b/include/asm-ppc64/elf.h | |||
@@ -221,9 +221,7 @@ do { \ | |||
221 | set_thread_flag(TIF_ABI_PENDING); \ | 221 | set_thread_flag(TIF_ABI_PENDING); \ |
222 | else \ | 222 | else \ |
223 | clear_thread_flag(TIF_ABI_PENDING); \ | 223 | clear_thread_flag(TIF_ABI_PENDING); \ |
224 | if (ibcs2) \ | 224 | if (personality(current->personality) != PER_LINUX32) \ |
225 | set_personality(PER_SVR4); \ | ||
226 | else if (current->personality != PER_LINUX32) \ | ||
227 | set_personality(PER_LINUX); \ | 225 | set_personality(PER_LINUX); \ |
228 | } while (0) | 226 | } while (0) |
229 | 227 | ||
diff --git a/include/asm-ppc64/iSeries/HvCall.h b/include/asm-ppc64/iSeries/HvCall.h index d9a2e74e2399..c3f19475c0d9 100644 --- a/include/asm-ppc64/iSeries/HvCall.h +++ b/include/asm-ppc64/iSeries/HvCall.h | |||
@@ -1,84 +1,36 @@ | |||
1 | /* | 1 | /* |
2 | * HvCall.h | 2 | * HvCall.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | /* | |
20 | //=========================================================================== | 20 | * This file contains the "hypervisor call" interface which is used to |
21 | // | 21 | * drive the hypervisor from the OS. |
22 | // This file contains the "hypervisor call" interface which is used to | 22 | */ |
23 | // drive the hypervisor from the OS. | ||
24 | // | ||
25 | //=========================================================================== | ||
26 | #ifndef _HVCALL_H | 23 | #ifndef _HVCALL_H |
27 | #define _HVCALL_H | 24 | #define _HVCALL_H |
28 | 25 | ||
29 | //------------------------------------------------------------------- | ||
30 | // Standard Includes | ||
31 | //------------------------------------------------------------------- | ||
32 | #include <asm/iSeries/HvCallSc.h> | 26 | #include <asm/iSeries/HvCallSc.h> |
33 | #include <asm/iSeries/HvTypes.h> | 27 | #include <asm/iSeries/HvTypes.h> |
34 | #include <asm/paca.h> | 28 | #include <asm/paca.h> |
35 | 29 | ||
36 | /* | ||
37 | enum HvCall_ReturnCode | ||
38 | { | ||
39 | HvCall_Good = 0, | ||
40 | HvCall_Partial = 1, | ||
41 | HvCall_NotOwned = 2, | ||
42 | HvCall_NotFreed = 3, | ||
43 | HvCall_UnspecifiedError = 4 | ||
44 | }; | ||
45 | |||
46 | enum HvCall_TypeOfSIT | ||
47 | { | ||
48 | HvCall_ReduceOnly = 0, | ||
49 | HvCall_Unconditional = 1 | ||
50 | }; | ||
51 | |||
52 | enum HvCall_TypeOfYield | ||
53 | { | ||
54 | HvCall_YieldTimed = 0, // Yield until specified time | ||
55 | HvCall_YieldToActive = 1, // Yield until all active procs have run | ||
56 | HvCall_YieldToProc = 2 // Yield until the specified processor has run | ||
57 | }; | ||
58 | |||
59 | enum HvCall_InterruptMasks | ||
60 | { | ||
61 | HvCall_MaskIPI = 0x00000001, | ||
62 | HvCall_MaskLpEvent = 0x00000002, | ||
63 | HvCall_MaskLpProd = 0x00000004, | ||
64 | HvCall_MaskTimeout = 0x00000008 | ||
65 | }; | ||
66 | |||
67 | enum HvCall_VaryOffChunkRc | ||
68 | { | ||
69 | HvCall_VaryOffSucceeded = 0, | ||
70 | HvCall_VaryOffWithdrawn = 1, | ||
71 | HvCall_ChunkInLoadArea = 2, | ||
72 | HvCall_ChunkInHPT = 3, | ||
73 | HvCall_ChunkNotAccessible = 4, | ||
74 | HvCall_ChunkInUse = 5 | ||
75 | }; | ||
76 | */ | ||
77 | |||
78 | /* Type of yield for HvCallBaseYieldProcessor */ | 30 | /* Type of yield for HvCallBaseYieldProcessor */ |
79 | #define HvCall_YieldTimed 0 // Yield until specified time (tb) | 31 | #define HvCall_YieldTimed 0 /* Yield until specified time (tb) */ |
80 | #define HvCall_YieldToActive 1 // Yield until all active procs have run | 32 | #define HvCall_YieldToActive 1 /* Yield until all active procs have run */ |
81 | #define HvCall_YieldToProc 2 // Yield until the specified processor has run | 33 | #define HvCall_YieldToProc 2 /* Yield until the specified processor has run */ |
82 | 34 | ||
83 | /* interrupt masks for setEnabledInterrupts */ | 35 | /* interrupt masks for setEnabledInterrupts */ |
84 | #define HvCall_MaskIPI 0x00000001 | 36 | #define HvCall_MaskIPI 0x00000001 |
@@ -86,7 +38,7 @@ enum HvCall_VaryOffChunkRc | |||
86 | #define HvCall_MaskLpProd 0x00000004 | 38 | #define HvCall_MaskLpProd 0x00000004 |
87 | #define HvCall_MaskTimeout 0x00000008 | 39 | #define HvCall_MaskTimeout 0x00000008 |
88 | 40 | ||
89 | /* Log buffer formats */ | 41 | /* Log buffer formats */ |
90 | #define HvCall_LogBuffer_ASCII 0 | 42 | #define HvCall_LogBuffer_ASCII 0 |
91 | #define HvCall_LogBuffer_EBCDIC 1 | 43 | #define HvCall_LogBuffer_EBCDIC 1 |
92 | 44 | ||
@@ -95,7 +47,7 @@ enum HvCall_VaryOffChunkRc | |||
95 | #define HvCallBaseGetHwPatch HvCallBase + 2 | 47 | #define HvCallBaseGetHwPatch HvCallBase + 2 |
96 | #define HvCallBaseReIplSpAttn HvCallBase + 3 | 48 | #define HvCallBaseReIplSpAttn HvCallBase + 3 |
97 | #define HvCallBaseSetASR HvCallBase + 4 | 49 | #define HvCallBaseSetASR HvCallBase + 4 |
98 | #define HvCallBaseSetASRAndRfi HvCallBase + 5 | 50 | #define HvCallBaseSetASRAndRfi HvCallBase + 5 |
99 | #define HvCallBaseSetIMR HvCallBase + 6 | 51 | #define HvCallBaseSetIMR HvCallBase + 6 |
100 | #define HvCallBaseSendIPI HvCallBase + 7 | 52 | #define HvCallBaseSendIPI HvCallBase + 7 |
101 | #define HvCallBaseTerminateMachine HvCallBase + 8 | 53 | #define HvCallBaseTerminateMachine HvCallBase + 8 |
@@ -115,91 +67,47 @@ enum HvCall_VaryOffChunkRc | |||
115 | #define HvCallBaseGetLogBufferCodePage HvCallBase + 22 | 67 | #define HvCallBaseGetLogBufferCodePage HvCallBase + 22 |
116 | #define HvCallBaseGetLogBufferFormat HvCallBase + 23 | 68 | #define HvCallBaseGetLogBufferFormat HvCallBase + 23 |
117 | #define HvCallBaseGetLogBufferLength HvCallBase + 24 | 69 | #define HvCallBaseGetLogBufferLength HvCallBase + 24 |
118 | #define HvCallBaseReadLogBuffer HvCallBase + 25 | 70 | #define HvCallBaseReadLogBuffer HvCallBase + 25 |
119 | #define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26 | 71 | #define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26 |
120 | #define HvCallBaseWriteLogBuffer HvCallBase + 27 | 72 | #define HvCallBaseWriteLogBuffer HvCallBase + 27 |
121 | #define HvCallBaseRouter28 HvCallBase + 28 | 73 | #define HvCallBaseRouter28 HvCallBase + 28 |
122 | #define HvCallBaseRouter29 HvCallBase + 29 | 74 | #define HvCallBaseRouter29 HvCallBase + 29 |
123 | #define HvCallBaseRouter30 HvCallBase + 30 | 75 | #define HvCallBaseRouter30 HvCallBase + 30 |
124 | #define HvCallBaseSetDebugBus HvCallBase + 31 | 76 | #define HvCallBaseSetDebugBus HvCallBase + 31 |
125 | 77 | ||
126 | #define HvCallCcSetDABR HvCallCc + 7 | 78 | #define HvCallCcSetDABR HvCallCc + 7 |
127 | 79 | ||
128 | //===================================================================================== | 80 | static inline void HvCall_setVirtualDecr(void) |
129 | static inline void HvCall_setVirtualDecr(void) | ||
130 | { | 81 | { |
131 | /* Ignore any error return codes - most likely means that the target value for the | 82 | /* |
132 | * LP has been increased and this vary off would bring us below the new target. */ | 83 | * Ignore any error return codes - most likely means that the |
84 | * target value for the LP has been increased and this vary off | ||
85 | * would bring us below the new target. | ||
86 | */ | ||
133 | HvCall0(HvCallBaseSetVirtualDecr); | 87 | HvCall0(HvCallBaseSetVirtualDecr); |
134 | } | 88 | } |
135 | //===================================================================== | ||
136 | static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm) | ||
137 | { | ||
138 | HvCall2( HvCallBaseYieldProcessor, typeOfYield, yieldParm ); | ||
139 | } | ||
140 | //===================================================================== | ||
141 | static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts) | ||
142 | { | ||
143 | HvCall1(HvCallBaseSetEnabledInterrupts,enabledInterrupts); | ||
144 | } | ||
145 | |||
146 | //===================================================================== | ||
147 | static inline void HvCall_clearLogBuffer(HvLpIndex lpindex) | ||
148 | { | ||
149 | HvCall1(HvCallBaseClearLogBuffer,lpindex); | ||
150 | } | ||
151 | |||
152 | //===================================================================== | ||
153 | static inline u32 HvCall_getLogBufferCodePage(HvLpIndex lpindex) | ||
154 | { | ||
155 | u32 retVal = HvCall1(HvCallBaseGetLogBufferCodePage,lpindex); | ||
156 | return retVal; | ||
157 | } | ||
158 | |||
159 | //===================================================================== | ||
160 | static inline int HvCall_getLogBufferFormat(HvLpIndex lpindex) | ||
161 | { | ||
162 | int retVal = HvCall1(HvCallBaseGetLogBufferFormat,lpindex); | ||
163 | return retVal; | ||
164 | } | ||
165 | |||
166 | //===================================================================== | ||
167 | static inline u32 HvCall_getLogBufferLength(HvLpIndex lpindex) | ||
168 | { | ||
169 | u32 retVal = HvCall1(HvCallBaseGetLogBufferLength,lpindex); | ||
170 | return retVal; | ||
171 | } | ||
172 | 89 | ||
173 | //===================================================================== | 90 | static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm) |
174 | static inline void HvCall_setLogBufferFormatAndCodepage(int format, u32 codePage) | ||
175 | { | 91 | { |
176 | HvCall2(HvCallBaseSetLogBufferFormatAndCodePage,format, codePage); | 92 | HvCall2(HvCallBaseYieldProcessor, typeOfYield, yieldParm); |
177 | } | 93 | } |
178 | 94 | ||
179 | //===================================================================== | 95 | static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts) |
180 | int HvCall_readLogBuffer(HvLpIndex lpindex, void *buffer, u64 bufLen); | ||
181 | void HvCall_writeLogBuffer(const void *buffer, u64 bufLen); | ||
182 | |||
183 | //===================================================================== | ||
184 | static inline void HvCall_sendIPI(struct paca_struct * targetPaca) | ||
185 | { | 96 | { |
186 | HvCall1( HvCallBaseSendIPI, targetPaca->paca_index ); | 97 | HvCall1(HvCallBaseSetEnabledInterrupts, enabledInterrupts); |
187 | } | 98 | } |
188 | 99 | ||
189 | //===================================================================== | 100 | static inline void HvCall_setLogBufferFormatAndCodepage(int format, |
190 | static inline void HvCall_terminateMachineSrc(void) | 101 | u32 codePage) |
191 | { | 102 | { |
192 | HvCall0( HvCallBaseTerminateMachineSrc ); | 103 | HvCall2(HvCallBaseSetLogBufferFormatAndCodePage, format, codePage); |
193 | } | 104 | } |
194 | 105 | ||
195 | static inline void HvCall_setDABR(unsigned long val) | 106 | extern void HvCall_writeLogBuffer(const void *buffer, u64 bufLen); |
196 | { | ||
197 | HvCall1(HvCallCcSetDABR, val); | ||
198 | } | ||
199 | 107 | ||
200 | static inline void HvCall_setDebugBus(unsigned long val) | 108 | static inline void HvCall_sendIPI(struct paca_struct *targetPaca) |
201 | { | 109 | { |
202 | HvCall1(HvCallBaseSetDebugBus, val); | 110 | HvCall1(HvCallBaseSendIPI, targetPaca->paca_index); |
203 | } | 111 | } |
204 | 112 | ||
205 | #endif /* _HVCALL_H */ | 113 | #endif /* _HVCALL_H */ |
diff --git a/include/asm-ppc64/iSeries/HvCallCfg.h b/include/asm-ppc64/iSeries/HvCallCfg.h deleted file mode 100644 index 9f40f16de533..000000000000 --- a/include/asm-ppc64/iSeries/HvCallCfg.h +++ /dev/null | |||
@@ -1,213 +0,0 @@ | |||
1 | /* | ||
2 | * HvCallCfg.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | //===================================================================================== | ||
21 | // | ||
22 | // This file contains the "hypervisor call" interface which is used to | ||
23 | // drive the hypervisor from the OS. | ||
24 | // | ||
25 | //===================================================================================== | ||
26 | #ifndef _HVCALLCFG_H | ||
27 | #define _HVCALLCFG_H | ||
28 | |||
29 | //------------------------------------------------------------------- | ||
30 | // Standard Includes | ||
31 | //------------------------------------------------------------------- | ||
32 | #include <asm/iSeries/HvCallSc.h> | ||
33 | #include <asm/iSeries/HvTypes.h> | ||
34 | |||
35 | //------------------------------------------------------------------------------------- | ||
36 | // Constants | ||
37 | //------------------------------------------------------------------------------------- | ||
38 | |||
39 | enum HvCallCfg_ReqQual | ||
40 | { | ||
41 | HvCallCfg_Cur = 0, | ||
42 | HvCallCfg_Init = 1, | ||
43 | HvCallCfg_Max = 2, | ||
44 | HvCallCfg_Min = 3 | ||
45 | }; | ||
46 | |||
47 | #define HvCallCfgGetLps HvCallCfg + 0 | ||
48 | #define HvCallCfgGetActiveLpMap HvCallCfg + 1 | ||
49 | #define HvCallCfgGetLpVrmIndex HvCallCfg + 2 | ||
50 | #define HvCallCfgGetLpMinSupportedPlicVrmIndex HvCallCfg + 3 | ||
51 | #define HvCallCfgGetLpMinCompatablePlicVrmIndex HvCallCfg + 4 | ||
52 | #define HvCallCfgGetLpVrmName HvCallCfg + 5 | ||
53 | #define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6 | ||
54 | #define HvCallCfgGetPhysicalProcessors HvCallCfg + 7 | ||
55 | #define HvCallCfgGetSystemMsChunks HvCallCfg + 8 | ||
56 | #define HvCallCfgGetMsChunks HvCallCfg + 9 | ||
57 | #define HvCallCfgGetInteractivePercentage HvCallCfg + 10 | ||
58 | #define HvCallCfgIsBusDedicated HvCallCfg + 11 | ||
59 | #define HvCallCfgGetBusOwner HvCallCfg + 12 | ||
60 | #define HvCallCfgGetBusAllocation HvCallCfg + 13 | ||
61 | #define HvCallCfgGetBusUnitOwner HvCallCfg + 14 | ||
62 | #define HvCallCfgGetBusUnitAllocation HvCallCfg + 15 | ||
63 | #define HvCallCfgGetVirtualBusPool HvCallCfg + 16 | ||
64 | #define HvCallCfgGetBusUnitInterruptProc HvCallCfg + 17 | ||
65 | #define HvCallCfgGetConfiguredBusUnitsForIntProc HvCallCfg + 18 | ||
66 | #define HvCallCfgGetRioSanBusPool HvCallCfg + 19 | ||
67 | #define HvCallCfgGetSharedPoolIndex HvCallCfg + 20 | ||
68 | #define HvCallCfgGetSharedProcUnits HvCallCfg + 21 | ||
69 | #define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22 | ||
70 | #define HvCallCfgRouter23 HvCallCfg + 23 | ||
71 | #define HvCallCfgRouter24 HvCallCfg + 24 | ||
72 | #define HvCallCfgRouter25 HvCallCfg + 25 | ||
73 | #define HvCallCfgRouter26 HvCallCfg + 26 | ||
74 | #define HvCallCfgRouter27 HvCallCfg + 27 | ||
75 | #define HvCallCfgGetMinRuntimeMsChunks HvCallCfg + 28 | ||
76 | #define HvCallCfgSetMinRuntimeMsChunks HvCallCfg + 29 | ||
77 | #define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30 | ||
78 | #define HvCallCfgGetLpExecutionMode HvCallCfg + 31 | ||
79 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 | ||
80 | |||
81 | //==================================================================== | ||
82 | static inline HvLpIndex HvCallCfg_getLps(void) | ||
83 | { | ||
84 | HvLpIndex retVal = HvCall0(HvCallCfgGetLps); | ||
85 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
86 | return retVal; | ||
87 | } | ||
88 | //==================================================================== | ||
89 | static inline int HvCallCfg_isBusDedicated(u64 busIndex) | ||
90 | { | ||
91 | int retVal = HvCall1(HvCallCfgIsBusDedicated,busIndex); | ||
92 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
93 | return retVal; | ||
94 | } | ||
95 | //==================================================================== | ||
96 | static inline HvLpIndex HvCallCfg_getBusOwner(u64 busIndex) | ||
97 | { | ||
98 | HvLpIndex retVal = HvCall1(HvCallCfgGetBusOwner,busIndex); | ||
99 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
100 | return retVal; | ||
101 | } | ||
102 | //==================================================================== | ||
103 | static inline HvLpIndexMap HvCallCfg_getBusAllocation(u64 busIndex) | ||
104 | { | ||
105 | HvLpIndexMap retVal = HvCall1(HvCallCfgGetBusAllocation,busIndex); | ||
106 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
107 | return retVal; | ||
108 | } | ||
109 | //==================================================================== | ||
110 | static inline HvLpIndexMap HvCallCfg_getActiveLpMap(void) | ||
111 | { | ||
112 | HvLpIndexMap retVal = HvCall0(HvCallCfgGetActiveLpMap); | ||
113 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
114 | return retVal; | ||
115 | } | ||
116 | //==================================================================== | ||
117 | static inline HvLpVirtualLanIndexMap HvCallCfg_getVirtualLanIndexMap(HvLpIndex lp) | ||
118 | { | ||
119 | // This is a new function in V5R1 so calls to this on older | ||
120 | // hypervisors will return -1 | ||
121 | u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp); | ||
122 | if(retVal == -1) | ||
123 | retVal = 0; | ||
124 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
125 | return retVal; | ||
126 | } | ||
127 | //=================================================================== | ||
128 | static inline u64 HvCallCfg_getSystemMsChunks(void) | ||
129 | { | ||
130 | u64 retVal = HvCall0(HvCallCfgGetSystemMsChunks); | ||
131 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
132 | return retVal; | ||
133 | } | ||
134 | //=================================================================== | ||
135 | static inline u64 HvCallCfg_getMsChunks(HvLpIndex lp,enum HvCallCfg_ReqQual qual) | ||
136 | { | ||
137 | u64 retVal = HvCall2(HvCallCfgGetMsChunks,lp,qual); | ||
138 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
139 | return retVal; | ||
140 | } | ||
141 | //=================================================================== | ||
142 | static inline u64 HvCallCfg_getMinRuntimeMsChunks(HvLpIndex lp) | ||
143 | { | ||
144 | // NOTE: This function was added in v5r1 so older hypervisors will return a -1 value | ||
145 | u64 retVal = HvCall1(HvCallCfgGetMinRuntimeMsChunks,lp); | ||
146 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
147 | return retVal; | ||
148 | } | ||
149 | //=================================================================== | ||
150 | static inline u64 HvCallCfg_setMinRuntimeMsChunks(u64 chunks) | ||
151 | { | ||
152 | u64 retVal = HvCall1(HvCallCfgSetMinRuntimeMsChunks,chunks); | ||
153 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
154 | return retVal; | ||
155 | } | ||
156 | //=================================================================== | ||
157 | static inline u64 HvCallCfg_getSystemPhysicalProcessors(void) | ||
158 | { | ||
159 | u64 retVal = HvCall0(HvCallCfgGetSystemPhysicalProcessors); | ||
160 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
161 | return retVal; | ||
162 | } | ||
163 | //=================================================================== | ||
164 | static inline u64 HvCallCfg_getPhysicalProcessors(HvLpIndex lp,enum HvCallCfg_ReqQual qual) | ||
165 | { | ||
166 | u64 retVal = HvCall2(HvCallCfgGetPhysicalProcessors,lp,qual); | ||
167 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
168 | return retVal; | ||
169 | } | ||
170 | //=================================================================== | ||
171 | static inline u64 HvCallCfg_getConfiguredBusUnitsForInterruptProc(HvLpIndex lp, | ||
172 | u16 hvLogicalProcIndex) | ||
173 | { | ||
174 | u64 retVal = HvCall2(HvCallCfgGetConfiguredBusUnitsForIntProc,lp,hvLogicalProcIndex); | ||
175 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
176 | return retVal; | ||
177 | |||
178 | } | ||
179 | //================================================================== | ||
180 | static inline HvLpSharedPoolIndex HvCallCfg_getSharedPoolIndex(HvLpIndex lp) | ||
181 | { | ||
182 | HvLpSharedPoolIndex retVal = | ||
183 | HvCall1(HvCallCfgGetSharedPoolIndex,lp); | ||
184 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
185 | return retVal; | ||
186 | |||
187 | } | ||
188 | //================================================================== | ||
189 | static inline u64 HvCallCfg_getSharedProcUnits(HvLpIndex lp,enum HvCallCfg_ReqQual qual) | ||
190 | { | ||
191 | u64 retVal = HvCall2(HvCallCfgGetSharedProcUnits,lp,qual); | ||
192 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
193 | return retVal; | ||
194 | |||
195 | } | ||
196 | //================================================================== | ||
197 | static inline u64 HvCallCfg_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) | ||
198 | { | ||
199 | u16 retVal = HvCall1(HvCallCfgGetNumProcsInSharedPool,sPI); | ||
200 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
201 | return retVal; | ||
202 | |||
203 | } | ||
204 | //================================================================== | ||
205 | static inline HvLpIndex HvCallCfg_getHostingLpIndex(HvLpIndex lp) | ||
206 | { | ||
207 | u64 retVal = HvCall1(HvCallCfgGetHostingLpIndex,lp); | ||
208 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
209 | return retVal; | ||
210 | |||
211 | } | ||
212 | |||
213 | #endif /* _HVCALLCFG_H */ | ||
diff --git a/include/asm-ppc64/iSeries/HvCallEvent.h b/include/asm-ppc64/iSeries/HvCallEvent.h index 191ddce0c2c6..5d9a327d0122 100644 --- a/include/asm-ppc64/iSeries/HvCallEvent.h +++ b/include/asm-ppc64/iSeries/HvCallEvent.h | |||
@@ -1,32 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | * HvCallEvent.h | 2 | * HvCallEvent.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | |||
20 | /* | 19 | /* |
21 | * This file contains the "hypervisor call" interface which is used to | 20 | * This file contains the "hypervisor call" interface which is used to |
22 | * drive the hypervisor from the OS. | 21 | * drive the hypervisor from the OS. |
23 | */ | 22 | */ |
24 | #ifndef _HVCALLEVENT_H | 23 | #ifndef _HVCALLEVENT_H |
25 | #define _HVCALLEVENT_H | 24 | #define _HVCALLEVENT_H |
26 | 25 | ||
27 | /* | ||
28 | * Standard Includes | ||
29 | */ | ||
30 | #include <asm/iSeries/HvCallSc.h> | 26 | #include <asm/iSeries/HvCallSc.h> |
31 | #include <asm/iSeries/HvTypes.h> | 27 | #include <asm/iSeries/HvTypes.h> |
32 | #include <asm/abs_addr.h> | 28 | #include <asm/abs_addr.h> |
@@ -71,7 +67,7 @@ typedef u64 HvLpDma_Rc; | |||
71 | #define HvCallEventCloseLpEventPath HvCallEvent + 2 | 67 | #define HvCallEventCloseLpEventPath HvCallEvent + 2 |
72 | #define HvCallEventDmaBufList HvCallEvent + 3 | 68 | #define HvCallEventDmaBufList HvCallEvent + 3 |
73 | #define HvCallEventDmaSingle HvCallEvent + 4 | 69 | #define HvCallEventDmaSingle HvCallEvent + 4 |
74 | #define HvCallEventDmaToSp HvCallEvent + 5 | 70 | #define HvCallEventDmaToSp HvCallEvent + 5 |
75 | #define HvCallEventGetOverflowLpEvents HvCallEvent + 6 | 71 | #define HvCallEventGetOverflowLpEvents HvCallEvent + 6 |
76 | #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7 | 72 | #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7 |
77 | #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8 | 73 | #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8 |
@@ -85,14 +81,12 @@ typedef u64 HvLpDma_Rc; | |||
85 | 81 | ||
86 | static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex) | 82 | static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex) |
87 | { | 83 | { |
88 | HvCall1(HvCallEventGetOverflowLpEvents,queueIndex); | 84 | HvCall1(HvCallEventGetOverflowLpEvents, queueIndex); |
89 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
90 | } | 85 | } |
91 | 86 | ||
92 | static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex) | 87 | static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex) |
93 | { | 88 | { |
94 | HvCall1(HvCallEventSetInterLpQueueIndex,queueIndex); | 89 | HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex); |
95 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
96 | } | 90 | } |
97 | 91 | ||
98 | static inline void HvCallEvent_setLpEventStack(u8 queueIndex, | 92 | static inline void HvCallEvent_setLpEventStack(u8 queueIndex, |
@@ -103,7 +97,6 @@ static inline void HvCallEvent_setLpEventStack(u8 queueIndex, | |||
103 | abs_addr = virt_to_abs(eventStackAddr); | 97 | abs_addr = virt_to_abs(eventStackAddr); |
104 | HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr, | 98 | HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr, |
105 | eventStackSize); | 99 | eventStackSize); |
106 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
107 | } | 100 | } |
108 | 101 | ||
109 | static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, | 102 | static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, |
@@ -111,22 +104,18 @@ static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, | |||
111 | { | 104 | { |
112 | HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex, | 105 | HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex, |
113 | lpLogicalProcIndex); | 106 | lpLogicalProcIndex); |
114 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
115 | } | 107 | } |
116 | 108 | ||
117 | static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) | 109 | static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) |
118 | { | 110 | { |
119 | u64 abs_addr; | 111 | u64 abs_addr; |
120 | HvLpEvent_Rc retVal; | ||
121 | 112 | ||
122 | #ifdef DEBUG_SENDEVENT | 113 | #ifdef DEBUG_SENDEVENT |
123 | printk("HvCallEvent_signalLpEvent: *event = %016lx\n ", | 114 | printk("HvCallEvent_signalLpEvent: *event = %016lx\n ", |
124 | (unsigned long)event); | 115 | (unsigned long)event); |
125 | #endif | 116 | #endif |
126 | abs_addr = virt_to_abs(event); | 117 | abs_addr = virt_to_abs(event); |
127 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventSignalLpEvent, abs_addr); | 118 | return HvCall1(HvCallEventSignalLpEvent, abs_addr); |
128 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
129 | return retVal; | ||
130 | } | 119 | } |
131 | 120 | ||
132 | static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | 121 | static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, |
@@ -136,9 +125,7 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | |||
136 | u64 eventData1, u64 eventData2, u64 eventData3, | 125 | u64 eventData1, u64 eventData2, u64 eventData3, |
137 | u64 eventData4, u64 eventData5) | 126 | u64 eventData4, u64 eventData5) |
138 | { | 127 | { |
139 | HvLpEvent_Rc retVal; | 128 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
140 | |||
141 | // Pack the misc bits into a single Dword to pass to PLIC | ||
142 | union { | 129 | union { |
143 | struct HvCallEvent_PackedParms parms; | 130 | struct HvCallEvent_PackedParms parms; |
144 | u64 dword; | 131 | u64 dword; |
@@ -152,67 +139,49 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | |||
152 | packed.parms.xSourceInstId = sourceInstanceId; | 139 | packed.parms.xSourceInstId = sourceInstanceId; |
153 | packed.parms.xTargetInstId = targetInstanceId; | 140 | packed.parms.xTargetInstId = targetInstanceId; |
154 | 141 | ||
155 | retVal = (HvLpEvent_Rc)HvCall7(HvCallEventSignalLpEventParms, | 142 | return HvCall7(HvCallEventSignalLpEventParms, packed.dword, |
156 | packed.dword, correlationToken, eventData1,eventData2, | 143 | correlationToken, eventData1, eventData2, |
157 | eventData3,eventData4, eventData5); | 144 | eventData3, eventData4, eventData5); |
158 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
159 | return retVal; | ||
160 | } | 145 | } |
161 | 146 | ||
162 | static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) | 147 | static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) |
163 | { | 148 | { |
164 | u64 abs_addr; | 149 | u64 abs_addr; |
165 | HvLpEvent_Rc retVal; | ||
166 | 150 | ||
167 | abs_addr = virt_to_abs(event); | 151 | abs_addr = virt_to_abs(event); |
168 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventAckLpEvent, abs_addr); | 152 | return HvCall1(HvCallEventAckLpEvent, abs_addr); |
169 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
170 | return retVal; | ||
171 | } | 153 | } |
172 | 154 | ||
173 | static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) | 155 | static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) |
174 | { | 156 | { |
175 | u64 abs_addr; | 157 | u64 abs_addr; |
176 | HvLpEvent_Rc retVal; | ||
177 | 158 | ||
178 | abs_addr = virt_to_abs(event); | 159 | abs_addr = virt_to_abs(event); |
179 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventCancelLpEvent, abs_addr); | 160 | return HvCall1(HvCallEventCancelLpEvent, abs_addr); |
180 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
181 | return retVal; | ||
182 | } | 161 | } |
183 | 162 | ||
184 | static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( | 163 | static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( |
185 | HvLpIndex targetLp, HvLpEvent_Type type) | 164 | HvLpIndex targetLp, HvLpEvent_Type type) |
186 | { | 165 | { |
187 | HvLpInstanceId retVal; | 166 | return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type); |
188 | |||
189 | retVal = HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type); | ||
190 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
191 | return retVal; | ||
192 | } | 167 | } |
193 | 168 | ||
194 | static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId( | 169 | static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId( |
195 | HvLpIndex targetLp, HvLpEvent_Type type) | 170 | HvLpIndex targetLp, HvLpEvent_Type type) |
196 | { | 171 | { |
197 | HvLpInstanceId retVal; | 172 | return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type); |
198 | |||
199 | retVal = HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type); | ||
200 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
201 | return retVal; | ||
202 | } | 173 | } |
203 | 174 | ||
204 | static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp, | 175 | static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp, |
205 | HvLpEvent_Type type) | 176 | HvLpEvent_Type type) |
206 | { | 177 | { |
207 | HvCall2(HvCallEventOpenLpEventPath, targetLp, type); | 178 | HvCall2(HvCallEventOpenLpEventPath, targetLp, type); |
208 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
209 | } | 179 | } |
210 | 180 | ||
211 | static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp, | 181 | static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp, |
212 | HvLpEvent_Type type) | 182 | HvLpEvent_Type type) |
213 | { | 183 | { |
214 | HvCall2(HvCallEventCloseLpEventPath, targetLp, type); | 184 | HvCall2(HvCallEventCloseLpEventPath, targetLp, type); |
215 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
216 | } | 185 | } |
217 | 186 | ||
218 | static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, | 187 | static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, |
@@ -224,8 +193,7 @@ static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, | |||
224 | /* Do these need to be converted to absolute addresses? */ | 193 | /* Do these need to be converted to absolute addresses? */ |
225 | u64 localBufList, u64 remoteBufList, u32 transferLength) | 194 | u64 localBufList, u64 remoteBufList, u32 transferLength) |
226 | { | 195 | { |
227 | HvLpDma_Rc retVal; | 196 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
228 | // Pack the misc bits into a single Dword to pass to PLIC | ||
229 | union { | 197 | union { |
230 | struct HvCallEvent_PackedDmaParms parms; | 198 | struct HvCallEvent_PackedDmaParms parms; |
231 | u64 dword; | 199 | u64 dword; |
@@ -241,11 +209,8 @@ static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, | |||
241 | packed.parms.xLocalInstId = localInstanceId; | 209 | packed.parms.xLocalInstId = localInstanceId; |
242 | packed.parms.xRemoteInstId = remoteInstanceId; | 210 | packed.parms.xRemoteInstId = remoteInstanceId; |
243 | 211 | ||
244 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaBufList, | 212 | return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList, |
245 | packed.dword, localBufList, remoteBufList, | 213 | remoteBufList, transferLength); |
246 | transferLength); | ||
247 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
248 | return retVal; | ||
249 | } | 214 | } |
250 | 215 | ||
251 | static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, | 216 | static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, |
@@ -256,8 +221,7 @@ static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, | |||
256 | HvLpDma_AddressType remoteAddressType, | 221 | HvLpDma_AddressType remoteAddressType, |
257 | u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength) | 222 | u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength) |
258 | { | 223 | { |
259 | HvLpDma_Rc retVal; | 224 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
260 | // Pack the misc bits into a single Dword to pass to PLIC | ||
261 | union { | 225 | union { |
262 | struct HvCallEvent_PackedDmaParms parms; | 226 | struct HvCallEvent_PackedDmaParms parms; |
263 | u64 dword; | 227 | u64 dword; |
@@ -273,25 +237,17 @@ static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, | |||
273 | packed.parms.xLocalInstId = localInstanceId; | 237 | packed.parms.xLocalInstId = localInstanceId; |
274 | packed.parms.xRemoteInstId = remoteInstanceId; | 238 | packed.parms.xRemoteInstId = remoteInstanceId; |
275 | 239 | ||
276 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, | 240 | return (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, packed.dword, |
277 | packed.dword, localAddrOrTce, remoteAddrOrTce, | 241 | localAddrOrTce, remoteAddrOrTce, transferLength); |
278 | transferLength); | ||
279 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
280 | return retVal; | ||
281 | } | 242 | } |
282 | 243 | ||
283 | static inline HvLpDma_Rc HvCallEvent_dmaToSp(void* local, u32 remote, | 244 | static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote, |
284 | u32 length, HvLpDma_Direction dir) | 245 | u32 length, HvLpDma_Direction dir) |
285 | { | 246 | { |
286 | u64 abs_addr; | 247 | u64 abs_addr; |
287 | HvLpDma_Rc retVal; | ||
288 | 248 | ||
289 | abs_addr = virt_to_abs(local); | 249 | abs_addr = virt_to_abs(local); |
290 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaToSp, abs_addr, remote, | 250 | return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir); |
291 | length, dir); | ||
292 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
293 | return retVal; | ||
294 | } | 251 | } |
295 | 252 | ||
296 | |||
297 | #endif /* _HVCALLEVENT_H */ | 253 | #endif /* _HVCALLEVENT_H */ |
diff --git a/include/asm-ppc64/iSeries/HvCallHpt.h b/include/asm-ppc64/iSeries/HvCallHpt.h index da769873d18b..66f38222ff75 100644 --- a/include/asm-ppc64/iSeries/HvCallHpt.h +++ b/include/asm-ppc64/iSeries/HvCallHpt.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * HvCallHpt.h | 2 | * HvCallHpt.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,21 +19,15 @@ | |||
19 | #ifndef _HVCALLHPT_H | 19 | #ifndef _HVCALLHPT_H |
20 | #define _HVCALLHPT_H | 20 | #define _HVCALLHPT_H |
21 | 21 | ||
22 | //============================================================================ | 22 | /* |
23 | // | 23 | * This file contains the "hypervisor call" interface which is used to |
24 | // This file contains the "hypervisor call" interface which is used to | 24 | * drive the hypervisor from the OS. |
25 | // drive the hypervisor from the OS. | 25 | */ |
26 | // | ||
27 | //============================================================================ | ||
28 | 26 | ||
29 | #include <asm/iSeries/HvCallSc.h> | 27 | #include <asm/iSeries/HvCallSc.h> |
30 | #include <asm/iSeries/HvTypes.h> | 28 | #include <asm/iSeries/HvTypes.h> |
31 | #include <asm/mmu.h> | 29 | #include <asm/mmu.h> |
32 | 30 | ||
33 | //----------------------------------------------------------------------------- | ||
34 | // Constants | ||
35 | //----------------------------------------------------------------------------- | ||
36 | |||
37 | #define HvCallHptGetHptAddress HvCallHpt + 0 | 31 | #define HvCallHptGetHptAddress HvCallHpt + 0 |
38 | #define HvCallHptGetHptPages HvCallHpt + 1 | 32 | #define HvCallHptGetHptPages HvCallHpt + 1 |
39 | #define HvCallHptSetPp HvCallHpt + 5 | 33 | #define HvCallHptSetPp HvCallHpt + 5 |
@@ -47,81 +41,63 @@ | |||
47 | #define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18 | 41 | #define HvCallHptInvalidateSetSwBitsGet HvCallHpt + 18 |
48 | 42 | ||
49 | 43 | ||
50 | //============================================================================ | 44 | static inline u64 HvCallHpt_getHptAddress(void) |
51 | static inline u64 HvCallHpt_getHptAddress(void) | ||
52 | { | 45 | { |
53 | u64 retval = HvCall0(HvCallHptGetHptAddress); | 46 | return HvCall0(HvCallHptGetHptAddress); |
54 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
55 | return retval; | ||
56 | } | 47 | } |
57 | //============================================================================ | 48 | |
58 | static inline u64 HvCallHpt_getHptPages(void) | 49 | static inline u64 HvCallHpt_getHptPages(void) |
59 | { | 50 | { |
60 | u64 retval = HvCall0(HvCallHptGetHptPages); | 51 | return HvCall0(HvCallHptGetHptPages); |
61 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
62 | return retval; | ||
63 | } | 52 | } |
64 | //============================================================================= | 53 | |
65 | static inline void HvCallHpt_setPp(u32 hpteIndex, u8 value) | 54 | static inline void HvCallHpt_setPp(u32 hpteIndex, u8 value) |
66 | { | 55 | { |
67 | HvCall2( HvCallHptSetPp, hpteIndex, value ); | 56 | HvCall2(HvCallHptSetPp, hpteIndex, value); |
68 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
69 | } | 57 | } |
70 | //============================================================================= | 58 | |
71 | static inline void HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff ) | 59 | static inline void HvCallHpt_setSwBits(u32 hpteIndex, u8 bitson, u8 bitsoff) |
72 | { | 60 | { |
73 | HvCall3( HvCallHptSetSwBits, hpteIndex, bitson, bitsoff ); | 61 | HvCall3(HvCallHptSetSwBits, hpteIndex, bitson, bitsoff); |
74 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
75 | } | 62 | } |
76 | //============================================================================= | 63 | |
77 | static inline void HvCallHpt_invalidateNoSyncICache(u32 hpteIndex) | 64 | static inline void HvCallHpt_invalidateNoSyncICache(u32 hpteIndex) |
78 | |||
79 | { | 65 | { |
80 | HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex ); | 66 | HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex); |
81 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
82 | } | 67 | } |
83 | //============================================================================= | 68 | |
84 | static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson, u8 bitsoff ) | 69 | static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson, |
85 | 70 | u8 bitsoff) | |
86 | { | 71 | { |
87 | u64 compressedStatus; | 72 | u64 compressedStatus; |
88 | compressedStatus = HvCall4( HvCallHptInvalidateSetSwBitsGet, hpteIndex, bitson, bitsoff, 1 ); | 73 | |
89 | HvCall1( HvCallHptInvalidateNoSyncICache, hpteIndex ); | 74 | compressedStatus = HvCall4(HvCallHptInvalidateSetSwBitsGet, |
90 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | 75 | hpteIndex, bitson, bitsoff, 1); |
76 | HvCall1(HvCallHptInvalidateNoSyncICache, hpteIndex); | ||
91 | return compressedStatus; | 77 | return compressedStatus; |
92 | } | 78 | } |
93 | //============================================================================= | 79 | |
94 | static inline u64 HvCallHpt_findValid( HPTE *hpte, u64 vpn ) | 80 | static inline u64 HvCallHpt_findValid(HPTE *hpte, u64 vpn) |
95 | { | 81 | { |
96 | u64 retIndex = HvCall3Ret16( HvCallHptFindValid, hpte, vpn, 0, 0 ); | 82 | return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0); |
97 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
98 | return retIndex; | ||
99 | } | 83 | } |
100 | //============================================================================= | 84 | |
101 | static inline u64 HvCallHpt_findNextValid( HPTE *hpte, u32 hpteIndex, u8 bitson, u8 bitsoff ) | 85 | static inline u64 HvCallHpt_findNextValid(HPTE *hpte, u32 hpteIndex, |
86 | u8 bitson, u8 bitsoff) | ||
102 | { | 87 | { |
103 | u64 retIndex = HvCall3Ret16( HvCallHptFindNextValid, hpte, hpteIndex, bitson, bitsoff ); | 88 | return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex, |
104 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | 89 | bitson, bitsoff); |
105 | return retIndex; | ||
106 | } | 90 | } |
107 | //============================================================================= | 91 | |
108 | static inline void HvCallHpt_get( HPTE *hpte, u32 hpteIndex ) | 92 | static inline void HvCallHpt_get(HPTE *hpte, u32 hpteIndex) |
109 | { | 93 | { |
110 | HvCall2Ret16( HvCallHptGet, hpte, hpteIndex, 0 ); | 94 | HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0); |
111 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
112 | } | 95 | } |
113 | //============================================================================ | 96 | |
114 | static inline void HvCallHpt_addValidate( u32 hpteIndex, | 97 | static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, HPTE *hpte) |
115 | u32 hBit, | ||
116 | HPTE *hpte ) | ||
117 | |||
118 | { | 98 | { |
119 | HvCall4( HvCallHptAddValidate, hpteIndex, | 99 | HvCall4(HvCallHptAddValidate, hpteIndex, hBit, (*((u64 *)hpte)), |
120 | hBit, (*((u64 *)hpte)), (*(((u64 *)hpte)+1)) ); | 100 | (*(((u64 *)hpte)+1))); |
121 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
122 | } | 101 | } |
123 | 102 | ||
124 | |||
125 | //============================================================================= | ||
126 | |||
127 | #endif /* _HVCALLHPT_H */ | 103 | #endif /* _HVCALLHPT_H */ |
diff --git a/include/asm-ppc64/iSeries/HvCallPci.h b/include/asm-ppc64/iSeries/HvCallPci.h index 6887b619288e..c8d675c40f5e 100644 --- a/include/asm-ppc64/iSeries/HvCallPci.h +++ b/include/asm-ppc64/iSeries/HvCallPci.h | |||
@@ -1,26 +1,26 @@ | |||
1 | /************************************************************************/ | 1 | /* |
2 | /* Provides the Hypervisor PCI calls for iSeries Linux Parition. */ | 2 | * Provides the Hypervisor PCI calls for iSeries Linux Parition. |
3 | /* Copyright (C) 2001 <Wayne G Holm> <IBM Corporation> */ | 3 | * Copyright (C) 2001 <Wayne G Holm> <IBM Corporation> |
4 | /* */ | 4 | * |
5 | /* This program is free software; you can redistribute it and/or modify */ | 5 | * This program is free software; you can redistribute it and/or modify |
6 | /* it under the terms of the GNU General Public License as published by */ | 6 | * it under the terms of the GNU General Public License as published by |
7 | /* the Free Software Foundation; either version 2 of the License, or */ | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | /* (at your option) any later version. */ | 8 | * (at your option) any later version. |
9 | /* */ | 9 | * |
10 | /* This program is distributed in the hope that it will be useful, */ | 10 | * This program is distributed in the hope that it will be useful, |
11 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | /* GNU General Public License for more details. */ | 13 | * GNU General Public License for more details. |
14 | /* */ | 14 | * |
15 | /* You should have received a copy of the GNU General Public License */ | 15 | * You should have received a copy of the GNU General Public License |
16 | /* along with this program; if not, write to the: */ | 16 | * along with this program; if not, write to the: |
17 | /* Free Software Foundation, Inc., */ | 17 | * Free Software Foundation, Inc., |
18 | /* 59 Temple Place, Suite 330, */ | 18 | * 59 Temple Place, Suite 330, |
19 | /* Boston, MA 02111-1307 USA */ | 19 | * Boston, MA 02111-1307 USA |
20 | /************************************************************************/ | 20 | * |
21 | /* Change Activity: */ | 21 | * Change Activity: |
22 | /* Created, Jan 9, 2001 */ | 22 | * Created, Jan 9, 2001 |
23 | /************************************************************************/ | 23 | */ |
24 | 24 | ||
25 | #ifndef _HVCALLPCI_H | 25 | #ifndef _HVCALLPCI_H |
26 | #define _HVCALLPCI_H | 26 | #define _HVCALLPCI_H |
@@ -34,8 +34,8 @@ | |||
34 | */ | 34 | */ |
35 | struct HvCallPci_DsaAddr { | 35 | struct HvCallPci_DsaAddr { |
36 | u16 busNumber; /* PHB index? */ | 36 | u16 busNumber; /* PHB index? */ |
37 | u8 subBusNumber; /* PCI bus number? */ | 37 | u8 subBusNumber; /* PCI bus number? */ |
38 | u8 deviceId; /* device and function? */ | 38 | u8 deviceId; /* device and function? */ |
39 | u8 barNumber; | 39 | u8 barNumber; |
40 | u8 reserved[3]; | 40 | u8 reserved[3]; |
41 | }; | 41 | }; |
@@ -52,34 +52,37 @@ struct HvCallPci_LoadReturn { | |||
52 | 52 | ||
53 | enum HvCallPci_DeviceType { | 53 | enum HvCallPci_DeviceType { |
54 | HvCallPci_NodeDevice = 1, | 54 | HvCallPci_NodeDevice = 1, |
55 | HvCallPci_SpDevice = 2, | 55 | HvCallPci_SpDevice = 2, |
56 | HvCallPci_IopDevice = 3, | 56 | HvCallPci_IopDevice = 3, |
57 | HvCallPci_BridgeDevice = 4, | 57 | HvCallPci_BridgeDevice = 4, |
58 | HvCallPci_MultiFunctionDevice = 5, | 58 | HvCallPci_MultiFunctionDevice = 5, |
59 | HvCallPci_IoaDevice = 6 | 59 | HvCallPci_IoaDevice = 6 |
60 | }; | 60 | }; |
61 | 61 | ||
62 | 62 | ||
63 | struct HvCallPci_DeviceInfo { | 63 | struct HvCallPci_DeviceInfo { |
64 | u32 deviceType; // See DeviceType enum for values | 64 | u32 deviceType; /* See DeviceType enum for values */ |
65 | }; | 65 | }; |
66 | 66 | ||
67 | struct HvCallPci_BusUnitInfo { | 67 | struct HvCallPci_BusUnitInfo { |
68 | u32 sizeReturned; // length of data returned | 68 | u32 sizeReturned; /* length of data returned */ |
69 | u32 deviceType; // see DeviceType enum for values | 69 | u32 deviceType; /* see DeviceType enum for values */ |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct HvCallPci_BridgeInfo { | 72 | struct HvCallPci_BridgeInfo { |
73 | struct HvCallPci_BusUnitInfo busUnitInfo; // Generic bus unit info | 73 | struct HvCallPci_BusUnitInfo busUnitInfo; /* Generic bus unit info */ |
74 | u8 subBusNumber; // Bus number of secondary bus | 74 | u8 subBusNumber; /* Bus number of secondary bus */ |
75 | u8 maxAgents; // Max idsels on secondary bus | 75 | u8 maxAgents; /* Max idsels on secondary bus */ |
76 | u8 maxSubBusNumber; // Max Sub Bus | 76 | u8 maxSubBusNumber; /* Max Sub Bus */ |
77 | u8 logicalSlotNumber; // Logical Slot Number for IOA | 77 | u8 logicalSlotNumber; /* Logical Slot Number for IOA */ |
78 | }; | 78 | }; |
79 | |||
80 | 79 | ||
81 | // Maximum BusUnitInfo buffer size. Provided for clients so they can allocate | 80 | |
82 | // a buffer big enough for any type of bus unit. Increase as needed. | 81 | /* |
82 | * Maximum BusUnitInfo buffer size. Provided for clients so | ||
83 | * they can allocate a buffer big enough for any type of bus | ||
84 | * unit. Increase as needed. | ||
85 | */ | ||
83 | enum {HvCallPci_MaxBusUnitInfoSize = 128}; | 86 | enum {HvCallPci_MaxBusUnitInfoSize = 128}; |
84 | 87 | ||
85 | struct HvCallPci_BarParms { | 88 | struct HvCallPci_BarParms { |
@@ -89,12 +92,12 @@ struct HvCallPci_BarParms { | |||
89 | u64 protectStart; | 92 | u64 protectStart; |
90 | u64 protectEnd; | 93 | u64 protectEnd; |
91 | u64 relocationOffset; | 94 | u64 relocationOffset; |
92 | u64 pciAddress; | 95 | u64 pciAddress; |
93 | u64 reserved[3]; | 96 | u64 reserved[3]; |
94 | }; | 97 | }; |
95 | 98 | ||
96 | enum HvCallPci_VpdType { | 99 | enum HvCallPci_VpdType { |
97 | HvCallPci_BusVpd = 1, | 100 | HvCallPci_BusVpd = 1, |
98 | HvCallPci_BusAdapterVpd = 2 | 101 | HvCallPci_BusAdapterVpd = 2 |
99 | }; | 102 | }; |
100 | 103 | ||
@@ -123,15 +126,13 @@ enum HvCallPci_VpdType { | |||
123 | #define HvCallPciUnmaskInterrupts HvCallPci + 49 | 126 | #define HvCallPciUnmaskInterrupts HvCallPci + 49 |
124 | #define HvCallPciGetBusUnitInfo HvCallPci + 50 | 127 | #define HvCallPciGetBusUnitInfo HvCallPci + 50 |
125 | 128 | ||
126 | //============================================================================ | ||
127 | static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber, | 129 | static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber, |
128 | u8 deviceId, u32 offset, | 130 | u8 deviceId, u32 offset, u8 *value) |
129 | u8 *value) | ||
130 | { | 131 | { |
131 | struct HvCallPci_DsaAddr dsa; | 132 | struct HvCallPci_DsaAddr dsa; |
132 | struct HvCallPci_LoadReturn retVal; | 133 | struct HvCallPci_LoadReturn retVal; |
133 | 134 | ||
134 | *((u64*)&dsa) = 0; | 135 | *((u64*)&dsa) = 0; |
135 | 136 | ||
136 | dsa.busNumber = busNumber; | 137 | dsa.busNumber = busNumber; |
137 | dsa.subBusNumber = subBusNumber; | 138 | dsa.subBusNumber = subBusNumber; |
@@ -139,21 +140,18 @@ static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber, | |||
139 | 140 | ||
140 | HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0); | 141 | HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0); |
141 | 142 | ||
142 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
143 | |||
144 | *value = retVal.value; | 143 | *value = retVal.value; |
145 | 144 | ||
146 | return retVal.rc; | 145 | return retVal.rc; |
147 | } | 146 | } |
148 | //============================================================================ | 147 | |
149 | static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber, | 148 | static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber, |
150 | u8 deviceId, u32 offset, | 149 | u8 deviceId, u32 offset, u16 *value) |
151 | u16 *value) | ||
152 | { | 150 | { |
153 | struct HvCallPci_DsaAddr dsa; | 151 | struct HvCallPci_DsaAddr dsa; |
154 | struct HvCallPci_LoadReturn retVal; | 152 | struct HvCallPci_LoadReturn retVal; |
155 | 153 | ||
156 | *((u64*)&dsa) = 0; | 154 | *((u64*)&dsa) = 0; |
157 | 155 | ||
158 | dsa.busNumber = busNumber; | 156 | dsa.busNumber = busNumber; |
159 | dsa.subBusNumber = subBusNumber; | 157 | dsa.subBusNumber = subBusNumber; |
@@ -161,21 +159,18 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber, | |||
161 | 159 | ||
162 | HvCall3Ret16(HvCallPciConfigLoad16, &retVal, *(u64 *)&dsa, offset, 0); | 160 | HvCall3Ret16(HvCallPciConfigLoad16, &retVal, *(u64 *)&dsa, offset, 0); |
163 | 161 | ||
164 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
165 | |||
166 | *value = retVal.value; | 162 | *value = retVal.value; |
167 | 163 | ||
168 | return retVal.rc; | 164 | return retVal.rc; |
169 | } | 165 | } |
170 | //============================================================================ | 166 | |
171 | static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber, | 167 | static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber, |
172 | u8 deviceId, u32 offset, | 168 | u8 deviceId, u32 offset, u32 *value) |
173 | u32 *value) | ||
174 | { | 169 | { |
175 | struct HvCallPci_DsaAddr dsa; | 170 | struct HvCallPci_DsaAddr dsa; |
176 | struct HvCallPci_LoadReturn retVal; | 171 | struct HvCallPci_LoadReturn retVal; |
177 | 172 | ||
178 | *((u64*)&dsa) = 0; | 173 | *((u64*)&dsa) = 0; |
179 | 174 | ||
180 | dsa.busNumber = busNumber; | 175 | dsa.busNumber = busNumber; |
181 | dsa.subBusNumber = subBusNumber; | 176 | dsa.subBusNumber = subBusNumber; |
@@ -183,84 +178,61 @@ static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber, | |||
183 | 178 | ||
184 | HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0); | 179 | HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0); |
185 | 180 | ||
186 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
187 | |||
188 | *value = retVal.value; | 181 | *value = retVal.value; |
189 | 182 | ||
190 | return retVal.rc; | 183 | return retVal.rc; |
191 | } | 184 | } |
192 | //============================================================================ | 185 | |
193 | static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, | 186 | static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, |
194 | u8 deviceId, u32 offset, | 187 | u8 deviceId, u32 offset, u8 value) |
195 | u8 value) | ||
196 | { | 188 | { |
197 | struct HvCallPci_DsaAddr dsa; | 189 | struct HvCallPci_DsaAddr dsa; |
198 | u64 retVal; | ||
199 | 190 | ||
200 | *((u64*)&dsa) = 0; | 191 | *((u64*)&dsa) = 0; |
201 | 192 | ||
202 | dsa.busNumber = busNumber; | 193 | dsa.busNumber = busNumber; |
203 | dsa.subBusNumber = subBusNumber; | 194 | dsa.subBusNumber = subBusNumber; |
204 | dsa.deviceId = deviceId; | 195 | dsa.deviceId = deviceId; |
205 | 196 | ||
206 | retVal = HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0); | 197 | return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0); |
207 | |||
208 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
209 | |||
210 | return retVal; | ||
211 | } | 198 | } |
212 | //============================================================================ | 199 | |
213 | static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber, | 200 | static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber, |
214 | u8 deviceId, u32 offset, | 201 | u8 deviceId, u32 offset, u16 value) |
215 | u16 value) | ||
216 | { | 202 | { |
217 | struct HvCallPci_DsaAddr dsa; | 203 | struct HvCallPci_DsaAddr dsa; |
218 | u64 retVal; | ||
219 | 204 | ||
220 | *((u64*)&dsa) = 0; | 205 | *((u64*)&dsa) = 0; |
221 | 206 | ||
222 | dsa.busNumber = busNumber; | 207 | dsa.busNumber = busNumber; |
223 | dsa.subBusNumber = subBusNumber; | 208 | dsa.subBusNumber = subBusNumber; |
224 | dsa.deviceId = deviceId; | 209 | dsa.deviceId = deviceId; |
225 | 210 | ||
226 | retVal = HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0); | 211 | return HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0); |
227 | |||
228 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
229 | |||
230 | return retVal; | ||
231 | } | 212 | } |
232 | //============================================================================ | 213 | |
233 | static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber, | 214 | static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber, |
234 | u8 deviceId, u32 offset, | 215 | u8 deviceId, u32 offset, u32 value) |
235 | u32 value) | ||
236 | { | 216 | { |
237 | struct HvCallPci_DsaAddr dsa; | 217 | struct HvCallPci_DsaAddr dsa; |
238 | u64 retVal; | ||
239 | 218 | ||
240 | *((u64*)&dsa) = 0; | 219 | *((u64*)&dsa) = 0; |
241 | 220 | ||
242 | dsa.busNumber = busNumber; | 221 | dsa.busNumber = busNumber; |
243 | dsa.subBusNumber = subBusNumber; | 222 | dsa.subBusNumber = subBusNumber; |
244 | dsa.deviceId = deviceId; | 223 | dsa.deviceId = deviceId; |
245 | 224 | ||
246 | retVal = HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0); | 225 | return HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0); |
247 | |||
248 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
249 | |||
250 | return retVal; | ||
251 | } | 226 | } |
252 | //============================================================================ | 227 | |
253 | static inline u64 HvCallPci_barLoad8(u16 busNumberParm, | 228 | static inline u64 HvCallPci_barLoad8(u16 busNumberParm, u8 subBusParm, |
254 | u8 subBusParm, | 229 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
255 | u8 deviceIdParm, | 230 | u8 *valueParm) |
256 | u8 barNumberParm, | ||
257 | u64 offsetParm, | ||
258 | u8* valueParm) | ||
259 | { | 231 | { |
260 | struct HvCallPci_DsaAddr dsa; | 232 | struct HvCallPci_DsaAddr dsa; |
261 | struct HvCallPci_LoadReturn retVal; | 233 | struct HvCallPci_LoadReturn retVal; |
262 | 234 | ||
263 | *((u64*)&dsa) = 0; | 235 | *((u64*)&dsa) = 0; |
264 | 236 | ||
265 | dsa.busNumber = busNumberParm; | 237 | dsa.busNumber = busNumberParm; |
266 | dsa.subBusNumber = subBusParm; | 238 | dsa.subBusNumber = subBusParm; |
@@ -269,24 +241,19 @@ static inline u64 HvCallPci_barLoad8(u16 busNumberParm, | |||
269 | 241 | ||
270 | HvCall3Ret16(HvCallPciBarLoad8, &retVal, *(u64 *)&dsa, offsetParm, 0); | 242 | HvCall3Ret16(HvCallPciBarLoad8, &retVal, *(u64 *)&dsa, offsetParm, 0); |
271 | 243 | ||
272 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
273 | |||
274 | *valueParm = retVal.value; | 244 | *valueParm = retVal.value; |
275 | 245 | ||
276 | return retVal.rc; | 246 | return retVal.rc; |
277 | } | 247 | } |
278 | //============================================================================ | 248 | |
279 | static inline u64 HvCallPci_barLoad16(u16 busNumberParm, | 249 | static inline u64 HvCallPci_barLoad16(u16 busNumberParm, u8 subBusParm, |
280 | u8 subBusParm, | 250 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
281 | u8 deviceIdParm, | 251 | u16 *valueParm) |
282 | u8 barNumberParm, | ||
283 | u64 offsetParm, | ||
284 | u16* valueParm) | ||
285 | { | 252 | { |
286 | struct HvCallPci_DsaAddr dsa; | 253 | struct HvCallPci_DsaAddr dsa; |
287 | struct HvCallPci_LoadReturn retVal; | 254 | struct HvCallPci_LoadReturn retVal; |
288 | 255 | ||
289 | *((u64*)&dsa) = 0; | 256 | *((u64*)&dsa) = 0; |
290 | 257 | ||
291 | dsa.busNumber = busNumberParm; | 258 | dsa.busNumber = busNumberParm; |
292 | dsa.subBusNumber = subBusParm; | 259 | dsa.subBusNumber = subBusParm; |
@@ -295,24 +262,19 @@ static inline u64 HvCallPci_barLoad16(u16 busNumberParm, | |||
295 | 262 | ||
296 | HvCall3Ret16(HvCallPciBarLoad16, &retVal, *(u64 *)&dsa, offsetParm, 0); | 263 | HvCall3Ret16(HvCallPciBarLoad16, &retVal, *(u64 *)&dsa, offsetParm, 0); |
297 | 264 | ||
298 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
299 | |||
300 | *valueParm = retVal.value; | 265 | *valueParm = retVal.value; |
301 | 266 | ||
302 | return retVal.rc; | 267 | return retVal.rc; |
303 | } | 268 | } |
304 | //============================================================================ | 269 | |
305 | static inline u64 HvCallPci_barLoad32(u16 busNumberParm, | 270 | static inline u64 HvCallPci_barLoad32(u16 busNumberParm, u8 subBusParm, |
306 | u8 subBusParm, | 271 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
307 | u8 deviceIdParm, | 272 | u32 *valueParm) |
308 | u8 barNumberParm, | ||
309 | u64 offsetParm, | ||
310 | u32* valueParm) | ||
311 | { | 273 | { |
312 | struct HvCallPci_DsaAddr dsa; | 274 | struct HvCallPci_DsaAddr dsa; |
313 | struct HvCallPci_LoadReturn retVal; | 275 | struct HvCallPci_LoadReturn retVal; |
314 | 276 | ||
315 | *((u64*)&dsa) = 0; | 277 | *((u64*)&dsa) = 0; |
316 | 278 | ||
317 | dsa.busNumber = busNumberParm; | 279 | dsa.busNumber = busNumberParm; |
318 | dsa.subBusNumber = subBusParm; | 280 | dsa.subBusNumber = subBusParm; |
@@ -321,24 +283,19 @@ static inline u64 HvCallPci_barLoad32(u16 busNumberParm, | |||
321 | 283 | ||
322 | HvCall3Ret16(HvCallPciBarLoad32, &retVal, *(u64 *)&dsa, offsetParm, 0); | 284 | HvCall3Ret16(HvCallPciBarLoad32, &retVal, *(u64 *)&dsa, offsetParm, 0); |
323 | 285 | ||
324 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
325 | |||
326 | *valueParm = retVal.value; | 286 | *valueParm = retVal.value; |
327 | 287 | ||
328 | return retVal.rc; | 288 | return retVal.rc; |
329 | } | 289 | } |
330 | //============================================================================ | 290 | |
331 | static inline u64 HvCallPci_barLoad64(u16 busNumberParm, | 291 | static inline u64 HvCallPci_barLoad64(u16 busNumberParm, u8 subBusParm, |
332 | u8 subBusParm, | 292 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
333 | u8 deviceIdParm, | 293 | u64 *valueParm) |
334 | u8 barNumberParm, | ||
335 | u64 offsetParm, | ||
336 | u64* valueParm) | ||
337 | { | 294 | { |
338 | struct HvCallPci_DsaAddr dsa; | 295 | struct HvCallPci_DsaAddr dsa; |
339 | struct HvCallPci_LoadReturn retVal; | 296 | struct HvCallPci_LoadReturn retVal; |
340 | 297 | ||
341 | *((u64*)&dsa) = 0; | 298 | *((u64*)&dsa) = 0; |
342 | 299 | ||
343 | dsa.busNumber = busNumberParm; | 300 | dsa.busNumber = busNumberParm; |
344 | dsa.subBusNumber = subBusParm; | 301 | dsa.subBusNumber = subBusParm; |
@@ -347,112 +304,81 @@ static inline u64 HvCallPci_barLoad64(u16 busNumberParm, | |||
347 | 304 | ||
348 | HvCall3Ret16(HvCallPciBarLoad64, &retVal, *(u64 *)&dsa, offsetParm, 0); | 305 | HvCall3Ret16(HvCallPciBarLoad64, &retVal, *(u64 *)&dsa, offsetParm, 0); |
349 | 306 | ||
350 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
351 | |||
352 | *valueParm = retVal.value; | 307 | *valueParm = retVal.value; |
353 | 308 | ||
354 | return retVal.rc; | 309 | return retVal.rc; |
355 | } | 310 | } |
356 | //============================================================================ | 311 | |
357 | static inline u64 HvCallPci_barStore8(u16 busNumberParm, | 312 | static inline u64 HvCallPci_barStore8(u16 busNumberParm, u8 subBusParm, |
358 | u8 subBusParm, | 313 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
359 | u8 deviceIdParm, | 314 | u8 valueParm) |
360 | u8 barNumberParm, | ||
361 | u64 offsetParm, | ||
362 | u8 valueParm) | ||
363 | { | 315 | { |
364 | struct HvCallPci_DsaAddr dsa; | 316 | struct HvCallPci_DsaAddr dsa; |
365 | u64 retVal; | ||
366 | 317 | ||
367 | *((u64*)&dsa) = 0; | 318 | *((u64*)&dsa) = 0; |
368 | 319 | ||
369 | dsa.busNumber = busNumberParm; | 320 | dsa.busNumber = busNumberParm; |
370 | dsa.subBusNumber = subBusParm; | 321 | dsa.subBusNumber = subBusParm; |
371 | dsa.deviceId = deviceIdParm; | 322 | dsa.deviceId = deviceIdParm; |
372 | dsa.barNumber = barNumberParm; | 323 | dsa.barNumber = barNumberParm; |
373 | 324 | ||
374 | retVal = HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm, valueParm, 0); | 325 | return HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm, |
375 | 326 | valueParm, 0); | |
376 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
377 | |||
378 | return retVal; | ||
379 | } | 327 | } |
380 | //============================================================================ | 328 | |
381 | static inline u64 HvCallPci_barStore16(u16 busNumberParm, | 329 | static inline u64 HvCallPci_barStore16(u16 busNumberParm, u8 subBusParm, |
382 | u8 subBusParm, | 330 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
383 | u8 deviceIdParm, | 331 | u16 valueParm) |
384 | u8 barNumberParm, | ||
385 | u64 offsetParm, | ||
386 | u16 valueParm) | ||
387 | { | 332 | { |
388 | struct HvCallPci_DsaAddr dsa; | 333 | struct HvCallPci_DsaAddr dsa; |
389 | u64 retVal; | ||
390 | 334 | ||
391 | *((u64*)&dsa) = 0; | 335 | *((u64*)&dsa) = 0; |
392 | 336 | ||
393 | dsa.busNumber = busNumberParm; | 337 | dsa.busNumber = busNumberParm; |
394 | dsa.subBusNumber = subBusParm; | 338 | dsa.subBusNumber = subBusParm; |
395 | dsa.deviceId = deviceIdParm; | 339 | dsa.deviceId = deviceIdParm; |
396 | dsa.barNumber = barNumberParm; | 340 | dsa.barNumber = barNumberParm; |
397 | 341 | ||
398 | retVal = HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm, valueParm, 0); | 342 | return HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm, |
399 | 343 | valueParm, 0); | |
400 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
401 | |||
402 | return retVal; | ||
403 | } | 344 | } |
404 | //============================================================================ | 345 | |
405 | static inline u64 HvCallPci_barStore32(u16 busNumberParm, | 346 | static inline u64 HvCallPci_barStore32(u16 busNumberParm, u8 subBusParm, |
406 | u8 subBusParm, | 347 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
407 | u8 deviceIdParm, | 348 | u32 valueParm) |
408 | u8 barNumberParm, | ||
409 | u64 offsetParm, | ||
410 | u32 valueParm) | ||
411 | { | 349 | { |
412 | struct HvCallPci_DsaAddr dsa; | 350 | struct HvCallPci_DsaAddr dsa; |
413 | u64 retVal; | ||
414 | 351 | ||
415 | *((u64*)&dsa) = 0; | 352 | *((u64*)&dsa) = 0; |
416 | 353 | ||
417 | dsa.busNumber = busNumberParm; | 354 | dsa.busNumber = busNumberParm; |
418 | dsa.subBusNumber = subBusParm; | 355 | dsa.subBusNumber = subBusParm; |
419 | dsa.deviceId = deviceIdParm; | 356 | dsa.deviceId = deviceIdParm; |
420 | dsa.barNumber = barNumberParm; | 357 | dsa.barNumber = barNumberParm; |
421 | 358 | ||
422 | retVal = HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm, valueParm, 0); | 359 | return HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm, |
423 | 360 | valueParm, 0); | |
424 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
425 | |||
426 | return retVal; | ||
427 | } | 361 | } |
428 | //============================================================================ | 362 | |
429 | static inline u64 HvCallPci_barStore64(u16 busNumberParm, | 363 | static inline u64 HvCallPci_barStore64(u16 busNumberParm, u8 subBusParm, |
430 | u8 subBusParm, | 364 | u8 deviceIdParm, u8 barNumberParm, u64 offsetParm, |
431 | u8 deviceIdParm, | 365 | u64 valueParm) |
432 | u8 barNumberParm, | ||
433 | u64 offsetParm, | ||
434 | u64 valueParm) | ||
435 | { | 366 | { |
436 | struct HvCallPci_DsaAddr dsa; | 367 | struct HvCallPci_DsaAddr dsa; |
437 | u64 retVal; | ||
438 | 368 | ||
439 | *((u64*)&dsa) = 0; | 369 | *((u64*)&dsa) = 0; |
440 | 370 | ||
441 | dsa.busNumber = busNumberParm; | 371 | dsa.busNumber = busNumberParm; |
442 | dsa.subBusNumber = subBusParm; | 372 | dsa.subBusNumber = subBusParm; |
443 | dsa.deviceId = deviceIdParm; | 373 | dsa.deviceId = deviceIdParm; |
444 | dsa.barNumber = barNumberParm; | 374 | dsa.barNumber = barNumberParm; |
445 | 375 | ||
446 | retVal = HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm, valueParm, 0); | 376 | return HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm, |
447 | 377 | valueParm, 0); | |
448 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
449 | |||
450 | return retVal; | ||
451 | } | 378 | } |
452 | //============================================================================ | 379 | |
453 | static inline u64 HvCallPci_eoi(u16 busNumberParm, | 380 | static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm, |
454 | u8 subBusParm, | 381 | u8 deviceIdParm) |
455 | u8 deviceIdParm) | ||
456 | { | 382 | { |
457 | struct HvCallPci_DsaAddr dsa; | 383 | struct HvCallPci_DsaAddr dsa; |
458 | struct HvCallPci_LoadReturn retVal; | 384 | struct HvCallPci_LoadReturn retVal; |
@@ -465,20 +391,13 @@ static inline u64 HvCallPci_eoi(u16 busNumberParm, | |||
465 | 391 | ||
466 | HvCall1Ret16(HvCallPciEoi, &retVal, *(u64*)&dsa); | 392 | HvCall1Ret16(HvCallPciEoi, &retVal, *(u64*)&dsa); |
467 | 393 | ||
468 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
469 | |||
470 | return retVal.rc; | 394 | return retVal.rc; |
471 | } | 395 | } |
472 | //============================================================================ | 396 | |
473 | static inline u64 HvCallPci_getBarParms(u16 busNumberParm, | 397 | static inline u64 HvCallPci_getBarParms(u16 busNumberParm, u8 subBusParm, |
474 | u8 subBusParm, | 398 | u8 deviceIdParm, u8 barNumberParm, u64 parms, u32 sizeofParms) |
475 | u8 deviceIdParm, | ||
476 | u8 barNumberParm, | ||
477 | u64 parms, | ||
478 | u32 sizeofParms) | ||
479 | { | 399 | { |
480 | struct HvCallPci_DsaAddr dsa; | 400 | struct HvCallPci_DsaAddr dsa; |
481 | u64 retVal; | ||
482 | 401 | ||
483 | *((u64*)&dsa) = 0; | 402 | *((u64*)&dsa) = 0; |
484 | 403 | ||
@@ -487,62 +406,41 @@ static inline u64 HvCallPci_getBarParms(u16 busNumberParm, | |||
487 | dsa.deviceId = deviceIdParm; | 406 | dsa.deviceId = deviceIdParm; |
488 | dsa.barNumber = barNumberParm; | 407 | dsa.barNumber = barNumberParm; |
489 | 408 | ||
490 | retVal = HvCall3(HvCallPciGetBarParms, *(u64*)&dsa, parms, sizeofParms); | 409 | return HvCall3(HvCallPciGetBarParms, *(u64*)&dsa, parms, sizeofParms); |
491 | |||
492 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
493 | |||
494 | return retVal; | ||
495 | } | 410 | } |
496 | //============================================================================ | 411 | |
497 | static inline u64 HvCallPci_maskFisr(u16 busNumberParm, | 412 | static inline u64 HvCallPci_maskFisr(u16 busNumberParm, u8 subBusParm, |
498 | u8 subBusParm, | 413 | u8 deviceIdParm, u64 fisrMask) |
499 | u8 deviceIdParm, | ||
500 | u64 fisrMask) | ||
501 | { | 414 | { |
502 | struct HvCallPci_DsaAddr dsa; | 415 | struct HvCallPci_DsaAddr dsa; |
503 | u64 retVal; | ||
504 | 416 | ||
505 | *((u64*)&dsa) = 0; | 417 | *((u64*)&dsa) = 0; |
506 | 418 | ||
507 | dsa.busNumber = busNumberParm; | 419 | dsa.busNumber = busNumberParm; |
508 | dsa.subBusNumber = subBusParm; | 420 | dsa.subBusNumber = subBusParm; |
509 | dsa.deviceId = deviceIdParm; | 421 | dsa.deviceId = deviceIdParm; |
510 | 422 | ||
511 | retVal = HvCall2(HvCallPciMaskFisr, *(u64*)&dsa, fisrMask); | 423 | return HvCall2(HvCallPciMaskFisr, *(u64*)&dsa, fisrMask); |
512 | |||
513 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
514 | |||
515 | return retVal; | ||
516 | } | 424 | } |
517 | //============================================================================ | 425 | |
518 | static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, | 426 | static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm, |
519 | u8 subBusParm, | 427 | u8 deviceIdParm, u64 fisrMask) |
520 | u8 deviceIdParm, | ||
521 | u64 fisrMask) | ||
522 | { | 428 | { |
523 | struct HvCallPci_DsaAddr dsa; | 429 | struct HvCallPci_DsaAddr dsa; |
524 | u64 retVal; | ||
525 | 430 | ||
526 | *((u64*)&dsa) = 0; | 431 | *((u64*)&dsa) = 0; |
527 | 432 | ||
528 | dsa.busNumber = busNumberParm; | 433 | dsa.busNumber = busNumberParm; |
529 | dsa.subBusNumber = subBusParm; | 434 | dsa.subBusNumber = subBusParm; |
530 | dsa.deviceId = deviceIdParm; | 435 | dsa.deviceId = deviceIdParm; |
531 | 436 | ||
532 | retVal = HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask); | 437 | return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask); |
533 | |||
534 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
535 | |||
536 | return retVal; | ||
537 | } | 438 | } |
538 | //============================================================================ | 439 | |
539 | static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, | 440 | static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, u8 subBusParm, |
540 | u8 subBusParm, | 441 | u8 deviceIdParm, u64 onNotOff) |
541 | u8 deviceIdParm, | ||
542 | u64 onNotOff) | ||
543 | { | 442 | { |
544 | struct HvCallPci_DsaAddr dsa; | 443 | struct HvCallPci_DsaAddr dsa; |
545 | u64 retVal; | ||
546 | 444 | ||
547 | *((u64*)&dsa) = 0; | 445 | *((u64*)&dsa) = 0; |
548 | 446 | ||
@@ -550,21 +448,13 @@ static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, | |||
550 | dsa.subBusNumber = subBusParm; | 448 | dsa.subBusNumber = subBusParm; |
551 | dsa.deviceId = deviceIdParm; | 449 | dsa.deviceId = deviceIdParm; |
552 | 450 | ||
553 | retVal = HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff); | 451 | return HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff); |
554 | |||
555 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
556 | |||
557 | return retVal; | ||
558 | } | 452 | } |
559 | //============================================================================ | 453 | |
560 | static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, | 454 | static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm, |
561 | u8 subBusParm, | 455 | u8 deviceNumberParm, u64 parms, u32 sizeofParms) |
562 | u8 deviceNumberParm, | ||
563 | u64 parms, | ||
564 | u32 sizeofParms) | ||
565 | { | 456 | { |
566 | struct HvCallPci_DsaAddr dsa; | 457 | struct HvCallPci_DsaAddr dsa; |
567 | u64 retVal; | ||
568 | 458 | ||
569 | *((u64*)&dsa) = 0; | 459 | *((u64*)&dsa) = 0; |
570 | 460 | ||
@@ -572,102 +462,72 @@ static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, | |||
572 | dsa.subBusNumber = subBusParm; | 462 | dsa.subBusNumber = subBusParm; |
573 | dsa.deviceId = deviceNumberParm << 4; | 463 | dsa.deviceId = deviceNumberParm << 4; |
574 | 464 | ||
575 | retVal = HvCall3(HvCallPciGetDeviceInfo, *(u64*)&dsa, parms, sizeofParms); | 465 | return HvCall3(HvCallPciGetDeviceInfo, *(u64*)&dsa, parms, sizeofParms); |
576 | |||
577 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
578 | |||
579 | return retVal; | ||
580 | } | 466 | } |
581 | //============================================================================ | 467 | |
582 | static inline u64 HvCallPci_maskInterrupts(u16 busNumberParm, | 468 | static inline u64 HvCallPci_maskInterrupts(u16 busNumberParm, u8 subBusParm, |
583 | u8 subBusParm, | 469 | u8 deviceIdParm, u64 interruptMask) |
584 | u8 deviceIdParm, | ||
585 | u64 interruptMask) | ||
586 | { | 470 | { |
587 | struct HvCallPci_DsaAddr dsa; | 471 | struct HvCallPci_DsaAddr dsa; |
588 | u64 retVal; | ||
589 | 472 | ||
590 | *((u64*)&dsa) = 0; | 473 | *((u64*)&dsa) = 0; |
591 | 474 | ||
592 | dsa.busNumber = busNumberParm; | 475 | dsa.busNumber = busNumberParm; |
593 | dsa.subBusNumber = subBusParm; | 476 | dsa.subBusNumber = subBusParm; |
594 | dsa.deviceId = deviceIdParm; | 477 | dsa.deviceId = deviceIdParm; |
595 | 478 | ||
596 | retVal = HvCall2(HvCallPciMaskInterrupts, *(u64*)&dsa, interruptMask); | 479 | return HvCall2(HvCallPciMaskInterrupts, *(u64*)&dsa, interruptMask); |
597 | |||
598 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
599 | |||
600 | return retVal; | ||
601 | } | 480 | } |
602 | //============================================================================ | 481 | |
603 | static inline u64 HvCallPci_unmaskInterrupts(u16 busNumberParm, | 482 | static inline u64 HvCallPci_unmaskInterrupts(u16 busNumberParm, u8 subBusParm, |
604 | u8 subBusParm, | 483 | u8 deviceIdParm, u64 interruptMask) |
605 | u8 deviceIdParm, | ||
606 | u64 interruptMask) | ||
607 | { | 484 | { |
608 | struct HvCallPci_DsaAddr dsa; | 485 | struct HvCallPci_DsaAddr dsa; |
609 | u64 retVal; | ||
610 | 486 | ||
611 | *((u64*)&dsa) = 0; | 487 | *((u64*)&dsa) = 0; |
612 | 488 | ||
613 | dsa.busNumber = busNumberParm; | 489 | dsa.busNumber = busNumberParm; |
614 | dsa.subBusNumber = subBusParm; | 490 | dsa.subBusNumber = subBusParm; |
615 | dsa.deviceId = deviceIdParm; | 491 | dsa.deviceId = deviceIdParm; |
616 | 492 | ||
617 | retVal = HvCall2(HvCallPciUnmaskInterrupts, *(u64*)&dsa, interruptMask); | 493 | return HvCall2(HvCallPciUnmaskInterrupts, *(u64*)&dsa, interruptMask); |
618 | |||
619 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
620 | |||
621 | return retVal; | ||
622 | } | 494 | } |
623 | //============================================================================ | ||
624 | 495 | ||
625 | static inline u64 HvCallPci_getBusUnitInfo(u16 busNumberParm, | 496 | static inline u64 HvCallPci_getBusUnitInfo(u16 busNumberParm, u8 subBusParm, |
626 | u8 subBusParm, | 497 | u8 deviceIdParm, u64 parms, u32 sizeofParms) |
627 | u8 deviceIdParm, | ||
628 | u64 parms, | ||
629 | u32 sizeofParms) | ||
630 | { | 498 | { |
631 | struct HvCallPci_DsaAddr dsa; | 499 | struct HvCallPci_DsaAddr dsa; |
632 | u64 retVal; | ||
633 | 500 | ||
634 | *((u64*)&dsa) = 0; | 501 | *((u64*)&dsa) = 0; |
635 | 502 | ||
636 | dsa.busNumber = busNumberParm; | 503 | dsa.busNumber = busNumberParm; |
637 | dsa.subBusNumber = subBusParm; | 504 | dsa.subBusNumber = subBusParm; |
638 | dsa.deviceId = deviceIdParm; | 505 | dsa.deviceId = deviceIdParm; |
639 | 506 | ||
640 | retVal = HvCall3(HvCallPciGetBusUnitInfo, *(u64*)&dsa, parms, sizeofParms); | 507 | return HvCall3(HvCallPciGetBusUnitInfo, *(u64*)&dsa, parms, |
641 | 508 | sizeofParms); | |
642 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
643 | |||
644 | return retVal; | ||
645 | } | 509 | } |
646 | //============================================================================ | ||
647 | 510 | ||
648 | static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm, u16 sizeParm) | 511 | static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm, |
512 | u16 sizeParm) | ||
649 | { | 513 | { |
650 | int xRetSize; | 514 | u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, |
651 | u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, sizeParm, HvCallPci_BusVpd); | 515 | sizeParm, HvCallPci_BusVpd); |
652 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
653 | if (xRc == -1) | 516 | if (xRc == -1) |
654 | xRetSize = -1; | 517 | return -1; |
655 | else | 518 | else |
656 | xRetSize = xRc & 0xFFFF; | 519 | return xRc & 0xFFFF; |
657 | return xRetSize; | ||
658 | } | 520 | } |
659 | //============================================================================ | ||
660 | 521 | ||
661 | static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm, u16 sizeParm) | 522 | static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm, |
523 | u16 sizeParm) | ||
662 | { | 524 | { |
663 | int xRetSize; | 525 | u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, |
664 | u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm, sizeParm, HvCallPci_BusAdapterVpd); | 526 | sizeParm, HvCallPci_BusAdapterVpd); |
665 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
666 | if (xRc == -1) | 527 | if (xRc == -1) |
667 | xRetSize = -1; | 528 | return -1; |
668 | else | 529 | else |
669 | xRetSize = xRc & 0xFFFF; | 530 | return xRc & 0xFFFF; |
670 | return xRetSize; | ||
671 | } | 531 | } |
672 | //============================================================================ | 532 | |
673 | #endif /* _HVCALLPCI_H */ | 533 | #endif /* _HVCALLPCI_H */ |
diff --git a/include/asm-ppc64/iSeries/HvCallSc.h b/include/asm-ppc64/iSeries/HvCallSc.h index eea258447642..a62cef3822f9 100644 --- a/include/asm-ppc64/iSeries/HvCallSc.h +++ b/include/asm-ppc64/iSeries/HvCallSc.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * HvCallSc.h | 2 | * HvCallSc.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,7 +19,7 @@ | |||
19 | #ifndef _HVCALLSC_H | 19 | #ifndef _HVCALLSC_H |
20 | #define _HVCALLSC_H | 20 | #define _HVCALLSC_H |
21 | 21 | ||
22 | #include <asm/iSeries/HvTypes.h> | 22 | #include <linux/types.h> |
23 | 23 | ||
24 | #define HvCallBase 0x8000000000000000ul | 24 | #define HvCallBase 0x8000000000000000ul |
25 | #define HvCallCc 0x8001000000000000ul | 25 | #define HvCallCc 0x8001000000000000ul |
@@ -30,22 +30,22 @@ | |||
30 | #define HvCallSm 0x8007000000000000ul | 30 | #define HvCallSm 0x8007000000000000ul |
31 | #define HvCallXm 0x8009000000000000ul | 31 | #define HvCallXm 0x8009000000000000ul |
32 | 32 | ||
33 | u64 HvCall0( u64 ); | 33 | extern u64 HvCall0(u64); |
34 | u64 HvCall1( u64, u64 ); | 34 | extern u64 HvCall1(u64, u64); |
35 | u64 HvCall2( u64, u64, u64 ); | 35 | extern u64 HvCall2(u64, u64, u64); |
36 | u64 HvCall3( u64, u64, u64, u64 ); | 36 | extern u64 HvCall3(u64, u64, u64, u64); |
37 | u64 HvCall4( u64, u64, u64, u64, u64 ); | 37 | extern u64 HvCall4(u64, u64, u64, u64, u64); |
38 | u64 HvCall5( u64, u64, u64, u64, u64, u64 ); | 38 | extern u64 HvCall5(u64, u64, u64, u64, u64, u64); |
39 | u64 HvCall6( u64, u64, u64, u64, u64, u64, u64 ); | 39 | extern u64 HvCall6(u64, u64, u64, u64, u64, u64, u64); |
40 | u64 HvCall7( u64, u64, u64, u64, u64, u64, u64, u64 ); | 40 | extern u64 HvCall7(u64, u64, u64, u64, u64, u64, u64, u64); |
41 | 41 | ||
42 | u64 HvCall0Ret16( u64, void * ); | 42 | extern u64 HvCall0Ret16(u64, void *); |
43 | u64 HvCall1Ret16( u64, void *, u64 ); | 43 | extern u64 HvCall1Ret16(u64, void *, u64); |
44 | u64 HvCall2Ret16( u64, void *, u64, u64 ); | 44 | extern u64 HvCall2Ret16(u64, void *, u64, u64); |
45 | u64 HvCall3Ret16( u64, void *, u64, u64, u64 ); | 45 | extern u64 HvCall3Ret16(u64, void *, u64, u64, u64); |
46 | u64 HvCall4Ret16( u64, void *, u64, u64, u64, u64 ); | 46 | extern u64 HvCall4Ret16(u64, void *, u64, u64, u64, u64); |
47 | u64 HvCall5Ret16( u64, void *, u64, u64, u64, u64, u64 ); | 47 | extern u64 HvCall5Ret16(u64, void *, u64, u64, u64, u64, u64); |
48 | u64 HvCall6Ret16( u64, void *, u64, u64, u64, u64, u64, u64 ); | 48 | extern u64 HvCall6Ret16(u64, void *, u64, u64, u64, u64, u64, u64); |
49 | u64 HvCall7Ret16( u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64 ); | 49 | extern u64 HvCall7Ret16(u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64); |
50 | 50 | ||
51 | #endif /* _HVCALLSC_H */ | 51 | #endif /* _HVCALLSC_H */ |
diff --git a/include/asm-ppc64/iSeries/HvCallSm.h b/include/asm-ppc64/iSeries/HvCallSm.h index 9050c94a529d..8a3dbb071a43 100644 --- a/include/asm-ppc64/iSeries/HvCallSm.h +++ b/include/asm-ppc64/iSeries/HvCallSm.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * HvCallSm.h | 2 | * HvCallSm.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,34 +19,20 @@ | |||
19 | #ifndef _HVCALLSM_H | 19 | #ifndef _HVCALLSM_H |
20 | #define _HVCALLSM_H | 20 | #define _HVCALLSM_H |
21 | 21 | ||
22 | //============================================================================ | 22 | /* |
23 | // | 23 | * This file contains the "hypervisor call" interface which is used to |
24 | // This file contains the "hypervisor call" interface which is used to | 24 | * drive the hypervisor from the OS. |
25 | // drive the hypervisor from the OS. | 25 | */ |
26 | // | ||
27 | //============================================================================ | ||
28 | 26 | ||
29 | //------------------------------------------------------------------- | ||
30 | // Standard Includes | ||
31 | //------------------------------------------------------------------- | ||
32 | #include <asm/iSeries/HvCallSc.h> | 27 | #include <asm/iSeries/HvCallSc.h> |
33 | #include <asm/iSeries/HvTypes.h> | 28 | #include <asm/iSeries/HvTypes.h> |
34 | 29 | ||
35 | //----------------------------------------------------------------------------- | ||
36 | // Constants | ||
37 | //----------------------------------------------------------------------------- | ||
38 | |||
39 | #define HvCallSmGet64BitsOfAccessMap HvCallSm + 11 | 30 | #define HvCallSmGet64BitsOfAccessMap HvCallSm + 11 |
40 | 31 | ||
41 | 32 | static inline u64 HvCallSm_get64BitsOfAccessMap(HvLpIndex lpIndex, | |
42 | //============================================================================ | 33 | u64 indexIntoBitMap) |
43 | static inline u64 HvCallSm_get64BitsOfAccessMap( | ||
44 | HvLpIndex lpIndex, u64 indexIntoBitMap ) | ||
45 | { | 34 | { |
46 | u64 retval = HvCall2(HvCallSmGet64BitsOfAccessMap, lpIndex, | 35 | return HvCall2(HvCallSmGet64BitsOfAccessMap, lpIndex, indexIntoBitMap); |
47 | indexIntoBitMap ); | ||
48 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
49 | return retval; | ||
50 | } | 36 | } |
51 | //============================================================================ | 37 | |
52 | #endif /* _HVCALLSM_H */ | 38 | #endif /* _HVCALLSM_H */ |
diff --git a/include/asm-ppc64/iSeries/HvCallXm.h b/include/asm-ppc64/iSeries/HvCallXm.h index bfb898f4db8d..8b9ba608daaf 100644 --- a/include/asm-ppc64/iSeries/HvCallXm.h +++ b/include/asm-ppc64/iSeries/HvCallXm.h | |||
@@ -1,30 +1,13 @@ | |||
1 | //============================================================================ | 1 | /* |
2 | // Header File Id | 2 | * This file contains the "hypervisor call" interface which is used to |
3 | // Name______________: HvCallXm.H | 3 | * drive the hypervisor from SLIC. |
4 | // | 4 | */ |
5 | // Description_______: | ||
6 | // | ||
7 | // This file contains the "hypervisor call" interface which is used to | ||
8 | // drive the hypervisor from SLIC. | ||
9 | // | ||
10 | //============================================================================ | ||
11 | #ifndef _HVCALLXM_H | 5 | #ifndef _HVCALLXM_H |
12 | #define _HVCALLXM_H | 6 | #define _HVCALLXM_H |
13 | 7 | ||
14 | //------------------------------------------------------------------- | ||
15 | // Forward declarations | ||
16 | //------------------------------------------------------------------- | ||
17 | |||
18 | //------------------------------------------------------------------- | ||
19 | // Standard Includes | ||
20 | //------------------------------------------------------------------- | ||
21 | #include <asm/iSeries/HvCallSc.h> | 8 | #include <asm/iSeries/HvCallSc.h> |
22 | #include <asm/iSeries/HvTypes.h> | 9 | #include <asm/iSeries/HvTypes.h> |
23 | 10 | ||
24 | //----------------------------------------------------------------------------- | ||
25 | // Constants | ||
26 | //----------------------------------------------------------------------------- | ||
27 | |||
28 | #define HvCallXmGetTceTableParms HvCallXm + 0 | 11 | #define HvCallXmGetTceTableParms HvCallXm + 0 |
29 | #define HvCallXmTestBus HvCallXm + 1 | 12 | #define HvCallXmTestBus HvCallXm + 1 |
30 | #define HvCallXmConnectBusUnit HvCallXm + 2 | 13 | #define HvCallXmConnectBusUnit HvCallXm + 2 |
@@ -33,63 +16,63 @@ | |||
33 | #define HvCallXmSetTce HvCallXm + 11 | 16 | #define HvCallXmSetTce HvCallXm + 11 |
34 | #define HvCallXmSetTces HvCallXm + 13 | 17 | #define HvCallXmSetTces HvCallXm + 13 |
35 | 18 | ||
19 | /* | ||
20 | * Structure passed to HvCallXm_getTceTableParms | ||
21 | */ | ||
22 | struct iommu_table_cb { | ||
23 | unsigned long itc_busno; /* Bus number for this tce table */ | ||
24 | unsigned long itc_start; /* Will be NULL for secondary */ | ||
25 | unsigned long itc_totalsize; /* Size (in pages) of whole table */ | ||
26 | unsigned long itc_offset; /* Index into real tce table of the | ||
27 | start of our section */ | ||
28 | unsigned long itc_size; /* Size (in pages) of our section */ | ||
29 | unsigned long itc_index; /* Index of this tce table */ | ||
30 | unsigned short itc_maxtables; /* Max num of tables for partition */ | ||
31 | unsigned char itc_virtbus; /* Flag to indicate virtual bus */ | ||
32 | unsigned char itc_slotno; /* IOA Tce Slot Index */ | ||
33 | unsigned char itc_rsvd[4]; | ||
34 | }; | ||
36 | 35 | ||
37 | 36 | static inline void HvCallXm_getTceTableParms(u64 cb) | |
38 | //============================================================================ | ||
39 | static inline void HvCallXm_getTceTableParms(u64 cb) | ||
40 | { | 37 | { |
41 | HvCall1(HvCallXmGetTceTableParms, cb); | 38 | HvCall1(HvCallXmGetTceTableParms, cb); |
42 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
43 | } | 39 | } |
44 | //============================================================================ | 40 | |
45 | static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce) | 41 | static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce) |
46 | { | 42 | { |
47 | u64 retval = HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce ); | 43 | return HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce); |
48 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
49 | return retval; | ||
50 | } | ||
51 | //============================================================================ | ||
52 | static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset, u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4) | ||
53 | { | ||
54 | u64 retval = HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces, | ||
55 | tce1, tce2, tce3, tce4 ); | ||
56 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
57 | return retval; | ||
58 | } | 44 | } |
59 | //============================================================================= | 45 | |
60 | static inline u64 HvCallXm_testBus(u16 busNumber) | 46 | static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset, |
47 | u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4) | ||
61 | { | 48 | { |
62 | u64 retVal = HvCall1(HvCallXmTestBus, busNumber); | 49 | return HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces, |
63 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | 50 | tce1, tce2, tce3, tce4); |
64 | return retVal; | ||
65 | } | 51 | } |
66 | //===================================================================================== | 52 | |
67 | static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber, u8 deviceId) | 53 | static inline u64 HvCallXm_testBus(u16 busNumber) |
68 | { | 54 | { |
69 | u64 busUnitNumber = (subBusNumber << 8) | deviceId; | 55 | return HvCall1(HvCallXmTestBus, busNumber); |
70 | u64 retVal = HvCall2(HvCallXmTestBusUnit, busNumber, busUnitNumber); | ||
71 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
72 | return retVal; | ||
73 | } | 56 | } |
74 | //===================================================================================== | 57 | |
75 | static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber, u8 deviceId, | 58 | static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber, |
76 | u64 interruptToken) | 59 | u8 deviceId) |
77 | { | 60 | { |
78 | u64 busUnitNumber = (subBusNumber << 8) | deviceId; | 61 | return HvCall2(HvCallXmTestBusUnit, busNumber, |
79 | u64 queueIndex = 0; // HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)); | 62 | (subBusNumber << 8) | deviceId); |
63 | } | ||
80 | 64 | ||
81 | u64 retVal = HvCall5(HvCallXmConnectBusUnit, busNumber, busUnitNumber, | 65 | static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber, |
82 | interruptToken, 0, queueIndex); | 66 | u8 deviceId, u64 interruptToken) |
83 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | 67 | { |
84 | return retVal; | 68 | return HvCall5(HvCallXmConnectBusUnit, busNumber, |
69 | (subBusNumber << 8) | deviceId, interruptToken, 0, | ||
70 | 0 /* HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)) */); | ||
85 | } | 71 | } |
86 | //===================================================================================== | 72 | |
87 | static inline u64 HvCallXm_loadTod(void) | 73 | static inline u64 HvCallXm_loadTod(void) |
88 | { | 74 | { |
89 | u64 retVal = HvCall0(HvCallXmLoadTod); | 75 | return HvCall0(HvCallXmLoadTod); |
90 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | ||
91 | return retVal; | ||
92 | } | 76 | } |
93 | //===================================================================================== | ||
94 | 77 | ||
95 | #endif /* _HVCALLXM_H */ | 78 | #endif /* _HVCALLXM_H */ |
diff --git a/include/asm-ppc64/iSeries/HvLpConfig.h b/include/asm-ppc64/iSeries/HvLpConfig.h index bdbd70f42c9d..f1cf1e70ca3c 100644 --- a/include/asm-ppc64/iSeries/HvLpConfig.h +++ b/include/asm-ppc64/iSeries/HvLpConfig.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * HvLpConfig.h | 2 | * HvLpConfig.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,262 +19,120 @@ | |||
19 | #ifndef _HVLPCONFIG_H | 19 | #ifndef _HVLPCONFIG_H |
20 | #define _HVLPCONFIG_H | 20 | #define _HVLPCONFIG_H |
21 | 21 | ||
22 | //=========================================================================== | 22 | /* |
23 | // | 23 | * This file contains the interface to the LPAR configuration data |
24 | // This file contains the interface to the LPAR configuration data | 24 | * to determine which resources should be allocated to each partition. |
25 | // to determine which resources should be allocated to each partition. | 25 | */ |
26 | // | ||
27 | //=========================================================================== | ||
28 | 26 | ||
29 | #include <asm/iSeries/HvCallCfg.h> | 27 | #include <asm/iSeries/HvCallSc.h> |
30 | #include <asm/iSeries/HvTypes.h> | 28 | #include <asm/iSeries/HvTypes.h> |
31 | #include <asm/iSeries/ItLpNaca.h> | 29 | #include <asm/iSeries/ItLpNaca.h> |
32 | #include <asm/iSeries/LparData.h> | ||
33 | 30 | ||
34 | //------------------------------------------------------------------- | 31 | enum { |
35 | // Constants | 32 | HvCallCfg_Cur = 0, |
36 | //------------------------------------------------------------------- | 33 | HvCallCfg_Init = 1, |
34 | HvCallCfg_Max = 2, | ||
35 | HvCallCfg_Min = 3 | ||
36 | }; | ||
37 | |||
38 | #define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6 | ||
39 | #define HvCallCfgGetPhysicalProcessors HvCallCfg + 7 | ||
40 | #define HvCallCfgGetMsChunks HvCallCfg + 9 | ||
41 | #define HvCallCfgGetSharedPoolIndex HvCallCfg + 20 | ||
42 | #define HvCallCfgGetSharedProcUnits HvCallCfg + 21 | ||
43 | #define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22 | ||
44 | #define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30 | ||
45 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 | ||
37 | 46 | ||
38 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); | 47 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); |
39 | 48 | ||
40 | //=================================================================== | ||
41 | static inline HvLpIndex HvLpConfig_getLpIndex(void) | 49 | static inline HvLpIndex HvLpConfig_getLpIndex(void) |
42 | { | 50 | { |
43 | return itLpNaca.xLpIndex; | 51 | return itLpNaca.xLpIndex; |
44 | } | 52 | } |
45 | //=================================================================== | 53 | |
46 | static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) | 54 | static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) |
47 | { | 55 | { |
48 | return itLpNaca.xPrimaryLpIndex; | 56 | return itLpNaca.xPrimaryLpIndex; |
49 | } | 57 | } |
50 | //================================================================= | 58 | |
51 | static inline HvLpIndex HvLpConfig_getLps(void) | 59 | static inline u64 HvLpConfig_getMsChunks(void) |
52 | { | ||
53 | return HvCallCfg_getLps(); | ||
54 | } | ||
55 | //================================================================= | ||
56 | static inline HvLpIndexMap HvLpConfig_getActiveLpMap(void) | ||
57 | { | ||
58 | return HvCallCfg_getActiveLpMap(); | ||
59 | } | ||
60 | //================================================================= | ||
61 | static inline u64 HvLpConfig_getSystemMsMegs(void) | ||
62 | { | ||
63 | return HvCallCfg_getSystemMsChunks() / HVCHUNKSPERMEG; | ||
64 | } | ||
65 | //================================================================= | ||
66 | static inline u64 HvLpConfig_getSystemMsChunks(void) | ||
67 | { | ||
68 | return HvCallCfg_getSystemMsChunks(); | ||
69 | } | ||
70 | //================================================================= | ||
71 | static inline u64 HvLpConfig_getSystemMsPages(void) | ||
72 | { | ||
73 | return HvCallCfg_getSystemMsChunks() * HVPAGESPERCHUNK; | ||
74 | } | ||
75 | //================================================================ | ||
76 | static inline u64 HvLpConfig_getMsMegs(void) | ||
77 | { | ||
78 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) / HVCHUNKSPERMEG; | ||
79 | } | ||
80 | //================================================================ | ||
81 | static inline u64 HvLpConfig_getMsChunks(void) | ||
82 | { | ||
83 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
84 | } | ||
85 | //================================================================ | ||
86 | static inline u64 HvLpConfig_getMsPages(void) | ||
87 | { | ||
88 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * HVPAGESPERCHUNK; | ||
89 | } | ||
90 | //================================================================ | ||
91 | static inline u64 HvLpConfig_getMinMsMegs(void) | ||
92 | { | ||
93 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) / HVCHUNKSPERMEG; | ||
94 | } | ||
95 | //================================================================ | ||
96 | static inline u64 HvLpConfig_getMinMsChunks(void) | ||
97 | { | ||
98 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
99 | } | ||
100 | //================================================================ | ||
101 | static inline u64 HvLpConfig_getMinMsPages(void) | ||
102 | { | ||
103 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) * HVPAGESPERCHUNK; | ||
104 | } | ||
105 | //================================================================ | ||
106 | static inline u64 HvLpConfig_getMinRuntimeMsMegs(void) | ||
107 | { | ||
108 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) / HVCHUNKSPERMEG; | ||
109 | } | ||
110 | //=============================================================== | ||
111 | static inline u64 HvLpConfig_getMinRuntimeMsChunks(void) | ||
112 | { | ||
113 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()); | ||
114 | } | ||
115 | //=============================================================== | ||
116 | static inline u64 HvLpConfig_getMinRuntimeMsPages(void) | ||
117 | { | ||
118 | return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) * HVPAGESPERCHUNK; | ||
119 | } | ||
120 | //=============================================================== | ||
121 | static inline u64 HvLpConfig_getMaxMsMegs(void) | ||
122 | { | ||
123 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) / HVCHUNKSPERMEG; | ||
124 | } | ||
125 | //=============================================================== | ||
126 | static inline u64 HvLpConfig_getMaxMsChunks(void) | ||
127 | { | ||
128 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
129 | } | ||
130 | //=============================================================== | ||
131 | static inline u64 HvLpConfig_getMaxMsPages(void) | ||
132 | { | ||
133 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) * HVPAGESPERCHUNK; | ||
134 | } | ||
135 | //=============================================================== | ||
136 | static inline u64 HvLpConfig_getInitMsMegs(void) | ||
137 | { | ||
138 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) / HVCHUNKSPERMEG; | ||
139 | } | ||
140 | //=============================================================== | ||
141 | static inline u64 HvLpConfig_getInitMsChunks(void) | ||
142 | { | ||
143 | return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init); | ||
144 | } | ||
145 | //=============================================================== | ||
146 | static inline u64 HvLpConfig_getInitMsPages(void) | ||
147 | { return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) * HVPAGESPERCHUNK; | ||
148 | } | ||
149 | //=============================================================== | ||
150 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) | ||
151 | { | ||
152 | return HvCallCfg_getSystemPhysicalProcessors(); | ||
153 | } | ||
154 | //=============================================================== | ||
155 | static inline u64 HvLpConfig_getSystemLogicalProcessors(void) | ||
156 | { | ||
157 | return HvCallCfg_getSystemPhysicalProcessors() * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
158 | } | ||
159 | //=============================================================== | ||
160 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) | ||
161 | { | ||
162 | return HvCallCfg_getNumProcsInSharedPool(sPI); | ||
163 | } | ||
164 | //=============================================================== | ||
165 | static inline u64 HvLpConfig_getPhysicalProcessors(void) | ||
166 | { | ||
167 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
168 | } | ||
169 | //=============================================================== | ||
170 | static inline u64 HvLpConfig_getLogicalProcessors(void) | ||
171 | { | ||
172 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
173 | } | ||
174 | //=============================================================== | ||
175 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) | ||
176 | { | ||
177 | return HvCallCfg_getSharedPoolIndex(HvLpConfig_getLpIndex()); | ||
178 | } | ||
179 | //=============================================================== | ||
180 | static inline u64 HvLpConfig_getSharedProcUnits(void) | ||
181 | { | ||
182 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Cur); | ||
183 | } | ||
184 | //=============================================================== | ||
185 | static inline u64 HvLpConfig_getMinSharedProcUnits(void) | ||
186 | { | ||
187 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
188 | } | ||
189 | //=============================================================== | ||
190 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) | ||
191 | { | ||
192 | return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
193 | } | ||
194 | //=============================================================== | ||
195 | static inline u64 HvLpConfig_getMinPhysicalProcessors(void) | ||
196 | { | ||
197 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min); | ||
198 | } | ||
199 | //=============================================================== | ||
200 | static inline u64 HvLpConfig_getMinLogicalProcessors(void) | ||
201 | { | ||
202 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
203 | } | ||
204 | //=============================================================== | ||
205 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) | ||
206 | { | ||
207 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max); | ||
208 | } | ||
209 | //=============================================================== | ||
210 | static inline u64 HvLpConfig_getMaxLogicalProcessors(void) | ||
211 | { | ||
212 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | ||
213 | } | ||
214 | //=============================================================== | ||
215 | static inline u64 HvLpConfig_getInitPhysicalProcessors(void) | ||
216 | { | 60 | { |
217 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init); | 61 | return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(), |
62 | HvCallCfg_Cur); | ||
218 | } | 63 | } |
219 | //=============================================================== | 64 | |
220 | static inline u64 HvLpConfig_getInitLogicalProcessors(void) | 65 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) |
221 | { | 66 | { |
222 | return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init) * (/*getPaca()->getSecondaryThreadCount() +*/ 1); | 67 | return HvCall0(HvCallCfgGetSystemPhysicalProcessors); |
223 | } | 68 | } |
224 | //================================================================ | 69 | |
225 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) | 70 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) |
226 | { | 71 | { |
227 | return HvCallCfg_getVirtualLanIndexMap(HvLpConfig_getLpIndex_outline()); | 72 | return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI); |
228 | } | 73 | } |
229 | //=============================================================== | 74 | |
230 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(HvLpIndex lp) | 75 | static inline u64 HvLpConfig_getPhysicalProcessors(void) |
231 | { | 76 | { |
232 | return HvCallCfg_getVirtualLanIndexMap(lp); | 77 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), |
78 | HvCallCfg_Cur); | ||
233 | } | 79 | } |
234 | //================================================================ | 80 | |
235 | static inline HvLpIndex HvLpConfig_getBusOwner(HvBusNumber busNumber) | 81 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) |
236 | { | 82 | { |
237 | return HvCallCfg_getBusOwner(busNumber); | 83 | return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex()); |
238 | } | 84 | } |
239 | //=============================================================== | 85 | |
240 | static inline int HvLpConfig_isBusDedicated(HvBusNumber busNumber) | 86 | static inline u64 HvLpConfig_getSharedProcUnits(void) |
241 | { | 87 | { |
242 | return HvCallCfg_isBusDedicated(busNumber); | 88 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), |
89 | HvCallCfg_Cur); | ||
243 | } | 90 | } |
244 | //================================================================ | 91 | |
245 | static inline HvLpIndexMap HvLpConfig_getBusAllocation(HvBusNumber busNumber) | 92 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) |
246 | { | 93 | { |
247 | return HvCallCfg_getBusAllocation(busNumber); | 94 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), |
95 | HvCallCfg_Max); | ||
248 | } | 96 | } |
249 | //================================================================ | 97 | |
250 | // returns the absolute real address of the load area | 98 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) |
251 | static inline u64 HvLpConfig_getLoadAddress(void) | ||
252 | { | 99 | { |
253 | return itLpNaca.xLoadAreaAddr & 0x7fffffffffffffff; | 100 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), |
101 | HvCallCfg_Max); | ||
254 | } | 102 | } |
255 | //================================================================ | 103 | |
256 | static inline u64 HvLpConfig_getLoadPages(void) | 104 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp( |
257 | { | 105 | HvLpIndex lp) |
258 | return itLpNaca.xLoadAreaChunks * HVPAGESPERCHUNK; | 106 | { |
107 | /* | ||
108 | * This is a new function in V5R1 so calls to this on older | ||
109 | * hypervisors will return -1 | ||
110 | */ | ||
111 | u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp); | ||
112 | if (retVal == -1) | ||
113 | retVal = 0; | ||
114 | return retVal; | ||
259 | } | 115 | } |
260 | //================================================================ | 116 | |
261 | static inline int HvLpConfig_isBusOwnedByThisLp(HvBusNumber busNumber) | 117 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) |
262 | { | 118 | { |
263 | HvLpIndex busOwner = HvLpConfig_getBusOwner(busNumber); | 119 | return HvLpConfig_getVirtualLanIndexMapForLp( |
264 | return (busOwner == HvLpConfig_getLpIndex()); | 120 | HvLpConfig_getLpIndex_outline()); |
265 | } | 121 | } |
266 | //================================================================ | 122 | |
267 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, HvLpIndex lp2) | 123 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, |
124 | HvLpIndex lp2) | ||
268 | { | 125 | { |
269 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = HvCallCfg_getVirtualLanIndexMap( lp1 ); | 126 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = |
270 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = HvCallCfg_getVirtualLanIndexMap( lp2 ); | 127 | HvLpConfig_getVirtualLanIndexMapForLp(lp1); |
128 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = | ||
129 | HvLpConfig_getVirtualLanIndexMapForLp(lp2); | ||
271 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); | 130 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); |
272 | } | 131 | } |
273 | //================================================================ | 132 | |
274 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) | 133 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) |
275 | { | 134 | { |
276 | return HvCallCfg_getHostingLpIndex(lp); | 135 | return HvCall1(HvCallCfgGetHostingLpIndex, lp); |
277 | } | 136 | } |
278 | //================================================================ | ||
279 | 137 | ||
280 | #endif /* _HVLPCONFIG_H */ | 138 | #endif /* _HVLPCONFIG_H */ |
diff --git a/include/asm-ppc64/iSeries/HvLpEvent.h b/include/asm-ppc64/iSeries/HvLpEvent.h index 30936e433064..865000de79b6 100644 --- a/include/asm-ppc64/iSeries/HvLpEvent.h +++ b/include/asm-ppc64/iSeries/HvLpEvent.h | |||
@@ -1,27 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | * HvLpEvent.h | 2 | * HvLpEvent.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | //====================================================================== | 20 | /* This file contains the class for HV events in the system. */ |
21 | // | 21 | |
22 | // This file contains the class for HV events in the system. | ||
23 | // | ||
24 | //===================================================================== | ||
25 | #ifndef _HVLPEVENT_H | 22 | #ifndef _HVLPEVENT_H |
26 | #define _HVLPEVENT_H | 23 | #define _HVLPEVENT_H |
27 | 24 | ||
@@ -30,69 +27,70 @@ | |||
30 | #include <asm/iSeries/HvTypes.h> | 27 | #include <asm/iSeries/HvTypes.h> |
31 | #include <asm/iSeries/HvCallEvent.h> | 28 | #include <asm/iSeries/HvCallEvent.h> |
32 | 29 | ||
33 | //===================================================================== | 30 | /* |
34 | // | 31 | * HvLpEvent is the structure for Lp Event messages passed between |
35 | // HvLpEvent is the structure for Lp Event messages passed between | 32 | * partitions through PLIC. |
36 | // partitions through PLIC. | 33 | */ |
37 | // | 34 | |
38 | //===================================================================== | 35 | struct HvEventFlags { |
39 | 36 | u8 xValid:1; /* Indicates a valid request x00-x00 */ | |
40 | struct HvEventFlags | 37 | u8 xRsvd1:4; /* Reserved ... */ |
41 | { | 38 | u8 xAckType:1; /* Immediate or deferred ... */ |
42 | u8 xValid:1; // Indicates a valid request x00-x00 | 39 | u8 xAckInd:1; /* Indicates if ACK required ... */ |
43 | u8 xRsvd1:4; // Reserved ... | 40 | u8 xFunction:1; /* Interrupt or Acknowledge ... */ |
44 | u8 xAckType:1; // Immediate or deferred ... | ||
45 | u8 xAckInd:1; // Indicates if ACK required ... | ||
46 | u8 xFunction:1; // Interrupt or Acknowledge ... | ||
47 | }; | 41 | }; |
48 | 42 | ||
49 | 43 | ||
50 | struct HvLpEvent | 44 | struct HvLpEvent { |
51 | { | 45 | struct HvEventFlags xFlags; /* Event flags x00-x00 */ |
52 | struct HvEventFlags xFlags; // Event flags x00-x00 | 46 | u8 xType; /* Type of message x01-x01 */ |
53 | u8 xType; // Type of message x01-x01 | 47 | u16 xSubtype; /* Subtype for event x02-x03 */ |
54 | u16 xSubtype; // Subtype for event x02-x03 | 48 | u8 xSourceLp; /* Source LP x04-x04 */ |
55 | u8 xSourceLp; // Source LP x04-x04 | 49 | u8 xTargetLp; /* Target LP x05-x05 */ |
56 | u8 xTargetLp; // Target LP x05-x05 | 50 | u8 xSizeMinus1; /* Size of Derived class - 1 x06-x06 */ |
57 | u8 xSizeMinus1; // Size of Derived class - 1 x06-x06 | 51 | u8 xRc; /* RC for Ack flows x07-x07 */ |
58 | u8 xRc; // RC for Ack flows x07-x07 | 52 | u16 xSourceInstanceId; /* Source sides instance id x08-x09 */ |
59 | u16 xSourceInstanceId; // Source sides instance id x08-x09 | 53 | u16 xTargetInstanceId; /* Target sides instance id x0A-x0B */ |
60 | u16 xTargetInstanceId; // Target sides instance id x0A-x0B | ||
61 | union { | 54 | union { |
62 | u32 xSubtypeData; // Data usable by the subtype x0C-x0F | 55 | u32 xSubtypeData; /* Data usable by the subtype x0C-x0F */ |
63 | u16 xSubtypeDataShort[2]; // Data as 2 shorts | 56 | u16 xSubtypeDataShort[2]; /* Data as 2 shorts */ |
64 | u8 xSubtypeDataChar[4]; // Data as 4 chars | 57 | u8 xSubtypeDataChar[4]; /* Data as 4 chars */ |
65 | } x; | 58 | } x; |
66 | 59 | ||
67 | u64 xCorrelationToken; // Unique value for source/type x10-x17 | 60 | u64 xCorrelationToken; /* Unique value for source/type x10-x17 */ |
68 | }; | 61 | }; |
69 | 62 | ||
70 | // Lp Event handler function | ||
71 | typedef void (*LpEventHandler)(struct HvLpEvent *, struct pt_regs *); | 63 | typedef void (*LpEventHandler)(struct HvLpEvent *, struct pt_regs *); |
72 | 64 | ||
73 | // Register a handler for an event type | 65 | /* Register a handler for an event type - returns 0 on success */ |
74 | // returns 0 on success | 66 | extern int HvLpEvent_registerHandler(HvLpEvent_Type eventType, |
75 | extern int HvLpEvent_registerHandler( HvLpEvent_Type eventType, LpEventHandler hdlr); | 67 | LpEventHandler hdlr); |
76 | |||
77 | // Unregister a handler for an event type | ||
78 | // This call will sleep until the handler being removed is guaranteed to | ||
79 | // be no longer executing on any CPU. Do not call with locks held. | ||
80 | // | ||
81 | // returns 0 on success | ||
82 | // Unregister will fail if there are any paths open for the type | ||
83 | extern int HvLpEvent_unregisterHandler( HvLpEvent_Type eventType ); | ||
84 | 68 | ||
85 | // Open an Lp Event Path for an event type | 69 | /* |
86 | // returns 0 on success | 70 | * Unregister a handler for an event type |
87 | // openPath will fail if there is no handler registered for the event type. | 71 | * |
88 | // The lpIndex specified is the partition index for the target partition | 72 | * This call will sleep until the handler being removed is guaranteed to |
89 | // (for VirtualIo, VirtualLan and SessionMgr) other types specify zero) | 73 | * be no longer executing on any CPU. Do not call with locks held. |
90 | extern int HvLpEvent_openPath( HvLpEvent_Type eventType, HvLpIndex lpIndex ); | 74 | * |
75 | * returns 0 on success | ||
76 | * Unregister will fail if there are any paths open for the type | ||
77 | */ | ||
78 | extern int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType); | ||
91 | 79 | ||
80 | /* | ||
81 | * Open an Lp Event Path for an event type | ||
82 | * returns 0 on success | ||
83 | * openPath will fail if there is no handler registered for the event type. | ||
84 | * The lpIndex specified is the partition index for the target partition | ||
85 | * (for VirtualIo, VirtualLan and SessionMgr) other types specify zero) | ||
86 | */ | ||
87 | extern int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex); | ||
92 | 88 | ||
93 | // Close an Lp Event Path for a type and partition | 89 | /* |
94 | // returns 0 on sucess | 90 | * Close an Lp Event Path for a type and partition |
95 | extern int HvLpEvent_closePath( HvLpEvent_Type eventType, HvLpIndex lpIndex ); | 91 | * returns 0 on sucess |
92 | */ | ||
93 | extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex); | ||
96 | 94 | ||
97 | #define HvLpEvent_Type_Hypervisor 0 | 95 | #define HvLpEvent_Type_Hypervisor 0 |
98 | #define HvLpEvent_Type_MachineFac 1 | 96 | #define HvLpEvent_Type_MachineFac 1 |
@@ -141,4 +139,4 @@ extern int HvLpEvent_closePath( HvLpEvent_Type eventType, HvLpIndex lpIndex ); | |||
141 | #define HvLpDma_Rc_InvalidAddress 4 | 139 | #define HvLpDma_Rc_InvalidAddress 4 |
142 | #define HvLpDma_Rc_InvalidLength 5 | 140 | #define HvLpDma_Rc_InvalidLength 5 |
143 | 141 | ||
144 | #endif // _HVLPEVENT_H | 142 | #endif /* _HVLPEVENT_H */ |
diff --git a/include/asm-ppc64/iSeries/HvReleaseData.h b/include/asm-ppc64/iSeries/HvReleaseData.h index 183e5e738c26..01a1f13ea4a0 100644 --- a/include/asm-ppc64/iSeries/HvReleaseData.h +++ b/include/asm-ppc64/iSeries/HvReleaseData.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * HvReleaseData.h | 2 | * HvReleaseData.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,47 +19,45 @@ | |||
19 | #ifndef _HVRELEASEDATA_H | 19 | #ifndef _HVRELEASEDATA_H |
20 | #define _HVRELEASEDATA_H | 20 | #define _HVRELEASEDATA_H |
21 | 21 | ||
22 | //============================================================================= | 22 | /* |
23 | // | 23 | * This control block contains the critical information about the |
24 | // This control block contains the critical information about the | 24 | * release so that it can be changed in the future (ie, the virtual |
25 | // release so that it can be changed in the future (ie, the virtual | 25 | * address of the OS's NACA). |
26 | // address of the OS's NACA). | 26 | */ |
27 | // | ||
28 | #include <asm/types.h> | 27 | #include <asm/types.h> |
29 | #include <asm/naca.h> | 28 | #include <asm/naca.h> |
30 | 29 | ||
31 | //============================================================================= | 30 | /* |
32 | // | 31 | * When we IPL a secondary partition, we will check if if the |
33 | // When we IPL a secondary partition, we will check if if the | 32 | * secondary xMinPlicVrmIndex > the primary xVrmIndex. |
34 | // secondary xMinPlicVrmIndex > the primary xVrmIndex. | 33 | * If it is then this tells PLIC that this secondary is not |
35 | // If it is then this tells PLIC that this secondary is not | 34 | * supported running on this "old" of a level of PLIC. |
36 | // supported running on this "old" of a level of PLIC. | 35 | * |
37 | // | 36 | * Likewise, we will compare the primary xMinSlicVrmIndex to |
38 | // Likewise, we will compare the primary xMinSlicVrmIndex to | 37 | * the secondary xVrmIndex. |
39 | // the secondary xVrmIndex. | 38 | * If the primary xMinSlicVrmDelta > secondary xVrmDelta then we |
40 | // If the primary xMinSlicVrmDelta > secondary xVrmDelta then we | 39 | * know that this PLIC does not support running an OS "that old". |
41 | // know that this PLIC does not support running an OS "that old". | 40 | */ |
42 | // | ||
43 | //============================================================================= | ||
44 | 41 | ||
45 | struct HvReleaseData | 42 | struct HvReleaseData { |
46 | { | 43 | u32 xDesc; /* Descriptor "HvRD" ebcdic x00-x03 */ |
47 | u32 xDesc; // Descriptor "HvRD" ebcdic x00-x03 | 44 | u16 xSize; /* Size of this control block x04-x05 */ |
48 | u16 xSize; // Size of this control block x04-x05 | 45 | u16 xVpdAreasPtrOffset; /* Offset in NACA of ItVpdAreas x06-x07 */ |
49 | u16 xVpdAreasPtrOffset; // Offset in NACA of ItVpdAreas x06-x07 | 46 | struct naca_struct *xSlicNacaAddr; /* Virt addr of SLIC NACA x08-x0F */ |
50 | struct naca_struct * xSlicNacaAddr; // Virt addr of SLIC NACA x08-x0F | 47 | u32 xMsNucDataOffset; /* Offset of Linux Mapping Data x10-x13 */ |
51 | u32 xMsNucDataOffset; // Offset of Linux Mapping Data x10-x13 | 48 | u32 xRsvd1; /* Reserved x14-x17 */ |
52 | u32 xRsvd1; // Reserved x14-x17 | 49 | u16 xTagsMode:1; /* 0 == tags active, 1 == tags inactive */ |
53 | u16 xTagsMode:1; // 0 == tags active, 1 == tags inactive | 50 | u16 xAddressSize:1; /* 0 == 64-bit, 1 == 32-bit */ |
54 | u16 xAddressSize:1; // 0 == 64-bit, 1 == 32-bit | 51 | u16 xNoSharedProcs:1; /* 0 == shared procs, 1 == no shared */ |
55 | u16 xNoSharedProcs:1; // 0 == shared procs, 1 == no shared | 52 | u16 xNoHMT:1; /* 0 == allow HMT, 1 == no HMT */ |
56 | u16 xNoHMT:1; // 0 == allow HMT, 1 == no HMT | 53 | u16 xRsvd2:12; /* Reserved x18-x19 */ |
57 | u16 xRsvd2:12; // Reserved x18-x19 | 54 | u16 xVrmIndex; /* VRM Index of OS image x1A-x1B */ |
58 | u16 xVrmIndex; // VRM Index of OS image x1A-x1B | 55 | u16 xMinSupportedPlicVrmIndex; /* Min PLIC level (soft) x1C-x1D */ |
59 | u16 xMinSupportedPlicVrmIndex;// Min PLIC level (soft) x1C-x1D | 56 | u16 xMinCompatablePlicVrmIndex; /* Min PLIC levelP (hard) x1E-x1F */ |
60 | u16 xMinCompatablePlicVrmIndex;// Min PLIC levelP (hard) x1E-x1F | 57 | char xVrmName[12]; /* Displayable name x20-x2B */ |
61 | char xVrmName[12]; // Displayable name x20-x2B | 58 | char xRsvd3[20]; /* Reserved x2C-x3F */ |
62 | char xRsvd3[20]; // Reserved x2C-x3F | ||
63 | }; | 59 | }; |
64 | 60 | ||
61 | extern struct HvReleaseData hvReleaseData; | ||
62 | |||
65 | #endif /* _HVRELEASEDATA_H */ | 63 | #endif /* _HVRELEASEDATA_H */ |
diff --git a/include/asm-ppc64/iSeries/HvTypes.h b/include/asm-ppc64/iSeries/HvTypes.h index 3ec49c1aec32..b1ef2b4cb3e3 100644 --- a/include/asm-ppc64/iSeries/HvTypes.h +++ b/include/asm-ppc64/iSeries/HvTypes.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * HvTypes.h | 2 | * HvTypes.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,74 +19,60 @@ | |||
19 | #ifndef _HVTYPES_H | 19 | #ifndef _HVTYPES_H |
20 | #define _HVTYPES_H | 20 | #define _HVTYPES_H |
21 | 21 | ||
22 | //=========================================================================== | 22 | /* |
23 | // Header File Id | 23 | * General typedefs for the hypervisor. |
24 | // Name______________: HvTypes.H | 24 | */ |
25 | // | ||
26 | // Description_______: | ||
27 | // | ||
28 | // General typedefs for the hypervisor. | ||
29 | // | ||
30 | // Declared Class(es): | ||
31 | // | ||
32 | //=========================================================================== | ||
33 | 25 | ||
34 | #include <asm/types.h> | 26 | #include <asm/types.h> |
35 | 27 | ||
36 | //------------------------------------------------------------------- | ||
37 | // Typedefs | ||
38 | //------------------------------------------------------------------- | ||
39 | typedef u8 HvLpIndex; | 28 | typedef u8 HvLpIndex; |
40 | typedef u16 HvLpInstanceId; | 29 | typedef u16 HvLpInstanceId; |
41 | typedef u64 HvLpTOD; | 30 | typedef u64 HvLpTOD; |
42 | typedef u64 HvLpSystemSerialNum; | 31 | typedef u64 HvLpSystemSerialNum; |
43 | typedef u8 HvLpDeviceSerialNum[12]; | 32 | typedef u8 HvLpDeviceSerialNum[12]; |
44 | typedef u16 HvLpSanHwSet; | 33 | typedef u16 HvLpSanHwSet; |
45 | typedef u16 HvLpBus; | 34 | typedef u16 HvLpBus; |
46 | typedef u16 HvLpBoard; | 35 | typedef u16 HvLpBoard; |
47 | typedef u16 HvLpCard; | 36 | typedef u16 HvLpCard; |
48 | typedef u8 HvLpDeviceType[4]; | 37 | typedef u8 HvLpDeviceType[4]; |
49 | typedef u8 HvLpDeviceModel[3]; | 38 | typedef u8 HvLpDeviceModel[3]; |
50 | typedef u64 HvIoToken; | 39 | typedef u64 HvIoToken; |
51 | typedef u8 HvLpName[8]; | 40 | typedef u8 HvLpName[8]; |
52 | typedef u32 HvIoId; | 41 | typedef u32 HvIoId; |
53 | typedef u64 HvRealMemoryIndex; | 42 | typedef u64 HvRealMemoryIndex; |
54 | typedef u32 HvLpIndexMap; // Must hold HvMaxArchitectedLps bits!!! | 43 | typedef u32 HvLpIndexMap; /* Must hold HVMAXARCHITECTEDLPS bits!!! */ |
55 | typedef u16 HvLpVrmIndex; | 44 | typedef u16 HvLpVrmIndex; |
56 | typedef u32 HvXmGenerationId; | 45 | typedef u32 HvXmGenerationId; |
57 | typedef u8 HvLpBusPool; | 46 | typedef u8 HvLpBusPool; |
58 | typedef u8 HvLpSharedPoolIndex; | 47 | typedef u8 HvLpSharedPoolIndex; |
59 | typedef u16 HvLpSharedProcUnitsX100; | 48 | typedef u16 HvLpSharedProcUnitsX100; |
60 | typedef u8 HvLpVirtualLanIndex; | 49 | typedef u8 HvLpVirtualLanIndex; |
61 | typedef u16 HvLpVirtualLanIndexMap; // Must hold HvMaxArchitectedVirtualLans bits!!! | 50 | typedef u16 HvLpVirtualLanIndexMap; /* Must hold HVMAXARCHITECTEDVIRTUALLANS bits!!! */ |
62 | typedef u16 HvBusNumber; // Hypervisor Bus Number | 51 | typedef u16 HvBusNumber; /* Hypervisor Bus Number */ |
63 | typedef u8 HvSubBusNumber; // Hypervisor SubBus Number | 52 | typedef u8 HvSubBusNumber; /* Hypervisor SubBus Number */ |
64 | typedef u8 HvAgentId; // Hypervisor DevFn | 53 | typedef u8 HvAgentId; /* Hypervisor DevFn */ |
54 | |||
65 | 55 | ||
56 | #define HVMAXARCHITECTEDLPS 32 | ||
57 | #define HVMAXARCHITECTEDVIRTUALLANS 16 | ||
58 | #define HVMAXARCHITECTEDVIRTUALDISKS 32 | ||
59 | #define HVMAXARCHITECTEDVIRTUALCDROMS 8 | ||
60 | #define HVMAXARCHITECTEDVIRTUALTAPES 8 | ||
61 | #define HVCHUNKSIZE (256 * 1024) | ||
62 | #define HVPAGESIZE (4 * 1024) | ||
63 | #define HVLPMINMEGSPRIMARY 256 | ||
64 | #define HVLPMINMEGSSECONDARY 64 | ||
65 | #define HVCHUNKSPERMEG 4 | ||
66 | #define HVPAGESPERMEG 256 | ||
67 | #define HVPAGESPERCHUNK 64 | ||
66 | 68 | ||
67 | #define HVMAXARCHITECTEDLPS 32 | ||
68 | #define HVMAXARCHITECTEDVIRTUALLANS 16 | ||
69 | #define HVMAXARCHITECTEDVIRTUALDISKS 32 | ||
70 | #define HVMAXARCHITECTEDVIRTUALCDROMS 8 | ||
71 | #define HVMAXARCHITECTEDVIRTUALTAPES 8 | ||
72 | #define HVCHUNKSIZE 256 * 1024 | ||
73 | #define HVPAGESIZE 4 * 1024 | ||
74 | #define HVLPMINMEGSPRIMARY 256 | ||
75 | #define HVLPMINMEGSSECONDARY 64 | ||
76 | #define HVCHUNKSPERMEG 4 | ||
77 | #define HVPAGESPERMEG 256 | ||
78 | #define HVPAGESPERCHUNK 64 | ||
79 | |||
80 | #define HvMaxArchitectedLps ((HvLpIndex)HVMAXARCHITECTEDLPS) | ||
81 | #define HvMaxArchitectedVirtualLans ((HvLpVirtualLanIndex)16) | ||
82 | #define HvLpIndexInvalid ((HvLpIndex)0xff) | 69 | #define HvLpIndexInvalid ((HvLpIndex)0xff) |
83 | 70 | ||
84 | //-------------------------------------------------------------------- | 71 | /* |
85 | // Enums for the sub-components under PLIC | 72 | * Enums for the sub-components under PLIC |
86 | // Used in HvCall and HvPrimaryCall | 73 | * Used in HvCall and HvPrimaryCall |
87 | //-------------------------------------------------------------------- | 74 | */ |
88 | enum HvCallCompIds | 75 | enum { |
89 | { | ||
90 | HvCallCompId = 0, | 76 | HvCallCompId = 0, |
91 | HvCallCpuCtlsCompId = 1, | 77 | HvCallCpuCtlsCompId = 1, |
92 | HvCallCfgCompId = 2, | 78 | HvCallCfgCompId = 2, |
@@ -97,18 +83,18 @@ enum HvCallCompIds | |||
97 | HvCallSmCompId = 7, | 83 | HvCallSmCompId = 7, |
98 | HvCallSpdCompId = 8, | 84 | HvCallSpdCompId = 8, |
99 | HvCallXmCompId = 9, | 85 | HvCallXmCompId = 9, |
100 | HvCallRioCompId = 10, | 86 | HvCallRioCompId = 10, |
101 | HvCallRsvd3CompId = 11, | 87 | HvCallRsvd3CompId = 11, |
102 | HvCallRsvd2CompId = 12, | 88 | HvCallRsvd2CompId = 12, |
103 | HvCallRsvd1CompId = 13, | 89 | HvCallRsvd1CompId = 13, |
104 | HvCallMaxCompId = 14, | 90 | HvCallMaxCompId = 14, |
105 | HvPrimaryCallCompId = 0, | 91 | HvPrimaryCallCompId = 0, |
106 | HvPrimaryCallCfgCompId = 1, | 92 | HvPrimaryCallCfgCompId = 1, |
107 | HvPrimaryCallPciCompId = 2, | 93 | HvPrimaryCallPciCompId = 2, |
108 | HvPrimaryCallSmCompId = 3, | 94 | HvPrimaryCallSmCompId = 3, |
109 | HvPrimaryCallSpdCompId = 4, | 95 | HvPrimaryCallSpdCompId = 4, |
110 | HvPrimaryCallXmCompId = 5, | 96 | HvPrimaryCallXmCompId = 5, |
111 | HvPrimaryCallRioCompId = 6, | 97 | HvPrimaryCallRioCompId = 6, |
112 | HvPrimaryCallRsvd7CompId = 7, | 98 | HvPrimaryCallRsvd7CompId = 7, |
113 | HvPrimaryCallRsvd6CompId = 8, | 99 | HvPrimaryCallRsvd6CompId = 8, |
114 | HvPrimaryCallRsvd5CompId = 9, | 100 | HvPrimaryCallRsvd5CompId = 9, |
@@ -116,7 +102,7 @@ enum HvCallCompIds | |||
116 | HvPrimaryCallRsvd3CompId = 11, | 102 | HvPrimaryCallRsvd3CompId = 11, |
117 | HvPrimaryCallRsvd2CompId = 12, | 103 | HvPrimaryCallRsvd2CompId = 12, |
118 | HvPrimaryCallRsvd1CompId = 13, | 104 | HvPrimaryCallRsvd1CompId = 13, |
119 | HvPrimaryCallMaxCompId = HvCallMaxCompId | 105 | HvPrimaryCallMaxCompId = HvCallMaxCompId |
120 | }; | 106 | }; |
121 | 107 | ||
122 | struct HvLpBufferList { | 108 | struct HvLpBufferList { |
diff --git a/include/asm-ppc64/iSeries/IoHriMainStore.h b/include/asm-ppc64/iSeries/IoHriMainStore.h index ff00e865f620..45ed3ea67d06 100644 --- a/include/asm-ppc64/iSeries/IoHriMainStore.h +++ b/include/asm-ppc64/iSeries/IoHriMainStore.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * IoHriMainStore.h | 2 | * IoHriMainStore.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -21,7 +21,7 @@ | |||
21 | #define _IOHRIMAINSTORE_H | 21 | #define _IOHRIMAINSTORE_H |
22 | 22 | ||
23 | /* Main Store Vpd for Condor,iStar,sStar */ | 23 | /* Main Store Vpd for Condor,iStar,sStar */ |
24 | struct IoHriMainStoreSegment4 { | 24 | struct IoHriMainStoreSegment4 { |
25 | u8 msArea0Exists:1; | 25 | u8 msArea0Exists:1; |
26 | u8 msArea1Exists:1; | 26 | u8 msArea1Exists:1; |
27 | u8 msArea2Exists:1; | 27 | u8 msArea2Exists:1; |
@@ -51,7 +51,7 @@ struct IoHriMainStoreSegment4 { | |||
51 | u8 msArea1HasRiserVpd:1; | 51 | u8 msArea1HasRiserVpd:1; |
52 | u8 msArea2HasRiserVpd:1; | 52 | u8 msArea2HasRiserVpd:1; |
53 | u8 msArea3HasRiserVpd:1; | 53 | u8 msArea3HasRiserVpd:1; |
54 | u8 reserved5:4; | 54 | u8 reserved5:4; |
55 | u8 reserved6; | 55 | u8 reserved6; |
56 | u16 reserved7; | 56 | u16 reserved7; |
57 | 57 | ||
@@ -82,8 +82,8 @@ struct IoHriMainStoreVpdFruData { | |||
82 | }; | 82 | }; |
83 | 83 | ||
84 | struct IoHriMainStoreAdrRangeBlock { | 84 | struct IoHriMainStoreAdrRangeBlock { |
85 | void * blockStart __attribute((packed)); | 85 | void *blockStart __attribute((packed)); |
86 | void * blockEnd __attribute((packed)); | 86 | void *blockEnd __attribute((packed)); |
87 | u32 blockProcChipId __attribute((packed)); | 87 | u32 blockProcChipId __attribute((packed)); |
88 | }; | 88 | }; |
89 | 89 | ||
@@ -102,7 +102,7 @@ struct IoHriMainStoreArea4 { | |||
102 | u32 procNodeId __attribute((packed)); | 102 | u32 procNodeId __attribute((packed)); |
103 | 103 | ||
104 | u32 numAdrRangeBlocks __attribute((packed)); | 104 | u32 numAdrRangeBlocks __attribute((packed)); |
105 | struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed)); | 105 | struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed)); |
106 | 106 | ||
107 | struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed)); | 107 | struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed)); |
108 | struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed)); | 108 | struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed)); |
@@ -113,17 +113,17 @@ struct IoHriMainStoreArea4 { | |||
113 | struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed)); | 113 | struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed)); |
114 | struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed)); | 114 | struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed)); |
115 | 115 | ||
116 | void * msRamAreaArray __attribute((packed)); | 116 | void *msRamAreaArray __attribute((packed)); |
117 | u32 msRamAreaArrayNumEntries __attribute((packed)); | 117 | u32 msRamAreaArrayNumEntries __attribute((packed)); |
118 | u32 msRamAreaArrayEntrySize __attribute((packed)); | 118 | u32 msRamAreaArrayEntrySize __attribute((packed)); |
119 | 119 | ||
120 | u32 numaDimmExists __attribute((packed)); | 120 | u32 numaDimmExists __attribute((packed)); |
121 | u32 numaDimmFunctional __attribute((packed)); | 121 | u32 numaDimmFunctional __attribute((packed)); |
122 | void * numaDimmArray __attribute((packed)); | 122 | void *numaDimmArray __attribute((packed)); |
123 | u32 numaDimmArrayNumEntries __attribute((packed)); | 123 | u32 numaDimmArrayNumEntries __attribute((packed)); |
124 | u32 numaDimmArrayEntrySize __attribute((packed)); | 124 | u32 numaDimmArrayEntrySize __attribute((packed)); |
125 | 125 | ||
126 | struct IoHriMainStoreVpdIdData idData __attribute((packed)); | 126 | struct IoHriMainStoreVpdIdData idData __attribute((packed)); |
127 | 127 | ||
128 | u64 powerData __attribute((packed)); | 128 | u64 powerData __attribute((packed)); |
129 | u64 cardAssemblyPartNum __attribute((packed)); | 129 | u64 cardAssemblyPartNum __attribute((packed)); |
@@ -143,7 +143,7 @@ struct IoHriMainStoreArea4 { | |||
143 | }; | 143 | }; |
144 | 144 | ||
145 | 145 | ||
146 | struct IoHriMainStoreSegment5 { | 146 | struct IoHriMainStoreSegment5 { |
147 | u16 reserved1; | 147 | u16 reserved1; |
148 | u8 reserved2; | 148 | u8 reserved2; |
149 | u8 msVpdFormat; | 149 | u8 msVpdFormat; |
@@ -151,17 +151,16 @@ struct IoHriMainStoreSegment5 { | |||
151 | u32 totalMainStore; | 151 | u32 totalMainStore; |
152 | u64 maxConfiguredMsAdr; | 152 | u64 maxConfiguredMsAdr; |
153 | 153 | ||
154 | struct IoHriMainStoreArea4* msAreaArray; | 154 | struct IoHriMainStoreArea4 *msAreaArray; |
155 | u32 msAreaArrayNumEntries; | 155 | u32 msAreaArrayNumEntries; |
156 | u32 msAreaArrayEntrySize; | 156 | u32 msAreaArrayEntrySize; |
157 | 157 | ||
158 | u32 msAreaExists; | 158 | u32 msAreaExists; |
159 | u32 msAreaFunctional; | 159 | u32 msAreaFunctional; |
160 | 160 | ||
161 | u64 reserved3; | 161 | u64 reserved3; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | extern u64 xMsVpd[]; | ||
164 | 165 | ||
165 | 166 | #endif /* _IOHRIMAINSTORE_H */ | |
166 | #endif // _IOHRIMAINSTORE_H | ||
167 | |||
diff --git a/include/asm-ppc64/iSeries/IoHriProcessorVpd.h b/include/asm-ppc64/iSeries/IoHriProcessorVpd.h index 965433888653..73b73d80b8b1 100644 --- a/include/asm-ppc64/iSeries/IoHriProcessorVpd.h +++ b/include/asm-ppc64/iSeries/IoHriProcessorVpd.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * IoHriProcessorVpd.h | 2 | * IoHriProcessorVpd.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,16 +19,12 @@ | |||
19 | #ifndef _IOHRIPROCESSORVPD_H | 19 | #ifndef _IOHRIPROCESSORVPD_H |
20 | #define _IOHRIPROCESSORVPD_H | 20 | #define _IOHRIPROCESSORVPD_H |
21 | 21 | ||
22 | //=================================================================== | ||
23 | // | ||
24 | // This struct maps Processor Vpd that is DMAd to SLIC by CSP | ||
25 | // | ||
26 | |||
27 | #include <asm/types.h> | 22 | #include <asm/types.h> |
28 | 23 | ||
29 | struct IoHriProcessorVpd | 24 | /* |
30 | { | 25 | * This struct maps Processor Vpd that is DMAd to SLIC by CSP |
31 | 26 | */ | |
27 | struct IoHriProcessorVpd { | ||
32 | u8 xFormat; // VPD format indicator x00-x00 | 28 | u8 xFormat; // VPD format indicator x00-x00 |
33 | u8 xProcStatus:8; // Processor State x01-x01 | 29 | u8 xProcStatus:8; // Processor State x01-x01 |
34 | u8 xSecondaryThreadCount; // Secondary thread cnt x02-x02 | 30 | u8 xSecondaryThreadCount; // Secondary thread cnt x02-x02 |
@@ -40,12 +36,12 @@ struct IoHriProcessorVpd | |||
40 | u16 xRsvd2; // Reserved x06-x07 | 36 | u16 xRsvd2; // Reserved x06-x07 |
41 | u32 xHwNodeId; // Hardware node id x08-x0B | 37 | u32 xHwNodeId; // Hardware node id x08-x0B |
42 | u32 xHwProcId; // Hardware processor id x0C-x0F | 38 | u32 xHwProcId; // Hardware processor id x0C-x0F |
43 | 39 | ||
44 | u32 xTypeNum; // Card Type/CCIN number x10-x13 | 40 | u32 xTypeNum; // Card Type/CCIN number x10-x13 |
45 | u32 xModelNum; // Model/Feature number x14-x17 | 41 | u32 xModelNum; // Model/Feature number x14-x17 |
46 | u64 xSerialNum; // Serial number x18-x1F | 42 | u64 xSerialNum; // Serial number x18-x1F |
47 | char xPartNum[12]; // Book Part or FPU number x20-x2B | 43 | char xPartNum[12]; // Book Part or FPU number x20-x2B |
48 | char xMfgID[4]; // Manufacturing ID x2C-x2F | 44 | char xMfgID[4]; // Manufacturing ID x2C-x2F |
49 | 45 | ||
50 | u32 xProcFreq; // Processor Frequency x30-x33 | 46 | u32 xProcFreq; // Processor Frequency x30-x33 |
51 | u32 xTimeBaseFreq; // Time Base Frequency x34-x37 | 47 | u32 xTimeBaseFreq; // Time Base Frequency x34-x37 |
@@ -71,7 +67,7 @@ struct IoHriProcessorVpd | |||
71 | u32 xDataL3CacheSizeKB; // L3 data cache size in KB x80-x83 | 67 | u32 xDataL3CacheSizeKB; // L3 data cache size in KB x80-x83 |
72 | u32 xDataL3CacheLineSize; // L3 data cache block size x84-x87 | 68 | u32 xDataL3CacheLineSize; // L3 data cache block size x84-x87 |
73 | u64 xRsvd6; // Reserved x88-x8F | 69 | u64 xRsvd6; // Reserved x88-x8F |
74 | 70 | ||
75 | u64 xFruLabel; // Card Location Label x90-x97 | 71 | u64 xFruLabel; // Card Location Label x90-x97 |
76 | u8 xSlotsOnCard; // Slots on card (0=no slots) x98-x98 | 72 | u8 xSlotsOnCard; // Slots on card (0=no slots) x98-x98 |
77 | u8 xPartLocFlag; // Location flag (0-pluggable 1-imbedded) x99-x99 | 73 | u8 xPartLocFlag; // Location flag (0-pluggable 1-imbedded) x99-x99 |
@@ -79,10 +75,12 @@ struct IoHriProcessorVpd | |||
79 | u8 xSmartCardPortNo; // Smart card port number x9C-x9C | 75 | u8 xSmartCardPortNo; // Smart card port number x9C-x9C |
80 | u8 xRsvd7; // Reserved x9D-x9D | 76 | u8 xRsvd7; // Reserved x9D-x9D |
81 | u16 xFrameIdAndRackUnit; // Frame ID and rack unit adr x9E-x9F | 77 | u16 xFrameIdAndRackUnit; // Frame ID and rack unit adr x9E-x9F |
82 | 78 | ||
83 | u8 xRsvd8[24]; // Reserved xA0-xB7 | 79 | u8 xRsvd8[24]; // Reserved xA0-xB7 |
84 | 80 | ||
85 | char xProcSrc[72]; // CSP format SRC xB8-xFF | 81 | char xProcSrc[72]; // CSP format SRC xB8-xFF |
86 | }; | 82 | }; |
87 | 83 | ||
84 | extern struct IoHriProcessorVpd xIoHriProcessorVpd[]; | ||
85 | |||
88 | #endif /* _IOHRIPROCESSORVPD_H */ | 86 | #endif /* _IOHRIPROCESSORVPD_H */ |
diff --git a/include/asm-ppc64/iSeries/ItExtVpdPanel.h b/include/asm-ppc64/iSeries/ItExtVpdPanel.h index dee6b1273031..4c546a8802b4 100644 --- a/include/asm-ppc64/iSeries/ItExtVpdPanel.h +++ b/include/asm-ppc64/iSeries/ItExtVpdPanel.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * ItExtVpdPanel.h | 2 | * ItExtVpdPanel.h |
3 | * Copyright (C) 2002 Dave Boutcher IBM Corporation | 3 | * Copyright (C) 2002 Dave Boutcher IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -20,39 +20,33 @@ | |||
20 | #define _ITEXTVPDPANEL_H | 20 | #define _ITEXTVPDPANEL_H |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * | 23 | * This struct maps the panel information |
24 | * This struct maps the panel information | ||
25 | * | 24 | * |
26 | * Warning: | 25 | * Warning: |
27 | * This data must match the architecture for the panel information | 26 | * This data must match the architecture for the panel information |
28 | * | ||
29 | */ | 27 | */ |
30 | 28 | ||
31 | |||
32 | /*------------------------------------------------------------------- | ||
33 | * Standard Includes | ||
34 | *------------------------------------------------------------------- | ||
35 | */ | ||
36 | #include <asm/types.h> | 29 | #include <asm/types.h> |
37 | 30 | ||
38 | struct ItExtVpdPanel | 31 | struct ItExtVpdPanel { |
39 | { | 32 | /* Definition of the Extended Vpd On Panel Data Area */ |
40 | // Definition of the Extended Vpd On Panel Data Area | 33 | char systemSerial[8]; |
41 | char systemSerial[8]; | 34 | char mfgID[4]; |
42 | char mfgID[4]; | 35 | char reserved1[24]; |
43 | char reserved1[24]; | 36 | char machineType[4]; |
44 | char machineType[4]; | 37 | char systemID[6]; |
45 | char systemID[6]; | 38 | char somUniqueCnt[4]; |
46 | char somUniqueCnt[4]; | 39 | char serialNumberCount; |
47 | char serialNumberCount; | 40 | char reserved2[7]; |
48 | char reserved2[7]; | 41 | u16 bbu3; |
49 | u16 bbu3; | 42 | u16 bbu2; |
50 | u16 bbu2; | 43 | u16 bbu1; |
51 | u16 bbu1; | 44 | char xLocationLabel[8]; |
52 | char xLocationLabel[8]; | 45 | u8 xRsvd1[6]; |
53 | u8 xRsvd1[6]; | 46 | u16 xFrameId; |
54 | u16 xFrameId; | 47 | u8 xRsvd2[48]; |
55 | u8 xRsvd2[48]; | ||
56 | }; | 48 | }; |
57 | 49 | ||
58 | #endif /* _ITEXTVPDPANEL_H */ | 50 | extern struct ItExtVpdPanel xItExtVpdPanel; |
51 | |||
52 | #endif /* _ITEXTVPDPANEL_H */ | ||
diff --git a/include/asm-ppc64/iSeries/ItIplParmsReal.h b/include/asm-ppc64/iSeries/ItIplParmsReal.h index 4d8b430ab12d..ae3417dc599e 100644 --- a/include/asm-ppc64/iSeries/ItIplParmsReal.h +++ b/include/asm-ppc64/iSeries/ItIplParmsReal.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * ItIplParmsReal.h | 2 | * ItIplParmsReal.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,58 +19,53 @@ | |||
19 | #ifndef _ITIPLPARMSREAL_H | 19 | #ifndef _ITIPLPARMSREAL_H |
20 | #define _ITIPLPARMSREAL_H | 20 | #define _ITIPLPARMSREAL_H |
21 | 21 | ||
22 | //============================================================================== | 22 | /* |
23 | // | 23 | * This struct maps the IPL Parameters DMA'd from the SP. |
24 | // This struct maps the IPL Parameters DMA'd from the SP. | 24 | * |
25 | // | 25 | * Warning: |
26 | // Warning: | 26 | * This data must map in exactly 64 bytes and match the architecture for |
27 | // This data must map in exactly 64 bytes and match the architecture for | 27 | * the IPL parms |
28 | // the IPL parms | 28 | */ |
29 | // | ||
30 | //============================================================================= | ||
31 | |||
32 | 29 | ||
33 | //------------------------------------------------------------------- | ||
34 | // Standard Includes | ||
35 | //------------------------------------------------------------------- | ||
36 | #include <asm/types.h> | 30 | #include <asm/types.h> |
37 | 31 | ||
38 | struct ItIplParmsReal | 32 | struct ItIplParmsReal { |
39 | { | 33 | u8 xFormat; // Defines format of IplParms x00-x00 |
40 | u8 xFormat; // Defines format of IplParms x00-x00 | 34 | u8 xRsvd01:6; // Reserved x01-x01 |
41 | u8 xRsvd01:6; // Reserved x01-x01 | 35 | u8 xAlternateSearch:1; // Alternate search indicator ... |
42 | u8 xAlternateSearch:1; // Alternate search indicator ... | 36 | u8 xUaSupplied:1; // UA Supplied on programmed IPL... |
43 | u8 xUaSupplied:1; // UA Supplied on programmed IPL ... | 37 | u8 xLsUaFormat; // Format byte for UA x02-x02 |
44 | u8 xLsUaFormat; // Format byte for UA x02-x02 | 38 | u8 xRsvd02; // Reserved x03-x03 |
45 | u8 xRsvd02; // Reserved x03-x03 | 39 | u32 xLsUa; // LS UA x04-x07 |
46 | u32 xLsUa; // LS UA x04-x07 | 40 | u32 xUnusedLsLid; // First OS LID to load x08-x0B |
47 | u32 xUnusedLsLid; // First OS LID to load x08-x0B | 41 | u16 xLsBusNumber; // LS Bus Number x0C-x0D |
48 | u16 xLsBusNumber; // LS Bus Number x0C-x0D | 42 | u8 xLsCardAdr; // LS Card Address x0E-x0E |
49 | u8 xLsCardAdr; // LS Card Address x0E-x0E | 43 | u8 xLsBoardAdr; // LS Board Address x0F-x0F |
50 | u8 xLsBoardAdr; // LS Board Address x0F-x0F | 44 | u32 xRsvd03; // Reserved x10-x13 |
51 | u32 xRsvd03; // Reserved x10-x13 | 45 | u8 xSpcnPresent:1; // SPCN present x14-x14 |
52 | u8 xSpcnPresent:1; // SPCN present x14-x14 | 46 | u8 xCpmPresent:1; // CPM present ... |
53 | u8 xCpmPresent:1; // CPM present ... | 47 | u8 xRsvd04:6; // Reserved ... |
54 | u8 xRsvd04:6; // Reserved ... | 48 | u8 xRsvd05:4; // Reserved x15-x15 |
55 | u8 xRsvd05:4; // Reserved x15-x15 | 49 | u8 xKeyLock:4; // Keylock setting ... |
56 | u8 xKeyLock:4; // Keylock setting ... | 50 | u8 xRsvd06:6; // Reserved x16-x16 |
57 | u8 xRsvd06:6; // Reserved x16-x16 | 51 | u8 xIplMode:2; // Ipl mode (A|B|C|D) ... |
58 | u8 xIplMode:2; // Ipl mode (A|B|C|D) ... | 52 | u8 xHwIplType; // Fast v slow v slow EC HW IPL x17-x17 |
59 | u8 xHwIplType; // Fast v slow v slow EC HW IPL x17-x17 | 53 | u16 xCpmEnabledIpl:1; // CPM in effect when IPL initiatedx18-x19 |
60 | u16 xCpmEnabledIpl:1; // CPM in effect when IPL initiated x18-x19 | 54 | u16 xPowerOnResetIpl:1; // Indicate POR condition ... |
61 | u16 xPowerOnResetIpl:1; // Indicate POR condition ... | 55 | u16 xMainStorePreserved:1; // Main Storage is preserved ... |
62 | u16 xMainStorePreserved:1; // Main Storage is preserved ... | 56 | u16 xRsvd07:13; // Reserved ... |
63 | u16 xRsvd07:13; // Reserved ... | 57 | u16 xIplSource:16; // Ipl source x1A-x1B |
64 | u16 xIplSource:16; // Ipl source x1A-x1B | 58 | u8 xIplReason:8; // Reason for this IPL x1C-x1C |
65 | u8 xIplReason:8; // Reason for this IPL x1C-x1C | 59 | u8 xRsvd08; // Reserved x1D-x1D |
66 | u8 xRsvd08; // Reserved x1D-x1D | 60 | u16 xRsvd09; // Reserved x1E-x1F |
67 | u16 xRsvd09; // Reserved x1E-x1F | 61 | u16 xSysBoxType; // System Box Type x20-x21 |
68 | u16 xSysBoxType; // System Box Type x20-x21 | 62 | u16 xSysProcType; // System Processor Type x22-x23 |
69 | u16 xSysProcType; // System Processor Type x22-x23 | 63 | u32 xRsvd10; // Reserved x24-x27 |
70 | u32 xRsvd10; // Reserved x24-x27 | 64 | u64 xRsvd11; // Reserved x28-x2F |
71 | u64 xRsvd11; // Reserved x28-x2F | 65 | u64 xRsvd12; // Reserved x30-x37 |
72 | u64 xRsvd12; // Reserved x30-x37 | 66 | u64 xRsvd13; // Reserved x38-x3F |
73 | u64 xRsvd13; // Reserved x38-x3F | ||
74 | }; | 67 | }; |
75 | 68 | ||
69 | extern struct ItIplParmsReal xItIplParmsReal; | ||
70 | |||
76 | #endif /* _ITIPLPARMSREAL_H */ | 71 | #endif /* _ITIPLPARMSREAL_H */ |
diff --git a/include/asm-ppc64/iSeries/ItLpNaca.h b/include/asm-ppc64/iSeries/ItLpNaca.h index 5baffddfae1b..225d0176779d 100644 --- a/include/asm-ppc64/iSeries/ItLpNaca.h +++ b/include/asm-ppc64/iSeries/ItLpNaca.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * ItLpNaca.h | 2 | * ItLpNaca.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,18 +19,15 @@ | |||
19 | #ifndef _ITLPNACA_H | 19 | #ifndef _ITLPNACA_H |
20 | #define _ITLPNACA_H | 20 | #define _ITLPNACA_H |
21 | 21 | ||
22 | //============================================================================= | 22 | #include <linux/types.h> |
23 | // | ||
24 | // This control block contains the data that is shared between the | ||
25 | // hypervisor (PLIC) and the OS. | ||
26 | // | ||
27 | //============================================================================= | ||
28 | 23 | ||
29 | struct ItLpNaca | 24 | /* |
30 | { | 25 | * This control block contains the data that is shared between the |
31 | //============================================================================= | 26 | * hypervisor (PLIC) and the OS. |
27 | */ | ||
28 | |||
29 | struct ItLpNaca { | ||
32 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data | 30 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data |
33 | //============================================================================= | ||
34 | u32 xDesc; // Eye catcher x00-x03 | 31 | u32 xDesc; // Eye catcher x00-x03 |
35 | u16 xSize; // Size of this class x04-x05 | 32 | u16 xSize; // Size of this class x04-x05 |
36 | u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07 | 33 | u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07 |
@@ -59,30 +56,25 @@ struct ItLpNaca | |||
59 | u64 xLoadAreaAddr; // ER address of load area x28-x2F | 56 | u64 xLoadAreaAddr; // ER address of load area x28-x2F |
60 | u32 xLoadAreaChunks; // Chunks for the load area x30-x33 | 57 | u32 xLoadAreaChunks; // Chunks for the load area x30-x33 |
61 | u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37 | 58 | u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37 |
62 | // doing an ASR switch on PASE | 59 | // doing an ASR switch on PASE |
63 | // system call. | 60 | // system call. |
64 | u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f | 61 | u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f |
65 | u8 xRsvd1_4[64]; // x40-x7F | 62 | u8 xRsvd1_4[64]; // x40-x7F |
66 | 63 | ||
67 | //============================================================================= | ||
68 | // CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data | 64 | // CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data |
69 | //============================================================================= | ||
70 | u8 xRsvd2_0[128]; // Reserved x00-x7F | 65 | u8 xRsvd2_0[128]; // Reserved x00-x7F |
71 | 66 | ||
72 | //============================================================================= | ||
73 | // CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators | 67 | // CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators |
74 | // NB: Padding required to keep xInterrruptHdlr at x300 which is required | 68 | // NB: Padding required to keep xInterrruptHdlr at x300 which is required |
75 | // for v4r4 PLIC. | 69 | // for v4r4 PLIC. |
76 | //============================================================================= | ||
77 | u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F | 70 | u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F |
78 | u8 xRsvd3_0[384]; // Reserved 180-2FF | 71 | u8 xRsvd3_0[384]; // Reserved 180-2FF |
79 | //============================================================================= | 72 | |
80 | // CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt | 73 | // CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt |
81 | // handlers | 74 | // handlers |
82 | //============================================================================= | ||
83 | u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF | 75 | u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF |
84 | }; | 76 | }; |
85 | 77 | ||
86 | //============================================================================= | 78 | extern struct ItLpNaca itLpNaca; |
87 | 79 | ||
88 | #endif /* _ITLPNACA_H */ | 80 | #endif /* _ITLPNACA_H */ |
diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index 4f4dde2a638d..393299e04d7f 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * ItLpQueue.h | 2 | * ItLpQueue.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,54 +19,54 @@ | |||
19 | #ifndef _ITLPQUEUE_H | 19 | #ifndef _ITLPQUEUE_H |
20 | #define _ITLPQUEUE_H | 20 | #define _ITLPQUEUE_H |
21 | 21 | ||
22 | //============================================================================= | 22 | /* |
23 | // | 23 | * This control block defines the simple LP queue structure that is |
24 | // This control block defines the simple LP queue structure that is | 24 | * shared between the hypervisor (PLIC) and the OS in order to send |
25 | // shared between the hypervisor (PLIC) and the OS in order to send | 25 | * events to an LP. |
26 | // events to an LP. | 26 | */ |
27 | // | ||
28 | 27 | ||
29 | #include <asm/types.h> | 28 | #include <asm/types.h> |
30 | #include <asm/ptrace.h> | 29 | #include <asm/ptrace.h> |
31 | 30 | ||
32 | struct HvLpEvent; | 31 | struct HvLpEvent; |
33 | 32 | ||
34 | #define ITMaxLpQueues 8 | 33 | #define ITMaxLpQueues 8 |
35 | 34 | ||
36 | #define NotUsed 0 // Queue will not be used by PLIC | 35 | #define NotUsed 0 // Queue will not be used by PLIC |
37 | #define DedicatedIo 1 // Queue dedicated to IO processor specified | 36 | #define DedicatedIo 1 // Queue dedicated to IO processor specified |
38 | #define DedicatedLp 2 // Queue dedicated to LP specified | 37 | #define DedicatedLp 2 // Queue dedicated to LP specified |
39 | #define Shared 3 // Queue shared for both IO and LP | 38 | #define Shared 3 // Queue shared for both IO and LP |
40 | 39 | ||
41 | #define LpEventStackSize 4096 | 40 | #define LpEventStackSize 4096 |
42 | #define LpEventMaxSize 256 | 41 | #define LpEventMaxSize 256 |
43 | #define LpEventAlign 64 | 42 | #define LpEventAlign 64 |
44 | 43 | ||
45 | struct ItLpQueue | 44 | struct ItLpQueue { |
46 | { | 45 | /* |
47 | // | 46 | * The xSlicCurEventPtr is the pointer to the next event stack entry |
48 | // The xSlicCurEventPtr is the pointer to the next event stack entry that will | 47 | * that will become valid. The OS must peek at this entry to determine |
49 | // become valid. The OS must peek at this entry to determine if it is valid. | 48 | * if it is valid. PLIC will set the valid indicator as the very last |
50 | // PLIC will set the valid indicator as the very last store into that entry. | 49 | * store into that entry. |
51 | // | 50 | * |
52 | // When the OS has completed processing of the event then it will mark the event | 51 | * When the OS has completed processing of the event then it will mark |
53 | // as invalid so that PLIC knows it can store into that event location again. | 52 | * the event as invalid so that PLIC knows it can store into that event |
54 | // | 53 | * location again. |
55 | // If the event stack fills and there are overflow events, then PLIC will set | 54 | * |
56 | // the xPlicOverflowIntPending flag in which case the OS will have to fetch the | 55 | * If the event stack fills and there are overflow events, then PLIC |
57 | // additional LP events once they have drained the event stack. | 56 | * will set the xPlicOverflowIntPending flag in which case the OS will |
58 | // | 57 | * have to fetch the additional LP events once they have drained the |
59 | // The first 16-bytes are known by both the OS and PLIC. The remainder of the | 58 | * event stack. |
60 | // cache line is for use by the OS. | 59 | * |
61 | // | 60 | * The first 16-bytes are known by both the OS and PLIC. The remainder |
62 | //============================================================================= | 61 | * of the cache line is for use by the OS. |
62 | */ | ||
63 | u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending | 63 | u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending |
64 | u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed | 64 | u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed |
65 | u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation | 65 | u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation |
66 | u8 xPlicRsvd[12]; // 0x04 | 66 | u8 xPlicRsvd[12]; // 0x04 |
67 | char* xSlicCurEventPtr; // 0x10 | 67 | char *xSlicCurEventPtr; // 0x10 |
68 | char* xSlicLastValidEventPtr; // 0x18 | 68 | char *xSlicLastValidEventPtr; // 0x18 |
69 | char* xSlicEventStackPtr; // 0x20 | 69 | char *xSlicEventStackPtr; // 0x20 |
70 | u8 xIndex; // 0x28 unique sequential index. | 70 | u8 xIndex; // 0x28 unique sequential index. |
71 | u8 xSlicRsvd[3]; // 0x29-2b | 71 | u8 xSlicRsvd[3]; // 0x29-2b |
72 | u32 xInUseWord; // 0x2C | 72 | u32 xInUseWord; // 0x2C |
@@ -76,17 +76,9 @@ struct ItLpQueue | |||
76 | 76 | ||
77 | extern struct ItLpQueue xItLpQueue; | 77 | extern struct ItLpQueue xItLpQueue; |
78 | 78 | ||
79 | extern struct HvLpEvent * ItLpQueue_getNextLpEvent( struct ItLpQueue * ); | 79 | extern struct HvLpEvent *ItLpQueue_getNextLpEvent(struct ItLpQueue *); |
80 | extern int ItLpQueue_isLpIntPending( struct ItLpQueue * ); | 80 | extern int ItLpQueue_isLpIntPending(struct ItLpQueue *); |
81 | extern unsigned ItLpQueue_process( struct ItLpQueue *, struct pt_regs * ); | 81 | extern unsigned ItLpQueue_process(struct ItLpQueue *, struct pt_regs *); |
82 | extern void ItLpQueue_clearValid( struct HvLpEvent * ); | 82 | extern void ItLpQueue_clearValid(struct HvLpEvent *); |
83 | |||
84 | static __inline__ void process_iSeries_events( void ) | ||
85 | { | ||
86 | __asm__ __volatile__ ( | ||
87 | " li 0,0x5555 \n\ | ||
88 | sc" | ||
89 | : : : "r0", "r3" ); | ||
90 | } | ||
91 | 83 | ||
92 | #endif /* _ITLPQUEUE_H */ | 84 | #endif /* _ITLPQUEUE_H */ |
diff --git a/include/asm-ppc64/iSeries/ItLpRegSave.h b/include/asm-ppc64/iSeries/ItLpRegSave.h index dafc4c813788..1b3087e76205 100644 --- a/include/asm-ppc64/iSeries/ItLpRegSave.h +++ b/include/asm-ppc64/iSeries/ItLpRegSave.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * ItLpRegSave.h | 2 | * ItLpRegSave.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,33 +19,30 @@ | |||
19 | #ifndef _ITLPREGSAVE_H | 19 | #ifndef _ITLPREGSAVE_H |
20 | #define _ITLPREGSAVE_H | 20 | #define _ITLPREGSAVE_H |
21 | 21 | ||
22 | //===================================================================================== | 22 | /* |
23 | // | 23 | * This control block contains the data that is shared between PLIC |
24 | // This control block contains the data that is shared between PLIC | 24 | * and the OS |
25 | // and the OS | 25 | */ |
26 | // | ||
27 | // | ||
28 | 26 | ||
29 | struct ItLpRegSave | 27 | struct ItLpRegSave { |
30 | { | ||
31 | u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003 | 28 | u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003 |
32 | u16 xSize; // Size of this class 004-005 | 29 | u16 xSize; // Size of this class 004-005 |
33 | u8 xInUse; // Area is live 006-007 | 30 | u8 xInUse; // Area is live 006-007 |
34 | u8 xRsvd1[9]; // Reserved 007-00F | 31 | u8 xRsvd1[9]; // Reserved 007-00F |
35 | 32 | ||
36 | u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F | 33 | u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F |
37 | u32 xCTRL; // Control Register 170-173 | 34 | u32 xCTRL; // Control Register 170-173 |
38 | u32 xDEC; // Decrementer 174-177 | 35 | u32 xDEC; // Decrementer 174-177 |
39 | u32 xFPSCR; // FP Status and Control Reg 178-17B | 36 | u32 xFPSCR; // FP Status and Control Reg 178-17B |
40 | u32 xPVR; // Processor Version Number 17C-17F | 37 | u32 xPVR; // Processor Version Number 17C-17F |
41 | 38 | ||
42 | u64 xMMCR0; // Monitor Mode Control Reg 0 180-187 | 39 | u64 xMMCR0; // Monitor Mode Control Reg 0 180-187 |
43 | u32 xPMC1; // Perf Monitor Counter 1 188-18B | 40 | u32 xPMC1; // Perf Monitor Counter 1 188-18B |
44 | u32 xPMC2; // Perf Monitor Counter 2 18C-18F | 41 | u32 xPMC2; // Perf Monitor Counter 2 18C-18F |
45 | u32 xPMC3; // Perf Monitor Counter 3 190-193 | 42 | u32 xPMC3; // Perf Monitor Counter 3 190-193 |
46 | u32 xPMC4; // Perf Monitor Counter 4 194-197 | 43 | u32 xPMC4; // Perf Monitor Counter 4 194-197 |
47 | u32 xPIR; // Processor ID Reg 198-19B | 44 | u32 xPIR; // Processor ID Reg 198-19B |
48 | 45 | ||
49 | u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F | 46 | u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F |
50 | u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3 | 47 | u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3 |
51 | u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7 | 48 | u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7 |
@@ -57,17 +54,17 @@ struct ItLpRegSave | |||
57 | u32 xRsvd; // Reserved 1BC-1BF | 54 | u32 xRsvd; // Reserved 1BC-1BF |
58 | 55 | ||
59 | u64 xACCR; // Address Compare Control Reg 1C0-1C7 | 56 | u64 xACCR; // Address Compare Control Reg 1C0-1C7 |
60 | u64 xIMR; // Instruction Match Register 1C8-1CF | 57 | u64 xIMR; // Instruction Match Register 1C8-1CF |
61 | u64 xSDR1; // Storage Description Reg 1 1D0-1D7 | 58 | u64 xSDR1; // Storage Description Reg 1 1D0-1D7 |
62 | u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF | 59 | u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF |
63 | u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7 | 60 | u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7 |
64 | u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF | 61 | u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF |
65 | u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7 | 62 | u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7 |
66 | u64 xTB; // Time Base Register 1F8-1FF | 63 | u64 xTB; // Time Base Register 1F8-1FF |
67 | 64 | ||
68 | u64 xFPR[32]; // Floating Point Registers 200-2FF | 65 | u64 xFPR[32]; // Floating Point Registers 200-2FF |
69 | 66 | ||
70 | u64 xMSR; // Machine State Register 300-307 | 67 | u64 xMSR; // Machine State Register 300-307 |
71 | u64 xNIA; // Next Instruction Address 308-30F | 68 | u64 xNIA; // Next Instruction Address 308-30F |
72 | 69 | ||
73 | u64 xDABR; // Data Address Breakpoint Reg 310-317 | 70 | u64 xDABR; // Data Address Breakpoint Reg 310-317 |
@@ -76,8 +73,8 @@ struct ItLpRegSave | |||
76 | u64 xHID0; // HW Implementation Dependent0 320-327 | 73 | u64 xHID0; // HW Implementation Dependent0 320-327 |
77 | 74 | ||
78 | u64 xHID4; // HW Implementation Dependent4 328-32F | 75 | u64 xHID4; // HW Implementation Dependent4 328-32F |
79 | u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337 | 76 | u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337 |
80 | u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F | 77 | u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F |
81 | u64 xSDAR; // Sample Data Address Register 340-347 | 78 | u64 xSDAR; // Sample Data Address Register 340-347 |
82 | u64 xSIAR; // Sample Inst Address Register 348-34F | 79 | u64 xSIAR; // Sample Inst Address Register 348-34F |
83 | 80 | ||
diff --git a/include/asm-ppc64/iSeries/ItSpCommArea.h b/include/asm-ppc64/iSeries/ItSpCommArea.h index f1b56f9e11e2..5535f8271c9f 100644 --- a/include/asm-ppc64/iSeries/ItSpCommArea.h +++ b/include/asm-ppc64/iSeries/ItSpCommArea.h | |||
@@ -1,29 +1,27 @@ | |||
1 | /* | 1 | /* |
2 | * ItSpCommArea.h | 2 | * ItSpCommArea.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | |||
21 | #ifndef _ITSPCOMMAREA_H | 20 | #ifndef _ITSPCOMMAREA_H |
22 | #define _ITSPCOMMAREA_H | 21 | #define _ITSPCOMMAREA_H |
23 | 22 | ||
24 | 23 | ||
25 | struct SpCommArea | 24 | struct SpCommArea { |
26 | { | ||
27 | u32 xDesc; // Descriptor (only in new formats) 000-003 | 25 | u32 xDesc; // Descriptor (only in new formats) 000-003 |
28 | u8 xFormat; // Format (only in new formats) 004-004 | 26 | u8 xFormat; // Format (only in new formats) 004-004 |
29 | u8 xRsvd1[11]; // Reserved 005-00F | 27 | u8 xRsvd1[11]; // Reserved 005-00F |
diff --git a/include/asm-ppc64/iSeries/ItVpdAreas.h b/include/asm-ppc64/iSeries/ItVpdAreas.h index d120439f30a5..71b3ad24f95a 100644 --- a/include/asm-ppc64/iSeries/ItVpdAreas.h +++ b/include/asm-ppc64/iSeries/ItVpdAreas.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * ItVpdAreas.h | 2 | * ItVpdAreas.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -19,78 +19,71 @@ | |||
19 | #ifndef _ITVPDAREAS_H | 19 | #ifndef _ITVPDAREAS_H |
20 | #define _ITVPDAREAS_H | 20 | #define _ITVPDAREAS_H |
21 | 21 | ||
22 | //===================================================================================== | 22 | /* |
23 | // | 23 | * This file defines the address and length of all of the VPD area passed to |
24 | // This file defines the address and length of all of the VPD area passed to | 24 | * the OS from PLIC (most of which start from the SP). |
25 | // the OS from PLIC (most of which start from the SP). | 25 | */ |
26 | // | ||
27 | 26 | ||
28 | #include <asm/types.h> | 27 | #include <asm/types.h> |
29 | 28 | ||
30 | // VPD Entry index is carved in stone - cannot be changed (easily). | 29 | /* VPD Entry index is carved in stone - cannot be changed (easily). */ |
31 | #define ItVpdCecVpd 0 | 30 | #define ItVpdCecVpd 0 |
32 | #define ItVpdDynamicSpace 1 | 31 | #define ItVpdDynamicSpace 1 |
33 | #define ItVpdExtVpd 2 | 32 | #define ItVpdExtVpd 2 |
34 | #define ItVpdExtVpdOnPanel 3 | 33 | #define ItVpdExtVpdOnPanel 3 |
35 | #define ItVpdFirstPaca 4 | 34 | #define ItVpdFirstPaca 4 |
36 | #define ItVpdIoVpd 5 | 35 | #define ItVpdIoVpd 5 |
37 | #define ItVpdIplParms 6 | 36 | #define ItVpdIplParms 6 |
38 | #define ItVpdMsVpd 7 | 37 | #define ItVpdMsVpd 7 |
39 | #define ItVpdPanelVpd 8 | 38 | #define ItVpdPanelVpd 8 |
40 | #define ItVpdLpNaca 9 | 39 | #define ItVpdLpNaca 9 |
41 | #define ItVpdBackplaneAndMaybeClockCardVpd 10 | 40 | #define ItVpdBackplaneAndMaybeClockCardVpd 10 |
42 | #define ItVpdRecoveryLogBuffer 11 | 41 | #define ItVpdRecoveryLogBuffer 11 |
43 | #define ItVpdSpCommArea 12 | 42 | #define ItVpdSpCommArea 12 |
44 | #define ItVpdSpLogBuffer 13 | 43 | #define ItVpdSpLogBuffer 13 |
45 | #define ItVpdSpLogBufferSave 14 | 44 | #define ItVpdSpLogBufferSave 14 |
46 | #define ItVpdSpCardVpd 15 | 45 | #define ItVpdSpCardVpd 15 |
47 | #define ItVpdFirstProcVpd 16 | 46 | #define ItVpdFirstProcVpd 16 |
48 | #define ItVpdApModelVpd 17 | 47 | #define ItVpdApModelVpd 17 |
49 | #define ItVpdClockCardVpd 18 | 48 | #define ItVpdClockCardVpd 18 |
50 | #define ItVpdBusExtCardVpd 19 | 49 | #define ItVpdBusExtCardVpd 19 |
51 | #define ItVpdProcCapacityVpd 20 | 50 | #define ItVpdProcCapacityVpd 20 |
52 | #define ItVpdInteractiveCapacityVpd 21 | 51 | #define ItVpdInteractiveCapacityVpd 21 |
53 | #define ItVpdFirstSlotLabel 22 | 52 | #define ItVpdFirstSlotLabel 22 |
54 | #define ItVpdFirstLpQueue 23 | 53 | #define ItVpdFirstLpQueue 23 |
55 | #define ItVpdFirstL3CacheVpd 24 | 54 | #define ItVpdFirstL3CacheVpd 24 |
56 | #define ItVpdFirstProcFruVpd 25 | 55 | #define ItVpdFirstProcFruVpd 25 |
57 | |||
58 | #define ItVpdMaxEntries 26 | ||
59 | 56 | ||
57 | #define ItVpdMaxEntries 26 | ||
60 | 58 | ||
61 | #define ItDmaMaxEntries 10 | 59 | #define ItDmaMaxEntries 10 |
62 | 60 | ||
63 | #define ItVpdAreasMaxSlotLabels 192 | 61 | #define ItVpdAreasMaxSlotLabels 192 |
64 | 62 | ||
65 | 63 | ||
66 | struct SlicVpdAdrs { | 64 | struct ItVpdAreas { |
67 | u32 pad1; | 65 | u32 xSlicDesc; // Descriptor 000-003 |
68 | void * vpdAddr; | 66 | u16 xSlicSize; // Size of this control block 004-005 |
67 | u16 xPlicAdjustVpdLens:1; // Flag to indicate new interface006-007 | ||
68 | u16 xRsvd1:15; // Reserved bits ... | ||
69 | u16 xSlicVpdEntries; // Number of VPD entries 008-009 | ||
70 | u16 xSlicDmaEntries; // Number of DMA entries 00A-00B | ||
71 | u16 xSlicMaxLogicalProcs; // Maximum logical processors 00C-00D | ||
72 | u16 xSlicMaxPhysicalProcs; // Maximum physical processors 00E-00F | ||
73 | u16 xSlicDmaToksOffset; // Offset into this of array 010-011 | ||
74 | u16 xSlicVpdAdrsOffset; // Offset into this of array 012-013 | ||
75 | u16 xSlicDmaLensOffset; // Offset into this of array 014-015 | ||
76 | u16 xSlicVpdLensOffset; // Offset into this of array 016-017 | ||
77 | u16 xSlicMaxSlotLabels; // Maximum number of slot labels018-019 | ||
78 | u16 xSlicMaxLpQueues; // Maximum number of LP Queues 01A-01B | ||
79 | u8 xRsvd2[4]; // Reserved 01C-01F | ||
80 | u64 xRsvd3[12]; // Reserved 020-07F | ||
81 | u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7 | ||
82 | u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF | ||
83 | u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F | ||
84 | void *xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF | ||
69 | }; | 85 | }; |
70 | 86 | ||
71 | 87 | extern struct ItVpdAreas itVpdAreas; | |
72 | struct ItVpdAreas | ||
73 | { | ||
74 | u32 xSlicDesc; // Descriptor 000-003 | ||
75 | u16 xSlicSize; // Size of this control block 004-005 | ||
76 | u16 xPlicAdjustVpdLens:1; // Flag to indicate new interface 006-007 | ||
77 | u16 xRsvd1:15; // Reserved bits ... | ||
78 | u16 xSlicVpdEntries; // Number of VPD entries 008-009 | ||
79 | u16 xSlicDmaEntries; // Number of DMA entries 00A-00B | ||
80 | u16 xSlicMaxLogicalProcs; // Maximum logical processors 00C-00D | ||
81 | u16 xSlicMaxPhysicalProcs; // Maximum physical processors 00E-00F | ||
82 | u16 xSlicDmaToksOffset; // Offset into this of array 010-011 | ||
83 | u16 xSlicVpdAdrsOffset; // Offset into this of array 012-013 | ||
84 | u16 xSlicDmaLensOffset; // Offset into this of array 014-015 | ||
85 | u16 xSlicVpdLensOffset; // Offset into this of array 016-017 | ||
86 | u16 xSlicMaxSlotLabels; // Maximum number of slot labels 018-019 | ||
87 | u16 xSlicMaxLpQueues; // Maximum number of LP Queues 01A-01B | ||
88 | u8 xRsvd2[4]; // Reserved 01C-01F | ||
89 | u64 xRsvd3[12]; // Reserved 020-07F | ||
90 | u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7 | ||
91 | u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF | ||
92 | u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F | ||
93 | void * xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF | ||
94 | }; | ||
95 | 88 | ||
96 | #endif /* _ITVPDAREAS_H */ | 89 | #endif /* _ITVPDAREAS_H */ |
diff --git a/include/asm-ppc64/iSeries/LparData.h b/include/asm-ppc64/iSeries/LparData.h deleted file mode 100644 index e54f3b686e58..000000000000 --- a/include/asm-ppc64/iSeries/LparData.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* | ||
2 | * LparData.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef _LPARDATA_H | ||
21 | #define _LPARDATA_H | ||
22 | |||
23 | #include <asm/types.h> | ||
24 | #include <asm/page.h> | ||
25 | #include <asm/abs_addr.h> | ||
26 | |||
27 | #include <asm/iSeries/ItLpNaca.h> | ||
28 | #include <asm/iSeries/ItLpRegSave.h> | ||
29 | #include <asm/iSeries/HvReleaseData.h> | ||
30 | #include <asm/iSeries/LparMap.h> | ||
31 | #include <asm/iSeries/ItVpdAreas.h> | ||
32 | #include <asm/iSeries/ItIplParmsReal.h> | ||
33 | #include <asm/iSeries/ItExtVpdPanel.h> | ||
34 | #include <asm/iSeries/ItLpQueue.h> | ||
35 | #include <asm/iSeries/IoHriProcessorVpd.h> | ||
36 | |||
37 | extern struct LparMap xLparMap; | ||
38 | extern struct HvReleaseData hvReleaseData; | ||
39 | extern struct ItLpNaca itLpNaca; | ||
40 | extern struct ItIplParmsReal xItIplParmsReal; | ||
41 | extern struct ItExtVpdPanel xItExtVpdPanel; | ||
42 | extern struct IoHriProcessorVpd xIoHriProcessorVpd[]; | ||
43 | extern struct ItLpQueue xItLpQueue; | ||
44 | extern struct ItVpdAreas itVpdAreas; | ||
45 | extern u64 xMsVpd[]; | ||
46 | extern struct msChunks msChunks; | ||
47 | |||
48 | |||
49 | #endif /* _LPARDATA_H */ | ||
diff --git a/include/asm-ppc64/iSeries/LparMap.h b/include/asm-ppc64/iSeries/LparMap.h index 075205bb0f4a..038e5df7e9f8 100644 --- a/include/asm-ppc64/iSeries/LparMap.h +++ b/include/asm-ppc64/iSeries/LparMap.h | |||
@@ -1,17 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * LparMap.h | 2 | * LparMap.h |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -21,13 +21,14 @@ | |||
21 | 21 | ||
22 | #include <asm/types.h> | 22 | #include <asm/types.h> |
23 | 23 | ||
24 | /* The iSeries hypervisor will set up mapping for one or more | 24 | /* |
25 | * The iSeries hypervisor will set up mapping for one or more | ||
25 | * ESID/VSID pairs (in SLB/segment registers) and will set up | 26 | * ESID/VSID pairs (in SLB/segment registers) and will set up |
26 | * mappings of one or more ranges of pages to VAs. | 27 | * mappings of one or more ranges of pages to VAs. |
27 | * We will have the hypervisor set up the ESID->VSID mapping | 28 | * We will have the hypervisor set up the ESID->VSID mapping |
28 | * for the four kernel segments (C-F). With shared processors, | 29 | * for the four kernel segments (C-F). With shared processors, |
29 | * the hypervisor will clear all segment registers and reload | 30 | * the hypervisor will clear all segment registers and reload |
30 | * these four whenever the processor is switched from one | 31 | * these four whenever the processor is switched from one |
31 | * partition to another. | 32 | * partition to another. |
32 | */ | 33 | */ |
33 | 34 | ||
@@ -38,30 +39,31 @@ | |||
38 | * need to be located within the load area (if the total partition size | 39 | * need to be located within the load area (if the total partition size |
39 | * is 64 MB), but cannot be mapped. Typically, this should specify | 40 | * is 64 MB), but cannot be mapped. Typically, this should specify |
40 | * to map half (32 MB) of the load area. | 41 | * to map half (32 MB) of the load area. |
41 | * | 42 | * |
42 | * The hypervisor will set up page table entries for the number of | 43 | * The hypervisor will set up page table entries for the number of |
43 | * pages specified. | 44 | * pages specified. |
44 | * | 45 | * |
45 | * In 32-bit mode, the hypervisor will load all four of the | 46 | * In 32-bit mode, the hypervisor will load all four of the |
46 | * segment registers (identified by the low-order four bits of the | 47 | * segment registers (identified by the low-order four bits of the |
47 | * Esid field. In 64-bit mode, the hypervisor will load one SLB | 48 | * Esid field. In 64-bit mode, the hypervisor will load one SLB |
48 | * entry to map the Esid to the Vsid. | 49 | * entry to map the Esid to the Vsid. |
49 | */ | 50 | */ |
50 | 51 | ||
51 | // Hypervisor initially maps 32MB of the load area | 52 | /* Hypervisor initially maps 32MB of the load area */ |
52 | #define HvPagesToMap 8192 | 53 | #define HvPagesToMap 8192 |
53 | 54 | ||
54 | struct LparMap | 55 | struct LparMap { |
55 | { | 56 | u64 xNumberEsids; // Number of ESID/VSID pairs (1) |
56 | u64 xNumberEsids; // Number of ESID/VSID pairs (1) | 57 | u64 xNumberRanges; // Number of VA ranges to map (1) |
57 | u64 xNumberRanges; // Number of VA ranges to map (1) | 58 | u64 xSegmentTableOffs; // Page number within load area of seg table (0) |
58 | u64 xSegmentTableOffs; // Page number within load area of seg table (0) | 59 | u64 xRsvd[5]; |
59 | u64 xRsvd[5]; // Reserved (0) | 60 | u64 xKernelEsid; // Esid used to map kernel load (0x0C00000000) |
60 | u64 xKernelEsid; // Esid used to map kernel load (0x0C00000000) | 61 | u64 xKernelVsid; // Vsid used to map kernel load (0x0C00000000) |
61 | u64 xKernelVsid; // Vsid used to map kernel load (0x0C00000000) | 62 | u64 xPages; // Number of pages to be mapped (8192) |
62 | u64 xPages; // Number of pages to be mapped (8192) | 63 | u64 xOffset; // Offset from start of load area (0) |
63 | u64 xOffset; // Offset from start of load area (0) | 64 | u64 xVPN; // Virtual Page Number (0x000C000000000000) |
64 | u64 xVPN; // Virtual Page Number (0x000C000000000000) | ||
65 | }; | 65 | }; |
66 | 66 | ||
67 | extern struct LparMap xLparMap; | ||
68 | |||
67 | #endif /* _LPARMAP_H */ | 69 | #endif /* _LPARMAP_H */ |
diff --git a/include/asm-ppc64/iSeries/XmPciLpEvent.h b/include/asm-ppc64/iSeries/XmPciLpEvent.h deleted file mode 100644 index a3d27f116e49..000000000000 --- a/include/asm-ppc64/iSeries/XmPciLpEvent.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | |||
2 | #ifndef __XMPCILPEVENT_H__ | ||
3 | #define __XMPCILPEVENT_H__ | ||
4 | |||
5 | |||
6 | #ifdef __cplusplus | ||
7 | extern "C" { | ||
8 | #endif | ||
9 | |||
10 | int XmPciLpEvent_init(void); | ||
11 | void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq); | ||
12 | |||
13 | |||
14 | #ifdef __cplusplus | ||
15 | } | ||
16 | #endif | ||
17 | |||
18 | #endif /* __XMPCILPEVENT_H__ */ | ||
diff --git a/include/asm-ppc64/iSeries/iSeries_io.h b/include/asm-ppc64/iSeries/iSeries_io.h index f52b7599b372..9f79413342b3 100644 --- a/include/asm-ppc64/iSeries/iSeries_io.h +++ b/include/asm-ppc64/iSeries/iSeries_io.h | |||
@@ -5,32 +5,33 @@ | |||
5 | 5 | ||
6 | #ifdef CONFIG_PPC_ISERIES | 6 | #ifdef CONFIG_PPC_ISERIES |
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | /************************************************************************/ | 8 | /* |
9 | /* File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000. */ | 9 | * File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000. |
10 | /************************************************************************/ | 10 | * |
11 | /* Remaps the io.h for the iSeries Io */ | 11 | * Remaps the io.h for the iSeries Io |
12 | /* Copyright (C) 20yy Allan H Trautman, IBM Corporation */ | 12 | * Copyright (C) 2000 Allan H Trautman, IBM Corporation |
13 | /* */ | 13 | * |
14 | /* This program is free software; you can redistribute it and/or modify */ | 14 | * This program is free software; you can redistribute it and/or modify |
15 | /* it under the terms of the GNU General Public License as published by */ | 15 | * it under the terms of the GNU General Public License as published by |
16 | /* the Free Software Foundation; either version 2 of the License, or */ | 16 | * the Free Software Foundation; either version 2 of the License, or |
17 | /* (at your option) any later version. */ | 17 | * (at your option) any later version. |
18 | /* */ | 18 | * |
19 | /* This program is distributed in the hope that it will be useful, */ | 19 | * This program is distributed in the hope that it will be useful, |
20 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | /* GNU General Public License for more details. */ | 22 | * GNU General Public License for more details. |
23 | /* */ | 23 | * |
24 | /* You should have received a copy of the GNU General Public License */ | 24 | * You should have received a copy of the GNU General Public License |
25 | /* along with this program; if not, write to the: */ | 25 | * along with this program; if not, write to the: |
26 | /* Free Software Foundation, Inc., */ | 26 | * Free Software Foundation, Inc., |
27 | /* 59 Temple Place, Suite 330, */ | 27 | * 59 Temple Place, Suite 330, |
28 | /* Boston, MA 02111-1307 USA */ | 28 | * Boston, MA 02111-1307 USA |
29 | /************************************************************************/ | 29 | * |
30 | /* Change Activity: */ | 30 | * Change Activity: |
31 | /* Created December 28, 2000 */ | 31 | * Created December 28, 2000 |
32 | /* End Change Activity */ | 32 | * End Change Activity |
33 | /************************************************************************/ | 33 | */ |
34 | |||
34 | extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); | 35 | extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); |
35 | extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); | 36 | extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); |
36 | extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); | 37 | extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); |
@@ -39,8 +40,10 @@ extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress); | |||
39 | extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); | 40 | extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); |
40 | 41 | ||
41 | extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); | 42 | extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); |
42 | extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t n); | 43 | extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, |
43 | extern void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *source, size_t n); | 44 | size_t n); |
45 | extern void iSeries_memcpy_fromio(void *dest, | ||
46 | const volatile void __iomem *source, size_t n); | ||
44 | 47 | ||
45 | #endif /* CONFIG_PPC_ISERIES */ | 48 | #endif /* CONFIG_PPC_ISERIES */ |
46 | #endif /* _ISERIES_IO_H */ | 49 | #endif /* _ISERIES_IO_H */ |
diff --git a/include/asm-ppc64/iSeries/iSeries_irq.h b/include/asm-ppc64/iSeries/iSeries_irq.h index ff8ddede038c..6c9767ac1302 100644 --- a/include/asm-ppc64/iSeries/iSeries_irq.h +++ b/include/asm-ppc64/iSeries/iSeries_irq.h | |||
@@ -1,19 +1,8 @@ | |||
1 | #ifndef __ISERIES_IRQ_H__ | 1 | #ifndef __ISERIES_IRQ_H__ |
2 | #define __ISERIES_IRQ_H__ | 2 | #define __ISERIES_IRQ_H__ |
3 | 3 | ||
4 | #ifdef __cplusplus | 4 | extern void iSeries_init_IRQ(void); |
5 | extern "C" { | 5 | extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId); |
6 | #endif | 6 | extern void iSeries_activate_IRQs(void); |
7 | |||
8 | void iSeries_init_IRQ(void); | ||
9 | int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId); | ||
10 | int iSeries_assign_IRQ(int, HvBusNumber, HvSubBusNumber, HvAgentId); | ||
11 | void iSeries_activate_IRQs(void); | ||
12 | |||
13 | int XmPciLpEvent_init(void); | ||
14 | |||
15 | #ifdef __cplusplus | ||
16 | } | ||
17 | #endif | ||
18 | 7 | ||
19 | #endif /* __ISERIES_IRQ_H__ */ | 8 | #endif /* __ISERIES_IRQ_H__ */ |
diff --git a/include/asm-ppc64/iSeries/iSeries_pci.h b/include/asm-ppc64/iSeries/iSeries_pci.h index 5769cff4c00c..575f611f8b33 100644 --- a/include/asm-ppc64/iSeries/iSeries_pci.h +++ b/include/asm-ppc64/iSeries/iSeries_pci.h | |||
@@ -1,112 +1,88 @@ | |||
1 | #ifndef _ISERIES_64_PCI_H | 1 | #ifndef _ISERIES_64_PCI_H |
2 | #define _ISERIES_64_PCI_H | 2 | #define _ISERIES_64_PCI_H |
3 | 3 | ||
4 | /************************************************************************/ | 4 | /* |
5 | /* File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001. */ | 5 | * File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001. |
6 | /************************************************************************/ | 6 | * |
7 | /* Define some useful macros for the iSeries pci routines. */ | 7 | * Define some useful macros for the iSeries pci routines. |
8 | /* Copyright (C) 2001 Allan H Trautman, IBM Corporation */ | 8 | * Copyright (C) 2001 Allan H Trautman, IBM Corporation |
9 | /* */ | 9 | * |
10 | /* This program is free software; you can redistribute it and/or modify */ | 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 */ | 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 */ | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | /* (at your option) any later version. */ | 13 | * (at your option) any later version. |
14 | /* */ | 14 | * |
15 | /* This program is distributed in the hope that it will be useful, */ | 15 | * This program is distributed in the hope that it will be useful, |
16 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | /* GNU General Public License for more details. */ | 18 | * GNU General Public License for more details. |
19 | /* */ | 19 | * |
20 | /* You should have received a copy of the GNU General Public License */ | 20 | * You should have received a copy of the GNU General Public License |
21 | /* along with this program; if not, write to the: */ | 21 | * along with this program; if not, write to the: |
22 | /* Free Software Foundation, Inc., */ | 22 | * Free Software Foundation, Inc., |
23 | /* 59 Temple Place, Suite 330, */ | 23 | * 59 Temple Place, Suite 330, |
24 | /* Boston, MA 02111-1307 USA */ | 24 | * Boston, MA 02111-1307 USA |
25 | /************************************************************************/ | 25 | * |
26 | /* Change Activity: */ | 26 | * Change Activity: |
27 | /* Created Feb 20, 2001 */ | 27 | * Created Feb 20, 2001 |
28 | /* Added device reset, March 22, 2001 */ | 28 | * Added device reset, March 22, 2001 |
29 | /* Ported to ppc64, May 25, 2001 */ | 29 | * Ported to ppc64, May 25, 2001 |
30 | /* End Change Activity */ | 30 | * End Change Activity |
31 | /************************************************************************/ | 31 | */ |
32 | 32 | ||
33 | #include <asm/iSeries/HvCallPci.h> | 33 | #include <asm/iSeries/HvCallPci.h> |
34 | #include <asm/abs_addr.h> | 34 | #include <asm/abs_addr.h> |
35 | 35 | ||
36 | struct pci_dev; /* For Forward Reference */ | 36 | struct pci_dev; /* For Forward Reference */ |
37 | struct iSeries_Device_Node; | 37 | struct iSeries_Device_Node; |
38 | 38 | ||
39 | /************************************************************************/ | 39 | /* |
40 | /* Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure */ | 40 | * Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure |
41 | /************************************************************************/ | 41 | */ |
42 | 42 | ||
43 | #define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber | 43 | #define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber |
44 | #define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber | 44 | #define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber |
45 | #define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId | 45 | #define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId |
46 | #define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr | 46 | #define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr |
47 | #define ISERIES_DEVFUN(DevPtr) DevPtr->DevFn | 47 | #define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node *)PciDev->sysdata) |
48 | #define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node*)PciDev->sysdata) | ||
49 | 48 | ||
50 | #define EADsMaxAgents 7 | 49 | #define EADsMaxAgents 7 |
51 | 50 | ||
52 | /************************************************************************/ | ||
53 | /* Decodes Linux DevFn to iSeries DevFn, bridge device, or function. */ | ||
54 | /* For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h */ | ||
55 | /************************************************************************/ | ||
56 | |||
57 | #define ISERIES_PCI_AGENTID(idsel,func) ((idsel & 0x0F) << 4) | (func & 0x07) | ||
58 | #define ISERIES_ENCODE_DEVICE(agentid) ((0x10) | ((agentid&0x20)>>2) | (agentid&07)) | ||
59 | |||
60 | #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) | ||
61 | #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) | ||
62 | |||
63 | /* | 51 | /* |
64 | * N.B. the ISERIES_DECODE_* macros are not used anywhere, and I think | 52 | * Decodes Linux DevFn to iSeries DevFn, bridge device, or function. |
65 | * the 0x71 (at least) must be wrong - 0x78 maybe? -- paulus. | 53 | * For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h |
66 | */ | 54 | */ |
67 | #define ISERIES_DECODE_DEVFN(linuxdevfn) (((linuxdevfn & 0x71) << 1) | (linuxdevfn & 0x07)) | ||
68 | #define ISERIES_DECODE_DEVICE(linuxdevfn) (((linuxdevfn & 0x38) >> 3) |(((linuxdevfn & 0x40) >> 2) + 0x10)) | ||
69 | #define ISERIES_DECODE_FUNCTION(linuxdevfn) (linuxdevfn & 0x07) | ||
70 | 55 | ||
71 | /************************************************************************/ | 56 | #define ISERIES_PCI_AGENTID(idsel, func) \ |
72 | /* Converts Virtual Address to Real Address for Hypervisor calls */ | 57 | (((idsel & 0x0F) << 4) | (func & 0x07)) |
73 | /************************************************************************/ | 58 | #define ISERIES_ENCODE_DEVICE(agentid) \ |
59 | ((0x10) | ((agentid & 0x20) >> 2) | (agentid & 0x07)) | ||
74 | 60 | ||
75 | #define ISERIES_HV_ADDR(virtaddr) (0x8000000000000000 | virt_to_abs(virtaddr)) | 61 | #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) |
62 | #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) | ||
76 | 63 | ||
77 | /************************************************************************/ | 64 | /* |
78 | /* iSeries Device Information */ | 65 | * Converts Virtual Address to Real Address for Hypervisor calls |
79 | /************************************************************************/ | 66 | */ |
67 | #define ISERIES_HV_ADDR(virtaddr) \ | ||
68 | (0x8000000000000000 | virt_to_abs(virtaddr)) | ||
80 | 69 | ||
70 | /* | ||
71 | * iSeries Device Information | ||
72 | */ | ||
81 | struct iSeries_Device_Node { | 73 | struct iSeries_Device_Node { |
82 | struct list_head Device_List; | 74 | struct list_head Device_List; |
83 | struct pci_dev* PciDev; /* Pointer to pci_dev structure*/ | 75 | struct pci_dev *PciDev; |
84 | union HvDsaMap DsaAddr; /* Direct Select Address */ | 76 | union HvDsaMap DsaAddr; /* Direct Select Address */ |
85 | /* busNumber,subBusNumber, */ | 77 | /* busNumber, subBusNumber, */ |
86 | /* deviceId, barNumber */ | 78 | /* deviceId, barNumber */ |
87 | HvAgentId AgentId; /* Hypervisor DevFn */ | 79 | int DevFn; /* Linux devfn */ |
88 | int DevFn; /* Linux devfn */ | 80 | int Irq; /* Assigned IRQ */ |
89 | int BarOffset; | 81 | int Flags; /* Possible flags(disable/bist)*/ |
90 | int Irq; /* Assigned IRQ */ | 82 | u8 LogicalSlot; /* Hv Slot Index for Tces */ |
91 | int ReturnCode; /* Return Code Holder */ | 83 | struct iommu_table *iommu_table;/* Device TCE Table */ |
92 | int IoRetry; /* Current Retry Count */ | ||
93 | int Flags; /* Possible flags(disable/bist)*/ | ||
94 | u16 Vendor; /* Vendor ID */ | ||
95 | u8 LogicalSlot; /* Hv Slot Index for Tces */ | ||
96 | struct iommu_table* iommu_table;/* Device TCE Table */ | ||
97 | u8 PhbId; /* Phb Card is on. */ | ||
98 | u16 Board; /* Board Number */ | ||
99 | u8 FrameId; /* iSeries spcn Frame Id */ | ||
100 | char CardLocation[4];/* Char format of planar vpd */ | ||
101 | char Location[20]; /* Frame 1, Card C10 */ | ||
102 | }; | 84 | }; |
103 | 85 | ||
104 | /************************************************************************/ | 86 | extern void iSeries_Device_Information(struct pci_dev*, int); |
105 | /* Functions */ | ||
106 | /************************************************************************/ | ||
107 | |||
108 | extern int iSeries_Device_Information(struct pci_dev*,char*, int); | ||
109 | extern void iSeries_Get_Location_Code(struct iSeries_Device_Node*); | ||
110 | extern int iSeries_Device_ToggleReset(struct pci_dev* PciDev, int AssertTime, int DelayTime); | ||
111 | 87 | ||
112 | #endif /* _ISERIES_64_PCI_H */ | 88 | #endif /* _ISERIES_64_PCI_H */ |
diff --git a/include/asm-ppc64/iSeries/iSeries_proc.h b/include/asm-ppc64/iSeries/iSeries_proc.h deleted file mode 100644 index adb6dc14dd4d..000000000000 --- a/include/asm-ppc64/iSeries/iSeries_proc.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * iSeries_proc.h | ||
3 | * Copyright (C) 2001 Kyle A. Lucke IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | #ifndef _ISERIES_PROC_H | ||
20 | #define _ISERIES_PROC_H | ||
21 | |||
22 | extern void iSeries_proc_early_init(void); | ||
23 | |||
24 | #endif /* _iSeries_PROC_H */ | ||
diff --git a/include/asm-ppc64/iSeries/mf.h b/include/asm-ppc64/iSeries/mf.h index 2e59a8e15a0b..7e6a0d936999 100644 --- a/include/asm-ppc64/iSeries/mf.h +++ b/include/asm-ppc64/iSeries/mf.h | |||
@@ -9,17 +9,16 @@ | |||
9 | * all partitions in the iSeries. It also provides miscellaneous low-level | 9 | * all partitions in the iSeries. It also provides miscellaneous low-level |
10 | * machine facility type operations. | 10 | * machine facility type operations. |
11 | * | 11 | * |
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by | 13 | * it under the terms of the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2 of the License, or | 14 | * the Free Software Foundation; either version 2 of the License, or |
16 | * (at your option) any later version. | 15 | * (at your option) any later version. |
17 | * | 16 | * |
18 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
22 | * | 21 | * |
23 | * You should have received a copy of the GNU General Public License | 22 | * You should have received a copy of the GNU General Public License |
24 | * along with this program; if not, write to the Free Software | 23 | * along with this program; if not, write to the Free Software |
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
@@ -52,6 +51,7 @@ extern void mf_clear_src(void); | |||
52 | extern void mf_init(void); | 51 | extern void mf_init(void); |
53 | 52 | ||
54 | extern int mf_get_rtc(struct rtc_time *tm); | 53 | extern int mf_get_rtc(struct rtc_time *tm); |
54 | extern int mf_get_boot_rtc(struct rtc_time *tm); | ||
55 | extern int mf_set_rtc(struct rtc_time *tm); | 55 | extern int mf_set_rtc(struct rtc_time *tm); |
56 | 56 | ||
57 | #endif /* _ASM_PPC64_ISERIES_MF_H */ | 57 | #endif /* _ASM_PPC64_ISERIES_MF_H */ |
diff --git a/include/asm-ppc64/iSeries/vio.h b/include/asm-ppc64/iSeries/vio.h index 3e5766a849d6..6c05e6257f53 100644 --- a/include/asm-ppc64/iSeries/vio.h +++ b/include/asm-ppc64/iSeries/vio.h | |||
@@ -8,32 +8,32 @@ | |||
8 | * Colin Devilbiss <devilbis@us.ibm.com> | 8 | * Colin Devilbiss <devilbis@us.ibm.com> |
9 | * | 9 | * |
10 | * (C) Copyright 2000 IBM Corporation | 10 | * (C) Copyright 2000 IBM Corporation |
11 | * | 11 | * |
12 | * This header file is used by the iSeries virtual I/O device | 12 | * This header file is used by the iSeries virtual I/O device |
13 | * drivers. It defines the interfaces to the common functions | 13 | * drivers. It defines the interfaces to the common functions |
14 | * (implemented in drivers/char/viopath.h) as well as defining | 14 | * (implemented in drivers/char/viopath.h) as well as defining |
15 | * common functions and structures. Currently (at the time I | 15 | * common functions and structures. Currently (at the time I |
16 | * wrote this comment) the iSeries virtual I/O device drivers | 16 | * wrote this comment) the iSeries virtual I/O device drivers |
17 | * that use this are | 17 | * that use this are |
18 | * drivers/block/viodasd.c | 18 | * drivers/block/viodasd.c |
19 | * drivers/char/viocons.c | 19 | * drivers/char/viocons.c |
20 | * drivers/char/viotape.c | 20 | * drivers/char/viotape.c |
21 | * drivers/cdrom/viocd.c | 21 | * drivers/cdrom/viocd.c |
22 | * | 22 | * |
23 | * The iSeries virtual ethernet support (veth.c) uses a whole | 23 | * The iSeries virtual ethernet support (veth.c) uses a whole |
24 | * different set of functions. | 24 | * different set of functions. |
25 | * | 25 | * |
26 | * This program is free software; you can redistribute it and/or | 26 | * This program is free software; you can redistribute it and/or |
27 | * modify it under the terms of the GNU General Public License as | 27 | * modify it under the terms of the GNU General Public License as |
28 | * published by the Free Software Foundation; either version 2 of the | 28 | * published by the Free Software Foundation; either version 2 of the |
29 | * License, or (at your option) anyu later version. | 29 | * License, or (at your option) anyu later version. |
30 | * | 30 | * |
31 | * This program is distributed in the hope that it will be useful, but | 31 | * This program is distributed in the hope that it will be useful, but |
32 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 32 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
34 | * General Public License for more details. | 34 | * General Public License for more details. |
35 | * | 35 | * |
36 | * You should have received a copy of the GNU General Public License | 36 | * You should have received a copy of the GNU General Public License |
37 | * along with this program; if not, write to the Free Software Foundation, | 37 | * along with this program; if not, write to the Free Software Foundation, |
38 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 38 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
39 | * | 39 | * |
@@ -44,39 +44,41 @@ | |||
44 | #include <asm/iSeries/HvTypes.h> | 44 | #include <asm/iSeries/HvTypes.h> |
45 | #include <asm/iSeries/HvLpEvent.h> | 45 | #include <asm/iSeries/HvLpEvent.h> |
46 | 46 | ||
47 | /* iSeries virtual I/O events use the subtype field in | 47 | /* |
48 | * iSeries virtual I/O events use the subtype field in | ||
48 | * HvLpEvent to figure out what kind of vio event is coming | 49 | * HvLpEvent to figure out what kind of vio event is coming |
49 | * in. We use a table to route these, and this defines | 50 | * in. We use a table to route these, and this defines |
50 | * the maximum number of distinct subtypes | 51 | * the maximum number of distinct subtypes |
51 | */ | 52 | */ |
52 | #define VIO_MAX_SUBTYPES 8 | 53 | #define VIO_MAX_SUBTYPES 8 |
53 | 54 | ||
54 | /* Each subtype can register a handler to process their events. | 55 | /* |
56 | * Each subtype can register a handler to process their events. | ||
55 | * The handler must have this interface. | 57 | * The handler must have this interface. |
56 | */ | 58 | */ |
57 | typedef void (vio_event_handler_t) (struct HvLpEvent * event); | 59 | typedef void (vio_event_handler_t) (struct HvLpEvent * event); |
58 | 60 | ||
59 | int viopath_open(HvLpIndex remoteLp, int subtype, int numReq); | 61 | extern int viopath_open(HvLpIndex remoteLp, int subtype, int numReq); |
60 | int viopath_close(HvLpIndex remoteLp, int subtype, int numReq); | 62 | extern int viopath_close(HvLpIndex remoteLp, int subtype, int numReq); |
61 | int vio_setHandler(int subtype, vio_event_handler_t * beh); | 63 | extern int vio_setHandler(int subtype, vio_event_handler_t * beh); |
62 | int vio_clearHandler(int subtype); | 64 | extern int vio_clearHandler(int subtype); |
63 | int viopath_isactive(HvLpIndex lp); | 65 | extern int viopath_isactive(HvLpIndex lp); |
64 | HvLpInstanceId viopath_sourceinst(HvLpIndex lp); | 66 | extern HvLpInstanceId viopath_sourceinst(HvLpIndex lp); |
65 | HvLpInstanceId viopath_targetinst(HvLpIndex lp); | 67 | extern HvLpInstanceId viopath_targetinst(HvLpIndex lp); |
66 | void vio_set_hostlp(void); | 68 | extern void vio_set_hostlp(void); |
67 | void *vio_get_event_buffer(int subtype); | 69 | extern void *vio_get_event_buffer(int subtype); |
68 | void vio_free_event_buffer(int subtype, void *buffer); | 70 | extern void vio_free_event_buffer(int subtype, void *buffer); |
69 | 71 | ||
70 | extern HvLpIndex viopath_hostLp; | 72 | extern HvLpIndex viopath_hostLp; |
71 | extern HvLpIndex viopath_ourLp; | 73 | extern HvLpIndex viopath_ourLp; |
72 | 74 | ||
73 | #define VIOCHAR_MAX_DATA 200 | 75 | #define VIOCHAR_MAX_DATA 200 |
74 | 76 | ||
75 | #define VIOMAJOR_SUBTYPE_MASK 0xff00 | 77 | #define VIOMAJOR_SUBTYPE_MASK 0xff00 |
76 | #define VIOMINOR_SUBTYPE_MASK 0x00ff | 78 | #define VIOMINOR_SUBTYPE_MASK 0x00ff |
77 | #define VIOMAJOR_SUBTYPE_SHIFT 8 | 79 | #define VIOMAJOR_SUBTYPE_SHIFT 8 |
78 | 80 | ||
79 | #define VIOVERSION 0x0101 | 81 | #define VIOVERSION 0x0101 |
80 | 82 | ||
81 | /* | 83 | /* |
82 | * This is the general structure for VIO errors; each module should have | 84 | * This is the general structure for VIO errors; each module should have |
@@ -89,8 +91,8 @@ struct vio_error_entry { | |||
89 | int errno; | 91 | int errno; |
90 | const char *msg; | 92 | const char *msg; |
91 | }; | 93 | }; |
92 | const struct vio_error_entry *vio_lookup_rc(const struct vio_error_entry | 94 | extern const struct vio_error_entry *vio_lookup_rc( |
93 | *local_table, u16 rc); | 95 | const struct vio_error_entry *local_table, u16 rc); |
94 | 96 | ||
95 | enum viosubtypes { | 97 | enum viosubtypes { |
96 | viomajorsubtype_monitor = 0x0100, | 98 | viomajorsubtype_monitor = 0x0100, |
@@ -102,7 +104,6 @@ enum viosubtypes { | |||
102 | viomajorsubtype_scsi = 0x0700 | 104 | viomajorsubtype_scsi = 0x0700 |
103 | }; | 105 | }; |
104 | 106 | ||
105 | |||
106 | enum vioconfigsubtype { | 107 | enum vioconfigsubtype { |
107 | vioconfigget = 0x0001, | 108 | vioconfigget = 0x0001, |
108 | }; | 109 | }; |
diff --git a/include/asm-ppc64/imalloc.h b/include/asm-ppc64/imalloc.h index 3a45e918bf16..e46ff68a6e41 100644 --- a/include/asm-ppc64/imalloc.h +++ b/include/asm-ppc64/imalloc.h | |||
@@ -4,9 +4,9 @@ | |||
4 | /* | 4 | /* |
5 | * Define the address range of the imalloc VM area. | 5 | * Define the address range of the imalloc VM area. |
6 | */ | 6 | */ |
7 | #define PHBS_IO_BASE IOREGIONBASE | 7 | #define PHBS_IO_BASE VMALLOC_END |
8 | #define IMALLOC_BASE (IOREGIONBASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */ | 8 | #define IMALLOC_BASE (PHBS_IO_BASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */ |
9 | #define IMALLOC_END (IOREGIONBASE + EADDR_MASK) | 9 | #define IMALLOC_END (VMALLOC_START + EADDR_MASK) |
10 | 10 | ||
11 | 11 | ||
12 | /* imalloc region types */ | 12 | /* imalloc region types */ |
@@ -18,7 +18,9 @@ | |||
18 | 18 | ||
19 | extern struct vm_struct * im_get_free_area(unsigned long size); | 19 | extern struct vm_struct * im_get_free_area(unsigned long size); |
20 | extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size, | 20 | extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size, |
21 | int region_type); | 21 | int region_type); |
22 | unsigned long im_free(void *addr); | 22 | extern void im_free(void *addr); |
23 | |||
24 | extern unsigned long ioremap_bot; | ||
23 | 25 | ||
24 | #endif /* _PPC64_IMALLOC_H */ | 26 | #endif /* _PPC64_IMALLOC_H */ |
diff --git a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h index bd53ca4dcfa2..729de5cc21d9 100644 --- a/include/asm-ppc64/iommu.h +++ b/include/asm-ppc64/iommu.h | |||
@@ -82,24 +82,6 @@ struct iommu_table { | |||
82 | unsigned long *it_map; /* A simple allocation bitmap for now */ | 82 | unsigned long *it_map; /* A simple allocation bitmap for now */ |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #ifdef CONFIG_PPC_ISERIES | ||
86 | struct iommu_table_cb { | ||
87 | unsigned long itc_busno; /* Bus number for this tce table */ | ||
88 | unsigned long itc_start; /* Will be NULL for secondary */ | ||
89 | unsigned long itc_totalsize; /* Size (in pages) of whole table */ | ||
90 | unsigned long itc_offset; /* Index into real tce table of the | ||
91 | start of our section */ | ||
92 | unsigned long itc_size; /* Size (in pages) of our section */ | ||
93 | unsigned long itc_index; /* Index of this tce table */ | ||
94 | unsigned short itc_maxtables; /* Max num of tables for partition */ | ||
95 | unsigned char itc_virtbus; /* Flag to indicate virtual bus */ | ||
96 | unsigned char itc_slotno; /* IOA Tce Slot Index */ | ||
97 | unsigned char itc_rsvd[4]; | ||
98 | }; | ||
99 | |||
100 | extern struct iommu_table vio_tce_table; /* Tce table for virtual bus */ | ||
101 | #endif /* CONFIG_PPC_ISERIES */ | ||
102 | |||
103 | struct scatterlist; | 85 | struct scatterlist; |
104 | 86 | ||
105 | #ifdef CONFIG_PPC_MULTIPLATFORM | 87 | #ifdef CONFIG_PPC_MULTIPLATFORM |
@@ -122,9 +104,6 @@ extern void iommu_devnode_init_pSeries(struct device_node *dn); | |||
122 | 104 | ||
123 | #ifdef CONFIG_PPC_ISERIES | 105 | #ifdef CONFIG_PPC_ISERIES |
124 | 106 | ||
125 | /* Walks all buses and creates iommu tables */ | ||
126 | extern void iommu_setup_iSeries(void); | ||
127 | |||
128 | /* Initializes tables for bio buses */ | 107 | /* Initializes tables for bio buses */ |
129 | extern void __init iommu_vio_init(void); | 108 | extern void __init iommu_vio_init(void); |
130 | 109 | ||
@@ -158,8 +137,12 @@ extern void iommu_init_early_pSeries(void); | |||
158 | extern void iommu_init_early_iSeries(void); | 137 | extern void iommu_init_early_iSeries(void); |
159 | extern void iommu_init_early_u3(void); | 138 | extern void iommu_init_early_u3(void); |
160 | 139 | ||
140 | #ifdef CONFIG_PCI | ||
161 | extern void pci_iommu_init(void); | 141 | extern void pci_iommu_init(void); |
162 | extern void pci_direct_iommu_init(void); | 142 | extern void pci_direct_iommu_init(void); |
143 | #else | ||
144 | static inline void pci_iommu_init(void) { } | ||
145 | #endif | ||
163 | 146 | ||
164 | extern void alloc_u3_dart_table(void); | 147 | extern void alloc_u3_dart_table(void); |
165 | 148 | ||
diff --git a/include/asm-ppc64/kdebug.h b/include/asm-ppc64/kdebug.h index 488634258a72..d383d161cf8d 100644 --- a/include/asm-ppc64/kdebug.h +++ b/include/asm-ppc64/kdebug.h | |||
@@ -17,7 +17,7 @@ struct die_args { | |||
17 | 17 | ||
18 | /* | 18 | /* |
19 | Note - you should never unregister because that can race with NMIs. | 19 | Note - you should never unregister because that can race with NMIs. |
20 | If you really want to do it first unregister - then synchronize_kernel - | 20 | If you really want to do it first unregister - then synchronize_sched - |
21 | then free. | 21 | then free. |
22 | */ | 22 | */ |
23 | int register_die_notifier(struct notifier_block *nb); | 23 | int register_die_notifier(struct notifier_block *nb); |
diff --git a/include/asm-ppc64/kexec.h b/include/asm-ppc64/kexec.h new file mode 100644 index 000000000000..511908afaeeb --- /dev/null +++ b/include/asm-ppc64/kexec.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef _PPC64_KEXEC_H | ||
2 | #define _PPC64_KEXEC_H | ||
3 | |||
4 | /* | ||
5 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | ||
6 | * I.e. Maximum page that is mapped directly into kernel memory, | ||
7 | * and kmap is not required. | ||
8 | */ | ||
9 | |||
10 | /* Maximum physical address we can use pages from */ | ||
11 | /* XXX: since we copy virt we can use any page we allocate */ | ||
12 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) | ||
13 | |||
14 | /* Maximum address we can reach in physical address mode */ | ||
15 | /* XXX: I want to allow initrd in highmem. otherwise set to rmo on lpar */ | ||
16 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) | ||
17 | |||
18 | /* Maximum address we can use for the control code buffer */ | ||
19 | /* XXX: unused today, ppc32 uses TASK_SIZE, probably left over from use_mm */ | ||
20 | #define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) | ||
21 | |||
22 | /* XXX: today we don't use this at all, althogh we have a static stack */ | ||
23 | #define KEXEC_CONTROL_CODE_SIZE 4096 | ||
24 | |||
25 | /* The native architecture */ | ||
26 | #define KEXEC_ARCH KEXEC_ARCH_PPC64 | ||
27 | |||
28 | #define MAX_NOTE_BYTES 1024 | ||
29 | |||
30 | #ifndef __ASSEMBLY__ | ||
31 | |||
32 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
33 | |||
34 | extern note_buf_t crash_notes[]; | ||
35 | |||
36 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for | ||
37 | master to copy new code to 0 */ | ||
38 | |||
39 | #endif /* __ASSEMBLY__ */ | ||
40 | #endif /* _PPC_KEXEC_H */ | ||
41 | |||
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 5d3cd9d042e2..9cdad3ed1526 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h | |||
@@ -76,6 +76,7 @@ struct machdep_calls { | |||
76 | void (*tce_flush)(struct iommu_table *tbl); | 76 | void (*tce_flush)(struct iommu_table *tbl); |
77 | void (*iommu_dev_setup)(struct pci_dev *dev); | 77 | void (*iommu_dev_setup)(struct pci_dev *dev); |
78 | void (*iommu_bus_setup)(struct pci_bus *bus); | 78 | void (*iommu_bus_setup)(struct pci_bus *bus); |
79 | void (*irq_bus_setup)(struct pci_bus *bus); | ||
79 | 80 | ||
80 | int (*probe)(int platform); | 81 | int (*probe)(int platform); |
81 | void (*setup_arch)(void); | 82 | void (*setup_arch)(void); |
@@ -85,6 +86,7 @@ struct machdep_calls { | |||
85 | 86 | ||
86 | void (*init_IRQ)(void); | 87 | void (*init_IRQ)(void); |
87 | int (*get_irq)(struct pt_regs *); | 88 | int (*get_irq)(struct pt_regs *); |
89 | void (*cpu_irq_down)(void); | ||
88 | 90 | ||
89 | /* PCI stuff */ | 91 | /* PCI stuff */ |
90 | void (*pcibios_fixup)(void); | 92 | void (*pcibios_fixup)(void); |
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index c78282a67d8e..f373de5e3dd9 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h | |||
@@ -47,9 +47,10 @@ | |||
47 | #define SLB_VSID_KS ASM_CONST(0x0000000000000800) | 47 | #define SLB_VSID_KS ASM_CONST(0x0000000000000800) |
48 | #define SLB_VSID_KP ASM_CONST(0x0000000000000400) | 48 | #define SLB_VSID_KP ASM_CONST(0x0000000000000400) |
49 | #define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ | 49 | #define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ |
50 | #define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage 16M */ | 50 | #define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage */ |
51 | #define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ | 51 | #define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ |
52 | 52 | #define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */ | |
53 | |||
53 | #define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) | 54 | #define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) |
54 | #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) | 55 | #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) |
55 | 56 | ||
@@ -180,6 +181,28 @@ static inline void tlbiel(unsigned long va) | |||
180 | asm volatile("ptesync": : :"memory"); | 181 | asm volatile("ptesync": : :"memory"); |
181 | } | 182 | } |
182 | 183 | ||
184 | static inline unsigned long slot2va(unsigned long avpn, unsigned long large, | ||
185 | unsigned long secondary, unsigned long slot) | ||
186 | { | ||
187 | unsigned long va; | ||
188 | |||
189 | va = avpn << 23; | ||
190 | |||
191 | if (!large) { | ||
192 | unsigned long vpi, pteg; | ||
193 | |||
194 | pteg = slot / HPTES_PER_GROUP; | ||
195 | if (secondary) | ||
196 | pteg = ~pteg; | ||
197 | |||
198 | vpi = ((va >> 28) ^ pteg) & htab_hash_mask; | ||
199 | |||
200 | va |= vpi << PAGE_SHIFT; | ||
201 | } | ||
202 | |||
203 | return va; | ||
204 | } | ||
205 | |||
183 | /* | 206 | /* |
184 | * Handle a fault by adding an HPTE. If the address can't be determined | 207 | * Handle a fault by adding an HPTE. If the address can't be determined |
185 | * to be valid via Linux page tables, return 1. If handled return 0 | 208 | * to be valid via Linux page tables, return 1. If handled return 0 |
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h index 0619a41a3c9d..ed473f4b0152 100644 --- a/include/asm-ppc64/mmzone.h +++ b/include/asm-ppc64/mmzone.h | |||
@@ -10,9 +10,20 @@ | |||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <asm/smp.h> | 11 | #include <asm/smp.h> |
12 | 12 | ||
13 | #ifdef CONFIG_DISCONTIGMEM | 13 | /* generic non-linear memory support: |
14 | * | ||
15 | * 1) we will not split memory into more chunks than will fit into the | ||
16 | * flags field of the struct page | ||
17 | */ | ||
18 | |||
19 | |||
20 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
14 | 21 | ||
15 | extern struct pglist_data *node_data[]; | 22 | extern struct pglist_data *node_data[]; |
23 | /* | ||
24 | * Return a pointer to the node data for node n. | ||
25 | */ | ||
26 | #define NODE_DATA(nid) (node_data[nid]) | ||
16 | 27 | ||
17 | /* | 28 | /* |
18 | * Following are specific to this numa platform. | 29 | * Following are specific to this numa platform. |
@@ -47,36 +58,32 @@ static inline int pa_to_nid(unsigned long pa) | |||
47 | return nid; | 58 | return nid; |
48 | } | 59 | } |
49 | 60 | ||
50 | #define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) | ||
51 | |||
52 | /* | ||
53 | * Return a pointer to the node data for node n. | ||
54 | */ | ||
55 | #define NODE_DATA(nid) (node_data[nid]) | ||
56 | |||
57 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) | 61 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) |
58 | 62 | ||
59 | /* | 63 | /* |
60 | * Following are macros that each numa implmentation must define. | 64 | * Following are macros that each numa implmentation must define. |
61 | */ | 65 | */ |
62 | 66 | ||
63 | /* | ||
64 | * Given a kernel address, find the home node of the underlying memory. | ||
65 | */ | ||
66 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | ||
67 | |||
68 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
69 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 67 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
70 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) | 68 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) |
71 | 69 | ||
72 | #define local_mapnr(kvaddr) \ | 70 | #define local_mapnr(kvaddr) \ |
73 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) | 71 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) |
74 | 72 | ||
73 | #ifdef CONFIG_DISCONTIGMEM | ||
74 | |||
75 | /* | ||
76 | * Given a kernel address, find the home node of the underlying memory. | ||
77 | */ | ||
78 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | ||
79 | |||
80 | #define pfn_to_nid(pfn) pa_to_nid((unsigned long)(pfn) << PAGE_SHIFT) | ||
81 | |||
75 | /* Written this way to avoid evaluating arguments twice */ | 82 | /* Written this way to avoid evaluating arguments twice */ |
76 | #define discontigmem_pfn_to_page(pfn) \ | 83 | #define discontigmem_pfn_to_page(pfn) \ |
77 | ({ \ | 84 | ({ \ |
78 | unsigned long __tmp = pfn; \ | 85 | unsigned long __tmp = pfn; \ |
79 | (node_mem_map(pfn_to_nid(__tmp)) + \ | 86 | (NODE_DATA(pfn_to_nid(__tmp))->node_mem_map + \ |
80 | node_localnr(__tmp, pfn_to_nid(__tmp))); \ | 87 | node_localnr(__tmp, pfn_to_nid(__tmp))); \ |
81 | }) | 88 | }) |
82 | 89 | ||
@@ -91,4 +98,11 @@ static inline int pa_to_nid(unsigned long pa) | |||
91 | #define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) | 98 | #define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) |
92 | 99 | ||
93 | #endif /* CONFIG_DISCONTIGMEM */ | 100 | #endif /* CONFIG_DISCONTIGMEM */ |
101 | |||
102 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ | ||
103 | |||
104 | #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
105 | #define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT) | ||
106 | #endif | ||
107 | |||
94 | #endif /* _ASM_MMZONE_H_ */ | 108 | #endif /* _ASM_MMZONE_H_ */ |
diff --git a/include/asm-ppc64/nvram.h b/include/asm-ppc64/nvram.h index 4e6dd370d936..dfaa21566c9a 100644 --- a/include/asm-ppc64/nvram.h +++ b/include/asm-ppc64/nvram.h | |||
@@ -70,6 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name); | |||
70 | 70 | ||
71 | extern int pSeries_nvram_init(void); | 71 | extern int pSeries_nvram_init(void); |
72 | extern int pmac_nvram_init(void); | 72 | extern int pmac_nvram_init(void); |
73 | extern int bpa_nvram_init(void); | ||
73 | 74 | ||
74 | /* PowerMac specific nvram stuffs */ | 75 | /* PowerMac specific nvram stuffs */ |
75 | 76 | ||
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index 1a0223b5f3b8..ae76cae1483f 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h | |||
@@ -20,13 +20,13 @@ | |||
20 | #include <asm/types.h> | 20 | #include <asm/types.h> |
21 | #include <asm/lppaca.h> | 21 | #include <asm/lppaca.h> |
22 | #include <asm/iSeries/ItLpRegSave.h> | 22 | #include <asm/iSeries/ItLpRegSave.h> |
23 | #include <asm/iSeries/ItLpQueue.h> | ||
23 | #include <asm/mmu.h> | 24 | #include <asm/mmu.h> |
24 | 25 | ||
25 | register struct paca_struct *local_paca asm("r13"); | 26 | register struct paca_struct *local_paca asm("r13"); |
26 | #define get_paca() local_paca | 27 | #define get_paca() local_paca |
27 | 28 | ||
28 | struct task_struct; | 29 | struct task_struct; |
29 | struct ItLpQueue; | ||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Defines the layout of the paca. | 32 | * Defines the layout of the paca. |
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index bcd21789d3b7..a5893a305a09 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h | |||
@@ -202,9 +202,7 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */ | |||
202 | #define PAGE_OFFSET ASM_CONST(0xC000000000000000) | 202 | #define PAGE_OFFSET ASM_CONST(0xC000000000000000) |
203 | #define KERNELBASE PAGE_OFFSET | 203 | #define KERNELBASE PAGE_OFFSET |
204 | #define VMALLOCBASE ASM_CONST(0xD000000000000000) | 204 | #define VMALLOCBASE ASM_CONST(0xD000000000000000) |
205 | #define IOREGIONBASE ASM_CONST(0xE000000000000000) | ||
206 | 205 | ||
207 | #define IO_REGION_ID (IOREGIONBASE >> REGION_SHIFT) | ||
208 | #define VMALLOC_REGION_ID (VMALLOCBASE >> REGION_SHIFT) | 206 | #define VMALLOC_REGION_ID (VMALLOCBASE >> REGION_SHIFT) |
209 | #define KERNEL_REGION_ID (KERNELBASE >> REGION_SHIFT) | 207 | #define KERNEL_REGION_ID (KERNELBASE >> REGION_SHIFT) |
210 | #define USER_REGION_ID (0UL) | 208 | #define USER_REGION_ID (0UL) |
@@ -219,7 +217,8 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */ | |||
219 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) | 217 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) |
220 | #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) | 218 | #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) |
221 | #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) | 219 | #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) |
222 | #else | 220 | #endif |
221 | #ifdef CONFIG_FLATMEM | ||
223 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 222 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
224 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 223 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
225 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 224 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h index 264c4f7993be..46cf61c2ff69 100644 --- a/include/asm-ppc64/pgtable.h +++ b/include/asm-ppc64/pgtable.h | |||
@@ -53,7 +53,8 @@ | |||
53 | * Define the address range of the vmalloc VM area. | 53 | * Define the address range of the vmalloc VM area. |
54 | */ | 54 | */ |
55 | #define VMALLOC_START (0xD000000000000000ul) | 55 | #define VMALLOC_START (0xD000000000000000ul) |
56 | #define VMALLOC_END (VMALLOC_START + EADDR_MASK) | 56 | #define VMALLOC_SIZE (0x10000000000UL) |
57 | #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) | ||
57 | 58 | ||
58 | /* | 59 | /* |
59 | * Bits in a linux-style PTE. These match the bits in the | 60 | * Bits in a linux-style PTE. These match the bits in the |
@@ -239,9 +240,6 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
239 | /* This now only contains the vmalloc pages */ | 240 | /* This now only contains the vmalloc pages */ |
240 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | 241 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) |
241 | 242 | ||
242 | /* to find an entry in the ioremap page-table-directory */ | ||
243 | #define pgd_offset_i(address) (ioremap_pgd + pgd_index(address)) | ||
244 | |||
245 | /* | 243 | /* |
246 | * The following only work if pte_present() is true. | 244 | * The following only work if pte_present() is true. |
247 | * Undefined behaviour if not.. | 245 | * Undefined behaviour if not.. |
@@ -459,15 +457,12 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr, | |||
459 | #define __HAVE_ARCH_PTE_SAME | 457 | #define __HAVE_ARCH_PTE_SAME |
460 | #define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) | 458 | #define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) |
461 | 459 | ||
462 | extern unsigned long ioremap_bot, ioremap_base; | ||
463 | |||
464 | #define pmd_ERROR(e) \ | 460 | #define pmd_ERROR(e) \ |
465 | printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e)) | 461 | printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e)) |
466 | #define pgd_ERROR(e) \ | 462 | #define pgd_ERROR(e) \ |
467 | printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e)) | 463 | printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e)) |
468 | 464 | ||
469 | extern pgd_t swapper_pg_dir[]; | 465 | extern pgd_t swapper_pg_dir[]; |
470 | extern pgd_t ioremap_dir[]; | ||
471 | 466 | ||
472 | extern void paging_init(void); | 467 | extern void paging_init(void); |
473 | 468 | ||
diff --git a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h index 1d0404897550..6b44a8caf395 100644 --- a/include/asm-ppc64/ppc32.h +++ b/include/asm-ppc64/ppc32.h | |||
@@ -32,7 +32,7 @@ typedef struct compat_siginfo { | |||
32 | 32 | ||
33 | /* POSIX.1b timers */ | 33 | /* POSIX.1b timers */ |
34 | struct { | 34 | struct { |
35 | timer_t _tid; /* timer id */ | 35 | compat_timer_t _tid; /* timer id */ |
36 | int _overrun; /* overrun count */ | 36 | int _overrun; /* overrun count */ |
37 | compat_sigval_t _sigval; /* same as below */ | 37 | compat_sigval_t _sigval; /* same as below */ |
38 | int _sys_private; /* not to be passed to user */ | 38 | int _sys_private; /* not to be passed to user */ |
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index 0035efe2db2b..af28aa55d8c1 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h | |||
@@ -120,128 +120,36 @@ | |||
120 | 120 | ||
121 | /* Special Purpose Registers (SPRNs)*/ | 121 | /* Special Purpose Registers (SPRNs)*/ |
122 | 122 | ||
123 | #define SPRN_CDBCR 0x3D7 /* Cache Debug Control Register */ | ||
124 | #define SPRN_CTR 0x009 /* Count Register */ | 123 | #define SPRN_CTR 0x009 /* Count Register */ |
125 | #define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ | 124 | #define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ |
126 | #define SPRN_DAC1 0x3F6 /* Data Address Compare 1 */ | 125 | #define DABR_TRANSLATION (1UL << 2) |
127 | #define SPRN_DAC2 0x3F7 /* Data Address Compare 2 */ | ||
128 | #define SPRN_DAR 0x013 /* Data Address Register */ | 126 | #define SPRN_DAR 0x013 /* Data Address Register */ |
129 | #define SPRN_DBCR 0x3F2 /* Debug Control Regsiter */ | ||
130 | #define DBCR_EDM 0x80000000 | ||
131 | #define DBCR_IDM 0x40000000 | ||
132 | #define DBCR_RST(x) (((x) & 0x3) << 28) | ||
133 | #define DBCR_RST_NONE 0 | ||
134 | #define DBCR_RST_CORE 1 | ||
135 | #define DBCR_RST_CHIP 2 | ||
136 | #define DBCR_RST_SYSTEM 3 | ||
137 | #define DBCR_IC 0x08000000 /* Instruction Completion Debug Evnt */ | ||
138 | #define DBCR_BT 0x04000000 /* Branch Taken Debug Event */ | ||
139 | #define DBCR_EDE 0x02000000 /* Exception Debug Event */ | ||
140 | #define DBCR_TDE 0x01000000 /* TRAP Debug Event */ | ||
141 | #define DBCR_FER 0x00F80000 /* First Events Remaining Mask */ | ||
142 | #define DBCR_FT 0x00040000 /* Freeze Timers on Debug Event */ | ||
143 | #define DBCR_IA1 0x00020000 /* Instr. Addr. Compare 1 Enable */ | ||
144 | #define DBCR_IA2 0x00010000 /* Instr. Addr. Compare 2 Enable */ | ||
145 | #define DBCR_D1R 0x00008000 /* Data Addr. Compare 1 Read Enable */ | ||
146 | #define DBCR_D1W 0x00004000 /* Data Addr. Compare 1 Write Enable */ | ||
147 | #define DBCR_D1S(x) (((x) & 0x3) << 12) /* Data Adrr. Compare 1 Size */ | ||
148 | #define DAC_BYTE 0 | ||
149 | #define DAC_HALF 1 | ||
150 | #define DAC_WORD 2 | ||
151 | #define DAC_QUAD 3 | ||
152 | #define DBCR_D2R 0x00000800 /* Data Addr. Compare 2 Read Enable */ | ||
153 | #define DBCR_D2W 0x00000400 /* Data Addr. Compare 2 Write Enable */ | ||
154 | #define DBCR_D2S(x) (((x) & 0x3) << 8) /* Data Addr. Compare 2 Size */ | ||
155 | #define DBCR_SBT 0x00000040 /* Second Branch Taken Debug Event */ | ||
156 | #define DBCR_SED 0x00000020 /* Second Exception Debug Event */ | ||
157 | #define DBCR_STD 0x00000010 /* Second Trap Debug Event */ | ||
158 | #define DBCR_SIA 0x00000008 /* Second IAC Enable */ | ||
159 | #define DBCR_SDA 0x00000004 /* Second DAC Enable */ | ||
160 | #define DBCR_JOI 0x00000002 /* JTAG Serial Outbound Int. Enable */ | ||
161 | #define DBCR_JII 0x00000001 /* JTAG Serial Inbound Int. Enable */ | ||
162 | #define SPRN_DBCR0 0x3F2 /* Debug Control Register 0 */ | ||
163 | #define SPRN_DBCR1 0x3BD /* Debug Control Register 1 */ | ||
164 | #define SPRN_DBSR 0x3F0 /* Debug Status Register */ | ||
165 | #define SPRN_DCCR 0x3FA /* Data Cache Cacheability Register */ | ||
166 | #define DCCR_NOCACHE 0 /* Noncacheable */ | ||
167 | #define DCCR_CACHE 1 /* Cacheable */ | ||
168 | #define SPRN_DCMP 0x3D1 /* Data TLB Compare Register */ | ||
169 | #define SPRN_DCWR 0x3BA /* Data Cache Write-thru Register */ | ||
170 | #define DCWR_COPY 0 /* Copy-back */ | ||
171 | #define DCWR_WRITE 1 /* Write-through */ | ||
172 | #define SPRN_DEAR 0x3D5 /* Data Error Address Register */ | ||
173 | #define SPRN_DEC 0x016 /* Decrement Register */ | 127 | #define SPRN_DEC 0x016 /* Decrement Register */ |
174 | #define SPRN_DMISS 0x3D0 /* Data TLB Miss Register */ | ||
175 | #define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ | 128 | #define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ |
176 | #define DSISR_NOHPTE 0x40000000 /* no translation found */ | 129 | #define DSISR_NOHPTE 0x40000000 /* no translation found */ |
177 | #define DSISR_PROTFAULT 0x08000000 /* protection fault */ | 130 | #define DSISR_PROTFAULT 0x08000000 /* protection fault */ |
178 | #define DSISR_ISSTORE 0x02000000 /* access was a store */ | 131 | #define DSISR_ISSTORE 0x02000000 /* access was a store */ |
179 | #define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */ | 132 | #define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */ |
180 | #define DSISR_NOSEGMENT 0x00200000 /* STAB/SLB miss */ | 133 | #define DSISR_NOSEGMENT 0x00200000 /* STAB/SLB miss */ |
181 | #define SPRN_EAR 0x11A /* External Address Register */ | ||
182 | #define SPRN_ESR 0x3D4 /* Exception Syndrome Register */ | ||
183 | #define ESR_IMCP 0x80000000 /* Instr. Machine Check - Protection */ | ||
184 | #define ESR_IMCN 0x40000000 /* Instr. Machine Check - Non-config */ | ||
185 | #define ESR_IMCB 0x20000000 /* Instr. Machine Check - Bus error */ | ||
186 | #define ESR_IMCT 0x10000000 /* Instr. Machine Check - Timeout */ | ||
187 | #define ESR_PIL 0x08000000 /* Program Exception - Illegal */ | ||
188 | #define ESR_PPR 0x04000000 /* Program Exception - Priveleged */ | ||
189 | #define ESR_PTR 0x02000000 /* Program Exception - Trap */ | ||
190 | #define ESR_DST 0x00800000 /* Storage Exception - Data miss */ | ||
191 | #define ESR_DIZ 0x00400000 /* Storage Exception - Zone fault */ | ||
192 | #define SPRN_EVPR 0x3D6 /* Exception Vector Prefix Register */ | ||
193 | #define SPRN_HASH1 0x3D2 /* Primary Hash Address Register */ | ||
194 | #define SPRN_HASH2 0x3D3 /* Secondary Hash Address Resgister */ | ||
195 | #define SPRN_HID0 0x3F0 /* Hardware Implementation Register 0 */ | 134 | #define SPRN_HID0 0x3F0 /* Hardware Implementation Register 0 */ |
196 | #define HID0_EMCP (1<<31) /* Enable Machine Check pin */ | ||
197 | #define HID0_EBA (1<<29) /* Enable Bus Address Parity */ | ||
198 | #define HID0_EBD (1<<28) /* Enable Bus Data Parity */ | ||
199 | #define HID0_SBCLK (1<<27) | ||
200 | #define HID0_EICE (1<<26) | ||
201 | #define HID0_ECLK (1<<25) | ||
202 | #define HID0_PAR (1<<24) | ||
203 | #define HID0_DOZE (1<<23) | ||
204 | #define HID0_NAP (1<<22) | ||
205 | #define HID0_SLEEP (1<<21) | ||
206 | #define HID0_DPM (1<<20) | ||
207 | #define HID0_ICE (1<<15) /* Instruction Cache Enable */ | ||
208 | #define HID0_DCE (1<<14) /* Data Cache Enable */ | ||
209 | #define HID0_ILOCK (1<<13) /* Instruction Cache Lock */ | ||
210 | #define HID0_DLOCK (1<<12) /* Data Cache Lock */ | ||
211 | #define HID0_ICFI (1<<11) /* Instr. Cache Flash Invalidate */ | ||
212 | #define HID0_DCI (1<<10) /* Data Cache Invalidate */ | ||
213 | #define HID0_SPD (1<<9) /* Speculative disable */ | ||
214 | #define HID0_SGE (1<<7) /* Store Gathering Enable */ | ||
215 | #define HID0_SIED (1<<7) /* Serial Instr. Execution [Disable] */ | ||
216 | #define HID0_BTIC (1<<5) /* Branch Target Instruction Cache Enable */ | ||
217 | #define HID0_ABE (1<<3) /* Address Broadcast Enable */ | ||
218 | #define HID0_BHTE (1<<2) /* Branch History Table Enable */ | ||
219 | #define HID0_BTCD (1<<1) /* Branch target cache disable */ | ||
220 | #define SPRN_MSRDORM 0x3F1 /* Hardware Implementation Register 1 */ | 135 | #define SPRN_MSRDORM 0x3F1 /* Hardware Implementation Register 1 */ |
221 | #define SPRN_HID1 0x3F1 /* Hardware Implementation Register 1 */ | 136 | #define SPRN_HID1 0x3F1 /* Hardware Implementation Register 1 */ |
222 | #define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ | 137 | #define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ |
223 | #define SPRN_NIADORM 0x3F3 /* Hardware Implementation Register 2 */ | 138 | #define SPRN_NIADORM 0x3F3 /* Hardware Implementation Register 2 */ |
224 | #define SPRN_HID4 0x3F4 /* 970 HID4 */ | 139 | #define SPRN_HID4 0x3F4 /* 970 HID4 */ |
225 | #define SPRN_HID5 0x3F6 /* 970 HID5 */ | 140 | #define SPRN_HID5 0x3F6 /* 970 HID5 */ |
226 | #define SPRN_TSC 0x3FD /* Thread switch control */ | 141 | #define SPRN_HID6 0x3F9 /* BE HID 6 */ |
227 | #define SPRN_TST 0x3FC /* Thread switch timeout */ | 142 | #define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */ |
228 | #define SPRN_IAC1 0x3F4 /* Instruction Address Compare 1 */ | 143 | #define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */ |
229 | #define SPRN_IAC2 0x3F5 /* Instruction Address Compare 2 */ | 144 | #define SPRN_TSCR 0x399 /* Thread switch control on BE */ |
230 | #define SPRN_ICCR 0x3FB /* Instruction Cache Cacheability Register */ | 145 | #define SPRN_TTR 0x39A /* Thread switch timeout on BE */ |
231 | #define ICCR_NOCACHE 0 /* Noncacheable */ | 146 | #define TSCR_DEC_ENABLE 0x200000 /* Decrementer Interrupt */ |
232 | #define ICCR_CACHE 1 /* Cacheable */ | 147 | #define TSCR_EE_ENABLE 0x100000 /* External Interrupt */ |
233 | #define SPRN_ICDBDR 0x3D3 /* Instruction Cache Debug Data Register */ | 148 | #define TSCR_EE_BOOST 0x080000 /* External Interrupt Boost */ |
234 | #define SPRN_ICMP 0x3D5 /* Instruction TLB Compare Register */ | 149 | #define SPRN_TSC 0x3FD /* Thread switch control on others */ |
235 | #define SPRN_ICTC 0x3FB /* Instruction Cache Throttling Control Reg */ | 150 | #define SPRN_TST 0x3FC /* Thread switch timeout on others */ |
236 | #define SPRN_IMISS 0x3D4 /* Instruction TLB Miss Register */ | ||
237 | #define SPRN_IMMR 0x27E /* Internal Memory Map Register */ | ||
238 | #define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */ | 151 | #define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */ |
239 | #define SPRN_LR 0x008 /* Link Register */ | 152 | #define SPRN_LR 0x008 /* Link Register */ |
240 | #define SPRN_PBL1 0x3FC /* Protection Bound Lower 1 */ | ||
241 | #define SPRN_PBL2 0x3FE /* Protection Bound Lower 2 */ | ||
242 | #define SPRN_PBU1 0x3FD /* Protection Bound Upper 1 */ | ||
243 | #define SPRN_PBU2 0x3FF /* Protection Bound Upper 2 */ | ||
244 | #define SPRN_PID 0x3B1 /* Process ID */ | ||
245 | #define SPRN_PIR 0x3FF /* Processor Identification Register */ | 153 | #define SPRN_PIR 0x3FF /* Processor Identification Register */ |
246 | #define SPRN_PIT 0x3DB /* Programmable Interval Timer */ | 154 | #define SPRN_PIT 0x3DB /* Programmable Interval Timer */ |
247 | #define SPRN_PURR 0x135 /* Processor Utilization of Resources Register */ | 155 | #define SPRN_PURR 0x135 /* Processor Utilization of Resources Register */ |
@@ -249,9 +157,6 @@ | |||
249 | #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ | 157 | #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ |
250 | #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ | 158 | #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ |
251 | #define SPRN_SDR1 0x019 /* MMU Hash Base Register */ | 159 | #define SPRN_SDR1 0x019 /* MMU Hash Base Register */ |
252 | #define SPRN_SGR 0x3B9 /* Storage Guarded Register */ | ||
253 | #define SGR_NORMAL 0 | ||
254 | #define SGR_GUARDED 1 | ||
255 | #define SPRN_SIA 0x3BB /* Sampled Instruction Address Register */ | 160 | #define SPRN_SIA 0x3BB /* Sampled Instruction Address Register */ |
256 | #define SPRN_SPRG0 0x110 /* Special Purpose Register General 0 */ | 161 | #define SPRN_SPRG0 0x110 /* Special Purpose Register General 0 */ |
257 | #define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */ | 162 | #define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */ |
@@ -264,50 +169,12 @@ | |||
264 | #define SPRN_TBWL 0x11C /* Time Base Lower Register (super, W/O) */ | 169 | #define SPRN_TBWL 0x11C /* Time Base Lower Register (super, W/O) */ |
265 | #define SPRN_TBWU 0x11D /* Time Base Write Upper Register (super, W/O) */ | 170 | #define SPRN_TBWU 0x11D /* Time Base Write Upper Register (super, W/O) */ |
266 | #define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */ | 171 | #define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */ |
267 | #define SPRN_TCR 0x3DA /* Timer Control Register */ | ||
268 | #define TCR_WP(x) (((x)&0x3)<<30) /* WDT Period */ | ||
269 | #define WP_2_17 0 /* 2^17 clocks */ | ||
270 | #define WP_2_21 1 /* 2^21 clocks */ | ||
271 | #define WP_2_25 2 /* 2^25 clocks */ | ||
272 | #define WP_2_29 3 /* 2^29 clocks */ | ||
273 | #define TCR_WRC(x) (((x)&0x3)<<28) /* WDT Reset Control */ | ||
274 | #define WRC_NONE 0 /* No reset will occur */ | ||
275 | #define WRC_CORE 1 /* Core reset will occur */ | ||
276 | #define WRC_CHIP 2 /* Chip reset will occur */ | ||
277 | #define WRC_SYSTEM 3 /* System reset will occur */ | ||
278 | #define TCR_WIE 0x08000000 /* WDT Interrupt Enable */ | ||
279 | #define TCR_PIE 0x04000000 /* PIT Interrupt Enable */ | ||
280 | #define TCR_FP(x) (((x)&0x3)<<24) /* FIT Period */ | ||
281 | #define FP_2_9 0 /* 2^9 clocks */ | ||
282 | #define FP_2_13 1 /* 2^13 clocks */ | ||
283 | #define FP_2_17 2 /* 2^17 clocks */ | ||
284 | #define FP_2_21 3 /* 2^21 clocks */ | ||
285 | #define TCR_FIE 0x00800000 /* FIT Interrupt Enable */ | ||
286 | #define TCR_ARE 0x00400000 /* Auto Reload Enable */ | ||
287 | #define SPRN_THRM1 0x3FC /* Thermal Management Register 1 */ | ||
288 | #define THRM1_TIN (1<<0) | ||
289 | #define THRM1_TIV (1<<1) | ||
290 | #define THRM1_THRES (0x7f<<2) | ||
291 | #define THRM1_TID (1<<29) | ||
292 | #define THRM1_TIE (1<<30) | ||
293 | #define THRM1_V (1<<31) | ||
294 | #define SPRN_THRM2 0x3FD /* Thermal Management Register 2 */ | ||
295 | #define SPRN_THRM3 0x3FE /* Thermal Management Register 3 */ | ||
296 | #define THRM3_E (1<<31) | ||
297 | #define SPRN_TSR 0x3D8 /* Timer Status Register */ | ||
298 | #define TSR_ENW 0x80000000 /* Enable Next Watchdog */ | ||
299 | #define TSR_WIS 0x40000000 /* WDT Interrupt Status */ | ||
300 | #define TSR_WRS(x) (((x)&0x3)<<28) /* WDT Reset Status */ | ||
301 | #define WRS_NONE 0 /* No WDT reset occurred */ | ||
302 | #define WRS_CORE 1 /* WDT forced core reset */ | ||
303 | #define WRS_CHIP 2 /* WDT forced chip reset */ | ||
304 | #define WRS_SYSTEM 3 /* WDT forced system reset */ | ||
305 | #define TSR_PIS 0x08000000 /* PIT Interrupt Status */ | ||
306 | #define TSR_FIS 0x04000000 /* FIT Interrupt Status */ | ||
307 | #define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */ | 172 | #define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */ |
308 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ | 173 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ |
309 | #define SPRN_ZPR 0x3B0 /* Zone Protection Register */ | ||
310 | #define SPRN_VRSAVE 0x100 /* Vector save */ | 174 | #define SPRN_VRSAVE 0x100 /* Vector save */ |
175 | #define SPRN_CTRLF 0x088 | ||
176 | #define SPRN_CTRLT 0x098 | ||
177 | #define CTRL_RUNLATCH 0x1 | ||
311 | 178 | ||
312 | /* Performance monitor SPRs */ | 179 | /* Performance monitor SPRs */ |
313 | #define SPRN_SIAR 780 | 180 | #define SPRN_SIAR 780 |
@@ -352,28 +219,19 @@ | |||
352 | #define CTR SPRN_CTR /* Counter Register */ | 219 | #define CTR SPRN_CTR /* Counter Register */ |
353 | #define DAR SPRN_DAR /* Data Address Register */ | 220 | #define DAR SPRN_DAR /* Data Address Register */ |
354 | #define DABR SPRN_DABR /* Data Address Breakpoint Register */ | 221 | #define DABR SPRN_DABR /* Data Address Breakpoint Register */ |
355 | #define DCMP SPRN_DCMP /* Data TLB Compare Register */ | ||
356 | #define DEC SPRN_DEC /* Decrement Register */ | 222 | #define DEC SPRN_DEC /* Decrement Register */ |
357 | #define DMISS SPRN_DMISS /* Data TLB Miss Register */ | ||
358 | #define DSISR SPRN_DSISR /* Data Storage Interrupt Status Register */ | 223 | #define DSISR SPRN_DSISR /* Data Storage Interrupt Status Register */ |
359 | #define EAR SPRN_EAR /* External Address Register */ | ||
360 | #define HASH1 SPRN_HASH1 /* Primary Hash Address Register */ | ||
361 | #define HASH2 SPRN_HASH2 /* Secondary Hash Address Register */ | ||
362 | #define HID0 SPRN_HID0 /* Hardware Implementation Register 0 */ | 224 | #define HID0 SPRN_HID0 /* Hardware Implementation Register 0 */ |
363 | #define MSRDORM SPRN_MSRDORM /* MSR Dormant Register */ | 225 | #define MSRDORM SPRN_MSRDORM /* MSR Dormant Register */ |
364 | #define NIADORM SPRN_NIADORM /* NIA Dormant Register */ | 226 | #define NIADORM SPRN_NIADORM /* NIA Dormant Register */ |
365 | #define TSC SPRN_TSC /* Thread switch control */ | 227 | #define TSC SPRN_TSC /* Thread switch control */ |
366 | #define TST SPRN_TST /* Thread switch timeout */ | 228 | #define TST SPRN_TST /* Thread switch timeout */ |
367 | #define IABR SPRN_IABR /* Instruction Address Breakpoint Register */ | 229 | #define IABR SPRN_IABR /* Instruction Address Breakpoint Register */ |
368 | #define ICMP SPRN_ICMP /* Instruction TLB Compare Register */ | ||
369 | #define IMISS SPRN_IMISS /* Instruction TLB Miss Register */ | ||
370 | #define IMMR SPRN_IMMR /* PPC 860/821 Internal Memory Map Register */ | ||
371 | #define L2CR SPRN_L2CR /* PPC 750 L2 control register */ | 230 | #define L2CR SPRN_L2CR /* PPC 750 L2 control register */ |
372 | #define __LR SPRN_LR | 231 | #define __LR SPRN_LR |
373 | #define PVR SPRN_PVR /* Processor Version */ | 232 | #define PVR SPRN_PVR /* Processor Version */ |
374 | #define PIR SPRN_PIR /* Processor ID */ | 233 | #define PIR SPRN_PIR /* Processor ID */ |
375 | #define PURR SPRN_PURR /* Processor Utilization of Resource Register */ | 234 | #define PURR SPRN_PURR /* Processor Utilization of Resource Register */ |
376 | //#define RPA SPRN_RPA /* Required Physical Address Register */ | ||
377 | #define SDR1 SPRN_SDR1 /* MMU hash base register */ | 235 | #define SDR1 SPRN_SDR1 /* MMU hash base register */ |
378 | #define SPR0 SPRN_SPRG0 /* Supervisor Private Registers */ | 236 | #define SPR0 SPRN_SPRG0 /* Supervisor Private Registers */ |
379 | #define SPR1 SPRN_SPRG1 | 237 | #define SPR1 SPRN_SPRG1 |
@@ -389,10 +247,6 @@ | |||
389 | #define TBRU SPRN_TBRU /* Time Base Read Upper Register */ | 247 | #define TBRU SPRN_TBRU /* Time Base Read Upper Register */ |
390 | #define TBWL SPRN_TBWL /* Time Base Write Lower Register */ | 248 | #define TBWL SPRN_TBWL /* Time Base Write Lower Register */ |
391 | #define TBWU SPRN_TBWU /* Time Base Write Upper Register */ | 249 | #define TBWU SPRN_TBWU /* Time Base Write Upper Register */ |
392 | #define ICTC 1019 | ||
393 | #define THRM1 SPRN_THRM1 /* Thermal Management Register 1 */ | ||
394 | #define THRM2 SPRN_THRM2 /* Thermal Management Register 2 */ | ||
395 | #define THRM3 SPRN_THRM3 /* Thermal Management Register 3 */ | ||
396 | #define XER SPRN_XER | 250 | #define XER SPRN_XER |
397 | 251 | ||
398 | /* Processor Version Register (PVR) field extraction */ | 252 | /* Processor Version Register (PVR) field extraction */ |
@@ -413,6 +267,7 @@ | |||
413 | #define PV_970FX 0x003C | 267 | #define PV_970FX 0x003C |
414 | #define PV_630 0x0040 | 268 | #define PV_630 0x0040 |
415 | #define PV_630p 0x0041 | 269 | #define PV_630p 0x0041 |
270 | #define PV_BE 0x0070 | ||
416 | 271 | ||
417 | /* Platforms supported by PPC64 */ | 272 | /* Platforms supported by PPC64 */ |
418 | #define PLATFORM_PSERIES 0x0100 | 273 | #define PLATFORM_PSERIES 0x0100 |
@@ -421,6 +276,7 @@ | |||
421 | #define PLATFORM_LPAR 0x0001 | 276 | #define PLATFORM_LPAR 0x0001 |
422 | #define PLATFORM_POWERMAC 0x0400 | 277 | #define PLATFORM_POWERMAC 0x0400 |
423 | #define PLATFORM_MAPLE 0x0500 | 278 | #define PLATFORM_MAPLE 0x0500 |
279 | #define PLATFORM_BPA 0x1000 | ||
424 | 280 | ||
425 | /* Compatibility with drivers coming from PPC32 world */ | 281 | /* Compatibility with drivers coming from PPC32 world */ |
426 | #define _machine (systemcfg->platform) | 282 | #define _machine (systemcfg->platform) |
@@ -432,16 +288,11 @@ | |||
432 | #define IC_INVALID 0 | 288 | #define IC_INVALID 0 |
433 | #define IC_OPEN_PIC 1 | 289 | #define IC_OPEN_PIC 1 |
434 | #define IC_PPC_XIC 2 | 290 | #define IC_PPC_XIC 2 |
291 | #define IC_BPA_IIC 3 | ||
435 | 292 | ||
436 | #define XGLUE(a,b) a##b | 293 | #define XGLUE(a,b) a##b |
437 | #define GLUE(a,b) XGLUE(a,b) | 294 | #define GLUE(a,b) XGLUE(a,b) |
438 | 295 | ||
439 | /* iSeries CTRL register (for runlatch) */ | ||
440 | |||
441 | #define CTRLT 0x098 | ||
442 | #define CTRLF 0x088 | ||
443 | #define RUNLATCH 0x0001 | ||
444 | |||
445 | #ifdef __ASSEMBLY__ | 296 | #ifdef __ASSEMBLY__ |
446 | 297 | ||
447 | #define _GLOBAL(name) \ | 298 | #define _GLOBAL(name) \ |
@@ -590,16 +441,6 @@ struct thread_struct { | |||
590 | } | 441 | } |
591 | 442 | ||
592 | /* | 443 | /* |
593 | * Note: the vm_start and vm_end fields here should *not* | ||
594 | * be in kernel space. (Could vm_end == vm_start perhaps?) | ||
595 | */ | ||
596 | #define IOREMAP_MMAP { &ioremap_mm, 0, 0x1000, NULL, \ | ||
597 | PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, \ | ||
598 | 1, NULL, NULL } | ||
599 | |||
600 | extern struct mm_struct ioremap_mm; | ||
601 | |||
602 | /* | ||
603 | * Return saved PC of a blocked thread. For now, this is the "user" PC | 444 | * Return saved PC of a blocked thread. For now, this is the "user" PC |
604 | */ | 445 | */ |
605 | #define thread_saved_pc(tsk) \ | 446 | #define thread_saved_pc(tsk) \ |
@@ -656,6 +497,24 @@ static inline void prefetchw(const void *x) | |||
656 | 497 | ||
657 | #define HAVE_ARCH_PICK_MMAP_LAYOUT | 498 | #define HAVE_ARCH_PICK_MMAP_LAYOUT |
658 | 499 | ||
500 | static inline void ppc64_runlatch_on(void) | ||
501 | { | ||
502 | unsigned long ctrl; | ||
503 | |||
504 | ctrl = mfspr(SPRN_CTRLF); | ||
505 | ctrl |= CTRL_RUNLATCH; | ||
506 | mtspr(SPRN_CTRLT, ctrl); | ||
507 | } | ||
508 | |||
509 | static inline void ppc64_runlatch_off(void) | ||
510 | { | ||
511 | unsigned long ctrl; | ||
512 | |||
513 | ctrl = mfspr(SPRN_CTRLF); | ||
514 | ctrl &= ~CTRL_RUNLATCH; | ||
515 | mtspr(SPRN_CTRLT, ctrl); | ||
516 | } | ||
517 | |||
659 | #endif /* __KERNEL__ */ | 518 | #endif /* __KERNEL__ */ |
660 | 519 | ||
661 | #endif /* __ASSEMBLY__ */ | 520 | #endif /* __ASSEMBLY__ */ |
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h index 2440a2c90ae9..04b1a84f7ca3 100644 --- a/include/asm-ppc64/prom.h +++ b/include/asm-ppc64/prom.h | |||
@@ -147,9 +147,7 @@ struct device_node { | |||
147 | struct device_node *sibling; | 147 | struct device_node *sibling; |
148 | struct device_node *next; /* next device of same type */ | 148 | struct device_node *next; /* next device of same type */ |
149 | struct device_node *allnext; /* next in list of all nodes */ | 149 | struct device_node *allnext; /* next in list of all nodes */ |
150 | struct proc_dir_entry *pde; /* this node's proc directory */ | 150 | struct proc_dir_entry *pde; /* this node's proc directory */ |
151 | struct proc_dir_entry *name_link; /* name symlink */ | ||
152 | struct proc_dir_entry *addr_link; /* addr symlink */ | ||
153 | struct kref kref; | 151 | struct kref kref; |
154 | unsigned long _flags; | 152 | unsigned long _flags; |
155 | }; | 153 | }; |
@@ -174,15 +172,6 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e | |||
174 | dn->pde = de; | 172 | dn->pde = de; |
175 | } | 173 | } |
176 | 174 | ||
177 | static void inline set_node_name_link(struct device_node *dn, struct proc_dir_entry *de) | ||
178 | { | ||
179 | dn->name_link = de; | ||
180 | } | ||
181 | |||
182 | static void inline set_node_addr_link(struct device_node *dn, struct proc_dir_entry *de) | ||
183 | { | ||
184 | dn->addr_link = de; | ||
185 | } | ||
186 | 175 | ||
187 | /* OBSOLETE: Old stlye node lookup */ | 176 | /* OBSOLETE: Old stlye node lookup */ |
188 | extern struct device_node *find_devices(const char *name); | 177 | extern struct device_node *find_devices(const char *name); |
diff --git a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h index a8ab0e9db84a..e7d1b5222802 100644 --- a/include/asm-ppc64/rtas.h +++ b/include/asm-ppc64/rtas.h | |||
@@ -186,8 +186,14 @@ extern int rtas_get_sensor(int sensor, int index, int *state); | |||
186 | extern int rtas_get_power_level(int powerdomain, int *level); | 186 | extern int rtas_get_power_level(int powerdomain, int *level); |
187 | extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); | 187 | extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); |
188 | extern int rtas_set_indicator(int indicator, int index, int new_value); | 188 | extern int rtas_set_indicator(int indicator, int index, int new_value); |
189 | extern void rtas_progress(char *s, unsigned short hex); | ||
189 | extern void rtas_initialize(void); | 190 | extern void rtas_initialize(void); |
190 | 191 | ||
192 | struct rtc_time; | ||
193 | extern void rtas_get_boot_time(struct rtc_time *rtc_time); | ||
194 | extern void rtas_get_rtc_time(struct rtc_time *rtc_time); | ||
195 | extern int rtas_set_rtc_time(struct rtc_time *rtc_time); | ||
196 | |||
191 | /* Given an RTAS status code of 9900..9905 compute the hinted delay */ | 197 | /* Given an RTAS status code of 9900..9905 compute the hinted delay */ |
192 | unsigned int rtas_extended_busy_delay_time(int status); | 198 | unsigned int rtas_extended_busy_delay_time(int status); |
193 | static inline int rtas_is_extended_busy(int status) | 199 | static inline int rtas_is_extended_busy(int status) |
diff --git a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h index c8646fa999c2..d86f742e9a21 100644 --- a/include/asm-ppc64/smp.h +++ b/include/asm-ppc64/smp.h | |||
@@ -45,7 +45,7 @@ void generic_cpu_die(unsigned int cpu); | |||
45 | void generic_mach_cpu_die(void); | 45 | void generic_mach_cpu_die(void); |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #define __smp_processor_id() (get_paca()->paca_index) | 48 | #define raw_smp_processor_id() (get_paca()->paca_index) |
49 | #define hard_smp_processor_id() (get_paca()->hw_cpu_id) | 49 | #define hard_smp_processor_id() (get_paca()->hw_cpu_id) |
50 | 50 | ||
51 | extern cpumask_t cpu_sibling_map[NR_CPUS]; | 51 | extern cpumask_t cpu_sibling_map[NR_CPUS]; |
@@ -85,6 +85,14 @@ extern void smp_generic_take_timebase(void); | |||
85 | 85 | ||
86 | extern struct smp_ops_t *smp_ops; | 86 | extern struct smp_ops_t *smp_ops; |
87 | 87 | ||
88 | #ifdef CONFIG_PPC_PSERIES | ||
89 | void vpa_init(int cpu); | ||
90 | #else | ||
91 | static inline void vpa_init(int cpu) | ||
92 | { | ||
93 | } | ||
94 | #endif /* CONFIG_PPC_PSERIES */ | ||
95 | |||
88 | #endif /* __ASSEMBLY__ */ | 96 | #endif /* __ASSEMBLY__ */ |
89 | 97 | ||
90 | #endif /* !(_PPC64_SMP_H) */ | 98 | #endif /* !(_PPC64_SMP_H) */ |
diff --git a/include/asm-ppc64/sparsemem.h b/include/asm-ppc64/sparsemem.h new file mode 100644 index 000000000000..c5bd47e57f17 --- /dev/null +++ b/include/asm-ppc64/sparsemem.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _ASM_PPC64_SPARSEMEM_H | ||
2 | #define _ASM_PPC64_SPARSEMEM_H 1 | ||
3 | |||
4 | #ifdef CONFIG_SPARSEMEM | ||
5 | /* | ||
6 | * SECTION_SIZE_BITS 2^N: how big each section will be | ||
7 | * MAX_PHYSADDR_BITS 2^N: how much physical address space we have | ||
8 | * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space | ||
9 | */ | ||
10 | #define SECTION_SIZE_BITS 24 | ||
11 | #define MAX_PHYSADDR_BITS 38 | ||
12 | #define MAX_PHYSMEM_BITS 36 | ||
13 | |||
14 | #endif /* CONFIG_SPARSEMEM */ | ||
15 | |||
16 | #endif /* _ASM_PPC64_SPARSEMEM_H */ | ||
diff --git a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h index 037b5e06083c..0494df6fca74 100644 --- a/include/asm-ppc64/thread_info.h +++ b/include/asm-ppc64/thread_info.h | |||
@@ -24,7 +24,7 @@ struct thread_info { | |||
24 | struct task_struct *task; /* main task structure */ | 24 | struct task_struct *task; /* main task structure */ |
25 | struct exec_domain *exec_domain; /* execution domain */ | 25 | struct exec_domain *exec_domain; /* execution domain */ |
26 | int cpu; /* cpu we're on */ | 26 | int cpu; /* cpu we're on */ |
27 | int preempt_count; | 27 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
28 | struct restart_block restart_block; | 28 | struct restart_block restart_block; |
29 | /* set by force_successful_syscall_return */ | 29 | /* set by force_successful_syscall_return */ |
30 | unsigned char syscall_noerror; | 30 | unsigned char syscall_noerror; |
@@ -96,7 +96,7 @@ static inline struct thread_info *current_thread_info(void) | |||
96 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling | 96 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling |
97 | TIF_NEED_RESCHED */ | 97 | TIF_NEED_RESCHED */ |
98 | #define TIF_32BIT 5 /* 32 bit binary */ | 98 | #define TIF_32BIT 5 /* 32 bit binary */ |
99 | #define TIF_RUN_LIGHT 6 /* iSeries run light */ | 99 | /* #define SPARE 6 */ |
100 | #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */ | 100 | #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */ |
101 | #define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */ | 101 | #define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */ |
102 | #define TIF_SINGLESTEP 9 /* singlestepping active */ | 102 | #define TIF_SINGLESTEP 9 /* singlestepping active */ |
@@ -110,7 +110,7 @@ static inline struct thread_info *current_thread_info(void) | |||
110 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 110 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
111 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 111 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
112 | #define _TIF_32BIT (1<<TIF_32BIT) | 112 | #define _TIF_32BIT (1<<TIF_32BIT) |
113 | #define _TIF_RUN_LIGHT (1<<TIF_RUN_LIGHT) | 113 | /* #define _SPARE (1<<SPARE) */ |
114 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) | 114 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) |
115 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 115 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
116 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | 116 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
diff --git a/include/asm-ppc64/time.h b/include/asm-ppc64/time.h index 8d6e3760ee10..c6c762cad8b0 100644 --- a/include/asm-ppc64/time.h +++ b/include/asm-ppc64/time.h | |||
@@ -34,6 +34,15 @@ struct rtc_time; | |||
34 | extern void to_tm(int tim, struct rtc_time * tm); | 34 | extern void to_tm(int tim, struct rtc_time * tm); |
35 | extern time_t last_rtc_update; | 35 | extern time_t last_rtc_update; |
36 | 36 | ||
37 | void generic_calibrate_decr(void); | ||
38 | void setup_default_decr(void); | ||
39 | |||
40 | /* Some sane defaults: 125 MHz timebase, 1GHz processor */ | ||
41 | extern unsigned long ppc_proc_freq; | ||
42 | #define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) | ||
43 | extern unsigned long ppc_tb_freq; | ||
44 | #define DEFAULT_TB_FREQ 125000000UL | ||
45 | |||
37 | /* | 46 | /* |
38 | * By putting all of this stuff into a single struct we | 47 | * By putting all of this stuff into a single struct we |
39 | * reduce the number of cache lines touched by do_gettimeofday. | 48 | * reduce the number of cache lines touched by do_gettimeofday. |
diff --git a/include/asm-ppc64/topology.h b/include/asm-ppc64/topology.h index d58d9dd79998..fcdcfd26a26b 100644 --- a/include/asm-ppc64/topology.h +++ b/include/asm-ppc64/topology.h | |||
@@ -59,10 +59,8 @@ static inline int node_to_first_cpu(int node) | |||
59 | .nr_balance_failed = 0, \ | 59 | .nr_balance_failed = 0, \ |
60 | } | 60 | } |
61 | 61 | ||
62 | #else /* !CONFIG_NUMA */ | 62 | #endif /* CONFIG_NUMA */ |
63 | 63 | ||
64 | #include <asm-generic/topology.h> | 64 | #include <asm-generic/topology.h> |
65 | 65 | ||
66 | #endif /* CONFIG_NUMA */ | ||
67 | |||
68 | #endif /* _ASM_PPC64_TOPOLOGY_H */ | 66 | #endif /* _ASM_PPC64_TOPOLOGY_H */ |
diff --git a/include/asm-ppc64/xics.h b/include/asm-ppc64/xics.h index fdec5e7a7af6..0c45e14e26ca 100644 --- a/include/asm-ppc64/xics.h +++ b/include/asm-ppc64/xics.h | |||
@@ -17,6 +17,7 @@ | |||
17 | void xics_init_IRQ(void); | 17 | void xics_init_IRQ(void); |
18 | int xics_get_irq(struct pt_regs *); | 18 | int xics_get_irq(struct pt_regs *); |
19 | void xics_setup_cpu(void); | 19 | void xics_setup_cpu(void); |
20 | void xics_teardown_cpu(void); | ||
20 | void xics_cause_IPI(int cpu); | 21 | void xics_cause_IPI(int cpu); |
21 | void xics_request_IPIs(void); | 22 | void xics_request_IPIs(void); |
22 | void xics_migrate_irqs_away(void); | 23 | void xics_migrate_irqs_away(void); |
diff --git a/include/asm-s390/cpcmd.h b/include/asm-s390/cpcmd.h index 1d33c5da083e..1fcf65be7a23 100644 --- a/include/asm-s390/cpcmd.h +++ b/include/asm-s390/cpcmd.h | |||
@@ -11,14 +11,28 @@ | |||
11 | #define __CPCMD__ | 11 | #define __CPCMD__ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * the lowlevel function for cpcmd | ||
14 | * the caller of __cpcmd has to ensure that the response buffer is below 2 GB | 15 | * the caller of __cpcmd has to ensure that the response buffer is below 2 GB |
15 | */ | 16 | */ |
16 | extern void __cpcmd(char *cmd, char *response, int rlen); | 17 | extern int __cpcmd(const char *cmd, char *response, int rlen, int *response_code); |
17 | 18 | ||
18 | #ifndef __s390x__ | 19 | #ifndef __s390x__ |
19 | #define cpcmd __cpcmd | 20 | #define cpcmd __cpcmd |
20 | #else | 21 | #else |
21 | extern void cpcmd(char *cmd, char *response, int rlen); | 22 | /* |
23 | * cpcmd is the in-kernel interface for issuing CP commands | ||
24 | * | ||
25 | * cmd: null-terminated command string, max 240 characters | ||
26 | * response: response buffer for VM's textual response | ||
27 | * rlen: size of the response buffer, cpcmd will not exceed this size | ||
28 | * but will cap the output, if its too large. Everything that | ||
29 | * did not fit into the buffer will be silently dropped | ||
30 | * response_code: return pointer for VM's error code | ||
31 | * return value: the size of the response. The caller can check if the buffer | ||
32 | * was large enough by comparing the return value and rlen | ||
33 | * NOTE: If the response buffer is not below 2 GB, cpcmd can sleep | ||
34 | */ | ||
35 | extern int cpcmd(const char *cmd, char *response, int rlen, int *response_code); | ||
22 | #endif /*__s390x__*/ | 36 | #endif /*__s390x__*/ |
23 | 37 | ||
24 | #endif | 38 | #endif |
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h index 6bbcdea42a86..92360d90144b 100644 --- a/include/asm-s390/debug.h +++ b/include/asm-s390/debug.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef DEBUG_H | 9 | #ifndef DEBUG_H |
10 | #define DEBUG_H | 10 | #define DEBUG_H |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/fs.h> | ||
12 | #include <linux/string.h> | 14 | #include <linux/string.h> |
13 | 15 | ||
14 | /* Note: | 16 | /* Note: |
@@ -31,19 +33,18 @@ struct __debug_entry{ | |||
31 | } __attribute__((packed)); | 33 | } __attribute__((packed)); |
32 | 34 | ||
33 | 35 | ||
34 | #define __DEBUG_FEATURE_VERSION 1 /* version of debug feature */ | 36 | #define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */ |
35 | 37 | ||
36 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
37 | #include <linux/spinlock.h> | 39 | #include <linux/spinlock.h> |
38 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
39 | #include <linux/time.h> | 41 | #include <linux/time.h> |
40 | #include <linux/proc_fs.h> | ||
41 | 42 | ||
42 | #define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ | 43 | #define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ |
43 | #define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */ | 44 | #define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */ |
44 | #define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */ | 45 | #define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */ |
45 | #define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */ | 46 | #define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */ |
46 | #define DEBUG_MAX_PROCF_LEN 64 /* max length for a proc file name */ | 47 | #define DEBUG_MAX_NAME_LEN 64 /* max length for a debugfs file name */ |
47 | #define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */ | 48 | #define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */ |
48 | 49 | ||
49 | #define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */ | 50 | #define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */ |
@@ -64,16 +65,17 @@ typedef struct debug_info { | |||
64 | spinlock_t lock; | 65 | spinlock_t lock; |
65 | int level; | 66 | int level; |
66 | int nr_areas; | 67 | int nr_areas; |
67 | int page_order; | 68 | int pages_per_area; |
68 | int buf_size; | 69 | int buf_size; |
69 | int entry_size; | 70 | int entry_size; |
70 | debug_entry_t** areas; | 71 | debug_entry_t*** areas; |
71 | int active_area; | 72 | int active_area; |
72 | int *active_entry; | 73 | int *active_pages; |
73 | struct proc_dir_entry* proc_root_entry; | 74 | int *active_entries; |
74 | struct proc_dir_entry* proc_entries[DEBUG_MAX_VIEWS]; | 75 | struct dentry* debugfs_root_entry; |
76 | struct dentry* debugfs_entries[DEBUG_MAX_VIEWS]; | ||
75 | struct debug_view* views[DEBUG_MAX_VIEWS]; | 77 | struct debug_view* views[DEBUG_MAX_VIEWS]; |
76 | char name[DEBUG_MAX_PROCF_LEN]; | 78 | char name[DEBUG_MAX_NAME_LEN]; |
77 | } debug_info_t; | 79 | } debug_info_t; |
78 | 80 | ||
79 | typedef int (debug_header_proc_t) (debug_info_t* id, | 81 | typedef int (debug_header_proc_t) (debug_info_t* id, |
@@ -98,7 +100,7 @@ int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view, | |||
98 | int area, debug_entry_t* entry, char* out_buf); | 100 | int area, debug_entry_t* entry, char* out_buf); |
99 | 101 | ||
100 | struct debug_view { | 102 | struct debug_view { |
101 | char name[DEBUG_MAX_PROCF_LEN]; | 103 | char name[DEBUG_MAX_NAME_LEN]; |
102 | debug_prolog_proc_t* prolog_proc; | 104 | debug_prolog_proc_t* prolog_proc; |
103 | debug_header_proc_t* header_proc; | 105 | debug_header_proc_t* header_proc; |
104 | debug_format_proc_t* format_proc; | 106 | debug_format_proc_t* format_proc; |
@@ -120,7 +122,7 @@ debug_entry_t* debug_exception_common(debug_info_t* id, int level, | |||
120 | 122 | ||
121 | /* Debug Feature API: */ | 123 | /* Debug Feature API: */ |
122 | 124 | ||
123 | debug_info_t* debug_register(char* name, int pages_index, int nr_areas, | 125 | debug_info_t* debug_register(char* name, int pages, int nr_areas, |
124 | int buf_size); | 126 | int buf_size); |
125 | 127 | ||
126 | void debug_unregister(debug_info_t* id); | 128 | void debug_unregister(debug_info_t* id); |
@@ -132,7 +134,8 @@ void debug_stop_all(void); | |||
132 | extern inline debug_entry_t* | 134 | extern inline debug_entry_t* |
133 | debug_event(debug_info_t* id, int level, void* data, int length) | 135 | debug_event(debug_info_t* id, int level, void* data, int length) |
134 | { | 136 | { |
135 | if ((!id) || (level > id->level)) return NULL; | 137 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
138 | return NULL; | ||
136 | return debug_event_common(id,level,data,length); | 139 | return debug_event_common(id,level,data,length); |
137 | } | 140 | } |
138 | 141 | ||
@@ -140,7 +143,8 @@ extern inline debug_entry_t* | |||
140 | debug_int_event(debug_info_t* id, int level, unsigned int tag) | 143 | debug_int_event(debug_info_t* id, int level, unsigned int tag) |
141 | { | 144 | { |
142 | unsigned int t=tag; | 145 | unsigned int t=tag; |
143 | if ((!id) || (level > id->level)) return NULL; | 146 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
147 | return NULL; | ||
144 | return debug_event_common(id,level,&t,sizeof(unsigned int)); | 148 | return debug_event_common(id,level,&t,sizeof(unsigned int)); |
145 | } | 149 | } |
146 | 150 | ||
@@ -148,14 +152,16 @@ extern inline debug_entry_t * | |||
148 | debug_long_event (debug_info_t* id, int level, unsigned long tag) | 152 | debug_long_event (debug_info_t* id, int level, unsigned long tag) |
149 | { | 153 | { |
150 | unsigned long t=tag; | 154 | unsigned long t=tag; |
151 | if ((!id) || (level > id->level)) return NULL; | 155 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
156 | return NULL; | ||
152 | return debug_event_common(id,level,&t,sizeof(unsigned long)); | 157 | return debug_event_common(id,level,&t,sizeof(unsigned long)); |
153 | } | 158 | } |
154 | 159 | ||
155 | extern inline debug_entry_t* | 160 | extern inline debug_entry_t* |
156 | debug_text_event(debug_info_t* id, int level, const char* txt) | 161 | debug_text_event(debug_info_t* id, int level, const char* txt) |
157 | { | 162 | { |
158 | if ((!id) || (level > id->level)) return NULL; | 163 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
164 | return NULL; | ||
159 | return debug_event_common(id,level,txt,strlen(txt)); | 165 | return debug_event_common(id,level,txt,strlen(txt)); |
160 | } | 166 | } |
161 | 167 | ||
@@ -167,7 +173,8 @@ debug_sprintf_event(debug_info_t* id,int level,char *string,...) | |||
167 | extern inline debug_entry_t* | 173 | extern inline debug_entry_t* |
168 | debug_exception(debug_info_t* id, int level, void* data, int length) | 174 | debug_exception(debug_info_t* id, int level, void* data, int length) |
169 | { | 175 | { |
170 | if ((!id) || (level > id->level)) return NULL; | 176 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
177 | return NULL; | ||
171 | return debug_exception_common(id,level,data,length); | 178 | return debug_exception_common(id,level,data,length); |
172 | } | 179 | } |
173 | 180 | ||
@@ -175,7 +182,8 @@ extern inline debug_entry_t* | |||
175 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) | 182 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) |
176 | { | 183 | { |
177 | unsigned int t=tag; | 184 | unsigned int t=tag; |
178 | if ((!id) || (level > id->level)) return NULL; | 185 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
186 | return NULL; | ||
179 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); | 187 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); |
180 | } | 188 | } |
181 | 189 | ||
@@ -183,14 +191,16 @@ extern inline debug_entry_t * | |||
183 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) | 191 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) |
184 | { | 192 | { |
185 | unsigned long t=tag; | 193 | unsigned long t=tag; |
186 | if ((!id) || (level > id->level)) return NULL; | 194 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
195 | return NULL; | ||
187 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); | 196 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); |
188 | } | 197 | } |
189 | 198 | ||
190 | extern inline debug_entry_t* | 199 | extern inline debug_entry_t* |
191 | debug_text_exception(debug_info_t* id, int level, const char* txt) | 200 | debug_text_exception(debug_info_t* id, int level, const char* txt) |
192 | { | 201 | { |
193 | if ((!id) || (level > id->level)) return NULL; | 202 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
203 | return NULL; | ||
194 | return debug_exception_common(id,level,txt,strlen(txt)); | 204 | return debug_exception_common(id,level,txt,strlen(txt)); |
195 | } | 205 | } |
196 | 206 | ||
diff --git a/include/asm-s390/kexec.h b/include/asm-s390/kexec.h new file mode 100644 index 000000000000..54cf7d9f251c --- /dev/null +++ b/include/asm-s390/kexec.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * include/asm-s390/kexec.h | ||
3 | * | ||
4 | * (C) Copyright IBM Corp. 2005 | ||
5 | * | ||
6 | * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef _S390_KEXEC_H | ||
11 | #define _S390_KEXEC_H | ||
12 | |||
13 | #include <asm/page.h> | ||
14 | #include <asm/processor.h> | ||
15 | /* | ||
16 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | ||
17 | * I.e. Maximum page that is mapped directly into kernel memory, | ||
18 | * and kmap is not required. | ||
19 | */ | ||
20 | |||
21 | /* Maximum physical address we can use pages from */ | ||
22 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) | ||
23 | |||
24 | /* Maximum address we can reach in physical address mode */ | ||
25 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) | ||
26 | |||
27 | /* Maximum address we can use for the control pages */ | ||
28 | /* Not more than 2GB */ | ||
29 | #define KEXEC_CONTROL_MEMORY_LIMIT (1<<31) | ||
30 | |||
31 | /* Allocate one page for the pdp and the second for the code */ | ||
32 | #define KEXEC_CONTROL_CODE_SIZE 4096 | ||
33 | |||
34 | /* The native architecture */ | ||
35 | #define KEXEC_ARCH KEXEC_ARCH_S390 | ||
36 | |||
37 | #define MAX_NOTE_BYTES 1024 | ||
38 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
39 | |||
40 | extern note_buf_t crash_notes[]; | ||
41 | |||
42 | #endif /*_S390_KEXEC_H */ | ||
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index df5172fc589d..76b5b19c0ae2 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
@@ -109,10 +109,14 @@ | |||
109 | 109 | ||
110 | #ifndef __s390x__ | 110 | #ifndef __s390x__ |
111 | #define __LC_PFAULT_INTPARM 0x080 | 111 | #define __LC_PFAULT_INTPARM 0x080 |
112 | #define __LC_CPU_TIMER_SAVE_AREA 0x0D8 | ||
112 | #define __LC_AREGS_SAVE_AREA 0x120 | 113 | #define __LC_AREGS_SAVE_AREA 0x120 |
114 | #define __LC_GPREGS_SAVE_AREA 0x180 | ||
113 | #define __LC_CREGS_SAVE_AREA 0x1C0 | 115 | #define __LC_CREGS_SAVE_AREA 0x1C0 |
114 | #else /* __s390x__ */ | 116 | #else /* __s390x__ */ |
115 | #define __LC_PFAULT_INTPARM 0x11B8 | 117 | #define __LC_PFAULT_INTPARM 0x11B8 |
118 | #define __LC_GPREGS_SAVE_AREA 0x1280 | ||
119 | #define __LC_CPU_TIMER_SAVE_AREA 0x1328 | ||
116 | #define __LC_AREGS_SAVE_AREA 0x1340 | 120 | #define __LC_AREGS_SAVE_AREA 0x1340 |
117 | #define __LC_CREGS_SAVE_AREA 0x1380 | 121 | #define __LC_CREGS_SAVE_AREA 0x1380 |
118 | #endif /* __s390x__ */ | 122 | #endif /* __s390x__ */ |
@@ -167,7 +171,8 @@ struct _lowcore | |||
167 | __u16 subchannel_nr; /* 0x0ba */ | 171 | __u16 subchannel_nr; /* 0x0ba */ |
168 | __u32 io_int_parm; /* 0x0bc */ | 172 | __u32 io_int_parm; /* 0x0bc */ |
169 | __u32 io_int_word; /* 0x0c0 */ | 173 | __u32 io_int_word; /* 0x0c0 */ |
170 | __u8 pad3[0xD8-0xC4]; /* 0x0c4 */ | 174 | __u8 pad3[0xD4-0xC4]; /* 0x0c4 */ |
175 | __u32 extended_save_area_addr; /* 0x0d4 */ | ||
171 | __u32 cpu_timer_save_area[2]; /* 0x0d8 */ | 176 | __u32 cpu_timer_save_area[2]; /* 0x0d8 */ |
172 | __u32 clock_comp_save_area[2]; /* 0x0e0 */ | 177 | __u32 clock_comp_save_area[2]; /* 0x0e0 */ |
173 | __u32 mcck_interruption_code[2]; /* 0x0e8 */ | 178 | __u32 mcck_interruption_code[2]; /* 0x0e8 */ |
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index fb46e9090b50..8bd14de69e35 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
@@ -207,6 +207,18 @@ unsigned long get_wchan(struct task_struct *p); | |||
207 | #endif /* __s390x__ */ | 207 | #endif /* __s390x__ */ |
208 | 208 | ||
209 | /* | 209 | /* |
210 | * Set PSW to specified value. | ||
211 | */ | ||
212 | static inline void __load_psw(psw_t psw) | ||
213 | { | ||
214 | #ifndef __s390x__ | ||
215 | asm volatile ("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); | ||
216 | #else | ||
217 | asm volatile ("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); | ||
218 | #endif | ||
219 | } | ||
220 | |||
221 | /* | ||
210 | * Set PSW mask to specified value, while leaving the | 222 | * Set PSW mask to specified value, while leaving the |
211 | * PSW addr pointing to the next instruction. | 223 | * PSW addr pointing to the next instruction. |
212 | */ | 224 | */ |
@@ -214,8 +226,8 @@ unsigned long get_wchan(struct task_struct *p); | |||
214 | static inline void __load_psw_mask (unsigned long mask) | 226 | static inline void __load_psw_mask (unsigned long mask) |
215 | { | 227 | { |
216 | unsigned long addr; | 228 | unsigned long addr; |
217 | |||
218 | psw_t psw; | 229 | psw_t psw; |
230 | |||
219 | psw.mask = mask; | 231 | psw.mask = mask; |
220 | 232 | ||
221 | #ifndef __s390x__ | 233 | #ifndef __s390x__ |
@@ -241,30 +253,8 @@ static inline void __load_psw_mask (unsigned long mask) | |||
241 | */ | 253 | */ |
242 | static inline void enabled_wait(void) | 254 | static inline void enabled_wait(void) |
243 | { | 255 | { |
244 | unsigned long reg; | 256 | __load_psw_mask(PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | |
245 | psw_t wait_psw; | 257 | PSW_MASK_MCHECK | PSW_MASK_WAIT | PSW_DEFAULT_KEY); |
246 | |||
247 | wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | | ||
248 | PSW_MASK_MCHECK | PSW_MASK_WAIT | PSW_DEFAULT_KEY; | ||
249 | #ifndef __s390x__ | ||
250 | asm volatile ( | ||
251 | " basr %0,0\n" | ||
252 | "0: la %0,1f-0b(%0)\n" | ||
253 | " st %0,4(%1)\n" | ||
254 | " oi 4(%1),0x80\n" | ||
255 | " lpsw 0(%1)\n" | ||
256 | "1:" | ||
257 | : "=&a" (reg) : "a" (&wait_psw), "m" (wait_psw) | ||
258 | : "memory", "cc" ); | ||
259 | #else /* __s390x__ */ | ||
260 | asm volatile ( | ||
261 | " larl %0,0f\n" | ||
262 | " stg %0,8(%1)\n" | ||
263 | " lpswe 0(%1)\n" | ||
264 | "0:" | ||
265 | : "=&a" (reg) : "a" (&wait_psw), "m" (wait_psw) | ||
266 | : "memory", "cc" ); | ||
267 | #endif /* __s390x__ */ | ||
268 | } | 258 | } |
269 | 259 | ||
270 | /* | 260 | /* |
@@ -273,13 +263,11 @@ static inline void enabled_wait(void) | |||
273 | 263 | ||
274 | static inline void disabled_wait(unsigned long code) | 264 | static inline void disabled_wait(unsigned long code) |
275 | { | 265 | { |
276 | char psw_buffer[2*sizeof(psw_t)]; | ||
277 | unsigned long ctl_buf; | 266 | unsigned long ctl_buf; |
278 | psw_t *dw_psw = (psw_t *)(((unsigned long) &psw_buffer+sizeof(psw_t)-1) | 267 | psw_t dw_psw; |
279 | & -sizeof(psw_t)); | ||
280 | 268 | ||
281 | dw_psw->mask = PSW_BASE_BITS | PSW_MASK_WAIT; | 269 | dw_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT; |
282 | dw_psw->addr = code; | 270 | dw_psw.addr = code; |
283 | /* | 271 | /* |
284 | * Store status and then load disabled wait psw, | 272 | * Store status and then load disabled wait psw, |
285 | * the processor is dead afterwards | 273 | * the processor is dead afterwards |
@@ -301,7 +289,7 @@ static inline void disabled_wait(unsigned long code) | |||
301 | " oi 0x1c0,0x10\n" /* fake protection bit */ | 289 | " oi 0x1c0,0x10\n" /* fake protection bit */ |
302 | " lpsw 0(%1)" | 290 | " lpsw 0(%1)" |
303 | : "=m" (ctl_buf) | 291 | : "=m" (ctl_buf) |
304 | : "a" (dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc" ); | 292 | : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc" ); |
305 | #else /* __s390x__ */ | 293 | #else /* __s390x__ */ |
306 | asm volatile (" stctg 0,0,0(%2)\n" | 294 | asm volatile (" stctg 0,0,0(%2)\n" |
307 | " ni 4(%2),0xef\n" /* switch off protection */ | 295 | " ni 4(%2),0xef\n" /* switch off protection */ |
@@ -333,7 +321,7 @@ static inline void disabled_wait(unsigned long code) | |||
333 | " oi 0x384(1),0x10\n" /* fake protection bit */ | 321 | " oi 0x384(1),0x10\n" /* fake protection bit */ |
334 | " lpswe 0(%1)" | 322 | " lpswe 0(%1)" |
335 | : "=m" (ctl_buf) | 323 | : "=m" (ctl_buf) |
336 | : "a" (dw_psw), "a" (&ctl_buf), | 324 | : "a" (&dw_psw), "a" (&ctl_buf), |
337 | "m" (dw_psw) : "cc", "0", "1"); | 325 | "m" (dw_psw) : "cc", "0", "1"); |
338 | #endif /* __s390x__ */ | 326 | #endif /* __s390x__ */ |
339 | } | 327 | } |
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index 4eff8f2e3bf1..fc7c96edc697 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h | |||
@@ -276,7 +276,7 @@ typedef struct | |||
276 | #endif /* __s390x__ */ | 276 | #endif /* __s390x__ */ |
277 | 277 | ||
278 | #define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | \ | 278 | #define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | \ |
279 | PSW_DEFAULT_KEY) | 279 | PSW_MASK_MCHECK | PSW_DEFAULT_KEY) |
280 | #define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ | 280 | #define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ |
281 | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ | 281 | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ |
282 | PSW_MASK_PSTATE | PSW_DEFAULT_KEY) | 282 | PSW_MASK_PSTATE | PSW_DEFAULT_KEY) |
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index 9473786387a3..dd50e57a928f 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h | |||
@@ -47,7 +47,7 @@ extern int smp_call_function_on(void (*func) (void *info), void *info, | |||
47 | 47 | ||
48 | #define PROC_CHANGE_PENALTY 20 /* Schedule penalty */ | 48 | #define PROC_CHANGE_PENALTY 20 /* Schedule penalty */ |
49 | 49 | ||
50 | #define smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) | 50 | #define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) |
51 | 51 | ||
52 | extern int smp_get_cpu(cpumask_t cpu_map); | 52 | extern int smp_get_cpu(cpumask_t cpu_map); |
53 | extern void smp_put_cpu(int cpu); | 53 | extern void smp_put_cpu(int cpu); |
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index 81514d76edcf..b4a9f05a93d6 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/types.h> | 16 | #include <asm/types.h> |
17 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
18 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |
19 | #include <asm/processor.h> | ||
19 | 20 | ||
20 | #ifdef __KERNEL__ | 21 | #ifdef __KERNEL__ |
21 | 22 | ||
@@ -103,29 +104,18 @@ static inline void restore_access_regs(unsigned int *acrs) | |||
103 | prev = __switch_to(prev,next); \ | 104 | prev = __switch_to(prev,next); \ |
104 | } while (0) | 105 | } while (0) |
105 | 106 | ||
106 | #define prepare_arch_switch(rq, next) do { } while(0) | ||
107 | #define task_running(rq, p) ((rq)->curr == (p)) | ||
108 | |||
109 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 107 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
110 | extern void account_user_vtime(struct task_struct *); | 108 | extern void account_user_vtime(struct task_struct *); |
111 | extern void account_system_vtime(struct task_struct *); | 109 | extern void account_system_vtime(struct task_struct *); |
112 | |||
113 | #define finish_arch_switch(rq, prev) do { \ | ||
114 | set_fs(current->thread.mm_segment); \ | ||
115 | spin_unlock(&(rq)->lock); \ | ||
116 | account_system_vtime(prev); \ | ||
117 | local_irq_enable(); \ | ||
118 | } while (0) | ||
119 | |||
120 | #else | 110 | #else |
111 | #define account_system_vtime(prev) do { } while (0) | ||
112 | #endif | ||
121 | 113 | ||
122 | #define finish_arch_switch(rq, prev) do { \ | 114 | #define finish_arch_switch(rq, prev) do { \ |
123 | set_fs(current->thread.mm_segment); \ | 115 | set_fs(current->thread.mm_segment); \ |
124 | spin_unlock_irq(&(rq)->lock); \ | 116 | account_system_vtime(prev); \ |
125 | } while (0) | 117 | } while (0) |
126 | 118 | ||
127 | #endif | ||
128 | |||
129 | #define nop() __asm__ __volatile__ ("nop") | 119 | #define nop() __asm__ __volatile__ ("nop") |
130 | 120 | ||
131 | #define xchg(ptr,x) \ | 121 | #define xchg(ptr,x) \ |
@@ -331,9 +321,6 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
331 | 321 | ||
332 | #ifdef __s390x__ | 322 | #ifdef __s390x__ |
333 | 323 | ||
334 | #define __load_psw(psw) \ | ||
335 | __asm__ __volatile__("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); | ||
336 | |||
337 | #define __ctl_load(array, low, high) ({ \ | 324 | #define __ctl_load(array, low, high) ({ \ |
338 | typedef struct { char _[sizeof(array)]; } addrtype; \ | 325 | typedef struct { char _[sizeof(array)]; } addrtype; \ |
339 | __asm__ __volatile__ ( \ | 326 | __asm__ __volatile__ ( \ |
@@ -390,9 +377,6 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
390 | 377 | ||
391 | #else /* __s390x__ */ | 378 | #else /* __s390x__ */ |
392 | 379 | ||
393 | #define __load_psw(psw) \ | ||
394 | __asm__ __volatile__("lpsw 0(%0)" : : "a" (&psw) : "cc" ); | ||
395 | |||
396 | #define __ctl_load(array, low, high) ({ \ | 380 | #define __ctl_load(array, low, high) ({ \ |
397 | typedef struct { char _[sizeof(array)]; } addrtype; \ | 381 | typedef struct { char _[sizeof(array)]; } addrtype; \ |
398 | __asm__ __volatile__ ( \ | 382 | __asm__ __volatile__ ( \ |
@@ -451,6 +435,20 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
451 | /* For spinlocks etc */ | 435 | /* For spinlocks etc */ |
452 | #define local_irq_save(x) ((x) = local_irq_disable()) | 436 | #define local_irq_save(x) ((x) = local_irq_disable()) |
453 | 437 | ||
438 | /* | ||
439 | * Use to set psw mask except for the first byte which | ||
440 | * won't be changed by this function. | ||
441 | */ | ||
442 | static inline void | ||
443 | __set_psw_mask(unsigned long mask) | ||
444 | { | ||
445 | local_save_flags(mask); | ||
446 | __load_psw_mask(mask); | ||
447 | } | ||
448 | |||
449 | #define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS) | ||
450 | #define local_mcck_disable() __set_psw_mask(PSW_KERNEL_BITS & ~PSW_MASK_MCHECK) | ||
451 | |||
454 | #ifdef CONFIG_SMP | 452 | #ifdef CONFIG_SMP |
455 | 453 | ||
456 | extern void smp_ctl_set_bit(int cr, int bit); | 454 | extern void smp_ctl_set_bit(int cr, int bit); |
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h index aade85c53a63..6c18a3f24316 100644 --- a/include/asm-s390/thread_info.h +++ b/include/asm-s390/thread_info.h | |||
@@ -50,7 +50,7 @@ struct thread_info { | |||
50 | struct exec_domain *exec_domain; /* execution domain */ | 50 | struct exec_domain *exec_domain; /* execution domain */ |
51 | unsigned long flags; /* low level flags */ | 51 | unsigned long flags; /* low level flags */ |
52 | unsigned int cpu; /* current CPU */ | 52 | unsigned int cpu; /* current CPU */ |
53 | unsigned int preempt_count; /* 0 => preemptable */ | 53 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
54 | struct restart_block restart_block; | 54 | struct restart_block restart_block; |
55 | }; | 55 | }; |
56 | 56 | ||
@@ -96,6 +96,7 @@ static inline struct thread_info *current_thread_info(void) | |||
96 | #define TIF_RESTART_SVC 4 /* restart svc with new svc number */ | 96 | #define TIF_RESTART_SVC 4 /* restart svc with new svc number */ |
97 | #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ | 97 | #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ |
98 | #define TIF_SINGLE_STEP 6 /* deliver sigtrap on return to user */ | 98 | #define TIF_SINGLE_STEP 6 /* deliver sigtrap on return to user */ |
99 | #define TIF_MCCK_PENDING 7 /* machine check handling is pending */ | ||
99 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ | 100 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ |
100 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling | 101 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling |
101 | TIF_NEED_RESCHED */ | 102 | TIF_NEED_RESCHED */ |
@@ -109,6 +110,7 @@ static inline struct thread_info *current_thread_info(void) | |||
109 | #define _TIF_RESTART_SVC (1<<TIF_RESTART_SVC) | 110 | #define _TIF_RESTART_SVC (1<<TIF_RESTART_SVC) |
110 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 111 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
111 | #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) | 112 | #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) |
113 | #define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING) | ||
112 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | 114 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) |
113 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 115 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
114 | #define _TIF_31BIT (1<<TIF_31BIT) | 116 | #define _TIF_31BIT (1<<TIF_31BIT) |
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index f1a204f7c0f0..363db45f8d07 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -269,7 +269,7 @@ | |||
269 | #define __NR_mq_timedreceive 274 | 269 | #define __NR_mq_timedreceive 274 |
270 | #define __NR_mq_notify 275 | 270 | #define __NR_mq_notify 275 |
271 | #define __NR_mq_getsetattr 276 | 271 | #define __NR_mq_getsetattr 276 |
272 | /* Number 277 is reserved for new sys_kexec_load */ | 272 | #define __NR_kexec_load 277 |
273 | #define __NR_add_key 278 | 273 | #define __NR_add_key 278 |
274 | #define __NR_request_key 279 | 274 | #define __NR_request_key 279 |
275 | #define __NR_keyctl 280 | 275 | #define __NR_keyctl 280 |
diff --git a/include/asm-s390/user.h b/include/asm-s390/user.h index c64f8c181df3..1dc74baf03c4 100644 --- a/include/asm-s390/user.h +++ b/include/asm-s390/user.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #define _S390_USER_H | 10 | #define _S390_USER_H |
11 | 11 | ||
12 | #include <asm/page.h> | 12 | #include <asm/page.h> |
13 | #include <linux/ptrace.h> | 13 | #include <asm/ptrace.h> |
14 | /* Core file format: The core file is written in such a way that gdb | 14 | /* Core file format: The core file is written in such a way that gdb |
15 | can understand it and provide useful information to the user (under | 15 | can understand it and provide useful information to the user (under |
16 | linux we use the 'trad-core' bfd). There are quite a number of | 16 | linux we use the 'trad-core' bfd). There are quite a number of |
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 4c6d129e7d91..180467be8e7b 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) | 31 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) |
32 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) | 32 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) |
33 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) | 33 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) |
34 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
34 | #endif | 35 | #endif |
35 | 36 | ||
36 | #ifdef __KERNEL__ | 37 | #ifdef __KERNEL__ |
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index cd847a47a9aa..ecb909572d3f 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h | |||
@@ -196,6 +196,7 @@ static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _ | |||
196 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 196 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
197 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 197 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
198 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } | 198 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } |
199 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } | ||
199 | 200 | ||
200 | /* | 201 | /* |
201 | * Macro and implementation to make a page protection as uncachable. | 202 | * Macro and implementation to make a page protection as uncachable. |
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h index 38b54469d7d1..f19a8b3b69a6 100644 --- a/include/asm-sh/smp.h +++ b/include/asm-sh/smp.h | |||
@@ -25,7 +25,7 @@ extern cpumask_t cpu_possible_map; | |||
25 | 25 | ||
26 | #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) | 26 | #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) |
27 | 27 | ||
28 | #define smp_processor_id() (current_thread_info()->cpu) | 28 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
29 | 29 | ||
30 | /* I've no idea what the real meaning of this is */ | 30 | /* I've no idea what the real meaning of this is */ |
31 | #define PROC_CHANGE_PENALTY 20 | 31 | #define PROC_CHANGE_PENALTY 20 |
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h index d82f883d8e6d..46080cefaff8 100644 --- a/include/asm-sh/thread_info.h +++ b/include/asm-sh/thread_info.h | |||
@@ -20,14 +20,14 @@ struct thread_info { | |||
20 | struct exec_domain *exec_domain; /* execution domain */ | 20 | struct exec_domain *exec_domain; /* execution domain */ |
21 | __u32 flags; /* low level flags */ | 21 | __u32 flags; /* low level flags */ |
22 | __u32 cpu; | 22 | __u32 cpu; |
23 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 23 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
24 | struct restart_block restart_block; | 24 | struct restart_block restart_block; |
25 | __u8 supervisor_stack[0]; | 25 | __u8 supervisor_stack[0]; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #define PREEMPT_ACTIVE 0x4000000 | 30 | #define PREEMPT_ACTIVE 0x10000000 |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * macros/functions for gaining access to the thread information structure | 33 | * macros/functions for gaining access to the thread information structure |
diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h index e1f7f5a41210..d6167f1c0e99 100644 --- a/include/asm-sh64/page.h +++ b/include/asm-sh64/page.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) | 41 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) |
42 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) | 42 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) |
43 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) | 43 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) |
44 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | #ifdef __KERNEL__ | 47 | #ifdef __KERNEL__ |
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h index 525e1523ef5f..78ac6be2d9ef 100644 --- a/include/asm-sh64/pgtable.h +++ b/include/asm-sh64/pgtable.h | |||
@@ -430,6 +430,8 @@ extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | | |||
430 | extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; } | 430 | extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; } |
431 | extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 431 | extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
432 | extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 432 | extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
433 | extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } | ||
434 | |||
433 | 435 | ||
434 | /* | 436 | /* |
435 | * Conversion functions: convert a page and protection to a page entry. | 437 | * Conversion functions: convert a page and protection to a page entry. |
diff --git a/include/asm-sh64/thread_info.h b/include/asm-sh64/thread_info.h index e65f394da472..10f024c6a2e3 100644 --- a/include/asm-sh64/thread_info.h +++ b/include/asm-sh64/thread_info.h | |||
@@ -22,7 +22,7 @@ struct thread_info { | |||
22 | struct exec_domain *exec_domain; /* execution domain */ | 22 | struct exec_domain *exec_domain; /* execution domain */ |
23 | unsigned long flags; /* low level flags */ | 23 | unsigned long flags; /* low level flags */ |
24 | /* Put the 4 32-bit fields together to make asm offsetting easier. */ | 24 | /* Put the 4 32-bit fields together to make asm offsetting easier. */ |
25 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | 25 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
26 | __u16 cpu; | 26 | __u16 cpu; |
27 | 27 | ||
28 | mm_segment_t addr_limit; | 28 | mm_segment_t addr_limit; |
@@ -73,7 +73,7 @@ static inline struct thread_info *current_thread_info(void) | |||
73 | 73 | ||
74 | #define THREAD_SIZE 8192 | 74 | #define THREAD_SIZE 8192 |
75 | 75 | ||
76 | #define PREEMPT_ACTIVE 0x4000000 | 76 | #define PREEMPT_ACTIVE 0x10000000 |
77 | 77 | ||
78 | /* thread information flags */ | 78 | /* thread information flags */ |
79 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 79 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h index f986c0d0922a..4f96d8333a12 100644 --- a/include/asm-sparc/smp.h +++ b/include/asm-sparc/smp.h | |||
@@ -148,7 +148,7 @@ extern __inline__ int hard_smp_processor_id(void) | |||
148 | } | 148 | } |
149 | #endif | 149 | #endif |
150 | 150 | ||
151 | #define smp_processor_id() (current_thread_info()->cpu) | 151 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
152 | 152 | ||
153 | #define prof_multiplier(__cpu) cpu_data(__cpu).multiplier | 153 | #define prof_multiplier(__cpu) cpu_data(__cpu).multiplier |
154 | #define prof_counter(__cpu) cpu_data(__cpu).counter | 154 | #define prof_counter(__cpu) cpu_data(__cpu).counter |
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index 80cf20cfaee1..898562ebe94c 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h | |||
@@ -101,7 +101,7 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | |||
101 | * SWITCH_ENTER and SWITH_DO_LAZY_FPU do not work yet (e.g. SMP does not work) | 101 | * SWITCH_ENTER and SWITH_DO_LAZY_FPU do not work yet (e.g. SMP does not work) |
102 | * XXX WTF is the above comment? Found in late teen 2.4.x. | 102 | * XXX WTF is the above comment? Found in late teen 2.4.x. |
103 | */ | 103 | */ |
104 | #define prepare_arch_switch(rq, next) do { \ | 104 | #define prepare_arch_switch(next) do { \ |
105 | __asm__ __volatile__( \ | 105 | __asm__ __volatile__( \ |
106 | ".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ | 106 | ".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ |
107 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ | 107 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ |
@@ -109,8 +109,6 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | |||
109 | "save %sp, -0x40, %sp\n\t" \ | 109 | "save %sp, -0x40, %sp\n\t" \ |
110 | "restore; restore; restore; restore; restore; restore; restore"); \ | 110 | "restore; restore; restore; restore; restore; restore; restore"); \ |
111 | } while(0) | 111 | } while(0) |
112 | #define finish_arch_switch(rq, next) spin_unlock_irq(&(rq)->lock) | ||
113 | #define task_running(rq, p) ((rq)->curr == (p)) | ||
114 | 112 | ||
115 | /* Much care has gone into this code, do not touch it. | 113 | /* Much care has gone into this code, do not touch it. |
116 | * | 114 | * |
diff --git a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h index 104f03c55416..ff6ccb3d24c6 100644 --- a/include/asm-sparc/thread_info.h +++ b/include/asm-sparc/thread_info.h | |||
@@ -30,9 +30,9 @@ struct thread_info { | |||
30 | struct task_struct *task; /* main task structure */ | 30 | struct task_struct *task; /* main task structure */ |
31 | struct exec_domain *exec_domain; /* execution domain */ | 31 | struct exec_domain *exec_domain; /* execution domain */ |
32 | unsigned long flags; /* low level flags */ | 32 | unsigned long flags; /* low level flags */ |
33 | |||
34 | int cpu; /* cpu we're on */ | 33 | int cpu; /* cpu we're on */ |
35 | int preempt_count; | 34 | int preempt_count; /* 0 => preemptable, |
35 | <0 => BUG */ | ||
36 | int softirq_count; | 36 | int softirq_count; |
37 | int hardirq_count; | 37 | int hardirq_count; |
38 | 38 | ||
diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h index f461144067ee..0a780e84a12b 100644 --- a/include/asm-sparc/uaccess.h +++ b/include/asm-sparc/uaccess.h | |||
@@ -41,10 +41,11 @@ | |||
41 | * No one can read/write anything from userland in the kernel space by setting | 41 | * No one can read/write anything from userland in the kernel space by setting |
42 | * large size and address near to PAGE_OFFSET - a fault will break his intentions. | 42 | * large size and address near to PAGE_OFFSET - a fault will break his intentions. |
43 | */ | 43 | */ |
44 | #define __user_ok(addr,size) ((addr) < STACK_TOP) | 44 | #define __user_ok(addr, size) ({ (void)(size); (addr) < STACK_TOP; }) |
45 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) | 45 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) |
46 | #define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size))) | 46 | #define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size))) |
47 | #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) | 47 | #define access_ok(type, addr, size) \ |
48 | ({ (void)(type); __access_ok((unsigned long)(addr), size); }) | ||
48 | 49 | ||
49 | /* this function will go away soon - use access_ok() instead */ | 50 | /* this function will go away soon - use access_ok() instead */ |
50 | static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size) | 51 | static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size) |
diff --git a/include/asm-sparc64/agp.h b/include/asm-sparc64/agp.h index ba05bdf9a211..58f8cb6ae767 100644 --- a/include/asm-sparc64/agp.h +++ b/include/asm-sparc64/agp.h | |||
@@ -8,4 +8,14 @@ | |||
8 | #define flush_agp_mappings() | 8 | #define flush_agp_mappings() |
9 | #define flush_agp_cache() mb() | 9 | #define flush_agp_cache() mb() |
10 | 10 | ||
11 | /* Convert a physical address to an address suitable for the GART. */ | ||
12 | #define phys_to_gart(x) (x) | ||
13 | #define gart_to_phys(x) (x) | ||
14 | |||
15 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ | ||
16 | #define alloc_gatt_pages(order) \ | ||
17 | ((char *)__get_free_pages(GFP_KERNEL, (order))) | ||
18 | #define free_gatt_pages(table, order) \ | ||
19 | free_pages((unsigned long)(table), (order)) | ||
20 | |||
11 | #endif | 21 | #endif |
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h index 22f58055b8ab..b59122dd176d 100644 --- a/include/asm-sparc64/compat.h +++ b/include/asm-sparc64/compat.h | |||
@@ -25,6 +25,7 @@ typedef s32 compat_daddr_t; | |||
25 | typedef u32 compat_caddr_t; | 25 | typedef u32 compat_caddr_t; |
26 | typedef __kernel_fsid_t compat_fsid_t; | 26 | typedef __kernel_fsid_t compat_fsid_t; |
27 | typedef s32 compat_key_t; | 27 | typedef s32 compat_key_t; |
28 | typedef s32 compat_timer_t; | ||
28 | 29 | ||
29 | typedef s32 compat_int_t; | 30 | typedef s32 compat_int_t; |
30 | typedef s32 compat_long_t; | 31 | typedef s32 compat_long_t; |
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h index 5fd16e42a045..0de7a3da79cd 100644 --- a/include/asm-sparc64/iommu.h +++ b/include/asm-sparc64/iommu.h | |||
@@ -16,4 +16,6 @@ | |||
16 | #define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ | 16 | #define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ |
17 | #define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ | 17 | #define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ |
18 | 18 | ||
19 | #define IOMMU_NUM_CTXS 4096 | ||
20 | |||
19 | #endif /* !(_SPARC_IOMMU_H) */ | 21 | #endif /* !(_SPARC_IOMMU_H) */ |
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h index f70d3dad01f9..6321f5a0198d 100644 --- a/include/asm-sparc64/kdebug.h +++ b/include/asm-sparc64/kdebug.h | |||
@@ -16,7 +16,7 @@ struct die_args { | |||
16 | }; | 16 | }; |
17 | 17 | ||
18 | /* Note - you should never unregister because that can race with NMIs. | 18 | /* Note - you should never unregister because that can race with NMIs. |
19 | * If you really want to do it first unregister - then synchronize_kernel | 19 | * If you really want to do it first unregister - then synchronize_sched |
20 | * - then free. | 20 | * - then free. |
21 | */ | 21 | */ |
22 | int register_die_notifier(struct notifier_block *nb); | 22 | int register_die_notifier(struct notifier_block *nb); |
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index 219ea043a14a..b87dbbd64bc9 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h | |||
@@ -95,6 +95,8 @@ typedef unsigned long pgprot_t; | |||
95 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) | 95 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) |
96 | #define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) | 96 | #define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) |
97 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 97 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
98 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
99 | #define ARCH_HAS_HUGETLB_PREFAULT_HOOK | ||
98 | #endif | 100 | #endif |
99 | 101 | ||
100 | #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ | 102 | #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ |
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h index 92999631c819..4c15610a2bac 100644 --- a/include/asm-sparc64/pbm.h +++ b/include/asm-sparc64/pbm.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <asm/page.h> | 16 | #include <asm/page.h> |
17 | #include <asm/oplib.h> | 17 | #include <asm/oplib.h> |
18 | #include <asm/iommu.h> | ||
18 | 19 | ||
19 | /* The abstraction used here is that there are PCI controllers, | 20 | /* The abstraction used here is that there are PCI controllers, |
20 | * each with one (Sabre) or two (PSYCHO/SCHIZO) PCI bus modules | 21 | * each with one (Sabre) or two (PSYCHO/SCHIZO) PCI bus modules |
@@ -40,9 +41,6 @@ struct pci_iommu { | |||
40 | */ | 41 | */ |
41 | spinlock_t lock; | 42 | spinlock_t lock; |
42 | 43 | ||
43 | /* Context allocator. */ | ||
44 | unsigned int iommu_cur_ctx; | ||
45 | |||
46 | /* IOMMU page table, a linear array of ioptes. */ | 44 | /* IOMMU page table, a linear array of ioptes. */ |
47 | iopte_t *page_table; /* The page table itself. */ | 45 | iopte_t *page_table; /* The page table itself. */ |
48 | int page_table_sz_bits; /* log2 of ow many pages does it map? */ | 46 | int page_table_sz_bits; /* log2 of ow many pages does it map? */ |
@@ -87,6 +85,10 @@ struct pci_iommu { | |||
87 | u16 flush; | 85 | u16 flush; |
88 | } alloc_info[PBM_NCLUSTERS]; | 86 | } alloc_info[PBM_NCLUSTERS]; |
89 | 87 | ||
88 | /* CTX allocation. */ | ||
89 | unsigned long ctx_lowest_free; | ||
90 | unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)]; | ||
91 | |||
90 | /* Here a PCI controller driver describes the areas of | 92 | /* Here a PCI controller driver describes the areas of |
91 | * PCI memory space where DMA to/from physical memory | 93 | * PCI memory space where DMA to/from physical memory |
92 | * are addressed. Drivers interrogate the PCI layer | 94 | * are addressed. Drivers interrogate the PCI layer |
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index ae2cd5b09a7c..1ae00c5087f1 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -286,6 +286,7 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot) | |||
286 | #define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_ACCESSED | _PAGE_R)) | 286 | #define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_ACCESSED | _PAGE_R)) |
287 | #define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_WRITE)) | 287 | #define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_WRITE)) |
288 | #define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_MODIFIED | _PAGE_W)) | 288 | #define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_MODIFIED | _PAGE_W)) |
289 | #define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_SZHUGE)) | ||
289 | 290 | ||
290 | /* to find an entry in a page-table-directory. */ | 291 | /* to find an entry in a page-table-directory. */ |
291 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) | 292 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) |
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index bc1445b904ef..d0bee2413560 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h | |||
@@ -192,6 +192,40 @@ extern unsigned long get_wchan(struct task_struct *task); | |||
192 | 192 | ||
193 | #define cpu_relax() barrier() | 193 | #define cpu_relax() barrier() |
194 | 194 | ||
195 | /* Prefetch support. This is tuned for UltraSPARC-III and later. | ||
196 | * UltraSPARC-I will treat these as nops, and UltraSPARC-II has | ||
197 | * a shallower prefetch queue than later chips. | ||
198 | */ | ||
199 | #define ARCH_HAS_PREFETCH | ||
200 | #define ARCH_HAS_PREFETCHW | ||
201 | #define ARCH_HAS_SPINLOCK_PREFETCH | ||
202 | |||
203 | static inline void prefetch(const void *x) | ||
204 | { | ||
205 | /* We do not use the read prefetch mnemonic because that | ||
206 | * prefetches into the prefetch-cache which only is accessible | ||
207 | * by floating point operations in UltraSPARC-III and later. | ||
208 | * By contrast, "#one_write" prefetches into the L2 cache | ||
209 | * in shared state. | ||
210 | */ | ||
211 | __asm__ __volatile__("prefetch [%0], #one_write" | ||
212 | : /* no outputs */ | ||
213 | : "r" (x)); | ||
214 | } | ||
215 | |||
216 | static inline void prefetchw(const void *x) | ||
217 | { | ||
218 | /* The most optimal prefetch to use for writes is | ||
219 | * "#n_writes". This brings the cacheline into the | ||
220 | * L2 cache in "owned" state. | ||
221 | */ | ||
222 | __asm__ __volatile__("prefetch [%0], #n_writes" | ||
223 | : /* no outputs */ | ||
224 | : "r" (x)); | ||
225 | } | ||
226 | |||
227 | #define spin_lock_prefetch(x) prefetchw(x) | ||
228 | |||
195 | #endif /* !(__ASSEMBLY__) */ | 229 | #endif /* !(__ASSEMBLY__) */ |
196 | 230 | ||
197 | #endif /* !(__ASM_SPARC64_PROCESSOR_H) */ | 231 | #endif /* !(__ASM_SPARC64_PROCESSOR_H) */ |
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 5e3e06d908fe..110a2de89123 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h | |||
@@ -64,7 +64,7 @@ static __inline__ int hard_smp_processor_id(void) | |||
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | #define smp_processor_id() (current_thread_info()->cpu) | 67 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
68 | 68 | ||
69 | #endif /* !(__ASSEMBLY__) */ | 69 | #endif /* !(__ASSEMBLY__) */ |
70 | 70 | ||
diff --git a/include/asm-sparc64/spitfire.h b/include/asm-sparc64/spitfire.h index ad78ce64d69e..9d7613eea812 100644 --- a/include/asm-sparc64/spitfire.h +++ b/include/asm-sparc64/spitfire.h | |||
@@ -48,6 +48,9 @@ enum ultra_tlb_layout { | |||
48 | 48 | ||
49 | extern enum ultra_tlb_layout tlb_type; | 49 | extern enum ultra_tlb_layout tlb_type; |
50 | 50 | ||
51 | extern int cheetah_pcache_forced_on; | ||
52 | extern void cheetah_enable_pcache(void); | ||
53 | |||
51 | #define sparc64_highest_locked_tlbent() \ | 54 | #define sparc64_highest_locked_tlbent() \ |
52 | (tlb_type == spitfire ? \ | 55 | (tlb_type == spitfire ? \ |
53 | SPITFIRE_HIGHEST_LOCKED_TLBENT : \ | 56 | SPITFIRE_HIGHEST_LOCKED_TLBENT : \ |
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index fd12ca386f48..f9be2c5b4dc9 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h | |||
@@ -139,19 +139,13 @@ extern void __flushw_user(void); | |||
139 | #define flush_user_windows flushw_user | 139 | #define flush_user_windows flushw_user |
140 | #define flush_register_windows flushw_all | 140 | #define flush_register_windows flushw_all |
141 | 141 | ||
142 | #define prepare_arch_switch(rq, next) \ | 142 | /* Don't hold the runqueue lock over context switch */ |
143 | do { spin_lock(&(next)->switch_lock); \ | 143 | #define __ARCH_WANT_UNLOCKED_CTXSW |
144 | spin_unlock(&(rq)->lock); \ | 144 | #define prepare_arch_switch(next) \ |
145 | do { \ | ||
145 | flushw_all(); \ | 146 | flushw_all(); \ |
146 | } while (0) | 147 | } while (0) |
147 | 148 | ||
148 | #define finish_arch_switch(rq, prev) \ | ||
149 | do { spin_unlock_irq(&(prev)->switch_lock); \ | ||
150 | } while (0) | ||
151 | |||
152 | #define task_running(rq, p) \ | ||
153 | ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock)) | ||
154 | |||
155 | /* See what happens when you design the chip correctly? | 149 | /* See what happens when you design the chip correctly? |
156 | * | 150 | * |
157 | * We tell gcc we clobber all non-fixed-usage registers except | 151 | * We tell gcc we clobber all non-fixed-usage registers except |
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h index 8effce0da087..9777a9cca88a 100644 --- a/include/asm-sparc64/termios.h +++ b/include/asm-sparc64/termios.h | |||
@@ -100,16 +100,17 @@ struct winsize { | |||
100 | #define user_termio_to_kernel_termios(termios, termio) \ | 100 | #define user_termio_to_kernel_termios(termios, termio) \ |
101 | ({ \ | 101 | ({ \ |
102 | unsigned short tmp; \ | 102 | unsigned short tmp; \ |
103 | get_user(tmp, &(termio)->c_iflag); \ | 103 | int err; \ |
104 | err = get_user(tmp, &(termio)->c_iflag); \ | ||
104 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ | 105 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ |
105 | get_user(tmp, &(termio)->c_oflag); \ | 106 | err |= get_user(tmp, &(termio)->c_oflag); \ |
106 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ | 107 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ |
107 | get_user(tmp, &(termio)->c_cflag); \ | 108 | err |= get_user(tmp, &(termio)->c_cflag); \ |
108 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ | 109 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ |
109 | get_user(tmp, &(termio)->c_lflag); \ | 110 | err |= get_user(tmp, &(termio)->c_lflag); \ |
110 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ | 111 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ |
111 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | 112 | err |= copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ |
112 | 0; \ | 113 | err; \ |
113 | }) | 114 | }) |
114 | 115 | ||
115 | /* | 116 | /* |
@@ -119,53 +120,56 @@ struct winsize { | |||
119 | */ | 120 | */ |
120 | #define kernel_termios_to_user_termio(termio, termios) \ | 121 | #define kernel_termios_to_user_termio(termio, termios) \ |
121 | ({ \ | 122 | ({ \ |
122 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | 123 | int err; \ |
123 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | 124 | err = put_user((termios)->c_iflag, &(termio)->c_iflag); \ |
124 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | 125 | err |= put_user((termios)->c_oflag, &(termio)->c_oflag); \ |
125 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | 126 | err |= put_user((termios)->c_cflag, &(termio)->c_cflag); \ |
126 | put_user((termios)->c_line, &(termio)->c_line); \ | 127 | err |= put_user((termios)->c_lflag, &(termio)->c_lflag); \ |
127 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | 128 | err |= put_user((termios)->c_line, &(termio)->c_line); \ |
129 | err |= copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
128 | if (!((termios)->c_lflag & ICANON)) { \ | 130 | if (!((termios)->c_lflag & ICANON)) { \ |
129 | put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \ | 131 | err |= put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \ |
130 | put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \ | 132 | err |= put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \ |
131 | } \ | 133 | } \ |
132 | 0; \ | 134 | err; \ |
133 | }) | 135 | }) |
134 | 136 | ||
135 | #define user_termios_to_kernel_termios(k, u) \ | 137 | #define user_termios_to_kernel_termios(k, u) \ |
136 | ({ \ | 138 | ({ \ |
137 | get_user((k)->c_iflag, &(u)->c_iflag); \ | 139 | int err; \ |
138 | get_user((k)->c_oflag, &(u)->c_oflag); \ | 140 | err = get_user((k)->c_iflag, &(u)->c_iflag); \ |
139 | get_user((k)->c_cflag, &(u)->c_cflag); \ | 141 | err |= get_user((k)->c_oflag, &(u)->c_oflag); \ |
140 | get_user((k)->c_lflag, &(u)->c_lflag); \ | 142 | err |= get_user((k)->c_cflag, &(u)->c_cflag); \ |
141 | get_user((k)->c_line, &(u)->c_line); \ | 143 | err |= get_user((k)->c_lflag, &(u)->c_lflag); \ |
142 | copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | 144 | err |= get_user((k)->c_line, &(u)->c_line); \ |
145 | err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | ||
143 | if((k)->c_lflag & ICANON) { \ | 146 | if((k)->c_lflag & ICANON) { \ |
144 | get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | 147 | err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ |
145 | get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | 148 | err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ |
146 | } else { \ | 149 | } else { \ |
147 | get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | 150 | err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ |
148 | get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | 151 | err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ |
149 | } \ | 152 | } \ |
150 | 0; \ | 153 | err; \ |
151 | }) | 154 | }) |
152 | 155 | ||
153 | #define kernel_termios_to_user_termios(u, k) \ | 156 | #define kernel_termios_to_user_termios(u, k) \ |
154 | ({ \ | 157 | ({ \ |
155 | put_user((k)->c_iflag, &(u)->c_iflag); \ | 158 | int err; \ |
156 | put_user((k)->c_oflag, &(u)->c_oflag); \ | 159 | err = put_user((k)->c_iflag, &(u)->c_iflag); \ |
157 | put_user((k)->c_cflag, &(u)->c_cflag); \ | 160 | err |= put_user((k)->c_oflag, &(u)->c_oflag); \ |
158 | put_user((k)->c_lflag, &(u)->c_lflag); \ | 161 | err |= put_user((k)->c_cflag, &(u)->c_cflag); \ |
159 | put_user((k)->c_line, &(u)->c_line); \ | 162 | err |= put_user((k)->c_lflag, &(u)->c_lflag); \ |
160 | copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | 163 | err |= put_user((k)->c_line, &(u)->c_line); \ |
164 | err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | ||
161 | if(!((k)->c_lflag & ICANON)) { \ | 165 | if(!((k)->c_lflag & ICANON)) { \ |
162 | put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | 166 | err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ |
163 | put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | 167 | err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ |
164 | } else { \ | 168 | } else { \ |
165 | put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | 169 | err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ |
166 | put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | 170 | err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ |
167 | } \ | 171 | } \ |
168 | 0; \ | 172 | err; \ |
169 | }) | 173 | }) |
170 | 174 | ||
171 | #endif /* __KERNEL__ */ | 175 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h index 517caaba1c87..0cd652956929 100644 --- a/include/asm-sparc64/thread_info.h +++ b/include/asm-sparc64/thread_info.h | |||
@@ -46,7 +46,7 @@ struct thread_info { | |||
46 | unsigned long fault_address; | 46 | unsigned long fault_address; |
47 | struct pt_regs *kregs; | 47 | struct pt_regs *kregs; |
48 | struct exec_domain *exec_domain; | 48 | struct exec_domain *exec_domain; |
49 | int preempt_count; | 49 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
50 | int __pad; | 50 | int __pad; |
51 | 51 | ||
52 | unsigned long *utraps; | 52 | unsigned long *utraps; |
diff --git a/include/asm-um/page.h b/include/asm-um/page.h index 504ea8e486b0..5afee8a8cdf3 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h | |||
@@ -98,7 +98,13 @@ extern unsigned long uml_physmem; | |||
98 | 98 | ||
99 | extern unsigned long to_phys(void *virt); | 99 | extern unsigned long to_phys(void *virt); |
100 | extern void *to_virt(unsigned long phys); | 100 | extern void *to_virt(unsigned long phys); |
101 | #define __pa(virt) to_phys((void *) virt) | 101 | |
102 | /* Cast to unsigned long before casting to void * to avoid a warning from | ||
103 | * mmap_kmem about cutting a long long down to a void *. Not sure that | ||
104 | * casting is the right thing, but 32-bit UML can't have 64-bit virtual | ||
105 | * addresses | ||
106 | */ | ||
107 | #define __pa(virt) to_phys((void *) (unsigned long) virt) | ||
102 | #define __va(phys) to_virt((unsigned long) phys) | 108 | #define __va(phys) to_virt((unsigned long) phys) |
103 | 109 | ||
104 | #define page_to_pfn(page) ((page) - mem_map) | 110 | #define page_to_pfn(page) ((page) - mem_map) |
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index 510e513c7f88..a88040920311 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h | |||
@@ -114,17 +114,9 @@ extern unsigned long end_iomem; | |||
114 | extern unsigned long pg0[1024]; | 114 | extern unsigned long pg0[1024]; |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * BAD_PAGETABLE is used when we need a bogus page-table, while | ||
118 | * BAD_PAGE is used for a bogus page. | ||
119 | * | ||
120 | * ZERO_PAGE is a global shared page that is always zero: used | 117 | * ZERO_PAGE is a global shared page that is always zero: used |
121 | * for zero-mapped memory areas etc.. | 118 | * for zero-mapped memory areas etc.. |
122 | */ | 119 | */ |
123 | extern pte_t __bad_page(void); | ||
124 | extern pte_t * __bad_pagetable(void); | ||
125 | |||
126 | #define BAD_PAGETABLE __bad_pagetable() | ||
127 | #define BAD_PAGE __bad_page() | ||
128 | 120 | ||
129 | #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page) | 121 | #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page) |
130 | 122 | ||
diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h index 04222f35c43e..fe882b9d917e 100644 --- a/include/asm-um/ptrace-i386.h +++ b/include/asm-um/ptrace-i386.h | |||
@@ -32,6 +32,10 @@ | |||
32 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r) | 32 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r) |
33 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) | 33 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) |
34 | 34 | ||
35 | /* Cope with a conditional i386 definition. */ | ||
36 | #undef profile_pc | ||
37 | #define profile_pc(regs) PT_REGS_IP(regs) | ||
38 | |||
35 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | 39 | #define user_mode(r) UPT_IS_USER(&(r)->regs) |
36 | 40 | ||
37 | #endif | 41 | #endif |
diff --git a/include/asm-um/smp.h b/include/asm-um/smp.h index 4412d5d9c26b..d879eba2b52c 100644 --- a/include/asm-um/smp.h +++ b/include/asm-um/smp.h | |||
@@ -8,7 +8,8 @@ | |||
8 | #include "asm/current.h" | 8 | #include "asm/current.h" |
9 | #include "linux/cpumask.h" | 9 | #include "linux/cpumask.h" |
10 | 10 | ||
11 | #define smp_processor_id() (current_thread->cpu) | 11 | #define raw_smp_processor_id() (current_thread->cpu) |
12 | |||
12 | #define cpu_logical_map(n) (n) | 13 | #define cpu_logical_map(n) (n) |
13 | #define cpu_number_map(n) (n) | 14 | #define cpu_number_map(n) (n) |
14 | #define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ | 15 | #define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ |
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h index a10ea155907e..97267f059ef5 100644 --- a/include/asm-um/thread_info.h +++ b/include/asm-um/thread_info.h | |||
@@ -17,7 +17,7 @@ struct thread_info { | |||
17 | struct exec_domain *exec_domain; /* execution domain */ | 17 | struct exec_domain *exec_domain; /* execution domain */ |
18 | unsigned long flags; /* low level flags */ | 18 | unsigned long flags; /* low level flags */ |
19 | __u32 cpu; /* current CPU */ | 19 | __u32 cpu; /* current CPU */ |
20 | __s32 preempt_count; /* 0 => preemptable, | 20 | int preempt_count; /* 0 => preemptable, |
21 | <0 => BUG */ | 21 | <0 => BUG */ |
22 | mm_segment_t addr_limit; /* thread address space: | 22 | mm_segment_t addr_limit; /* thread address space: |
23 | 0-0xBFFFFFFF for user | 23 | 0-0xBFFFFFFF for user |
@@ -41,18 +41,17 @@ struct thread_info { | |||
41 | #define init_thread_info (init_thread_union.thread_info) | 41 | #define init_thread_info (init_thread_union.thread_info) |
42 | #define init_stack (init_thread_union.stack) | 42 | #define init_stack (init_thread_union.stack) |
43 | 43 | ||
44 | #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE) | ||
44 | /* how to get the thread information struct from C */ | 45 | /* how to get the thread information struct from C */ |
45 | static inline struct thread_info *current_thread_info(void) | 46 | static inline struct thread_info *current_thread_info(void) |
46 | { | 47 | { |
47 | struct thread_info *ti; | 48 | struct thread_info *ti; |
48 | unsigned long mask = PAGE_SIZE * | 49 | unsigned long mask = THREAD_SIZE - 1; |
49 | (1 << CONFIG_KERNEL_STACK_ORDER) - 1; | 50 | ti = (struct thread_info *) (((unsigned long) &ti) & ~mask); |
50 | ti = (struct thread_info *) (((unsigned long) &ti) & ~mask); | ||
51 | return ti; | 51 | return ti; |
52 | } | 52 | } |
53 | 53 | ||
54 | /* thread information allocation */ | 54 | /* thread information allocation */ |
55 | #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE) | ||
56 | #define alloc_thread_info(tsk) \ | 55 | #define alloc_thread_info(tsk) \ |
57 | ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL)) | 56 | ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL)) |
58 | #define free_thread_info(ti) kfree(ti) | 57 | #define free_thread_info(ti) kfree(ti) |
@@ -62,7 +61,7 @@ static inline struct thread_info *current_thread_info(void) | |||
62 | 61 | ||
63 | #endif | 62 | #endif |
64 | 63 | ||
65 | #define PREEMPT_ACTIVE 0x4000000 | 64 | #define PREEMPT_ACTIVE 0x10000000 |
66 | 65 | ||
67 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 66 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
68 | #define TIF_SIGPENDING 1 /* signal pending */ | 67 | #define TIF_SIGPENDING 1 /* signal pending */ |
diff --git a/include/asm-v850/thread_info.h b/include/asm-v850/thread_info.h index e2ef44593752..e4cfad94a553 100644 --- a/include/asm-v850/thread_info.h +++ b/include/asm-v850/thread_info.h | |||
@@ -30,7 +30,8 @@ struct thread_info { | |||
30 | struct exec_domain *exec_domain; /* execution domain */ | 30 | struct exec_domain *exec_domain; /* execution domain */ |
31 | unsigned long flags; /* low level flags */ | 31 | unsigned long flags; /* low level flags */ |
32 | int cpu; /* cpu we're on */ | 32 | int cpu; /* cpu we're on */ |
33 | int preempt_count; | 33 | int preempt_count; /* 0 => preemptable, |
34 | <0 => BUG */ | ||
34 | struct restart_block restart_block; | 35 | struct restart_block restart_block; |
35 | }; | 36 | }; |
36 | 37 | ||
diff --git a/include/asm-x86_64/a.out.h b/include/asm-x86_64/a.out.h index 5952914f4121..7255cde06538 100644 --- a/include/asm-x86_64/a.out.h +++ b/include/asm-x86_64/a.out.h | |||
@@ -21,7 +21,7 @@ struct exec | |||
21 | 21 | ||
22 | #ifdef __KERNEL__ | 22 | #ifdef __KERNEL__ |
23 | #include <linux/thread_info.h> | 23 | #include <linux/thread_info.h> |
24 | #define STACK_TOP (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE) | 24 | #define STACK_TOP TASK_SIZE |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #endif /* __A_OUT_GNU_H__ */ | 27 | #endif /* __A_OUT_GNU_H__ */ |
diff --git a/include/asm-x86_64/agp.h b/include/asm-x86_64/agp.h index 0bb9019d58aa..06c52ee9c06b 100644 --- a/include/asm-x86_64/agp.h +++ b/include/asm-x86_64/agp.h | |||
@@ -19,4 +19,14 @@ int unmap_page_from_agp(struct page *page); | |||
19 | worth it. Would need a page for it. */ | 19 | worth it. Would need a page for it. */ |
20 | #define flush_agp_cache() asm volatile("wbinvd":::"memory") | 20 | #define flush_agp_cache() asm volatile("wbinvd":::"memory") |
21 | 21 | ||
22 | /* Convert a physical address to an address suitable for the GART. */ | ||
23 | #define phys_to_gart(x) (x) | ||
24 | #define gart_to_phys(x) (x) | ||
25 | |||
26 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ | ||
27 | #define alloc_gatt_pages(order) \ | ||
28 | ((char *)__get_free_pages(GFP_KERNEL, (order))) | ||
29 | #define free_gatt_pages(table, order) \ | ||
30 | free_pages((unsigned long)(table), (order)) | ||
31 | |||
22 | #endif | 32 | #endif |
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index e4b1017b8b2b..16ec82e16b21 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h | |||
@@ -77,7 +77,7 @@ static inline void ack_APIC_irq(void) | |||
77 | extern int get_maxlvt (void); | 77 | extern int get_maxlvt (void); |
78 | extern void clear_local_APIC (void); | 78 | extern void clear_local_APIC (void); |
79 | extern void connect_bsp_APIC (void); | 79 | extern void connect_bsp_APIC (void); |
80 | extern void disconnect_bsp_APIC (void); | 80 | extern void disconnect_bsp_APIC (int virt_wire_setup); |
81 | extern void disable_local_APIC (void); | 81 | extern void disable_local_APIC (void); |
82 | extern int verify_local_APIC (void); | 82 | extern int verify_local_APIC (void); |
83 | extern void cache_APIC_registers (void); | 83 | extern void cache_APIC_registers (void); |
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h index bfebdb690654..9388062c4f6e 100644 --- a/include/asm-x86_64/apicdef.h +++ b/include/asm-x86_64/apicdef.h | |||
@@ -94,7 +94,7 @@ | |||
94 | #define SET_APIC_DELIVERY_MODE(x,y) (((x)&~0x700)|((y)<<8)) | 94 | #define SET_APIC_DELIVERY_MODE(x,y) (((x)&~0x700)|((y)<<8)) |
95 | #define APIC_MODE_FIXED 0x0 | 95 | #define APIC_MODE_FIXED 0x0 |
96 | #define APIC_MODE_NMI 0x4 | 96 | #define APIC_MODE_NMI 0x4 |
97 | #define APIC_MODE_EXINT 0x7 | 97 | #define APIC_MODE_EXTINT 0x7 |
98 | #define APIC_LVT1 0x360 | 98 | #define APIC_LVT1 0x360 |
99 | #define APIC_LVTERR 0x370 | 99 | #define APIC_LVTERR 0x370 |
100 | #define APIC_TMICT 0x380 | 100 | #define APIC_TMICT 0x380 |
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index 5dd7727c756b..a31bb99be53f 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -411,8 +411,6 @@ static __inline__ int ffs(int x) | |||
411 | /* find last set bit */ | 411 | /* find last set bit */ |
412 | #define fls(x) generic_fls(x) | 412 | #define fls(x) generic_fls(x) |
413 | 413 | ||
414 | #define ARCH_HAS_ATOMIC_UNSIGNED 1 | ||
415 | |||
416 | #endif /* __KERNEL__ */ | 414 | #endif /* __KERNEL__ */ |
417 | 415 | ||
418 | #endif /* _X86_64_BITOPS_H */ | 416 | #endif /* _X86_64_BITOPS_H */ |
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h index bdbf66eab6ee..3d2a666a5dd5 100644 --- a/include/asm-x86_64/bug.h +++ b/include/asm-x86_64/bug.h | |||
@@ -21,6 +21,8 @@ struct bug_frame { | |||
21 | asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ | 21 | asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ |
22 | "i"(__LINE__), "i" (__stringify(__FILE__))) | 22 | "i"(__LINE__), "i" (__stringify(__FILE__))) |
23 | void out_of_line_bug(void); | 23 | void out_of_line_bug(void); |
24 | #else | ||
25 | static inline void out_of_line_bug(void) { } | ||
24 | #endif | 26 | #endif |
25 | 27 | ||
26 | #include <asm-generic/bug.h> | 28 | #include <asm-generic/bug.h> |
diff --git a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h index c0a7717923ed..6efa00fe4e7b 100644 --- a/include/asm-x86_64/ia32.h +++ b/include/asm-x86_64/ia32.h | |||
@@ -94,7 +94,7 @@ typedef struct compat_siginfo{ | |||
94 | 94 | ||
95 | /* POSIX.1b timers */ | 95 | /* POSIX.1b timers */ |
96 | struct { | 96 | struct { |
97 | int _tid; /* timer id */ | 97 | compat_timer_t _tid; /* timer id */ |
98 | int _overrun; /* overrun count */ | 98 | int _overrun; /* overrun count */ |
99 | compat_sigval_t _sigval; /* same as below */ | 99 | compat_sigval_t _sigval; /* same as below */ |
100 | int _sys_private; /* not to be passed to user */ | 100 | int _sys_private; /* not to be passed to user */ |
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h index 94202703fae2..37fc3f149a5a 100644 --- a/include/asm-x86_64/io.h +++ b/include/asm-x86_64/io.h | |||
@@ -124,12 +124,7 @@ extern inline void * phys_to_virt(unsigned long address) | |||
124 | /* | 124 | /* |
125 | * Change "struct page" to physical address. | 125 | * Change "struct page" to physical address. |
126 | */ | 126 | */ |
127 | #ifdef CONFIG_DISCONTIGMEM | ||
128 | #include <asm/mmzone.h> | ||
129 | #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) | 127 | #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) |
130 | #else | ||
131 | #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) | ||
132 | #endif | ||
133 | 128 | ||
134 | #include <asm-generic/iomap.h> | 129 | #include <asm-generic/iomap.h> |
135 | 130 | ||
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index 3af50b3c3b05..eb3b7aa9eb9f 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h | |||
@@ -52,4 +52,9 @@ struct irqaction; | |||
52 | struct pt_regs; | 52 | struct pt_regs; |
53 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | 53 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); |
54 | 54 | ||
55 | #ifdef CONFIG_HOTPLUG_CPU | ||
56 | #include <linux/cpumask.h> | ||
57 | extern void fixup_irqs(cpumask_t map); | ||
58 | #endif | ||
59 | |||
55 | #endif /* _ASM_IRQ_H */ | 60 | #endif /* _ASM_IRQ_H */ |
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h index 6277f75cbb4b..b90341994d80 100644 --- a/include/asm-x86_64/kdebug.h +++ b/include/asm-x86_64/kdebug.h | |||
@@ -14,7 +14,7 @@ struct die_args { | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | /* Note - you should never unregister because that can race with NMIs. | 16 | /* Note - you should never unregister because that can race with NMIs. |
17 | If you really want to do it first unregister - then synchronize_kernel - then free. | 17 | If you really want to do it first unregister - then synchronize_sched - then free. |
18 | */ | 18 | */ |
19 | int register_die_notifier(struct notifier_block *nb); | 19 | int register_die_notifier(struct notifier_block *nb); |
20 | extern struct notifier_block *die_chain; | 20 | extern struct notifier_block *die_chain; |
diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h new file mode 100644 index 000000000000..42d2ff15c592 --- /dev/null +++ b/include/asm-x86_64/kexec.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _X86_64_KEXEC_H | ||
2 | #define _X86_64_KEXEC_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | #include <asm/proto.h> | ||
6 | |||
7 | /* | ||
8 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | ||
9 | * I.e. Maximum page that is mapped directly into kernel memory, | ||
10 | * and kmap is not required. | ||
11 | * | ||
12 | * So far x86_64 is limited to 40 physical address bits. | ||
13 | */ | ||
14 | |||
15 | /* Maximum physical address we can use pages from */ | ||
16 | #define KEXEC_SOURCE_MEMORY_LIMIT (0xFFFFFFFFFFUL) | ||
17 | /* Maximum address we can reach in physical address mode */ | ||
18 | #define KEXEC_DESTINATION_MEMORY_LIMIT (0xFFFFFFFFFFUL) | ||
19 | /* Maximum address we can use for the control pages */ | ||
20 | #define KEXEC_CONTROL_MEMORY_LIMIT (0xFFFFFFFFFFUL) | ||
21 | |||
22 | /* Allocate one page for the pdp and the second for the code */ | ||
23 | #define KEXEC_CONTROL_CODE_SIZE (4096UL + 4096UL) | ||
24 | |||
25 | /* The native architecture */ | ||
26 | #define KEXEC_ARCH KEXEC_ARCH_X86_64 | ||
27 | |||
28 | #define MAX_NOTE_BYTES 1024 | ||
29 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
30 | |||
31 | extern note_buf_t crash_notes[]; | ||
32 | |||
33 | #endif /* _X86_64_KEXEC_H */ | ||
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h index bfea52d516f8..6d6d883fdf6d 100644 --- a/include/asm-x86_64/kprobes.h +++ b/include/asm-x86_64/kprobes.h | |||
@@ -38,6 +38,9 @@ typedef u8 kprobe_opcode_t; | |||
38 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) | 38 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) |
39 | 39 | ||
40 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 40 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
41 | #define ARCH_SUPPORTS_KRETPROBES | ||
42 | |||
43 | void kretprobe_trampoline(void); | ||
41 | 44 | ||
42 | /* Architecture specific copy of original instruction*/ | 45 | /* Architecture specific copy of original instruction*/ |
43 | struct arch_specific_insn { | 46 | struct arch_specific_insn { |
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h index d95b7c240831..768413751b34 100644 --- a/include/asm-x86_64/mmzone.h +++ b/include/asm-x86_64/mmzone.h | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | 8 | ||
9 | #ifdef CONFIG_DISCONTIGMEM | 9 | #ifdef CONFIG_NUMA |
10 | 10 | ||
11 | #define VIRTUAL_BUG_ON(x) | 11 | #define VIRTUAL_BUG_ON(x) |
12 | 12 | ||
@@ -30,27 +30,23 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
30 | return nid; | 30 | return nid; |
31 | } | 31 | } |
32 | 32 | ||
33 | #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) | ||
34 | |||
35 | #define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) | ||
36 | #define NODE_DATA(nid) (node_data[nid]) | 33 | #define NODE_DATA(nid) (node_data[nid]) |
37 | 34 | ||
38 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
39 | |||
40 | #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) | ||
41 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 35 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
42 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ | 36 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ |
43 | NODE_DATA(nid)->node_spanned_pages) | 37 | NODE_DATA(nid)->node_spanned_pages) |
44 | 38 | ||
45 | #define local_mapnr(kvaddr) \ | 39 | #ifdef CONFIG_DISCONTIGMEM |
46 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) ) | 40 | |
41 | #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) | ||
42 | #define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) | ||
47 | 43 | ||
48 | /* AK: this currently doesn't deal with invalid addresses. We'll see | 44 | /* AK: this currently doesn't deal with invalid addresses. We'll see |
49 | if the 2.5 kernel doesn't pass them | 45 | if the 2.5 kernel doesn't pass them |
50 | (2.4 used to). */ | 46 | (2.4 used to). */ |
51 | #define pfn_to_page(pfn) ({ \ | 47 | #define pfn_to_page(pfn) ({ \ |
52 | int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); \ | 48 | int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); \ |
53 | ((pfn) - node_start_pfn(nid)) + node_mem_map(nid); \ | 49 | ((pfn) - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map; \ |
54 | }) | 50 | }) |
55 | 51 | ||
56 | #define page_to_pfn(page) \ | 52 | #define page_to_pfn(page) \ |
@@ -60,4 +56,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
60 | ({ u8 nid__ = pfn_to_nid(pfn); \ | 56 | ({ u8 nid__ = pfn_to_nid(pfn); \ |
61 | nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) | 57 | nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) |
62 | #endif | 58 | #endif |
59 | |||
60 | #define local_mapnr(kvaddr) \ | ||
61 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) ) | ||
62 | #endif | ||
63 | #endif | 63 | #endif |
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index 513e52c71821..bc700232728d 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h | |||
@@ -57,11 +57,6 @@ | |||
57 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ | 57 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ |
58 | } while(0) | 58 | } while(0) |
59 | 59 | ||
60 | #define rdpmc(counter,low,high) \ | ||
61 | __asm__ __volatile__("rdpmc" \ | ||
62 | : "=a" (low), "=d" (high) \ | ||
63 | : "c" (counter)) | ||
64 | |||
65 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) | 60 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) |
66 | 61 | ||
67 | #define rdpmc(counter,low,high) \ | 62 | #define rdpmc(counter,low,high) \ |
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index f43048035a03..431318764af6 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | 28 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) |
29 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 29 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
30 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 30 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
31 | #define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE | ||
31 | 32 | ||
32 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
33 | #ifndef __ASSEMBLY__ | 34 | #ifndef __ASSEMBLY__ |
@@ -63,12 +64,14 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
63 | #define __pgd(x) ((pgd_t) { (x) } ) | 64 | #define __pgd(x) ((pgd_t) { (x) } ) |
64 | #define __pgprot(x) ((pgprot_t) { (x) } ) | 65 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
65 | 66 | ||
66 | #define __START_KERNEL 0xffffffff80100000UL | 67 | #define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START) |
68 | #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) | ||
67 | #define __START_KERNEL_map 0xffffffff80000000UL | 69 | #define __START_KERNEL_map 0xffffffff80000000UL |
68 | #define __PAGE_OFFSET 0xffff810000000000UL | 70 | #define __PAGE_OFFSET 0xffff810000000000UL |
69 | 71 | ||
70 | #else | 72 | #else |
71 | #define __START_KERNEL 0xffffffff80100000 | 73 | #define __PHYSICAL_START CONFIG_PHYSICAL_START |
74 | #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) | ||
72 | #define __START_KERNEL_map 0xffffffff80000000 | 75 | #define __START_KERNEL_map 0xffffffff80000000 |
73 | #define __PAGE_OFFSET 0xffff810000000000 | 76 | #define __PAGE_OFFSET 0xffff810000000000 |
74 | #endif /* !__ASSEMBLY__ */ | 77 | #endif /* !__ASSEMBLY__ */ |
@@ -118,7 +121,9 @@ extern __inline__ int get_order(unsigned long size) | |||
118 | __pa(v); }) | 121 | __pa(v); }) |
119 | 122 | ||
120 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | 123 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
121 | #ifndef CONFIG_DISCONTIGMEM | 124 | #define __boot_va(x) __va(x) |
125 | #define __boot_pa(x) __pa(x) | ||
126 | #ifdef CONFIG_FLATMEM | ||
122 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 127 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
123 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 128 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
124 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 129 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
diff --git a/include/asm-x86_64/param.h b/include/asm-x86_64/param.h index b707f0568c9e..40b11937180d 100644 --- a/include/asm-x86_64/param.h +++ b/include/asm-x86_64/param.h | |||
@@ -1,9 +1,11 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
1 | #ifndef _ASMx86_64_PARAM_H | 3 | #ifndef _ASMx86_64_PARAM_H |
2 | #define _ASMx86_64_PARAM_H | 4 | #define _ASMx86_64_PARAM_H |
3 | 5 | ||
4 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
5 | # define HZ 1000 /* Internal kernel timer frequency */ | 7 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ |
6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks */ | 8 | # define USER_HZ 100 /* .. some user interfaces are in "ticks */ |
7 | #define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | 9 | #define CLOCKS_PER_SEC (USER_HZ) /* like times() */ |
8 | #endif | 10 | #endif |
9 | 11 | ||
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h index 415d73f3c8ef..9c71855736fb 100644 --- a/include/asm-x86_64/percpu.h +++ b/include/asm-x86_64/percpu.h | |||
@@ -39,7 +39,7 @@ extern void setup_per_cpu_areas(void); | |||
39 | #define DEFINE_PER_CPU(type, name) \ | 39 | #define DEFINE_PER_CPU(type, name) \ |
40 | __typeof__(type) per_cpu__##name | 40 | __typeof__(type) per_cpu__##name |
41 | 41 | ||
42 | #define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var)) | 42 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) |
43 | #define __get_cpu_var(var) per_cpu__##var | 43 | #define __get_cpu_var(var) per_cpu__##var |
44 | 44 | ||
45 | #endif /* SMP */ | 45 | #endif /* SMP */ |
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index db2a0efbf573..4eec176c3c39 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -253,6 +253,7 @@ extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; | |||
253 | extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 253 | extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
254 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 254 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
255 | 255 | ||
256 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) | ||
256 | extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } | 257 | extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } |
257 | extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } | 258 | extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } |
258 | extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } | 259 | extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } |
@@ -263,6 +264,7 @@ extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _ | |||
263 | extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 264 | extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
264 | extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 265 | extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
265 | extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } | 266 | extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } |
267 | extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; } | ||
266 | 268 | ||
267 | struct vm_area_struct; | 269 | struct vm_area_struct; |
268 | 270 | ||
@@ -290,7 +292,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
290 | */ | 292 | */ |
291 | #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) | 293 | #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) |
292 | 294 | ||
293 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) | ||
294 | static inline int pmd_large(pmd_t pte) { | 295 | static inline int pmd_large(pmd_t pte) { |
295 | return (pmd_val(pte) & __LARGE_PTE) == __LARGE_PTE; | 296 | return (pmd_val(pte) & __LARGE_PTE) == __LARGE_PTE; |
296 | } | 297 | } |
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index d641b19f6da5..106f666517bb 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -160,16 +160,17 @@ static inline void clear_in_cr4 (unsigned long mask) | |||
160 | /* | 160 | /* |
161 | * User space process size. 47bits minus one guard page. | 161 | * User space process size. 47bits minus one guard page. |
162 | */ | 162 | */ |
163 | #define TASK_SIZE (0x800000000000UL - 4096) | 163 | #define TASK_SIZE64 (0x800000000000UL - 4096) |
164 | 164 | ||
165 | /* This decides where the kernel will search for a free chunk of vm | 165 | /* This decides where the kernel will search for a free chunk of vm |
166 | * space during mmap's. | 166 | * space during mmap's. |
167 | */ | 167 | */ |
168 | #define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000) | 168 | #define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000) |
169 | #define TASK_UNMAPPED_32 PAGE_ALIGN(IA32_PAGE_OFFSET/3) | 169 | |
170 | #define TASK_UNMAPPED_64 PAGE_ALIGN(TASK_SIZE/3) | 170 | #define TASK_SIZE (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE64) |
171 | #define TASK_UNMAPPED_BASE \ | 171 | #define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? IA32_PAGE_OFFSET : TASK_SIZE64) |
172 | (test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64) | 172 | |
173 | #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE/3) | ||
173 | 174 | ||
174 | /* | 175 | /* |
175 | * Size of io_bitmap. | 176 | * Size of io_bitmap. |
@@ -279,6 +280,14 @@ struct thread_struct { | |||
279 | set_fs(USER_DS); \ | 280 | set_fs(USER_DS); \ |
280 | } while(0) | 281 | } while(0) |
281 | 282 | ||
283 | #define get_debugreg(var, register) \ | ||
284 | __asm__("movq %%db" #register ", %0" \ | ||
285 | :"=r" (var)) | ||
286 | #define set_debugreg(value, register) \ | ||
287 | __asm__("movq %0,%%db" #register \ | ||
288 | : /* no output */ \ | ||
289 | :"r" (value)) | ||
290 | |||
282 | struct task_struct; | 291 | struct task_struct; |
283 | struct mm_struct; | 292 | struct mm_struct; |
284 | 293 | ||
diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h index 5bbc8d3141c8..ca6f15ff61d4 100644 --- a/include/asm-x86_64/ptrace.h +++ b/include/asm-x86_64/ptrace.h | |||
@@ -82,6 +82,7 @@ struct pt_regs { | |||
82 | 82 | ||
83 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 83 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
84 | #define user_mode(regs) (!!((regs)->cs & 3)) | 84 | #define user_mode(regs) (!!((regs)->cs & 3)) |
85 | #define user_mode_vm(regs) user_mode(regs) | ||
85 | #define instruction_pointer(regs) ((regs)->rip) | 86 | #define instruction_pointer(regs) ((regs)->rip) |
86 | extern unsigned long profile_pc(struct pt_regs *regs); | 87 | extern unsigned long profile_pc(struct pt_regs *regs); |
87 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); | 88 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); |
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index 96844fecbde8..aeb1b73e21e1 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
@@ -43,6 +43,8 @@ extern cpumask_t cpu_callout_map; | |||
43 | extern void smp_alloc_memory(void); | 43 | extern void smp_alloc_memory(void); |
44 | extern volatile unsigned long smp_invalidate_needed; | 44 | extern volatile unsigned long smp_invalidate_needed; |
45 | extern int pic_mode; | 45 | extern int pic_mode; |
46 | extern void lock_ipi_call_lock(void); | ||
47 | extern void unlock_ipi_call_lock(void); | ||
46 | extern int smp_num_siblings; | 48 | extern int smp_num_siblings; |
47 | extern void smp_flush_tlb(void); | 49 | extern void smp_flush_tlb(void); |
48 | extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); | 50 | extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); |
@@ -68,7 +70,7 @@ static inline int num_booting_cpus(void) | |||
68 | return cpus_weight(cpu_callout_map); | 70 | return cpus_weight(cpu_callout_map); |
69 | } | 71 | } |
70 | 72 | ||
71 | #define __smp_processor_id() read_pda(cpunumber) | 73 | #define raw_smp_processor_id() read_pda(cpunumber) |
72 | 74 | ||
73 | extern __inline int hard_smp_processor_id(void) | 75 | extern __inline int hard_smp_processor_id(void) |
74 | { | 76 | { |
@@ -77,6 +79,8 @@ extern __inline int hard_smp_processor_id(void) | |||
77 | } | 79 | } |
78 | 80 | ||
79 | extern int safe_smp_processor_id(void); | 81 | extern int safe_smp_processor_id(void); |
82 | extern int __cpu_disable(void); | ||
83 | extern void __cpu_die(unsigned int cpu); | ||
80 | 84 | ||
81 | #endif /* !ASSEMBLY */ | 85 | #endif /* !ASSEMBLY */ |
82 | 86 | ||
diff --git a/include/asm-x86_64/sparsemem.h b/include/asm-x86_64/sparsemem.h new file mode 100644 index 000000000000..dabb16714a71 --- /dev/null +++ b/include/asm-x86_64/sparsemem.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _ASM_X86_64_SPARSEMEM_H | ||
2 | #define _ASM_X86_64_SPARSEMEM_H 1 | ||
3 | |||
4 | #ifdef CONFIG_SPARSEMEM | ||
5 | |||
6 | /* | ||
7 | * generic non-linear memory support: | ||
8 | * | ||
9 | * 1) we will not split memory into more chunks than will fit into the flags | ||
10 | * field of the struct page | ||
11 | * | ||
12 | * SECTION_SIZE_BITS 2^n: size of each section | ||
13 | * MAX_PHYSADDR_BITS 2^n: max size of physical address space | ||
14 | * MAX_PHYSMEM_BITS 2^n: how much memory we can have in that space | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */ | ||
19 | #define MAX_PHYSADDR_BITS 40 | ||
20 | #define MAX_PHYSMEM_BITS 40 | ||
21 | |||
22 | extern int early_pfn_to_nid(unsigned long pfn); | ||
23 | |||
24 | #endif /* CONFIG_SPARSEMEM */ | ||
25 | |||
26 | #endif /* _ASM_X86_64_SPARSEMEM_H */ | ||
diff --git a/include/asm-x86_64/suspend.h b/include/asm-x86_64/suspend.h index ec745807feae..bb9f40597d09 100644 --- a/include/asm-x86_64/suspend.h +++ b/include/asm-x86_64/suspend.h | |||
@@ -16,7 +16,7 @@ arch_prepare_suspend(void) | |||
16 | struct saved_context { | 16 | struct saved_context { |
17 | u16 ds, es, fs, gs, ss; | 17 | u16 ds, es, fs, gs, ss; |
18 | unsigned long gs_base, gs_kernel_base, fs_base; | 18 | unsigned long gs_base, gs_kernel_base, fs_base; |
19 | unsigned long cr0, cr2, cr3, cr4; | 19 | unsigned long cr0, cr2, cr3, cr4, cr8; |
20 | u16 gdt_pad; | 20 | u16 gdt_pad; |
21 | u16 gdt_limit; | 21 | u16 gdt_limit; |
22 | unsigned long gdt_base; | 22 | unsigned long gdt_base; |
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index f4b3b249639c..08eb6e4f3737 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h | |||
@@ -29,7 +29,7 @@ struct thread_info { | |||
29 | __u32 flags; /* low level flags */ | 29 | __u32 flags; /* low level flags */ |
30 | __u32 status; /* thread synchronous flags */ | 30 | __u32 status; /* thread synchronous flags */ |
31 | __u32 cpu; /* current CPU */ | 31 | __u32 cpu; /* current CPU */ |
32 | int preempt_count; | 32 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
33 | 33 | ||
34 | mm_segment_t addr_limit; | 34 | mm_segment_t addr_limit; |
35 | struct restart_block restart_block; | 35 | struct restart_block restart_block; |
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h index 34f31a18f90b..24ecf6a637cb 100644 --- a/include/asm-x86_64/timex.h +++ b/include/asm-x86_64/timex.h | |||
@@ -26,6 +26,9 @@ static inline cycles_t get_cycles (void) | |||
26 | 26 | ||
27 | extern unsigned int cpu_khz; | 27 | extern unsigned int cpu_khz; |
28 | 28 | ||
29 | extern int read_current_timer(unsigned long *timer_value); | ||
30 | #define ARCH_HAS_READ_CURRENT_TIMER 1 | ||
31 | |||
29 | extern struct vxtime_data vxtime; | 32 | extern struct vxtime_data vxtime; |
30 | 33 | ||
31 | #endif | 34 | #endif |
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h index 67f24e0ea819..c1bc3fad482e 100644 --- a/include/asm-x86_64/topology.h +++ b/include/asm-x86_64/topology.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | #ifdef CONFIG_DISCONTIGMEM | 6 | #ifdef CONFIG_NUMA |
7 | 7 | ||
8 | #include <asm/mpspec.h> | 8 | #include <asm/mpspec.h> |
9 | #include <asm/bitops.h> | 9 | #include <asm/bitops.h> |
@@ -13,8 +13,8 @@ | |||
13 | extern cpumask_t cpu_online_map; | 13 | extern cpumask_t cpu_online_map; |
14 | 14 | ||
15 | extern unsigned char cpu_to_node[]; | 15 | extern unsigned char cpu_to_node[]; |
16 | extern unsigned char pci_bus_to_node[]; | ||
16 | extern cpumask_t node_to_cpumask[]; | 17 | extern cpumask_t node_to_cpumask[]; |
17 | extern cpumask_t pci_bus_to_cpumask[]; | ||
18 | 18 | ||
19 | #ifdef CONFIG_ACPI_NUMA | 19 | #ifdef CONFIG_ACPI_NUMA |
20 | extern int __node_distance(int, int); | 20 | extern int __node_distance(int, int); |
@@ -26,18 +26,9 @@ extern int __node_distance(int, int); | |||
26 | #define parent_node(node) (node) | 26 | #define parent_node(node) (node) |
27 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) | 27 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) |
28 | #define node_to_cpumask(node) (node_to_cpumask[node]) | 28 | #define node_to_cpumask(node) (node_to_cpumask[node]) |
29 | #define pcibus_to_node(bus) pci_bus_to_node[(bus)->number] | ||
30 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); | ||
29 | 31 | ||
30 | static inline cpumask_t __pcibus_to_cpumask(int bus) | ||
31 | { | ||
32 | cpumask_t busmask = pci_bus_to_cpumask[bus]; | ||
33 | cpumask_t online = cpu_online_map; | ||
34 | cpumask_t res; | ||
35 | cpus_and(res, busmask, online); | ||
36 | return res; | ||
37 | } | ||
38 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number) | ||
39 | |||
40 | #ifdef CONFIG_NUMA | ||
41 | /* sched_domains SD_NODE_INIT for x86_64 machines */ | 32 | /* sched_domains SD_NODE_INIT for x86_64 machines */ |
42 | #define SD_NODE_INIT (struct sched_domain) { \ | 33 | #define SD_NODE_INIT (struct sched_domain) { \ |
43 | .span = CPU_MASK_NONE, \ | 34 | .span = CPU_MASK_NONE, \ |
@@ -48,18 +39,21 @@ static inline cpumask_t __pcibus_to_cpumask(int bus) | |||
48 | .busy_factor = 32, \ | 39 | .busy_factor = 32, \ |
49 | .imbalance_pct = 125, \ | 40 | .imbalance_pct = 125, \ |
50 | .cache_hot_time = (10*1000000), \ | 41 | .cache_hot_time = (10*1000000), \ |
51 | .cache_nice_tries = 1, \ | 42 | .cache_nice_tries = 2, \ |
43 | .busy_idx = 3, \ | ||
44 | .idle_idx = 2, \ | ||
45 | .newidle_idx = 0, \ | ||
46 | .wake_idx = 1, \ | ||
47 | .forkexec_idx = 1, \ | ||
52 | .per_cpu_gain = 100, \ | 48 | .per_cpu_gain = 100, \ |
53 | .flags = SD_LOAD_BALANCE \ | 49 | .flags = SD_LOAD_BALANCE \ |
54 | | SD_BALANCE_NEWIDLE \ | 50 | | SD_BALANCE_FORK \ |
55 | | SD_BALANCE_EXEC \ | 51 | | SD_BALANCE_EXEC \ |
56 | | SD_WAKE_IDLE \ | ||
57 | | SD_WAKE_BALANCE, \ | 52 | | SD_WAKE_BALANCE, \ |
58 | .last_balance = jiffies, \ | 53 | .last_balance = jiffies, \ |
59 | .balance_interval = 1, \ | 54 | .balance_interval = 1, \ |
60 | .nr_balance_failed = 0, \ | 55 | .nr_balance_failed = 0, \ |
61 | } | 56 | } |
62 | #endif | ||
63 | 57 | ||
64 | #endif | 58 | #endif |
65 | 59 | ||
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 3c9af6fd4332..d767adcbf0ff 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h | |||
@@ -552,7 +552,7 @@ __SYSCALL(__NR_mq_notify, sys_mq_notify) | |||
552 | #define __NR_mq_getsetattr 245 | 552 | #define __NR_mq_getsetattr 245 |
553 | __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) | 553 | __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) |
554 | #define __NR_kexec_load 246 | 554 | #define __NR_kexec_load 246 |
555 | __SYSCALL(__NR_kexec_load, sys_ni_syscall) | 555 | __SYSCALL(__NR_kexec_load, sys_kexec_load) |
556 | #define __NR_waitid 247 | 556 | #define __NR_waitid 247 |
557 | __SYSCALL(__NR_waitid, sys_waitid) | 557 | __SYSCALL(__NR_waitid, sys_waitid) |
558 | #define __NR_add_key 248 | 558 | #define __NR_add_key 248 |
diff --git a/include/asm-xtensa/a.out.h b/include/asm-xtensa/a.out.h new file mode 100644 index 000000000000..3be701dfe098 --- /dev/null +++ b/include/asm-xtensa/a.out.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/addrspace.h | ||
3 | * | ||
4 | * Dummy a.out file. Xtensa does not support the a.out format, but the kernel | ||
5 | * seems to depend on it. | ||
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 | * | ||
11 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
12 | */ | ||
13 | |||
14 | #ifndef _XTENSA_A_OUT_H | ||
15 | #define _XTENSA_A_OUT_H | ||
16 | |||
17 | /* Note: the kernel needs the a.out definitions, even if only ELF is used. */ | ||
18 | |||
19 | #define STACK_TOP TASK_SIZE | ||
20 | |||
21 | struct exec | ||
22 | { | ||
23 | unsigned long a_info; | ||
24 | unsigned a_text; | ||
25 | unsigned a_data; | ||
26 | unsigned a_bss; | ||
27 | unsigned a_syms; | ||
28 | unsigned a_entry; | ||
29 | unsigned a_trsize; | ||
30 | unsigned a_drsize; | ||
31 | }; | ||
32 | |||
33 | #endif /* _XTENSA_A_OUT_H */ | ||
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h new file mode 100644 index 000000000000..d72bcb32ba4f --- /dev/null +++ b/include/asm-xtensa/atomic.h | |||
@@ -0,0 +1,272 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/atomic.h | ||
3 | * | ||
4 | * Atomic operations that C can't guarantee us. Useful for resource counting.. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_ATOMIC_H | ||
14 | #define _XTENSA_ATOMIC_H | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/stringify.h> | ||
18 | |||
19 | typedef struct { volatile int counter; } atomic_t; | ||
20 | |||
21 | #ifdef __KERNEL__ | ||
22 | #include <asm/processor.h> | ||
23 | #include <asm/system.h> | ||
24 | |||
25 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | ||
26 | |||
27 | /* | ||
28 | * This Xtensa implementation assumes that the right mechanism | ||
29 | * for exclusion is for locking interrupts to level 1. | ||
30 | * | ||
31 | * Locking interrupts looks like this: | ||
32 | * | ||
33 | * rsil a15, 1 | ||
34 | * <code> | ||
35 | * wsr a15, PS | ||
36 | * rsync | ||
37 | * | ||
38 | * Note that a15 is used here because the register allocation | ||
39 | * done by the compiler is not guaranteed and a window overflow | ||
40 | * may not occur between the rsil and wsr instructions. By using | ||
41 | * a15 in the rsil, the machine is guaranteed to be in a state | ||
42 | * where no register reference will cause an overflow. | ||
43 | */ | ||
44 | |||
45 | /** | ||
46 | * atomic_read - read atomic variable | ||
47 | * @v: pointer of type atomic_t | ||
48 | * | ||
49 | * Atomically reads the value of @v. | ||
50 | */ | ||
51 | #define atomic_read(v) ((v)->counter) | ||
52 | |||
53 | /** | ||
54 | * atomic_set - set atomic variable | ||
55 | * @v: pointer of type atomic_t | ||
56 | * @i: required value | ||
57 | * | ||
58 | * Atomically sets the value of @v to @i. | ||
59 | */ | ||
60 | #define atomic_set(v,i) ((v)->counter = (i)) | ||
61 | |||
62 | /** | ||
63 | * atomic_add - add integer to atomic variable | ||
64 | * @i: integer value to add | ||
65 | * @v: pointer of type atomic_t | ||
66 | * | ||
67 | * Atomically adds @i to @v. | ||
68 | */ | ||
69 | extern __inline__ void atomic_add(int i, atomic_t * v) | ||
70 | { | ||
71 | unsigned int vval; | ||
72 | |||
73 | __asm__ __volatile__( | ||
74 | "rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
75 | "l32i %0, %2, 0 \n\t" | ||
76 | "add %0, %0, %1 \n\t" | ||
77 | "s32i %0, %2, 0 \n\t" | ||
78 | "wsr a15, "__stringify(PS)" \n\t" | ||
79 | "rsync \n" | ||
80 | : "=&a" (vval) | ||
81 | : "a" (i), "a" (v) | ||
82 | : "a15", "memory" | ||
83 | ); | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * atomic_sub - subtract the atomic variable | ||
88 | * @i: integer value to subtract | ||
89 | * @v: pointer of type atomic_t | ||
90 | * | ||
91 | * Atomically subtracts @i from @v. | ||
92 | */ | ||
93 | extern __inline__ void atomic_sub(int i, atomic_t *v) | ||
94 | { | ||
95 | unsigned int vval; | ||
96 | |||
97 | __asm__ __volatile__( | ||
98 | "rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
99 | "l32i %0, %2, 0 \n\t" | ||
100 | "sub %0, %0, %1 \n\t" | ||
101 | "s32i %0, %2, 0 \n\t" | ||
102 | "wsr a15, "__stringify(PS)" \n\t" | ||
103 | "rsync \n" | ||
104 | : "=&a" (vval) | ||
105 | : "a" (i), "a" (v) | ||
106 | : "a15", "memory" | ||
107 | ); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * We use atomic_{add|sub}_return to define other functions. | ||
112 | */ | ||
113 | |||
114 | extern __inline__ int atomic_add_return(int i, atomic_t * v) | ||
115 | { | ||
116 | unsigned int vval; | ||
117 | |||
118 | __asm__ __volatile__( | ||
119 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
120 | "l32i %0, %2, 0 \n\t" | ||
121 | "add %0, %0, %1 \n\t" | ||
122 | "s32i %0, %2, 0 \n\t" | ||
123 | "wsr a15, "__stringify(PS)" \n\t" | ||
124 | "rsync \n" | ||
125 | : "=&a" (vval) | ||
126 | : "a" (i), "a" (v) | ||
127 | : "a15", "memory" | ||
128 | ); | ||
129 | |||
130 | return vval; | ||
131 | } | ||
132 | |||
133 | extern __inline__ int atomic_sub_return(int i, atomic_t * v) | ||
134 | { | ||
135 | unsigned int vval; | ||
136 | |||
137 | __asm__ __volatile__( | ||
138 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
139 | "l32i %0, %2, 0 \n\t" | ||
140 | "sub %0, %0, %1 \n\t" | ||
141 | "s32i %0, %2, 0 \n\t" | ||
142 | "wsr a15, "__stringify(PS)" \n\t" | ||
143 | "rsync \n" | ||
144 | : "=&a" (vval) | ||
145 | : "a" (i), "a" (v) | ||
146 | : "a15", "memory" | ||
147 | ); | ||
148 | |||
149 | return vval; | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * atomic_sub_and_test - subtract value from variable and test result | ||
154 | * @i: integer value to subtract | ||
155 | * @v: pointer of type atomic_t | ||
156 | * | ||
157 | * Atomically subtracts @i from @v and returns | ||
158 | * true if the result is zero, or false for all | ||
159 | * other cases. | ||
160 | */ | ||
161 | #define atomic_sub_and_test(i,v) (atomic_sub_return((i),(v)) == 0) | ||
162 | |||
163 | /** | ||
164 | * atomic_inc - increment atomic variable | ||
165 | * @v: pointer of type atomic_t | ||
166 | * | ||
167 | * Atomically increments @v by 1. | ||
168 | */ | ||
169 | #define atomic_inc(v) atomic_add(1,(v)) | ||
170 | |||
171 | /** | ||
172 | * atomic_inc - increment atomic variable | ||
173 | * @v: pointer of type atomic_t | ||
174 | * | ||
175 | * Atomically increments @v by 1. | ||
176 | */ | ||
177 | #define atomic_inc_return(v) atomic_add_return(1,(v)) | ||
178 | |||
179 | /** | ||
180 | * atomic_dec - decrement atomic variable | ||
181 | * @v: pointer of type atomic_t | ||
182 | * | ||
183 | * Atomically decrements @v by 1. | ||
184 | */ | ||
185 | #define atomic_dec(v) atomic_sub(1,(v)) | ||
186 | |||
187 | /** | ||
188 | * atomic_dec_return - decrement atomic variable | ||
189 | * @v: pointer of type atomic_t | ||
190 | * | ||
191 | * Atomically decrements @v by 1. | ||
192 | */ | ||
193 | #define atomic_dec_return(v) atomic_sub_return(1,(v)) | ||
194 | |||
195 | /** | ||
196 | * atomic_dec_and_test - decrement and test | ||
197 | * @v: pointer of type atomic_t | ||
198 | * | ||
199 | * Atomically decrements @v by 1 and | ||
200 | * returns true if the result is 0, or false for all other | ||
201 | * cases. | ||
202 | */ | ||
203 | #define atomic_dec_and_test(v) (atomic_sub_return(1,(v)) == 0) | ||
204 | |||
205 | /** | ||
206 | * atomic_inc_and_test - increment and test | ||
207 | * @v: pointer of type atomic_t | ||
208 | * | ||
209 | * Atomically increments @v by 1 | ||
210 | * and returns true if the result is zero, or false for all | ||
211 | * other cases. | ||
212 | */ | ||
213 | #define atomic_inc_and_test(v) (atomic_add_return(1,(v)) == 0) | ||
214 | |||
215 | /** | ||
216 | * atomic_add_negative - add and test if negative | ||
217 | * @v: pointer of type atomic_t | ||
218 | * @i: integer value to add | ||
219 | * | ||
220 | * Atomically adds @i to @v and returns true | ||
221 | * if the result is negative, or false when | ||
222 | * result is greater than or equal to zero. | ||
223 | */ | ||
224 | #define atomic_add_negative(i,v) (atomic_add_return((i),(v)) < 0) | ||
225 | |||
226 | |||
227 | extern __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) | ||
228 | { | ||
229 | unsigned int all_f = -1; | ||
230 | unsigned int vval; | ||
231 | |||
232 | __asm__ __volatile__( | ||
233 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
234 | "l32i %0, %2, 0 \n\t" | ||
235 | "xor %1, %4, %3 \n\t" | ||
236 | "and %0, %0, %4 \n\t" | ||
237 | "s32i %0, %2, 0 \n\t" | ||
238 | "wsr a15, "__stringify(PS)" \n\t" | ||
239 | "rsync \n" | ||
240 | : "=&a" (vval), "=a" (mask) | ||
241 | : "a" (v), "a" (all_f), "1" (mask) | ||
242 | : "a15", "memory" | ||
243 | ); | ||
244 | } | ||
245 | |||
246 | extern __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
247 | { | ||
248 | unsigned int vval; | ||
249 | |||
250 | __asm__ __volatile__( | ||
251 | "rsil a15,"__stringify(LOCKLEVEL)"\n\t" | ||
252 | "l32i %0, %2, 0 \n\t" | ||
253 | "or %0, %0, %1 \n\t" | ||
254 | "s32i %0, %2, 0 \n\t" | ||
255 | "wsr a15, "__stringify(PS)" \n\t" | ||
256 | "rsync \n" | ||
257 | : "=&a" (vval) | ||
258 | : "a" (mask), "a" (v) | ||
259 | : "a15", "memory" | ||
260 | ); | ||
261 | } | ||
262 | |||
263 | /* Atomic operations are already serializing */ | ||
264 | #define smp_mb__before_atomic_dec() barrier() | ||
265 | #define smp_mb__after_atomic_dec() barrier() | ||
266 | #define smp_mb__before_atomic_inc() barrier() | ||
267 | #define smp_mb__after_atomic_inc() barrier() | ||
268 | |||
269 | #endif /* __KERNEL__ */ | ||
270 | |||
271 | #endif /* _XTENSA_ATOMIC_H */ | ||
272 | |||
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h new file mode 100644 index 000000000000..d395ef226c32 --- /dev/null +++ b/include/asm-xtensa/bitops.h | |||
@@ -0,0 +1,446 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bitops.h | ||
3 | * | ||
4 | * Atomic operations that C can't guarantee us.Useful for resource counting etc. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_BITOPS_H | ||
14 | #define _XTENSA_BITOPS_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <asm/processor.h> | ||
19 | #include <asm/byteorder.h> | ||
20 | #include <asm/system.h> | ||
21 | |||
22 | #ifdef CONFIG_SMP | ||
23 | # error SMP not supported on this architecture | ||
24 | #endif | ||
25 | |||
26 | static __inline__ void set_bit(int nr, volatile void * addr) | ||
27 | { | ||
28 | unsigned long mask = 1 << (nr & 0x1f); | ||
29 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
30 | unsigned long flags; | ||
31 | |||
32 | local_irq_save(flags); | ||
33 | *a |= mask; | ||
34 | local_irq_restore(flags); | ||
35 | } | ||
36 | |||
37 | static __inline__ void __set_bit(int nr, volatile unsigned long * addr) | ||
38 | { | ||
39 | unsigned long mask = 1 << (nr & 0x1f); | ||
40 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
41 | |||
42 | *a |= mask; | ||
43 | } | ||
44 | |||
45 | static __inline__ void clear_bit(int nr, volatile void * addr) | ||
46 | { | ||
47 | unsigned long mask = 1 << (nr & 0x1f); | ||
48 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
49 | unsigned long flags; | ||
50 | |||
51 | local_irq_save(flags); | ||
52 | *a &= ~mask; | ||
53 | local_irq_restore(flags); | ||
54 | } | ||
55 | |||
56 | static __inline__ void __clear_bit(int nr, volatile unsigned long *addr) | ||
57 | { | ||
58 | unsigned long mask = 1 << (nr & 0x1f); | ||
59 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
60 | |||
61 | *a &= ~mask; | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * clear_bit() doesn't provide any barrier for the compiler. | ||
66 | */ | ||
67 | |||
68 | #define smp_mb__before_clear_bit() barrier() | ||
69 | #define smp_mb__after_clear_bit() barrier() | ||
70 | |||
71 | static __inline__ void change_bit(int nr, volatile void * addr) | ||
72 | { | ||
73 | unsigned long mask = 1 << (nr & 0x1f); | ||
74 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
75 | unsigned long flags; | ||
76 | |||
77 | local_irq_save(flags); | ||
78 | *a ^= mask; | ||
79 | local_irq_restore(flags); | ||
80 | } | ||
81 | |||
82 | static __inline__ void __change_bit(int nr, volatile void * addr) | ||
83 | { | ||
84 | unsigned long mask = 1 << (nr & 0x1f); | ||
85 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
86 | |||
87 | *a ^= mask; | ||
88 | } | ||
89 | |||
90 | static __inline__ int test_and_set_bit(int nr, volatile void * addr) | ||
91 | { | ||
92 | unsigned long retval; | ||
93 | unsigned long mask = 1 << (nr & 0x1f); | ||
94 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
95 | unsigned long flags; | ||
96 | |||
97 | local_irq_save(flags); | ||
98 | retval = (mask & *a) != 0; | ||
99 | *a |= mask; | ||
100 | local_irq_restore(flags); | ||
101 | |||
102 | return retval; | ||
103 | } | ||
104 | |||
105 | static __inline__ int __test_and_set_bit(int nr, volatile void * addr) | ||
106 | { | ||
107 | unsigned long retval; | ||
108 | unsigned long mask = 1 << (nr & 0x1f); | ||
109 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
110 | |||
111 | retval = (mask & *a) != 0; | ||
112 | *a |= mask; | ||
113 | |||
114 | return retval; | ||
115 | } | ||
116 | |||
117 | static __inline__ int test_and_clear_bit(int nr, volatile void * addr) | ||
118 | { | ||
119 | unsigned long retval; | ||
120 | unsigned long mask = 1 << (nr & 0x1f); | ||
121 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
122 | unsigned long flags; | ||
123 | |||
124 | local_irq_save(flags); | ||
125 | retval = (mask & *a) != 0; | ||
126 | *a &= ~mask; | ||
127 | local_irq_restore(flags); | ||
128 | |||
129 | return retval; | ||
130 | } | ||
131 | |||
132 | static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) | ||
133 | { | ||
134 | unsigned long mask = 1 << (nr & 0x1f); | ||
135 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
136 | unsigned long old = *a; | ||
137 | |||
138 | *a = old & ~mask; | ||
139 | return (old & mask) != 0; | ||
140 | } | ||
141 | |||
142 | static __inline__ int test_and_change_bit(int nr, volatile void * addr) | ||
143 | { | ||
144 | unsigned long retval; | ||
145 | unsigned long mask = 1 << (nr & 0x1f); | ||
146 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
147 | unsigned long flags; | ||
148 | |||
149 | local_irq_save(flags); | ||
150 | |||
151 | retval = (mask & *a) != 0; | ||
152 | *a ^= mask; | ||
153 | local_irq_restore(flags); | ||
154 | |||
155 | return retval; | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * non-atomic version; can be reordered | ||
160 | */ | ||
161 | |||
162 | static __inline__ int __test_and_change_bit(int nr, volatile void *addr) | ||
163 | { | ||
164 | unsigned long mask = 1 << (nr & 0x1f); | ||
165 | unsigned long *a = ((unsigned long *)addr) + (nr >> 5); | ||
166 | unsigned long old = *a; | ||
167 | |||
168 | *a = old ^ mask; | ||
169 | return (old & mask) != 0; | ||
170 | } | ||
171 | |||
172 | static __inline__ int test_bit(int nr, const volatile void *addr) | ||
173 | { | ||
174 | return 1UL & (((const volatile unsigned int *)addr)[nr>>5] >> (nr&31)); | ||
175 | } | ||
176 | |||
177 | #if XCHAL_HAVE_NSAU | ||
178 | |||
179 | static __inline__ int __cntlz (unsigned long x) | ||
180 | { | ||
181 | int lz; | ||
182 | asm ("nsau %0, %1" : "=r" (lz) : "r" (x)); | ||
183 | return 31 - lz; | ||
184 | } | ||
185 | |||
186 | #else | ||
187 | |||
188 | static __inline__ int __cntlz (unsigned long x) | ||
189 | { | ||
190 | unsigned long sum, x1, x2, x4, x8, x16; | ||
191 | x1 = x & 0xAAAAAAAA; | ||
192 | x2 = x & 0xCCCCCCCC; | ||
193 | x4 = x & 0xF0F0F0F0; | ||
194 | x8 = x & 0xFF00FF00; | ||
195 | x16 = x & 0xFFFF0000; | ||
196 | sum = x2 ? 2 : 0; | ||
197 | sum += (x16 != 0) * 16; | ||
198 | sum += (x8 != 0) * 8; | ||
199 | sum += (x4 != 0) * 4; | ||
200 | sum += (x1 != 0); | ||
201 | |||
202 | return sum; | ||
203 | } | ||
204 | |||
205 | #endif | ||
206 | |||
207 | /* | ||
208 | * ffz: Find first zero in word. Undefined if no zero exists. | ||
209 | * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). | ||
210 | */ | ||
211 | |||
212 | static __inline__ int ffz(unsigned long x) | ||
213 | { | ||
214 | if ((x = ~x) == 0) | ||
215 | return 32; | ||
216 | return __cntlz(x & -x); | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * __ffs: Find first bit set in word. Return 0 for bit 0 | ||
221 | */ | ||
222 | |||
223 | static __inline__ int __ffs(unsigned long x) | ||
224 | { | ||
225 | return __cntlz(x & -x); | ||
226 | } | ||
227 | |||
228 | /* | ||
229 | * ffs: Find first bit set in word. This is defined the same way as | ||
230 | * the libc and compiler builtin ffs routines, therefore | ||
231 | * differs in spirit from the above ffz (man ffs). | ||
232 | */ | ||
233 | |||
234 | static __inline__ int ffs(unsigned long x) | ||
235 | { | ||
236 | return __cntlz(x & -x) + 1; | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | * fls: Find last (most-significant) bit set in word. | ||
241 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. | ||
242 | */ | ||
243 | |||
244 | static __inline__ int fls (unsigned int x) | ||
245 | { | ||
246 | return __cntlz(x); | ||
247 | } | ||
248 | |||
249 | static __inline__ int | ||
250 | find_next_bit(const unsigned long *addr, int size, int offset) | ||
251 | { | ||
252 | const unsigned long *p = addr + (offset >> 5); | ||
253 | unsigned long result = offset & ~31UL; | ||
254 | unsigned long tmp; | ||
255 | |||
256 | if (offset >= size) | ||
257 | return size; | ||
258 | size -= result; | ||
259 | offset &= 31UL; | ||
260 | if (offset) { | ||
261 | tmp = *p++; | ||
262 | tmp &= ~0UL << offset; | ||
263 | if (size < 32) | ||
264 | goto found_first; | ||
265 | if (tmp) | ||
266 | goto found_middle; | ||
267 | size -= 32; | ||
268 | result += 32; | ||
269 | } | ||
270 | while (size >= 32) { | ||
271 | if ((tmp = *p++) != 0) | ||
272 | goto found_middle; | ||
273 | result += 32; | ||
274 | size -= 32; | ||
275 | } | ||
276 | if (!size) | ||
277 | return result; | ||
278 | tmp = *p; | ||
279 | |||
280 | found_first: | ||
281 | tmp &= ~0UL >> (32 - size); | ||
282 | if (tmp == 0UL) /* Are any bits set? */ | ||
283 | return result + size; /* Nope. */ | ||
284 | found_middle: | ||
285 | return result + __ffs(tmp); | ||
286 | } | ||
287 | |||
288 | /** | ||
289 | * find_first_bit - find the first set bit in a memory region | ||
290 | * @addr: The address to start the search at | ||
291 | * @size: The maximum size to search | ||
292 | * | ||
293 | * Returns the bit-number of the first set bit, not the number of the byte | ||
294 | * containing a bit. | ||
295 | */ | ||
296 | |||
297 | #define find_first_bit(addr, size) \ | ||
298 | find_next_bit((addr), (size), 0) | ||
299 | |||
300 | static __inline__ int | ||
301 | find_next_zero_bit(const unsigned long *addr, int size, int offset) | ||
302 | { | ||
303 | const unsigned long *p = addr + (offset >> 5); | ||
304 | unsigned long result = offset & ~31UL; | ||
305 | unsigned long tmp; | ||
306 | |||
307 | if (offset >= size) | ||
308 | return size; | ||
309 | size -= result; | ||
310 | offset &= 31UL; | ||
311 | if (offset) { | ||
312 | tmp = *p++; | ||
313 | tmp |= ~0UL >> (32-offset); | ||
314 | if (size < 32) | ||
315 | goto found_first; | ||
316 | if (~tmp) | ||
317 | goto found_middle; | ||
318 | size -= 32; | ||
319 | result += 32; | ||
320 | } | ||
321 | while (size & ~31UL) { | ||
322 | if (~(tmp = *p++)) | ||
323 | goto found_middle; | ||
324 | result += 32; | ||
325 | size -= 32; | ||
326 | } | ||
327 | if (!size) | ||
328 | return result; | ||
329 | tmp = *p; | ||
330 | |||
331 | found_first: | ||
332 | tmp |= ~0UL << size; | ||
333 | found_middle: | ||
334 | return result + ffz(tmp); | ||
335 | } | ||
336 | |||
337 | #define find_first_zero_bit(addr, size) \ | ||
338 | find_next_zero_bit((addr), (size), 0) | ||
339 | |||
340 | #ifdef __XTENSA_EL__ | ||
341 | # define ext2_set_bit(nr,addr) __test_and_set_bit((nr), (addr)) | ||
342 | # define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr),(addr)) | ||
343 | # define ext2_clear_bit(nr,addr) __test_and_clear_bit((nr), (addr)) | ||
344 | # define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr),(addr)) | ||
345 | # define ext2_test_bit(nr,addr) test_bit((nr), (addr)) | ||
346 | # define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr),(size)) | ||
347 | # define ext2_find_next_zero_bit(addr, size, offset) \ | ||
348 | find_next_zero_bit((addr), (size), (offset)) | ||
349 | #elif defined(__XTENSA_EB__) | ||
350 | # define ext2_set_bit(nr,addr) __test_and_set_bit((nr) ^ 0x18, (addr)) | ||
351 | # define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr) ^ 0x18, (addr)) | ||
352 | # define ext2_clear_bit(nr,addr) __test_and_clear_bit((nr) ^ 18, (addr)) | ||
353 | # define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr)^0x18,(addr)) | ||
354 | # define ext2_test_bit(nr,addr) test_bit((nr) ^ 0x18, (addr)) | ||
355 | # define ext2_find_first_zero_bit(addr, size) \ | ||
356 | ext2_find_next_zero_bit((addr), (size), 0) | ||
357 | |||
358 | static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) | ||
359 | { | ||
360 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); | ||
361 | unsigned long result = offset & ~31UL; | ||
362 | unsigned long tmp; | ||
363 | |||
364 | if (offset >= size) | ||
365 | return size; | ||
366 | size -= result; | ||
367 | offset &= 31UL; | ||
368 | if(offset) { | ||
369 | /* We hold the little endian value in tmp, but then the | ||
370 | * shift is illegal. So we could keep a big endian value | ||
371 | * in tmp, like this: | ||
372 | * | ||
373 | * tmp = __swab32(*(p++)); | ||
374 | * tmp |= ~0UL >> (32-offset); | ||
375 | * | ||
376 | * but this would decrease preformance, so we change the | ||
377 | * shift: | ||
378 | */ | ||
379 | tmp = *(p++); | ||
380 | tmp |= __swab32(~0UL >> (32-offset)); | ||
381 | if(size < 32) | ||
382 | goto found_first; | ||
383 | if(~tmp) | ||
384 | goto found_middle; | ||
385 | size -= 32; | ||
386 | result += 32; | ||
387 | } | ||
388 | while(size & ~31UL) { | ||
389 | if(~(tmp = *(p++))) | ||
390 | goto found_middle; | ||
391 | result += 32; | ||
392 | size -= 32; | ||
393 | } | ||
394 | if(!size) | ||
395 | return result; | ||
396 | tmp = *p; | ||
397 | |||
398 | found_first: | ||
399 | /* tmp is little endian, so we would have to swab the shift, | ||
400 | * see above. But then we have to swab tmp below for ffz, so | ||
401 | * we might as well do this here. | ||
402 | */ | ||
403 | return result + ffz(__swab32(tmp) | (~0UL << size)); | ||
404 | found_middle: | ||
405 | return result + ffz(__swab32(tmp)); | ||
406 | } | ||
407 | |||
408 | #else | ||
409 | # error processor byte order undefined! | ||
410 | #endif | ||
411 | |||
412 | |||
413 | #define hweight32(x) generic_hweight32(x) | ||
414 | #define hweight16(x) generic_hweight16(x) | ||
415 | #define hweight8(x) generic_hweight8(x) | ||
416 | |||
417 | /* | ||
418 | * Find the first bit set in a 140-bit bitmap. | ||
419 | * The first 100 bits are unlikely to be set. | ||
420 | */ | ||
421 | |||
422 | static inline int sched_find_first_bit(const unsigned long *b) | ||
423 | { | ||
424 | if (unlikely(b[0])) | ||
425 | return __ffs(b[0]); | ||
426 | if (unlikely(b[1])) | ||
427 | return __ffs(b[1]) + 32; | ||
428 | if (unlikely(b[2])) | ||
429 | return __ffs(b[2]) + 64; | ||
430 | if (b[3]) | ||
431 | return __ffs(b[3]) + 96; | ||
432 | return __ffs(b[4]) + 128; | ||
433 | } | ||
434 | |||
435 | |||
436 | /* Bitmap functions for the minix filesystem. */ | ||
437 | |||
438 | #define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) | ||
439 | #define minix_set_bit(nr,addr) set_bit(nr,addr) | ||
440 | #define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) | ||
441 | #define minix_test_bit(nr,addr) test_bit(nr,addr) | ||
442 | #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) | ||
443 | |||
444 | #endif /* __KERNEL__ */ | ||
445 | |||
446 | #endif /* _XTENSA_BITOPS_H */ | ||
diff --git a/include/asm-xtensa/bootparam.h b/include/asm-xtensa/bootparam.h new file mode 100644 index 000000000000..9983f2c1b7ee --- /dev/null +++ b/include/asm-xtensa/bootparam.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bootparam.h | ||
3 | * | ||
4 | * Definition of the Linux/Xtensa boot parameter structure | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | * | ||
12 | * (Concept borrowed from the 68K port) | ||
13 | */ | ||
14 | |||
15 | #ifndef _XTENSA_BOOTPARAM_H | ||
16 | #define _XTENSA_BOOTPARAM_H | ||
17 | |||
18 | #define BP_VERSION 0x0001 | ||
19 | |||
20 | #define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/ | ||
21 | #define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */ | ||
22 | #define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */ | ||
23 | #define BP_TAG_SERIAL_BAUSRATE 0x1004 /* baud rate of current console. */ | ||
24 | #define BP_TAG_SERIAL_PORT 0x1005 /* serial device of current console */ | ||
25 | |||
26 | #define BP_TAG_FIRST 0x7B0B /* first tag with a version number */ | ||
27 | #define BP_TAG_LAST 0x7E0B /* last tag */ | ||
28 | |||
29 | #ifndef __ASSEMBLY__ | ||
30 | |||
31 | /* All records are aligned to 4 bytes */ | ||
32 | |||
33 | typedef struct bp_tag { | ||
34 | unsigned short id; /* tag id */ | ||
35 | unsigned short size; /* size of this record excluding the structure*/ | ||
36 | unsigned long data[0]; /* data */ | ||
37 | } bp_tag_t; | ||
38 | |||
39 | typedef struct meminfo { | ||
40 | unsigned long type; | ||
41 | unsigned long start; | ||
42 | unsigned long end; | ||
43 | } meminfo_t; | ||
44 | |||
45 | #define SYSMEM_BANKS_MAX 5 | ||
46 | |||
47 | #define MEMORY_TYPE_CONVENTIONAL 0x1000 | ||
48 | #define MEMORY_TYPE_NONE 0x2000 | ||
49 | |||
50 | typedef struct sysmem_info { | ||
51 | int nr_banks; | ||
52 | meminfo_t bank[SYSMEM_BANKS_MAX]; | ||
53 | } sysmem_info_t; | ||
54 | |||
55 | extern sysmem_info_t sysmem; | ||
56 | |||
57 | #endif | ||
58 | #endif | ||
59 | |||
60 | |||
61 | |||
diff --git a/include/asm-xtensa/bug.h b/include/asm-xtensa/bug.h new file mode 100644 index 000000000000..56703659b204 --- /dev/null +++ b/include/asm-xtensa/bug.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bug.h | ||
3 | * | ||
4 | * Macros to cause a 'bug' message. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_BUG_H | ||
14 | #define _XTENSA_BUG_H | ||
15 | |||
16 | #include <linux/stringify.h> | ||
17 | |||
18 | #define ILL __asm__ __volatile__ (".byte 0,0,0\n") | ||
19 | |||
20 | #ifdef CONFIG_KALLSYMS | ||
21 | # define BUG() do { \ | ||
22 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | ||
23 | ILL; \ | ||
24 | } while (0) | ||
25 | #else | ||
26 | # define BUG() do { \ | ||
27 | printk("kernel BUG!\n"); \ | ||
28 | ILL; \ | ||
29 | } while (0) | ||
30 | #endif | ||
31 | |||
32 | #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) | ||
33 | #define PAGE_BUG(page) do { BUG(); } while (0) | ||
34 | #define WARN_ON(condition) do { \ | ||
35 | if (unlikely((condition)!=0)) { \ | ||
36 | printk ("Warning in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ | ||
37 | dump_stack(); \ | ||
38 | } \ | ||
39 | } while (0) | ||
40 | |||
41 | #endif /* _XTENSA_BUG_H */ | ||
diff --git a/include/asm-xtensa/bugs.h b/include/asm-xtensa/bugs.h new file mode 100644 index 000000000000..c42285320133 --- /dev/null +++ b/include/asm-xtensa/bugs.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/bugs.h | ||
3 | * | ||
4 | * This is included by init/main.c to check for architecture-dependent bugs. | ||
5 | * | ||
6 | * Xtensa processors don't have any bugs. :) | ||
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 | ||
10 | * this archive for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_BUGS_H | ||
14 | #define _XTENSA_BUGS_H | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | |||
18 | static void __init check_bugs(void) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | #endif /* _XTENSA_BUGS_H */ | ||
diff --git a/include/asm-xtensa/byteorder.h b/include/asm-xtensa/byteorder.h new file mode 100644 index 000000000000..0b1552569aae --- /dev/null +++ b/include/asm-xtensa/byteorder.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/byteorder.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_BYTEORDER_H | ||
12 | #define _XTENSA_BYTEORDER_H | ||
13 | |||
14 | #include <asm/processor.h> | ||
15 | #include <asm/types.h> | ||
16 | |||
17 | static __inline__ __const__ __u32 ___arch__swab32(__u32 x) | ||
18 | { | ||
19 | __u32 res; | ||
20 | /* instruction sequence from Xtensa ISA release 2/2000 */ | ||
21 | __asm__("ssai 8 \n\t" | ||
22 | "srli %0, %1, 16 \n\t" | ||
23 | "src %0, %0, %1 \n\t" | ||
24 | "src %0, %0, %0 \n\t" | ||
25 | "src %0, %1, %0 \n" | ||
26 | : "=&a" (res) | ||
27 | : "a" (x) | ||
28 | ); | ||
29 | return res; | ||
30 | } | ||
31 | |||
32 | static __inline__ __const__ __u16 ___arch__swab16(__u16 x) | ||
33 | { | ||
34 | /* Given that 'short' values are signed (i.e., can be negative), | ||
35 | * we cannot assume that the upper 16-bits of the register are | ||
36 | * zero. We are careful to mask values after shifting. | ||
37 | */ | ||
38 | |||
39 | /* There exists an anomaly between xt-gcc and xt-xcc. xt-gcc | ||
40 | * inserts an extui instruction after putting this function inline | ||
41 | * to ensure that it uses only the least-significant 16 bits of | ||
42 | * the result. xt-xcc doesn't use an extui, but assumes the | ||
43 | * __asm__ macro follows convention that the upper 16 bits of an | ||
44 | * 'unsigned short' result are still zero. This macro doesn't | ||
45 | * follow convention; indeed, it leaves garbage in the upport 16 | ||
46 | * bits of the register. | ||
47 | |||
48 | * Declaring the temporary variables 'res' and 'tmp' to be 32-bit | ||
49 | * types while the return type of the function is a 16-bit type | ||
50 | * forces both compilers to insert exactly one extui instruction | ||
51 | * (or equivalent) to mask off the upper 16 bits. */ | ||
52 | |||
53 | __u32 res; | ||
54 | __u32 tmp; | ||
55 | |||
56 | __asm__("extui %1, %2, 8, 8\n\t" | ||
57 | "slli %0, %2, 8 \n\t" | ||
58 | "or %0, %0, %1 \n" | ||
59 | : "=&a" (res), "=&a" (tmp) | ||
60 | : "a" (x) | ||
61 | ); | ||
62 | |||
63 | return res; | ||
64 | } | ||
65 | |||
66 | #define __arch__swab32(x) ___arch__swab32(x) | ||
67 | #define __arch__swab16(x) ___arch__swab16(x) | ||
68 | |||
69 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
70 | # define __BYTEORDER_HAS_U64__ | ||
71 | # define __SWAB_64_THRU_32__ | ||
72 | #endif | ||
73 | |||
74 | #ifdef __XTENSA_EL__ | ||
75 | # include <linux/byteorder/little_endian.h> | ||
76 | #elif defined(__XTENSA_EB__) | ||
77 | # include <linux/byteorder/big_endian.h> | ||
78 | #else | ||
79 | # error processor byte order undefined! | ||
80 | #endif | ||
81 | |||
82 | #endif /* __ASM_XTENSA_BYTEORDER_H */ | ||
diff --git a/include/asm-xtensa/cache.h b/include/asm-xtensa/cache.h new file mode 100644 index 000000000000..5aae3f12407c --- /dev/null +++ b/include/asm-xtensa/cache.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cacheflush.h | ||
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 | * 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * (C) 2001 - 2005 Tensilica Inc. | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_CACHE_H | ||
13 | #define _XTENSA_CACHE_H | ||
14 | |||
15 | #include <xtensa/config/core.h> | ||
16 | |||
17 | #if XCHAL_ICACHE_SIZE > 0 | ||
18 | # if (XCHAL_ICACHE_SIZE % (XCHAL_ICACHE_LINESIZE*XCHAL_ICACHE_WAYS*4)) != 0 | ||
19 | # error cache configuration outside expected/supported range! | ||
20 | # endif | ||
21 | #endif | ||
22 | |||
23 | #if XCHAL_DCACHE_SIZE > 0 | ||
24 | # if (XCHAL_DCACHE_SIZE % (XCHAL_DCACHE_LINESIZE*XCHAL_DCACHE_WAYS*4)) != 0 | ||
25 | # error cache configuration outside expected/supported range! | ||
26 | # endif | ||
27 | #endif | ||
28 | |||
29 | #define L1_CACHE_SHIFT XCHAL_CACHE_LINEWIDTH_MAX | ||
30 | #define L1_CACHE_BYTES XCHAL_CACHE_LINESIZE_MAX | ||
31 | |||
32 | #endif /* _XTENSA_CACHE_H */ | ||
diff --git a/include/asm-xtensa/cacheflush.h b/include/asm-xtensa/cacheflush.h new file mode 100644 index 000000000000..44a36e087844 --- /dev/null +++ b/include/asm-xtensa/cacheflush.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cacheflush.h | ||
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 | * (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CACHEFLUSH_H | ||
12 | #define _XTENSA_CACHEFLUSH_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <linux/mm.h> | ||
17 | #include <asm/processor.h> | ||
18 | #include <asm/page.h> | ||
19 | |||
20 | /* | ||
21 | * flush and invalidate data cache, invalidate instruction cache: | ||
22 | * | ||
23 | * __flush_invalidate_cache_all() | ||
24 | * __flush_invalidate_cache_range(from,sze) | ||
25 | * | ||
26 | * invalidate data or instruction cache: | ||
27 | * | ||
28 | * __invalidate_icache_all() | ||
29 | * __invalidate_icache_page(adr) | ||
30 | * __invalidate_dcache_page(adr) | ||
31 | * __invalidate_icache_range(from,size) | ||
32 | * __invalidate_dcache_range(from,size) | ||
33 | * | ||
34 | * flush data cache: | ||
35 | * | ||
36 | * __flush_dcache_page(adr) | ||
37 | * | ||
38 | * flush and invalidate data cache: | ||
39 | * | ||
40 | * __flush_invalidate_dcache_all() | ||
41 | * __flush_invalidate_dcache_page(adr) | ||
42 | * __flush_invalidate_dcache_range(from,size) | ||
43 | */ | ||
44 | |||
45 | extern void __flush_invalidate_cache_all(void); | ||
46 | extern void __flush_invalidate_cache_range(unsigned long, unsigned long); | ||
47 | extern void __flush_invalidate_dcache_all(void); | ||
48 | extern void __invalidate_icache_all(void); | ||
49 | |||
50 | extern void __invalidate_dcache_page(unsigned long); | ||
51 | extern void __invalidate_icache_page(unsigned long); | ||
52 | extern void __invalidate_icache_range(unsigned long, unsigned long); | ||
53 | extern void __invalidate_dcache_range(unsigned long, unsigned long); | ||
54 | |||
55 | #if XCHAL_DCACHE_IS_WRITEBACK | ||
56 | extern void __flush_dcache_page(unsigned long); | ||
57 | extern void __flush_invalidate_dcache_page(unsigned long); | ||
58 | extern void __flush_invalidate_dcache_range(unsigned long, unsigned long); | ||
59 | #else | ||
60 | # define __flush_dcache_page(p) do { } while(0) | ||
61 | # define __flush_invalidate_dcache_page(p) do { } while(0) | ||
62 | # define __flush_invalidate_dcache_range(p,s) do { } while(0) | ||
63 | #endif | ||
64 | |||
65 | /* | ||
66 | * We have physically tagged caches - nothing to do here - | ||
67 | * unless we have cache aliasing. | ||
68 | * | ||
69 | * Pages can get remapped. Because this might change the 'color' of that page, | ||
70 | * we have to flush the cache before the PTE is changed. | ||
71 | * (see also Documentation/cachetlb.txt) | ||
72 | */ | ||
73 | |||
74 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
75 | |||
76 | #define flush_cache_all() __flush_invalidate_cache_all(); | ||
77 | #define flush_cache_mm(mm) __flush_invalidate_cache_all(); | ||
78 | |||
79 | #define flush_cache_vmap(start,end) __flush_invalidate_cache_all(); | ||
80 | #define flush_cache_vunmap(start,end) __flush_invalidate_cache_all(); | ||
81 | |||
82 | extern void flush_dcache_page(struct page*); | ||
83 | |||
84 | extern void flush_cache_range(struct vm_area_struct*, ulong, ulong); | ||
85 | extern void flush_cache_page(struct vm_area_struct*, unsigned long, unsigned long); | ||
86 | |||
87 | #else | ||
88 | |||
89 | #define flush_cache_all() do { } while (0) | ||
90 | #define flush_cache_mm(mm) do { } while (0) | ||
91 | |||
92 | #define flush_cache_vmap(start,end) do { } while (0) | ||
93 | #define flush_cache_vunmap(start,end) do { } while (0) | ||
94 | |||
95 | #define flush_dcache_page(page) do { } while (0) | ||
96 | |||
97 | #define flush_cache_page(vma,addr,pfn) do { } while (0) | ||
98 | #define flush_cache_range(vma,start,end) do { } while (0) | ||
99 | |||
100 | #endif | ||
101 | |||
102 | #define flush_icache_range(start,end) \ | ||
103 | __invalidate_icache_range(start,(end)-(start)) | ||
104 | |||
105 | /* This is not required, see Documentation/cachetlb.txt */ | ||
106 | |||
107 | #define flush_icache_page(vma,page) do { } while(0) | ||
108 | |||
109 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
110 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
111 | |||
112 | |||
113 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
114 | memcpy(dst, src, len) | ||
115 | |||
116 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
117 | memcpy(dst, src, len) | ||
118 | |||
119 | #endif /* __KERNEL__ */ | ||
120 | |||
121 | #endif /* _XTENSA_CACHEFLUSH_H */ | ||
122 | |||
diff --git a/include/asm-xtensa/checksum.h b/include/asm-xtensa/checksum.h new file mode 100644 index 000000000000..1a00fad19929 --- /dev/null +++ b/include/asm-xtensa/checksum.h | |||
@@ -0,0 +1,264 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/checksum.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CHECKSUM_H | ||
12 | #define _XTENSA_CHECKSUM_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/in6.h> | ||
16 | #include <xtensa/config/core.h> | ||
17 | |||
18 | /* | ||
19 | * computes the checksum of a memory block at buff, length len, | ||
20 | * and adds in "sum" (32-bit) | ||
21 | * | ||
22 | * returns a 32-bit number suitable for feeding into itself | ||
23 | * or csum_tcpudp_magic | ||
24 | * | ||
25 | * this function must be called with even lengths, except | ||
26 | * for the last fragment, which may be odd | ||
27 | * | ||
28 | * it's best to have buff aligned on a 32-bit boundary | ||
29 | */ | ||
30 | asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); | ||
31 | |||
32 | /* | ||
33 | * the same as csum_partial, but copies from src while it | ||
34 | * checksums, and handles user-space pointer exceptions correctly, when needed. | ||
35 | * | ||
36 | * here even more important to align src and dst on a 32-bit (or even | ||
37 | * better 64-bit) boundary | ||
38 | */ | ||
39 | |||
40 | asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, | ||
41 | int *src_err_ptr, int *dst_err_ptr); | ||
42 | |||
43 | /* | ||
44 | * Note: when you get a NULL pointer exception here this means someone | ||
45 | * passed in an incorrect kernel address to one of these functions. | ||
46 | * | ||
47 | * If you use these functions directly please don't forget the | ||
48 | * verify_area(). | ||
49 | */ | ||
50 | extern __inline__ | ||
51 | unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, | ||
52 | int len, int sum) | ||
53 | { | ||
54 | return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); | ||
55 | } | ||
56 | |||
57 | extern __inline__ | ||
58 | unsigned int csum_partial_copy_from_user ( const char *src, char *dst, | ||
59 | int len, int sum, int *err_ptr) | ||
60 | { | ||
61 | return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * These are the old (and unsafe) way of doing checksums, a warning message will be | ||
66 | * printed if they are used and an exeption occurs. | ||
67 | * | ||
68 | * these functions should go away after some time. | ||
69 | */ | ||
70 | |||
71 | #define csum_partial_copy_fromuser csum_partial_copy | ||
72 | unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum); | ||
73 | |||
74 | /* | ||
75 | * Fold a partial checksum | ||
76 | */ | ||
77 | |||
78 | static __inline__ unsigned int csum_fold(unsigned int sum) | ||
79 | { | ||
80 | unsigned int __dummy; | ||
81 | __asm__("extui %1, %0, 16, 16\n\t" | ||
82 | "extui %0 ,%0, 0, 16\n\t" | ||
83 | "add %0, %0, %1\n\t" | ||
84 | "slli %1, %0, 16\n\t" | ||
85 | "add %0, %0, %1\n\t" | ||
86 | "extui %0, %0, 16, 16\n\t" | ||
87 | "neg %0, %0\n\t" | ||
88 | "addi %0, %0, -1\n\t" | ||
89 | "extui %0, %0, 0, 16\n\t" | ||
90 | : "=r" (sum), "=&r" (__dummy) | ||
91 | : "0" (sum)); | ||
92 | return sum; | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
97 | * which always checksum on 4 octet boundaries. | ||
98 | */ | ||
99 | static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) | ||
100 | { | ||
101 | unsigned int sum, tmp, endaddr; | ||
102 | |||
103 | __asm__ __volatile__( | ||
104 | "sub %0, %0, %0\n\t" | ||
105 | #if XCHAL_HAVE_LOOPS | ||
106 | "loopgtz %2, 2f\n\t" | ||
107 | #else | ||
108 | "beqz %2, 2f\n\t" | ||
109 | "slli %4, %2, 2\n\t" | ||
110 | "add %4, %4, %1\n\t" | ||
111 | "0:\t" | ||
112 | #endif | ||
113 | "l32i %3, %1, 0\n\t" | ||
114 | "add %0, %0, %3\n\t" | ||
115 | "bgeu %0, %3, 1f\n\t" | ||
116 | "addi %0, %0, 1\n\t" | ||
117 | "1:\t" | ||
118 | "addi %1, %1, 4\n\t" | ||
119 | #if !XCHAL_HAVE_LOOPS | ||
120 | "blt %1, %4, 0b\n\t" | ||
121 | #endif | ||
122 | "2:\t" | ||
123 | /* Since the input registers which are loaded with iph and ihl | ||
124 | are modified, we must also specify them as outputs, or gcc | ||
125 | will assume they contain their original values. */ | ||
126 | : "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmp), "=&r" (endaddr) | ||
127 | : "1" (iph), "2" (ihl)); | ||
128 | |||
129 | return csum_fold(sum); | ||
130 | } | ||
131 | |||
132 | static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, | ||
133 | unsigned long daddr, | ||
134 | unsigned short len, | ||
135 | unsigned short proto, | ||
136 | unsigned int sum) | ||
137 | { | ||
138 | |||
139 | #ifdef __XTENSA_EL__ | ||
140 | unsigned long len_proto = (ntohs(len)<<16)+proto*256; | ||
141 | #elif defined(__XTENSA_EB__) | ||
142 | unsigned long len_proto = (proto<<16)+len; | ||
143 | #else | ||
144 | # error processor byte order undefined! | ||
145 | #endif | ||
146 | __asm__("add %0, %0, %1\n\t" | ||
147 | "bgeu %0, %1, 1f\n\t" | ||
148 | "addi %0, %0, 1\n\t" | ||
149 | "1:\t" | ||
150 | "add %0, %0, %2\n\t" | ||
151 | "bgeu %0, %2, 1f\n\t" | ||
152 | "addi %0, %0, 1\n\t" | ||
153 | "1:\t" | ||
154 | "add %0, %0, %3\n\t" | ||
155 | "bgeu %0, %3, 1f\n\t" | ||
156 | "addi %0, %0, 1\n\t" | ||
157 | "1:\t" | ||
158 | : "=r" (sum), "=r" (len_proto) | ||
159 | : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum)); | ||
160 | return sum; | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | * computes the checksum of the TCP/UDP pseudo-header | ||
165 | * returns a 16-bit checksum, already complemented | ||
166 | */ | ||
167 | static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr, | ||
168 | unsigned long daddr, | ||
169 | unsigned short len, | ||
170 | unsigned short proto, | ||
171 | unsigned int sum) | ||
172 | { | ||
173 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
178 | * in icmp.c | ||
179 | */ | ||
180 | |||
181 | static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) | ||
182 | { | ||
183 | return csum_fold (csum_partial(buff, len, 0)); | ||
184 | } | ||
185 | |||
186 | #define _HAVE_ARCH_IPV6_CSUM | ||
187 | static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, | ||
188 | struct in6_addr *daddr, | ||
189 | __u32 len, | ||
190 | unsigned short proto, | ||
191 | unsigned int sum) | ||
192 | { | ||
193 | unsigned int __dummy; | ||
194 | __asm__("l32i %1, %2, 0\n\t" | ||
195 | "add %0, %0, %1\n\t" | ||
196 | "bgeu %0, %1, 1f\n\t" | ||
197 | "addi %0, %0, 1\n\t" | ||
198 | "1:\t" | ||
199 | "l32i %1, %2, 4\n\t" | ||
200 | "add %0, %0, %1\n\t" | ||
201 | "bgeu %0, %1, 1f\n\t" | ||
202 | "addi %0, %0, 1\n\t" | ||
203 | "1:\t" | ||
204 | "l32i %1, %2, 8\n\t" | ||
205 | "add %0, %0, %1\n\t" | ||
206 | "bgeu %0, %1, 1f\n\t" | ||
207 | "addi %0, %0, 1\n\t" | ||
208 | "1:\t" | ||
209 | "l32i %1, %2, 12\n\t" | ||
210 | "add %0, %0, %1\n\t" | ||
211 | "bgeu %0, %1, 1f\n\t" | ||
212 | "addi %0, %0, 1\n\t" | ||
213 | "1:\t" | ||
214 | "l32i %1, %3, 0\n\t" | ||
215 | "add %0, %0, %1\n\t" | ||
216 | "bgeu %0, %1, 1f\n\t" | ||
217 | "addi %0, %0, 1\n\t" | ||
218 | "1:\t" | ||
219 | "l32i %1, %3, 4\n\t" | ||
220 | "add %0, %0, %1\n\t" | ||
221 | "bgeu %0, %1, 1f\n\t" | ||
222 | "addi %0, %0, 1\n\t" | ||
223 | "1:\t" | ||
224 | "l32i %1, %3, 8\n\t" | ||
225 | "add %0, %0, %1\n\t" | ||
226 | "bgeu %0, %1, 1f\n\t" | ||
227 | "addi %0, %0, 1\n\t" | ||
228 | "1:\t" | ||
229 | "l32i %1, %3, 12\n\t" | ||
230 | "add %0, %0, %1\n\t" | ||
231 | "bgeu %0, %1, 1f\n\t" | ||
232 | "addi %0, %0, 1\n\t" | ||
233 | "1:\t" | ||
234 | "add %0, %0, %4\n\t" | ||
235 | "bgeu %0, %4, 1f\n\t" | ||
236 | "addi %0, %0, 1\n\t" | ||
237 | "1:\t" | ||
238 | "add %0, %0, %5\n\t" | ||
239 | "bgeu %0, %5, 1f\n\t" | ||
240 | "addi %0, %0, 1\n\t" | ||
241 | "1:\t" | ||
242 | : "=r" (sum), "=&r" (__dummy) | ||
243 | : "r" (saddr), "r" (daddr), | ||
244 | "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)); | ||
245 | |||
246 | return csum_fold(sum); | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * Copy and checksum to user | ||
251 | */ | ||
252 | #define HAVE_CSUM_COPY_USER | ||
253 | static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst, | ||
254 | int len, int sum, int *err_ptr) | ||
255 | { | ||
256 | if (access_ok(VERIFY_WRITE, dst, len)) | ||
257 | return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); | ||
258 | |||
259 | if (len) | ||
260 | *err_ptr = -EFAULT; | ||
261 | |||
262 | return -1; /* invalid checksum */ | ||
263 | } | ||
264 | #endif | ||
diff --git a/include/asm-xtensa/coprocessor.h b/include/asm-xtensa/coprocessor.h new file mode 100644 index 000000000000..a91b96dc0efe --- /dev/null +++ b/include/asm-xtensa/coprocessor.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cpextra.h | ||
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 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_COPROCESSOR_H | ||
12 | #define _XTENSA_COPROCESSOR_H | ||
13 | |||
14 | #include <xtensa/config/core.h> | ||
15 | |||
16 | #define XTOFS(last_start,last_size,align) \ | ||
17 | ((last_start+last_size+align-1) & -align) | ||
18 | |||
19 | #define XTENSA_CP_EXTRA_OFFSET 0 | ||
20 | #define XTENSA_CP_EXTRA_ALIGN XCHAL_EXTRA_SA_ALIGN | ||
21 | |||
22 | #define XTENSA_CPE_CP0_OFFSET \ | ||
23 | XTOFS(XTENSA_CP_EXTRA_OFFSET, XCHAL_EXTRA_SA_SIZE, XCHAL_CP0_SA_ALIGN) | ||
24 | #define XTENSA_CPE_CP1_OFFSET \ | ||
25 | XTOFS(XTENSA_CPE_CP0_OFFSET, XCHAL_CP0_SA_SIZE, XCHAL_CP1_SA_ALIGN) | ||
26 | #define XTENSA_CPE_CP2_OFFSET \ | ||
27 | XTOFS(XTENSA_CPE_CP1_OFFSET, XCHAL_CP1_SA_SIZE, XCHAL_CP2_SA_ALIGN) | ||
28 | #define XTENSA_CPE_CP3_OFFSET \ | ||
29 | XTOFS(XTENSA_CPE_CP2_OFFSET, XCHAL_CP2_SA_SIZE, XCHAL_CP3_SA_ALIGN) | ||
30 | #define XTENSA_CPE_CP4_OFFSET \ | ||
31 | XTOFS(XTENSA_CPE_CP3_OFFSET, XCHAL_CP3_SA_SIZE, XCHAL_CP4_SA_ALIGN) | ||
32 | #define XTENSA_CPE_CP5_OFFSET \ | ||
33 | XTOFS(XTENSA_CPE_CP4_OFFSET, XCHAL_CP4_SA_SIZE, XCHAL_CP5_SA_ALIGN) | ||
34 | #define XTENSA_CPE_CP6_OFFSET \ | ||
35 | XTOFS(XTENSA_CPE_CP5_OFFSET, XCHAL_CP5_SA_SIZE, XCHAL_CP6_SA_ALIGN) | ||
36 | #define XTENSA_CPE_CP7_OFFSET \ | ||
37 | XTOFS(XTENSA_CPE_CP6_OFFSET, XCHAL_CP6_SA_SIZE, XCHAL_CP7_SA_ALIGN) | ||
38 | #define XTENSA_CP_EXTRA_SIZE \ | ||
39 | XTOFS(XTENSA_CPE_CP7_OFFSET, XCHAL_CP7_SA_SIZE, 16) | ||
40 | |||
41 | #if XCHAL_CP_NUM > 0 | ||
42 | # ifndef __ASSEMBLY__ | ||
43 | /* | ||
44 | * Tasks that own contents of (last user) each coprocessor. | ||
45 | * Entries are 0 for not-owned or non-existent coprocessors. | ||
46 | * Note: The size of this structure is fixed to 8 bytes in entry.S | ||
47 | */ | ||
48 | typedef struct { | ||
49 | struct task_struct *owner; /* owner */ | ||
50 | int offset; /* offset in cpextra space. */ | ||
51 | } coprocessor_info_t; | ||
52 | # else | ||
53 | # define COPROCESSOR_INFO_OWNER 0 | ||
54 | # define COPROCESSOR_INFO_OFFSET 4 | ||
55 | # define COPROCESSOR_INFO_SIZE 8 | ||
56 | # endif | ||
57 | #endif | ||
58 | |||
59 | |||
60 | #ifndef __ASSEMBLY__ | ||
61 | # if XCHAL_CP_NUM > 0 | ||
62 | struct task_struct; | ||
63 | extern void release_coprocessors (struct task_struct*); | ||
64 | extern void save_coprocessor_registers(void*, int); | ||
65 | # else | ||
66 | # define release_coprocessors(task) | ||
67 | # endif | ||
68 | #endif | ||
69 | |||
70 | #endif /* _XTENSA_COPROCESSOR_H */ | ||
diff --git a/include/asm-xtensa/cpumask.h b/include/asm-xtensa/cpumask.h new file mode 100644 index 000000000000..ebeede397db3 --- /dev/null +++ b/include/asm-xtensa/cpumask.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/cpumask.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CPUMASK_H | ||
12 | #define _XTENSA_CPUMASK_H | ||
13 | |||
14 | #include <asm-generic/cpumask.h> | ||
15 | |||
16 | #endif /* _XTENSA_CPUMASK_H */ | ||
diff --git a/include/asm-xtensa/cputime.h b/include/asm-xtensa/cputime.h new file mode 100644 index 000000000000..a7fb864a50ae --- /dev/null +++ b/include/asm-xtensa/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _XTENSA_CPUTIME_H | ||
2 | #define _XTENSA_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* _XTENSA_CPUTIME_H */ | ||
diff --git a/include/asm-xtensa/current.h b/include/asm-xtensa/current.h new file mode 100644 index 000000000000..8d1eb5d78649 --- /dev/null +++ b/include/asm-xtensa/current.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/current.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_CURRENT_H | ||
12 | #define _XTENSA_CURRENT_H | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | #include <linux/thread_info.h> | ||
17 | |||
18 | struct task_struct; | ||
19 | |||
20 | static inline struct task_struct *get_current(void) | ||
21 | { | ||
22 | return current_thread_info()->task; | ||
23 | } | ||
24 | |||
25 | #define current get_current() | ||
26 | |||
27 | #else | ||
28 | |||
29 | #define CURRENT_SHIFT 13 | ||
30 | |||
31 | #define GET_CURRENT(reg,sp) \ | ||
32 | GET_THREAD_INFO(reg,sp); \ | ||
33 | l32i reg, reg, TI_TASK \ | ||
34 | |||
35 | #endif | ||
36 | |||
37 | |||
38 | #endif /* XTENSA_CURRENT_H */ | ||
diff --git a/include/asm-xtensa/delay.h b/include/asm-xtensa/delay.h new file mode 100644 index 000000000000..6359c55e77a8 --- /dev/null +++ b/include/asm-xtensa/delay.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/delay.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_DELAY_H | ||
13 | #define _XTENSA_DELAY_H | ||
14 | |||
15 | #include <linux/config.h> | ||
16 | #include <asm/processor.h> | ||
17 | #include <asm/param.h> | ||
18 | |||
19 | extern unsigned long loops_per_jiffy; | ||
20 | |||
21 | extern __inline__ void __delay(unsigned long loops) | ||
22 | { | ||
23 | /* 2 cycles per loop. */ | ||
24 | __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 1, 1b" | ||
25 | : "=r" (loops) : "0" (loops)); | ||
26 | } | ||
27 | |||
28 | static __inline__ u32 xtensa_get_ccount(void) | ||
29 | { | ||
30 | u32 ccount; | ||
31 | asm volatile ("rsr %0, 234; # CCOUNT\n" : "=r" (ccount)); | ||
32 | return ccount; | ||
33 | } | ||
34 | |||
35 | /* For SMP/NUMA systems, change boot_cpu_data to something like | ||
36 | * local_cpu_data->... where local_cpu_data points to the current | ||
37 | * cpu. */ | ||
38 | |||
39 | static __inline__ void udelay (unsigned long usecs) | ||
40 | { | ||
41 | unsigned long start = xtensa_get_ccount(); | ||
42 | unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ)); | ||
43 | |||
44 | /* Note: all variables are unsigned (can wrap around)! */ | ||
45 | while (((unsigned long)xtensa_get_ccount()) - start < cycles) | ||
46 | ; | ||
47 | } | ||
48 | |||
49 | #endif | ||
50 | |||
diff --git a/include/asm-xtensa/div64.h b/include/asm-xtensa/div64.h new file mode 100644 index 000000000000..c4a105776383 --- /dev/null +++ b/include/asm-xtensa/div64.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/div64.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_DIV64_H | ||
12 | #define _XTENSA_DIV64_H | ||
13 | |||
14 | #define do_div(n,base) ({ \ | ||
15 | int __res = n % ((unsigned int) base); \ | ||
16 | n /= (unsigned int) base; \ | ||
17 | __res; }) | ||
18 | |||
19 | #endif | ||
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h new file mode 100644 index 000000000000..e86a206f1209 --- /dev/null +++ b/include/asm-xtensa/dma-mapping.h | |||
@@ -0,0 +1,182 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/dma_mapping.h | ||
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 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_DMA_MAPPING_H | ||
12 | #define _XTENSA_DMA_MAPPING_H | ||
13 | |||
14 | #include <asm/scatterlist.h> | ||
15 | #include <asm/cache.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <linux/mm.h> | ||
18 | |||
19 | /* | ||
20 | * DMA-consistent mapping functions. | ||
21 | */ | ||
22 | |||
23 | extern void *consistent_alloc(int, size_t, dma_addr_t, unsigned long); | ||
24 | extern void consistent_free(void*, size_t, dma_addr_t); | ||
25 | extern void consistent_sync(void*, size_t, int); | ||
26 | |||
27 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
28 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
29 | |||
30 | void *dma_alloc_coherent(struct device *dev, size_t size, | ||
31 | dma_addr_t *dma_handle, int flag); | ||
32 | |||
33 | void dma_free_coherent(struct device *dev, size_t size, | ||
34 | void *vaddr, dma_addr_t dma_handle); | ||
35 | |||
36 | static inline dma_addr_t | ||
37 | dma_map_single(struct device *dev, void *ptr, size_t size, | ||
38 | enum dma_data_direction direction) | ||
39 | { | ||
40 | BUG_ON(direction == DMA_NONE); | ||
41 | consistent_sync(ptr, size, direction); | ||
42 | return virt_to_phys(ptr); | ||
43 | } | ||
44 | |||
45 | static inline void | ||
46 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
47 | enum dma_data_direction direction) | ||
48 | { | ||
49 | BUG_ON(direction == DMA_NONE); | ||
50 | } | ||
51 | |||
52 | static inline int | ||
53 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
54 | enum dma_data_direction direction) | ||
55 | { | ||
56 | int i; | ||
57 | |||
58 | BUG_ON(direction == DMA_NONE); | ||
59 | |||
60 | for (i = 0; i < nents; i++, sg++ ) { | ||
61 | BUG_ON(!sg->page); | ||
62 | |||
63 | sg->dma_address = page_to_phys(sg->page) + sg->offset; | ||
64 | consistent_sync(page_address(sg->page) + sg->offset, | ||
65 | sg->length, direction); | ||
66 | } | ||
67 | |||
68 | return nents; | ||
69 | } | ||
70 | |||
71 | static inline dma_addr_t | ||
72 | dma_map_page(struct device *dev, struct page *page, unsigned long offset, | ||
73 | size_t size, enum dma_data_direction direction) | ||
74 | { | ||
75 | BUG_ON(direction == DMA_NONE); | ||
76 | return (dma_addr_t)(page_to_pfn(page)) * PAGE_SIZE + offset; | ||
77 | } | ||
78 | |||
79 | static inline void | ||
80 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
81 | enum dma_data_direction direction) | ||
82 | { | ||
83 | BUG_ON(direction == DMA_NONE); | ||
84 | } | ||
85 | |||
86 | |||
87 | static inline void | ||
88 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
89 | enum dma_data_direction direction) | ||
90 | { | ||
91 | BUG_ON(direction == DMA_NONE); | ||
92 | } | ||
93 | |||
94 | static inline void | ||
95 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
96 | enum dma_data_direction direction) | ||
97 | { | ||
98 | consistent_sync((void *)bus_to_virt(dma_handle), size, direction); | ||
99 | } | ||
100 | |||
101 | static inline void | ||
102 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
103 | enum dma_data_direction direction) | ||
104 | { | ||
105 | consistent_sync((void *)bus_to_virt(dma_handle), size, direction); | ||
106 | } | ||
107 | |||
108 | static inline void | ||
109 | dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
110 | unsigned long offset, size_t size, | ||
111 | enum dma_data_direction direction) | ||
112 | { | ||
113 | |||
114 | consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction); | ||
115 | } | ||
116 | |||
117 | static inline void | ||
118 | dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, | ||
119 | unsigned long offset, size_t size, | ||
120 | enum dma_data_direction direction) | ||
121 | { | ||
122 | |||
123 | consistent_sync((void *)bus_to_virt(dma_handle)+offset,size,direction); | ||
124 | } | ||
125 | static inline void | ||
126 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
127 | enum dma_data_direction dir) | ||
128 | { | ||
129 | int i; | ||
130 | for (i = 0; i < nelems; i++, sg++) | ||
131 | consistent_sync(page_address(sg->page) + sg->offset, | ||
132 | sg->length, dir); | ||
133 | } | ||
134 | |||
135 | static inline void | ||
136 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | ||
137 | enum dma_data_direction dir) | ||
138 | { | ||
139 | int i; | ||
140 | for (i = 0; i < nelems; i++, sg++) | ||
141 | consistent_sync(page_address(sg->page) + sg->offset, | ||
142 | sg->length, dir); | ||
143 | } | ||
144 | static inline int | ||
145 | dma_mapping_error(dma_addr_t dma_addr) | ||
146 | { | ||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static inline int | ||
151 | dma_supported(struct device *dev, u64 mask) | ||
152 | { | ||
153 | return 1; | ||
154 | } | ||
155 | |||
156 | static inline int | ||
157 | dma_set_mask(struct device *dev, u64 mask) | ||
158 | { | ||
159 | if(!dev->dma_mask || !dma_supported(dev, mask)) | ||
160 | return -EIO; | ||
161 | |||
162 | *dev->dma_mask = mask; | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static inline int | ||
168 | dma_get_cache_alignment(void) | ||
169 | { | ||
170 | return L1_CACHE_BYTES; | ||
171 | } | ||
172 | |||
173 | #define dma_is_consistent(d) (1) | ||
174 | |||
175 | static inline void | ||
176 | dma_cache_sync(void *vaddr, size_t size, | ||
177 | enum dma_data_direction direction) | ||
178 | { | ||
179 | consistent_sync(vaddr, size, direction); | ||
180 | } | ||
181 | |||
182 | #endif /* _XTENSA_DMA_MAPPING_H */ | ||
diff --git a/include/asm-xtensa/dma.h b/include/asm-xtensa/dma.h new file mode 100644 index 000000000000..1c22b0234586 --- /dev/null +++ b/include/asm-xtensa/dma.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/dma.h | ||
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 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_DMA_H | ||
12 | #define _XTENSA_DMA_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <asm/io.h> /* need byte IO */ | ||
16 | #include <xtensa/config/core.h> | ||
17 | |||
18 | /* | ||
19 | * This is only to be defined if we have PC-like DMA. | ||
20 | * By default this is not true on an Xtensa processor, | ||
21 | * however on boards with a PCI bus, such functionality | ||
22 | * might be emulated externally. | ||
23 | * | ||
24 | * NOTE: there still exists driver code that assumes | ||
25 | * this is defined, eg. drivers/sound/soundcard.c (as of 2.4). | ||
26 | */ | ||
27 | #define MAX_DMA_CHANNELS 8 | ||
28 | |||
29 | /* | ||
30 | * The maximum virtual address to which DMA transfers | ||
31 | * can be performed on this platform. | ||
32 | * | ||
33 | * NOTE: This is board (platform) specific, not processor-specific! | ||
34 | * | ||
35 | * NOTE: This assumes DMA transfers can only be performed on | ||
36 | * the section of physical memory contiguously mapped in virtual | ||
37 | * space for the kernel. For the Xtensa architecture, this | ||
38 | * means the maximum possible size of this DMA area is | ||
39 | * the size of the statically mapped kernel segment | ||
40 | * (XCHAL_KSEG_{CACHED,BYPASS}_SIZE), ie. 128 MB. | ||
41 | * | ||
42 | * NOTE: When the entire KSEG area is DMA capable, we substract | ||
43 | * one from the max address so that the virt_to_phys() macro | ||
44 | * works correctly on the address (otherwise the address | ||
45 | * enters another area, and virt_to_phys() may not return | ||
46 | * the value desired). | ||
47 | */ | ||
48 | #define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KSEG_CACHED_SIZE - 1) | ||
49 | |||
50 | /* Reserve and release a DMA channel */ | ||
51 | extern int request_dma(unsigned int dmanr, const char * device_id); | ||
52 | extern void free_dma(unsigned int dmanr); | ||
53 | |||
54 | #ifdef CONFIG_PCI | ||
55 | extern int isa_dma_bridge_buggy; | ||
56 | #else | ||
57 | #define isa_dma_bridge_buggy (0) | ||
58 | #endif | ||
59 | |||
60 | |||
61 | #endif | ||
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h new file mode 100644 index 000000000000..64f1f53874fe --- /dev/null +++ b/include/asm-xtensa/elf.h | |||
@@ -0,0 +1,222 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/elf.h | ||
3 | * | ||
4 | * ELF register definitions | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_ELF_H | ||
14 | #define _XTENSA_ELF_H | ||
15 | |||
16 | #include <asm/ptrace.h> | ||
17 | #include <asm/coprocessor.h> | ||
18 | #include <xtensa/config/core.h> | ||
19 | |||
20 | /* Xtensa processor ELF architecture-magic number */ | ||
21 | |||
22 | #define EM_XTENSA 94 | ||
23 | #define EM_XTENSA_OLD 0xABC7 | ||
24 | |||
25 | /* ELF register definitions. This is needed for core dump support. */ | ||
26 | |||
27 | /* | ||
28 | * elf_gregset_t contains the application-level state in the following order: | ||
29 | * Processor info: config_version, cpuxy | ||
30 | * Processor state: pc, ps, exccause, excvaddr, wb, ws, | ||
31 | * lbeg, lend, lcount, sar | ||
32 | * GP regs: ar0 - arXX | ||
33 | */ | ||
34 | |||
35 | typedef unsigned long elf_greg_t; | ||
36 | |||
37 | typedef struct { | ||
38 | elf_greg_t xchal_config_id0; | ||
39 | elf_greg_t xchal_config_id1; | ||
40 | elf_greg_t cpux; | ||
41 | elf_greg_t cpuy; | ||
42 | elf_greg_t pc; | ||
43 | elf_greg_t ps; | ||
44 | elf_greg_t exccause; | ||
45 | elf_greg_t excvaddr; | ||
46 | elf_greg_t windowbase; | ||
47 | elf_greg_t windowstart; | ||
48 | elf_greg_t lbeg; | ||
49 | elf_greg_t lend; | ||
50 | elf_greg_t lcount; | ||
51 | elf_greg_t sar; | ||
52 | elf_greg_t syscall; | ||
53 | elf_greg_t ar[XCHAL_NUM_AREGS]; | ||
54 | } xtensa_gregset_t; | ||
55 | |||
56 | #define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t)) | ||
57 | |||
58 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
59 | |||
60 | /* | ||
61 | * Compute the size of the coprocessor and extra state layout (register info) | ||
62 | * table (in bytes). | ||
63 | * This is actually the maximum size of the table, as opposed to the size, | ||
64 | * which is available from the _xtensa_reginfo_table_size global variable. | ||
65 | * | ||
66 | * (See also arch/xtensa/kernel/coprocessor.S) | ||
67 | * | ||
68 | */ | ||
69 | |||
70 | #ifndef XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM | ||
71 | # define XTENSA_CPE_LTABLE_SIZE 0 | ||
72 | #else | ||
73 | # define XTENSA_CPE_SEGMENT(num) (num ? (1+num) : 0) | ||
74 | # define XTENSA_CPE_LTABLE_ENTRIES \ | ||
75 | ( XTENSA_CPE_SEGMENT(XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM) \ | ||
76 | + XTENSA_CPE_SEGMENT(XCHAL_CP0_SA_CONTENTS_LIBDB_NUM) \ | ||
77 | + XTENSA_CPE_SEGMENT(XCHAL_CP1_SA_CONTENTS_LIBDB_NUM) \ | ||
78 | + XTENSA_CPE_SEGMENT(XCHAL_CP2_SA_CONTENTS_LIBDB_NUM) \ | ||
79 | + XTENSA_CPE_SEGMENT(XCHAL_CP3_SA_CONTENTS_LIBDB_NUM) \ | ||
80 | + XTENSA_CPE_SEGMENT(XCHAL_CP4_SA_CONTENTS_LIBDB_NUM) \ | ||
81 | + XTENSA_CPE_SEGMENT(XCHAL_CP5_SA_CONTENTS_LIBDB_NUM) \ | ||
82 | + XTENSA_CPE_SEGMENT(XCHAL_CP6_SA_CONTENTS_LIBDB_NUM) \ | ||
83 | + XTENSA_CPE_SEGMENT(XCHAL_CP7_SA_CONTENTS_LIBDB_NUM) \ | ||
84 | + 1 /* final entry */ \ | ||
85 | ) | ||
86 | # define XTENSA_CPE_LTABLE_SIZE (XTENSA_CPE_LTABLE_ENTRIES * 8) | ||
87 | #endif | ||
88 | |||
89 | |||
90 | /* | ||
91 | * Instantiations of the elf_fpregset_t type contain, in most | ||
92 | * architectures, the floating point (FPU) register set. | ||
93 | * For Xtensa, this type is extended to contain all custom state, | ||
94 | * ie. coprocessor and "extra" (non-coprocessor) state (including, | ||
95 | * for example, TIE-defined states and register files; as well | ||
96 | * as other optional processor state). | ||
97 | * This includes FPU state if a floating-point coprocessor happens | ||
98 | * to have been configured within the Xtensa processor. | ||
99 | * | ||
100 | * TOTAL_FPREGS_SIZE is the required size (without rounding) | ||
101 | * of elf_fpregset_t. It provides space for the following: | ||
102 | * | ||
103 | * a) 32-bit mask of active coprocessors for this task (similar | ||
104 | * to CPENABLE in single-threaded Xtensa processor systems) | ||
105 | * | ||
106 | * b) table describing the layout of custom states (ie. of | ||
107 | * individual registers, etc) within the save areas | ||
108 | * | ||
109 | * c) save areas for each coprocessor and for non-coprocessor | ||
110 | * ("extra") state | ||
111 | * | ||
112 | * Note that save areas may require up to 16-byte alignment when | ||
113 | * accessed by save/restore sequences. We do not need to ensure | ||
114 | * such alignment in an elf_fpregset_t structure because custom | ||
115 | * state is not directly loaded/stored into it; rather, save area | ||
116 | * contents are copied to elf_fpregset_t from the active save areas | ||
117 | * (see 'struct task_struct' definition in processor.h for that) | ||
118 | * using memcpy(). But we do allow space for such alignment, | ||
119 | * to allow optimizations of layout and copying. | ||
120 | */ | ||
121 | |||
122 | #define TOTAL_FPREGS_SIZE \ | ||
123 | (4 + XTENSA_CPE_LTABLE_SIZE + XTENSA_CP_EXTRA_SIZE) | ||
124 | #define ELF_NFPREG \ | ||
125 | ((TOTAL_FPREGS_SIZE + sizeof(elf_fpreg_t) - 1) / sizeof(elf_fpreg_t)) | ||
126 | |||
127 | typedef unsigned int elf_fpreg_t; | ||
128 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | ||
129 | |||
130 | #define ELF_CORE_COPY_REGS(_eregs, _pregs) \ | ||
131 | xtensa_elf_core_copy_regs (&_eregs, _pregs); | ||
132 | |||
133 | extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *); | ||
134 | |||
135 | /* | ||
136 | * This is used to ensure we don't load something for the wrong architecture. | ||
137 | */ | ||
138 | |||
139 | #define elf_check_arch(x) ( ( (x)->e_machine == EM_XTENSA ) || \ | ||
140 | ( (x)->e_machine == EM_XTENSA_OLD ) ) | ||
141 | |||
142 | /* | ||
143 | * These are used to set parameters in the core dumps. | ||
144 | */ | ||
145 | |||
146 | #ifdef __XTENSA_EL__ | ||
147 | # define ELF_DATA ELFDATA2LSB | ||
148 | #elif defined(__XTENSA_EB__) | ||
149 | # define ELF_DATA ELFDATA2MSB | ||
150 | #else | ||
151 | # error processor byte order undefined! | ||
152 | #endif | ||
153 | |||
154 | #define ELF_CLASS ELFCLASS32 | ||
155 | #define ELF_ARCH EM_XTENSA | ||
156 | |||
157 | #define USE_ELF_CORE_DUMP | ||
158 | #define ELF_EXEC_PAGESIZE PAGE_SIZE | ||
159 | |||
160 | /* | ||
161 | * This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
162 | * use of this is to invoke "./ld.so someprog" to test out a new version of | ||
163 | * the loader. We need to make sure that it is out of the way of the program | ||
164 | * that it will "exec", and that there is sufficient room for the brk. | ||
165 | */ | ||
166 | |||
167 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
168 | |||
169 | /* | ||
170 | * This yields a mask that user programs can use to figure out what | ||
171 | * instruction set this CPU supports. This could be done in user space, | ||
172 | * but it's not easy, and we've already done it here. | ||
173 | */ | ||
174 | |||
175 | #define ELF_HWCAP (0) | ||
176 | |||
177 | /* | ||
178 | * This yields a string that ld.so will use to load implementation | ||
179 | * specific libraries for optimization. This is more specific in | ||
180 | * intent than poking at uname or /proc/cpuinfo. | ||
181 | * For the moment, we have only optimizations for the Intel generations, | ||
182 | * but that could change... | ||
183 | */ | ||
184 | |||
185 | #define ELF_PLATFORM (NULL) | ||
186 | |||
187 | /* | ||
188 | * The Xtensa processor ABI says that when the program starts, a2 | ||
189 | * contains a pointer to a function which might be registered using | ||
190 | * `atexit'. This provides a mean for the dynamic linker to call | ||
191 | * DT_FINI functions for shared libraries that have been loaded before | ||
192 | * the code runs. | ||
193 | * | ||
194 | * A value of 0 tells we have no such handler. | ||
195 | * | ||
196 | * We might as well make sure everything else is cleared too (except | ||
197 | * for the stack pointer in a1), just to make things more | ||
198 | * deterministic. Also, clearing a0 terminates debugger backtraces. | ||
199 | */ | ||
200 | |||
201 | #define ELF_PLAT_INIT(_r, load_addr) \ | ||
202 | do { _r->areg[0]=0; /*_r->areg[1]=0;*/ _r->areg[2]=0; _r->areg[3]=0; \ | ||
203 | _r->areg[4]=0; _r->areg[5]=0; _r->areg[6]=0; _r->areg[7]=0; \ | ||
204 | _r->areg[8]=0; _r->areg[9]=0; _r->areg[10]=0; _r->areg[11]=0; \ | ||
205 | _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \ | ||
206 | } while (0) | ||
207 | |||
208 | #ifdef __KERNEL__ | ||
209 | |||
210 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) | ||
211 | |||
212 | extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*, | ||
213 | struct task_struct*); | ||
214 | extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*, | ||
215 | struct task_struct*); | ||
216 | extern void do_save_fpregs (elf_fpregset_t*, struct pt_regs*, | ||
217 | struct task_struct*); | ||
218 | extern int do_restore_fpregs (elf_fpregset_t*, struct pt_regs*, | ||
219 | struct task_struct*); | ||
220 | |||
221 | #endif /* __KERNEL__ */ | ||
222 | #endif /* _XTENSA_ELF_H */ | ||
diff --git a/include/asm-xtensa/errno.h b/include/asm-xtensa/errno.h new file mode 100644 index 000000000000..ced5194d2750 --- /dev/null +++ b/include/asm-xtensa/errno.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/errno.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_ERRNO_H | ||
12 | #define _XTENSA_ERRNO_H | ||
13 | |||
14 | #define EPERM 1 /* Operation not permitted */ | ||
15 | #define ENOENT 2 /* No such file or directory */ | ||
16 | #define ESRCH 3 /* No such process */ | ||
17 | #define EINTR 4 /* Interrupted system call */ | ||
18 | #define EIO 5 /* I/O error */ | ||
19 | #define ENXIO 6 /* No such device or address */ | ||
20 | #define E2BIG 7 /* Arg list too long */ | ||
21 | #define ENOEXEC 8 /* Exec format error */ | ||
22 | #define EBADF 9 /* Bad file number */ | ||
23 | #define ECHILD 10 /* No child processes */ | ||
24 | #define EAGAIN 11 /* Try again */ | ||
25 | #define ENOMEM 12 /* Out of memory */ | ||
26 | #define EACCES 13 /* Permission denied */ | ||
27 | #define EFAULT 14 /* Bad address */ | ||
28 | #define ENOTBLK 15 /* Block device required */ | ||
29 | #define EBUSY 16 /* Device or resource busy */ | ||
30 | #define EEXIST 17 /* File exists */ | ||
31 | #define EXDEV 18 /* Cross-device link */ | ||
32 | #define ENODEV 19 /* No such device */ | ||
33 | #define ENOTDIR 20 /* Not a directory */ | ||
34 | #define EISDIR 21 /* Is a directory */ | ||
35 | #define EINVAL 22 /* Invalid argument */ | ||
36 | #define ENFILE 23 /* File table overflow */ | ||
37 | #define EMFILE 24 /* Too many open files */ | ||
38 | #define ENOTTY 25 /* Not a typewriter */ | ||
39 | #define ETXTBSY 26 /* Text file busy */ | ||
40 | #define EFBIG 27 /* File too large */ | ||
41 | #define ENOSPC 28 /* No space left on device */ | ||
42 | #define ESPIPE 29 /* Illegal seek */ | ||
43 | #define EROFS 30 /* Read-only file system */ | ||
44 | #define EMLINK 31 /* Too many links */ | ||
45 | #define EPIPE 32 /* Broken pipe */ | ||
46 | #define EDOM 33 /* Math argument out of domain of func */ | ||
47 | #define ERANGE 34 /* Math result not representable */ | ||
48 | #define EDEADLK 35 /* Resource deadlock would occur */ | ||
49 | #define ENAMETOOLONG 36 /* File name too long */ | ||
50 | #define ENOLCK 37 /* No record locks available */ | ||
51 | #define ENOSYS 38 /* Function not implemented */ | ||
52 | #define ENOTEMPTY 39 /* Directory not empty */ | ||
53 | #define ELOOP 40 /* Too many symbolic links encountered */ | ||
54 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
55 | #define ENOMSG 42 /* No message of desired type */ | ||
56 | #define EIDRM 43 /* Identifier removed */ | ||
57 | #define ECHRNG 44 /* Channel number out of range */ | ||
58 | #define EL2NSYNC 45 /* Level 2 not synchronized */ | ||
59 | #define EL3HLT 46 /* Level 3 halted */ | ||
60 | #define EL3RST 47 /* Level 3 reset */ | ||
61 | #define ELNRNG 48 /* Link number out of range */ | ||
62 | #define EUNATCH 49 /* Protocol driver not attached */ | ||
63 | #define ENOCSI 50 /* No CSI structure available */ | ||
64 | #define EL2HLT 51 /* Level 2 halted */ | ||
65 | #define EBADE 52 /* Invalid exchange */ | ||
66 | #define EBADR 53 /* Invalid request descriptor */ | ||
67 | #define EXFULL 54 /* Exchange full */ | ||
68 | #define ENOANO 55 /* No anode */ | ||
69 | #define EBADRQC 56 /* Invalid request code */ | ||
70 | #define EBADSLT 57 /* Invalid slot */ | ||
71 | |||
72 | #define EDEADLOCK EDEADLK | ||
73 | |||
74 | #define EBFONT 59 /* Bad font file format */ | ||
75 | #define ENOSTR 60 /* Device not a stream */ | ||
76 | #define ENODATA 61 /* No data available */ | ||
77 | #define ETIME 62 /* Timer expired */ | ||
78 | #define ENOSR 63 /* Out of streams resources */ | ||
79 | #define ENONET 64 /* Machine is not on the network */ | ||
80 | #define ENOPKG 65 /* Package not installed */ | ||
81 | #define EREMOTE 66 /* Object is remote */ | ||
82 | #define ENOLINK 67 /* Link has been severed */ | ||
83 | #define EADV 68 /* Advertise error */ | ||
84 | #define ESRMNT 69 /* Srmount error */ | ||
85 | #define ECOMM 70 /* Communication error on send */ | ||
86 | #define EPROTO 71 /* Protocol error */ | ||
87 | #define EMULTIHOP 72 /* Multihop attempted */ | ||
88 | #define EDOTDOT 73 /* RFS specific error */ | ||
89 | #define EBADMSG 74 /* Not a data message */ | ||
90 | #define EOVERFLOW 75 /* Value too large for defined data type */ | ||
91 | #define ENOTUNIQ 76 /* Name not unique on network */ | ||
92 | #define EBADFD 77 /* File descriptor in bad state */ | ||
93 | #define EREMCHG 78 /* Remote address changed */ | ||
94 | #define ELIBACC 79 /* Can not access a needed shared library */ | ||
95 | #define ELIBBAD 80 /* Accessing a corrupted shared library */ | ||
96 | #define ELIBSCN 81 /* .lib section in a.out corrupted */ | ||
97 | #define ELIBMAX 82 /* Attempting to link in too many shared libraries */ | ||
98 | #define ELIBEXEC 83 /* Cannot exec a shared library directly */ | ||
99 | #define EILSEQ 84 /* Illegal byte sequence */ | ||
100 | #define ERESTART 85 /* Interrupted system call should be restarted */ | ||
101 | #define ESTRPIPE 86 /* Streams pipe error */ | ||
102 | #define EUSERS 87 /* Too many users */ | ||
103 | #define ENOTSOCK 88 /* Socket operation on non-socket */ | ||
104 | #define EDESTADDRREQ 89 /* Destination address required */ | ||
105 | #define EMSGSIZE 90 /* Message too long */ | ||
106 | #define EPROTOTYPE 91 /* Protocol wrong type for socket */ | ||
107 | #define ENOPROTOOPT 92 /* Protocol not available */ | ||
108 | #define EPROTONOSUPPORT 93 /* Protocol not supported */ | ||
109 | #define ESOCKTNOSUPPORT 94 /* Socket type not supported */ | ||
110 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | ||
111 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | ||
112 | #define EAFNOSUPPORT 97 /* Address family not supported by protocol */ | ||
113 | #define EADDRINUSE 98 /* Address already in use */ | ||
114 | #define EADDRNOTAVAIL 99 /* Cannot assign requested address */ | ||
115 | #define ENETDOWN 100 /* Network is down */ | ||
116 | #define ENETUNREACH 101 /* Network is unreachable */ | ||
117 | #define ENETRESET 102 /* Network dropped connection because of reset */ | ||
118 | #define ECONNABORTED 103 /* Software caused connection abort */ | ||
119 | #define ECONNRESET 104 /* Connection reset by peer */ | ||
120 | #define ENOBUFS 105 /* No buffer space available */ | ||
121 | #define EISCONN 106 /* Transport endpoint is already connected */ | ||
122 | #define ENOTCONN 107 /* Transport endpoint is not connected */ | ||
123 | #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ | ||
124 | #define ETOOMANYREFS 109 /* Too many references: cannot splice */ | ||
125 | #define ETIMEDOUT 110 /* Connection timed out */ | ||
126 | #define ECONNREFUSED 111 /* Connection refused */ | ||
127 | #define EHOSTDOWN 112 /* Host is down */ | ||
128 | #define EHOSTUNREACH 113 /* No route to host */ | ||
129 | #define EALREADY 114 /* Operation already in progress */ | ||
130 | #define EINPROGRESS 115 /* Operation now in progress */ | ||
131 | #define ESTALE 116 /* Stale NFS file handle */ | ||
132 | #define EUCLEAN 117 /* Structure needs cleaning */ | ||
133 | #define ENOTNAM 118 /* Not a XENIX named type file */ | ||
134 | #define ENAVAIL 119 /* No XENIX semaphores available */ | ||
135 | #define EISNAM 120 /* Is a named type file */ | ||
136 | #define EREMOTEIO 121 /* Remote I/O error */ | ||
137 | #define EDQUOT 122 /* Quota exceeded */ | ||
138 | |||
139 | #define ENOMEDIUM 123 /* No medium found */ | ||
140 | #define EMEDIUMTYPE 124 /* Wrong medium type */ | ||
141 | |||
142 | #endif /* _XTENSA_ERRNO_H */ | ||
diff --git a/include/asm-xtensa/fcntl.h b/include/asm-xtensa/fcntl.h new file mode 100644 index 000000000000..48876bb727d2 --- /dev/null +++ b/include/asm-xtensa/fcntl.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/fcntl.h | ||
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 | * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle | ||
9 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_FCNTL_H | ||
13 | #define _XTENSA_FCNTL_H | ||
14 | |||
15 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
16 | located on an ext2 file system */ | ||
17 | #define O_ACCMODE 0x0003 | ||
18 | #define O_RDONLY 0x0000 | ||
19 | #define O_WRONLY 0x0001 | ||
20 | #define O_RDWR 0x0002 | ||
21 | #define O_APPEND 0x0008 | ||
22 | #define O_SYNC 0x0010 | ||
23 | #define O_NONBLOCK 0x0080 | ||
24 | #define O_CREAT 0x0100 /* not fcntl */ | ||
25 | #define O_TRUNC 0x0200 /* not fcntl */ | ||
26 | #define O_EXCL 0x0400 /* not fcntl */ | ||
27 | #define O_NOCTTY 0x0800 /* not fcntl */ | ||
28 | #define FASYNC 0x1000 /* fcntl, for BSD compatibility */ | ||
29 | #define O_LARGEFILE 0x2000 /* allow large file opens - currently ignored */ | ||
30 | #define O_DIRECT 0x8000 /* direct disk access hint - currently ignored*/ | ||
31 | #define O_DIRECTORY 0x10000 /* must be a directory */ | ||
32 | #define O_NOFOLLOW 0x20000 /* don't follow links */ | ||
33 | #define O_NOATIME 0x100000 | ||
34 | |||
35 | #define O_NDELAY O_NONBLOCK | ||
36 | |||
37 | #define F_DUPFD 0 /* dup */ | ||
38 | #define F_GETFD 1 /* get close_on_exec */ | ||
39 | #define F_SETFD 2 /* set/clear close_on_exec */ | ||
40 | #define F_GETFL 3 /* get file->f_flags */ | ||
41 | #define F_SETFL 4 /* set file->f_flags */ | ||
42 | #define F_GETLK 14 | ||
43 | #define F_GETLK64 15 | ||
44 | #define F_SETLK 6 | ||
45 | #define F_SETLKW 7 | ||
46 | #define F_SETLK64 16 | ||
47 | #define F_SETLKW64 17 | ||
48 | |||
49 | #define F_SETOWN 24 /* for sockets. */ | ||
50 | #define F_GETOWN 23 /* for sockets. */ | ||
51 | #define F_SETSIG 10 /* for sockets. */ | ||
52 | #define F_GETSIG 11 /* for sockets. */ | ||
53 | |||
54 | /* for F_[GET|SET]FL */ | ||
55 | #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ | ||
56 | |||
57 | /* for posix fcntl() and lockf() */ | ||
58 | #define F_RDLCK 0 | ||
59 | #define F_WRLCK 1 | ||
60 | #define F_UNLCK 2 | ||
61 | |||
62 | /* for old implementation of bsd flock () */ | ||
63 | #define F_EXLCK 4 /* or 3 */ | ||
64 | #define F_SHLCK 8 /* or 4 */ | ||
65 | |||
66 | /* for leases */ | ||
67 | #define F_INPROGRESS 16 | ||
68 | |||
69 | /* operations for bsd flock(), also used by the kernel implementation */ | ||
70 | #define LOCK_SH 1 /* shared lock */ | ||
71 | #define LOCK_EX 2 /* exclusive lock */ | ||
72 | #define LOCK_NB 4 /* or'd with one of the above to prevent | ||
73 | blocking */ | ||
74 | #define LOCK_UN 8 /* remove lock */ | ||
75 | |||
76 | #define LOCK_MAND 32 /* This is a mandatory flock ... */ | ||
77 | #define LOCK_READ 64 /* which allows concurrent read operations */ | ||
78 | #define LOCK_WRITE 128 /* which allows concurrent write operations */ | ||
79 | #define LOCK_RW 192 /* which allows concurrent read & write ops */ | ||
80 | |||
81 | typedef struct flock { | ||
82 | short l_type; | ||
83 | short l_whence; | ||
84 | __kernel_off_t l_start; | ||
85 | __kernel_off_t l_len; | ||
86 | long l_sysid; | ||
87 | __kernel_pid_t l_pid; | ||
88 | long pad[4]; | ||
89 | } flock_t; | ||
90 | |||
91 | struct flock64 { | ||
92 | short l_type; | ||
93 | short l_whence; | ||
94 | __kernel_off_t l_start; | ||
95 | __kernel_off_t l_len; | ||
96 | pid_t l_pid; | ||
97 | }; | ||
98 | |||
99 | #define F_LINUX_SPECIFIC_BASE 1024 | ||
100 | |||
101 | #endif /* _XTENSA_FCNTL_H */ | ||
diff --git a/include/asm-xtensa/fixmap.h b/include/asm-xtensa/fixmap.h new file mode 100644 index 000000000000..4423b8ad4954 --- /dev/null +++ b/include/asm-xtensa/fixmap.h | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/fixmap.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_FIXMAP_H | ||
12 | #define _XTENSA_FIXMAP_H | ||
13 | |||
14 | #include <asm/processor.h> | ||
15 | |||
16 | #ifdef CONFIG_MMU | ||
17 | |||
18 | /* | ||
19 | * Here we define all the compile-time virtual addresses. | ||
20 | */ | ||
21 | |||
22 | #if XCHAL_SEG_MAPPABLE_VADDR != 0 | ||
23 | # error "Current port requires virtual user space starting at 0" | ||
24 | #endif | ||
25 | #if XCHAL_SEG_MAPPABLE_SIZE < 0x80000000 | ||
26 | # error "Current port requires at least 0x8000000 bytes for user space" | ||
27 | #endif | ||
28 | |||
29 | /* Verify instruction/data ram/rom and xlmi don't overlay vmalloc space. */ | ||
30 | |||
31 | #define __IN_VMALLOC(addr) \ | ||
32 | (((addr) >= VMALLOC_START) && ((addr) < VMALLOC_END)) | ||
33 | #define __SPAN_VMALLOC(start,end) \ | ||
34 | (((start) < VMALLOC_START) && ((end) >= VMALLOC_END)) | ||
35 | #define INSIDE_VMALLOC(start,end) \ | ||
36 | (__IN_VMALLOC((start)) || __IN_VMALLOC(end) || __SPAN_VMALLOC((start),(end))) | ||
37 | |||
38 | #if XCHAL_NUM_INSTROM | ||
39 | # if XCHAL_NUM_INSTROM == 1 | ||
40 | # if INSIDE_VMALLOC(XCHAL_INSTROM0_VADDR,XCHAL_INSTROM0_VADDR+XCHAL_INSTROM0_SIZE) | ||
41 | # error vmalloc range conflicts with instrom0 | ||
42 | # endif | ||
43 | # endif | ||
44 | # if XCHAL_NUM_INSTROM == 2 | ||
45 | # if INSIDE_VMALLOC(XCHAL_INSTROM1_VADDR,XCHAL_INSTROM1_VADDR+XCHAL_INSTROM1_SIZE) | ||
46 | # error vmalloc range conflicts with instrom1 | ||
47 | # endif | ||
48 | # endif | ||
49 | #endif | ||
50 | |||
51 | #if XCHAL_NUM_INSTRAM | ||
52 | # if XCHAL_NUM_INSTRAM == 1 | ||
53 | # if INSIDE_VMALLOC(XCHAL_INSTRAM0_VADDR,XCHAL_INSTRAM0_VADDR+XCHAL_INSTRAM0_SIZE) | ||
54 | # error vmalloc range conflicts with instram0 | ||
55 | # endif | ||
56 | # endif | ||
57 | # if XCHAL_NUM_INSTRAM == 2 | ||
58 | # if INSIDE_VMALLOC(XCHAL_INSTRAM1_VADDR,XCHAL_INSTRAM1_VADDR+XCHAL_INSTRAM1_SIZE) | ||
59 | # error vmalloc range conflicts with instram1 | ||
60 | # endif | ||
61 | # endif | ||
62 | #endif | ||
63 | |||
64 | #if XCHAL_NUM_DATAROM | ||
65 | # if XCHAL_NUM_DATAROM == 1 | ||
66 | # if INSIDE_VMALLOC(XCHAL_DATAROM0_VADDR,XCHAL_DATAROM0_VADDR+XCHAL_DATAROM0_SIZE) | ||
67 | # error vmalloc range conflicts with datarom0 | ||
68 | # endif | ||
69 | # endif | ||
70 | # if XCHAL_NUM_DATAROM == 2 | ||
71 | # if INSIDE_VMALLOC(XCHAL_DATAROM1_VADDR,XCHAL_DATAROM1_VADDR+XCHAL_DATAROM1_SIZE) | ||
72 | # error vmalloc range conflicts with datarom1 | ||
73 | # endif | ||
74 | # endif | ||
75 | #endif | ||
76 | |||
77 | #if XCHAL_NUM_DATARAM | ||
78 | # if XCHAL_NUM_DATARAM == 1 | ||
79 | # if INSIDE_VMALLOC(XCHAL_DATARAM0_VADDR,XCHAL_DATARAM0_VADDR+XCHAL_DATARAM0_SIZE) | ||
80 | # error vmalloc range conflicts with dataram0 | ||
81 | # endif | ||
82 | # endif | ||
83 | # if XCHAL_NUM_DATARAM == 2 | ||
84 | # if INSIDE_VMALLOC(XCHAL_DATARAM1_VADDR,XCHAL_DATARAM1_VADDR+XCHAL_DATARAM1_SIZE) | ||
85 | # error vmalloc range conflicts with dataram1 | ||
86 | # endif | ||
87 | # endif | ||
88 | #endif | ||
89 | |||
90 | #if XCHAL_NUM_XLMI | ||
91 | # if XCHAL_NUM_XLMI == 1 | ||
92 | # if INSIDE_VMALLOC(XCHAL_XLMI0_VADDR,XCHAL_XLMI0_VADDR+XCHAL_XLMI0_SIZE) | ||
93 | # error vmalloc range conflicts with xlmi0 | ||
94 | # endif | ||
95 | # endif | ||
96 | # if XCHAL_NUM_XLMI == 2 | ||
97 | # if INSIDE_VMALLOC(XCHAL_XLMI1_VADDR,XCHAL_XLMI1_VADDR+XCHAL_XLMI1_SIZE) | ||
98 | # error vmalloc range conflicts with xlmi1 | ||
99 | # endif | ||
100 | # endif | ||
101 | #endif | ||
102 | |||
103 | #if (XCHAL_NUM_INSTROM > 2) || \ | ||
104 | (XCHAL_NUM_INSTRAM > 2) || \ | ||
105 | (XCHAL_NUM_DATARAM > 2) || \ | ||
106 | (XCHAL_NUM_DATAROM > 2) || \ | ||
107 | (XCHAL_NUM_XLMI > 2) | ||
108 | # error Insufficient checks on vmalloc above for more than 2 devices | ||
109 | #endif | ||
110 | |||
111 | /* | ||
112 | * USER_VM_SIZE does not necessarily equal TASK_SIZE. We bumped | ||
113 | * TASK_SIZE down to 0x4000000 to simplify the handling of windowed | ||
114 | * call instructions (currently limited to a range of 1 GByte). User | ||
115 | * tasks may very well reclaim the VM space from 0x40000000 to | ||
116 | * 0x7fffffff in the future, so we do not want the kernel becoming | ||
117 | * accustomed to having any of its stuff (e.g., page tables) in this | ||
118 | * region. This VM region is no-man's land for now. | ||
119 | */ | ||
120 | |||
121 | #define USER_VM_START XCHAL_SEG_MAPPABLE_VADDR | ||
122 | #define USER_VM_SIZE 0x80000000 | ||
123 | |||
124 | /* Size of page table: */ | ||
125 | |||
126 | #define PGTABLE_SIZE_BITS (32 - XCHAL_MMU_MIN_PTE_PAGE_SIZE + 2) | ||
127 | #define PGTABLE_SIZE (1L << PGTABLE_SIZE_BITS) | ||
128 | |||
129 | /* All kernel-mappable space: */ | ||
130 | |||
131 | #define KERNEL_ALLMAP_START (USER_VM_START + USER_VM_SIZE) | ||
132 | #define KERNEL_ALLMAP_SIZE (XCHAL_SEG_MAPPABLE_SIZE - KERNEL_ALLMAP_START) | ||
133 | |||
134 | /* Carve out page table at start of kernel-mappable area: */ | ||
135 | |||
136 | #if KERNEL_ALLMAP_SIZE < PGTABLE_SIZE | ||
137 | #error "Gimme some space for page table!" | ||
138 | #endif | ||
139 | #define PGTABLE_START KERNEL_ALLMAP_START | ||
140 | |||
141 | /* Remaining kernel-mappable space: */ | ||
142 | |||
143 | #define KERNEL_MAPPED_START (KERNEL_ALLMAP_START + PGTABLE_SIZE) | ||
144 | #define KERNEL_MAPPED_SIZE (KERNEL_ALLMAP_SIZE - PGTABLE_SIZE) | ||
145 | |||
146 | #if KERNEL_MAPPED_SIZE < 0x01000000 /* 16 MB is arbitrary for now */ | ||
147 | # error "Shouldn't the kernel have at least *some* mappable space?" | ||
148 | #endif | ||
149 | |||
150 | #define MAX_LOW_MEMORY XCHAL_KSEG_CACHED_SIZE | ||
151 | |||
152 | #endif | ||
153 | |||
154 | /* | ||
155 | * Some constants used elsewhere, but perhaps only in Xtensa header | ||
156 | * files, so maybe we can get rid of some and access compile-time HAL | ||
157 | * directly... | ||
158 | * | ||
159 | * Note: We assume that system RAM is located at the very start of the | ||
160 | * kernel segments !! | ||
161 | */ | ||
162 | #define KERNEL_VM_LOW XCHAL_KSEG_CACHED_VADDR | ||
163 | #define KERNEL_VM_HIGH XCHAL_KSEG_BYPASS_VADDR | ||
164 | #define KERNEL_SPACE XCHAL_KSEG_CACHED_VADDR | ||
165 | |||
166 | /* | ||
167 | * Returns the physical/virtual addresses of the kernel space | ||
168 | * (works with the cached kernel segment only, which is the | ||
169 | * one normally used for kernel operation). | ||
170 | */ | ||
171 | |||
172 | /* PHYSICAL BYPASS CACHED | ||
173 | * | ||
174 | * bypass vaddr bypass paddr * cached vaddr | ||
175 | * cached vaddr cached paddr bypass vaddr * | ||
176 | * bypass paddr * bypass vaddr cached vaddr | ||
177 | * cached paddr * bypass vaddr cached vaddr | ||
178 | * other * * * | ||
179 | */ | ||
180 | |||
181 | #define PHYSADDR(a) \ | ||
182 | (((unsigned)(a) >= XCHAL_KSEG_BYPASS_VADDR \ | ||
183 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_VADDR + XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
184 | (unsigned)(a) - XCHAL_KSEG_BYPASS_VADDR + XCHAL_KSEG_BYPASS_PADDR : \ | ||
185 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_VADDR \ | ||
186 | && (unsigned)(a) < XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_CACHED_SIZE) ? \ | ||
187 | (unsigned)(a) - XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_CACHED_PADDR : \ | ||
188 | (unsigned)(a)) | ||
189 | |||
190 | #define BYPASS_ADDR(a) \ | ||
191 | (((unsigned)(a) >= XCHAL_KSEG_BYPASS_PADDR \ | ||
192 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
193 | (unsigned)(a) - XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_BYPASS_VADDR : \ | ||
194 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_PADDR \ | ||
195 | && (unsigned)(a) < XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_CACHED_SIZE) ? \ | ||
196 | (unsigned)(a) - XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_BYPASS_VADDR : \ | ||
197 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_VADDR \ | ||
198 | && (unsigned)(a) < XCHAL_KSEG_CACHED_VADDR+XCHAL_KSEG_CACHED_SIZE)? \ | ||
199 | (unsigned)(a) - XCHAL_KSEG_CACHED_VADDR+XCHAL_KSEG_BYPASS_VADDR: \ | ||
200 | (unsigned)(a)) | ||
201 | |||
202 | #define CACHED_ADDR(a) \ | ||
203 | (((unsigned)(a) >= XCHAL_KSEG_BYPASS_PADDR \ | ||
204 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
205 | (unsigned)(a) - XCHAL_KSEG_BYPASS_PADDR + XCHAL_KSEG_CACHED_VADDR : \ | ||
206 | ((unsigned)(a) >= XCHAL_KSEG_CACHED_PADDR \ | ||
207 | && (unsigned)(a) < XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_CACHED_SIZE) ? \ | ||
208 | (unsigned)(a) - XCHAL_KSEG_CACHED_PADDR + XCHAL_KSEG_CACHED_VADDR : \ | ||
209 | ((unsigned)(a) >= XCHAL_KSEG_BYPASS_VADDR \ | ||
210 | && (unsigned)(a) < XCHAL_KSEG_BYPASS_VADDR+XCHAL_KSEG_BYPASS_SIZE) ? \ | ||
211 | (unsigned)(a) - XCHAL_KSEG_BYPASS_VADDR+XCHAL_KSEG_CACHED_VADDR : \ | ||
212 | (unsigned)(a)) | ||
213 | |||
214 | #define PHYSADDR_IO(a) \ | ||
215 | (((unsigned)(a) >= XCHAL_KIO_BYPASS_VADDR \ | ||
216 | && (unsigned)(a) < XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
217 | (unsigned)(a) - XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_BYPASS_PADDR : \ | ||
218 | ((unsigned)(a) >= XCHAL_KIO_CACHED_VADDR \ | ||
219 | && (unsigned)(a) < XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
220 | (unsigned)(a) - XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_CACHED_PADDR : \ | ||
221 | (unsigned)(a)) | ||
222 | |||
223 | #define BYPASS_ADDR_IO(a) \ | ||
224 | (((unsigned)(a) >= XCHAL_KIO_BYPASS_PADDR \ | ||
225 | && (unsigned)(a) < XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
226 | (unsigned)(a) - XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_BYPASS_VADDR : \ | ||
227 | ((unsigned)(a) >= XCHAL_KIO_CACHED_PADDR \ | ||
228 | && (unsigned)(a) < XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
229 | (unsigned)(a) - XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_BYPASS_VADDR : \ | ||
230 | ((unsigned)(a) >= XCHAL_KIO_CACHED_VADDR \ | ||
231 | && (unsigned)(a) < XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
232 | (unsigned)(a) - XCHAL_KIO_CACHED_VADDR + XCHAL_KIO_BYPASS_VADDR : \ | ||
233 | (unsigned)(a)) | ||
234 | |||
235 | #define CACHED_ADDR_IO(a) \ | ||
236 | (((unsigned)(a) >= XCHAL_KIO_BYPASS_PADDR \ | ||
237 | && (unsigned)(a) < XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
238 | (unsigned)(a) - XCHAL_KIO_BYPASS_PADDR + XCHAL_KIO_CACHED_VADDR : \ | ||
239 | ((unsigned)(a) >= XCHAL_KIO_CACHED_PADDR \ | ||
240 | && (unsigned)(a) < XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_CACHED_SIZE) ? \ | ||
241 | (unsigned)(a) - XCHAL_KIO_CACHED_PADDR + XCHAL_KIO_CACHED_VADDR : \ | ||
242 | ((unsigned)(a) >= XCHAL_KIO_BYPASS_VADDR \ | ||
243 | && (unsigned)(a) < XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_BYPASS_SIZE) ? \ | ||
244 | (unsigned)(a) - XCHAL_KIO_BYPASS_VADDR + XCHAL_KIO_CACHED_VADDR : \ | ||
245 | (unsigned)(a)) | ||
246 | |||
247 | #endif /* _XTENSA_ADDRSPACE_H */ | ||
248 | |||
249 | |||
250 | |||
251 | |||
252 | |||
diff --git a/include/asm-xtensa/hardirq.h b/include/asm-xtensa/hardirq.h new file mode 100644 index 000000000000..e07c76c36b95 --- /dev/null +++ b/include/asm-xtensa/hardirq.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/hardirq.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_HARDIRQ_H | ||
12 | #define _XTENSA_HARDIRQ_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/cache.h> | ||
16 | #include <asm/irq.h> | ||
17 | |||
18 | /* headers.S is sensitive to the offsets of these fields */ | ||
19 | typedef struct { | ||
20 | unsigned int __softirq_pending; | ||
21 | unsigned int __syscall_count; | ||
22 | struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ | ||
23 | unsigned int __nmi_count; /* arch dependent */ | ||
24 | } ____cacheline_aligned irq_cpustat_t; | ||
25 | |||
26 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
27 | |||
28 | #endif /* _XTENSA_HARDIRQ_H */ | ||
diff --git a/include/asm-xtensa/hdreg.h b/include/asm-xtensa/hdreg.h new file mode 100644 index 000000000000..64b80607b80d --- /dev/null +++ b/include/asm-xtensa/hdreg.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/hdreg.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | * Copyright (C) 1994-1996 Linus Torvalds & authors | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_HDREG_H | ||
13 | #define _XTENSA_HDREG_H | ||
14 | |||
15 | typedef unsigned int ide_ioreg_t; | ||
16 | |||
17 | #endif | ||
diff --git a/include/asm-xtensa/highmem.h b/include/asm-xtensa/highmem.h new file mode 100644 index 000000000000..0a046ca5a687 --- /dev/null +++ b/include/asm-xtensa/highmem.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/highmem.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_HIGHMEM_H | ||
12 | #define _XTENSA_HIGHMEM_H | ||
13 | |||
14 | extern void flush_cache_kmaps(void); | ||
15 | |||
16 | #endif | ||
17 | |||
diff --git a/include/asm-xtensa/hw_irq.h b/include/asm-xtensa/hw_irq.h new file mode 100644 index 000000000000..ccf436249eaa --- /dev/null +++ b/include/asm-xtensa/hw_irq.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/hw_irq.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_HW_IRQ_H | ||
12 | #define _XTENSA_HW_IRQ_H | ||
13 | |||
14 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) | ||
15 | { | ||
16 | } | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-xtensa/ide.h b/include/asm-xtensa/ide.h new file mode 100644 index 000000000000..b523cd4a486e --- /dev/null +++ b/include/asm-xtensa/ide.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ide.h | ||
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 | * Copyright (C) 1994 - 1996 Linus Torvalds & authors | ||
9 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
10 | */ | ||
11 | |||
12 | #ifndef _XTENSA_IDE_H | ||
13 | #define _XTENSA_IDE_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/config.h> | ||
18 | |||
19 | #ifndef MAX_HWIFS | ||
20 | # define MAX_HWIFS 1 | ||
21 | #endif | ||
22 | |||
23 | static __inline__ int ide_default_irq(unsigned long base) | ||
24 | { | ||
25 | /* Unsupported! */ | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | static __inline__ unsigned long ide_default_io_base(int index) | ||
30 | { | ||
31 | /* Unsupported! */ | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | #endif /* __KERNEL__ */ | ||
36 | #endif /* _XTENSA_IDE_H */ | ||
diff --git a/include/asm-xtensa/io.h b/include/asm-xtensa/io.h new file mode 100644 index 000000000000..2c471c42ecfc --- /dev/null +++ b/include/asm-xtensa/io.h | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/io.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IO_H | ||
12 | #define _XTENSA_IO_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | #include <linux/config.h> | ||
16 | #include <asm/byteorder.h> | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | #include <asm/fixmap.h> | ||
20 | |||
21 | #define _IO_BASE 0 | ||
22 | |||
23 | |||
24 | /* | ||
25 | * swap functions to change byte order from little-endian to big-endian and | ||
26 | * vice versa. | ||
27 | */ | ||
28 | |||
29 | static inline unsigned short _swapw (unsigned short v) | ||
30 | { | ||
31 | return (v << 8) | (v >> 8); | ||
32 | } | ||
33 | |||
34 | static inline unsigned int _swapl (unsigned int v) | ||
35 | { | ||
36 | return (v << 24) | ((v & 0xff00) << 8) | ((v >> 8) & 0xff00) | (v >> 24); | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Change virtual addresses to physical addresses and vv. | ||
41 | * These are trivial on the 1:1 Linux/Xtensa mapping | ||
42 | */ | ||
43 | |||
44 | extern inline unsigned long virt_to_phys(volatile void * address) | ||
45 | { | ||
46 | return PHYSADDR((unsigned long)address); | ||
47 | } | ||
48 | |||
49 | extern inline void * phys_to_virt(unsigned long address) | ||
50 | { | ||
51 | return (void*) CACHED_ADDR(address); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * IO bus memory addresses are also 1:1 with the physical address | ||
56 | */ | ||
57 | |||
58 | extern inline unsigned long virt_to_bus(volatile void * address) | ||
59 | { | ||
60 | return PHYSADDR((unsigned long)address); | ||
61 | } | ||
62 | |||
63 | extern inline void * bus_to_virt (unsigned long address) | ||
64 | { | ||
65 | return (void *) CACHED_ADDR(address); | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * Change "struct page" to physical address. | ||
70 | */ | ||
71 | |||
72 | extern inline void *ioremap(unsigned long offset, unsigned long size) | ||
73 | { | ||
74 | return (void *) CACHED_ADDR_IO(offset); | ||
75 | } | ||
76 | |||
77 | extern inline void *ioremap_nocache(unsigned long offset, unsigned long size) | ||
78 | { | ||
79 | return (void *) BYPASS_ADDR_IO(offset); | ||
80 | } | ||
81 | |||
82 | extern inline void iounmap(void *addr) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * Generic I/O | ||
88 | */ | ||
89 | |||
90 | #define readb(addr) \ | ||
91 | ({ unsigned char __v = (*(volatile unsigned char *)(addr)); __v; }) | ||
92 | #define readw(addr) \ | ||
93 | ({ unsigned short __v = (*(volatile unsigned short *)(addr)); __v; }) | ||
94 | #define readl(addr) \ | ||
95 | ({ unsigned int __v = (*(volatile unsigned int *)(addr)); __v; }) | ||
96 | #define writeb(b, addr) (void)((*(volatile unsigned char *)(addr)) = (b)) | ||
97 | #define writew(b, addr) (void)((*(volatile unsigned short *)(addr)) = (b)) | ||
98 | #define writel(b, addr) (void)((*(volatile unsigned int *)(addr)) = (b)) | ||
99 | |||
100 | static inline __u8 __raw_readb(const volatile void __iomem *addr) | ||
101 | { | ||
102 | return *(__force volatile __u8 *)(addr); | ||
103 | } | ||
104 | static inline __u16 __raw_readw(const volatile void __iomem *addr) | ||
105 | { | ||
106 | return *(__force volatile __u16 *)(addr); | ||
107 | } | ||
108 | static inline __u32 __raw_readl(const volatile void __iomem *addr) | ||
109 | { | ||
110 | return *(__force volatile __u32 *)(addr); | ||
111 | } | ||
112 | static inline void __raw_writeb(__u8 b, volatile void __iomem *addr) | ||
113 | { | ||
114 | *(__force volatile __u8 *)(addr) = b; | ||
115 | } | ||
116 | static inline void __raw_writew(__u16 b, volatile void __iomem *addr) | ||
117 | { | ||
118 | *(__force volatile __u16 *)(addr) = b; | ||
119 | } | ||
120 | static inline void __raw_writel(__u32 b, volatile void __iomem *addr) | ||
121 | { | ||
122 | *(__force volatile __u32 *)(addr) = b; | ||
123 | } | ||
124 | |||
125 | |||
126 | |||
127 | |||
128 | /* These are the definitions for the x86 IO instructions | ||
129 | * inb/inw/inl/outb/outw/outl, the "string" versions | ||
130 | * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions | ||
131 | * inb_p/inw_p/... | ||
132 | * The macros don't do byte-swapping. | ||
133 | */ | ||
134 | |||
135 | #define inb(port) readb((u8 *)((port)+_IO_BASE)) | ||
136 | #define outb(val, port) writeb((val),(u8 *)((unsigned long)(port)+_IO_BASE)) | ||
137 | #define inw(port) readw((u16 *)((port)+_IO_BASE)) | ||
138 | #define outw(val, port) writew((val),(u16 *)((unsigned long)(port)+_IO_BASE)) | ||
139 | #define inl(port) readl((u32 *)((port)+_IO_BASE)) | ||
140 | #define outl(val, port) writel((val),(u32 *)((unsigned long)(port))) | ||
141 | |||
142 | #define inb_p(port) inb((port)) | ||
143 | #define outb_p(val, port) outb((val), (port)) | ||
144 | #define inw_p(port) inw((port)) | ||
145 | #define outw_p(val, port) outw((val), (port)) | ||
146 | #define inl_p(port) inl((port)) | ||
147 | #define outl_p(val, port) outl((val), (port)) | ||
148 | |||
149 | extern void insb (unsigned long port, void *dst, unsigned long count); | ||
150 | extern void insw (unsigned long port, void *dst, unsigned long count); | ||
151 | extern void insl (unsigned long port, void *dst, unsigned long count); | ||
152 | extern void outsb (unsigned long port, const void *src, unsigned long count); | ||
153 | extern void outsw (unsigned long port, const void *src, unsigned long count); | ||
154 | extern void outsl (unsigned long port, const void *src, unsigned long count); | ||
155 | |||
156 | #define IO_SPACE_LIMIT ~0 | ||
157 | |||
158 | #define memset_io(a,b,c) memset((void *)(a),(b),(c)) | ||
159 | #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) | ||
160 | #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) | ||
161 | |||
162 | /* At this point the Xtensa doesn't provide byte swap instructions */ | ||
163 | |||
164 | #ifdef __XTENSA_EB__ | ||
165 | # define in_8(addr) (*(u8*)(addr)) | ||
166 | # define in_le16(addr) _swapw(*(u16*)(addr)) | ||
167 | # define in_le32(addr) _swapl(*(u32*)(addr)) | ||
168 | # define out_8(b, addr) *(u8*)(addr) = (b) | ||
169 | # define out_le16(b, addr) *(u16*)(addr) = _swapw(b) | ||
170 | # define out_le32(b, addr) *(u32*)(addr) = _swapl(b) | ||
171 | #elif defined(__XTENSA_EL__) | ||
172 | # define in_8(addr) (*(u8*)(addr)) | ||
173 | # define in_le16(addr) (*(u16*)(addr)) | ||
174 | # define in_le32(addr) (*(u32*)(addr)) | ||
175 | # define out_8(b, addr) *(u8*)(addr) = (b) | ||
176 | # define out_le16(b, addr) *(u16*)(addr) = (b) | ||
177 | # define out_le32(b, addr) *(u32*)(addr) = (b) | ||
178 | #else | ||
179 | # error processor byte order undefined! | ||
180 | #endif | ||
181 | |||
182 | |||
183 | /* | ||
184 | * * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
185 | * * access | ||
186 | * */ | ||
187 | #define xlate_dev_mem_ptr(p) __va(p) | ||
188 | |||
189 | /* | ||
190 | * * Convert a virtual cached pointer to an uncached pointer | ||
191 | * */ | ||
192 | #define xlate_dev_kmem_ptr(p) p | ||
193 | |||
194 | |||
195 | #endif /* __KERNEL__ */ | ||
196 | |||
197 | #endif /* _XTENSA_IO_H */ | ||
diff --git a/include/asm-xtensa/ioctl.h b/include/asm-xtensa/ioctl.h new file mode 100644 index 000000000000..856c605d62b1 --- /dev/null +++ b/include/asm-xtensa/ioctl.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ioctl.h | ||
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 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Derived from "include/asm-i386/ioctl.h" | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_IOCTL_H | ||
14 | #define _XTENSA_IOCTL_H | ||
15 | |||
16 | |||
17 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
18 | * size of the parameter structure in the lower 14 bits of the | ||
19 | * upper 16 bits. | ||
20 | * Encoding the size of the parameter structure in the ioctl request | ||
21 | * is useful for catching programs compiled with old versions | ||
22 | * and to avoid overwriting user space outside the user buffer area. | ||
23 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
24 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * The following is for compatibility across the various Linux | ||
29 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
30 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
31 | * bits are indeed used as a type field, so we might just as well make | ||
32 | * this explicit here. Please be sure to use the decoding macros | ||
33 | * below from now on. | ||
34 | */ | ||
35 | #define _IOC_NRBITS 8 | ||
36 | #define _IOC_TYPEBITS 8 | ||
37 | #define _IOC_SIZEBITS 14 | ||
38 | #define _IOC_DIRBITS 2 | ||
39 | |||
40 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
41 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
42 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
43 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
44 | |||
45 | #define _IOC_NRSHIFT 0 | ||
46 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
47 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
48 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
49 | |||
50 | /* | ||
51 | * Direction bits. | ||
52 | */ | ||
53 | #define _IOC_NONE 0U | ||
54 | #define _IOC_WRITE 1U | ||
55 | #define _IOC_READ 2U | ||
56 | |||
57 | #define _IOC(dir,type,nr,size) \ | ||
58 | (((dir) << _IOC_DIRSHIFT) | \ | ||
59 | ((type) << _IOC_TYPESHIFT) | \ | ||
60 | ((nr) << _IOC_NRSHIFT) | \ | ||
61 | ((size) << _IOC_SIZESHIFT)) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif | ||
diff --git a/include/asm-xtensa/ioctls.h b/include/asm-xtensa/ioctls.h new file mode 100644 index 000000000000..10c443435c11 --- /dev/null +++ b/include/asm-xtensa/ioctls.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ioctl.h | ||
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 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Derived from "include/asm-i386/ioctls.h" | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_IOCTLS_H | ||
14 | #define _XTENSA_IOCTLS_H | ||
15 | |||
16 | #include <asm/ioctl.h> | ||
17 | |||
18 | #define FIOCLEX _IO('f', 1) | ||
19 | #define FIONCLEX _IO('f', 2) | ||
20 | #define FIOASYNC _IOW('f', 125, int) | ||
21 | #define FIONBIO _IOW('f', 126, int) | ||
22 | #define FIONREAD _IOR('f', 127, int) | ||
23 | #define TIOCINQ FIONREAD | ||
24 | #define FIOQSIZE _IOR('f', 128, loff_t) | ||
25 | |||
26 | #define TCGETS 0x5401 | ||
27 | #define TCSETS 0x5402 | ||
28 | #define TCSETSW 0x5403 | ||
29 | #define TCSETSF 0x5404 | ||
30 | |||
31 | #define TCGETA _IOR('t', 23, struct termio) | ||
32 | #define TCSETA _IOW('t', 24, struct termio) | ||
33 | #define TCSETAW _IOW('t', 25, struct termio) | ||
34 | #define TCSETAF _IOW('t', 28, struct termio) | ||
35 | |||
36 | #define TCSBRK _IO('t', 29) | ||
37 | #define TCXONC _IO('t', 30) | ||
38 | #define TCFLSH _IO('t', 31) | ||
39 | |||
40 | #define TIOCSWINSZ _IOW('t', 103, struct winsize) | ||
41 | #define TIOCGWINSZ _IOR('t', 104, struct winsize) | ||
42 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ | ||
43 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ | ||
44 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ | ||
45 | |||
46 | #define TIOCSPGRP _IOW('t', 118, int) | ||
47 | #define TIOCGPGRP _IOR('t', 119, int) | ||
48 | |||
49 | #define TIOCEXCL _IO('T', 12) | ||
50 | #define TIOCNXCL _IO('T', 13) | ||
51 | #define TIOCSCTTY _IO('T', 14) | ||
52 | |||
53 | #define TIOCSTI _IOW('T', 18, char) | ||
54 | #define TIOCMGET _IOR('T', 21, unsigned int) | ||
55 | #define TIOCMBIS _IOW('T', 22, unsigned int) | ||
56 | #define TIOCMBIC _IOW('T', 23, unsigned int) | ||
57 | #define TIOCMSET _IOW('T', 24, unsigned int) | ||
58 | # define TIOCM_LE 0x001 | ||
59 | # define TIOCM_DTR 0x002 | ||
60 | # define TIOCM_RTS 0x004 | ||
61 | # define TIOCM_ST 0x008 | ||
62 | # define TIOCM_SR 0x010 | ||
63 | # define TIOCM_CTS 0x020 | ||
64 | # define TIOCM_CAR 0x040 | ||
65 | # define TIOCM_RNG 0x080 | ||
66 | # define TIOCM_DSR 0x100 | ||
67 | # define TIOCM_CD TIOCM_CAR | ||
68 | # define TIOCM_RI TIOCM_RNG | ||
69 | |||
70 | #define TIOCGSOFTCAR _IOR('T', 25, unsigned int) | ||
71 | #define TIOCSSOFTCAR _IOW('T', 26, unsigned int) | ||
72 | #define TIOCLINUX _IOW('T', 28, char) | ||
73 | #define TIOCCONS _IO('T', 29) | ||
74 | #define TIOCGSERIAL _IOR('T', 30, struct serial_struct) | ||
75 | #define TIOCSSERIAL _IOW('T', 31, struct serial_struct) | ||
76 | #define TIOCPKT _IOW('T', 32, int) | ||
77 | # define TIOCPKT_DATA 0 | ||
78 | # define TIOCPKT_FLUSHREAD 1 | ||
79 | # define TIOCPKT_FLUSHWRITE 2 | ||
80 | # define TIOCPKT_STOP 4 | ||
81 | # define TIOCPKT_START 8 | ||
82 | # define TIOCPKT_NOSTOP 16 | ||
83 | # define TIOCPKT_DOSTOP 32 | ||
84 | |||
85 | |||
86 | #define TIOCNOTTY _IO('T', 34) | ||
87 | #define TIOCSETD _IOW('T', 35, int) | ||
88 | #define TIOCGETD _IOR('T', 36, int) | ||
89 | #define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/ | ||
90 | #define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/ | ||
91 | #define TIOCSBRK _IO('T', 39) /* BSD compatibility */ | ||
92 | #define TIOCCBRK _IO('T', 40) /* BSD compatibility */ | ||
93 | #define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/ | ||
94 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | ||
95 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | ||
96 | |||
97 | #define TIOCSERCONFIG _IO('T', 83) | ||
98 | #define TIOCSERGWILD _IOR('T', 84, int) | ||
99 | #define TIOCSERSWILD _IOW('T', 85, int) | ||
100 | #define TIOCGLCKTRMIOS 0x5456 | ||
101 | #define TIOCSLCKTRMIOS 0x5457 | ||
102 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
103 | #define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */ | ||
104 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
105 | # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
106 | #define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */ | ||
107 | #define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ | ||
108 | |||
109 | #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ | ||
110 | #define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* read serial port inline interrupt counts */ | ||
111 | |||
112 | #endif /* _XTENSA_IOCTLS_H */ | ||
diff --git a/include/asm-xtensa/ipc.h b/include/asm-xtensa/ipc.h new file mode 100644 index 000000000000..d37bdb4d4c9c --- /dev/null +++ b/include/asm-xtensa/ipc.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ipc.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IPC_H | ||
12 | #define _XTENSA_IPC_H | ||
13 | |||
14 | struct ipc_kludge { | ||
15 | struct msgbuf __user *msgp; | ||
16 | long msgtyp; | ||
17 | }; | ||
18 | |||
19 | #define SEMOP 1 | ||
20 | #define SEMGET 2 | ||
21 | #define SEMCTL 3 | ||
22 | #define SEMTIMEDOP 4 | ||
23 | #define MSGSND 11 | ||
24 | #define MSGRCV 12 | ||
25 | #define MSGGET 13 | ||
26 | #define MSGCTL 14 | ||
27 | #define SHMAT 21 | ||
28 | #define SHMDT 22 | ||
29 | #define SHMGET 23 | ||
30 | #define SHMCTL 24 | ||
31 | |||
32 | #define IPCCALL(version,op) ((version)<<16 | (op)) | ||
33 | |||
34 | #endif /* _XTENSA_IPC_H */ | ||
diff --git a/include/asm-xtensa/ipcbuf.h b/include/asm-xtensa/ipcbuf.h new file mode 100644 index 000000000000..c33aa6a42145 --- /dev/null +++ b/include/asm-xtensa/ipcbuf.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ipcbuf.h | ||
3 | * | ||
4 | * The ipc64_perm structure for the Xtensa architecture. | ||
5 | * Note extra padding because this structure is passed back and forth | ||
6 | * between kernel and user space. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IPCBUF_H | ||
12 | #define _XTENSA_IPCBUF_H | ||
13 | |||
14 | /* | ||
15 | * Pad space is left for: | ||
16 | * - 32-bit mode_t and seq | ||
17 | * - 2 miscellaneous 32-bit values | ||
18 | * | ||
19 | * This file is subject to the terms and conditions of the GNU General | ||
20 | * Public License. See the file "COPYING" in the main directory of | ||
21 | * this archive for more details. | ||
22 | */ | ||
23 | |||
24 | struct ipc64_perm | ||
25 | { | ||
26 | __kernel_key_t key; | ||
27 | __kernel_uid32_t uid; | ||
28 | __kernel_gid32_t gid; | ||
29 | __kernel_uid32_t cuid; | ||
30 | __kernel_gid32_t cgid; | ||
31 | __kernel_mode_t mode; | ||
32 | unsigned long seq; | ||
33 | unsigned long __unused1; | ||
34 | unsigned long __unused2; | ||
35 | }; | ||
36 | |||
37 | #endif /* _XTENSA_IPCBUF_H */ | ||
diff --git a/include/asm-xtensa/irq.h b/include/asm-xtensa/irq.h new file mode 100644 index 000000000000..d984e955938f --- /dev/null +++ b/include/asm-xtensa/irq.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/irq.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_IRQ_H | ||
12 | #define _XTENSA_IRQ_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <asm/platform/hardware.h> | ||
16 | |||
17 | #include <xtensa/config/core.h> | ||
18 | |||
19 | #ifndef PLATFORM_NR_IRQS | ||
20 | # define PLATFORM_NR_IRQS 0 | ||
21 | #endif | ||
22 | #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS | ||
23 | #define NR_IRQS (XTENSA_NR_IRQS + PLATFORM_NR_IRQS) | ||
24 | |||
25 | static __inline__ int irq_canonicalize(int irq) | ||
26 | { | ||
27 | return (irq); | ||
28 | } | ||
29 | |||
30 | struct irqaction; | ||
31 | #if 0 // FIXME | ||
32 | extern void disable_irq_nosync(unsigned int); | ||
33 | extern void disable_irq(unsigned int); | ||
34 | extern void enable_irq(unsigned int); | ||
35 | #endif | ||
36 | |||
37 | #endif /* _XTENSA_IRQ_H */ | ||
diff --git a/include/asm-xtensa/kmap_types.h b/include/asm-xtensa/kmap_types.h new file mode 100644 index 000000000000..9e822d2e3bce --- /dev/null +++ b/include/asm-xtensa/kmap_types.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/kmap_types.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_KMAP_TYPES_H | ||
12 | #define _XTENSA_KMAP_TYPES_H | ||
13 | |||
14 | enum km_type { | ||
15 | KM_BOUNCE_READ, | ||
16 | KM_SKB_SUNRPC_DATA, | ||
17 | KM_SKB_DATA_SOFTIRQ, | ||
18 | KM_USER0, | ||
19 | KM_USER1, | ||
20 | KM_BIO_SRC_IRQ, | ||
21 | KM_BIO_DST_IRQ, | ||
22 | KM_PTE0, | ||
23 | KM_PTE1, | ||
24 | KM_IRQ0, | ||
25 | KM_IRQ1, | ||
26 | KM_SOFTIRQ0, | ||
27 | KM_SOFTIRQ1, | ||
28 | KM_TYPE_NR | ||
29 | }; | ||
30 | |||
31 | #endif /* _XTENSA_KMAP_TYPES_H */ | ||
diff --git a/include/asm-xtensa/linkage.h b/include/asm-xtensa/linkage.h new file mode 100644 index 000000000000..bf2128a99d79 --- /dev/null +++ b/include/asm-xtensa/linkage.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/linkage.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_LINKAGE_H | ||
12 | #define _XTENSA_LINKAGE_H | ||
13 | |||
14 | /* Nothing to do here ... */ | ||
15 | |||
16 | #endif /* _XTENSA_LINKAGE_H */ | ||
diff --git a/include/asm-xtensa/local.h b/include/asm-xtensa/local.h new file mode 100644 index 000000000000..48723e550d14 --- /dev/null +++ b/include/asm-xtensa/local.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/local.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_LOCAL_H | ||
12 | #define _XTENSA_LOCAL_H | ||
13 | |||
14 | #include <asm-generic/local.h> | ||
15 | |||
16 | #endif /* _XTENSA_LOCAL_H */ | ||
diff --git a/include/asm-xtensa/mman.h b/include/asm-xtensa/mman.h new file mode 100644 index 000000000000..9a95a45df996 --- /dev/null +++ b/include/asm-xtensa/mman.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/mman.h | ||
3 | * | ||
4 | * Xtensa Processor memory-manager definitions | ||
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 | * Copyright (C) 1995 by Ralf Baechle | ||
11 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
12 | */ | ||
13 | |||
14 | #ifndef _XTENSA_MMAN_H | ||
15 | #define _XTENSA_MMAN_H | ||
16 | |||
17 | /* | ||
18 | * Protections are chosen from these bits, OR'd together. The | ||
19 | * implementation does not necessarily support PROT_EXEC or PROT_WRITE | ||
20 | * without PROT_READ. The only guarantees are that no writing will be | ||
21 | * allowed without PROT_WRITE and no access will be allowed for PROT_NONE. | ||
22 | */ | ||
23 | |||
24 | #define PROT_NONE 0x0 /* page can not be accessed */ | ||
25 | #define PROT_READ 0x1 /* page can be read */ | ||
26 | #define PROT_WRITE 0x2 /* page can be written */ | ||
27 | #define PROT_EXEC 0x4 /* page can be executed */ | ||
28 | |||
29 | #define PROT_SEM 0x10 /* page may be used for atomic ops */ | ||
30 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ | ||
31 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end fo growsup vma */ | ||
32 | |||
33 | /* | ||
34 | * Flags for mmap | ||
35 | */ | ||
36 | #define MAP_SHARED 0x001 /* Share changes */ | ||
37 | #define MAP_PRIVATE 0x002 /* Changes are private */ | ||
38 | #define MAP_TYPE 0x00f /* Mask for type of mapping */ | ||
39 | #define MAP_FIXED 0x010 /* Interpret addr exactly */ | ||
40 | |||
41 | /* not used by linux, but here to make sure we don't clash with ABI defines */ | ||
42 | #define MAP_RENAME 0x020 /* Assign page to file */ | ||
43 | #define MAP_AUTOGROW 0x040 /* File may grow by writing */ | ||
44 | #define MAP_LOCAL 0x080 /* Copy on fork/sproc */ | ||
45 | #define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */ | ||
46 | |||
47 | /* These are linux-specific */ | ||
48 | #define MAP_NORESERVE 0x0400 /* don't check for reservations */ | ||
49 | #define MAP_ANONYMOUS 0x0800 /* don't use a file */ | ||
50 | #define MAP_GROWSDOWN 0x1000 /* stack-like segment */ | ||
51 | #define MAP_DENYWRITE 0x2000 /* ETXTBSY */ | ||
52 | #define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ | ||
53 | #define MAP_LOCKED 0x8000 /* pages are locked */ | ||
54 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ | ||
55 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ | ||
56 | |||
57 | /* | ||
58 | * Flags for msync | ||
59 | */ | ||
60 | #define MS_ASYNC 0x0001 /* sync memory asynchronously */ | ||
61 | #define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */ | ||
62 | #define MS_SYNC 0x0004 /* synchronous memory sync */ | ||
63 | |||
64 | /* | ||
65 | * Flags for mlockall | ||
66 | */ | ||
67 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
68 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
69 | |||
70 | #define MADV_NORMAL 0x0 /* default page-in behavior */ | ||
71 | #define MADV_RANDOM 0x1 /* page-in minimum required */ | ||
72 | #define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ | ||
73 | #define MADV_WILLNEED 0x3 /* pre-fault pages */ | ||
74 | #define MADV_DONTNEED 0x4 /* discard these pages */ | ||
75 | |||
76 | /* compatibility flags */ | ||
77 | #define MAP_ANON MAP_ANONYMOUS | ||
78 | #define MAP_FILE 0 | ||
79 | |||
80 | #endif /* _XTENSA_MMAN_H */ | ||
diff --git a/include/asm-xtensa/mmu.h b/include/asm-xtensa/mmu.h new file mode 100644 index 000000000000..44c5bb04c55c --- /dev/null +++ b/include/asm-xtensa/mmu.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/mmu.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_MMU_H | ||
12 | #define _XTENSA_MMU_H | ||
13 | |||
14 | /* Default "unsigned long" context */ | ||
15 | typedef unsigned long mm_context_t; | ||
16 | |||
17 | #endif /* _XTENSA_MMU_H */ | ||
diff --git a/include/asm-xtensa/mmu_context.h b/include/asm-xtensa/mmu_context.h new file mode 100644 index 000000000000..1b0801548cd9 --- /dev/null +++ b/include/asm-xtensa/mmu_context.h | |||
@@ -0,0 +1,330 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/mmu_context.h | ||
3 | * | ||
4 | * Switch an MMU context. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_MMU_CONTEXT_H | ||
14 | #define _XTENSA_MMU_CONTEXT_H | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/stringify.h> | ||
18 | |||
19 | #include <asm/pgtable.h> | ||
20 | #include <asm/mmu_context.h> | ||
21 | #include <asm/cacheflush.h> | ||
22 | #include <asm/tlbflush.h> | ||
23 | |||
24 | /* | ||
25 | * Linux was ported to Xtensa assuming all auto-refill ways in set 0 | ||
26 | * had the same properties (a very likely assumption). Multiple sets | ||
27 | * of auto-refill ways will still work properly, but not as optimally | ||
28 | * as the Xtensa designer may have assumed. | ||
29 | * | ||
30 | * We make this case a hard #error, killing the kernel build, to alert | ||
31 | * the developer to this condition (which is more likely an error). | ||
32 | * You super-duper clever developers can change it to a warning or | ||
33 | * remove it altogether if you think you know what you're doing. :) | ||
34 | */ | ||
35 | |||
36 | #if (XCHAL_HAVE_TLBS != 1) | ||
37 | # error "Linux must have an MMU!" | ||
38 | #endif | ||
39 | |||
40 | #if ((XCHAL_ITLB_ARF_WAYS == 0) || (XCHAL_DTLB_ARF_WAYS == 0)) | ||
41 | # error "MMU must have auto-refill ways" | ||
42 | #endif | ||
43 | |||
44 | #if ((XCHAL_ITLB_ARF_SETS != 1) || (XCHAL_DTLB_ARF_SETS != 1)) | ||
45 | # error Linux may not use all auto-refill ways as efficiently as you think | ||
46 | #endif | ||
47 | |||
48 | #if (XCHAL_MMU_MAX_PTE_PAGE_SIZE != XCHAL_MMU_MIN_PTE_PAGE_SIZE) | ||
49 | # error Only one page size allowed! | ||
50 | #endif | ||
51 | |||
52 | extern unsigned long asid_cache; | ||
53 | extern pgd_t *current_pgd; | ||
54 | |||
55 | /* | ||
56 | * Define the number of entries per auto-refill way in set 0 of both I and D | ||
57 | * TLBs. We deal only with set 0 here (an assumption further explained in | ||
58 | * assertions.h). Also, define the total number of ARF entries in both TLBs. | ||
59 | */ | ||
60 | |||
61 | #define ITLB_ENTRIES_PER_ARF_WAY (XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,ENTRIES)) | ||
62 | #define DTLB_ENTRIES_PER_ARF_WAY (XCHAL_DTLB_SET(XCHAL_DTLB_ARF_SET0,ENTRIES)) | ||
63 | |||
64 | #define ITLB_ENTRIES \ | ||
65 | (ITLB_ENTRIES_PER_ARF_WAY * (XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,WAYS))) | ||
66 | #define DTLB_ENTRIES \ | ||
67 | (DTLB_ENTRIES_PER_ARF_WAY * (XCHAL_DTLB_SET(XCHAL_DTLB_ARF_SET0,WAYS))) | ||
68 | |||
69 | |||
70 | /* | ||
71 | * SMALLEST_NTLB_ENTRIES is the smaller of ITLB_ENTRIES and DTLB_ENTRIES. | ||
72 | * In practice, they are probably equal. This macro simplifies function | ||
73 | * flush_tlb_range(). | ||
74 | */ | ||
75 | |||
76 | #if (DTLB_ENTRIES < ITLB_ENTRIES) | ||
77 | # define SMALLEST_NTLB_ENTRIES DTLB_ENTRIES | ||
78 | #else | ||
79 | # define SMALLEST_NTLB_ENTRIES ITLB_ENTRIES | ||
80 | #endif | ||
81 | |||
82 | |||
83 | /* | ||
84 | * asid_cache tracks only the ASID[USER_RING] field of the RASID special | ||
85 | * register, which is the current user-task asid allocation value. | ||
86 | * mm->context has the same meaning. When it comes time to write the | ||
87 | * asid_cache or mm->context values to the RASID special register, we first | ||
88 | * shift the value left by 8, then insert the value. | ||
89 | * ASID[0] always contains the kernel's asid value, and we reserve three | ||
90 | * other asid values that we never assign to user tasks. | ||
91 | */ | ||
92 | |||
93 | #define ASID_INC 0x1 | ||
94 | #define ASID_MASK ((1 << XCHAL_MMU_ASID_BITS) - 1) | ||
95 | |||
96 | /* | ||
97 | * XCHAL_MMU_ASID_INVALID is a configurable Xtensa processor constant | ||
98 | * indicating invalid address space. XCHAL_MMU_ASID_KERNEL is a configurable | ||
99 | * Xtensa processor constant indicating the kernel address space. They can | ||
100 | * be arbitrary values. | ||
101 | * | ||
102 | * We identify three more unique, reserved ASID values to use in the unused | ||
103 | * ring positions. No other user process will be assigned these reserved | ||
104 | * ASID values. | ||
105 | * | ||
106 | * For example, given that | ||
107 | * | ||
108 | * XCHAL_MMU_ASID_INVALID == 0 | ||
109 | * XCHAL_MMU_ASID_KERNEL == 1 | ||
110 | * | ||
111 | * the following maze of #if statements would generate | ||
112 | * | ||
113 | * ASID_RESERVED_1 == 2 | ||
114 | * ASID_RESERVED_2 == 3 | ||
115 | * ASID_RESERVED_3 == 4 | ||
116 | * ASID_FIRST_NONRESERVED == 5 | ||
117 | */ | ||
118 | |||
119 | #if (XCHAL_MMU_ASID_INVALID != XCHAL_MMU_ASID_KERNEL + 1) | ||
120 | # define ASID_RESERVED_1 ((XCHAL_MMU_ASID_KERNEL + 1) & ASID_MASK) | ||
121 | #else | ||
122 | # define ASID_RESERVED_1 ((XCHAL_MMU_ASID_KERNEL + 2) & ASID_MASK) | ||
123 | #endif | ||
124 | |||
125 | #if (XCHAL_MMU_ASID_INVALID != ASID_RESERVED_1 + 1) | ||
126 | # define ASID_RESERVED_2 ((ASID_RESERVED_1 + 1) & ASID_MASK) | ||
127 | #else | ||
128 | # define ASID_RESERVED_2 ((ASID_RESERVED_1 + 2) & ASID_MASK) | ||
129 | #endif | ||
130 | |||
131 | #if (XCHAL_MMU_ASID_INVALID != ASID_RESERVED_2 + 1) | ||
132 | # define ASID_RESERVED_3 ((ASID_RESERVED_2 + 1) & ASID_MASK) | ||
133 | #else | ||
134 | # define ASID_RESERVED_3 ((ASID_RESERVED_2 + 2) & ASID_MASK) | ||
135 | #endif | ||
136 | |||
137 | #if (XCHAL_MMU_ASID_INVALID != ASID_RESERVED_3 + 1) | ||
138 | # define ASID_FIRST_NONRESERVED ((ASID_RESERVED_3 + 1) & ASID_MASK) | ||
139 | #else | ||
140 | # define ASID_FIRST_NONRESERVED ((ASID_RESERVED_3 + 2) & ASID_MASK) | ||
141 | #endif | ||
142 | |||
143 | #define ASID_ALL_RESERVED ( ((ASID_RESERVED_1) << 24) + \ | ||
144 | ((ASID_RESERVED_2) << 16) + \ | ||
145 | ((ASID_RESERVED_3) << 8) + \ | ||
146 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
147 | |||
148 | |||
149 | /* | ||
150 | * NO_CONTEXT is the invalid ASID value that we don't ever assign to | ||
151 | * any user or kernel context. NO_CONTEXT is a better mnemonic than | ||
152 | * XCHAL_MMU_ASID_INVALID, so we use it in code instead. | ||
153 | */ | ||
154 | |||
155 | #define NO_CONTEXT XCHAL_MMU_ASID_INVALID | ||
156 | |||
157 | #if (KERNEL_RING != 0) | ||
158 | # error The KERNEL_RING really should be zero. | ||
159 | #endif | ||
160 | |||
161 | #if (USER_RING >= XCHAL_MMU_RINGS) | ||
162 | # error USER_RING cannot be greater than the highest numbered ring. | ||
163 | #endif | ||
164 | |||
165 | #if (USER_RING == KERNEL_RING) | ||
166 | # error The user and kernel rings really should not be equal. | ||
167 | #endif | ||
168 | |||
169 | #if (USER_RING == 1) | ||
170 | #define ASID_INSERT(x) ( ((ASID_RESERVED_1) << 24) + \ | ||
171 | ((ASID_RESERVED_2) << 16) + \ | ||
172 | (((x) & (ASID_MASK)) << 8) + \ | ||
173 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
174 | |||
175 | #elif (USER_RING == 2) | ||
176 | #define ASID_INSERT(x) ( ((ASID_RESERVED_1) << 24) + \ | ||
177 | (((x) & (ASID_MASK)) << 16) + \ | ||
178 | ((ASID_RESERVED_2) << 8) + \ | ||
179 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
180 | |||
181 | #elif (USER_RING == 3) | ||
182 | #define ASID_INSERT(x) ( (((x) & (ASID_MASK)) << 24) + \ | ||
183 | ((ASID_RESERVED_1) << 16) + \ | ||
184 | ((ASID_RESERVED_2) << 8) + \ | ||
185 | ((XCHAL_MMU_ASID_KERNEL)) ) | ||
186 | |||
187 | #else | ||
188 | #error Goofy value for USER_RING | ||
189 | |||
190 | #endif /* USER_RING == 1 */ | ||
191 | |||
192 | |||
193 | /* | ||
194 | * All unused by hardware upper bits will be considered | ||
195 | * as a software asid extension. | ||
196 | */ | ||
197 | |||
198 | #define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1))) | ||
199 | #define ASID_FIRST_VERSION \ | ||
200 | ((unsigned long)(~ASID_VERSION_MASK) + 1 + ASID_FIRST_NONRESERVED) | ||
201 | |||
202 | extern inline void set_rasid_register (unsigned long val) | ||
203 | { | ||
204 | __asm__ __volatile__ (" wsr %0, "__stringify(RASID)"\n\t" | ||
205 | " isync\n" : : "a" (val)); | ||
206 | } | ||
207 | |||
208 | extern inline unsigned long get_rasid_register (void) | ||
209 | { | ||
210 | unsigned long tmp; | ||
211 | __asm__ __volatile__ (" rsr %0, "__stringify(RASID)"\n\t" : "=a" (tmp)); | ||
212 | return tmp; | ||
213 | } | ||
214 | |||
215 | |||
216 | #if ((XCHAL_MMU_ASID_INVALID == 0) && (XCHAL_MMU_ASID_KERNEL == 1)) | ||
217 | |||
218 | extern inline void | ||
219 | get_new_mmu_context(struct mm_struct *mm, unsigned long asid) | ||
220 | { | ||
221 | extern void flush_tlb_all(void); | ||
222 | if (! ((asid += ASID_INC) & ASID_MASK) ) { | ||
223 | flush_tlb_all(); /* start new asid cycle */ | ||
224 | if (!asid) /* fix version if needed */ | ||
225 | asid = ASID_FIRST_VERSION - ASID_FIRST_NONRESERVED; | ||
226 | asid += ASID_FIRST_NONRESERVED; | ||
227 | } | ||
228 | mm->context = asid_cache = asid; | ||
229 | } | ||
230 | |||
231 | #else | ||
232 | #warning ASID_{INVALID,KERNEL} values impose non-optimal get_new_mmu_context implementation | ||
233 | |||
234 | /* XCHAL_MMU_ASID_INVALID == 0 and XCHAL_MMU_ASID_KERNEL ==1 are | ||
235 | really the best, but if you insist... */ | ||
236 | |||
237 | extern inline int validate_asid (unsigned long asid) | ||
238 | { | ||
239 | switch (asid) { | ||
240 | case XCHAL_MMU_ASID_INVALID: | ||
241 | case XCHAL_MMU_ASID_KERNEL: | ||
242 | case ASID_RESERVED_1: | ||
243 | case ASID_RESERVED_2: | ||
244 | case ASID_RESERVED_3: | ||
245 | return 0; /* can't use these values as ASIDs */ | ||
246 | } | ||
247 | return 1; /* valid */ | ||
248 | } | ||
249 | |||
250 | extern inline void | ||
251 | get_new_mmu_context(struct mm_struct *mm, unsigned long asid) | ||
252 | { | ||
253 | extern void flush_tlb_all(void); | ||
254 | while (1) { | ||
255 | asid += ASID_INC; | ||
256 | if ( ! (asid & ASID_MASK) ) { | ||
257 | flush_tlb_all(); /* start new asid cycle */ | ||
258 | if (!asid) /* fix version if needed */ | ||
259 | asid = ASID_FIRST_VERSION - ASID_FIRST_NONRESERVED; | ||
260 | asid += ASID_FIRST_NONRESERVED; | ||
261 | break; /* no need to validate here */ | ||
262 | } | ||
263 | if (validate_asid (asid & ASID_MASK)) | ||
264 | break; | ||
265 | } | ||
266 | mm->context = asid_cache = asid; | ||
267 | } | ||
268 | |||
269 | #endif | ||
270 | |||
271 | |||
272 | /* | ||
273 | * Initialize the context related info for a new mm_struct | ||
274 | * instance. | ||
275 | */ | ||
276 | |||
277 | extern inline int | ||
278 | init_new_context(struct task_struct *tsk, struct mm_struct *mm) | ||
279 | { | ||
280 | mm->context = NO_CONTEXT; | ||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
285 | struct task_struct *tsk) | ||
286 | { | ||
287 | unsigned long asid = asid_cache; | ||
288 | |||
289 | /* Check if our ASID is of an older version and thus invalid */ | ||
290 | |||
291 | if ((next->context ^ asid) & ASID_VERSION_MASK) | ||
292 | get_new_mmu_context(next, asid); | ||
293 | |||
294 | set_rasid_register (ASID_INSERT(next->context)); | ||
295 | invalidate_page_directory(); | ||
296 | } | ||
297 | |||
298 | #define deactivate_mm(tsk, mm) do { } while(0) | ||
299 | |||
300 | /* | ||
301 | * Destroy context related info for an mm_struct that is about | ||
302 | * to be put to rest. | ||
303 | */ | ||
304 | extern inline void destroy_context(struct mm_struct *mm) | ||
305 | { | ||
306 | /* Nothing to do. */ | ||
307 | } | ||
308 | |||
309 | /* | ||
310 | * After we have set current->mm to a new value, this activates | ||
311 | * the context for the new mm so we see the new mappings. | ||
312 | */ | ||
313 | extern inline void | ||
314 | activate_mm(struct mm_struct *prev, struct mm_struct *next) | ||
315 | { | ||
316 | /* Unconditionally get a new ASID. */ | ||
317 | |||
318 | get_new_mmu_context(next, asid_cache); | ||
319 | set_rasid_register (ASID_INSERT(next->context)); | ||
320 | invalidate_page_directory(); | ||
321 | } | ||
322 | |||
323 | |||
324 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
325 | { | ||
326 | /* Nothing to do. */ | ||
327 | |||
328 | } | ||
329 | |||
330 | #endif /* _XTENSA_MMU_CONTEXT_H */ | ||
diff --git a/include/asm-xtensa/module.h b/include/asm-xtensa/module.h new file mode 100644 index 000000000000..ffb25bfdf6a1 --- /dev/null +++ b/include/asm-xtensa/module.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/module.h | ||
3 | * | ||
4 | * This file contains the module code specific to the Xtensa architecture. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_MODULE_H | ||
14 | #define _XTENSA_MODULE_H | ||
15 | |||
16 | struct mod_arch_specific | ||
17 | { | ||
18 | /* Module support is not completely implemented. */ | ||
19 | }; | ||
20 | |||
21 | #define Elf_Shdr Elf32_Shdr | ||
22 | #define Elf_Sym Elf32_Sym | ||
23 | #define Elf_Ehdr Elf32_Ehdr | ||
24 | |||
25 | #endif /* _XTENSA_MODULE_H */ | ||
diff --git a/include/asm-xtensa/msgbuf.h b/include/asm-xtensa/msgbuf.h new file mode 100644 index 000000000000..693c96755280 --- /dev/null +++ b/include/asm-xtensa/msgbuf.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/msgbuf.h | ||
3 | * | ||
4 | * The msqid64_ds structure for the Xtensa architecture. | ||
5 | * Note extra padding because this structure is passed back and forth | ||
6 | * between kernel and user space. | ||
7 | * | ||
8 | * Pad space is left for: | ||
9 | * - 64-bit time_t to solve y2038 problem | ||
10 | * - 2 miscellaneous 32-bit values | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General | ||
13 | * Public License. See the file "COPYING" in the main directory of | ||
14 | * this archive for more details. | ||
15 | */ | ||
16 | |||
17 | #ifndef _XTENSA_MSGBUF_H | ||
18 | #define _XTENSA_MSGBUF_H | ||
19 | |||
20 | struct msqid64_ds { | ||
21 | struct ipc64_perm msg_perm; | ||
22 | #ifdef __XTENSA_EB__ | ||
23 | unsigned int __unused1; | ||
24 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
25 | unsigned int __unused2; | ||
26 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
27 | unsigned int __unused3; | ||
28 | __kernel_time_t msg_ctime; /* last change time */ | ||
29 | #elif defined(__XTENSA_EL__) | ||
30 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
31 | unsigned int __unused1; | ||
32 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
33 | unsigned int __unused2; | ||
34 | __kernel_time_t msg_ctime; /* last change time */ | ||
35 | unsigned int __unused3; | ||
36 | #else | ||
37 | # error processor byte order undefined! | ||
38 | #endif | ||
39 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
40 | unsigned long msg_qnum; /* number of messages in queue */ | ||
41 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
42 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
43 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
44 | unsigned long __unused4; | ||
45 | unsigned long __unused5; | ||
46 | }; | ||
47 | |||
48 | #endif /* _XTENSA_MSGBUF_H */ | ||
diff --git a/include/asm-xtensa/namei.h b/include/asm-xtensa/namei.h new file mode 100644 index 000000000000..3fdff039d27d --- /dev/null +++ b/include/asm-xtensa/namei.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/namei.h | ||
3 | * | ||
4 | * Included from linux/fs/namei.c | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_NAMEI_H | ||
14 | #define _XTENSA_NAMEI_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | /* This dummy routine maybe changed to something useful | ||
19 | * for /usr/gnemul/ emulation stuff. | ||
20 | * Look at asm-sparc/namei.h for details. | ||
21 | */ | ||
22 | |||
23 | #define __emul_prefix() NULL | ||
24 | |||
25 | #endif /* __KERNEL__ */ | ||
26 | #endif /* _XTENSA_NAMEI_H */ | ||
diff --git a/include/asm-xtensa/page.h b/include/asm-xtensa/page.h new file mode 100644 index 000000000000..b495e5b5a942 --- /dev/null +++ b/include/asm-xtensa/page.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/page.h | ||
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 version2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PAGE_H | ||
12 | #define _XTENSA_PAGE_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | #include <linux/config.h> | ||
18 | |||
19 | /* | ||
20 | * PAGE_SHIFT determines the page size | ||
21 | * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary | ||
22 | */ | ||
23 | |||
24 | #define PAGE_SHIFT XCHAL_MMU_MIN_PTE_PAGE_SIZE | ||
25 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
26 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
27 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE - 1) & PAGE_MASK) | ||
28 | |||
29 | #define DCACHE_WAY_SIZE (XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS) | ||
30 | #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR | ||
31 | |||
32 | #ifdef __ASSEMBLY__ | ||
33 | |||
34 | #define __pgprot(x) (x) | ||
35 | |||
36 | #else | ||
37 | |||
38 | /* | ||
39 | * These are used to make use of C type-checking.. | ||
40 | */ | ||
41 | |||
42 | typedef struct { unsigned long pte; } pte_t; /* page table entry */ | ||
43 | typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */ | ||
44 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
45 | |||
46 | #define pte_val(x) ((x).pte) | ||
47 | #define pgd_val(x) ((x).pgd) | ||
48 | #define pgprot_val(x) ((x).pgprot) | ||
49 | |||
50 | #define __pte(x) ((pte_t) { (x) } ) | ||
51 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
52 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
53 | |||
54 | /* | ||
55 | * Pure 2^n version of get_order | ||
56 | */ | ||
57 | |||
58 | extern __inline__ int get_order(unsigned long size) | ||
59 | { | ||
60 | int order; | ||
61 | #ifndef XCHAL_HAVE_NSU | ||
62 | unsigned long x1, x2, x4, x8, x16; | ||
63 | |||
64 | size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
65 | x1 = size & 0xAAAAAAAA; | ||
66 | x2 = size & 0xCCCCCCCC; | ||
67 | x4 = size & 0xF0F0F0F0; | ||
68 | x8 = size & 0xFF00FF00; | ||
69 | x16 = size & 0xFFFF0000; | ||
70 | order = x2 ? 2 : 0; | ||
71 | order += (x16 != 0) * 16; | ||
72 | order += (x8 != 0) * 8; | ||
73 | order += (x4 != 0) * 4; | ||
74 | order += (x1 != 0); | ||
75 | |||
76 | return order; | ||
77 | #else | ||
78 | size = (size - 1) >> PAGE_SHIFT; | ||
79 | asm ("nsau %0, %1" : "=r" (order) : "r" (size)); | ||
80 | return 32 - order; | ||
81 | #endif | ||
82 | } | ||
83 | |||
84 | |||
85 | struct page; | ||
86 | extern void clear_page(void *page); | ||
87 | extern void copy_page(void *to, void *from); | ||
88 | |||
89 | /* | ||
90 | * If we have cache aliasing and writeback caches, we might have to do | ||
91 | * some extra work | ||
92 | */ | ||
93 | |||
94 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) | ||
95 | void clear_user_page(void *addr, unsigned long vaddr, struct page* page); | ||
96 | void copy_user_page(void *to,void* from,unsigned long vaddr,struct page* page); | ||
97 | #else | ||
98 | # define clear_user_page(page,vaddr,pg) clear_page(page) | ||
99 | # define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
100 | #endif | ||
101 | |||
102 | /* | ||
103 | * This handles the memory map. We handle pages at | ||
104 | * XCHAL_KSEG_CACHED_VADDR for kernels with 32 bit address space. | ||
105 | * These macros are for conversion of kernel address, not user | ||
106 | * addresses. | ||
107 | */ | ||
108 | |||
109 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) | ||
110 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | ||
111 | #define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) | ||
112 | #ifndef CONFIG_DISCONTIGMEM | ||
113 | # define pfn_to_page(pfn) (mem_map + (pfn)) | ||
114 | # define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
115 | #else | ||
116 | # error CONFIG_DISCONTIGMEM not supported | ||
117 | #endif | ||
118 | |||
119 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
120 | #define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) | ||
121 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
122 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
123 | |||
124 | #define WANT_PAGE_VIRTUAL | ||
125 | |||
126 | |||
127 | #endif /* __ASSEMBLY__ */ | ||
128 | |||
129 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
130 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
131 | |||
132 | #endif /* __KERNEL__ */ | ||
133 | #endif /* _XTENSA_PAGE_H */ | ||
diff --git a/include/asm-xtensa/page.h.n b/include/asm-xtensa/page.h.n new file mode 100644 index 000000000000..546cc6624f24 --- /dev/null +++ b/include/asm-xtensa/page.h.n | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/page.h | ||
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 version2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PAGE_H | ||
12 | #define _XTENSA_PAGE_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | #include <linux/config.h> | ||
18 | |||
19 | /* | ||
20 | * PAGE_SHIFT determines the page size | ||
21 | * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary | ||
22 | */ | ||
23 | #define PAGE_SHIFT XCHAL_MMU_MIN_PTE_PAGE_SIZE | ||
24 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
25 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
26 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE - 1) & PAGE_MASK) | ||
27 | |||
28 | #define DCACHE_WAY_SIZE (XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS) | ||
29 | #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR | ||
30 | |||
31 | #ifdef __ASSEMBLY__ | ||
32 | |||
33 | #define __pgprot(x) (x) | ||
34 | |||
35 | #else | ||
36 | |||
37 | |||
38 | /* | ||
39 | * These are used to make use of C type-checking.. | ||
40 | */ | ||
41 | typedef struct { unsigned long pte; } pte_t; /* page table entry */ | ||
42 | typedef struct { unsigned long pmd; } pmd_t; /* PMD table entry */ | ||
43 | typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */ | ||
44 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
45 | |||
46 | #define pte_val(x) ((x).pte) | ||
47 | #define pmd_val(x) ((x).pmd) | ||
48 | #define pgd_val(x) ((x).pgd) | ||
49 | #define pgprot_val(x) ((x).pgprot) | ||
50 | |||
51 | #define __pte(x) ((pte_t) { (x) } ) | ||
52 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
53 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
54 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
55 | |||
56 | /* | ||
57 | * Pure 2^n version of get_order | ||
58 | */ | ||
59 | extern __inline__ int get_order(unsigned long size) | ||
60 | { | ||
61 | int order; | ||
62 | #ifndef XCHAL_HAVE_NSU | ||
63 | unsigned long x1, x2, x4, x8, x16; | ||
64 | |||
65 | size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
66 | x1 = size & 0xAAAAAAAA; | ||
67 | x2 = size & 0xCCCCCCCC; | ||
68 | x4 = size & 0xF0F0F0F0; | ||
69 | x8 = size & 0xFF00FF00; | ||
70 | x16 = size & 0xFFFF0000; | ||
71 | order = x2 ? 2 : 0; | ||
72 | order += (x16 != 0) * 16; | ||
73 | order += (x8 != 0) * 8; | ||
74 | order += (x4 != 0) * 4; | ||
75 | order += (x1 != 0); | ||
76 | |||
77 | return order; | ||
78 | #else | ||
79 | size = (size - 1) >> PAGE_SHIFT; | ||
80 | asm ("nsau %0, %1" : "=r" (order) : "r" (size)); | ||
81 | return 32 - order; | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | |||
86 | struct page; | ||
87 | extern void clear_page(void *page); | ||
88 | extern void copy_page(void *to, void *from); | ||
89 | |||
90 | /* | ||
91 | * If we have cache aliasing and writeback caches, we might have to do | ||
92 | * some extra work | ||
93 | */ | ||
94 | |||
95 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
96 | void clear_user_page(void *addr, unsigned long vaddr, struct page* page); | ||
97 | void copy_user_page(void *to, void* from, unsigned long vaddr, struct page* page); | ||
98 | #else | ||
99 | # define clear_user_page(page,vaddr,pg) clear_page(page) | ||
100 | # define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
101 | #endif | ||
102 | |||
103 | |||
104 | /* | ||
105 | * This handles the memory map. We handle pages at | ||
106 | * XCHAL_KSEG_CACHED_VADDR for kernels with 32 bit address space. | ||
107 | * These macros are for conversion of kernel address, not user | ||
108 | * addresses. | ||
109 | */ | ||
110 | |||
111 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) | ||
112 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | ||
113 | #define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) | ||
114 | #ifndef CONFIG_DISCONTIGMEM | ||
115 | # define pfn_to_page(pfn) (mem_map + (pfn)) | ||
116 | # define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
117 | #else | ||
118 | # error CONFIG_DISCONTIGMEM not supported | ||
119 | #endif | ||
120 | |||
121 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
122 | #define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) | ||
123 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
124 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
125 | |||
126 | #define WANT_PAGE_VIRTUAL | ||
127 | |||
128 | |||
129 | #endif /* __ASSEMBLY__ */ | ||
130 | |||
131 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
132 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
133 | |||
134 | #endif /* __KERNEL__ */ | ||
135 | #endif /* _XTENSA_PAGE_H */ | ||
diff --git a/include/asm-xtensa/param.h b/include/asm-xtensa/param.h new file mode 100644 index 000000000000..c0eec8260b0e --- /dev/null +++ b/include/asm-xtensa/param.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/param.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PARAM_H | ||
12 | #define _XTENSA_PARAM_H | ||
13 | |||
14 | #include <xtensa/config/core.h> | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | # define HZ 100 /* internal timer frequency */ | ||
18 | # define USER_HZ 100 /* for user interfaces in "ticks" */ | ||
19 | # define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */ | ||
20 | #endif | ||
21 | |||
22 | #define EXEC_PAGESIZE (1 << XCHAL_MMU_MIN_PTE_PAGE_SIZE) | ||
23 | |||
24 | #ifndef NGROUPS | ||
25 | #define NGROUPS 32 | ||
26 | #endif | ||
27 | |||
28 | #ifndef NOGROUP | ||
29 | #define NOGROUP (-1) | ||
30 | #endif | ||
31 | |||
32 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
33 | |||
34 | #endif /* _XTENSA_PARAM_H */ | ||
diff --git a/include/asm-xtensa/pci-bridge.h b/include/asm-xtensa/pci-bridge.h new file mode 100644 index 000000000000..00fcbd7c534a --- /dev/null +++ b/include/asm-xtensa/pci-bridge.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/pci-bridge.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PCI_BRIDGE_H | ||
12 | #define _XTENSA_PCI_BRIDGE_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | struct device_node; | ||
17 | struct pci_controller; | ||
18 | |||
19 | /* | ||
20 | * pciauto_bus_scan() enumerates the pci space. | ||
21 | */ | ||
22 | |||
23 | extern int pciauto_bus_scan(struct pci_controller *, int); | ||
24 | |||
25 | struct pci_space { | ||
26 | unsigned long start; | ||
27 | unsigned long end; | ||
28 | unsigned long base; | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * Structure of a PCI controller (host bridge) | ||
33 | */ | ||
34 | |||
35 | struct pci_controller { | ||
36 | int index; /* used for pci_controller_num */ | ||
37 | struct pci_controller *next; | ||
38 | struct pci_bus *bus; | ||
39 | void *arch_data; | ||
40 | |||
41 | int first_busno; | ||
42 | int last_busno; | ||
43 | |||
44 | struct pci_ops *ops; | ||
45 | volatile unsigned int *cfg_addr; | ||
46 | volatile unsigned char *cfg_data; | ||
47 | |||
48 | /* Currently, we limit ourselves to 1 IO range and 3 mem | ||
49 | * ranges since the common pci_bus structure can't handle more | ||
50 | */ | ||
51 | struct resource io_resource; | ||
52 | struct resource mem_resources[3]; | ||
53 | int mem_resource_count; | ||
54 | |||
55 | /* Host bridge I/O and Memory space | ||
56 | * Used for BAR placement algorithms | ||
57 | */ | ||
58 | struct pci_space io_space; | ||
59 | struct pci_space mem_space; | ||
60 | |||
61 | /* Return the interrupt number fo a device. */ | ||
62 | int (*map_irq)(struct pci_dev*, u8, u8); | ||
63 | |||
64 | }; | ||
65 | |||
66 | static inline void pcibios_init_resource(struct resource *res, | ||
67 | unsigned long start, unsigned long end, int flags, char *name) | ||
68 | { | ||
69 | res->start = start; | ||
70 | res->end = end; | ||
71 | res->flags = flags; | ||
72 | res->name = name; | ||
73 | res->parent = NULL; | ||
74 | res->sibling = NULL; | ||
75 | res->child = NULL; | ||
76 | } | ||
77 | |||
78 | |||
79 | /* These are used for config access before all the PCI probing has been done. */ | ||
80 | int early_read_config_byte(struct pci_controller*, int, int, int, u8*); | ||
81 | int early_read_config_word(struct pci_controller*, int, int, int, u16*); | ||
82 | int early_read_config_dword(struct pci_controller*, int, int, int, u32*); | ||
83 | int early_write_config_byte(struct pci_controller*, int, int, int, u8); | ||
84 | int early_write_config_word(struct pci_controller*, int, int, int, u16); | ||
85 | int early_write_config_dword(struct pci_controller*, int, int, int, u32); | ||
86 | |||
87 | #endif /* __KERNEL__ */ | ||
88 | #endif /* _XTENSA_PCI_BRIDGE_H */ | ||
diff --git a/include/asm-xtensa/pci.h b/include/asm-xtensa/pci.h new file mode 100644 index 000000000000..6817742301c2 --- /dev/null +++ b/include/asm-xtensa/pci.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/pci.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PCI_H | ||
12 | #define _XTENSA_PCI_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | /* Can be used to override the logic in pci_scan_bus for skipping | ||
17 | * already-configured bus numbers - to be used for buggy BIOSes | ||
18 | * or architectures with incomplete PCI setup by the loader | ||
19 | */ | ||
20 | |||
21 | #define pcibios_assign_all_busses() 0 | ||
22 | |||
23 | extern struct pci_controller* pcibios_alloc_controller(void); | ||
24 | |||
25 | extern inline void pcibios_set_master(struct pci_dev *dev) | ||
26 | { | ||
27 | /* No special bus mastering setup handling */ | ||
28 | } | ||
29 | |||
30 | extern inline void pcibios_penalize_isa_irq(int irq) | ||
31 | { | ||
32 | /* We don't do dynamic PCI IRQ allocation */ | ||
33 | } | ||
34 | |||
35 | /* Assume some values. (We should revise them, if necessary) */ | ||
36 | |||
37 | #define PCIBIOS_MIN_IO 0x2000 | ||
38 | #define PCIBIOS_MIN_MEM 0x10000000 | ||
39 | |||
40 | /* Dynamic DMA mapping stuff. | ||
41 | * Xtensa has everything mapped statically like x86. | ||
42 | */ | ||
43 | |||
44 | #include <linux/types.h> | ||
45 | #include <linux/slab.h> | ||
46 | #include <asm/scatterlist.h> | ||
47 | #include <linux/string.h> | ||
48 | #include <asm/io.h> | ||
49 | |||
50 | struct pci_dev; | ||
51 | |||
52 | /* The PCI address space does equal the physical memory address space. | ||
53 | * The networking and block device layers use this boolean for bounce buffer | ||
54 | * decisions. | ||
55 | */ | ||
56 | |||
57 | #define PCI_DMA_BUS_IS_PHYS (1) | ||
58 | |||
59 | /* pci_unmap_{page,single} is a no-op, so */ | ||
60 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | ||
61 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | ||
62 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) | ||
63 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
64 | #define pci_ubnmap_len(PTR, LEN_NAME) (0) | ||
65 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
66 | |||
67 | /* We cannot access memory above 4GB */ | ||
68 | #define pci_dac_dma_supported(pci_dev, mask) (0) | ||
69 | |||
70 | /* Map a range of PCI memory or I/O space for a device into user space */ | ||
71 | int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, | ||
72 | enum pci_mmap_state mmap_state, int write_combine); | ||
73 | |||
74 | /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ | ||
75 | #define HAVE_PCI_MMAP 1 | ||
76 | |||
77 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | #endif /* __KERNEL__ */ | ||
82 | |||
83 | /* Implement the pci_ DMA API in terms of the generic device dma_ one */ | ||
84 | #include <asm-generic/pci-dma-compat.h> | ||
85 | |||
86 | /* Generic PCI */ | ||
87 | #include <asm-generic/pci.h> | ||
88 | |||
89 | #endif /* _XTENSA_PCI_H */ | ||
diff --git a/include/asm-xtensa/percpu.h b/include/asm-xtensa/percpu.h new file mode 100644 index 000000000000..6d2bc2ada9d1 --- /dev/null +++ b/include/asm-xtensa/percpu.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/percpu.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PERCPU__ | ||
12 | #define _XTENSA_PERCPU__ | ||
13 | |||
14 | #include <asm-generic/percpu.h> | ||
15 | |||
16 | #endif /* _XTENSA_PERCPU__ */ | ||
diff --git a/include/asm-xtensa/pgalloc.h b/include/asm-xtensa/pgalloc.h new file mode 100644 index 000000000000..734a8d060395 --- /dev/null +++ b/include/asm-xtensa/pgalloc.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/pgalloc.h | ||
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 | * Copyright (C) 2001-2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PGALLOC_H | ||
12 | #define _XTENSA_PGALLOC_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/threads.h> | ||
18 | #include <linux/highmem.h> | ||
19 | #include <asm/processor.h> | ||
20 | #include <asm/cacheflush.h> | ||
21 | |||
22 | |||
23 | /* Cache aliasing: | ||
24 | * | ||
25 | * If the cache size for one way is greater than the page size, we have to | ||
26 | * deal with cache aliasing. The cache index is wider than the page size: | ||
27 | * | ||
28 | * |cache | | ||
29 | * |pgnum |page| virtual address | ||
30 | * |xxxxxX|zzzz| | ||
31 | * | | | | ||
32 | * \ / | | | ||
33 | * trans.| | | ||
34 | * / \ | | | ||
35 | * |yyyyyY|zzzz| physical address | ||
36 | * | ||
37 | * When the page number is translated to the physical page address, the lowest | ||
38 | * bit(s) (X) that are also part of the cache index are also translated (Y). | ||
39 | * If this translation changes this bit (X), the cache index is also afected, | ||
40 | * thus resulting in a different cache line than before. | ||
41 | * The kernel does not provide a mechanism to ensure that the page color | ||
42 | * (represented by this bit) remains the same when allocated or when pages | ||
43 | * are remapped. When user pages are mapped into kernel space, the color of | ||
44 | * the page might also change. | ||
45 | * | ||
46 | * We use the address space VMALLOC_END ... VMALLOC_END + DCACHE_WAY_SIZE * 2 | ||
47 | * to temporarily map a patch so we can match the color. | ||
48 | */ | ||
49 | |||
50 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) | ||
51 | # define PAGE_COLOR_MASK (PAGE_MASK & (DCACHE_WAY_SIZE-1)) | ||
52 | # define PAGE_COLOR(a) \ | ||
53 | (((unsigned long)(a)&PAGE_COLOR_MASK) >> PAGE_SHIFT) | ||
54 | # define PAGE_COLOR_EQ(a,b) \ | ||
55 | ((((unsigned long)(a) ^ (unsigned long)(b)) & PAGE_COLOR_MASK) == 0) | ||
56 | # define PAGE_COLOR_MAP0(v) \ | ||
57 | (VMALLOC_END + ((unsigned long)(v) & PAGE_COLOR_MASK)) | ||
58 | # define PAGE_COLOR_MAP1(v) \ | ||
59 | (VMALLOC_END + ((unsigned long)(v) & PAGE_COLOR_MASK) + DCACHE_WAY_SIZE) | ||
60 | #endif | ||
61 | |||
62 | /* | ||
63 | * Allocating and freeing a pmd is trivial: the 1-entry pmd is | ||
64 | * inside the pgd, so has no extra memory associated with it. | ||
65 | */ | ||
66 | |||
67 | #define pgd_free(pgd) free_page((unsigned long)(pgd)) | ||
68 | |||
69 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
70 | |||
71 | static inline void | ||
72 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *pte) | ||
73 | { | ||
74 | pmd_val(*(pmdp)) = (unsigned long)(pte); | ||
75 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (pmdp)); | ||
76 | } | ||
77 | |||
78 | static inline void | ||
79 | pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *page) | ||
80 | { | ||
81 | pmd_val(*(pmdp)) = (unsigned long)page_to_virt(page); | ||
82 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (pmdp)); | ||
83 | } | ||
84 | |||
85 | |||
86 | |||
87 | #else | ||
88 | |||
89 | # define pmd_populate_kernel(mm, pmdp, pte) \ | ||
90 | (pmd_val(*(pmdp)) = (unsigned long)(pte)) | ||
91 | # define pmd_populate(mm, pmdp, page) \ | ||
92 | (pmd_val(*(pmdp)) = (unsigned long)page_to_virt(page)) | ||
93 | |||
94 | #endif | ||
95 | |||
96 | static inline pgd_t* | ||
97 | pgd_alloc(struct mm_struct *mm) | ||
98 | { | ||
99 | pgd_t *pgd; | ||
100 | |||
101 | pgd = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, PGD_ORDER); | ||
102 | |||
103 | if (likely(pgd != NULL)) | ||
104 | __flush_dcache_page((unsigned long)pgd); | ||
105 | |||
106 | return pgd; | ||
107 | } | ||
108 | |||
109 | extern pte_t* pte_alloc_one_kernel(struct mm_struct* mm, unsigned long addr); | ||
110 | extern struct page* pte_alloc_one(struct mm_struct* mm, unsigned long addr); | ||
111 | |||
112 | #define pte_free_kernel(pte) free_page((unsigned long)pte) | ||
113 | #define pte_free(pte) __free_page(pte) | ||
114 | |||
115 | #endif /* __KERNEL__ */ | ||
116 | #endif /* _XTENSA_PGALLOC_H */ | ||
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h new file mode 100644 index 000000000000..0bb6416ae266 --- /dev/null +++ b/include/asm-xtensa/pgtable.h | |||
@@ -0,0 +1,468 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/page.h | ||
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 version2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PGTABLE_H | ||
12 | #define _XTENSA_PGTABLE_H | ||
13 | |||
14 | #include <asm-generic/pgtable-nopmd.h> | ||
15 | #include <asm/page.h> | ||
16 | |||
17 | /* Assertions. */ | ||
18 | |||
19 | #ifdef CONFIG_MMU | ||
20 | |||
21 | |||
22 | #if (XCHAL_MMU_RINGS < 2) | ||
23 | # error Linux build assumes at least 2 ring levels. | ||
24 | #endif | ||
25 | |||
26 | #if (XCHAL_MMU_CA_BITS != 4) | ||
27 | # error We assume exactly four bits for CA. | ||
28 | #endif | ||
29 | |||
30 | #if (XCHAL_MMU_SR_BITS != 0) | ||
31 | # error We have no room for SR bits. | ||
32 | #endif | ||
33 | |||
34 | /* | ||
35 | * Use the first min-wired way for mapping page-table pages. | ||
36 | * Page coloring requires a second min-wired way. | ||
37 | */ | ||
38 | |||
39 | #if (XCHAL_DTLB_MINWIRED_SETS == 0) | ||
40 | # error Need a min-wired way for mapping page-table pages | ||
41 | #endif | ||
42 | |||
43 | #define DTLB_WAY_PGTABLE XCHAL_DTLB_SET(XCHAL_DTLB_MINWIRED_SET0, WAY) | ||
44 | |||
45 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
46 | # if XCHAL_DTLB_SET(XCHAL_DTLB_MINWIRED_SET0, WAYS) >= 2 | ||
47 | # define DTLB_WAY_DCACHE_ALIAS0 (DTLB_WAY_PGTABLE + 1) | ||
48 | # define DTLB_WAY_DCACHE_ALIAS1 (DTLB_WAY_PGTABLE + 2) | ||
49 | # else | ||
50 | # error Page coloring requires its own wired dtlb way! | ||
51 | # endif | ||
52 | #endif | ||
53 | |||
54 | #endif /* CONFIG_MMU */ | ||
55 | |||
56 | /* | ||
57 | * We only use two ring levels, user and kernel space. | ||
58 | */ | ||
59 | |||
60 | #define USER_RING 1 /* user ring level */ | ||
61 | #define KERNEL_RING 0 /* kernel ring level */ | ||
62 | |||
63 | /* | ||
64 | * The Xtensa architecture port of Linux has a two-level page table system, | ||
65 | * i.e. the logical three-level Linux page table layout are folded. | ||
66 | * Each task has the following memory page tables: | ||
67 | * | ||
68 | * PGD table (page directory), ie. 3rd-level page table: | ||
69 | * One page (4 kB) of 1024 (PTRS_PER_PGD) pointers to PTE tables | ||
70 | * (Architectures that don't have the PMD folded point to the PMD tables) | ||
71 | * | ||
72 | * The pointer to the PGD table for a given task can be retrieved from | ||
73 | * the task structure (struct task_struct*) t, e.g. current(): | ||
74 | * (t->mm ? t->mm : t->active_mm)->pgd | ||
75 | * | ||
76 | * PMD tables (page middle-directory), ie. 2nd-level page tables: | ||
77 | * Absent for the Xtensa architecture (folded, PTRS_PER_PMD == 1). | ||
78 | * | ||
79 | * PTE tables (page table entry), ie. 1st-level page tables: | ||
80 | * One page (4 kB) of 1024 (PTRS_PER_PTE) PTEs with a special PTE | ||
81 | * invalid_pte_table for absent mappings. | ||
82 | * | ||
83 | * The individual pages are 4 kB big with special pages for the empty_zero_page. | ||
84 | */ | ||
85 | #define PGDIR_SHIFT 22 | ||
86 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
87 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
88 | |||
89 | /* | ||
90 | * Entries per page directory level: we use two-level, so | ||
91 | * we don't really have any PMD directory physically. | ||
92 | */ | ||
93 | #define PTRS_PER_PTE 1024 | ||
94 | #define PTRS_PER_PTE_SHIFT 10 | ||
95 | #define PTRS_PER_PMD 1 | ||
96 | #define PTRS_PER_PGD 1024 | ||
97 | #define PGD_ORDER 0 | ||
98 | #define PMD_ORDER 0 | ||
99 | #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) | ||
100 | #define FIRST_USER_ADDRESS XCHAL_SEG_MAPPABLE_VADDR | ||
101 | #define FIRST_USER_PGD_NR (FIRST_USER_ADDRESS >> PGDIR_SHIFT) | ||
102 | |||
103 | /* virtual memory area. We keep a distance to other memory regions to be | ||
104 | * on the safe side. We also use this area for cache aliasing. | ||
105 | */ | ||
106 | |||
107 | // FIXME: virtual memory area must be configuration-dependent | ||
108 | |||
109 | #define VMALLOC_START 0xC0000000 | ||
110 | #define VMALLOC_END 0xC7FF0000 | ||
111 | |||
112 | /* Xtensa Linux config PTE layout (when present): | ||
113 | * 31-12: PPN | ||
114 | * 11-6: Software | ||
115 | * 5-4: RING | ||
116 | * 3-0: CA | ||
117 | * | ||
118 | * Similar to the Alpha and MIPS ports, we need to keep track of the ref | ||
119 | * and mod bits in software. We have a software "you can read | ||
120 | * from this page" bit, and a hardware one which actually lets the | ||
121 | * process read from the page. On the same token we have a software | ||
122 | * writable bit and the real hardware one which actually lets the | ||
123 | * process write to the page. | ||
124 | * | ||
125 | * See further below for PTE layout for swapped-out pages. | ||
126 | */ | ||
127 | |||
128 | #define _PAGE_VALID (1<<0) /* hardware: page is accessible */ | ||
129 | #define _PAGE_WRENABLE (1<<1) /* hardware: page is writable */ | ||
130 | |||
131 | /* None of these cache modes include MP coherency: */ | ||
132 | #define _PAGE_NO_CACHE (0<<2) /* bypass, non-speculative */ | ||
133 | #if XCHAL_DCACHE_IS_WRITEBACK | ||
134 | # define _PAGE_WRITEBACK (1<<2) /* write back */ | ||
135 | # define _PAGE_WRITETHRU (2<<2) /* write through */ | ||
136 | #else | ||
137 | # define _PAGE_WRITEBACK (1<<2) /* assume write through */ | ||
138 | # define _PAGE_WRITETHRU (1<<2) | ||
139 | #endif | ||
140 | #define _PAGE_NOALLOC (3<<2) /* don't allocate cache,if not cached */ | ||
141 | #define _CACHE_MASK (3<<2) | ||
142 | |||
143 | #define _PAGE_USER (1<<4) /* user access (ring=1) */ | ||
144 | #define _PAGE_KERNEL (0<<4) /* kernel access (ring=0) */ | ||
145 | |||
146 | /* Software */ | ||
147 | #define _PAGE_RW (1<<6) /* software: page writable */ | ||
148 | #define _PAGE_DIRTY (1<<7) /* software: page dirty */ | ||
149 | #define _PAGE_ACCESSED (1<<8) /* software: page accessed (read) */ | ||
150 | #define _PAGE_FILE (1<<9) /* nonlinear file mapping*/ | ||
151 | |||
152 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _CACHE_MASK | _PAGE_DIRTY) | ||
153 | #define _PAGE_PRESENT ( _PAGE_VALID | _PAGE_WRITEBACK | _PAGE_ACCESSED) | ||
154 | |||
155 | #ifdef CONFIG_MMU | ||
156 | |||
157 | # define PAGE_NONE __pgprot(_PAGE_PRESENT) | ||
158 | # define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_RW) | ||
159 | # define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER) | ||
160 | # define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER) | ||
161 | # define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_KERNEL | _PAGE_WRENABLE) | ||
162 | # define PAGE_INVALID __pgprot(_PAGE_USER) | ||
163 | |||
164 | # if (DCACHE_WAY_SIZE > PAGE_SIZE) | ||
165 | # define PAGE_DIRECTORY __pgprot(_PAGE_VALID | _PAGE_ACCESSED | _PAGE_KERNEL) | ||
166 | # else | ||
167 | # define PAGE_DIRECTORY __pgprot(_PAGE_PRESENT | _PAGE_KERNEL) | ||
168 | # endif | ||
169 | |||
170 | #else /* no mmu */ | ||
171 | |||
172 | # define PAGE_NONE __pgprot(0) | ||
173 | # define PAGE_SHARED __pgprot(0) | ||
174 | # define PAGE_COPY __pgprot(0) | ||
175 | # define PAGE_READONLY __pgprot(0) | ||
176 | # define PAGE_KERNEL __pgprot(0) | ||
177 | |||
178 | #endif | ||
179 | |||
180 | /* | ||
181 | * On certain configurations of Xtensa MMUs (eg. the initial Linux config), | ||
182 | * the MMU can't do page protection for execute, and considers that the same as | ||
183 | * read. Also, write permissions may imply read permissions. | ||
184 | * What follows is the closest we can get by reasonable means.. | ||
185 | * See linux/mm/mmap.c for protection_map[] array that uses these definitions. | ||
186 | */ | ||
187 | #define __P000 PAGE_NONE /* private --- */ | ||
188 | #define __P001 PAGE_READONLY /* private --r */ | ||
189 | #define __P010 PAGE_COPY /* private -w- */ | ||
190 | #define __P011 PAGE_COPY /* private -wr */ | ||
191 | #define __P100 PAGE_READONLY /* private x-- */ | ||
192 | #define __P101 PAGE_READONLY /* private x-r */ | ||
193 | #define __P110 PAGE_COPY /* private xw- */ | ||
194 | #define __P111 PAGE_COPY /* private xwr */ | ||
195 | |||
196 | #define __S000 PAGE_NONE /* shared --- */ | ||
197 | #define __S001 PAGE_READONLY /* shared --r */ | ||
198 | #define __S010 PAGE_SHARED /* shared -w- */ | ||
199 | #define __S011 PAGE_SHARED /* shared -wr */ | ||
200 | #define __S100 PAGE_READONLY /* shared x-- */ | ||
201 | #define __S101 PAGE_READONLY /* shared x-r */ | ||
202 | #define __S110 PAGE_SHARED /* shared xw- */ | ||
203 | #define __S111 PAGE_SHARED /* shared xwr */ | ||
204 | |||
205 | #ifndef __ASSEMBLY__ | ||
206 | |||
207 | #define pte_ERROR(e) \ | ||
208 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
209 | #define pgd_ERROR(e) \ | ||
210 | printk("%s:%d: bad pgd entry %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | ||
211 | |||
212 | extern unsigned long empty_zero_page[1024]; | ||
213 | |||
214 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | ||
215 | |||
216 | extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; | ||
217 | |||
218 | /* | ||
219 | * The pmd contains the kernel virtual address of the pte page. | ||
220 | */ | ||
221 | #define pmd_page_kernel(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK)) | ||
222 | #define pmd_page(pmd) virt_to_page(pmd_val(pmd)) | ||
223 | |||
224 | /* | ||
225 | * The following only work if pte_present() is true. | ||
226 | */ | ||
227 | #define pte_none(pte) (!(pte_val(pte) ^ _PAGE_USER)) | ||
228 | #define pte_present(pte) (pte_val(pte) & _PAGE_VALID) | ||
229 | #define pte_clear(mm,addr,ptep) \ | ||
230 | do { update_pte(ptep, __pte(_PAGE_USER)); } while(0) | ||
231 | |||
232 | #define pmd_none(pmd) (!pmd_val(pmd)) | ||
233 | #define pmd_present(pmd) (pmd_val(pmd) & PAGE_MASK) | ||
234 | #define pmd_clear(pmdp) do { set_pmd(pmdp, __pmd(0)); } while (0) | ||
235 | #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) | ||
236 | |||
237 | /* Note: We use the _PAGE_USER bit to indicate write-protect kernel memory */ | ||
238 | |||
239 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
240 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | ||
241 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | ||
242 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | ||
243 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | ||
244 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; } | ||
245 | static inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } | ||
246 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } | ||
247 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | ||
248 | static inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } | ||
249 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } | ||
250 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } | ||
251 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } | ||
252 | |||
253 | /* | ||
254 | * Conversion functions: convert a page and protection to a page entry, | ||
255 | * and a page entry and page directory to the page they refer to. | ||
256 | */ | ||
257 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) | ||
258 | #define pte_same(a,b) (pte_val(a) == pte_val(b)) | ||
259 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
260 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
261 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) | ||
262 | |||
263 | extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
264 | { | ||
265 | return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)); | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * Certain architectures need to do special things when pte's | ||
270 | * within a page table are directly modified. Thus, the following | ||
271 | * hook is made available. | ||
272 | */ | ||
273 | static inline void update_pte(pte_t *ptep, pte_t pteval) | ||
274 | { | ||
275 | *ptep = pteval; | ||
276 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
277 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (ptep)); | ||
278 | #endif | ||
279 | } | ||
280 | |||
281 | extern inline void | ||
282 | set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) | ||
283 | { | ||
284 | update_pte(ptep, pteval); | ||
285 | } | ||
286 | |||
287 | |||
288 | extern inline void | ||
289 | set_pmd(pmd_t *pmdp, pmd_t pmdval) | ||
290 | { | ||
291 | *pmdp = pmdval; | ||
292 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK | ||
293 | __asm__ __volatile__ ("memw; dhwb %0, 0; dsync" :: "a" (pmdp)); | ||
294 | #endif | ||
295 | } | ||
296 | |||
297 | |||
298 | static inline int | ||
299 | ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, | ||
300 | pte_t *ptep) | ||
301 | { | ||
302 | pte_t pte = *ptep; | ||
303 | if (!pte_young(pte)) | ||
304 | return 0; | ||
305 | update_pte(ptep, pte_mkold(pte)); | ||
306 | return 1; | ||
307 | } | ||
308 | |||
309 | static inline int | ||
310 | ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, | ||
311 | pte_t *ptep) | ||
312 | { | ||
313 | pte_t pte = *ptep; | ||
314 | if (!pte_dirty(pte)) | ||
315 | return 0; | ||
316 | update_pte(ptep, pte_mkclean(pte)); | ||
317 | return 1; | ||
318 | } | ||
319 | |||
320 | static inline pte_t | ||
321 | ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
322 | { | ||
323 | pte_t pte = *ptep; | ||
324 | pte_clear(mm, addr, ptep); | ||
325 | return pte; | ||
326 | } | ||
327 | |||
328 | static inline void | ||
329 | ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
330 | { | ||
331 | pte_t pte = *ptep; | ||
332 | update_pte(ptep, pte_wrprotect(pte)); | ||
333 | } | ||
334 | |||
335 | /* to find an entry in a kernel page-table-directory */ | ||
336 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
337 | |||
338 | /* to find an entry in a page-table-directory */ | ||
339 | #define pgd_offset(mm,address) ((mm)->pgd + pgd_index(address)) | ||
340 | |||
341 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | ||
342 | |||
343 | /* Find an entry in the second-level page table.. */ | ||
344 | #define pmd_offset(dir,address) ((pmd_t*)(dir)) | ||
345 | |||
346 | /* Find an entry in the third-level page table.. */ | ||
347 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
348 | #define pte_offset_kernel(dir,addr) \ | ||
349 | ((pte_t*) pmd_page_kernel(*(dir)) + pte_index(addr)) | ||
350 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) | ||
351 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr)) | ||
352 | |||
353 | #define pte_unmap(pte) do { } while (0) | ||
354 | #define pte_unmap_nested(pte) do { } while (0) | ||
355 | |||
356 | |||
357 | /* | ||
358 | * Encode and decode a swap entry. | ||
359 | * Each PTE in a process VM's page table is either: | ||
360 | * "present" -- valid and not swapped out, protection bits are meaningful; | ||
361 | * "not present" -- which further subdivides in these two cases: | ||
362 | * "none" -- no mapping at all; identified by pte_none(), set by pte_clear( | ||
363 | * "swapped out" -- the page is swapped out, and the SWP macros below | ||
364 | * are used to store swap file info in the PTE itself. | ||
365 | * | ||
366 | * In the Xtensa processor MMU, any PTE entries in user space (or anywhere | ||
367 | * in virtual memory that can map differently across address spaces) | ||
368 | * must have a correct ring value that represents the RASID field that | ||
369 | * is changed when switching address spaces. Eg. such PTE entries cannot | ||
370 | * be set to ring zero, because that can cause a (global) kernel ASID | ||
371 | * entry to be created in the TLBs (even with invalid cache attribute), | ||
372 | * potentially causing a multihit exception when going back to another | ||
373 | * address space that mapped the same virtual address at another ring. | ||
374 | * | ||
375 | * SO: we avoid using ring bits (_PAGE_RING_MASK) in "not present" PTEs. | ||
376 | * We also avoid using the _PAGE_VALID bit which must be zero for non-present | ||
377 | * pages. | ||
378 | * | ||
379 | * We end up with the following available bits: 1..3 and 7..31. | ||
380 | * We don't bother with 1..3 for now (we can use them later if needed), | ||
381 | * and chose to allocate 6 bits for SWP_TYPE and the remaining 19 bits | ||
382 | * for SWP_OFFSET. At least 5 bits are needed for SWP_TYPE, because it | ||
383 | * is currently implemented as an index into swap_info[MAX_SWAPFILES] | ||
384 | * and MAX_SWAPFILES is currently defined as 32 in <linux/swap.h>. | ||
385 | * However, for some reason all other architectures in the 2.4 kernel | ||
386 | * reserve either 6, 7, or 8 bits so I'll not detract from that for now. :) | ||
387 | * SWP_OFFSET is an offset into the swap file in page-size units, so | ||
388 | * with 4 kB pages, 19 bits supports a maximum swap file size of 2 GB. | ||
389 | * | ||
390 | * FIXME: 2 GB isn't very big. Other bits can be used to allow | ||
391 | * larger swap sizes. In the meantime, it appears relatively easy to get | ||
392 | * around the 2 GB limitation by simply using multiple swap files. | ||
393 | */ | ||
394 | |||
395 | #define __swp_type(entry) (((entry).val >> 7) & 0x3f) | ||
396 | #define __swp_offset(entry) ((entry).val >> 13) | ||
397 | #define __swp_entry(type,offs) ((swp_entry_t) {((type) << 7) | ((offs) << 13)}) | ||
398 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
399 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
400 | |||
401 | #define PTE_FILE_MAX_BITS 29 | ||
402 | #define pte_to_pgoff(pte) (pte_val(pte) >> 3) | ||
403 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE }) | ||
404 | |||
405 | |||
406 | #endif /* !defined (__ASSEMBLY__) */ | ||
407 | |||
408 | |||
409 | #ifdef __ASSEMBLY__ | ||
410 | |||
411 | /* Assembly macro _PGD_INDEX is the same as C pgd_index(unsigned long), | ||
412 | * _PGD_OFFSET as C pgd_offset(struct mm_struct*, unsigned long), | ||
413 | * _PMD_OFFSET as C pmd_offset(pgd_t*, unsigned long) | ||
414 | * _PTE_OFFSET as C pte_offset(pmd_t*, unsigned long) | ||
415 | * | ||
416 | * Note: We require an additional temporary register which can be the same as | ||
417 | * the register that holds the address. | ||
418 | * | ||
419 | * ((pte_t*) ((unsigned long)(pmd_val(*pmd) & PAGE_MASK)) + pte_index(addr)) | ||
420 | * | ||
421 | */ | ||
422 | #define _PGD_INDEX(rt,rs) extui rt, rs, PGDIR_SHIFT, 32-PGDIR_SHIFT | ||
423 | #define _PTE_INDEX(rt,rs) extui rt, rs, PAGE_SHIFT, PTRS_PER_PTE_SHIFT | ||
424 | |||
425 | #define _PGD_OFFSET(mm,adr,tmp) l32i mm, mm, MM_PGD; \ | ||
426 | _PGD_INDEX(tmp, adr); \ | ||
427 | addx4 mm, tmp, mm | ||
428 | |||
429 | #define _PTE_OFFSET(pmd,adr,tmp) _PTE_INDEX(tmp, adr); \ | ||
430 | srli pmd, pmd, PAGE_SHIFT; \ | ||
431 | slli pmd, pmd, PAGE_SHIFT; \ | ||
432 | addx4 pmd, tmp, pmd | ||
433 | |||
434 | #else | ||
435 | |||
436 | extern void paging_init(void); | ||
437 | |||
438 | #define kern_addr_valid(addr) (1) | ||
439 | |||
440 | extern void update_mmu_cache(struct vm_area_struct * vma, | ||
441 | unsigned long address, pte_t pte); | ||
442 | |||
443 | /* | ||
444 | * remap a physical address `phys' of size `size' with page protection `prot' | ||
445 | * into virtual address `from' | ||
446 | */ | ||
447 | #define io_remap_page_range(vma,from,phys,size,prot) \ | ||
448 | remap_pfn_range(vma, from, (phys) >> PAGE_SHIFT, size, prot) | ||
449 | |||
450 | |||
451 | /* No page table caches to init */ | ||
452 | |||
453 | #define pgtable_cache_init() do { } while (0) | ||
454 | |||
455 | typedef pte_t *pte_addr_t; | ||
456 | |||
457 | #endif /* !defined (__ASSEMBLY__) */ | ||
458 | |||
459 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | ||
460 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | ||
461 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | ||
462 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | ||
463 | #define __HAVE_ARCH_PTEP_MKDIRTY | ||
464 | #define __HAVE_ARCH_PTE_SAME | ||
465 | |||
466 | #include <asm-generic/pgtable.h> | ||
467 | |||
468 | #endif /* _XTENSA_PGTABLE_H */ | ||
diff --git a/include/asm-xtensa/platform-iss/hardware.h b/include/asm-xtensa/platform-iss/hardware.h new file mode 100644 index 000000000000..22240f001803 --- /dev/null +++ b/include/asm-xtensa/platform-iss/hardware.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/platform-iss/hardware.h | ||
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 | * Copyright (C) 2001 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * This file contains the default configuration of ISS. | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_XTENSA_ISS_HARDWARE | ||
16 | #define __ASM_XTENSA_ISS_HARDWARE | ||
17 | |||
18 | /* | ||
19 | * Memory configuration. | ||
20 | */ | ||
21 | |||
22 | #define PLATFORM_DEFAULT_MEM_START XSHAL_RAM_PADDR | ||
23 | #define PLATFORM_DEFAULT_MEM_SIZE XSHAL_RAM_VSIZE | ||
24 | |||
25 | /* | ||
26 | * Interrupt configuration. | ||
27 | */ | ||
28 | |||
29 | #endif /* __ASM_XTENSA_ISS_HARDWARE */ | ||
diff --git a/include/asm-xtensa/platform.h b/include/asm-xtensa/platform.h new file mode 100644 index 000000000000..36163894bc20 --- /dev/null +++ b/include/asm-xtensa/platform.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/platform.h | ||
3 | * | ||
4 | * Platform specific functions | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General | ||
7 | * Public License. See the file "COPYING" in the main directory of | ||
8 | * this archive for more details. | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_PLATFORM_H | ||
14 | #define _XTENSA_PLATFORM_H | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/pci.h> | ||
19 | |||
20 | #include <asm/bootparam.h> | ||
21 | |||
22 | /* | ||
23 | * platform_init is called before the mmu is initialized to give the | ||
24 | * platform a early hook-up. bp_tag_t is a list of configuration tags | ||
25 | * passed from the boot-loader. | ||
26 | */ | ||
27 | extern void platform_init(bp_tag_t*); | ||
28 | |||
29 | /* | ||
30 | * platform_setup is called from setup_arch with a pointer to the command-line | ||
31 | * string. | ||
32 | */ | ||
33 | extern void platform_setup (char **); | ||
34 | |||
35 | /* | ||
36 | * platform_init_irq is called from init_IRQ. | ||
37 | */ | ||
38 | extern void platform_init_irq (void); | ||
39 | |||
40 | /* | ||
41 | * platform_restart is called to restart the system. | ||
42 | */ | ||
43 | extern void platform_restart (void); | ||
44 | |||
45 | /* | ||
46 | * platform_halt is called to stop the system and halt. | ||
47 | */ | ||
48 | extern void platform_halt (void); | ||
49 | |||
50 | /* | ||
51 | * platform_power_off is called to stop the system and power it off. | ||
52 | */ | ||
53 | extern void platform_power_off (void); | ||
54 | |||
55 | /* | ||
56 | * platform_idle is called from the idle function. | ||
57 | */ | ||
58 | extern void platform_idle (void); | ||
59 | |||
60 | /* | ||
61 | * platform_heartbeat is called every HZ | ||
62 | */ | ||
63 | extern void platform_heartbeat (void); | ||
64 | |||
65 | /* | ||
66 | * platform_pcibios_init is called to allow the platform to setup the pci bus. | ||
67 | */ | ||
68 | extern void platform_pcibios_init (void); | ||
69 | |||
70 | /* | ||
71 | * platform_pcibios_fixup allows to modify the PCI configuration. | ||
72 | */ | ||
73 | extern int platform_pcibios_fixup (void); | ||
74 | |||
75 | /* | ||
76 | * platform_calibrate_ccount calibrates cpu clock freq (CONFIG_XTENSA_CALIBRATE) | ||
77 | */ | ||
78 | extern void platform_calibrate_ccount (void); | ||
79 | |||
80 | /* | ||
81 | * platform_get_rtc_time returns RTC seconds (returns 0 for no error) | ||
82 | */ | ||
83 | extern int platform_get_rtc_time(time_t*); | ||
84 | |||
85 | /* | ||
86 | * platform_set_rtc_time set RTC seconds (returns 0 for no error) | ||
87 | */ | ||
88 | extern int platform_set_rtc_time(time_t); | ||
89 | |||
90 | |||
91 | #endif /* _XTENSA_PLATFORM_H */ | ||
92 | |||
diff --git a/include/asm-xtensa/poll.h b/include/asm-xtensa/poll.h new file mode 100644 index 000000000000..dffe447534e0 --- /dev/null +++ b/include/asm-xtensa/poll.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/poll.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_POLL_H | ||
12 | #define _XTENSA_POLL_H | ||
13 | |||
14 | |||
15 | #define POLLIN 0x0001 | ||
16 | #define POLLPRI 0x0002 | ||
17 | #define POLLOUT 0x0004 | ||
18 | |||
19 | #define POLLERR 0x0008 | ||
20 | #define POLLHUP 0x0010 | ||
21 | #define POLLNVAL 0x0020 | ||
22 | |||
23 | #define POLLRDNORM 0x0040 | ||
24 | #define POLLRDBAND 0x0080 | ||
25 | #define POLLWRNORM POLLOUT | ||
26 | #define POLLWRBAND 0x0100 | ||
27 | |||
28 | #define POLLMSG 0x0400 | ||
29 | #define POLLREMOVE 0x0800 | ||
30 | |||
31 | struct pollfd { | ||
32 | int fd; | ||
33 | short events; | ||
34 | short revents; | ||
35 | }; | ||
36 | |||
37 | #endif /* _XTENSA_POLL_H */ | ||
diff --git a/include/asm-xtensa/posix_types.h b/include/asm-xtensa/posix_types.h new file mode 100644 index 000000000000..2c816b0e7762 --- /dev/null +++ b/include/asm-xtensa/posix_types.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/posix_types.h | ||
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 | * Largely copied from include/asm-ppc/posix_types.h | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_POSIX_TYPES_H | ||
14 | #define _XTENSA_POSIX_TYPES_H | ||
15 | |||
16 | /* | ||
17 | * This file is generally used by user-level software, so you need to | ||
18 | * be a little careful about namespace pollution etc. Also, we cannot | ||
19 | * assume GCC is being used. | ||
20 | */ | ||
21 | |||
22 | typedef unsigned long __kernel_ino_t; | ||
23 | typedef unsigned int __kernel_mode_t; | ||
24 | typedef unsigned short __kernel_nlink_t; | ||
25 | typedef long __kernel_off_t; | ||
26 | typedef int __kernel_pid_t; | ||
27 | typedef unsigned short __kernel_ipc_pid_t; | ||
28 | typedef unsigned int __kernel_uid_t; | ||
29 | typedef unsigned int __kernel_gid_t; | ||
30 | typedef unsigned int __kernel_size_t; | ||
31 | typedef int __kernel_ssize_t; | ||
32 | typedef long __kernel_ptrdiff_t; | ||
33 | typedef long __kernel_time_t; | ||
34 | typedef long __kernel_suseconds_t; | ||
35 | typedef long __kernel_clock_t; | ||
36 | typedef int __kernel_timer_t; | ||
37 | typedef int __kernel_clockid_t; | ||
38 | typedef int __kernel_daddr_t; | ||
39 | typedef char * __kernel_caddr_t; | ||
40 | typedef unsigned short __kernel_uid16_t; | ||
41 | typedef unsigned short __kernel_gid16_t; | ||
42 | typedef unsigned int __kernel_uid32_t; | ||
43 | typedef unsigned int __kernel_gid32_t; | ||
44 | |||
45 | typedef unsigned short __kernel_old_uid_t; | ||
46 | typedef unsigned short __kernel_old_gid_t; | ||
47 | typedef unsigned short __kernel_old_dev_t; | ||
48 | |||
49 | #ifdef __GNUC__ | ||
50 | typedef long long __kernel_loff_t; | ||
51 | #endif | ||
52 | |||
53 | typedef struct { | ||
54 | int val[2]; | ||
55 | } __kernel_fsid_t; | ||
56 | |||
57 | #ifndef __GNUC__ | ||
58 | |||
59 | #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) | ||
60 | #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) | ||
61 | #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) | ||
62 | #define __FD_ZERO(set) \ | ||
63 | ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set))) | ||
64 | |||
65 | #else /* __GNUC__ */ | ||
66 | |||
67 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \ | ||
68 | || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0) | ||
69 | /* With GNU C, use inline functions instead so args are evaluated only once: */ | ||
70 | |||
71 | #undef __FD_SET | ||
72 | static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) | ||
73 | { | ||
74 | unsigned long _tmp = fd / __NFDBITS; | ||
75 | unsigned long _rem = fd % __NFDBITS; | ||
76 | fdsetp->fds_bits[_tmp] |= (1UL<<_rem); | ||
77 | } | ||
78 | |||
79 | #undef __FD_CLR | ||
80 | static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) | ||
81 | { | ||
82 | unsigned long _tmp = fd / __NFDBITS; | ||
83 | unsigned long _rem = fd % __NFDBITS; | ||
84 | fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); | ||
85 | } | ||
86 | |||
87 | #undef __FD_ISSET | ||
88 | static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p) | ||
89 | { | ||
90 | unsigned long _tmp = fd / __NFDBITS; | ||
91 | unsigned long _rem = fd % __NFDBITS; | ||
92 | return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * This will unroll the loop for the normal constant case (8 ints, | ||
97 | * for a 256-bit fd_set) | ||
98 | */ | ||
99 | #undef __FD_ZERO | ||
100 | static __inline__ void __FD_ZERO(__kernel_fd_set *p) | ||
101 | { | ||
102 | unsigned int *tmp = (unsigned int *)p->fds_bits; | ||
103 | int i; | ||
104 | |||
105 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
106 | switch (__FDSET_LONGS) { | ||
107 | case 8: | ||
108 | tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0; | ||
109 | tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; | ||
110 | return; | ||
111 | } | ||
112 | } | ||
113 | i = __FDSET_LONGS; | ||
114 | while (i) { | ||
115 | i--; | ||
116 | *tmp = 0; | ||
117 | tmp++; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | ||
122 | #endif /* __GNUC__ */ | ||
123 | #endif /* _XTENSA_POSIX_TYPES_H */ | ||
diff --git a/include/asm-xtensa/processor.h b/include/asm-xtensa/processor.h new file mode 100644 index 000000000000..9cab5e4298b9 --- /dev/null +++ b/include/asm-xtensa/processor.h | |||
@@ -0,0 +1,205 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/processor.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PROCESSOR_H | ||
12 | #define _XTENSA_PROCESSOR_H | ||
13 | |||
14 | #ifdef __ASSEMBLY__ | ||
15 | #define _ASMLANGUAGE | ||
16 | #endif | ||
17 | |||
18 | #include <xtensa/config/core.h> | ||
19 | #include <xtensa/config/specreg.h> | ||
20 | #include <xtensa/config/tie.h> | ||
21 | #include <xtensa/config/system.h> | ||
22 | |||
23 | #include <asm/ptrace.h> | ||
24 | #include <asm/types.h> | ||
25 | #include <asm/coprocessor.h> | ||
26 | |||
27 | /* Assertions. */ | ||
28 | |||
29 | #if (XCHAL_HAVE_WINDOWED != 1) | ||
30 | #error Linux requires the Xtensa Windowed Registers Option. | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * User space process size: 1 GB. | ||
35 | * Windowed call ABI requires caller and callee to be located within the same | ||
36 | * 1 GB region. The C compiler places trampoline code on the stack for sources | ||
37 | * that take the address of a nested C function (a feature used by glibc), so | ||
38 | * the 1 GB requirement applies to the stack as well. | ||
39 | */ | ||
40 | |||
41 | #define TASK_SIZE 0x40000000 | ||
42 | |||
43 | /* | ||
44 | * General exception cause assigned to debug exceptions. Debug exceptions go | ||
45 | * to their own vector, rather than the general exception vectors (user, | ||
46 | * kernel, double); and their specific causes are reported via DEBUGCAUSE | ||
47 | * rather than EXCCAUSE. However it is sometimes convenient to redirect debug | ||
48 | * exceptions to the general exception mechanism. To do this, an otherwise | ||
49 | * unused EXCCAUSE value was assigned to debug exceptions for this purpose. | ||
50 | */ | ||
51 | |||
52 | #define EXCCAUSE_MAPPED_DEBUG 63 | ||
53 | |||
54 | /* | ||
55 | * We use DEPC also as a flag to distinguish between double and regular | ||
56 | * exceptions. For performance reasons, DEPC might contain the value of | ||
57 | * EXCCAUSE for regular exceptions, so we use this definition to mark a | ||
58 | * valid double exception address. | ||
59 | * (Note: We use it in bgeui, so it should be 64, 128, or 256) | ||
60 | */ | ||
61 | |||
62 | #define VALID_DOUBLE_EXCEPTION_ADDRESS 64 | ||
63 | |||
64 | /* LOCKLEVEL defines the interrupt level that masks all | ||
65 | * general-purpose interrupts. | ||
66 | */ | ||
67 | #define LOCKLEVEL 1 | ||
68 | |||
69 | /* WSBITS and WBBITS are the width of the WINDOWSTART and WINDOWBASE | ||
70 | * registers | ||
71 | */ | ||
72 | #define WSBITS (XCHAL_NUM_AREGS / 4) /* width of WINDOWSTART in bits */ | ||
73 | #define WBBITS (XCHAL_NUM_AREGS_LOG2 - 2) /* width of WINDOWBASE in bits */ | ||
74 | |||
75 | #ifndef __ASSEMBLY__ | ||
76 | |||
77 | /* Build a valid return address for the specified call winsize. | ||
78 | * winsize must be 1 (call4), 2 (call8), or 3 (call12) | ||
79 | */ | ||
80 | #define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30) | ||
81 | |||
82 | /* Convert return address to a valid pc | ||
83 | * Note: We assume that the stack pointer is in the same 1GB ranges as the ra | ||
84 | */ | ||
85 | #define MAKE_PC_FROM_RA(ra,sp) (((ra) & 0x3fffffff) | ((sp) & 0xc0000000)) | ||
86 | |||
87 | typedef struct { | ||
88 | unsigned long seg; | ||
89 | } mm_segment_t; | ||
90 | |||
91 | struct thread_struct { | ||
92 | |||
93 | /* kernel's return address and stack pointer for context switching */ | ||
94 | unsigned long ra; /* kernel's a0: return address and window call size */ | ||
95 | unsigned long sp; /* kernel's a1: stack pointer */ | ||
96 | |||
97 | mm_segment_t current_ds; /* see uaccess.h for example uses */ | ||
98 | |||
99 | /* struct xtensa_cpuinfo info; */ | ||
100 | |||
101 | unsigned long bad_vaddr; /* last user fault */ | ||
102 | unsigned long bad_uaddr; /* last kernel fault accessing user space */ | ||
103 | unsigned long error_code; | ||
104 | |||
105 | unsigned long ibreak[XCHAL_NUM_IBREAK]; | ||
106 | unsigned long dbreaka[XCHAL_NUM_DBREAK]; | ||
107 | unsigned long dbreakc[XCHAL_NUM_DBREAK]; | ||
108 | |||
109 | /* Allocate storage for extra state and coprocessor state. */ | ||
110 | unsigned char cp_save[XTENSA_CP_EXTRA_SIZE] | ||
111 | __attribute__ ((aligned(XTENSA_CP_EXTRA_ALIGN))); | ||
112 | |||
113 | /* Make structure 16 bytes aligned. */ | ||
114 | int align[0] __attribute__ ((aligned(16))); | ||
115 | }; | ||
116 | |||
117 | |||
118 | /* | ||
119 | * Default implementation of macro that returns current | ||
120 | * instruction pointer ("program counter"). | ||
121 | */ | ||
122 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | ||
123 | |||
124 | |||
125 | /* This decides where the kernel will search for a free chunk of vm | ||
126 | * space during mmap's. | ||
127 | */ | ||
128 | #define TASK_UNMAPPED_BASE (TASK_SIZE / 2) | ||
129 | |||
130 | #define INIT_THREAD \ | ||
131 | { \ | ||
132 | ra: 0, \ | ||
133 | sp: sizeof(init_stack) + (long) &init_stack, \ | ||
134 | current_ds: {0}, \ | ||
135 | /*info: {0}, */ \ | ||
136 | bad_vaddr: 0, \ | ||
137 | bad_uaddr: 0, \ | ||
138 | error_code: 0, \ | ||
139 | } | ||
140 | |||
141 | |||
142 | /* | ||
143 | * Do necessary setup to start up a newly executed thread. | ||
144 | * Note: We set-up ps as if we did a call4 to the new pc. | ||
145 | * set_thread_state in signal.c depends on it. | ||
146 | */ | ||
147 | #define USER_PS_VALUE ( (1 << XCHAL_PS_WOE_SHIFT) + \ | ||
148 | (1 << XCHAL_PS_CALLINC_SHIFT) + \ | ||
149 | (USER_RING << XCHAL_PS_RING_SHIFT) + \ | ||
150 | (1 << XCHAL_PS_PROGSTACK_SHIFT) + \ | ||
151 | (1 << XCHAL_PS_EXCM_SHIFT) ) | ||
152 | |||
153 | /* Clearing a0 terminates the backtrace. */ | ||
154 | #define start_thread(regs, new_pc, new_sp) \ | ||
155 | regs->pc = new_pc; \ | ||
156 | regs->ps = USER_PS_VALUE; \ | ||
157 | regs->areg[1] = new_sp; \ | ||
158 | regs->areg[0] = 0; \ | ||
159 | regs->wmask = 1; \ | ||
160 | regs->depc = 0; \ | ||
161 | regs->windowbase = 0; \ | ||
162 | regs->windowstart = 1; | ||
163 | |||
164 | /* Forward declaration */ | ||
165 | struct task_struct; | ||
166 | struct mm_struct; | ||
167 | |||
168 | // FIXME: do we need release_thread for CP?? | ||
169 | /* Free all resources held by a thread. */ | ||
170 | #define release_thread(thread) do { } while(0) | ||
171 | |||
172 | // FIXME: do we need prepare_to_copy (lazy status) for CP?? | ||
173 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
174 | #define prepare_to_copy(tsk) do { } while (0) | ||
175 | |||
176 | /* | ||
177 | * create a kernel thread without removing it from tasklists | ||
178 | */ | ||
179 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
180 | |||
181 | /* Copy and release all segment info associated with a VM */ | ||
182 | |||
183 | #define copy_segments(p, mm) do { } while(0) | ||
184 | #define release_segments(mm) do { } while(0) | ||
185 | #define forget_segments() do { } while (0) | ||
186 | |||
187 | #define thread_saved_pc(tsk) (xtensa_pt_regs(tsk)->pc) | ||
188 | |||
189 | extern unsigned long get_wchan(struct task_struct *p); | ||
190 | |||
191 | #define KSTK_EIP(tsk) (xtensa_pt_regs(tsk)->pc) | ||
192 | #define KSTK_ESP(tsk) (xtensa_pt_regs(tsk)->areg[1]) | ||
193 | |||
194 | #define cpu_relax() do { } while (0) | ||
195 | |||
196 | /* Special register access. */ | ||
197 | |||
198 | #define WSR(v,sr) __asm__ __volatile__ ("wsr %0,"__stringify(sr) :: "a"(v)); | ||
199 | #define RSR(v,sr) __asm__ __volatile__ ("rsr %0,"__stringify(sr) : "=a"(v)); | ||
200 | |||
201 | #define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);}) | ||
202 | #define get_sr(sr) ({unsigned int v; RSR(v,sr); v; }) | ||
203 | |||
204 | #endif /* __ASSEMBLY__ */ | ||
205 | #endif /* _XTENSA_PROCESSOR_H */ | ||
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h new file mode 100644 index 000000000000..2848a5ff8349 --- /dev/null +++ b/include/asm-xtensa/ptrace.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ptrace.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_PTRACE_H | ||
12 | #define _XTENSA_PTRACE_H | ||
13 | |||
14 | #include <xtensa/config/core.h> | ||
15 | |||
16 | /* | ||
17 | * Kernel stack | ||
18 | * | ||
19 | * +-----------------------+ -------- STACK_SIZE | ||
20 | * | register file | | | ||
21 | * +-----------------------+ | | ||
22 | * | struct pt_regs | | | ||
23 | * +-----------------------+ | ------ PT_REGS_OFFSET | ||
24 | * double : 16 bytes spill area : | ^ | ||
25 | * excetion :- - - - - - - - - - - -: | | | ||
26 | * frame : struct pt_regs : | | | ||
27 | * :- - - - - - - - - - - -: | | | ||
28 | * | | | | | ||
29 | * | memory stack | | | | ||
30 | * | | | | | ||
31 | * ~ ~ ~ ~ | ||
32 | * ~ ~ ~ ~ | ||
33 | * | | | | | ||
34 | * | | | | | ||
35 | * +-----------------------+ | | --- STACK_BIAS | ||
36 | * | struct task_struct | | | ^ | ||
37 | * current --> +-----------------------+ | | | | ||
38 | * | struct thread_info | | | | | ||
39 | * +-----------------------+ -------- | ||
40 | */ | ||
41 | |||
42 | #define KERNEL_STACK_SIZE (2 * PAGE_SIZE) | ||
43 | |||
44 | /* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */ | ||
45 | |||
46 | #define EXC_TABLE_KSTK 0x004 /* Kernel Stack */ | ||
47 | #define EXC_TABLE_DOUBLE_SAVE 0x008 /* Double exception save area for a0 */ | ||
48 | #define EXC_TABLE_FIXUP 0x00c /* Fixup handler */ | ||
49 | #define EXC_TABLE_PARAM 0x010 /* For passing a parameter to fixup */ | ||
50 | #define EXC_TABLE_SYSCALL_SAVE 0x014 /* For fast syscall handler */ | ||
51 | #define EXC_TABLE_FAST_USER 0x100 /* Fast user exception handler */ | ||
52 | #define EXC_TABLE_FAST_KERNEL 0x200 /* Fast kernel exception handler */ | ||
53 | #define EXC_TABLE_DEFAULT 0x300 /* Default C-Handler */ | ||
54 | #define EXC_TABLE_SIZE 0x400 | ||
55 | |||
56 | /* Registers used by strace */ | ||
57 | |||
58 | #define REG_A_BASE 0xfc000000 | ||
59 | #define REG_AR_BASE 0x04000000 | ||
60 | #define REG_PC 0x14000000 | ||
61 | #define REG_PS 0x080000e6 | ||
62 | #define REG_WB 0x08000048 | ||
63 | #define REG_WS 0x08000049 | ||
64 | #define REG_LBEG 0x08000000 | ||
65 | #define REG_LEND 0x08000001 | ||
66 | #define REG_LCOUNT 0x08000002 | ||
67 | #define REG_SAR 0x08000003 | ||
68 | #define REG_DEPC 0x080000c0 | ||
69 | #define REG_EXCCAUSE 0x080000e8 | ||
70 | #define REG_EXCVADDR 0x080000ee | ||
71 | #define SYSCALL_NR 0x1 | ||
72 | |||
73 | #define AR_REGNO_TO_A_REGNO(ar, wb) (ar - wb*4) & ~(XCHAL_NUM_AREGS - 1) | ||
74 | |||
75 | /* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */ | ||
76 | |||
77 | #define PTRACE_GETREGS 12 | ||
78 | #define PTRACE_SETREGS 13 | ||
79 | #define PTRACE_GETFPREGS 14 | ||
80 | #define PTRACE_SETFPREGS 15 | ||
81 | #define PTRACE_GETFPREGSIZE 18 | ||
82 | |||
83 | #ifndef __ASSEMBLY__ | ||
84 | |||
85 | /* | ||
86 | * This struct defines the way the registers are stored on the | ||
87 | * kernel stack during a system call or other kernel entry. | ||
88 | */ | ||
89 | struct pt_regs { | ||
90 | unsigned long pc; /* 4 */ | ||
91 | unsigned long ps; /* 8 */ | ||
92 | unsigned long depc; /* 12 */ | ||
93 | unsigned long exccause; /* 16 */ | ||
94 | unsigned long excvaddr; /* 20 */ | ||
95 | unsigned long debugcause; /* 24 */ | ||
96 | unsigned long wmask; /* 28 */ | ||
97 | unsigned long lbeg; /* 32 */ | ||
98 | unsigned long lend; /* 36 */ | ||
99 | unsigned long lcount; /* 40 */ | ||
100 | unsigned long sar; /* 44 */ | ||
101 | unsigned long windowbase; /* 48 */ | ||
102 | unsigned long windowstart; /* 52 */ | ||
103 | unsigned long syscall; /* 56 */ | ||
104 | int reserved[2]; /* 64 */ | ||
105 | |||
106 | /* Make sure the areg field is 16 bytes aligned. */ | ||
107 | int align[0] __attribute__ ((aligned(16))); | ||
108 | |||
109 | /* current register frame. | ||
110 | * Note: The ESF for kernel exceptions ends after 16 registers! | ||
111 | */ | ||
112 | unsigned long areg[16]; /* 128 (64) */ | ||
113 | }; | ||
114 | |||
115 | #ifdef __KERNEL__ | ||
116 | # define xtensa_pt_regs(tsk) ((struct pt_regs*) \ | ||
117 | (((long)(tsk)->thread_info + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4)) - 1) | ||
118 | # define user_mode(regs) (((regs)->ps & 0x00000020)!=0) | ||
119 | # define instruction_pointer(regs) ((regs)->pc) | ||
120 | extern void show_regs(struct pt_regs *); | ||
121 | |||
122 | # ifndef CONFIG_SMP | ||
123 | # define profile_pc(regs) instruction_pointer(regs) | ||
124 | # endif | ||
125 | #endif /* __KERNEL__ */ | ||
126 | |||
127 | #else /* __ASSEMBLY__ */ | ||
128 | |||
129 | #ifdef __KERNEL__ | ||
130 | # include <asm/offsets.h> | ||
131 | #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) | ||
132 | #endif | ||
133 | |||
134 | #endif /* !__ASSEMBLY__ */ | ||
135 | #endif /* _XTENSA_PTRACE_H */ | ||
diff --git a/include/asm-xtensa/resource.h b/include/asm-xtensa/resource.h new file mode 100644 index 000000000000..17b5ab311771 --- /dev/null +++ b/include/asm-xtensa/resource.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/resource.h | ||
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 | * Copyright (C) 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_RESOURCE_H | ||
12 | #define _XTENSA_RESOURCE_H | ||
13 | |||
14 | #include <asm-generic/resource.h> | ||
15 | |||
16 | #endif /* _XTENSA_RESOURCE_H */ | ||
diff --git a/include/asm-xtensa/rmap.h b/include/asm-xtensa/rmap.h new file mode 100644 index 000000000000..649588b7e9ad --- /dev/null +++ b/include/asm-xtensa/rmap.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/rmap.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_RMAP_H | ||
12 | #define _XTENSA_RMAP_H | ||
13 | |||
14 | #include <asm-generic/rmap.h> | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-xtensa/rwsem.h b/include/asm-xtensa/rwsem.h new file mode 100644 index 000000000000..3c02b0e033f0 --- /dev/null +++ b/include/asm-xtensa/rwsem.h | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/rwsem.h | ||
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 | * Largely copied from include/asm-ppc/rwsem.h | ||
9 | * | ||
10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_RWSEM_H | ||
14 | #define _XTENSA_RWSEM_H | ||
15 | |||
16 | #include <linux/list.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | #include <asm/atomic.h> | ||
19 | #include <asm/system.h> | ||
20 | |||
21 | /* | ||
22 | * the semaphore definition | ||
23 | */ | ||
24 | struct rw_semaphore { | ||
25 | signed long count; | ||
26 | #define RWSEM_UNLOCKED_VALUE 0x00000000 | ||
27 | #define RWSEM_ACTIVE_BIAS 0x00000001 | ||
28 | #define RWSEM_ACTIVE_MASK 0x0000ffff | ||
29 | #define RWSEM_WAITING_BIAS (-0x00010000) | ||
30 | #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS | ||
31 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) | ||
32 | spinlock_t wait_lock; | ||
33 | struct list_head wait_list; | ||
34 | #if RWSEM_DEBUG | ||
35 | int debug; | ||
36 | #endif | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * initialisation | ||
41 | */ | ||
42 | #if RWSEM_DEBUG | ||
43 | #define __RWSEM_DEBUG_INIT , 0 | ||
44 | #else | ||
45 | #define __RWSEM_DEBUG_INIT /* */ | ||
46 | #endif | ||
47 | |||
48 | #define __RWSEM_INITIALIZER(name) \ | ||
49 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ | ||
50 | LIST_HEAD_INIT((name).wait_list) \ | ||
51 | __RWSEM_DEBUG_INIT } | ||
52 | |||
53 | #define DECLARE_RWSEM(name) \ | ||
54 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | ||
55 | |||
56 | extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); | ||
57 | extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | ||
58 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); | ||
59 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | ||
60 | |||
61 | static inline void init_rwsem(struct rw_semaphore *sem) | ||
62 | { | ||
63 | sem->count = RWSEM_UNLOCKED_VALUE; | ||
64 | spin_lock_init(&sem->wait_lock); | ||
65 | INIT_LIST_HEAD(&sem->wait_list); | ||
66 | #if RWSEM_DEBUG | ||
67 | sem->debug = 0; | ||
68 | #endif | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * lock for reading | ||
73 | */ | ||
74 | static inline void __down_read(struct rw_semaphore *sem) | ||
75 | { | ||
76 | if (atomic_add_return(1,(atomic_t *)(&sem->count)) > 0) | ||
77 | smp_wmb(); | ||
78 | else | ||
79 | rwsem_down_read_failed(sem); | ||
80 | } | ||
81 | |||
82 | static inline int __down_read_trylock(struct rw_semaphore *sem) | ||
83 | { | ||
84 | int tmp; | ||
85 | |||
86 | while ((tmp = sem->count) >= 0) { | ||
87 | if (tmp == cmpxchg(&sem->count, tmp, | ||
88 | tmp + RWSEM_ACTIVE_READ_BIAS)) { | ||
89 | smp_wmb(); | ||
90 | return 1; | ||
91 | } | ||
92 | } | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * lock for writing | ||
98 | */ | ||
99 | static inline void __down_write(struct rw_semaphore *sem) | ||
100 | { | ||
101 | int tmp; | ||
102 | |||
103 | tmp = atomic_add_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
104 | (atomic_t *)(&sem->count)); | ||
105 | if (tmp == RWSEM_ACTIVE_WRITE_BIAS) | ||
106 | smp_wmb(); | ||
107 | else | ||
108 | rwsem_down_write_failed(sem); | ||
109 | } | ||
110 | |||
111 | static inline int __down_write_trylock(struct rw_semaphore *sem) | ||
112 | { | ||
113 | int tmp; | ||
114 | |||
115 | tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE, | ||
116 | RWSEM_ACTIVE_WRITE_BIAS); | ||
117 | smp_wmb(); | ||
118 | return tmp == RWSEM_UNLOCKED_VALUE; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * unlock after reading | ||
123 | */ | ||
124 | static inline void __up_read(struct rw_semaphore *sem) | ||
125 | { | ||
126 | int tmp; | ||
127 | |||
128 | smp_wmb(); | ||
129 | tmp = atomic_sub_return(1,(atomic_t *)(&sem->count)); | ||
130 | if (tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0) | ||
131 | rwsem_wake(sem); | ||
132 | } | ||
133 | |||
134 | /* | ||
135 | * unlock after writing | ||
136 | */ | ||
137 | static inline void __up_write(struct rw_semaphore *sem) | ||
138 | { | ||
139 | smp_wmb(); | ||
140 | if (atomic_sub_return(RWSEM_ACTIVE_WRITE_BIAS, | ||
141 | (atomic_t *)(&sem->count)) < 0) | ||
142 | rwsem_wake(sem); | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | * implement atomic add functionality | ||
147 | */ | ||
148 | static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem) | ||
149 | { | ||
150 | atomic_add(delta, (atomic_t *)(&sem->count)); | ||
151 | } | ||
152 | |||
153 | /* | ||
154 | * downgrade write lock to read lock | ||
155 | */ | ||
156 | static inline void __downgrade_write(struct rw_semaphore *sem) | ||
157 | { | ||
158 | int tmp; | ||
159 | |||
160 | smp_wmb(); | ||
161 | tmp = atomic_add_return(-RWSEM_WAITING_BIAS, (atomic_t *)(&sem->count)); | ||
162 | if (tmp < 0) | ||
163 | rwsem_downgrade_wake(sem); | ||
164 | } | ||
165 | |||
166 | /* | ||
167 | * implement exchange and add functionality | ||
168 | */ | ||
169 | static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) | ||
170 | { | ||
171 | smp_mb(); | ||
172 | return atomic_add_return(delta, (atomic_t *)(&sem->count)); | ||
173 | } | ||
174 | |||
175 | #endif /* _XTENSA_RWSEM_XADD_H */ | ||
diff --git a/include/asm-xtensa/scatterlist.h b/include/asm-xtensa/scatterlist.h new file mode 100644 index 000000000000..38a2b9acd658 --- /dev/null +++ b/include/asm-xtensa/scatterlist.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/scatterlist.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SCATTERLIST_H | ||
12 | #define _XTENSA_SCATTERLIST_H | ||
13 | |||
14 | struct scatterlist { | ||
15 | struct page *page; | ||
16 | unsigned int offset; | ||
17 | dma_addr_t dma_address; | ||
18 | unsigned int length; | ||
19 | }; | ||
20 | |||
21 | /* | ||
22 | * These macros should be used after a pci_map_sg call has been done | ||
23 | * to get bus addresses of each of the SG entries and their lengths. | ||
24 | * You should only work with the number of sg entries pci_map_sg | ||
25 | * returns, or alternatively stop on the first sg_dma_len(sg) which | ||
26 | * is 0. | ||
27 | */ | ||
28 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
29 | #define sg_dma_len(sg) ((sg)->length) | ||
30 | |||
31 | |||
32 | #define ISA_DMA_THRESHOLD (~0UL) | ||
33 | |||
34 | #endif /* _XTENSA_SCATTERLIST_H */ | ||
diff --git a/include/asm-xtensa/sections.h b/include/asm-xtensa/sections.h new file mode 100644 index 000000000000..40b5191b55a2 --- /dev/null +++ b/include/asm-xtensa/sections.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sections.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SECTIONS_H | ||
12 | #define _XTENSA_SECTIONS_H | ||
13 | |||
14 | #include <asm-generic/sections.h> | ||
15 | |||
16 | #endif /* _XTENSA_SECTIONS_H */ | ||
diff --git a/include/asm-xtensa/segment.h b/include/asm-xtensa/segment.h new file mode 100644 index 000000000000..a2eb547a1a75 --- /dev/null +++ b/include/asm-xtensa/segment.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/segment.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SEGMENT_H | ||
12 | #define _XTENSA_SEGMENT_H | ||
13 | |||
14 | #include <asm/uaccess.h> | ||
15 | |||
16 | #endif /* _XTENSA_SEGEMENT_H */ | ||
diff --git a/include/asm-xtensa/semaphore.h b/include/asm-xtensa/semaphore.h new file mode 100644 index 000000000000..c8a7574a9a57 --- /dev/null +++ b/include/asm-xtensa/semaphore.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * linux/include/asm-xtensa/semaphore.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SEMAPHORE_H | ||
12 | #define _XTENSA_SEMAPHORE_H | ||
13 | |||
14 | #include <asm/atomic.h> | ||
15 | #include <asm/system.h> | ||
16 | #include <linux/wait.h> | ||
17 | #include <linux/rwsem.h> | ||
18 | |||
19 | struct semaphore { | ||
20 | atomic_t count; | ||
21 | int sleepers; | ||
22 | wait_queue_head_t wait; | ||
23 | #if WAITQUEUE_DEBUG | ||
24 | long __magic; | ||
25 | #endif | ||
26 | }; | ||
27 | |||
28 | #if WAITQUEUE_DEBUG | ||
29 | # define __SEM_DEBUG_INIT(name) \ | ||
30 | , (int)&(name).__magic | ||
31 | #else | ||
32 | # define __SEM_DEBUG_INIT(name) | ||
33 | #endif | ||
34 | |||
35 | #define __SEMAPHORE_INITIALIZER(name,count) \ | ||
36 | { ATOMIC_INIT(count), \ | ||
37 | 0, \ | ||
38 | __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ | ||
39 | __SEM_DEBUG_INIT(name) } | ||
40 | |||
41 | #define __MUTEX_INITIALIZER(name) \ | ||
42 | __SEMAPHORE_INITIALIZER(name, 1) | ||
43 | |||
44 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ | ||
45 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | ||
46 | |||
47 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) | ||
48 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) | ||
49 | |||
50 | extern inline void sema_init (struct semaphore *sem, int val) | ||
51 | { | ||
52 | /* | ||
53 | * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); | ||
54 | * | ||
55 | * i'd rather use the more flexible initialization above, but sadly | ||
56 | * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well. | ||
57 | */ | ||
58 | atomic_set(&sem->count, val); | ||
59 | init_waitqueue_head(&sem->wait); | ||
60 | #if WAITQUEUE_DEBUG | ||
61 | sem->__magic = (int)&sem->__magic; | ||
62 | #endif | ||
63 | } | ||
64 | |||
65 | static inline void init_MUTEX (struct semaphore *sem) | ||
66 | { | ||
67 | sema_init(sem, 1); | ||
68 | } | ||
69 | |||
70 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) | ||
71 | { | ||
72 | sema_init(sem, 0); | ||
73 | } | ||
74 | |||
75 | asmlinkage void __down(struct semaphore * sem); | ||
76 | asmlinkage int __down_interruptible(struct semaphore * sem); | ||
77 | asmlinkage int __down_trylock(struct semaphore * sem); | ||
78 | asmlinkage void __up(struct semaphore * sem); | ||
79 | |||
80 | extern spinlock_t semaphore_wake_lock; | ||
81 | |||
82 | extern __inline__ void down(struct semaphore * sem) | ||
83 | { | ||
84 | #if WAITQUEUE_DEBUG | ||
85 | CHECK_MAGIC(sem->__magic); | ||
86 | #endif | ||
87 | |||
88 | if (atomic_sub_return(1, &sem->count) < 0) | ||
89 | __down(sem); | ||
90 | } | ||
91 | |||
92 | extern __inline__ int down_interruptible(struct semaphore * sem) | ||
93 | { | ||
94 | int ret = 0; | ||
95 | #if WAITQUEUE_DEBUG | ||
96 | CHECK_MAGIC(sem->__magic); | ||
97 | #endif | ||
98 | |||
99 | if (atomic_sub_return(1, &sem->count) < 0) | ||
100 | ret = __down_interruptible(sem); | ||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | extern __inline__ int down_trylock(struct semaphore * sem) | ||
105 | { | ||
106 | int ret = 0; | ||
107 | #if WAITQUEUE_DEBUG | ||
108 | CHECK_MAGIC(sem->__magic); | ||
109 | #endif | ||
110 | |||
111 | if (atomic_sub_return(1, &sem->count) < 0) | ||
112 | ret = __down_trylock(sem); | ||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * Note! This is subtle. We jump to wake people up only if | ||
118 | * the semaphore was negative (== somebody was waiting on it). | ||
119 | */ | ||
120 | extern __inline__ void up(struct semaphore * sem) | ||
121 | { | ||
122 | #if WAITQUEUE_DEBUG | ||
123 | CHECK_MAGIC(sem->__magic); | ||
124 | #endif | ||
125 | if (atomic_add_return(1, &sem->count) <= 0) | ||
126 | __up(sem); | ||
127 | } | ||
128 | |||
129 | #endif /* _XTENSA_SEMAPHORE_H */ | ||
diff --git a/include/asm-xtensa/sembuf.h b/include/asm-xtensa/sembuf.h new file mode 100644 index 000000000000..2d26c47666fe --- /dev/null +++ b/include/asm-xtensa/sembuf.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sembuf.h | ||
3 | * | ||
4 | * The semid64_ds structure for Xtensa architecture. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | * | ||
12 | * Note extra padding because this structure is passed back and forth | ||
13 | * between kernel and user space. | ||
14 | * | ||
15 | * Pad space is left for: | ||
16 | * - 64-bit time_t to solve y2038 problem | ||
17 | * - 2 miscellaneous 32-bit values | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #ifndef _XTENSA_SEMBUF_H | ||
22 | #define _XTENSA_SEMBUF_H | ||
23 | |||
24 | #include <asm/byteorder.h> | ||
25 | |||
26 | struct semid64_ds { | ||
27 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
28 | #if XCHAL_HAVE_LE | ||
29 | __kernel_time_t sem_otime; /* last semop time */ | ||
30 | unsigned long __unused1; | ||
31 | __kernel_time_t sem_ctime; /* last change time */ | ||
32 | unsigned long __unused2; | ||
33 | #else | ||
34 | unsigned long __unused1; | ||
35 | __kernel_time_t sem_otime; /* last semop time */ | ||
36 | unsigned long __unused2; | ||
37 | __kernel_time_t sem_ctime; /* last change time */ | ||
38 | #endif | ||
39 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
40 | unsigned long __unused3; | ||
41 | unsigned long __unused4; | ||
42 | }; | ||
43 | |||
44 | #endif /* __ASM_XTENSA_SEMBUF_H */ | ||
diff --git a/include/asm-xtensa/serial.h b/include/asm-xtensa/serial.h new file mode 100644 index 000000000000..ec04114fcf0b --- /dev/null +++ b/include/asm-xtensa/serial.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/serial.h | ||
3 | * | ||
4 | * Configuration details for 8250, 16450, 16550, etc. serial ports | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_SERIAL_H | ||
14 | #define _XTENSA_SERIAL_H | ||
15 | |||
16 | #include <asm/platform/serial.h> | ||
17 | |||
18 | #endif /* _XTENSA_SERIAL_H */ | ||
diff --git a/include/asm-xtensa/setup.h b/include/asm-xtensa/setup.h new file mode 100644 index 000000000000..e3636520d8cc --- /dev/null +++ b/include/asm-xtensa/setup.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/setup.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SETUP_H | ||
12 | #define _XTENSA_SETUP_H | ||
13 | |||
14 | #define COMMAND_LINE_SIZE 256 | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-xtensa/shmbuf.h b/include/asm-xtensa/shmbuf.h new file mode 100644 index 000000000000..a30b81a4b933 --- /dev/null +++ b/include/asm-xtensa/shmbuf.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/shmbuf.h | ||
3 | * | ||
4 | * The shmid64_ds structure for Xtensa architecture. | ||
5 | * Note extra padding because this structure is passed back and forth | ||
6 | * between kernel and user space. | ||
7 | * | ||
8 | * Pad space is left for: | ||
9 | * - 64-bit time_t to solve y2038 problem | ||
10 | * - 2 miscellaneous 32-bit values | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General Public | ||
13 | * License. See the file "COPYING" in the main directory of this archive | ||
14 | * for more details. | ||
15 | * | ||
16 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
17 | */ | ||
18 | |||
19 | #ifndef _XTENSA_SHMBUF_H | ||
20 | #define _XTENSA_SHMBUF_H | ||
21 | |||
22 | struct shmid64_ds { | ||
23 | struct ipc64_perm shm_perm; /* operation perms */ | ||
24 | size_t shm_segsz; /* size of segment (bytes) */ | ||
25 | __kernel_time_t shm_atime; /* last attach time */ | ||
26 | unsigned long __unused1; | ||
27 | __kernel_time_t shm_dtime; /* last detach time */ | ||
28 | unsigned long __unused2; | ||
29 | __kernel_time_t shm_ctime; /* last change time */ | ||
30 | unsigned long __unused3; | ||
31 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
32 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
33 | unsigned long shm_nattch; /* no. of current attaches */ | ||
34 | unsigned long __unused4; | ||
35 | unsigned long __unused5; | ||
36 | }; | ||
37 | |||
38 | struct shminfo64 { | ||
39 | unsigned long shmmax; | ||
40 | unsigned long shmmin; | ||
41 | unsigned long shmmni; | ||
42 | unsigned long shmseg; | ||
43 | unsigned long shmall; | ||
44 | unsigned long __unused1; | ||
45 | unsigned long __unused2; | ||
46 | unsigned long __unused3; | ||
47 | unsigned long __unused4; | ||
48 | }; | ||
49 | |||
50 | #endif /* _XTENSA_SHMBUF_H */ | ||
diff --git a/include/asm-xtensa/shmparam.h b/include/asm-xtensa/shmparam.h new file mode 100644 index 000000000000..d3b65bfa71c3 --- /dev/null +++ b/include/asm-xtensa/shmparam.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/shmparam.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _XTENSA_SHMPARAM_H | ||
10 | #define _XTENSA_SHMPARAM_H | ||
11 | |||
12 | #include <asm/processor.h> | ||
13 | |||
14 | /* | ||
15 | * Xtensa can have variable size caches, and if | ||
16 | * the size of single way is larger than the page size, | ||
17 | * then we have to start worrying about cache aliasing | ||
18 | * problems. | ||
19 | */ | ||
20 | |||
21 | #define SHMLBA ((PAGE_SIZE > DCACHE_WAY_SIZE)? PAGE_SIZE : DCACHE_WAY_SIZE) | ||
22 | |||
23 | #endif /* _XTENSA_SHMPARAM_H */ | ||
diff --git a/include/asm-xtensa/sigcontext.h b/include/asm-xtensa/sigcontext.h new file mode 100644 index 000000000000..a75177291418 --- /dev/null +++ b/include/asm-xtensa/sigcontext.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sigcontext.h | ||
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 | * Copyright (C) 2001 - 2003 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SIGCONTEXT_H | ||
12 | #define _XTENSA_SIGCONTEXT_H | ||
13 | |||
14 | #define _ASMLANGUAGE | ||
15 | #include <asm/processor.h> | ||
16 | #include <asm/coprocessor.h> | ||
17 | |||
18 | |||
19 | struct _cpstate { | ||
20 | unsigned char _cpstate[XTENSA_CP_EXTRA_SIZE]; | ||
21 | } __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN))); | ||
22 | |||
23 | |||
24 | struct sigcontext { | ||
25 | unsigned long oldmask; | ||
26 | |||
27 | /* CPU registers */ | ||
28 | unsigned long sc_pc; | ||
29 | unsigned long sc_ps; | ||
30 | unsigned long sc_wmask; | ||
31 | unsigned long sc_windowbase; | ||
32 | unsigned long sc_windowstart; | ||
33 | unsigned long sc_lbeg; | ||
34 | unsigned long sc_lend; | ||
35 | unsigned long sc_lcount; | ||
36 | unsigned long sc_sar; | ||
37 | unsigned long sc_depc; | ||
38 | unsigned long sc_dareg0; | ||
39 | unsigned long sc_treg[4]; | ||
40 | unsigned long sc_areg[XCHAL_NUM_AREGS]; | ||
41 | struct _cpstate *sc_cpstate; | ||
42 | }; | ||
43 | |||
44 | #endif /* __ASM_XTENSA_SIGCONTEXT_H */ | ||
diff --git a/include/asm-xtensa/siginfo.h b/include/asm-xtensa/siginfo.h new file mode 100644 index 000000000000..44f0ae77b539 --- /dev/null +++ b/include/asm-xtensa/siginfo.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/processor.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SIGINFO_H | ||
12 | #define _XTENSA_SIGINFO_H | ||
13 | |||
14 | #include <asm-generic/siginfo.h> | ||
15 | |||
16 | #endif /* _XTENSA_SIGINFO_H */ | ||
diff --git a/include/asm-xtensa/signal.h b/include/asm-xtensa/signal.h new file mode 100644 index 000000000000..5d6fc9cdf58d --- /dev/null +++ b/include/asm-xtensa/signal.h | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/signal.h | ||
3 | * | ||
4 | * Swiped from SH. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_SIGNAL_H | ||
14 | #define _XTENSA_SIGNAL_H | ||
15 | |||
16 | |||
17 | #define _NSIG 64 | ||
18 | #define _NSIG_BPW 32 | ||
19 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
20 | |||
21 | #ifndef __ASSEMBLY__ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | /* Avoid too many header ordering problems. */ | ||
26 | struct siginfo; | ||
27 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
28 | typedef struct { | ||
29 | unsigned long sig[_NSIG_WORDS]; | ||
30 | } sigset_t; | ||
31 | |||
32 | #endif | ||
33 | |||
34 | #define SIGHUP 1 | ||
35 | #define SIGINT 2 | ||
36 | #define SIGQUIT 3 | ||
37 | #define SIGILL 4 | ||
38 | #define SIGTRAP 5 | ||
39 | #define SIGABRT 6 | ||
40 | #define SIGIOT 6 | ||
41 | #define SIGBUS 7 | ||
42 | #define SIGFPE 8 | ||
43 | #define SIGKILL 9 | ||
44 | #define SIGUSR1 10 | ||
45 | #define SIGSEGV 11 | ||
46 | #define SIGUSR2 12 | ||
47 | #define SIGPIPE 13 | ||
48 | #define SIGALRM 14 | ||
49 | #define SIGTERM 15 | ||
50 | #define SIGSTKFLT 16 | ||
51 | #define SIGCHLD 17 | ||
52 | #define SIGCONT 18 | ||
53 | #define SIGSTOP 19 | ||
54 | #define SIGTSTP 20 | ||
55 | #define SIGTTIN 21 | ||
56 | #define SIGTTOU 22 | ||
57 | #define SIGURG 23 | ||
58 | #define SIGXCPU 24 | ||
59 | #define SIGXFSZ 25 | ||
60 | #define SIGVTALRM 26 | ||
61 | #define SIGPROF 27 | ||
62 | #define SIGWINCH 28 | ||
63 | #define SIGIO 29 | ||
64 | #define SIGPOLL SIGIO | ||
65 | /* #define SIGLOST 29 */ | ||
66 | #define SIGPWR 30 | ||
67 | #define SIGSYS 31 | ||
68 | #define SIGUNUSED 31 | ||
69 | |||
70 | /* These should not be considered constants from userland. */ | ||
71 | #define SIGRTMIN 32 | ||
72 | #define SIGRTMAX (_NSIG-1) | ||
73 | |||
74 | /* | ||
75 | * SA_FLAGS values: | ||
76 | * | ||
77 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
78 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
79 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
80 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
81 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
82 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
83 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
84 | * | ||
85 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
86 | * Unix names RESETHAND and NODEFER respectively. | ||
87 | */ | ||
88 | #define SA_NOCLDSTOP 0x00000001 | ||
89 | #define SA_NOCLDWAIT 0x00000002 /* not supported yet */ | ||
90 | #define SA_SIGINFO 0x00000004 | ||
91 | #define SA_ONSTACK 0x08000000 | ||
92 | #define SA_RESTART 0x10000000 | ||
93 | #define SA_NODEFER 0x40000000 | ||
94 | #define SA_RESETHAND 0x80000000 | ||
95 | |||
96 | #define SA_NOMASK SA_NODEFER | ||
97 | #define SA_ONESHOT SA_RESETHAND | ||
98 | #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ | ||
99 | |||
100 | #define SA_RESTORER 0x04000000 | ||
101 | |||
102 | /* | ||
103 | * sigaltstack controls | ||
104 | */ | ||
105 | #define SS_ONSTACK 1 | ||
106 | #define SS_DISABLE 2 | ||
107 | |||
108 | #define MINSIGSTKSZ 2048 | ||
109 | #define SIGSTKSZ 8192 | ||
110 | |||
111 | #ifndef __ASSEMBLY__ | ||
112 | #ifdef __KERNEL__ | ||
113 | |||
114 | /* | ||
115 | * These values of sa_flags are used only by the kernel as part of the | ||
116 | * irq handling routines. | ||
117 | * | ||
118 | * SA_INTERRUPT is also used by the irq handling routines. | ||
119 | * SA_SHIRQ is for shared interrupt support on PCI and EISA. | ||
120 | */ | ||
121 | #define SA_PROBE SA_ONESHOT | ||
122 | #define SA_SAMPLE_RANDOM SA_RESTART | ||
123 | #define SA_SHIRQ 0x04000000 | ||
124 | #endif | ||
125 | |||
126 | #define SIG_BLOCK 0 /* for blocking signals */ | ||
127 | #define SIG_UNBLOCK 1 /* for unblocking signals */ | ||
128 | #define SIG_SETMASK 2 /* for setting the signal mask */ | ||
129 | |||
130 | /* Type of a signal handler. */ | ||
131 | typedef void (*__sighandler_t)(int); | ||
132 | |||
133 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ | ||
134 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ | ||
135 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ | ||
136 | |||
137 | #ifdef __KERNEL__ | ||
138 | struct old_sigaction { | ||
139 | __sighandler_t sa_handler; | ||
140 | old_sigset_t sa_mask; | ||
141 | unsigned long sa_flags; | ||
142 | void (*sa_restorer)(void); | ||
143 | }; | ||
144 | |||
145 | struct sigaction { | ||
146 | __sighandler_t sa_handler; | ||
147 | unsigned long sa_flags; | ||
148 | void (*sa_restorer)(void); | ||
149 | sigset_t sa_mask; /* mask last for extensibility */ | ||
150 | }; | ||
151 | |||
152 | struct k_sigaction { | ||
153 | struct sigaction sa; | ||
154 | }; | ||
155 | |||
156 | #else | ||
157 | |||
158 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
159 | |||
160 | struct sigaction { | ||
161 | union { | ||
162 | __sighandler_t _sa_handler; | ||
163 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
164 | } _u; | ||
165 | sigset_t sa_mask; | ||
166 | unsigned long sa_flags; | ||
167 | void (*sa_restorer)(void); | ||
168 | }; | ||
169 | |||
170 | #define sa_handler _u._sa_handler | ||
171 | #define sa_sigaction _u._sa_sigaction | ||
172 | |||
173 | #endif /* __KERNEL__ */ | ||
174 | |||
175 | typedef struct sigaltstack { | ||
176 | void *ss_sp; | ||
177 | int ss_flags; | ||
178 | size_t ss_size; | ||
179 | } stack_t; | ||
180 | |||
181 | #ifdef __KERNEL__ | ||
182 | #include <asm/sigcontext.h> | ||
183 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
184 | |||
185 | #endif /* __KERNEL__ */ | ||
186 | #endif /* __ASSEMBLY__ */ | ||
187 | #endif /* _XTENSA_SIGNAL_H */ | ||
diff --git a/include/asm-xtensa/smp.h b/include/asm-xtensa/smp.h new file mode 100644 index 000000000000..83c569e3bdbd --- /dev/null +++ b/include/asm-xtensa/smp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/smp.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SMP_H | ||
12 | #define _XTENSA_SMP_H | ||
13 | |||
14 | extern struct xtensa_cpuinfo boot_cpu_data; | ||
15 | |||
16 | #define cpu_data (&boot_cpu_data) | ||
17 | #define current_cpu_data boot_cpu_data | ||
18 | |||
19 | struct xtensa_cpuinfo { | ||
20 | unsigned long *pgd_cache; | ||
21 | unsigned long *pte_cache; | ||
22 | unsigned long pgtable_cache_sz; | ||
23 | }; | ||
24 | |||
25 | #define cpu_logical_map(cpu) (cpu) | ||
26 | |||
27 | #endif /* _XTENSA_SMP_H */ | ||
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h new file mode 100644 index 000000000000..daccd05a14cd --- /dev/null +++ b/include/asm-xtensa/socket.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/socket.h | ||
3 | * | ||
4 | * Copied from i386. | ||
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 | |||
11 | #ifndef _XTENSA_SOCKET_H | ||
12 | #define _XTENSA_SOCKET_H | ||
13 | |||
14 | #include <asm/sockios.h> | ||
15 | |||
16 | /* For setsockoptions(2) */ | ||
17 | #define SOL_SOCKET 1 | ||
18 | |||
19 | #define SO_DEBUG 1 | ||
20 | #define SO_REUSEADDR 2 | ||
21 | #define SO_TYPE 3 | ||
22 | #define SO_ERROR 4 | ||
23 | #define SO_DONTROUTE 5 | ||
24 | #define SO_BROADCAST 6 | ||
25 | #define SO_SNDBUF 7 | ||
26 | #define SO_RCVBUF 8 | ||
27 | #define SO_KEEPALIVE 9 | ||
28 | #define SO_OOBINLINE 10 | ||
29 | #define SO_NO_CHECK 11 | ||
30 | #define SO_PRIORITY 12 | ||
31 | #define SO_LINGER 13 | ||
32 | #define SO_BSDCOMPAT 14 | ||
33 | /* To add :#define SO_REUSEPORT 15 */ | ||
34 | #define SO_PASSCRED 16 | ||
35 | #define SO_PEERCRED 17 | ||
36 | #define SO_RCVLOWAT 18 | ||
37 | #define SO_SNDLOWAT 19 | ||
38 | #define SO_RCVTIMEO 20 | ||
39 | #define SO_SNDTIMEO 21 | ||
40 | |||
41 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
42 | |||
43 | #define SO_SECURITY_AUTHENTICATION 22 | ||
44 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
45 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
46 | |||
47 | #define SO_BINDTODEVICE 25 | ||
48 | |||
49 | /* Socket filtering */ | ||
50 | |||
51 | #define SO_ATTACH_FILTER 26 | ||
52 | #define SO_DETACH_FILTER 27 | ||
53 | |||
54 | #define SO_PEERNAME 28 | ||
55 | #define SO_TIMESTAMP 29 | ||
56 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
57 | |||
58 | #define SO_ACCEPTCONN 30 | ||
59 | #define SO_PEERSEC 31 | ||
60 | |||
61 | #endif /* _XTENSA_SOCKET_H */ | ||
diff --git a/include/asm-xtensa/sockios.h b/include/asm-xtensa/sockios.h new file mode 100644 index 000000000000..20d2ba10ecd1 --- /dev/null +++ b/include/asm-xtensa/sockios.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/sockios.h | ||
3 | * | ||
4 | * Socket-level I/O control calls. Copied from MIPS. | ||
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 | * Copyright (C) 1995 by Ralf Baechle | ||
11 | * Copyright (C) 2001 Tensilica Inc. | ||
12 | */ | ||
13 | |||
14 | #ifndef _XTENSA_SOCKIOS_H | ||
15 | #define _XTENSA_SOCKIOS_H | ||
16 | |||
17 | #include <asm/ioctl.h> | ||
18 | |||
19 | /* Socket-level I/O control calls. */ | ||
20 | |||
21 | #define FIOGETOWN _IOR('f', 123, int) | ||
22 | #define FIOSETOWN _IOW('f', 124, int) | ||
23 | |||
24 | #define SIOCATMARK _IOR('s', 7, int) | ||
25 | #define SIOCSPGRP _IOW('s', 8, pid_t) | ||
26 | #define SIOCGPGRP _IOR('s', 9, pid_t) | ||
27 | |||
28 | #define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ | ||
29 | |||
30 | #endif /* _XTENSA_SOCKIOS_H */ | ||
diff --git a/include/asm-xtensa/spinlock.h b/include/asm-xtensa/spinlock.h new file mode 100644 index 000000000000..8ff23649581b --- /dev/null +++ b/include/asm-xtensa/spinlock.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/spinlock.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SPINLOCK_H | ||
12 | #define _XTENSA_SPINLOCK_H | ||
13 | |||
14 | #include <linux/spinlock.h> | ||
15 | |||
16 | #endif /* _XTENSA_SPINLOCK_H */ | ||
diff --git a/include/asm-xtensa/stat.h b/include/asm-xtensa/stat.h new file mode 100644 index 000000000000..2f4662ff6c3a --- /dev/null +++ b/include/asm-xtensa/stat.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/stat.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_STAT_H | ||
12 | #define _XTENSA_STAT_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | |||
16 | struct __old_kernel_stat { | ||
17 | unsigned short st_dev; | ||
18 | unsigned short st_ino; | ||
19 | unsigned short st_mode; | ||
20 | unsigned short st_nlink; | ||
21 | unsigned short st_uid; | ||
22 | unsigned short st_gid; | ||
23 | unsigned short st_rdev; | ||
24 | unsigned long st_size; | ||
25 | unsigned long st_atime; | ||
26 | unsigned long st_mtime; | ||
27 | unsigned long st_ctime; | ||
28 | }; | ||
29 | |||
30 | #define STAT_HAVE_NSEC 1 | ||
31 | |||
32 | struct stat { | ||
33 | unsigned short st_dev; | ||
34 | unsigned short __pad1; | ||
35 | unsigned long st_ino; | ||
36 | unsigned short st_mode; | ||
37 | unsigned short st_nlink; | ||
38 | unsigned short st_uid; | ||
39 | unsigned short st_gid; | ||
40 | unsigned short st_rdev; | ||
41 | unsigned short __pad2; | ||
42 | unsigned long st_size; | ||
43 | unsigned long st_blksize; | ||
44 | unsigned long st_blocks; | ||
45 | unsigned long st_atime; | ||
46 | unsigned long st_atime_nsec; | ||
47 | unsigned long st_mtime; | ||
48 | unsigned long st_mtime_nsec; | ||
49 | unsigned long st_ctime; | ||
50 | unsigned long st_ctime_nsec; | ||
51 | unsigned long __unused4; | ||
52 | unsigned long __unused5; | ||
53 | }; | ||
54 | |||
55 | /* This matches struct stat64 in glibc-2.2.3. */ | ||
56 | |||
57 | struct stat64 { | ||
58 | #ifdef __XTENSA_EL__ | ||
59 | unsigned short st_dev; /* Device */ | ||
60 | unsigned char __pad0[10]; | ||
61 | #else | ||
62 | unsigned char __pad0[6]; | ||
63 | unsigned short st_dev; | ||
64 | unsigned char __pad1[2]; | ||
65 | #endif | ||
66 | |||
67 | #define STAT64_HAS_BROKEN_ST_INO 1 | ||
68 | unsigned long __st_ino; /* 32bit file serial number. */ | ||
69 | |||
70 | unsigned int st_mode; /* File mode. */ | ||
71 | unsigned int st_nlink; /* Link count. */ | ||
72 | unsigned int st_uid; /* User ID of the file's owner. */ | ||
73 | unsigned int st_gid; /* Group ID of the file's group. */ | ||
74 | |||
75 | #ifdef __XTENSA_EL__ | ||
76 | unsigned short st_rdev; /* Device number, if device. */ | ||
77 | unsigned char __pad3[10]; | ||
78 | #else | ||
79 | unsigned char __pad2[6]; | ||
80 | unsigned short st_rdev; | ||
81 | unsigned char __pad3[2]; | ||
82 | #endif | ||
83 | |||
84 | long long int st_size; /* Size of file, in bytes. */ | ||
85 | long int st_blksize; /* Optimal block size for I/O. */ | ||
86 | |||
87 | #ifdef __XTENSA_EL__ | ||
88 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
89 | unsigned long __pad4; | ||
90 | #else | ||
91 | unsigned long __pad4; | ||
92 | unsigned long st_blocks; | ||
93 | #endif | ||
94 | |||
95 | unsigned long __pad5; | ||
96 | long int st_atime; /* Time of last access. */ | ||
97 | unsigned long st_atime_nsec; | ||
98 | long int st_mtime; /* Time of last modification. */ | ||
99 | unsigned long st_mtime_nsec; | ||
100 | long int st_ctime; /* Time of last status change. */ | ||
101 | unsigned long st_ctime_nsec; | ||
102 | unsigned long long int st_ino; /* File serial number. */ | ||
103 | }; | ||
104 | |||
105 | #endif /* _XTENSA_STAT_H */ | ||
diff --git a/include/asm-xtensa/statfs.h b/include/asm-xtensa/statfs.h new file mode 100644 index 000000000000..9c3d1a213136 --- /dev/null +++ b/include/asm-xtensa/statfs.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/statfs.h | ||
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 | * Copyright (C) 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_STATFS_H | ||
12 | #define _XTENSA_STATFS_H | ||
13 | |||
14 | #include <asm-generic/statfs.h> | ||
15 | |||
16 | #endif /* _XTENSA_STATFS_H */ | ||
17 | |||
diff --git a/include/asm-xtensa/string.h b/include/asm-xtensa/string.h new file mode 100644 index 000000000000..3f81b27d9809 --- /dev/null +++ b/include/asm-xtensa/string.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/string.h | ||
3 | * | ||
4 | * These trivial string functions are considered part of the public domain. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | /* We should optimize these. See arch/xtensa/lib/strncpy_user.S */ | ||
14 | |||
15 | #ifndef _XTENSA_STRING_H | ||
16 | #define _XTENSA_STRING_H | ||
17 | |||
18 | #define __HAVE_ARCH_STRCPY | ||
19 | extern __inline__ char *strcpy(char *__dest, const char *__src) | ||
20 | { | ||
21 | register char *__xdest = __dest; | ||
22 | unsigned long __dummy; | ||
23 | |||
24 | __asm__ __volatile__("1:\n\t" | ||
25 | "l8ui %2, %1, 0\n\t" | ||
26 | "s8i %2, %0, 0\n\t" | ||
27 | "addi %1, %1, 1\n\t" | ||
28 | "addi %0, %0, 1\n\t" | ||
29 | "bnez %2, 1b\n\t" | ||
30 | : "=r" (__dest), "=r" (__src), "=&r" (__dummy) | ||
31 | : "0" (__dest), "1" (__src) | ||
32 | : "memory"); | ||
33 | |||
34 | return __xdest; | ||
35 | } | ||
36 | |||
37 | #define __HAVE_ARCH_STRNCPY | ||
38 | extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n) | ||
39 | { | ||
40 | register char *__xdest = __dest; | ||
41 | unsigned long __dummy; | ||
42 | |||
43 | if (__n == 0) | ||
44 | return __xdest; | ||
45 | |||
46 | __asm__ __volatile__( | ||
47 | "1:\n\t" | ||
48 | "l8ui %2, %1, 0\n\t" | ||
49 | "s8i %2, %0, 0\n\t" | ||
50 | "addi %1, %1, 1\n\t" | ||
51 | "addi %0, %0, 1\n\t" | ||
52 | "beqz %2, 2f\n\t" | ||
53 | "bne %1, %5, 1b\n" | ||
54 | "2:" | ||
55 | : "=r" (__dest), "=r" (__src), "=&r" (__dummy) | ||
56 | : "0" (__dest), "1" (__src), "r" (__src+__n) | ||
57 | : "memory"); | ||
58 | |||
59 | return __xdest; | ||
60 | } | ||
61 | |||
62 | #define __HAVE_ARCH_STRCMP | ||
63 | extern __inline__ int strcmp(const char *__cs, const char *__ct) | ||
64 | { | ||
65 | register int __res; | ||
66 | unsigned long __dummy; | ||
67 | |||
68 | __asm__ __volatile__( | ||
69 | "1:\n\t" | ||
70 | "l8ui %3, %1, 0\n\t" | ||
71 | "addi %1, %1, 1\n\t" | ||
72 | "l8ui %2, %0, 0\n\t" | ||
73 | "addi %0, %0, 1\n\t" | ||
74 | "beqz %2, 2f\n\t" | ||
75 | "beq %2, %3, 1b\n" | ||
76 | "2:\n\t" | ||
77 | "sub %2, %3, %2" | ||
78 | : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy) | ||
79 | : "0" (__cs), "1" (__ct)); | ||
80 | |||
81 | return __res; | ||
82 | } | ||
83 | |||
84 | #define __HAVE_ARCH_STRNCMP | ||
85 | extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n) | ||
86 | { | ||
87 | register int __res; | ||
88 | unsigned long __dummy; | ||
89 | |||
90 | __asm__ __volatile__( | ||
91 | "mov %2, %3\n" | ||
92 | "1:\n\t" | ||
93 | "beq %0, %6, 2f\n\t" | ||
94 | "l8ui %3, %1, 0\n\t" | ||
95 | "addi %1, %1, 1\n\t" | ||
96 | "l8ui %2, %0, 0\n\t" | ||
97 | "addi %0, %0, 1\n\t" | ||
98 | "beqz %2, 2f\n\t" | ||
99 | "beqz %3, 2f\n\t" | ||
100 | "beq %2, %3, 1b\n" | ||
101 | "2:\n\t" | ||
102 | "sub %2, %3, %2" | ||
103 | : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy) | ||
104 | : "0" (__cs), "1" (__ct), "r" (__cs+__n)); | ||
105 | |||
106 | return __res; | ||
107 | } | ||
108 | |||
109 | #define __HAVE_ARCH_MEMSET | ||
110 | extern void *memset(void *__s, int __c, size_t __count); | ||
111 | |||
112 | #define __HAVE_ARCH_MEMCPY | ||
113 | extern void *memcpy(void *__to, __const__ void *__from, size_t __n); | ||
114 | |||
115 | #define __HAVE_ARCH_MEMMOVE | ||
116 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); | ||
117 | |||
118 | /* Don't build bcopy at all ... */ | ||
119 | #define __HAVE_ARCH_BCOPY | ||
120 | |||
121 | #define __HAVE_ARCH_MEMSCAN | ||
122 | #define memscan memchr | ||
123 | |||
124 | #endif /* _XTENSA_STRING_H */ | ||
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h new file mode 100644 index 000000000000..690fe325e671 --- /dev/null +++ b/include/asm-xtensa/system.h | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/system.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_SYSTEM_H | ||
12 | #define _XTENSA_SYSTEM_H | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/stringify.h> | ||
16 | |||
17 | #include <asm/processor.h> | ||
18 | |||
19 | /* interrupt control */ | ||
20 | |||
21 | #define local_save_flags(x) \ | ||
22 | __asm__ __volatile__ ("rsr %0,"__stringify(PS) : "=a" (x)); | ||
23 | #define local_irq_restore(x) do { \ | ||
24 | __asm__ __volatile__ ("wsr %0, "__stringify(PS)" ; rsync" \ | ||
25 | :: "a" (x) : "memory"); } while(0); | ||
26 | #define local_irq_save(x) do { \ | ||
27 | __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL) \ | ||
28 | : "=a" (x) :: "memory");} while(0); | ||
29 | |||
30 | static inline void local_irq_disable(void) | ||
31 | { | ||
32 | unsigned long flags; | ||
33 | __asm__ __volatile__ ("rsil %0, "__stringify(LOCKLEVEL) | ||
34 | : "=a" (flags) :: "memory"); | ||
35 | } | ||
36 | static inline void local_irq_enable(void) | ||
37 | { | ||
38 | unsigned long flags; | ||
39 | __asm__ __volatile__ ("rsil %0, 0" : "=a" (flags) :: "memory"); | ||
40 | |||
41 | } | ||
42 | |||
43 | static inline int irqs_disabled(void) | ||
44 | { | ||
45 | unsigned long flags; | ||
46 | local_save_flags(flags); | ||
47 | return flags & 0xf; | ||
48 | } | ||
49 | |||
50 | #define RSR_CPENABLE(x) do { \ | ||
51 | __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \ | ||
52 | } while(0); | ||
53 | #define WSR_CPENABLE(x) do { \ | ||
54 | __asm__ __volatile__("wsr %0," __stringify(CPENABLE)";rsync" \ | ||
55 | :: "a" (x));} while(0); | ||
56 | |||
57 | #define clear_cpenable() __clear_cpenable() | ||
58 | |||
59 | extern __inline__ void __clear_cpenable(void) | ||
60 | { | ||
61 | #if XCHAL_HAVE_CP | ||
62 | unsigned long i = 0; | ||
63 | WSR_CPENABLE(i); | ||
64 | #endif | ||
65 | } | ||
66 | |||
67 | extern __inline__ void enable_coprocessor(int i) | ||
68 | { | ||
69 | #if XCHAL_HAVE_CP | ||
70 | int cp; | ||
71 | RSR_CPENABLE(cp); | ||
72 | cp |= 1 << i; | ||
73 | WSR_CPENABLE(cp); | ||
74 | #endif | ||
75 | } | ||
76 | |||
77 | extern __inline__ void disable_coprocessor(int i) | ||
78 | { | ||
79 | #if XCHAL_HAVE_CP | ||
80 | int cp; | ||
81 | RSR_CPENABLE(cp); | ||
82 | cp &= ~(1 << i); | ||
83 | WSR_CPENABLE(cp); | ||
84 | #endif | ||
85 | } | ||
86 | |||
87 | #define smp_read_barrier_depends() do { } while(0) | ||
88 | #define read_barrier_depends() do { } while(0) | ||
89 | |||
90 | #define mb() barrier() | ||
91 | #define rmb() mb() | ||
92 | #define wmb() mb() | ||
93 | |||
94 | #ifdef CONFIG_SMP | ||
95 | #error smp_* not defined | ||
96 | #else | ||
97 | #define smp_mb() barrier() | ||
98 | #define smp_rmb() barrier() | ||
99 | #define smp_wmb() barrier() | ||
100 | #endif | ||
101 | |||
102 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
103 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
104 | |||
105 | #if !defined (__ASSEMBLY__) | ||
106 | |||
107 | /* * switch_to(n) should switch tasks to task nr n, first | ||
108 | * checking that n isn't the current task, in which case it does nothing. | ||
109 | */ | ||
110 | extern void *_switch_to(void *last, void *next); | ||
111 | |||
112 | #endif /* __ASSEMBLY__ */ | ||
113 | |||
114 | #define prepare_to_switch() do { } while(0) | ||
115 | |||
116 | #define switch_to(prev,next,last) \ | ||
117 | do { \ | ||
118 | clear_cpenable(); \ | ||
119 | (last) = _switch_to(prev, next); \ | ||
120 | } while(0) | ||
121 | |||
122 | /* | ||
123 | * cmpxchg | ||
124 | */ | ||
125 | |||
126 | extern __inline__ unsigned long | ||
127 | __cmpxchg_u32(volatile int *p, int old, int new) | ||
128 | { | ||
129 | __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
130 | "l32i %0, %1, 0 \n\t" | ||
131 | "bne %0, %2, 1f \n\t" | ||
132 | "s32i %3, %1, 0 \n\t" | ||
133 | "1: \n\t" | ||
134 | "wsr a15, "__stringify(PS)" \n\t" | ||
135 | "rsync \n\t" | ||
136 | : "=&a" (old) | ||
137 | : "a" (p), "a" (old), "r" (new) | ||
138 | : "a15", "memory"); | ||
139 | return old; | ||
140 | } | ||
141 | /* This function doesn't exist, so you'll get a linker error | ||
142 | * if something tries to do an invalid cmpxchg(). */ | ||
143 | |||
144 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
145 | |||
146 | static __inline__ unsigned long | ||
147 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | ||
148 | { | ||
149 | switch (size) { | ||
150 | case 4: return __cmpxchg_u32(ptr, old, new); | ||
151 | default: __cmpxchg_called_with_bad_pointer(); | ||
152 | return old; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | #define cmpxchg(ptr,o,n) \ | ||
157 | ({ __typeof__(*(ptr)) _o_ = (o); \ | ||
158 | __typeof__(*(ptr)) _n_ = (n); \ | ||
159 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
160 | (unsigned long)_n_, sizeof (*(ptr))); \ | ||
161 | }) | ||
162 | |||
163 | |||
164 | |||
165 | |||
166 | /* | ||
167 | * xchg_u32 | ||
168 | * | ||
169 | * Note that a15 is used here because the register allocation | ||
170 | * done by the compiler is not guaranteed and a window overflow | ||
171 | * may not occur between the rsil and wsr instructions. By using | ||
172 | * a15 in the rsil, the machine is guaranteed to be in a state | ||
173 | * where no register reference will cause an overflow. | ||
174 | */ | ||
175 | |||
176 | extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) | ||
177 | { | ||
178 | unsigned long tmp; | ||
179 | __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t" | ||
180 | "l32i %0, %1, 0 \n\t" | ||
181 | "s32i %2, %1, 0 \n\t" | ||
182 | "wsr a15, "__stringify(PS)" \n\t" | ||
183 | "rsync \n\t" | ||
184 | : "=&a" (tmp) | ||
185 | : "a" (m), "a" (val) | ||
186 | : "a15", "memory"); | ||
187 | return tmp; | ||
188 | } | ||
189 | |||
190 | #define tas(ptr) (xchg((ptr),1)) | ||
191 | |||
192 | #if ( __XCC__ == 1 ) | ||
193 | |||
194 | /* xt-xcc processes __inline__ differently than xt-gcc and decides to | ||
195 | * insert an out-of-line copy of function __xchg. This presents the | ||
196 | * unresolved symbol at link time of __xchg_called_with_bad_pointer, | ||
197 | * even though such a function would never be called at run-time. | ||
198 | * xt-gcc always inlines __xchg, and optimizes away the undefined | ||
199 | * bad_pointer function. | ||
200 | */ | ||
201 | |||
202 | #define xchg(ptr,x) xchg_u32(ptr,x) | ||
203 | |||
204 | #else /* assume xt-gcc */ | ||
205 | |||
206 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
207 | |||
208 | /* | ||
209 | * This only works if the compiler isn't horribly bad at optimizing. | ||
210 | * gcc-2.5.8 reportedly can't handle this, but I define that one to | ||
211 | * be dead anyway. | ||
212 | */ | ||
213 | |||
214 | extern void __xchg_called_with_bad_pointer(void); | ||
215 | |||
216 | static __inline__ unsigned long | ||
217 | __xchg(unsigned long x, volatile void * ptr, int size) | ||
218 | { | ||
219 | switch (size) { | ||
220 | case 4: | ||
221 | return xchg_u32(ptr, x); | ||
222 | } | ||
223 | __xchg_called_with_bad_pointer(); | ||
224 | return x; | ||
225 | } | ||
226 | |||
227 | #endif | ||
228 | |||
229 | extern void set_except_vector(int n, void *addr); | ||
230 | |||
231 | static inline void spill_registers(void) | ||
232 | { | ||
233 | unsigned int a0, ps; | ||
234 | |||
235 | __asm__ __volatile__ ( | ||
236 | "movi a14," __stringify (PS_EXCM_MASK) " | 1\n\t" | ||
237 | "mov a12, a0\n\t" | ||
238 | "rsr a13," __stringify(SAR) "\n\t" | ||
239 | "xsr a14," __stringify(PS) "\n\t" | ||
240 | "movi a0, _spill_registers\n\t" | ||
241 | "rsync\n\t" | ||
242 | "callx0 a0\n\t" | ||
243 | "mov a0, a12\n\t" | ||
244 | "wsr a13," __stringify(SAR) "\n\t" | ||
245 | "wsr a14," __stringify(PS) "\n\t" | ||
246 | :: "a" (&a0), "a" (&ps) | ||
247 | : "a2", "a3", "a12", "a13", "a14", "a15", "memory"); | ||
248 | } | ||
249 | |||
250 | #define arch_align_stack(x) (x) | ||
251 | |||
252 | #endif /* _XTENSA_SYSTEM_H */ | ||
diff --git a/include/asm-xtensa/termbits.h b/include/asm-xtensa/termbits.h new file mode 100644 index 000000000000..c780593ff5f9 --- /dev/null +++ b/include/asm-xtensa/termbits.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/termbits.h | ||
3 | * | ||
4 | * Copied from SH. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_TERMBITS_H | ||
14 | #define _XTENSA_TERMBITS_H | ||
15 | |||
16 | |||
17 | #include <linux/posix_types.h> | ||
18 | |||
19 | typedef unsigned char cc_t; | ||
20 | typedef unsigned int speed_t; | ||
21 | typedef unsigned int tcflag_t; | ||
22 | |||
23 | #define NCCS 19 | ||
24 | struct termios { | ||
25 | tcflag_t c_iflag; /* input mode flags */ | ||
26 | tcflag_t c_oflag; /* output mode flags */ | ||
27 | tcflag_t c_cflag; /* control mode flags */ | ||
28 | tcflag_t c_lflag; /* local mode flags */ | ||
29 | cc_t c_line; /* line discipline */ | ||
30 | cc_t c_cc[NCCS]; /* control characters */ | ||
31 | }; | ||
32 | |||
33 | /* c_cc characters */ | ||
34 | |||
35 | #define VINTR 0 | ||
36 | #define VQUIT 1 | ||
37 | #define VERASE 2 | ||
38 | #define VKILL 3 | ||
39 | #define VEOF 4 | ||
40 | #define VTIME 5 | ||
41 | #define VMIN 6 | ||
42 | #define VSWTC 7 | ||
43 | #define VSTART 8 | ||
44 | #define VSTOP 9 | ||
45 | #define VSUSP 10 | ||
46 | #define VEOL 11 | ||
47 | #define VREPRINT 12 | ||
48 | #define VDISCARD 13 | ||
49 | #define VWERASE 14 | ||
50 | #define VLNEXT 15 | ||
51 | #define VEOL2 16 | ||
52 | |||
53 | /* c_iflag bits */ | ||
54 | |||
55 | #define IGNBRK 0000001 | ||
56 | #define BRKINT 0000002 | ||
57 | #define IGNPAR 0000004 | ||
58 | #define PARMRK 0000010 | ||
59 | #define INPCK 0000020 | ||
60 | #define ISTRIP 0000040 | ||
61 | #define INLCR 0000100 | ||
62 | #define IGNCR 0000200 | ||
63 | #define ICRNL 0000400 | ||
64 | #define IUCLC 0001000 | ||
65 | #define IXON 0002000 | ||
66 | #define IXANY 0004000 | ||
67 | #define IXOFF 0010000 | ||
68 | #define IMAXBEL 0020000 | ||
69 | #define IUTF8 0040000 | ||
70 | |||
71 | /* c_oflag bits */ | ||
72 | |||
73 | #define OPOST 0000001 | ||
74 | #define OLCUC 0000002 | ||
75 | #define ONLCR 0000004 | ||
76 | #define OCRNL 0000010 | ||
77 | #define ONOCR 0000020 | ||
78 | #define ONLRET 0000040 | ||
79 | #define OFILL 0000100 | ||
80 | #define OFDEL 0000200 | ||
81 | #define NLDLY 0000400 | ||
82 | #define NL0 0000000 | ||
83 | #define NL1 0000400 | ||
84 | #define CRDLY 0003000 | ||
85 | #define CR0 0000000 | ||
86 | #define CR1 0001000 | ||
87 | #define CR2 0002000 | ||
88 | #define CR3 0003000 | ||
89 | #define TABDLY 0014000 | ||
90 | #define TAB0 0000000 | ||
91 | #define TAB1 0004000 | ||
92 | #define TAB2 0010000 | ||
93 | #define TAB3 0014000 | ||
94 | #define XTABS 0014000 | ||
95 | #define BSDLY 0020000 | ||
96 | #define BS0 0000000 | ||
97 | #define BS1 0020000 | ||
98 | #define VTDLY 0040000 | ||
99 | #define VT0 0000000 | ||
100 | #define VT1 0040000 | ||
101 | #define FFDLY 0100000 | ||
102 | #define FF0 0000000 | ||
103 | #define FF1 0100000 | ||
104 | |||
105 | /* c_cflag bit meaning */ | ||
106 | |||
107 | #define CBAUD 0010017 | ||
108 | #define B0 0000000 /* hang up */ | ||
109 | #define B50 0000001 | ||
110 | #define B75 0000002 | ||
111 | #define B110 0000003 | ||
112 | #define B134 0000004 | ||
113 | #define B150 0000005 | ||
114 | #define B200 0000006 | ||
115 | #define B300 0000007 | ||
116 | #define B600 0000010 | ||
117 | #define B1200 0000011 | ||
118 | #define B1800 0000012 | ||
119 | #define B2400 0000013 | ||
120 | #define B4800 0000014 | ||
121 | #define B9600 0000015 | ||
122 | #define B19200 0000016 | ||
123 | #define B38400 0000017 | ||
124 | #define EXTA B19200 | ||
125 | #define EXTB B38400 | ||
126 | #define CSIZE 0000060 | ||
127 | #define CS5 0000000 | ||
128 | #define CS6 0000020 | ||
129 | #define CS7 0000040 | ||
130 | #define CS8 0000060 | ||
131 | #define CSTOPB 0000100 | ||
132 | #define CREAD 0000200 | ||
133 | #define PARENB 0000400 | ||
134 | #define PARODD 0001000 | ||
135 | #define HUPCL 0002000 | ||
136 | #define CLOCAL 0004000 | ||
137 | #define CBAUDEX 0010000 | ||
138 | #define B57600 0010001 | ||
139 | #define B115200 0010002 | ||
140 | #define B230400 0010003 | ||
141 | #define B460800 0010004 | ||
142 | #define B500000 0010005 | ||
143 | #define B576000 0010006 | ||
144 | #define B921600 0010007 | ||
145 | #define B1000000 0010010 | ||
146 | #define B1152000 0010011 | ||
147 | #define B1500000 0010012 | ||
148 | #define B2000000 0010013 | ||
149 | #define B2500000 0010014 | ||
150 | #define B3000000 0010015 | ||
151 | #define B3500000 0010016 | ||
152 | #define B4000000 0010017 | ||
153 | #define CIBAUD 002003600000 /* input baud rate (not used) */ | ||
154 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
155 | #define CRTSCTS 020000000000 /* flow control */ | ||
156 | |||
157 | /* c_lflag bits */ | ||
158 | |||
159 | #define ISIG 0000001 | ||
160 | #define ICANON 0000002 | ||
161 | #define XCASE 0000004 | ||
162 | #define ECHO 0000010 | ||
163 | #define ECHOE 0000020 | ||
164 | #define ECHOK 0000040 | ||
165 | #define ECHONL 0000100 | ||
166 | #define NOFLSH 0000200 | ||
167 | #define TOSTOP 0000400 | ||
168 | #define ECHOCTL 0001000 | ||
169 | #define ECHOPRT 0002000 | ||
170 | #define ECHOKE 0004000 | ||
171 | #define FLUSHO 0010000 | ||
172 | #define PENDIN 0040000 | ||
173 | #define IEXTEN 0100000 | ||
174 | |||
175 | /* tcflow() and TCXONC use these */ | ||
176 | |||
177 | #define TCOOFF 0 | ||
178 | #define TCOON 1 | ||
179 | #define TCIOFF 2 | ||
180 | #define TCION 3 | ||
181 | |||
182 | /* tcflush() and TCFLSH use these */ | ||
183 | |||
184 | #define TCIFLUSH 0 | ||
185 | #define TCOFLUSH 1 | ||
186 | #define TCIOFLUSH 2 | ||
187 | |||
188 | /* tcsetattr uses these */ | ||
189 | |||
190 | #define TCSANOW 0 | ||
191 | #define TCSADRAIN 1 | ||
192 | #define TCSAFLUSH 2 | ||
193 | |||
194 | #endif /* _XTENSA_TERMBITS_H */ | ||
diff --git a/include/asm-xtensa/termios.h b/include/asm-xtensa/termios.h new file mode 100644 index 000000000000..83c6aed1d115 --- /dev/null +++ b/include/asm-xtensa/termios.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/termios.h | ||
3 | * | ||
4 | * Copied from SH. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_TERMIOS_H | ||
14 | #define _XTENSA_TERMIOS_H | ||
15 | |||
16 | #include <asm/termbits.h> | ||
17 | #include <asm/ioctls.h> | ||
18 | |||
19 | struct winsize { | ||
20 | unsigned short ws_row; | ||
21 | unsigned short ws_col; | ||
22 | unsigned short ws_xpixel; | ||
23 | unsigned short ws_ypixel; | ||
24 | }; | ||
25 | |||
26 | #define NCC 8 | ||
27 | struct termio { | ||
28 | unsigned short c_iflag; /* input mode flags */ | ||
29 | unsigned short c_oflag; /* output mode flags */ | ||
30 | unsigned short c_cflag; /* control mode flags */ | ||
31 | unsigned short c_lflag; /* local mode flags */ | ||
32 | unsigned char c_line; /* line discipline */ | ||
33 | unsigned char c_cc[NCC]; /* control characters */ | ||
34 | }; | ||
35 | |||
36 | /* Modem lines */ | ||
37 | |||
38 | #define TIOCM_LE 0x001 | ||
39 | #define TIOCM_DTR 0x002 | ||
40 | #define TIOCM_RTS 0x004 | ||
41 | #define TIOCM_ST 0x008 | ||
42 | #define TIOCM_SR 0x010 | ||
43 | #define TIOCM_CTS 0x020 | ||
44 | #define TIOCM_CAR 0x040 | ||
45 | #define TIOCM_RNG 0x080 | ||
46 | #define TIOCM_DSR 0x100 | ||
47 | #define TIOCM_CD TIOCM_CAR | ||
48 | #define TIOCM_RI TIOCM_RNG | ||
49 | #define TIOCM_OUT1 0x2000 | ||
50 | #define TIOCM_OUT2 0x4000 | ||
51 | #define TIOCM_LOOP 0x8000 | ||
52 | |||
53 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
54 | |||
55 | /* Line disciplines */ | ||
56 | |||
57 | #define N_TTY 0 | ||
58 | #define N_SLIP 1 | ||
59 | #define N_MOUSE 2 | ||
60 | #define N_PPP 3 | ||
61 | #define N_STRIP 4 | ||
62 | #define N_AX25 5 | ||
63 | #define N_X25 6 /* X.25 async */ | ||
64 | #define N_6PACK 7 | ||
65 | #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ | ||
66 | #define N_R3964 9 /* Reserved for Simatic R3964 module */ | ||
67 | #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ | ||
68 | #define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */ | ||
69 | #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ | ||
70 | #define N_HDLC 13 /* synchronous HDLC */ | ||
71 | #define N_SYNC_PPP 14 | ||
72 | #define N_HCI 15 /* Bluetooth HCI UART */ | ||
73 | |||
74 | #ifdef __KERNEL__ | ||
75 | |||
76 | /* intr=^C quit=^\ erase=del kill=^U | ||
77 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | ||
78 | start=^Q stop=^S susp=^Z eol=\0 | ||
79 | reprint=^R discard=^U werase=^W lnext=^V | ||
80 | eol2=\0 | ||
81 | */ | ||
82 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | ||
83 | |||
84 | /* | ||
85 | * Translate a "termio" structure into a "termios". Ugh. | ||
86 | */ | ||
87 | |||
88 | #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ | ||
89 | unsigned short __tmp; \ | ||
90 | get_user(__tmp,&(termio)->x); \ | ||
91 | *(unsigned short *) &(termios)->x = __tmp; \ | ||
92 | } | ||
93 | |||
94 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
95 | ({ \ | ||
96 | SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ | ||
97 | SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ | ||
98 | SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ | ||
99 | SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ | ||
100 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
101 | }) | ||
102 | |||
103 | /* | ||
104 | * Translate a "termios" structure into a "termio". Ugh. | ||
105 | */ | ||
106 | |||
107 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
108 | ({ \ | ||
109 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
110 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
111 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
112 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
113 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
114 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
115 | }) | ||
116 | |||
117 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) | ||
118 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) | ||
119 | |||
120 | #endif /* __KERNEL__ */ | ||
121 | |||
122 | #endif /* _XTENSA_TERMIOS_H */ | ||
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h new file mode 100644 index 000000000000..af208d41fd82 --- /dev/null +++ b/include/asm-xtensa/thread_info.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/thread_info.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_THREAD_INFO_H | ||
12 | #define _XTENSA_THREAD_INFO_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | # include <asm/processor.h> | ||
18 | #endif | ||
19 | |||
20 | /* | ||
21 | * low level task data that entry.S needs immediate access to | ||
22 | * - this struct should fit entirely inside of one cache line | ||
23 | * - this struct shares the supervisor stack pages | ||
24 | * - if the contents of this structure are changed, the assembly constants | ||
25 | * must also be changed | ||
26 | */ | ||
27 | |||
28 | #ifndef __ASSEMBLY__ | ||
29 | |||
30 | struct thread_info { | ||
31 | struct task_struct *task; /* main task structure */ | ||
32 | struct exec_domain *exec_domain; /* execution domain */ | ||
33 | unsigned long flags; /* low level flags */ | ||
34 | unsigned long status; /* thread-synchronous flags */ | ||
35 | __u32 cpu; /* current CPU */ | ||
36 | __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/ | ||
37 | |||
38 | mm_segment_t addr_limit; /* thread address space */ | ||
39 | struct restart_block restart_block; | ||
40 | |||
41 | |||
42 | }; | ||
43 | |||
44 | #else /* !__ASSEMBLY__ */ | ||
45 | |||
46 | /* offsets into the thread_info struct for assembly code access */ | ||
47 | #define TI_TASK 0x00000000 | ||
48 | #define TI_EXEC_DOMAIN 0x00000004 | ||
49 | #define TI_FLAGS 0x00000008 | ||
50 | #define TI_STATUS 0x0000000C | ||
51 | #define TI_CPU 0x00000010 | ||
52 | #define TI_PRE_COUNT 0x00000014 | ||
53 | #define TI_ADDR_LIMIT 0x00000018 | ||
54 | #define TI_RESTART_BLOCK 0x000001C | ||
55 | |||
56 | #endif | ||
57 | |||
58 | #define PREEMPT_ACTIVE 0x10000000 | ||
59 | |||
60 | /* | ||
61 | * macros/functions for gaining access to the thread information structure | ||
62 | * | ||
63 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
64 | */ | ||
65 | |||
66 | #ifndef __ASSEMBLY__ | ||
67 | |||
68 | #define INIT_THREAD_INFO(tsk) \ | ||
69 | { \ | ||
70 | .task = &tsk, \ | ||
71 | .exec_domain = &default_exec_domain, \ | ||
72 | .flags = 0, \ | ||
73 | .cpu = 0, \ | ||
74 | .preempt_count = 1, \ | ||
75 | .addr_limit = KERNEL_DS, \ | ||
76 | .restart_block = { \ | ||
77 | .fn = do_no_restart_syscall, \ | ||
78 | }, \ | ||
79 | } | ||
80 | |||
81 | #define init_thread_info (init_thread_union.thread_info) | ||
82 | #define init_stack (init_thread_union.stack) | ||
83 | |||
84 | /* how to get the thread information struct from C */ | ||
85 | static inline struct thread_info *current_thread_info(void) | ||
86 | { | ||
87 | struct thread_info *ti; | ||
88 | __asm__("extui %0,a1,0,13\n\t" | ||
89 | "xor %0, a1, %0" : "=&r" (ti) : ); | ||
90 | return ti; | ||
91 | } | ||
92 | |||
93 | /* thread information allocation */ | ||
94 | #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) | ||
95 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
96 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
97 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
98 | |||
99 | #else /* !__ASSEMBLY__ */ | ||
100 | |||
101 | /* how to get the thread information struct from ASM */ | ||
102 | #define GET_THREAD_INFO(reg,sp) \ | ||
103 | extui reg, sp, 0, 13; \ | ||
104 | xor reg, sp, reg | ||
105 | #endif | ||
106 | |||
107 | |||
108 | /* | ||
109 | * thread information flags | ||
110 | * - these are process state flags that various assembly files may need to access | ||
111 | * - pending work-to-be-done flags are in LSW | ||
112 | * - other flags in MSW | ||
113 | */ | ||
114 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
115 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
116 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
117 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
118 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ | ||
119 | #define TIF_IRET 5 /* return with iret */ | ||
120 | #define TIF_MEMDIE 6 | ||
121 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
122 | |||
123 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
124 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
125 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
126 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
127 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | ||
128 | #define _TIF_IRET (1<<TIF_IRET) | ||
129 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
130 | |||
131 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | ||
132 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | ||
133 | |||
134 | /* | ||
135 | * Thread-synchronous status. | ||
136 | * | ||
137 | * This is different from the flags in that nobody else | ||
138 | * ever touches our thread-synchronous status, so we don't | ||
139 | * have to worry about atomic accesses. | ||
140 | */ | ||
141 | #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ | ||
142 | |||
143 | #define THREAD_SIZE 8192 //(2*PAGE_SIZE) | ||
144 | |||
145 | #endif /* __KERNEL__ */ | ||
146 | #endif /* _XTENSA_THREAD_INFO */ | ||
diff --git a/include/asm-xtensa/timex.h b/include/asm-xtensa/timex.h new file mode 100644 index 000000000000..d14a3755a12b --- /dev/null +++ b/include/asm-xtensa/timex.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/timex.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TIMEX_H | ||
12 | #define _XTENSA_TIMEX_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | #include <linux/stringify.h> | ||
18 | |||
19 | #if XCHAL_INT_LEVEL(XCHAL_TIMER0_INTERRUPT) == 1 | ||
20 | # define LINUX_TIMER 0 | ||
21 | #elif XCHAL_INT_LEVEL(XCHAL_TIMER1_INTERRUPT) == 1 | ||
22 | # define LINUX_TIMER 1 | ||
23 | #elif XCHAL_INT_LEVEL(XCHAL_TIMER2_INTERRUPT) == 1 | ||
24 | # define LINUX_TIMER 2 | ||
25 | #else | ||
26 | # error "Bad timer number for Linux configurations!" | ||
27 | #endif | ||
28 | |||
29 | #define LINUX_TIMER_INT XCHAL_TIMER_INTERRUPT(LINUX_TIMER) | ||
30 | #define LINUX_TIMER_MASK (1L << LINUX_TIMER_INT) | ||
31 | |||
32 | #define CLOCK_TICK_RATE 1193180 /* (everyone is using this value) */ | ||
33 | #define CLOCK_TICK_FACTOR 20 /* Factor of both 10^6 and CLOCK_TICK_RATE */ | ||
34 | #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ | ||
35 | (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ | ||
36 | << (SHIFT_SCALE-SHIFT_HZ)) / HZ) | ||
37 | |||
38 | #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT | ||
39 | extern unsigned long ccount_per_jiffy; | ||
40 | extern unsigned long ccount_nsec; | ||
41 | #define CCOUNT_PER_JIFFY ccount_per_jiffy | ||
42 | #define CCOUNT_NSEC ccount_nsec | ||
43 | #else | ||
44 | #define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ)) | ||
45 | #define CCOUNT_NSEC (1000000000UL / CONFIG_XTENSA_CPU_CLOCK) | ||
46 | #endif | ||
47 | |||
48 | |||
49 | typedef unsigned long long cycles_t; | ||
50 | |||
51 | /* | ||
52 | * Only used for SMP. | ||
53 | */ | ||
54 | |||
55 | extern cycles_t cacheflush_time; | ||
56 | |||
57 | #define get_cycles() (0) | ||
58 | |||
59 | |||
60 | /* | ||
61 | * Register access. | ||
62 | */ | ||
63 | |||
64 | #define WSR_CCOUNT(r) __asm__("wsr %0,"__stringify(CCOUNT) :: "a" (r)) | ||
65 | #define RSR_CCOUNT(r) __asm__("rsr %0,"__stringify(CCOUNT) : "=a" (r)) | ||
66 | #define WSR_CCOMPARE(x,r) __asm__("wsr %0,"__stringify(CCOMPARE_0)"+"__stringify(x) :: "a"(r)) | ||
67 | #define RSR_CCOMPARE(x,r) __asm__("rsr %0,"__stringify(CCOMPARE_0)"+"__stringify(x) : "=a"(r)) | ||
68 | |||
69 | static inline unsigned long get_ccount (void) | ||
70 | { | ||
71 | unsigned long ccount; | ||
72 | RSR_CCOUNT(ccount); | ||
73 | return ccount; | ||
74 | } | ||
75 | |||
76 | static inline void set_ccount (unsigned long ccount) | ||
77 | { | ||
78 | WSR_CCOUNT(ccount); | ||
79 | } | ||
80 | |||
81 | static inline unsigned long get_linux_timer (void) | ||
82 | { | ||
83 | unsigned ccompare; | ||
84 | RSR_CCOMPARE(LINUX_TIMER, ccompare); | ||
85 | return ccompare; | ||
86 | } | ||
87 | |||
88 | static inline void set_linux_timer (unsigned long ccompare) | ||
89 | { | ||
90 | WSR_CCOMPARE(LINUX_TIMER, ccompare); | ||
91 | } | ||
92 | |||
93 | #endif /* __KERNEL__ */ | ||
94 | #endif /* _XTENSA_TIMEX_H */ | ||
diff --git a/include/asm-xtensa/tlb.h b/include/asm-xtensa/tlb.h new file mode 100644 index 000000000000..4562b2dcfbc0 --- /dev/null +++ b/include/asm-xtensa/tlb.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/tlb.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TLB_H | ||
12 | #define _XTENSA_TLB_H | ||
13 | |||
14 | #define tlb_start_vma(tlb,vma) do { } while (0) | ||
15 | #define tlb_end_vma(tlb,vma) do { } while (0) | ||
16 | #define __tlb_remove_tlb_entry(tlb,pte,addr) do { } while (0) | ||
17 | |||
18 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
19 | |||
20 | #include <asm-generic/tlb.h> | ||
21 | #include <asm/page.h> | ||
22 | |||
23 | #define __pte_free_tlb(tlb,pte) pte_free(pte) | ||
24 | |||
25 | #endif /* _XTENSA_TLB_H */ | ||
diff --git a/include/asm-xtensa/tlbflush.h b/include/asm-xtensa/tlbflush.h new file mode 100644 index 000000000000..23bfe9db45f5 --- /dev/null +++ b/include/asm-xtensa/tlbflush.h | |||
@@ -0,0 +1,200 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/tlbflush.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TLBFLUSH_H | ||
12 | #define _XTENSA_TLBFLUSH_H | ||
13 | |||
14 | #define DEBUG_TLB | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <asm/processor.h> | ||
19 | #include <linux/stringify.h> | ||
20 | |||
21 | /* TLB flushing: | ||
22 | * | ||
23 | * - flush_tlb_all() flushes all processes TLB entries | ||
24 | * - flush_tlb_mm(mm) flushes the specified mm context TLB entries | ||
25 | * - flush_tlb_page(mm, vmaddr) flushes a single page | ||
26 | * - flush_tlb_range(mm, start, end) flushes a range of pages | ||
27 | */ | ||
28 | |||
29 | extern void flush_tlb_all(void); | ||
30 | extern void flush_tlb_mm(struct mm_struct*); | ||
31 | extern void flush_tlb_page(struct vm_area_struct*,unsigned long); | ||
32 | extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long); | ||
33 | |||
34 | #define flush_tlb_kernel_range(start,end) flush_tlb_all() | ||
35 | |||
36 | |||
37 | /* This is calld in munmap when we have freed up some page-table pages. | ||
38 | * We don't need to do anything here, there's nothing special about our | ||
39 | * page-table pages. | ||
40 | */ | ||
41 | |||
42 | extern inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
43 | unsigned long start, unsigned long end) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | /* TLB operations. */ | ||
48 | |||
49 | #define ITLB_WAYS_LOG2 XCHAL_ITLB_WAY_BITS | ||
50 | #define DTLB_WAYS_LOG2 XCHAL_DTLB_WAY_BITS | ||
51 | #define ITLB_PROBE_SUCCESS (1 << ITLB_WAYS_LOG2) | ||
52 | #define DTLB_PROBE_SUCCESS (1 << DTLB_WAYS_LOG2) | ||
53 | |||
54 | extern inline unsigned long itlb_probe(unsigned long addr) | ||
55 | { | ||
56 | unsigned long tmp; | ||
57 | __asm__ __volatile__("pitlb %0, %1\n\t" : "=a" (tmp) : "a" (addr)); | ||
58 | return tmp; | ||
59 | } | ||
60 | |||
61 | extern inline unsigned long dtlb_probe(unsigned long addr) | ||
62 | { | ||
63 | unsigned long tmp; | ||
64 | __asm__ __volatile__("pdtlb %0, %1\n\t" : "=a" (tmp) : "a" (addr)); | ||
65 | return tmp; | ||
66 | } | ||
67 | |||
68 | extern inline void invalidate_itlb_entry (unsigned long probe) | ||
69 | { | ||
70 | __asm__ __volatile__("iitlb %0; isync\n\t" : : "a" (probe)); | ||
71 | } | ||
72 | |||
73 | extern inline void invalidate_dtlb_entry (unsigned long probe) | ||
74 | { | ||
75 | __asm__ __volatile__("idtlb %0; dsync\n\t" : : "a" (probe)); | ||
76 | } | ||
77 | |||
78 | /* Use the .._no_isync functions with caution. Generally, these are | ||
79 | * handy for bulk invalidates followed by a single 'isync'. The | ||
80 | * caller must follow up with an 'isync', which can be relatively | ||
81 | * expensive on some Xtensa implementations. | ||
82 | */ | ||
83 | extern inline void invalidate_itlb_entry_no_isync (unsigned entry) | ||
84 | { | ||
85 | /* Caller must follow up with 'isync'. */ | ||
86 | __asm__ __volatile__ ("iitlb %0\n" : : "a" (entry) ); | ||
87 | } | ||
88 | |||
89 | extern inline void invalidate_dtlb_entry_no_isync (unsigned entry) | ||
90 | { | ||
91 | /* Caller must follow up with 'isync'. */ | ||
92 | __asm__ __volatile__ ("idtlb %0\n" : : "a" (entry) ); | ||
93 | } | ||
94 | |||
95 | extern inline void set_itlbcfg_register (unsigned long val) | ||
96 | { | ||
97 | __asm__ __volatile__("wsr %0, "__stringify(ITLBCFG)"\n\t" "isync\n\t" | ||
98 | : : "a" (val)); | ||
99 | } | ||
100 | |||
101 | extern inline void set_dtlbcfg_register (unsigned long val) | ||
102 | { | ||
103 | __asm__ __volatile__("wsr %0, "__stringify(DTLBCFG)"; dsync\n\t" | ||
104 | : : "a" (val)); | ||
105 | } | ||
106 | |||
107 | extern inline void set_ptevaddr_register (unsigned long val) | ||
108 | { | ||
109 | __asm__ __volatile__(" wsr %0, "__stringify(PTEVADDR)"; isync\n" | ||
110 | : : "a" (val)); | ||
111 | } | ||
112 | |||
113 | extern inline unsigned long read_ptevaddr_register (void) | ||
114 | { | ||
115 | unsigned long tmp; | ||
116 | __asm__ __volatile__("rsr %0, "__stringify(PTEVADDR)"\n\t" : "=a" (tmp)); | ||
117 | return tmp; | ||
118 | } | ||
119 | |||
120 | extern inline void write_dtlb_entry (pte_t entry, int way) | ||
121 | { | ||
122 | __asm__ __volatile__("wdtlb %1, %0; dsync\n\t" | ||
123 | : : "r" (way), "r" (entry) ); | ||
124 | } | ||
125 | |||
126 | extern inline void write_itlb_entry (pte_t entry, int way) | ||
127 | { | ||
128 | __asm__ __volatile__("witlb %1, %0; isync\n\t" | ||
129 | : : "r" (way), "r" (entry) ); | ||
130 | } | ||
131 | |||
132 | extern inline void invalidate_page_directory (void) | ||
133 | { | ||
134 | invalidate_dtlb_entry (DTLB_WAY_PGTABLE); | ||
135 | } | ||
136 | |||
137 | extern inline void invalidate_itlb_mapping (unsigned address) | ||
138 | { | ||
139 | unsigned long tlb_entry; | ||
140 | while ((tlb_entry = itlb_probe (address)) & ITLB_PROBE_SUCCESS) | ||
141 | invalidate_itlb_entry (tlb_entry); | ||
142 | } | ||
143 | |||
144 | extern inline void invalidate_dtlb_mapping (unsigned address) | ||
145 | { | ||
146 | unsigned long tlb_entry; | ||
147 | while ((tlb_entry = dtlb_probe (address)) & DTLB_PROBE_SUCCESS) | ||
148 | invalidate_dtlb_entry (tlb_entry); | ||
149 | } | ||
150 | |||
151 | #define check_pgt_cache() do { } while (0) | ||
152 | |||
153 | |||
154 | #ifdef DEBUG_TLB | ||
155 | |||
156 | /* DO NOT USE THESE FUNCTIONS. These instructions aren't part of the Xtensa | ||
157 | * ISA and exist only for test purposes.. | ||
158 | * You may find it helpful for MMU debugging, however. | ||
159 | * | ||
160 | * 'at' is the unmodified input register | ||
161 | * 'as' is the output register, as follows (specific to the Linux config): | ||
162 | * | ||
163 | * as[31..12] contain the virtual address | ||
164 | * as[11..08] are meaningless | ||
165 | * as[07..00] contain the asid | ||
166 | */ | ||
167 | |||
168 | extern inline unsigned long read_dtlb_virtual (int way) | ||
169 | { | ||
170 | unsigned long tmp; | ||
171 | __asm__ __volatile__("rdtlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
172 | return tmp; | ||
173 | } | ||
174 | |||
175 | extern inline unsigned long read_dtlb_translation (int way) | ||
176 | { | ||
177 | unsigned long tmp; | ||
178 | __asm__ __volatile__("rdtlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
179 | return tmp; | ||
180 | } | ||
181 | |||
182 | extern inline unsigned long read_itlb_virtual (int way) | ||
183 | { | ||
184 | unsigned long tmp; | ||
185 | __asm__ __volatile__("ritlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
186 | return tmp; | ||
187 | } | ||
188 | |||
189 | extern inline unsigned long read_itlb_translation (int way) | ||
190 | { | ||
191 | unsigned long tmp; | ||
192 | __asm__ __volatile__("ritlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way)); | ||
193 | return tmp; | ||
194 | } | ||
195 | |||
196 | #endif /* DEBUG_TLB */ | ||
197 | |||
198 | |||
199 | #endif /* __KERNEL__ */ | ||
200 | #endif /* _XTENSA_PGALLOC_H */ | ||
diff --git a/include/asm-xtensa/topology.h b/include/asm-xtensa/topology.h new file mode 100644 index 000000000000..7309e38a0ccb --- /dev/null +++ b/include/asm-xtensa/topology.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/topology.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TOPOLOGY_H | ||
12 | #define _XTENSA_TOPOLOGY_H | ||
13 | |||
14 | #include <asm-generic/topology.h> | ||
15 | |||
16 | #endif /* _XTENSA_TOPOLOGY_H */ | ||
diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h new file mode 100644 index 000000000000..ebac00469852 --- /dev/null +++ b/include/asm-xtensa/types.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/types.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_TYPES_H | ||
12 | #define _XTENSA_TYPES_H | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | typedef unsigned short umode_t; | ||
17 | |||
18 | /* | ||
19 | * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the | ||
20 | * header files exported to user space | ||
21 | */ | ||
22 | |||
23 | typedef __signed__ char __s8; | ||
24 | typedef unsigned char __u8; | ||
25 | |||
26 | typedef __signed__ short __s16; | ||
27 | typedef unsigned short __u16; | ||
28 | |||
29 | typedef __signed__ int __s32; | ||
30 | typedef unsigned int __u32; | ||
31 | |||
32 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) | ||
33 | typedef __signed__ long long __s64; | ||
34 | typedef unsigned long long __u64; | ||
35 | #endif | ||
36 | |||
37 | /* | ||
38 | * These aren't exported outside the kernel to avoid name space clashes | ||
39 | */ | ||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | typedef __signed__ char s8; | ||
43 | typedef unsigned char u8; | ||
44 | |||
45 | typedef __signed__ short s16; | ||
46 | typedef unsigned short u16; | ||
47 | |||
48 | typedef __signed__ int s32; | ||
49 | typedef unsigned int u32; | ||
50 | |||
51 | typedef __signed__ long long s64; | ||
52 | typedef unsigned long long u64; | ||
53 | |||
54 | |||
55 | #define BITS_PER_LONG 32 | ||
56 | |||
57 | /* Dma addresses are 32-bits wide. */ | ||
58 | |||
59 | typedef u32 dma_addr_t; | ||
60 | |||
61 | typedef unsigned int kmem_bufctl_t; | ||
62 | |||
63 | #endif /* __KERNEL__ */ | ||
64 | #endif | ||
65 | |||
66 | #endif /* _XTENSA_TYPES_H */ | ||
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h new file mode 100644 index 000000000000..35576b25c7b2 --- /dev/null +++ b/include/asm-xtensa/uaccess.h | |||
@@ -0,0 +1,532 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/uaccess.h | ||
3 | * | ||
4 | * User space memory access functions | ||
5 | * | ||
6 | * These routines provide basic accessing functions to the user memory | ||
7 | * space for the kernel. This header file provides fuctions such as: | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file "COPYING" in the main directory of this archive | ||
11 | * for more details. | ||
12 | * | ||
13 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
14 | */ | ||
15 | |||
16 | #ifndef _XTENSA_UACCESS_H | ||
17 | #define _XTENSA_UACCESS_H | ||
18 | |||
19 | #include <linux/errno.h> | ||
20 | |||
21 | #define VERIFY_READ 0 | ||
22 | #define VERIFY_WRITE 1 | ||
23 | |||
24 | #ifdef __ASSEMBLY__ | ||
25 | |||
26 | #define _ASMLANGUAGE | ||
27 | #include <asm/current.h> | ||
28 | #include <asm/offsets.h> | ||
29 | #include <asm/processor.h> | ||
30 | |||
31 | /* | ||
32 | * These assembly macros mirror the C macros that follow below. They | ||
33 | * should always have identical functionality. See | ||
34 | * arch/xtensa/kernel/sys.S for usage. | ||
35 | */ | ||
36 | |||
37 | #define KERNEL_DS 0 | ||
38 | #define USER_DS 1 | ||
39 | |||
40 | #define get_ds (KERNEL_DS) | ||
41 | |||
42 | /* | ||
43 | * get_fs reads current->thread.current_ds into a register. | ||
44 | * On Entry: | ||
45 | * <ad> anything | ||
46 | * <sp> stack | ||
47 | * On Exit: | ||
48 | * <ad> contains current->thread.current_ds | ||
49 | */ | ||
50 | .macro get_fs ad, sp | ||
51 | GET_CURRENT(\ad,\sp) | ||
52 | l32i \ad, \ad, THREAD_CURRENT_DS | ||
53 | .endm | ||
54 | |||
55 | /* | ||
56 | * set_fs sets current->thread.current_ds to some value. | ||
57 | * On Entry: | ||
58 | * <at> anything (temp register) | ||
59 | * <av> value to write | ||
60 | * <sp> stack | ||
61 | * On Exit: | ||
62 | * <at> destroyed (actually, current) | ||
63 | * <av> preserved, value to write | ||
64 | */ | ||
65 | .macro set_fs at, av, sp | ||
66 | GET_CURRENT(\at,\sp) | ||
67 | s32i \av, \at, THREAD_CURRENT_DS | ||
68 | .endm | ||
69 | |||
70 | /* | ||
71 | * kernel_ok determines whether we should bypass addr/size checking. | ||
72 | * See the equivalent C-macro version below for clarity. | ||
73 | * On success, kernel_ok branches to a label indicated by parameter | ||
74 | * <success>. This implies that the macro falls through to the next | ||
75 | * insruction on an error. | ||
76 | * | ||
77 | * Note that while this macro can be used independently, we designed | ||
78 | * in for optimal use in the access_ok macro below (i.e., we fall | ||
79 | * through on error). | ||
80 | * | ||
81 | * On Entry: | ||
82 | * <at> anything (temp register) | ||
83 | * <success> label to branch to on success; implies | ||
84 | * fall-through macro on error | ||
85 | * <sp> stack pointer | ||
86 | * On Exit: | ||
87 | * <at> destroyed (actually, current->thread.current_ds) | ||
88 | */ | ||
89 | |||
90 | #if ((KERNEL_DS != 0) || (USER_DS == 0)) | ||
91 | # error Assembly macro kernel_ok fails | ||
92 | #endif | ||
93 | .macro kernel_ok at, sp, success | ||
94 | get_fs \at, \sp | ||
95 | beqz \at, \success | ||
96 | .endm | ||
97 | |||
98 | /* | ||
99 | * user_ok determines whether the access to user-space memory is allowed. | ||
100 | * See the equivalent C-macro version below for clarity. | ||
101 | * | ||
102 | * On error, user_ok branches to a label indicated by parameter | ||
103 | * <error>. This implies that the macro falls through to the next | ||
104 | * instruction on success. | ||
105 | * | ||
106 | * Note that while this macro can be used independently, we designed | ||
107 | * in for optimal use in the access_ok macro below (i.e., we fall | ||
108 | * through on success). | ||
109 | * | ||
110 | * On Entry: | ||
111 | * <aa> register containing memory address | ||
112 | * <as> register containing memory size | ||
113 | * <at> temp register | ||
114 | * <error> label to branch to on error; implies fall-through | ||
115 | * macro on success | ||
116 | * On Exit: | ||
117 | * <aa> preserved | ||
118 | * <as> preserved | ||
119 | * <at> destroyed (actually, (TASK_SIZE + 1 - size)) | ||
120 | */ | ||
121 | .macro user_ok aa, as, at, error | ||
122 | movi \at, (TASK_SIZE+1) | ||
123 | bgeu \as, \at, \error | ||
124 | sub \at, \at, \as | ||
125 | bgeu \aa, \at, \error | ||
126 | .endm | ||
127 | |||
128 | /* | ||
129 | * access_ok determines whether a memory access is allowed. See the | ||
130 | * equivalent C-macro version below for clarity. | ||
131 | * | ||
132 | * On error, access_ok branches to a label indicated by parameter | ||
133 | * <error>. This implies that the macro falls through to the next | ||
134 | * instruction on success. | ||
135 | * | ||
136 | * Note that we assume success is the common case, and we optimize the | ||
137 | * branch fall-through case on success. | ||
138 | * | ||
139 | * On Entry: | ||
140 | * <aa> register containing memory address | ||
141 | * <as> register containing memory size | ||
142 | * <at> temp register | ||
143 | * <sp> | ||
144 | * <error> label to branch to on error; implies fall-through | ||
145 | * macro on success | ||
146 | * On Exit: | ||
147 | * <aa> preserved | ||
148 | * <as> preserved | ||
149 | * <at> destroyed | ||
150 | */ | ||
151 | .macro access_ok aa, as, at, sp, error | ||
152 | kernel_ok \at, \sp, .Laccess_ok_\@ | ||
153 | user_ok \aa, \as, \at, \error | ||
154 | .Laccess_ok_\@: | ||
155 | .endm | ||
156 | |||
157 | /* | ||
158 | * verify_area determines whether a memory access is allowed. It's | ||
159 | * mostly an unnecessary wrapper for access_ok, but we provide it as a | ||
160 | * duplicate of the verify_area() C inline function below. See the | ||
161 | * equivalent C version below for clarity. | ||
162 | * | ||
163 | * On error, verify_area branches to a label indicated by parameter | ||
164 | * <error>. This implies that the macro falls through to the next | ||
165 | * instruction on success. | ||
166 | * | ||
167 | * Note that we assume success is the common case, and we optimize the | ||
168 | * branch fall-through case on success. | ||
169 | * | ||
170 | * On Entry: | ||
171 | * <aa> register containing memory address | ||
172 | * <as> register containing memory size | ||
173 | * <at> temp register | ||
174 | * <error> label to branch to on error; implies fall-through | ||
175 | * macro on success | ||
176 | * On Exit: | ||
177 | * <aa> preserved | ||
178 | * <as> preserved | ||
179 | * <at> destroyed | ||
180 | */ | ||
181 | .macro verify_area aa, as, at, sp, error | ||
182 | access_ok \at, \aa, \as, \sp, \error | ||
183 | .endm | ||
184 | |||
185 | |||
186 | #else /* __ASSEMBLY__ not defined */ | ||
187 | |||
188 | #include <linux/sched.h> | ||
189 | #include <asm/types.h> | ||
190 | |||
191 | /* | ||
192 | * The fs value determines whether argument validity checking should | ||
193 | * be performed or not. If get_fs() == USER_DS, checking is | ||
194 | * performed, with get_fs() == KERNEL_DS, checking is bypassed. | ||
195 | * | ||
196 | * For historical reasons (Data Segment Register?), these macros are | ||
197 | * grossly misnamed. | ||
198 | */ | ||
199 | |||
200 | #define KERNEL_DS ((mm_segment_t) { 0 }) | ||
201 | #define USER_DS ((mm_segment_t) { 1 }) | ||
202 | |||
203 | #define get_ds() (KERNEL_DS) | ||
204 | #define get_fs() (current->thread.current_ds) | ||
205 | #define set_fs(val) (current->thread.current_ds = (val)) | ||
206 | |||
207 | #define segment_eq(a,b) ((a).seg == (b).seg) | ||
208 | |||
209 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) | ||
210 | #define __user_ok(addr,size) (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) | ||
211 | #define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) | ||
212 | #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) | ||
213 | |||
214 | extern inline int verify_area(int type, const void * addr, unsigned long size) | ||
215 | { | ||
216 | return access_ok(type,addr,size) ? 0 : -EFAULT; | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * These are the main single-value transfer routines. They | ||
221 | * automatically use the right size if we just have the right pointer | ||
222 | * type. | ||
223 | * | ||
224 | * This gets kind of ugly. We want to return _two_ values in | ||
225 | * "get_user()" and yet we don't want to do any pointers, because that | ||
226 | * is too much of a performance impact. Thus we have a few rather ugly | ||
227 | * macros here, and hide all the uglyness from the user. | ||
228 | * | ||
229 | * Careful to not | ||
230 | * (a) re-use the arguments for side effects (sizeof is ok) | ||
231 | * (b) require any knowledge of processes at this stage | ||
232 | */ | ||
233 | #define put_user(x,ptr) __put_user_check((x),(ptr),sizeof(*(ptr))) | ||
234 | #define get_user(x,ptr) __get_user_check((x),(ptr),sizeof(*(ptr))) | ||
235 | |||
236 | /* | ||
237 | * The "__xxx" versions of the user access functions are versions that | ||
238 | * do not verify the address space, that must have been done previously | ||
239 | * with a separate "access_ok()" call (this is used when we do multiple | ||
240 | * accesses to the same area of user memory). | ||
241 | */ | ||
242 | #define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
243 | #define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr))) | ||
244 | |||
245 | |||
246 | extern long __put_user_bad(void); | ||
247 | |||
248 | #define __put_user_nocheck(x,ptr,size) \ | ||
249 | ({ \ | ||
250 | long __pu_err; \ | ||
251 | __put_user_size((x),(ptr),(size),__pu_err); \ | ||
252 | __pu_err; \ | ||
253 | }) | ||
254 | |||
255 | #define __put_user_check(x,ptr,size) \ | ||
256 | ({ \ | ||
257 | long __pu_err = -EFAULT; \ | ||
258 | __typeof__(*(ptr)) *__pu_addr = (ptr); \ | ||
259 | if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ | ||
260 | __put_user_size((x),__pu_addr,(size),__pu_err); \ | ||
261 | __pu_err; \ | ||
262 | }) | ||
263 | |||
264 | #define __put_user_size(x,ptr,size,retval) \ | ||
265 | do { \ | ||
266 | retval = 0; \ | ||
267 | switch (size) { \ | ||
268 | case 1: __put_user_asm(x,ptr,retval,1,"s8i"); break; \ | ||
269 | case 2: __put_user_asm(x,ptr,retval,2,"s16i"); break; \ | ||
270 | case 4: __put_user_asm(x,ptr,retval,4,"s32i"); break; \ | ||
271 | case 8: { \ | ||
272 | __typeof__(*ptr) __v64 = x; \ | ||
273 | retval = __copy_to_user(ptr,&__v64,8); \ | ||
274 | break; \ | ||
275 | } \ | ||
276 | default: __put_user_bad(); \ | ||
277 | } \ | ||
278 | } while (0) | ||
279 | |||
280 | |||
281 | /* | ||
282 | * Consider a case of a user single load/store would cause both an | ||
283 | * unaligned exception and an MMU-related exception (unaligned | ||
284 | * exceptions happen first): | ||
285 | * | ||
286 | * User code passes a bad variable ptr to a system call. | ||
287 | * Kernel tries to access the variable. | ||
288 | * Unaligned exception occurs. | ||
289 | * Unaligned exception handler tries to make aligned accesses. | ||
290 | * Double exception occurs for MMU-related cause (e.g., page not mapped). | ||
291 | * do_page_fault() thinks the fault address belongs to the kernel, not the | ||
292 | * user, and panics. | ||
293 | * | ||
294 | * The kernel currently prohibits user unaligned accesses. We use the | ||
295 | * __check_align_* macros to check for unaligned addresses before | ||
296 | * accessing user space so we don't crash the kernel. Both | ||
297 | * __put_user_asm and __get_user_asm use these alignment macros, so | ||
298 | * macro-specific labels such as 0f, 1f, %0, %2, and %3 must stay in | ||
299 | * sync. | ||
300 | */ | ||
301 | |||
302 | #define __check_align_1 "" | ||
303 | |||
304 | #define __check_align_2 \ | ||
305 | " _bbci.l %2, 0, 1f \n" \ | ||
306 | " movi %0, %3 \n" \ | ||
307 | " _j 2f \n" | ||
308 | |||
309 | #define __check_align_4 \ | ||
310 | " _bbsi.l %2, 0, 0f \n" \ | ||
311 | " _bbci.l %2, 1, 1f \n" \ | ||
312 | "0: movi %0, %3 \n" \ | ||
313 | " _j 2f \n" | ||
314 | |||
315 | |||
316 | /* | ||
317 | * We don't tell gcc that we are accessing memory, but this is OK | ||
318 | * because we do not write to any memory gcc knows about, so there | ||
319 | * are no aliasing issues. | ||
320 | * | ||
321 | * WARNING: If you modify this macro at all, verify that the | ||
322 | * __check_align_* macros still work. | ||
323 | */ | ||
324 | #define __put_user_asm(x, addr, err, align, insn) \ | ||
325 | __asm__ __volatile__( \ | ||
326 | __check_align_##align \ | ||
327 | "1: "insn" %1, %2, 0 \n" \ | ||
328 | "2: \n" \ | ||
329 | " .section .fixup,\"ax\" \n" \ | ||
330 | " .align 4 \n" \ | ||
331 | "4: \n" \ | ||
332 | " .long 2b \n" \ | ||
333 | "5: \n" \ | ||
334 | " l32r %2, 4b \n" \ | ||
335 | " movi %0, %3 \n" \ | ||
336 | " jx %2 \n" \ | ||
337 | " .previous \n" \ | ||
338 | " .section __ex_table,\"a\" \n" \ | ||
339 | " .long 1b, 5b \n" \ | ||
340 | " .previous" \ | ||
341 | :"=r" (err) \ | ||
342 | :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err)) | ||
343 | |||
344 | #define __get_user_nocheck(x,ptr,size) \ | ||
345 | ({ \ | ||
346 | long __gu_err, __gu_val; \ | ||
347 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ | ||
348 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
349 | __gu_err; \ | ||
350 | }) | ||
351 | |||
352 | #define __get_user_check(x,ptr,size) \ | ||
353 | ({ \ | ||
354 | long __gu_err = -EFAULT, __gu_val = 0; \ | ||
355 | const __typeof__(*(ptr)) *__gu_addr = (ptr); \ | ||
356 | if (access_ok(VERIFY_READ,__gu_addr,size)) \ | ||
357 | __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \ | ||
358 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
359 | __gu_err; \ | ||
360 | }) | ||
361 | |||
362 | extern long __get_user_bad(void); | ||
363 | |||
364 | #define __get_user_size(x,ptr,size,retval) \ | ||
365 | do { \ | ||
366 | retval = 0; \ | ||
367 | switch (size) { \ | ||
368 | case 1: __get_user_asm(x,ptr,retval,1,"l8ui"); break; \ | ||
369 | case 2: __get_user_asm(x,ptr,retval,2,"l16ui"); break; \ | ||
370 | case 4: __get_user_asm(x,ptr,retval,4,"l32i"); break; \ | ||
371 | case 8: retval = __copy_from_user(&x,ptr,8); break; \ | ||
372 | default: (x) = __get_user_bad(); \ | ||
373 | } \ | ||
374 | } while (0) | ||
375 | |||
376 | |||
377 | /* | ||
378 | * WARNING: If you modify this macro at all, verify that the | ||
379 | * __check_align_* macros still work. | ||
380 | */ | ||
381 | #define __get_user_asm(x, addr, err, align, insn) \ | ||
382 | __asm__ __volatile__( \ | ||
383 | __check_align_##align \ | ||
384 | "1: "insn" %1, %2, 0 \n" \ | ||
385 | "2: \n" \ | ||
386 | " .section .fixup,\"ax\" \n" \ | ||
387 | " .align 4 \n" \ | ||
388 | "4: \n" \ | ||
389 | " .long 2b \n" \ | ||
390 | "5: \n" \ | ||
391 | " l32r %2, 4b \n" \ | ||
392 | " movi %1, 0 \n" \ | ||
393 | " movi %0, %3 \n" \ | ||
394 | " jx %2 \n" \ | ||
395 | " .previous \n" \ | ||
396 | " .section __ex_table,\"a\" \n" \ | ||
397 | " .long 1b, 5b \n" \ | ||
398 | " .previous" \ | ||
399 | :"=r" (err), "=r" (x) \ | ||
400 | :"r" (addr), "i" (-EFAULT), "0" (err)) | ||
401 | |||
402 | |||
403 | /* | ||
404 | * Copy to/from user space | ||
405 | */ | ||
406 | |||
407 | /* | ||
408 | * We use a generic, arbitrary-sized copy subroutine. The Xtensa | ||
409 | * architecture would cause heavy code bloat if we tried to inline | ||
410 | * these functions and provide __constant_copy_* equivalents like the | ||
411 | * i386 versions. __xtensa_copy_user is quite efficient. See the | ||
412 | * .fixup section of __xtensa_copy_user for a discussion on the | ||
413 | * X_zeroing equivalents for Xtensa. | ||
414 | */ | ||
415 | |||
416 | extern unsigned __xtensa_copy_user(void *to, const void *from, unsigned n); | ||
417 | #define __copy_user(to,from,size) __xtensa_copy_user(to,from,size) | ||
418 | |||
419 | |||
420 | static inline unsigned long | ||
421 | __generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n) | ||
422 | { | ||
423 | return __copy_user(to,from,n); | ||
424 | } | ||
425 | |||
426 | static inline unsigned long | ||
427 | __generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n) | ||
428 | { | ||
429 | return __copy_user(to,from,n); | ||
430 | } | ||
431 | |||
432 | static inline unsigned long | ||
433 | __generic_copy_to_user(void *to, const void *from, unsigned long n) | ||
434 | { | ||
435 | prefetch(from); | ||
436 | if (access_ok(VERIFY_WRITE, to, n)) | ||
437 | return __copy_user(to,from,n); | ||
438 | return n; | ||
439 | } | ||
440 | |||
441 | static inline unsigned long | ||
442 | __generic_copy_from_user(void *to, const void *from, unsigned long n) | ||
443 | { | ||
444 | prefetchw(to); | ||
445 | if (access_ok(VERIFY_READ, from, n)) | ||
446 | return __copy_user(to,from,n); | ||
447 | else | ||
448 | memset(to, 0, n); | ||
449 | return n; | ||
450 | } | ||
451 | |||
452 | #define copy_to_user(to,from,n) __generic_copy_to_user((to),(from),(n)) | ||
453 | #define copy_from_user(to,from,n) __generic_copy_from_user((to),(from),(n)) | ||
454 | #define __copy_to_user(to,from,n) __generic_copy_to_user_nocheck((to),(from),(n)) | ||
455 | #define __copy_from_user(to,from,n) __generic_copy_from_user_nocheck((to),(from),(n)) | ||
456 | #define __copy_to_user_inatomic __copy_to_user | ||
457 | #define __copy_from_user_inatomic __copy_from_user | ||
458 | |||
459 | |||
460 | /* | ||
461 | * We need to return the number of bytes not cleared. Our memset() | ||
462 | * returns zero if a problem occurs while accessing user-space memory. | ||
463 | * In that event, return no memory cleared. Otherwise, zero for | ||
464 | * success. | ||
465 | */ | ||
466 | |||
467 | extern inline unsigned long | ||
468 | __xtensa_clear_user(void *addr, unsigned long size) | ||
469 | { | ||
470 | if ( ! memset(addr, 0, size) ) | ||
471 | return size; | ||
472 | return 0; | ||
473 | } | ||
474 | |||
475 | extern inline unsigned long | ||
476 | clear_user(void *addr, unsigned long size) | ||
477 | { | ||
478 | if (access_ok(VERIFY_WRITE, addr, size)) | ||
479 | return __xtensa_clear_user(addr, size); | ||
480 | return size ? -EFAULT : 0; | ||
481 | } | ||
482 | |||
483 | #define __clear_user __xtensa_clear_user | ||
484 | |||
485 | |||
486 | extern long __strncpy_user(char *, const char *, long); | ||
487 | #define __strncpy_from_user __strncpy_user | ||
488 | |||
489 | extern inline long | ||
490 | strncpy_from_user(char *dst, const char *src, long count) | ||
491 | { | ||
492 | if (access_ok(VERIFY_READ, src, 1)) | ||
493 | return __strncpy_from_user(dst, src, count); | ||
494 | return -EFAULT; | ||
495 | } | ||
496 | |||
497 | |||
498 | #define strlen_user(str) strnlen_user((str), TASK_SIZE - 1) | ||
499 | |||
500 | /* | ||
501 | * Return the size of a string (including the ending 0!) | ||
502 | */ | ||
503 | extern long __strnlen_user(const char *, long); | ||
504 | |||
505 | extern inline long strnlen_user(const char *str, long len) | ||
506 | { | ||
507 | unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1; | ||
508 | |||
509 | if ((unsigned long)str > top) | ||
510 | return 0; | ||
511 | return __strnlen_user(str, len); | ||
512 | } | ||
513 | |||
514 | |||
515 | struct exception_table_entry | ||
516 | { | ||
517 | unsigned long insn, fixup; | ||
518 | }; | ||
519 | |||
520 | /* Returns 0 if exception not found and fixup.unit otherwise. */ | ||
521 | |||
522 | extern unsigned long search_exception_table(unsigned long addr); | ||
523 | extern void sort_exception_table(void); | ||
524 | |||
525 | /* Returns the new pc */ | ||
526 | #define fixup_exception(map_reg, fixup_unit, pc) \ | ||
527 | ({ \ | ||
528 | fixup_unit; \ | ||
529 | }) | ||
530 | |||
531 | #endif /* __ASSEMBLY__ */ | ||
532 | #endif /* _XTENSA_UACCESS_H */ | ||
diff --git a/include/asm-xtensa/ucontext.h b/include/asm-xtensa/ucontext.h new file mode 100644 index 000000000000..94c94ed3e00a --- /dev/null +++ b/include/asm-xtensa/ucontext.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ucontext.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_UCONTEXT_H | ||
12 | #define _XTENSA_UCONTEXT_H | ||
13 | |||
14 | struct ucontext { | ||
15 | unsigned long uc_flags; | ||
16 | struct ucontext *uc_link; | ||
17 | stack_t uc_stack; | ||
18 | struct sigcontext uc_mcontext; | ||
19 | sigset_t uc_sigmask; /* mask last for extensibility */ | ||
20 | }; | ||
21 | |||
22 | #endif /* _XTENSA_UCONTEXT_H */ | ||
diff --git a/include/asm-xtensa/unaligned.h b/include/asm-xtensa/unaligned.h new file mode 100644 index 000000000000..28220890d0a6 --- /dev/null +++ b/include/asm-xtensa/unaligned.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/unaligned.h | ||
3 | * | ||
4 | * Xtensa doesn't handle unaligned accesses efficiently. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_UNALIGNED_H | ||
14 | #define _XTENSA_UNALIGNED_H | ||
15 | |||
16 | #include <linux/string.h> | ||
17 | |||
18 | /* Use memmove here, so gcc does not insert a __builtin_memcpy. */ | ||
19 | |||
20 | #define get_unaligned(ptr) \ | ||
21 | ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) | ||
22 | |||
23 | #define put_unaligned(val, ptr) \ | ||
24 | ({ __typeof__(*(ptr)) __tmp = (val); \ | ||
25 | memmove((ptr), &__tmp, sizeof(*(ptr))); \ | ||
26 | (void)0; }) | ||
27 | |||
28 | #endif /* _XTENSA_UNALIGNED_H */ | ||
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h new file mode 100644 index 000000000000..64c64dd83ba4 --- /dev/null +++ b/include/asm-xtensa/unistd.h | |||
@@ -0,0 +1,537 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/unistd.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_UNISTD_H | ||
12 | #define _XTENSA_UNISTD_H | ||
13 | |||
14 | #include <linux/linkage.h> | ||
15 | |||
16 | //#define __NR_setup 0 /* used only by init, to get system going */ | ||
17 | #define __NR_spill 0 | ||
18 | #define __NR_exit 1 | ||
19 | #define __NR_fork 2 | ||
20 | #define __NR_read 3 | ||
21 | #define __NR_write 4 | ||
22 | #define __NR_open 5 | ||
23 | #define __NR_close 6 | ||
24 | #define __NR_waitpid 7 | ||
25 | #define __NR_creat 8 | ||
26 | #define __NR_link 9 | ||
27 | #define __NR_unlink 10 | ||
28 | #define __NR_execve 11 | ||
29 | #define __NR_chdir 12 | ||
30 | #define __NR_time 13 | ||
31 | #define __NR_mknod 14 | ||
32 | #define __NR_chmod 15 | ||
33 | #define __NR_lchown 16 | ||
34 | #define __NR_break 17 | ||
35 | #define __NR_oldstat 18 | ||
36 | #define __NR_lseek 19 | ||
37 | #define __NR_getpid 20 | ||
38 | #define __NR_mount 21 | ||
39 | #define __NR_oldumount 22 | ||
40 | #define __NR_setuid 23 | ||
41 | #define __NR_getuid 24 | ||
42 | #define __NR_stime 25 | ||
43 | #define __NR_ptrace 26 | ||
44 | #define __NR_alarm 27 | ||
45 | #define __NR_oldfstat 28 | ||
46 | #define __NR_pause 29 | ||
47 | #define __NR_utime 30 | ||
48 | #define __NR_stty 31 | ||
49 | #define __NR_gtty 32 | ||
50 | #define __NR_access 33 | ||
51 | #define __NR_nice 34 | ||
52 | #define __NR_ftime 35 | ||
53 | #define __NR_sync 36 | ||
54 | #define __NR_kill 37 | ||
55 | #define __NR_rename 38 | ||
56 | #define __NR_mkdir 39 | ||
57 | #define __NR_rmdir 40 | ||
58 | #define __NR_dup 41 | ||
59 | #define __NR_pipe 42 | ||
60 | #define __NR_times 43 | ||
61 | #define __NR_prof 44 | ||
62 | #define __NR_brk 45 | ||
63 | #define __NR_setgid 46 | ||
64 | #define __NR_getgid 47 | ||
65 | #define __NR_signal 48 | ||
66 | #define __NR_geteuid 49 | ||
67 | #define __NR_getegid 50 | ||
68 | #define __NR_acct 51 | ||
69 | #define __NR_umount 52 | ||
70 | #define __NR_lock 53 | ||
71 | #define __NR_ioctl 54 | ||
72 | #define __NR_fcntl 55 | ||
73 | #define __NR_mpx 56 | ||
74 | #define __NR_setpgid 57 | ||
75 | #define __NR_ulimit 58 | ||
76 | #define __NR_oldolduname 59 | ||
77 | #define __NR_umask 60 | ||
78 | #define __NR_chroot 61 | ||
79 | #define __NR_ustat 62 | ||
80 | #define __NR_dup2 63 | ||
81 | #define __NR_getppid 64 | ||
82 | #define __NR_getpgrp 65 | ||
83 | #define __NR_setsid 66 | ||
84 | #define __NR_sigaction 67 | ||
85 | #define __NR_sgetmask 68 | ||
86 | #define __NR_ssetmask 69 | ||
87 | #define __NR_setreuid 70 | ||
88 | #define __NR_setregid 71 | ||
89 | #define __NR_sigsuspend 72 | ||
90 | #define __NR_sigpending 73 | ||
91 | #define __NR_sethostname 74 | ||
92 | #define __NR_setrlimit 75 | ||
93 | #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ | ||
94 | #define __NR_getrusage 77 | ||
95 | #define __NR_gettimeofday 78 | ||
96 | #define __NR_settimeofday 79 | ||
97 | #define __NR_getgroups 80 | ||
98 | #define __NR_setgroups 81 | ||
99 | #define __NR_select 82 | ||
100 | #define __NR_symlink 83 | ||
101 | #define __NR_oldlstat 84 | ||
102 | #define __NR_readlink 85 | ||
103 | #define __NR_uselib 86 | ||
104 | #define __NR_swapon 87 | ||
105 | #define __NR_reboot 88 | ||
106 | #define __NR_readdir 89 | ||
107 | #define __NR_mmap 90 | ||
108 | #define __NR_munmap 91 | ||
109 | #define __NR_truncate 92 | ||
110 | #define __NR_ftruncate 93 | ||
111 | #define __NR_fchmod 94 | ||
112 | #define __NR_fchown 95 | ||
113 | #define __NR_getpriority 96 | ||
114 | #define __NR_setpriority 97 | ||
115 | #define __NR_profil 98 | ||
116 | #define __NR_statfs 99 | ||
117 | #define __NR_fstatfs 100 | ||
118 | #define __NR_ioperm 101 | ||
119 | #define __NR_socketcall 102 | ||
120 | #define __NR_syslog 103 | ||
121 | #define __NR_setitimer 104 | ||
122 | #define __NR_getitimer 105 | ||
123 | #define __NR_stat 106 | ||
124 | #define __NR_lstat 107 | ||
125 | #define __NR_fstat 108 | ||
126 | #define __NR_olduname 109 | ||
127 | #define __NR_iopl 110 | ||
128 | #define __NR_vhangup 111 | ||
129 | #define __NR_idle 112 | ||
130 | #define __NR_vm86 113 | ||
131 | #define __NR_wait4 114 | ||
132 | #define __NR_swapoff 115 | ||
133 | #define __NR_sysinfo 116 | ||
134 | #define __NR_ipc 117 | ||
135 | #define __NR_fsync 118 | ||
136 | #define __NR_sigreturn 119 | ||
137 | #define __NR_clone 120 | ||
138 | #define __NR_setdomainname 121 | ||
139 | #define __NR_uname 122 | ||
140 | #define __NR_modify_ldt 123 | ||
141 | #define __NR_adjtimex 124 | ||
142 | #define __NR_mprotect 125 | ||
143 | #define __NR_sigprocmask 126 | ||
144 | #define __NR_create_module 127 | ||
145 | #define __NR_init_module 128 | ||
146 | #define __NR_delete_module 129 | ||
147 | #define __NR_get_kernel_syms 130 | ||
148 | #define __NR_quotactl 131 | ||
149 | #define __NR_getpgid 132 | ||
150 | #define __NR_fchdir 133 | ||
151 | #define __NR_bdflush 134 | ||
152 | #define __NR_sysfs 135 | ||
153 | #define __NR_personality 136 | ||
154 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
155 | #define __NR_setfsuid 138 | ||
156 | #define __NR_setfsgid 139 | ||
157 | #define __NR__llseek 140 | ||
158 | #define __NR_getdents 141 | ||
159 | #define __NR__newselect 142 | ||
160 | #define __NR_flock 143 | ||
161 | #define __NR_msync 144 | ||
162 | #define __NR_readv 145 | ||
163 | #define __NR_writev 146 | ||
164 | #define __NR_cacheflush 147 | ||
165 | #define __NR_cachectl 148 | ||
166 | #define __NR_sysxtensa 149 | ||
167 | #define __NR_sysdummy 150 | ||
168 | #define __NR_getsid 151 | ||
169 | #define __NR_fdatasync 152 | ||
170 | #define __NR__sysctl 153 | ||
171 | #define __NR_mlock 154 | ||
172 | #define __NR_munlock 155 | ||
173 | #define __NR_mlockall 156 | ||
174 | #define __NR_munlockall 157 | ||
175 | #define __NR_sched_setparam 158 | ||
176 | #define __NR_sched_getparam 159 | ||
177 | #define __NR_sched_setscheduler 160 | ||
178 | #define __NR_sched_getscheduler 161 | ||
179 | #define __NR_sched_yield 162 | ||
180 | #define __NR_sched_get_priority_max 163 | ||
181 | #define __NR_sched_get_priority_min 164 | ||
182 | #define __NR_sched_rr_get_interval 165 | ||
183 | #define __NR_nanosleep 166 | ||
184 | #define __NR_mremap 167 | ||
185 | #define __NR_accept 168 | ||
186 | #define __NR_bind 169 | ||
187 | #define __NR_connect 170 | ||
188 | #define __NR_getpeername 171 | ||
189 | #define __NR_getsockname 172 | ||
190 | #define __NR_getsockopt 173 | ||
191 | #define __NR_listen 174 | ||
192 | #define __NR_recv 175 | ||
193 | #define __NR_recvfrom 176 | ||
194 | #define __NR_recvmsg 177 | ||
195 | #define __NR_send 178 | ||
196 | #define __NR_sendmsg 179 | ||
197 | #define __NR_sendto 180 | ||
198 | #define __NR_setsockopt 181 | ||
199 | #define __NR_shutdown 182 | ||
200 | #define __NR_socket 183 | ||
201 | #define __NR_socketpair 184 | ||
202 | #define __NR_setresuid 185 | ||
203 | #define __NR_getresuid 186 | ||
204 | #define __NR_query_module 187 | ||
205 | #define __NR_poll 188 | ||
206 | #define __NR_nfsservctl 189 | ||
207 | #define __NR_setresgid 190 | ||
208 | #define __NR_getresgid 191 | ||
209 | #define __NR_prctl 192 | ||
210 | #define __NR_rt_sigreturn 193 | ||
211 | #define __NR_rt_sigaction 194 | ||
212 | #define __NR_rt_sigprocmask 195 | ||
213 | #define __NR_rt_sigpending 196 | ||
214 | #define __NR_rt_sigtimedwait 197 | ||
215 | #define __NR_rt_sigqueueinfo 198 | ||
216 | #define __NR_rt_sigsuspend 199 | ||
217 | #define __NR_pread 200 | ||
218 | #define __NR_pwrite 201 | ||
219 | #define __NR_chown 202 | ||
220 | #define __NR_getcwd 203 | ||
221 | #define __NR_capget 204 | ||
222 | #define __NR_capset 205 | ||
223 | #define __NR_sigaltstack 206 | ||
224 | #define __NR_sendfile 207 | ||
225 | #define __NR_streams1 208 /* some people actually want it */ | ||
226 | #define __NR_streams2 209 /* some people actually want it */ | ||
227 | #define __NR_mmap2 210 | ||
228 | #define __NR_truncate64 211 | ||
229 | #define __NR_ftruncate64 212 | ||
230 | #define __NR_stat64 213 | ||
231 | #define __NR_lstat64 214 | ||
232 | #define __NR_fstat64 215 | ||
233 | #define __NR_pivot_root 216 | ||
234 | #define __NR_mincore 217 | ||
235 | #define __NR_madvise 218 | ||
236 | #define __NR_getdents64 219 | ||
237 | #define __NR_vfork 220 | ||
238 | |||
239 | /* Keep this last; should always equal the last valid call number. */ | ||
240 | #define __NR_Linux_syscalls 220 | ||
241 | |||
242 | /* user-visible error numbers are in the range -1 - -125: see | ||
243 | * <asm-xtensa/errno.h> */ | ||
244 | |||
245 | #define SYSXTENSA_RESERVED 0 /* don't use this */ | ||
246 | #define SYSXTENSA_ATOMIC_SET 1 /* set variable */ | ||
247 | #define SYSXTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */ | ||
248 | #define SYSXTENSA_ATOMIC_ADD 3 /* add to memory */ | ||
249 | #define SYSXTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */ | ||
250 | |||
251 | #define SYSXTENSA_COUNT 5 /* count of syscall0 functions*/ | ||
252 | |||
253 | #ifdef __KERNEL__ | ||
254 | #define __syscall_return(type, res) return ((type)(res)) | ||
255 | #else | ||
256 | #define __syscall_return(type, res) \ | ||
257 | do { \ | ||
258 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | ||
259 | /* Avoid using "res" which is declared to be in register r2; \ | ||
260 | * errno might expand to a function call and clobber it. */ \ | ||
261 | int __err = -(res); \ | ||
262 | errno = __err; \ | ||
263 | res = -1; \ | ||
264 | } \ | ||
265 | return (type) (res); \ | ||
266 | } while (0) | ||
267 | #endif | ||
268 | |||
269 | |||
270 | /* Tensilica's xt-xcc compiler is much more agressive at code | ||
271 | * optimization than gcc. Multiple __asm__ statements are | ||
272 | * insufficient for xt-xcc because subsequent optimization passes | ||
273 | * (beyond the front-end that knows of __asm__ statements and other | ||
274 | * such GNU Extensions to C) can modify the register selection for | ||
275 | * containment of C variables. | ||
276 | * | ||
277 | * xt-xcc cannot modify the contents of a single __asm__ statement, so | ||
278 | * we create single-asm versions of the syscall macros that are | ||
279 | * suitable and optimal for both xt-xcc and gcc. | ||
280 | * | ||
281 | * Linux takes system-call arguments in registers. The following | ||
282 | * design is optimized for user-land apps (e.g., glibc) which | ||
283 | * typically have a function wrapper around the "syscall" assembly | ||
284 | * instruction. It satisfies the Xtensa ABI while minizing argument | ||
285 | * shifting. | ||
286 | * | ||
287 | * The Xtensa ABI and software conventions require the system-call | ||
288 | * number in a2. If an argument exists in a2, we move it to the next | ||
289 | * available register. Note that for improved efficiency, we do NOT | ||
290 | * shift all parameters down one register to maintain the original | ||
291 | * order. | ||
292 | * | ||
293 | * At best case (zero arguments), we just write the syscall number to | ||
294 | * a2. At worst case (1 to 6 arguments), we move the argument in a2 | ||
295 | * to the next available register, then write the syscall number to | ||
296 | * a2. | ||
297 | * | ||
298 | * For clarity, the following truth table enumerates all possibilities. | ||
299 | * | ||
300 | * arguments syscall number arg0, arg1, arg2, arg3, arg4, arg5 | ||
301 | * --------- -------------- ---------------------------------- | ||
302 | * 0 a2 | ||
303 | * 1 a2 a3 | ||
304 | * 2 a2 a4, a3 | ||
305 | * 3 a2 a5, a3, a4 | ||
306 | * 4 a2 a6, a3, a4, a5 | ||
307 | * 5 a2 a7, a3, a4, a5, a6 | ||
308 | * 6 a2 a8, a3, a4, a5, a6, a7 | ||
309 | */ | ||
310 | |||
311 | #define _syscall0(type,name) \ | ||
312 | type name(void) \ | ||
313 | { \ | ||
314 | long __res; \ | ||
315 | __asm__ __volatile__ ( \ | ||
316 | " movi a2, %1 \n" \ | ||
317 | " syscall \n" \ | ||
318 | " mov %0, a2 \n" \ | ||
319 | : "=a" (__res) \ | ||
320 | : "i" (__NR_##name) \ | ||
321 | : "a2" \ | ||
322 | ); \ | ||
323 | __syscall_return(type,__res); \ | ||
324 | } | ||
325 | |||
326 | #define _syscall1(type,name,type0,arg0) \ | ||
327 | type name(type0 arg0) \ | ||
328 | { \ | ||
329 | long __res; \ | ||
330 | __asm__ __volatile__ ( \ | ||
331 | " mov a3, %2 \n" \ | ||
332 | " movi a2, %1 \n" \ | ||
333 | " syscall \n" \ | ||
334 | " mov %0, a2 \n" \ | ||
335 | : "=a" (__res) \ | ||
336 | : "i" (__NR_##name), "a" (arg0) \ | ||
337 | : "a2", "a3" \ | ||
338 | ); \ | ||
339 | __syscall_return(type,__res); \ | ||
340 | } | ||
341 | |||
342 | #define _syscall2(type,name,type0,arg0,type1,arg1) \ | ||
343 | type name(type0 arg0,type1 arg1) \ | ||
344 | { \ | ||
345 | long __res; \ | ||
346 | __asm__ __volatile__ ( \ | ||
347 | " mov a4, %2 \n" \ | ||
348 | " mov a3, %3 \n" \ | ||
349 | " movi a2, %1 \n" \ | ||
350 | " syscall \n" \ | ||
351 | " mov %0, a2 \n" \ | ||
352 | : "=a" (__res) \ | ||
353 | : "i" (__NR_##name), "a" (arg0), "a" (arg1) \ | ||
354 | : "a2", "a3", "a4" \ | ||
355 | ); \ | ||
356 | __syscall_return(type,__res); \ | ||
357 | } | ||
358 | |||
359 | #define _syscall3(type,name,type0,arg0,type1,arg1,type2,arg2) \ | ||
360 | type name(type0 arg0,type1 arg1,type2 arg2) \ | ||
361 | { \ | ||
362 | long __res; \ | ||
363 | __asm__ __volatile__ ( \ | ||
364 | " mov a5, %2 \n" \ | ||
365 | " mov a4, %4 \n" \ | ||
366 | " mov a3, %3 \n" \ | ||
367 | " movi a2, %1 \n" \ | ||
368 | " syscall \n" \ | ||
369 | " mov %0, a2 \n" \ | ||
370 | : "=a" (__res) \ | ||
371 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2) \ | ||
372 | : "a2", "a3", "a4", "a5" \ | ||
373 | ); \ | ||
374 | __syscall_return(type,__res); \ | ||
375 | } | ||
376 | |||
377 | #define _syscall4(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3) \ | ||
378 | type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3) \ | ||
379 | { \ | ||
380 | long __res; \ | ||
381 | __asm__ __volatile__ ( \ | ||
382 | " mov a6, %2 \n" \ | ||
383 | " mov a5, %5 \n" \ | ||
384 | " mov a4, %4 \n" \ | ||
385 | " mov a3, %3 \n" \ | ||
386 | " movi a2, %1 \n" \ | ||
387 | " syscall \n" \ | ||
388 | " mov %0, a2 \n" \ | ||
389 | : "=a" (__res) \ | ||
390 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), "a" (arg3) \ | ||
391 | : "a2", "a3", "a4", "a5", "a6" \ | ||
392 | ); \ | ||
393 | __syscall_return(type,__res); \ | ||
394 | } | ||
395 | |||
396 | /* Note that we save and restore the a7 frame pointer. | ||
397 | * Including a7 in the clobber list doesn't do what you'd expect. | ||
398 | */ | ||
399 | #define _syscall5(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ | ||
400 | type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ | ||
401 | { \ | ||
402 | long __res; \ | ||
403 | __asm__ __volatile__ ( \ | ||
404 | " mov a9, a7 \n" \ | ||
405 | " mov a7, %2 \n" \ | ||
406 | " mov a6, %6 \n" \ | ||
407 | " mov a5, %5 \n" \ | ||
408 | " mov a4, %4 \n" \ | ||
409 | " mov a3, %3 \n" \ | ||
410 | " movi a2, %1 \n" \ | ||
411 | " syscall \n" \ | ||
412 | " mov a7, a9 \n" \ | ||
413 | " mov %0, a2 \n" \ | ||
414 | : "=a" (__res) \ | ||
415 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), \ | ||
416 | "a" (arg3), "a" (arg4) \ | ||
417 | : "a2", "a3", "a4", "a5", "a6", "a9" \ | ||
418 | ); \ | ||
419 | __syscall_return(type,__res); \ | ||
420 | } | ||
421 | |||
422 | /* Note that we save and restore the a7 frame pointer. | ||
423 | * Including a7 in the clobber list doesn't do what you'd expect. | ||
424 | */ | ||
425 | #define _syscall6(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ | ||
426 | type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ | ||
427 | { \ | ||
428 | long __res; \ | ||
429 | __asm__ __volatile__ ( \ | ||
430 | " mov a9, a7 \n" \ | ||
431 | " mov a8, %2 \n" \ | ||
432 | " mov a7, %7 \n" \ | ||
433 | " mov a6, %6 \n" \ | ||
434 | " mov a5, %5 \n" \ | ||
435 | " mov a4, %4 \n" \ | ||
436 | " mov a3, %3 \n" \ | ||
437 | " movi a2, %1 \n" \ | ||
438 | " syscall \n" \ | ||
439 | " mov a7, a9 \n" \ | ||
440 | " mov %0, a2 \n" \ | ||
441 | : "=a" (__res) \ | ||
442 | : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), \ | ||
443 | "a" (arg3), "a" (arg4), "a" (arg5) \ | ||
444 | : "a2", "a3", "a4", "a5", "a6", "a8", "a9" \ | ||
445 | ); \ | ||
446 | __syscall_return(type,__res); \ | ||
447 | } | ||
448 | |||
449 | |||
450 | #ifdef __KERNEL_SYSCALLS__ | ||
451 | |||
452 | #include <linux/compiler.h> | ||
453 | #include <linux/types.h> | ||
454 | #include <linux/syscalls.h> | ||
455 | |||
456 | /* | ||
457 | * we need this inline - forking from kernel space will result | ||
458 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
459 | * is no problem, but for the stack. This is handled by not letting | ||
460 | * main() use the stack at all after fork(). Thus, no function | ||
461 | * calls - which means inline code for fork too, as otherwise we | ||
462 | * would use the stack upon exit from 'fork()'. | ||
463 | * | ||
464 | * Actually only pause and fork are needed inline, so that there | ||
465 | * won't be any messing with the stack from main(), but we define | ||
466 | * some others too. | ||
467 | */ | ||
468 | |||
469 | #define __NR__exit __NR_exit | ||
470 | |||
471 | static __inline__ _syscall0(int,pause) | ||
472 | //static __inline__ _syscall1(int,setup,int,magic) FIXME | ||
473 | static __inline__ _syscall0(int,sync) | ||
474 | static __inline__ _syscall0(pid_t,setsid) | ||
475 | static __inline__ _syscall3(int,write,int,fd,const char *,buf,off_t,count) | ||
476 | static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) | ||
477 | static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) | ||
478 | static __inline__ _syscall1(int,dup,int,fd) | ||
479 | static __inline__ _syscall3(int,execve,const char*,file,char**,argv,char**,envp) | ||
480 | static __inline__ _syscall3(int,open,const char *,file,int,flag,int,mode) | ||
481 | static __inline__ _syscall1(int,close,int,fd) | ||
482 | static __inline__ _syscall1(int,_exit,int,exitcode) | ||
483 | static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) | ||
484 | static __inline__ _syscall1(int,delete_module,const char *,name) | ||
485 | |||
486 | struct stat; | ||
487 | static __inline__ _syscall2(int,fstat,int,fd,struct stat *,buf) | ||
488 | static __inline__ _syscall0(pid_t,getpid) | ||
489 | static __inline__ _syscall2(int,kill,int,pid,int,sig) | ||
490 | static __inline__ _syscall2(int,stat,const char *, path,struct stat *,buf) | ||
491 | static __inline__ _syscall1(int,unlink,char *,pathname) | ||
492 | |||
493 | |||
494 | |||
495 | extern pid_t waitpid(int, int*, int ); | ||
496 | static __inline__ pid_t wait(int * wait_stat) | ||
497 | { | ||
498 | return waitpid(-1,wait_stat,0); | ||
499 | } | ||
500 | #endif | ||
501 | |||
502 | /* | ||
503 | * "Conditional" syscalls | ||
504 | * | ||
505 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
506 | * but it doesn't work on all toolchains, so we just do it by hand | ||
507 | */ | ||
508 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); | ||
509 | |||
510 | #ifdef __KERNEL__ | ||
511 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
512 | #define __ARCH_WANT_OLD_READDIR | ||
513 | #define __ARCH_WANT_OLD_STAT | ||
514 | #define __ARCH_WANT_STAT64 | ||
515 | #define __ARCH_WANT_SYS_ALARM | ||
516 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
517 | #define __ARCH_WANT_SYS_PAUSE | ||
518 | #define __ARCH_WANT_SYS_SGETMASK | ||
519 | #define __ARCH_WANT_SYS_SIGNAL | ||
520 | #define __ARCH_WANT_SYS_TIME | ||
521 | #define __ARCH_WANT_SYS_UTIME | ||
522 | #define __ARCH_WANT_SYS_WAITPID | ||
523 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
524 | #define __ARCH_WANT_SYS_FADVISE64 | ||
525 | #define __ARCH_WANT_SYS_GETPGRP | ||
526 | #define __ARCH_WANT_SYS_LLSEEK | ||
527 | #define __ARCH_WANT_SYS_NICE | ||
528 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
529 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
530 | #define __ARCH_WANT_SYS_SIGPENDING | ||
531 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
532 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
533 | #endif | ||
534 | |||
535 | |||
536 | |||
537 | #endif /* _XTENSA_UNISTD_H */ | ||
diff --git a/include/asm-xtensa/user.h b/include/asm-xtensa/user.h new file mode 100644 index 000000000000..2c3ed23354a8 --- /dev/null +++ b/include/asm-xtensa/user.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/user.h | ||
3 | * | ||
4 | * Xtensa Processor version. | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_USER_H | ||
14 | #define _XTENSA_USER_H | ||
15 | |||
16 | /* This file usually defines a 'struct user' structure. However, it it only | ||
17 | * used for a.out file, which are not supported on Xtensa. | ||
18 | */ | ||
19 | |||
20 | #endif /* _XTENSA_USER_H */ | ||
diff --git a/include/asm-xtensa/vga.h b/include/asm-xtensa/vga.h new file mode 100644 index 000000000000..23d82f6acb57 --- /dev/null +++ b/include/asm-xtensa/vga.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/vga.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_VGA_H | ||
12 | #define _XTENSA_VGA_H | ||
13 | |||
14 | #define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) | ||
15 | |||
16 | #define vga_readb(x) (*(x)) | ||
17 | #define vga_writeb(x,y) (*(y) = (x)) | ||
18 | |||
19 | #endif | ||
diff --git a/include/asm-xtensa/xor.h b/include/asm-xtensa/xor.h new file mode 100644 index 000000000000..e7b1f083991d --- /dev/null +++ b/include/asm-xtensa/xor.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/xor.h | ||
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 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _XTENSA_XOR_H | ||
12 | #define _XTENSA_XOR_H | ||
13 | |||
14 | #include <asm-generic/xor.h> | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-xtensa/xtensa/cacheasm.h b/include/asm-xtensa/xtensa/cacheasm.h new file mode 100644 index 000000000000..0cdbb0bf180e --- /dev/null +++ b/include/asm-xtensa/xtensa/cacheasm.h | |||
@@ -0,0 +1,708 @@ | |||
1 | #ifndef XTENSA_CACHEASM_H | ||
2 | #define XTENSA_CACHEASM_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/cacheasm.h -- assembler-specific cache | ||
8 | * related definitions that depend on CORE configuration. | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | * | ||
14 | * Copyright (C) 2002 Tensilica Inc. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include <xtensa/coreasm.h> | ||
19 | |||
20 | |||
21 | /* | ||
22 | * This header file defines assembler macros of the form: | ||
23 | * <x>cache_<func> | ||
24 | * where <x> is 'i' or 'd' for instruction and data caches, | ||
25 | * and <func> indicates the function of the macro. | ||
26 | * | ||
27 | * The following functions <func> are defined, | ||
28 | * and apply only to the specified cache (I or D): | ||
29 | * | ||
30 | * reset | ||
31 | * Resets the cache. | ||
32 | * | ||
33 | * sync | ||
34 | * Makes sure any previous cache instructions have been completed; | ||
35 | * ie. makes sure any previous cache control operations | ||
36 | * have had full effect and been synchronized to memory. | ||
37 | * Eg. any invalidate completed [so as not to generate a hit], | ||
38 | * any writebacks or other pipelined writes written to memory, etc. | ||
39 | * | ||
40 | * invalidate_line (single cache line) | ||
41 | * invalidate_region (specified memory range) | ||
42 | * invalidate_all (entire cache) | ||
43 | * Invalidates all cache entries that cache | ||
44 | * data from the specified memory range. | ||
45 | * NOTE: locked entries are not invalidated. | ||
46 | * | ||
47 | * writeback_line (single cache line) | ||
48 | * writeback_region (specified memory range) | ||
49 | * writeback_all (entire cache) | ||
50 | * Writes back to memory all dirty cache entries | ||
51 | * that cache data from the specified memory range, | ||
52 | * and marks these entries as clean. | ||
53 | * NOTE: on some future implementations, this might | ||
54 | * also invalidate. | ||
55 | * NOTE: locked entries are written back, but never invalidated. | ||
56 | * NOTE: instruction caches never implement writeback. | ||
57 | * | ||
58 | * writeback_inv_line (single cache line) | ||
59 | * writeback_inv_region (specified memory range) | ||
60 | * writeback_inv_all (entire cache) | ||
61 | * Writes back to memory all dirty cache entries | ||
62 | * that cache data from the specified memory range, | ||
63 | * and invalidates these entries (including all clean | ||
64 | * cache entries that cache data from that range). | ||
65 | * NOTE: locked entries are written back but not invalidated. | ||
66 | * NOTE: instruction caches never implement writeback. | ||
67 | * | ||
68 | * lock_line (single cache line) | ||
69 | * lock_region (specified memory range) | ||
70 | * Prefetch and lock the specified memory range into cache. | ||
71 | * NOTE: if any part of the specified memory range cannot | ||
72 | * be locked, a ??? exception occurs. These macros don't | ||
73 | * do anything special (yet anyway) to handle this situation. | ||
74 | * | ||
75 | * unlock_line (single cache line) | ||
76 | * unlock_region (specified memory range) | ||
77 | * unlock_all (entire cache) | ||
78 | * Unlock cache entries that cache the specified memory range. | ||
79 | * Entries not already locked are unaffected. | ||
80 | */ | ||
81 | |||
82 | |||
83 | |||
84 | /*************************** GENERIC -- ALL CACHES ***************************/ | ||
85 | |||
86 | |||
87 | /* | ||
88 | * The following macros assume the following cache size/parameter limits | ||
89 | * in the current Xtensa core implementation: | ||
90 | * cache size: 1024 bytes minimum | ||
91 | * line size: 16 - 64 bytes | ||
92 | * way count: 1 - 4 | ||
93 | * | ||
94 | * Minimum entries per way (ie. per associativity) = 1024 / 64 / 4 = 4 | ||
95 | * Hence the assumption that each loop can execute four cache instructions. | ||
96 | * | ||
97 | * Correspondingly, the offset range of instructions is assumed able to cover | ||
98 | * four lines, ie. offsets {0,1,2,3} * line_size are assumed valid for | ||
99 | * both hit and indexed cache instructions. Ie. these offsets are all | ||
100 | * valid: 0, 16, 32, 48, 64, 96, 128, 192 (for line sizes 16, 32, 64). | ||
101 | * This is true of all original cache instructions | ||
102 | * (dhi, ihi, dhwb, dhwbi, dii, iii) which have offsets | ||
103 | * of 0 to 1020 in multiples of 4 (ie. 8 bits shifted by 2). | ||
104 | * This is also true of subsequent cache instructions | ||
105 | * (dhu, ihu, diu, iiu, diwb, diwbi, dpfl, ipfl) which have offsets | ||
106 | * of 0 to 240 in multiples of 16 (ie. 4 bits shifted by 4). | ||
107 | * | ||
108 | * (Maximum cache size, currently 32k, doesn't affect the following macros. | ||
109 | * Cache ways > MMU min page size cause aliasing but that's another matter.) | ||
110 | */ | ||
111 | |||
112 | |||
113 | |||
114 | /* | ||
115 | * Macro to apply an 'indexed' cache instruction to the entire cache. | ||
116 | * | ||
117 | * Parameters: | ||
118 | * cainst instruction/ that takes an address register parameter | ||
119 | * and an offset parameter (in range 0 .. 3*linesize). | ||
120 | * size size of cache in bytes | ||
121 | * linesize size of cache line in bytes | ||
122 | * assoc_or1 number of associativities (ways/sets) in cache | ||
123 | * if all sets affected by cainst, | ||
124 | * or 1 if only one set (or not all sets) of the cache | ||
125 | * is affected by cainst (eg. DIWB or DIWBI [not yet ISA defined]). | ||
126 | * aa, ab unique address registers (temporaries) | ||
127 | */ | ||
128 | |||
129 | .macro cache_index_all cainst, size, linesize, assoc_or1, aa, ab | ||
130 | |||
131 | // Sanity-check on cache parameters: | ||
132 | .ifne (\size % (\linesize * \assoc_or1 * 4)) | ||
133 | .err // cache configuration outside expected/supported range! | ||
134 | .endif | ||
135 | |||
136 | // \size byte cache, \linesize byte lines, \assoc_or1 way(s) affected by each \cainst. | ||
137 | movi \aa, (\size / (\linesize * \assoc_or1 * 4)) | ||
138 | // Possible improvement: need only loop if \aa > 1 ; | ||
139 | // however that particular condition is highly unlikely. | ||
140 | movi \ab, 0 // to iterate over cache | ||
141 | floop \aa, cachex\@ | ||
142 | \cainst \ab, 0*\linesize | ||
143 | \cainst \ab, 1*\linesize | ||
144 | \cainst \ab, 2*\linesize | ||
145 | \cainst \ab, 3*\linesize | ||
146 | addi \ab, \ab, 4*\linesize // move to next line | ||
147 | floopend \aa, cachex\@ | ||
148 | |||
149 | .endm | ||
150 | |||
151 | |||
152 | /* | ||
153 | * Macro to apply a 'hit' cache instruction to a memory region, | ||
154 | * ie. to any cache entries that cache a specified portion (region) of memory. | ||
155 | * Takes care of the unaligned cases, ie. may apply to one | ||
156 | * more cache line than $asize / lineSize if $aaddr is not aligned. | ||
157 | * | ||
158 | * | ||
159 | * Parameters are: | ||
160 | * cainst instruction/macro that takes an address register parameter | ||
161 | * and an offset parameter (currently always zero) | ||
162 | * and generates a cache instruction (eg. "dhi", "dhwb", "ihi", etc.) | ||
163 | * linesize_log2 log2(size of cache line in bytes) | ||
164 | * addr register containing start address of region (clobbered) | ||
165 | * asize register containing size of the region in bytes (clobbered) | ||
166 | * askew unique register used as temporary | ||
167 | * | ||
168 | * !?!?! 2DO: optimization: iterate max(cache_size and \asize) / linesize | ||
169 | */ | ||
170 | |||
171 | .macro cache_hit_region cainst, linesize_log2, addr, asize, askew | ||
172 | |||
173 | // Make \asize the number of iterations: | ||
174 | extui \askew, \addr, 0, \linesize_log2 // get unalignment amount of \addr | ||
175 | add \asize, \asize, \askew // ... and add it to \asize | ||
176 | addi \asize, \asize, (1 << \linesize_log2) - 1 // round up! | ||
177 | srli \asize, \asize, \linesize_log2 | ||
178 | |||
179 | // Iterate over region: | ||
180 | floopnez \asize, cacheh\@ | ||
181 | \cainst \addr, 0 | ||
182 | addi \addr, \addr, (1 << \linesize_log2) // move to next line | ||
183 | floopend \asize, cacheh\@ | ||
184 | |||
185 | .endm | ||
186 | |||
187 | |||
188 | |||
189 | |||
190 | |||
191 | /*************************** INSTRUCTION CACHE ***************************/ | ||
192 | |||
193 | |||
194 | /* | ||
195 | * Reset/initialize the instruction cache by simply invalidating it: | ||
196 | * (need to unlock first also, if cache locking implemented): | ||
197 | * | ||
198 | * Parameters: | ||
199 | * aa, ab unique address registers (temporaries) | ||
200 | */ | ||
201 | .macro icache_reset aa, ab | ||
202 | icache_unlock_all \aa, \ab | ||
203 | icache_invalidate_all \aa, \ab | ||
204 | .endm | ||
205 | |||
206 | |||
207 | /* | ||
208 | * Synchronize after an instruction cache operation, | ||
209 | * to be sure everything is in sync with memory as to be | ||
210 | * expected following any previous instruction cache control operations. | ||
211 | * | ||
212 | * Parameters are: | ||
213 | * ar an address register (temporary) (currently unused, but may be used in future) | ||
214 | */ | ||
215 | .macro icache_sync ar | ||
216 | #if XCHAL_ICACHE_SIZE > 0 | ||
217 | isync | ||
218 | #endif | ||
219 | .endm | ||
220 | |||
221 | |||
222 | |||
223 | /* | ||
224 | * Invalidate a single line of the instruction cache. | ||
225 | * Parameters are: | ||
226 | * ar address register that contains (virtual) address to invalidate | ||
227 | * (may get clobbered in a future implementation, but not currently) | ||
228 | * offset (optional) offset to add to \ar to compute effective address to invalidate | ||
229 | * (note: some number of lsbits are ignored) | ||
230 | */ | ||
231 | .macro icache_invalidate_line ar, offset | ||
232 | #if XCHAL_ICACHE_SIZE > 0 | ||
233 | ihi \ar, \offset // invalidate icache line | ||
234 | /* | ||
235 | * NOTE: in some version of the silicon [!!!SHOULD HAVE BEEN DOCUMENTED!!!] | ||
236 | * 'ihi' doesn't work, so it had been replaced with 'iii' | ||
237 | * (which would just invalidate more than it should, | ||
238 | * which should be okay other than the performance hit | ||
239 | * because cache locking did not exist in that version, | ||
240 | * unless user somehow relies on something being cached). | ||
241 | * [WHAT VERSION IS IT!!?!? | ||
242 | * IS THERE ANY WAY TO TEST FOR THAT HERE, TO OUTPUT 'III' ONLY IF NEEDED!?!?]. | ||
243 | * | ||
244 | * iii \ar, \offset | ||
245 | */ | ||
246 | icache_sync \ar | ||
247 | #endif | ||
248 | .endm | ||
249 | |||
250 | |||
251 | |||
252 | |||
253 | /* | ||
254 | * Invalidate instruction cache entries that cache a specified portion of memory. | ||
255 | * Parameters are: | ||
256 | * astart start address (register gets clobbered) | ||
257 | * asize size of the region in bytes (register gets clobbered) | ||
258 | * ac unique register used as temporary | ||
259 | */ | ||
260 | .macro icache_invalidate_region astart, asize, ac | ||
261 | #if XCHAL_ICACHE_SIZE > 0 | ||
262 | // Instruction cache region invalidation: | ||
263 | cache_hit_region ihi, XCHAL_ICACHE_LINEWIDTH, \astart, \asize, \ac | ||
264 | icache_sync \ac | ||
265 | // End of instruction cache region invalidation | ||
266 | #endif | ||
267 | .endm | ||
268 | |||
269 | |||
270 | |||
271 | /* | ||
272 | * Invalidate entire instruction cache. | ||
273 | * | ||
274 | * Parameters: | ||
275 | * aa, ab unique address registers (temporaries) | ||
276 | */ | ||
277 | .macro icache_invalidate_all aa, ab | ||
278 | #if XCHAL_ICACHE_SIZE > 0 | ||
279 | // Instruction cache invalidation: | ||
280 | cache_index_all iii, XCHAL_ICACHE_SIZE, XCHAL_ICACHE_LINESIZE, XCHAL_ICACHE_WAYS, \aa, \ab | ||
281 | icache_sync \aa | ||
282 | // End of instruction cache invalidation | ||
283 | #endif | ||
284 | .endm | ||
285 | |||
286 | |||
287 | |||
288 | /* | ||
289 | * Lock (prefetch & lock) a single line of the instruction cache. | ||
290 | * | ||
291 | * Parameters are: | ||
292 | * ar address register that contains (virtual) address to lock | ||
293 | * (may get clobbered in a future implementation, but not currently) | ||
294 | * offset offset to add to \ar to compute effective address to lock | ||
295 | * (note: some number of lsbits are ignored) | ||
296 | */ | ||
297 | .macro icache_lock_line ar, offset | ||
298 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
299 | ipfl \ar, \offset /* prefetch and lock icache line */ | ||
300 | icache_sync \ar | ||
301 | #endif | ||
302 | .endm | ||
303 | |||
304 | |||
305 | |||
306 | /* | ||
307 | * Lock (prefetch & lock) a specified portion of memory into the instruction cache. | ||
308 | * Parameters are: | ||
309 | * astart start address (register gets clobbered) | ||
310 | * asize size of the region in bytes (register gets clobbered) | ||
311 | * ac unique register used as temporary | ||
312 | */ | ||
313 | .macro icache_lock_region astart, asize, ac | ||
314 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
315 | // Instruction cache region lock: | ||
316 | cache_hit_region ipfl, XCHAL_ICACHE_LINEWIDTH, \astart, \asize, \ac | ||
317 | icache_sync \ac | ||
318 | // End of instruction cache region lock | ||
319 | #endif | ||
320 | .endm | ||
321 | |||
322 | |||
323 | |||
324 | /* | ||
325 | * Unlock a single line of the instruction cache. | ||
326 | * | ||
327 | * Parameters are: | ||
328 | * ar address register that contains (virtual) address to unlock | ||
329 | * (may get clobbered in a future implementation, but not currently) | ||
330 | * offset offset to add to \ar to compute effective address to unlock | ||
331 | * (note: some number of lsbits are ignored) | ||
332 | */ | ||
333 | .macro icache_unlock_line ar, offset | ||
334 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
335 | ihu \ar, \offset /* unlock icache line */ | ||
336 | icache_sync \ar | ||
337 | #endif | ||
338 | .endm | ||
339 | |||
340 | |||
341 | |||
342 | /* | ||
343 | * Unlock a specified portion of memory from the instruction cache. | ||
344 | * Parameters are: | ||
345 | * astart start address (register gets clobbered) | ||
346 | * asize size of the region in bytes (register gets clobbered) | ||
347 | * ac unique register used as temporary | ||
348 | */ | ||
349 | .macro icache_unlock_region astart, asize, ac | ||
350 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
351 | // Instruction cache region unlock: | ||
352 | cache_hit_region ihu, XCHAL_ICACHE_LINEWIDTH, \astart, \asize, \ac | ||
353 | icache_sync \ac | ||
354 | // End of instruction cache region unlock | ||
355 | #endif | ||
356 | .endm | ||
357 | |||
358 | |||
359 | |||
360 | /* | ||
361 | * Unlock entire instruction cache. | ||
362 | * | ||
363 | * Parameters: | ||
364 | * aa, ab unique address registers (temporaries) | ||
365 | */ | ||
366 | .macro icache_unlock_all aa, ab | ||
367 | #if XCHAL_ICACHE_SIZE > 0 && XCHAL_ICACHE_LINE_LOCKABLE | ||
368 | // Instruction cache unlock: | ||
369 | cache_index_all iiu, XCHAL_ICACHE_SIZE, XCHAL_ICACHE_LINESIZE, 1, \aa, \ab | ||
370 | icache_sync \aa | ||
371 | // End of instruction cache unlock | ||
372 | #endif | ||
373 | .endm | ||
374 | |||
375 | |||
376 | |||
377 | |||
378 | |||
379 | /*************************** DATA CACHE ***************************/ | ||
380 | |||
381 | |||
382 | |||
383 | /* | ||
384 | * Reset/initialize the data cache by simply invalidating it | ||
385 | * (need to unlock first also, if cache locking implemented): | ||
386 | * | ||
387 | * Parameters: | ||
388 | * aa, ab unique address registers (temporaries) | ||
389 | */ | ||
390 | .macro dcache_reset aa, ab | ||
391 | dcache_unlock_all \aa, \ab | ||
392 | dcache_invalidate_all \aa, \ab | ||
393 | .endm | ||
394 | |||
395 | |||
396 | |||
397 | |||
398 | /* | ||
399 | * Synchronize after a data cache operation, | ||
400 | * to be sure everything is in sync with memory as to be | ||
401 | * expected following any previous data cache control operations. | ||
402 | * | ||
403 | * Parameters are: | ||
404 | * ar an address register (temporary) (currently unused, but may be used in future) | ||
405 | */ | ||
406 | .macro dcache_sync ar | ||
407 | #if XCHAL_DCACHE_SIZE > 0 | ||
408 | // This previous sequence errs on the conservative side (too much so); a DSYNC should be sufficient: | ||
409 | //memw // synchronize data cache changes relative to subsequent memory accesses | ||
410 | //isync // be conservative and ISYNC as well (just to be sure) | ||
411 | |||
412 | dsync | ||
413 | #endif | ||
414 | .endm | ||
415 | |||
416 | |||
417 | |||
418 | /* | ||
419 | * Synchronize after a data store operation, | ||
420 | * to be sure the stored data is completely off the processor | ||
421 | * (and assuming there is no buffering outside the processor, | ||
422 | * that the data is in memory). This may be required to | ||
423 | * ensure that the processor's write buffers are emptied. | ||
424 | * A MEMW followed by a read guarantees this, by definition. | ||
425 | * We also try to make sure the read itself completes. | ||
426 | * | ||
427 | * Parameters are: | ||
428 | * ar an address register (temporary) | ||
429 | */ | ||
430 | .macro write_sync ar | ||
431 | memw // ensure previous memory accesses are complete prior to subsequent memory accesses | ||
432 | l32i \ar, sp, 0 // completing this read ensures any previous write has completed, because of MEMW | ||
433 | //slot | ||
434 | add \ar, \ar, \ar // use the result of the read to help ensure the read completes (in future architectures) | ||
435 | .endm | ||
436 | |||
437 | |||
438 | /* | ||
439 | * Invalidate a single line of the data cache. | ||
440 | * Parameters are: | ||
441 | * ar address register that contains (virtual) address to invalidate | ||
442 | * (may get clobbered in a future implementation, but not currently) | ||
443 | * offset (optional) offset to add to \ar to compute effective address to invalidate | ||
444 | * (note: some number of lsbits are ignored) | ||
445 | */ | ||
446 | .macro dcache_invalidate_line ar, offset | ||
447 | #if XCHAL_DCACHE_SIZE > 0 | ||
448 | dhi \ar, \offset | ||
449 | dcache_sync \ar | ||
450 | #endif | ||
451 | .endm | ||
452 | |||
453 | |||
454 | |||
455 | |||
456 | |||
457 | /* | ||
458 | * Invalidate data cache entries that cache a specified portion of memory. | ||
459 | * Parameters are: | ||
460 | * astart start address (register gets clobbered) | ||
461 | * asize size of the region in bytes (register gets clobbered) | ||
462 | * ac unique register used as temporary | ||
463 | */ | ||
464 | .macro dcache_invalidate_region astart, asize, ac | ||
465 | #if XCHAL_DCACHE_SIZE > 0 | ||
466 | // Data cache region invalidation: | ||
467 | cache_hit_region dhi, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
468 | dcache_sync \ac | ||
469 | // End of data cache region invalidation | ||
470 | #endif | ||
471 | .endm | ||
472 | |||
473 | |||
474 | |||
475 | #if 0 | ||
476 | /* | ||
477 | * This is a work-around for a bug in SiChip1 (???). | ||
478 | * There should be a proper mechanism for not outputting | ||
479 | * these instructions when not needed. | ||
480 | * To enable work-around, uncomment this and replace 'dii' | ||
481 | * with 'dii_s1' everywhere, eg. in dcache_invalidate_all | ||
482 | * macro below. | ||
483 | */ | ||
484 | .macro dii_s1 ar, offset | ||
485 | dii \ar, \offset | ||
486 | or \ar, \ar, \ar | ||
487 | or \ar, \ar, \ar | ||
488 | or \ar, \ar, \ar | ||
489 | or \ar, \ar, \ar | ||
490 | .endm | ||
491 | #endif | ||
492 | |||
493 | |||
494 | /* | ||
495 | * Invalidate entire data cache. | ||
496 | * | ||
497 | * Parameters: | ||
498 | * aa, ab unique address registers (temporaries) | ||
499 | */ | ||
500 | .macro dcache_invalidate_all aa, ab | ||
501 | #if XCHAL_DCACHE_SIZE > 0 | ||
502 | // Data cache invalidation: | ||
503 | cache_index_all dii, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, XCHAL_DCACHE_WAYS, \aa, \ab | ||
504 | dcache_sync \aa | ||
505 | // End of data cache invalidation | ||
506 | #endif | ||
507 | .endm | ||
508 | |||
509 | |||
510 | |||
511 | /* | ||
512 | * Writeback a single line of the data cache. | ||
513 | * Parameters are: | ||
514 | * ar address register that contains (virtual) address to writeback | ||
515 | * (may get clobbered in a future implementation, but not currently) | ||
516 | * offset offset to add to \ar to compute effective address to writeback | ||
517 | * (note: some number of lsbits are ignored) | ||
518 | */ | ||
519 | .macro dcache_writeback_line ar, offset | ||
520 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_IS_WRITEBACK | ||
521 | dhwb \ar, \offset | ||
522 | dcache_sync \ar | ||
523 | #endif | ||
524 | .endm | ||
525 | |||
526 | |||
527 | |||
528 | /* | ||
529 | * Writeback dirty data cache entries that cache a specified portion of memory. | ||
530 | * Parameters are: | ||
531 | * astart start address (register gets clobbered) | ||
532 | * asize size of the region in bytes (register gets clobbered) | ||
533 | * ac unique register used as temporary | ||
534 | */ | ||
535 | .macro dcache_writeback_region astart, asize, ac | ||
536 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_IS_WRITEBACK | ||
537 | // Data cache region writeback: | ||
538 | cache_hit_region dhwb, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
539 | dcache_sync \ac | ||
540 | // End of data cache region writeback | ||
541 | #endif | ||
542 | .endm | ||
543 | |||
544 | |||
545 | |||
546 | /* | ||
547 | * Writeback entire data cache. | ||
548 | * Parameters: | ||
549 | * aa, ab unique address registers (temporaries) | ||
550 | */ | ||
551 | .macro dcache_writeback_all aa, ab | ||
552 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_IS_WRITEBACK | ||
553 | // Data cache writeback: | ||
554 | cache_index_all diwb, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, 1, \aa, \ab | ||
555 | dcache_sync \aa | ||
556 | // End of data cache writeback | ||
557 | #endif | ||
558 | .endm | ||
559 | |||
560 | |||
561 | |||
562 | /* | ||
563 | * Writeback and invalidate a single line of the data cache. | ||
564 | * Parameters are: | ||
565 | * ar address register that contains (virtual) address to writeback and invalidate | ||
566 | * (may get clobbered in a future implementation, but not currently) | ||
567 | * offset offset to add to \ar to compute effective address to writeback and invalidate | ||
568 | * (note: some number of lsbits are ignored) | ||
569 | */ | ||
570 | .macro dcache_writeback_inv_line ar, offset | ||
571 | #if XCHAL_DCACHE_SIZE > 0 | ||
572 | dhwbi \ar, \offset /* writeback and invalidate dcache line */ | ||
573 | dcache_sync \ar | ||
574 | #endif | ||
575 | .endm | ||
576 | |||
577 | |||
578 | |||
579 | /* | ||
580 | * Writeback and invalidate data cache entries that cache a specified portion of memory. | ||
581 | * Parameters are: | ||
582 | * astart start address (register gets clobbered) | ||
583 | * asize size of the region in bytes (register gets clobbered) | ||
584 | * ac unique register used as temporary | ||
585 | */ | ||
586 | .macro dcache_writeback_inv_region astart, asize, ac | ||
587 | #if XCHAL_DCACHE_SIZE > 0 | ||
588 | // Data cache region writeback and invalidate: | ||
589 | cache_hit_region dhwbi, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
590 | dcache_sync \ac | ||
591 | // End of data cache region writeback and invalidate | ||
592 | #endif | ||
593 | .endm | ||
594 | |||
595 | |||
596 | |||
597 | /* | ||
598 | * Writeback and invalidate entire data cache. | ||
599 | * Parameters: | ||
600 | * aa, ab unique address registers (temporaries) | ||
601 | */ | ||
602 | .macro dcache_writeback_inv_all aa, ab | ||
603 | #if XCHAL_DCACHE_SIZE > 0 | ||
604 | // Data cache writeback and invalidate: | ||
605 | #if XCHAL_DCACHE_IS_WRITEBACK | ||
606 | cache_index_all diwbi, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, 1, \aa, \ab | ||
607 | dcache_sync \aa | ||
608 | #else /*writeback*/ | ||
609 | // Data cache does not support writeback, so just invalidate: */ | ||
610 | dcache_invalidate_all \aa, \ab | ||
611 | #endif /*writeback*/ | ||
612 | // End of data cache writeback and invalidate | ||
613 | #endif | ||
614 | .endm | ||
615 | |||
616 | |||
617 | |||
618 | |||
619 | /* | ||
620 | * Lock (prefetch & lock) a single line of the data cache. | ||
621 | * | ||
622 | * Parameters are: | ||
623 | * ar address register that contains (virtual) address to lock | ||
624 | * (may get clobbered in a future implementation, but not currently) | ||
625 | * offset offset to add to \ar to compute effective address to lock | ||
626 | * (note: some number of lsbits are ignored) | ||
627 | */ | ||
628 | .macro dcache_lock_line ar, offset | ||
629 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
630 | dpfl \ar, \offset /* prefetch and lock dcache line */ | ||
631 | dcache_sync \ar | ||
632 | #endif | ||
633 | .endm | ||
634 | |||
635 | |||
636 | |||
637 | /* | ||
638 | * Lock (prefetch & lock) a specified portion of memory into the data cache. | ||
639 | * Parameters are: | ||
640 | * astart start address (register gets clobbered) | ||
641 | * asize size of the region in bytes (register gets clobbered) | ||
642 | * ac unique register used as temporary | ||
643 | */ | ||
644 | .macro dcache_lock_region astart, asize, ac | ||
645 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
646 | // Data cache region lock: | ||
647 | cache_hit_region dpfl, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
648 | dcache_sync \ac | ||
649 | // End of data cache region lock | ||
650 | #endif | ||
651 | .endm | ||
652 | |||
653 | |||
654 | |||
655 | /* | ||
656 | * Unlock a single line of the data cache. | ||
657 | * | ||
658 | * Parameters are: | ||
659 | * ar address register that contains (virtual) address to unlock | ||
660 | * (may get clobbered in a future implementation, but not currently) | ||
661 | * offset offset to add to \ar to compute effective address to unlock | ||
662 | * (note: some number of lsbits are ignored) | ||
663 | */ | ||
664 | .macro dcache_unlock_line ar, offset | ||
665 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
666 | dhu \ar, \offset /* unlock dcache line */ | ||
667 | dcache_sync \ar | ||
668 | #endif | ||
669 | .endm | ||
670 | |||
671 | |||
672 | |||
673 | /* | ||
674 | * Unlock a specified portion of memory from the data cache. | ||
675 | * Parameters are: | ||
676 | * astart start address (register gets clobbered) | ||
677 | * asize size of the region in bytes (register gets clobbered) | ||
678 | * ac unique register used as temporary | ||
679 | */ | ||
680 | .macro dcache_unlock_region astart, asize, ac | ||
681 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
682 | // Data cache region unlock: | ||
683 | cache_hit_region dhu, XCHAL_DCACHE_LINEWIDTH, \astart, \asize, \ac | ||
684 | dcache_sync \ac | ||
685 | // End of data cache region unlock | ||
686 | #endif | ||
687 | .endm | ||
688 | |||
689 | |||
690 | |||
691 | /* | ||
692 | * Unlock entire data cache. | ||
693 | * | ||
694 | * Parameters: | ||
695 | * aa, ab unique address registers (temporaries) | ||
696 | */ | ||
697 | .macro dcache_unlock_all aa, ab | ||
698 | #if XCHAL_DCACHE_SIZE > 0 && XCHAL_DCACHE_LINE_LOCKABLE | ||
699 | // Data cache unlock: | ||
700 | cache_index_all diu, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE, 1, \aa, \ab | ||
701 | dcache_sync \aa | ||
702 | // End of data cache unlock | ||
703 | #endif | ||
704 | .endm | ||
705 | |||
706 | |||
707 | #endif /*XTENSA_CACHEASM_H*/ | ||
708 | |||
diff --git a/include/asm-xtensa/xtensa/cacheattrasm.h b/include/asm-xtensa/xtensa/cacheattrasm.h new file mode 100644 index 000000000000..1c3e117b3592 --- /dev/null +++ b/include/asm-xtensa/xtensa/cacheattrasm.h | |||
@@ -0,0 +1,432 @@ | |||
1 | #ifndef XTENSA_CACHEATTRASM_H | ||
2 | #define XTENSA_CACHEATTRASM_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/cacheattrasm.h -- assembler-specific | ||
8 | * CACHEATTR register related definitions that depend on CORE | ||
9 | * configuration. | ||
10 | * | ||
11 | * This file is subject to the terms and conditions of the GNU General Public | ||
12 | * License. See the file "COPYING" in the main directory of this archive | ||
13 | * for more details. | ||
14 | * | ||
15 | * Copyright (C) 2002 Tensilica Inc. | ||
16 | */ | ||
17 | |||
18 | |||
19 | #include <xtensa/coreasm.h> | ||
20 | |||
21 | |||
22 | /* | ||
23 | * This header file defines assembler macros of the form: | ||
24 | * <x>cacheattr_<func> | ||
25 | * where: | ||
26 | * <x> is 'i', 'd' or absent for instruction, data | ||
27 | * or both caches; and | ||
28 | * <func> indicates the function of the macro. | ||
29 | * | ||
30 | * The following functions are defined: | ||
31 | * | ||
32 | * icacheattr_get | ||
33 | * Reads I-cache CACHEATTR into a2 (clobbers a3-a5). | ||
34 | * | ||
35 | * dcacheattr_get | ||
36 | * Reads D-cache CACHEATTR into a2 (clobbers a3-a5). | ||
37 | * (Note: for configs with a real CACHEATTR register, the | ||
38 | * above two macros are identical.) | ||
39 | * | ||
40 | * cacheattr_set | ||
41 | * Writes both I-cache and D-cache CACHEATTRs from a2 (a3-a8 clobbered). | ||
42 | * Works even when changing one's own code's attributes. | ||
43 | * | ||
44 | * icacheattr_is_enabled label | ||
45 | * Branches to \label if I-cache appears to have been enabled | ||
46 | * (eg. if CACHEATTR contains a cache-enabled attribute). | ||
47 | * (clobbers a2-a5,SAR) | ||
48 | * | ||
49 | * dcacheattr_is_enabled label | ||
50 | * Branches to \label if D-cache appears to have been enabled | ||
51 | * (eg. if CACHEATTR contains a cache-enabled attribute). | ||
52 | * (clobbers a2-a5,SAR) | ||
53 | * | ||
54 | * cacheattr_is_enabled label | ||
55 | * Branches to \label if either I-cache or D-cache appears to have been enabled | ||
56 | * (eg. if CACHEATTR contains a cache-enabled attribute). | ||
57 | * (clobbers a2-a5,SAR) | ||
58 | * | ||
59 | * The following macros are only defined under certain conditions: | ||
60 | * | ||
61 | * icacheattr_set (if XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR) | ||
62 | * Writes I-cache CACHEATTR from a2 (a3-a8 clobbered). | ||
63 | * | ||
64 | * dcacheattr_set (if XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR) | ||
65 | * Writes D-cache CACHEATTR from a2 (a3-a8 clobbered). | ||
66 | */ | ||
67 | |||
68 | |||
69 | |||
70 | /*************************** GENERIC -- ALL CACHES ***************************/ | ||
71 | |||
72 | /* | ||
73 | * _cacheattr_get | ||
74 | * | ||
75 | * (Internal macro.) | ||
76 | * Returns value of CACHEATTR register (or closest equivalent) in a2. | ||
77 | * | ||
78 | * Entry: | ||
79 | * (none) | ||
80 | * Exit: | ||
81 | * a2 value read from CACHEATTR | ||
82 | * a3-a5 clobbered (temporaries) | ||
83 | */ | ||
84 | .macro _cacheattr_get tlb | ||
85 | #if XCHAL_HAVE_CACHEATTR | ||
86 | rsr a2, CACHEATTR | ||
87 | #elif XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
88 | // We have a config that "mimics" CACHEATTR using a simplified | ||
89 | // "MMU" composed of a single statically-mapped way. | ||
90 | // DTLB and ITLB are independent, so there's no single | ||
91 | // cache attribute that can describe both. So for now | ||
92 | // just return the DTLB state. | ||
93 | movi a5, 0xE0000000 | ||
94 | movi a2, 0 | ||
95 | movi a3, 0 | ||
96 | 1: add a3, a3, a5 // next segment | ||
97 | r&tlb&1 a4, a3 // get PPN+CA of segment at 0xE0000000, 0xC0000000, ..., 0 | ||
98 | dsync // interlock??? | ||
99 | slli a2, a2, 4 | ||
100 | extui a4, a4, 0, 4 // extract CA | ||
101 | or a2, a2, a4 | ||
102 | bnez a3, 1b | ||
103 | #else | ||
104 | // This macro isn't applicable to arbitrary MMU configurations. | ||
105 | // Just return zero. | ||
106 | movi a2, 0 | ||
107 | #endif | ||
108 | .endm | ||
109 | |||
110 | .macro icacheattr_get | ||
111 | _cacheattr_get itlb | ||
112 | .endm | ||
113 | |||
114 | .macro dcacheattr_get | ||
115 | _cacheattr_get dtlb | ||
116 | .endm | ||
117 | |||
118 | |||
119 | #define XCHAL_CACHEATTR_ALL_BYPASS 0x22222222 /* default (powerup/reset) value of CACHEATTR, all BYPASS | ||
120 | mode (ie. disabled/bypassed caches) */ | ||
121 | |||
122 | #if XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
123 | |||
124 | #define XCHAL_FCA_ENAMASK 0x001A /* bitmap of fetch attributes that require enabled icache */ | ||
125 | #define XCHAL_LCA_ENAMASK 0x0003 /* bitmap of load attributes that require enabled dcache */ | ||
126 | #define XCHAL_SCA_ENAMASK 0x0003 /* bitmap of store attributes that require enabled dcache */ | ||
127 | #define XCHAL_LSCA_ENAMASK (XCHAL_LCA_ENAMASK|XCHAL_SCA_ENAMASK) /* l/s attrs requiring enabled dcache */ | ||
128 | #define XCHAL_ALLCA_ENAMASK (XCHAL_FCA_ENAMASK|XCHAL_LSCA_ENAMASK) /* all attrs requiring enabled caches */ | ||
129 | |||
130 | /* | ||
131 | * _cacheattr_is_enabled | ||
132 | * | ||
133 | * (Internal macro.) | ||
134 | * Branches to \label if CACHEATTR in a2 indicates an enabled | ||
135 | * cache, using mask in a3. | ||
136 | * | ||
137 | * Parameters: | ||
138 | * label where to branch to if cache is enabled | ||
139 | * Entry: | ||
140 | * a2 contains CACHEATTR value used to determine whether | ||
141 | * caches are enabled | ||
142 | * a3 16-bit constant where each bit correspond to | ||
143 | * one of the 16 possible CA values (in a CACHEATTR mask); | ||
144 | * CA values that indicate the cache is enabled | ||
145 | * have their corresponding bit set in this mask | ||
146 | * (eg. use XCHAL_xCA_ENAMASK , above) | ||
147 | * Exit: | ||
148 | * a2,a4,a5 clobbered | ||
149 | * SAR clobbered | ||
150 | */ | ||
151 | .macro _cacheattr_is_enabled label | ||
152 | movi a4, 8 // loop 8 times | ||
153 | .Lcaife\@: | ||
154 | extui a5, a2, 0, 4 // get CA nibble | ||
155 | ssr a5 // index into mask according to CA... | ||
156 | srl a5, a3 // ...and get CA's mask bit in a5 bit 0 | ||
157 | bbsi.l a5, 0, \label // if CA indicates cache enabled, jump to label | ||
158 | srli a2, a2, 4 // next nibble | ||
159 | addi a4, a4, -1 | ||
160 | bnez a4, .Lcaife\@ // loop for each nibble | ||
161 | .endm | ||
162 | |||
163 | #else /* XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR */ | ||
164 | .macro _cacheattr_is_enabled label | ||
165 | j \label // macro not applicable, assume caches always enabled | ||
166 | .endm | ||
167 | #endif /* XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR */ | ||
168 | |||
169 | |||
170 | |||
171 | /* | ||
172 | * icacheattr_is_enabled | ||
173 | * | ||
174 | * Branches to \label if I-cache is enabled. | ||
175 | * | ||
176 | * Parameters: | ||
177 | * label where to branch to if icache is enabled | ||
178 | * Entry: | ||
179 | * (none) | ||
180 | * Exit: | ||
181 | * a2-a5, SAR clobbered (temporaries) | ||
182 | */ | ||
183 | .macro icacheattr_is_enabled label | ||
184 | #if XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
185 | icacheattr_get | ||
186 | movi a3, XCHAL_FCA_ENAMASK | ||
187 | #endif | ||
188 | _cacheattr_is_enabled \label | ||
189 | .endm | ||
190 | |||
191 | /* | ||
192 | * dcacheattr_is_enabled | ||
193 | * | ||
194 | * Branches to \label if D-cache is enabled. | ||
195 | * | ||
196 | * Parameters: | ||
197 | * label where to branch to if dcache is enabled | ||
198 | * Entry: | ||
199 | * (none) | ||
200 | * Exit: | ||
201 | * a2-a5, SAR clobbered (temporaries) | ||
202 | */ | ||
203 | .macro dcacheattr_is_enabled label | ||
204 | #if XCHAL_HAVE_CACHEATTR || XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
205 | dcacheattr_get | ||
206 | movi a3, XCHAL_LSCA_ENAMASK | ||
207 | #endif | ||
208 | _cacheattr_is_enabled \label | ||
209 | .endm | ||
210 | |||
211 | /* | ||
212 | * cacheattr_is_enabled | ||
213 | * | ||
214 | * Branches to \label if either I-cache or D-cache is enabled. | ||
215 | * | ||
216 | * Parameters: | ||
217 | * label where to branch to if a cache is enabled | ||
218 | * Entry: | ||
219 | * (none) | ||
220 | * Exit: | ||
221 | * a2-a5, SAR clobbered (temporaries) | ||
222 | */ | ||
223 | .macro cacheattr_is_enabled label | ||
224 | #if XCHAL_HAVE_CACHEATTR | ||
225 | rsr a2, CACHEATTR | ||
226 | movi a3, XCHAL_ALLCA_ENAMASK | ||
227 | #elif XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
228 | icacheattr_get | ||
229 | movi a3, XCHAL_FCA_ENAMASK | ||
230 | _cacheattr_is_enabled \label | ||
231 | dcacheattr_get | ||
232 | movi a3, XCHAL_LSCA_ENAMASK | ||
233 | #endif | ||
234 | _cacheattr_is_enabled \label | ||
235 | .endm | ||
236 | |||
237 | |||
238 | |||
239 | /* | ||
240 | * The ISA does not have a defined way to change the | ||
241 | * instruction cache attributes of the running code, | ||
242 | * ie. of the memory area that encloses the current PC. | ||
243 | * However, each micro-architecture (or class of | ||
244 | * configurations within a micro-architecture) | ||
245 | * provides a way to deal with this issue. | ||
246 | * | ||
247 | * Here are a few macros used to implement the relevant | ||
248 | * approach taken. | ||
249 | */ | ||
250 | |||
251 | #if XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
252 | // We have a config that "mimics" CACHEATTR using a simplified | ||
253 | // "MMU" composed of a single statically-mapped way. | ||
254 | |||
255 | /* | ||
256 | * icacheattr_set | ||
257 | * | ||
258 | * Entry: | ||
259 | * a2 cacheattr value to set | ||
260 | * Exit: | ||
261 | * a2 unchanged | ||
262 | * a3-a8 clobbered (temporaries) | ||
263 | */ | ||
264 | .macro icacheattr_set | ||
265 | |||
266 | movi a5, 0xE0000000 // mask of upper 3 bits | ||
267 | movi a6, 3f // PC where ITLB is set | ||
268 | movi a3, 0 // start at region 0 (0 .. 7) | ||
269 | and a6, a6, a5 // upper 3 bits of local PC area | ||
270 | mov a7, a2 // copy a2 so it doesn't get clobbered | ||
271 | j 3f | ||
272 | |||
273 | # if XCHAL_HAVE_XLT_CACHEATTR | ||
274 | // Can do translations, use generic method: | ||
275 | 1: sub a6, a3, a5 // address of some other segment | ||
276 | ritlb1 a8, a6 // save its PPN+CA | ||
277 | dsync // interlock?? | ||
278 | witlb a4, a6 // make it translate to this code area | ||
279 | movi a6, 5f // where to jump into it | ||
280 | isync | ||
281 | sub a6, a6, a5 // adjust jump address within that other segment | ||
282 | jx a6 | ||
283 | |||
284 | // Note that in the following code snippet, which runs at a different virtual | ||
285 | // address than it is assembled for, we avoid using literals (eg. via movi/l32r) | ||
286 | // just in case literals end up in a different 512 MB segment, and we avoid | ||
287 | // instructions that rely on the current PC being what is expected. | ||
288 | // | ||
289 | .align 4 | ||
290 | _j 6f // this is at label '5' minus 4 bytes | ||
291 | .align 4 | ||
292 | 5: witlb a4, a3 // we're in other segment, now can write previous segment's CA | ||
293 | isync | ||
294 | add a6, a6, a5 // back to previous segment | ||
295 | addi a6, a6, -4 // next jump label | ||
296 | jx a6 | ||
297 | |||
298 | 6: sub a6, a3, a5 // address of some other segment | ||
299 | witlb a8, a6 // restore PPN+CA of other segment | ||
300 | mov a6, a3 // restore a6 | ||
301 | isync | ||
302 | # else /* XCHAL_HAVE_XLT_CACHEATTR */ | ||
303 | // Use micro-architecture specific method. | ||
304 | // The following 4-instruction sequence is aligned such that | ||
305 | // it all fits within a single I-cache line. Sixteen byte | ||
306 | // alignment is sufficient for this (using XCHAL_ICACHE_LINESIZE | ||
307 | // actually causes problems because that can be greater than | ||
308 | // the alignment of the reset vector, where this macro is often | ||
309 | // invoked, which would cause the linker to align the reset | ||
310 | // vector code away from the reset vector!!). | ||
311 | .align 16 /*XCHAL_ICACHE_LINESIZE*/ | ||
312 | 1: _witlb a4, a3 // write wired PTE (CA, no PPN) of 512MB segment to ITLB | ||
313 | _isync | ||
314 | nop | ||
315 | nop | ||
316 | # endif /* XCHAL_HAVE_XLT_CACHEATTR */ | ||
317 | beq a3, a5, 4f // done? | ||
318 | |||
319 | // Note that in the WITLB loop, we don't do any load/stores | ||
320 | // (may not be an issue here, but it is important in the DTLB case). | ||
321 | 2: srli a7, a7, 4 // next CA | ||
322 | sub a3, a3, a5 // next segment (add 0x20000000) | ||
323 | 3: | ||
324 | # if XCHAL_HAVE_XLT_CACHEATTR /* if have translation, preserve it */ | ||
325 | ritlb1 a8, a3 // get current PPN+CA of segment | ||
326 | dsync // interlock??? | ||
327 | extui a4, a7, 0, 4 // extract CA to set | ||
328 | srli a8, a8, 4 // clear CA but keep PPN ... | ||
329 | slli a8, a8, 4 // ... | ||
330 | add a4, a4, a8 // combine new CA with PPN to preserve | ||
331 | # else | ||
332 | extui a4, a7, 0, 4 // extract CA | ||
333 | # endif | ||
334 | beq a3, a6, 1b // current PC's region? if so, do it in a safe way | ||
335 | witlb a4, a3 // write wired PTE (CA [+PPN]) of 512MB segment to ITLB | ||
336 | bne a3, a5, 2b | ||
337 | isync // make sure all ifetch changes take effect | ||
338 | 4: | ||
339 | .endm // icacheattr_set | ||
340 | |||
341 | |||
342 | /* | ||
343 | * dcacheattr_set | ||
344 | * | ||
345 | * Entry: | ||
346 | * a2 cacheattr value to set | ||
347 | * Exit: | ||
348 | * a2 unchanged | ||
349 | * a3-a8 clobbered (temporaries) | ||
350 | */ | ||
351 | |||
352 | .macro dcacheattr_set | ||
353 | |||
354 | movi a5, 0xE0000000 // mask of upper 3 bits | ||
355 | movi a3, 0 // start at region 0 (0 .. 7) | ||
356 | mov a7, a2 // copy a2 so it doesn't get clobbered | ||
357 | j 3f | ||
358 | // Note that in the WDTLB loop, we don't do any load/stores | ||
359 | // (including implicit l32r via movi) because it isn't safe. | ||
360 | 2: srli a7, a7, 4 // next CA | ||
361 | sub a3, a3, a5 // next segment (add 0x20000000) | ||
362 | 3: | ||
363 | # if XCHAL_HAVE_XLT_CACHEATTR /* if have translation, preserve it */ | ||
364 | rdtlb1 a8, a3 // get current PPN+CA of segment | ||
365 | dsync // interlock??? | ||
366 | extui a4, a7, 0, 4 // extract CA to set | ||
367 | srli a8, a8, 4 // clear CA but keep PPN ... | ||
368 | slli a8, a8, 4 // ... | ||
369 | add a4, a4, a8 // combine new CA with PPN to preserve | ||
370 | # else | ||
371 | extui a4, a7, 0, 4 // extract CA to set | ||
372 | # endif | ||
373 | wdtlb a4, a3 // write wired PTE (CA [+PPN]) of 512MB segment to DTLB | ||
374 | bne a3, a5, 2b | ||
375 | dsync // make sure all data path changes take effect | ||
376 | .endm // dcacheattr_set | ||
377 | |||
378 | #endif /* XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR */ | ||
379 | |||
380 | |||
381 | |||
382 | /* | ||
383 | * cacheattr_set | ||
384 | * | ||
385 | * Macro that sets the current CACHEATTR safely | ||
386 | * (both i and d) according to the current contents of a2. | ||
387 | * It works even when changing the cache attributes of | ||
388 | * the currently running code. | ||
389 | * | ||
390 | * Entry: | ||
391 | * a2 cacheattr value to set | ||
392 | * Exit: | ||
393 | * a2 unchanged | ||
394 | * a3-a8 clobbered (temporaries) | ||
395 | */ | ||
396 | .macro cacheattr_set | ||
397 | |||
398 | #if XCHAL_HAVE_CACHEATTR | ||
399 | # if XCHAL_ICACHE_LINESIZE < 4 | ||
400 | // No i-cache, so can always safely write to CACHEATTR: | ||
401 | wsr a2, CACHEATTR | ||
402 | # else | ||
403 | // The Athens micro-architecture, when using the old | ||
404 | // exception architecture option (ie. with the CACHEATTR register) | ||
405 | // allows changing the cache attributes of the running code | ||
406 | // using the following exact sequence aligned to be within | ||
407 | // an instruction cache line. (NOTE: using XCHAL_ICACHE_LINESIZE | ||
408 | // alignment actually causes problems because that can be greater | ||
409 | // than the alignment of the reset vector, where this macro is often | ||
410 | // invoked, which would cause the linker to align the reset | ||
411 | // vector code away from the reset vector!!). | ||
412 | j 1f | ||
413 | .align 16 /*XCHAL_ICACHE_LINESIZE*/ // align to within an I-cache line | ||
414 | 1: _wsr a2, CACHEATTR | ||
415 | _isync | ||
416 | nop | ||
417 | nop | ||
418 | # endif | ||
419 | #elif XCHAL_HAVE_MIMIC_CACHEATTR || XCHAL_HAVE_XLT_CACHEATTR | ||
420 | // DTLB and ITLB are independent, but to keep semantics | ||
421 | // of this macro we simply write to both. | ||
422 | icacheattr_set | ||
423 | dcacheattr_set | ||
424 | #else | ||
425 | // This macro isn't applicable to arbitrary MMU configurations. | ||
426 | // Do nothing in this case. | ||
427 | #endif | ||
428 | .endm | ||
429 | |||
430 | |||
431 | #endif /*XTENSA_CACHEATTRASM_H*/ | ||
432 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/core.h b/include/asm-xtensa/xtensa/config-linux_be/core.h new file mode 100644 index 000000000000..d54fe5eb1064 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/core.h | |||
@@ -0,0 +1,1270 @@ | |||
1 | /* | ||
2 | * xtensa/config/core.h -- HAL definitions that are dependent on CORE configuration | ||
3 | * | ||
4 | * This header file is sometimes referred to as the "compile-time HAL" or CHAL. | ||
5 | * It was generated for a specific Xtensa processor configuration. | ||
6 | * | ||
7 | * Source for configuration-independent binaries (which link in a | ||
8 | * configuration-specific HAL library) must NEVER include this file. | ||
9 | * It is perfectly normal, however, for the HAL source itself to include this file. | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
17 | * License as published by the Free Software Foundation. | ||
18 | * | ||
19 | * This program is distributed in the hope that it would be useful, but | ||
20 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
22 | * | ||
23 | * Further, this software is distributed without any warranty that it is | ||
24 | * free of the rightful claim of any third person regarding infringement | ||
25 | * or the like. Any license provided herein, whether implied or | ||
26 | * otherwise, applies only to this software file. Patent licenses, if | ||
27 | * any, provided herein do not apply to combinations of this program with | ||
28 | * other software, or any other product whatsoever. | ||
29 | * | ||
30 | * You should have received a copy of the GNU Lesser General Public | ||
31 | * License along with this program; if not, write the Free Software | ||
32 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
33 | * USA. | ||
34 | */ | ||
35 | |||
36 | |||
37 | #ifndef XTENSA_CONFIG_CORE_H | ||
38 | #define XTENSA_CONFIG_CORE_H | ||
39 | |||
40 | #include <xtensa/hal.h> | ||
41 | |||
42 | |||
43 | /*---------------------------------------------------------------------- | ||
44 | GENERAL | ||
45 | ----------------------------------------------------------------------*/ | ||
46 | |||
47 | /* | ||
48 | * Separators for macros that expand into arrays. | ||
49 | * These can be predefined by files that #include this one, | ||
50 | * when different separators are required. | ||
51 | */ | ||
52 | /* Element separator for macros that expand into 1-dimensional arrays: */ | ||
53 | #ifndef XCHAL_SEP | ||
54 | #define XCHAL_SEP , | ||
55 | #endif | ||
56 | /* Array separator for macros that expand into 2-dimensional arrays: */ | ||
57 | #ifndef XCHAL_SEP2 | ||
58 | #define XCHAL_SEP2 },{ | ||
59 | #endif | ||
60 | |||
61 | |||
62 | /*---------------------------------------------------------------------- | ||
63 | ENDIANNESS | ||
64 | ----------------------------------------------------------------------*/ | ||
65 | |||
66 | #define XCHAL_HAVE_BE 1 | ||
67 | #define XCHAL_HAVE_LE 0 | ||
68 | #define XCHAL_MEMORY_ORDER XTHAL_BIGENDIAN | ||
69 | |||
70 | |||
71 | /*---------------------------------------------------------------------- | ||
72 | REGISTER WINDOWS | ||
73 | ----------------------------------------------------------------------*/ | ||
74 | |||
75 | #define XCHAL_HAVE_WINDOWED 1 /* 1 if windowed registers option configured, 0 otherwise */ | ||
76 | #define XCHAL_NUM_AREGS 64 /* number of physical address regs */ | ||
77 | #define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */ | ||
78 | |||
79 | |||
80 | /*---------------------------------------------------------------------- | ||
81 | ADDRESS ALIGNMENT | ||
82 | ----------------------------------------------------------------------*/ | ||
83 | |||
84 | /* These apply to a selected set of core load and store instructions only (see ISA): */ | ||
85 | #define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* 1 if unaligned loads cause an exception, 0 otherwise */ | ||
86 | #define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* 1 if unaligned stores cause an exception, 0 otherwise */ | ||
87 | |||
88 | |||
89 | /*---------------------------------------------------------------------- | ||
90 | INTERRUPTS | ||
91 | ----------------------------------------------------------------------*/ | ||
92 | |||
93 | #define XCHAL_HAVE_INTERRUPTS 1 /* 1 if interrupt option configured, 0 otherwise */ | ||
94 | #define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* 1 if high-priority interrupt option configured, 0 otherwise */ | ||
95 | #define XCHAL_HAVE_HIGHLEVEL_INTERRUPTS XCHAL_HAVE_HIGHPRI_INTERRUPTS | ||
96 | #define XCHAL_HAVE_NMI 0 /* 1 if NMI option configured, 0 otherwise */ | ||
97 | #define XCHAL_NUM_INTERRUPTS 17 /* number of interrupts */ | ||
98 | #define XCHAL_NUM_INTERRUPTS_LOG2 5 /* number of bits to hold an interrupt number: roundup(log2(number of interrupts)) */ | ||
99 | #define XCHAL_NUM_EXTINTERRUPTS 10 /* number of external interrupts */ | ||
100 | #define XCHAL_NUM_INTLEVELS 4 /* number of interrupt levels (not including level zero!) */ | ||
101 | #define XCHAL_NUM_LOWPRI_LEVELS 1 /* number of low-priority interrupt levels (always 1) */ | ||
102 | #define XCHAL_FIRST_HIGHPRI_LEVEL (XCHAL_NUM_LOWPRI_LEVELS+1) /* level of first high-priority interrupt (always 2) */ | ||
103 | #define XCHAL_EXCM_LEVEL 1 /* level of interrupts masked by PS.EXCM (XEA2 only; always 1 in T10xx); | ||
104 | for XEA1, where there is no PS.EXCM, this is always 1; | ||
105 | interrupts at levels FIRST_HIGHPRI <= n <= EXCM_LEVEL, if any, | ||
106 | are termed "medium priority" interrupts (post T10xx only) */ | ||
107 | /* Note: 1 <= LOWPRI_LEVELS <= EXCM_LEVEL < DEBUGLEVEL <= NUM_INTLEVELS < NMILEVEL <= 15 */ | ||
108 | |||
109 | /* Masks of interrupts at each interrupt level: */ | ||
110 | #define XCHAL_INTLEVEL0_MASK 0x00000000 | ||
111 | #define XCHAL_INTLEVEL1_MASK 0x000064F9 | ||
112 | #define XCHAL_INTLEVEL2_MASK 0x00008902 | ||
113 | #define XCHAL_INTLEVEL3_MASK 0x00011204 | ||
114 | #define XCHAL_INTLEVEL4_MASK 0x00000000 | ||
115 | #define XCHAL_INTLEVEL5_MASK 0x00000000 | ||
116 | #define XCHAL_INTLEVEL6_MASK 0x00000000 | ||
117 | #define XCHAL_INTLEVEL7_MASK 0x00000000 | ||
118 | #define XCHAL_INTLEVEL8_MASK 0x00000000 | ||
119 | #define XCHAL_INTLEVEL9_MASK 0x00000000 | ||
120 | #define XCHAL_INTLEVEL10_MASK 0x00000000 | ||
121 | #define XCHAL_INTLEVEL11_MASK 0x00000000 | ||
122 | #define XCHAL_INTLEVEL12_MASK 0x00000000 | ||
123 | #define XCHAL_INTLEVEL13_MASK 0x00000000 | ||
124 | #define XCHAL_INTLEVEL14_MASK 0x00000000 | ||
125 | #define XCHAL_INTLEVEL15_MASK 0x00000000 | ||
126 | /* As an array of entries (eg. for C constant arrays): */ | ||
127 | #define XCHAL_INTLEVEL_MASKS 0x00000000 XCHAL_SEP \ | ||
128 | 0x000064F9 XCHAL_SEP \ | ||
129 | 0x00008902 XCHAL_SEP \ | ||
130 | 0x00011204 XCHAL_SEP \ | ||
131 | 0x00000000 XCHAL_SEP \ | ||
132 | 0x00000000 XCHAL_SEP \ | ||
133 | 0x00000000 XCHAL_SEP \ | ||
134 | 0x00000000 XCHAL_SEP \ | ||
135 | 0x00000000 XCHAL_SEP \ | ||
136 | 0x00000000 XCHAL_SEP \ | ||
137 | 0x00000000 XCHAL_SEP \ | ||
138 | 0x00000000 XCHAL_SEP \ | ||
139 | 0x00000000 XCHAL_SEP \ | ||
140 | 0x00000000 XCHAL_SEP \ | ||
141 | 0x00000000 XCHAL_SEP \ | ||
142 | 0x00000000 | ||
143 | |||
144 | /* Masks of interrupts at each range 1..n of interrupt levels: */ | ||
145 | #define XCHAL_INTLEVEL0_ANDBELOW_MASK 0x00000000 | ||
146 | #define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x000064F9 | ||
147 | #define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x0000EDFB | ||
148 | #define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x0001FFFF | ||
149 | #define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x0001FFFF | ||
150 | #define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x0001FFFF | ||
151 | #define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x0001FFFF | ||
152 | #define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x0001FFFF | ||
153 | #define XCHAL_INTLEVEL8_ANDBELOW_MASK 0x0001FFFF | ||
154 | #define XCHAL_INTLEVEL9_ANDBELOW_MASK 0x0001FFFF | ||
155 | #define XCHAL_INTLEVEL10_ANDBELOW_MASK 0x0001FFFF | ||
156 | #define XCHAL_INTLEVEL11_ANDBELOW_MASK 0x0001FFFF | ||
157 | #define XCHAL_INTLEVEL12_ANDBELOW_MASK 0x0001FFFF | ||
158 | #define XCHAL_INTLEVEL13_ANDBELOW_MASK 0x0001FFFF | ||
159 | #define XCHAL_INTLEVEL14_ANDBELOW_MASK 0x0001FFFF | ||
160 | #define XCHAL_INTLEVEL15_ANDBELOW_MASK 0x0001FFFF | ||
161 | #define XCHAL_LOWPRI_MASK XCHAL_INTLEVEL1_ANDBELOW_MASK /* mask of all low-priority interrupts */ | ||
162 | #define XCHAL_EXCM_MASK XCHAL_INTLEVEL1_ANDBELOW_MASK /* mask of all interrupts masked by PS.EXCM (or CEXCM) */ | ||
163 | /* As an array of entries (eg. for C constant arrays): */ | ||
164 | #define XCHAL_INTLEVEL_ANDBELOW_MASKS 0x00000000 XCHAL_SEP \ | ||
165 | 0x000064F9 XCHAL_SEP \ | ||
166 | 0x0000EDFB XCHAL_SEP \ | ||
167 | 0x0001FFFF XCHAL_SEP \ | ||
168 | 0x0001FFFF XCHAL_SEP \ | ||
169 | 0x0001FFFF XCHAL_SEP \ | ||
170 | 0x0001FFFF XCHAL_SEP \ | ||
171 | 0x0001FFFF XCHAL_SEP \ | ||
172 | 0x0001FFFF XCHAL_SEP \ | ||
173 | 0x0001FFFF XCHAL_SEP \ | ||
174 | 0x0001FFFF XCHAL_SEP \ | ||
175 | 0x0001FFFF XCHAL_SEP \ | ||
176 | 0x0001FFFF XCHAL_SEP \ | ||
177 | 0x0001FFFF XCHAL_SEP \ | ||
178 | 0x0001FFFF XCHAL_SEP \ | ||
179 | 0x0001FFFF | ||
180 | |||
181 | /* Interrupt numbers for each interrupt level at which only one interrupt was configured: */ | ||
182 | /*#define XCHAL_INTLEVEL1_NUM ...more than one interrupt at this level...*/ | ||
183 | /*#define XCHAL_INTLEVEL2_NUM ...more than one interrupt at this level...*/ | ||
184 | /*#define XCHAL_INTLEVEL3_NUM ...more than one interrupt at this level...*/ | ||
185 | |||
186 | /* Level of each interrupt: */ | ||
187 | #define XCHAL_INT0_LEVEL 1 | ||
188 | #define XCHAL_INT1_LEVEL 2 | ||
189 | #define XCHAL_INT2_LEVEL 3 | ||
190 | #define XCHAL_INT3_LEVEL 1 | ||
191 | #define XCHAL_INT4_LEVEL 1 | ||
192 | #define XCHAL_INT5_LEVEL 1 | ||
193 | #define XCHAL_INT6_LEVEL 1 | ||
194 | #define XCHAL_INT7_LEVEL 1 | ||
195 | #define XCHAL_INT8_LEVEL 2 | ||
196 | #define XCHAL_INT9_LEVEL 3 | ||
197 | #define XCHAL_INT10_LEVEL 1 | ||
198 | #define XCHAL_INT11_LEVEL 2 | ||
199 | #define XCHAL_INT12_LEVEL 3 | ||
200 | #define XCHAL_INT13_LEVEL 1 | ||
201 | #define XCHAL_INT14_LEVEL 1 | ||
202 | #define XCHAL_INT15_LEVEL 2 | ||
203 | #define XCHAL_INT16_LEVEL 3 | ||
204 | #define XCHAL_INT17_LEVEL 0 | ||
205 | #define XCHAL_INT18_LEVEL 0 | ||
206 | #define XCHAL_INT19_LEVEL 0 | ||
207 | #define XCHAL_INT20_LEVEL 0 | ||
208 | #define XCHAL_INT21_LEVEL 0 | ||
209 | #define XCHAL_INT22_LEVEL 0 | ||
210 | #define XCHAL_INT23_LEVEL 0 | ||
211 | #define XCHAL_INT24_LEVEL 0 | ||
212 | #define XCHAL_INT25_LEVEL 0 | ||
213 | #define XCHAL_INT26_LEVEL 0 | ||
214 | #define XCHAL_INT27_LEVEL 0 | ||
215 | #define XCHAL_INT28_LEVEL 0 | ||
216 | #define XCHAL_INT29_LEVEL 0 | ||
217 | #define XCHAL_INT30_LEVEL 0 | ||
218 | #define XCHAL_INT31_LEVEL 0 | ||
219 | /* As an array of entries (eg. for C constant arrays): */ | ||
220 | #define XCHAL_INT_LEVELS 1 XCHAL_SEP \ | ||
221 | 2 XCHAL_SEP \ | ||
222 | 3 XCHAL_SEP \ | ||
223 | 1 XCHAL_SEP \ | ||
224 | 1 XCHAL_SEP \ | ||
225 | 1 XCHAL_SEP \ | ||
226 | 1 XCHAL_SEP \ | ||
227 | 1 XCHAL_SEP \ | ||
228 | 2 XCHAL_SEP \ | ||
229 | 3 XCHAL_SEP \ | ||
230 | 1 XCHAL_SEP \ | ||
231 | 2 XCHAL_SEP \ | ||
232 | 3 XCHAL_SEP \ | ||
233 | 1 XCHAL_SEP \ | ||
234 | 1 XCHAL_SEP \ | ||
235 | 2 XCHAL_SEP \ | ||
236 | 3 XCHAL_SEP \ | ||
237 | 0 XCHAL_SEP \ | ||
238 | 0 XCHAL_SEP \ | ||
239 | 0 XCHAL_SEP \ | ||
240 | 0 XCHAL_SEP \ | ||
241 | 0 XCHAL_SEP \ | ||
242 | 0 XCHAL_SEP \ | ||
243 | 0 XCHAL_SEP \ | ||
244 | 0 XCHAL_SEP \ | ||
245 | 0 XCHAL_SEP \ | ||
246 | 0 XCHAL_SEP \ | ||
247 | 0 XCHAL_SEP \ | ||
248 | 0 XCHAL_SEP \ | ||
249 | 0 XCHAL_SEP \ | ||
250 | 0 XCHAL_SEP \ | ||
251 | 0 | ||
252 | |||
253 | /* Type of each interrupt: */ | ||
254 | #define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
255 | #define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
256 | #define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
257 | #define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
258 | #define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
259 | #define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
260 | #define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL | ||
261 | #define XCHAL_INT7_TYPE XTHAL_INTTYPE_EXTERN_EDGE | ||
262 | #define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_EDGE | ||
263 | #define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_EDGE | ||
264 | #define XCHAL_INT10_TYPE XTHAL_INTTYPE_TIMER | ||
265 | #define XCHAL_INT11_TYPE XTHAL_INTTYPE_TIMER | ||
266 | #define XCHAL_INT12_TYPE XTHAL_INTTYPE_TIMER | ||
267 | #define XCHAL_INT13_TYPE XTHAL_INTTYPE_SOFTWARE | ||
268 | #define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE | ||
269 | #define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE | ||
270 | #define XCHAL_INT16_TYPE XTHAL_INTTYPE_SOFTWARE | ||
271 | #define XCHAL_INT17_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
272 | #define XCHAL_INT18_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
273 | #define XCHAL_INT19_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
274 | #define XCHAL_INT20_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
275 | #define XCHAL_INT21_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
276 | #define XCHAL_INT22_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
277 | #define XCHAL_INT23_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
278 | #define XCHAL_INT24_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
279 | #define XCHAL_INT25_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
280 | #define XCHAL_INT26_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
281 | #define XCHAL_INT27_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
282 | #define XCHAL_INT28_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
283 | #define XCHAL_INT29_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
284 | #define XCHAL_INT30_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
285 | #define XCHAL_INT31_TYPE XTHAL_INTTYPE_UNCONFIGURED | ||
286 | /* As an array of entries (eg. for C constant arrays): */ | ||
287 | #define XCHAL_INT_TYPES XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
288 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
289 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
290 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
291 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
292 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
293 | XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \ | ||
294 | XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \ | ||
295 | XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \ | ||
296 | XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \ | ||
297 | XTHAL_INTTYPE_TIMER XCHAL_SEP \ | ||
298 | XTHAL_INTTYPE_TIMER XCHAL_SEP \ | ||
299 | XTHAL_INTTYPE_TIMER XCHAL_SEP \ | ||
300 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
301 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
302 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
303 | XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \ | ||
304 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
305 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
306 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
307 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
308 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
309 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
310 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
311 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
312 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
313 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
314 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
315 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
316 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
317 | XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \ | ||
318 | XTHAL_INTTYPE_UNCONFIGURED | ||
319 | |||
320 | /* Masks of interrupts for each type of interrupt: */ | ||
321 | #define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFFE0000 | ||
322 | #define XCHAL_INTTYPE_MASK_SOFTWARE 0x0001E000 | ||
323 | #define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000380 | ||
324 | #define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0000007F | ||
325 | #define XCHAL_INTTYPE_MASK_TIMER 0x00001C00 | ||
326 | #define XCHAL_INTTYPE_MASK_NMI 0x00000000 | ||
327 | /* As an array of entries (eg. for C constant arrays): */ | ||
328 | #define XCHAL_INTTYPE_MASKS 0xFFFE0000 XCHAL_SEP \ | ||
329 | 0x0001E000 XCHAL_SEP \ | ||
330 | 0x00000380 XCHAL_SEP \ | ||
331 | 0x0000007F XCHAL_SEP \ | ||
332 | 0x00001C00 XCHAL_SEP \ | ||
333 | 0x00000000 | ||
334 | |||
335 | /* Interrupts assigned to each timer (CCOMPARE0 to CCOMPARE3), -1 if unassigned */ | ||
336 | #define XCHAL_TIMER0_INTERRUPT 10 | ||
337 | #define XCHAL_TIMER1_INTERRUPT 11 | ||
338 | #define XCHAL_TIMER2_INTERRUPT 12 | ||
339 | #define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED | ||
340 | /* As an array of entries (eg. for C constant arrays): */ | ||
341 | #define XCHAL_TIMER_INTERRUPTS 10 XCHAL_SEP \ | ||
342 | 11 XCHAL_SEP \ | ||
343 | 12 XCHAL_SEP \ | ||
344 | XTHAL_TIMER_UNCONFIGURED | ||
345 | |||
346 | /* Indexing macros: */ | ||
347 | #define _XCHAL_INTLEVEL_MASK(n) XCHAL_INTLEVEL ## n ## _MASK | ||
348 | #define XCHAL_INTLEVEL_MASK(n) _XCHAL_INTLEVEL_MASK(n) /* n = 0 .. 15 */ | ||
349 | #define _XCHAL_INTLEVEL_ANDBELOWMASK(n) XCHAL_INTLEVEL ## n ## _ANDBELOW_MASK | ||
350 | #define XCHAL_INTLEVEL_ANDBELOW_MASK(n) _XCHAL_INTLEVEL_ANDBELOWMASK(n) /* n = 0 .. 15 */ | ||
351 | #define _XCHAL_INT_LEVEL(n) XCHAL_INT ## n ## _LEVEL | ||
352 | #define XCHAL_INT_LEVEL(n) _XCHAL_INT_LEVEL(n) /* n = 0 .. 31 */ | ||
353 | #define _XCHAL_INT_TYPE(n) XCHAL_INT ## n ## _TYPE | ||
354 | #define XCHAL_INT_TYPE(n) _XCHAL_INT_TYPE(n) /* n = 0 .. 31 */ | ||
355 | #define _XCHAL_TIMER_INTERRUPT(n) XCHAL_TIMER ## n ## _INTERRUPT | ||
356 | #define XCHAL_TIMER_INTERRUPT(n) _XCHAL_TIMER_INTERRUPT(n) /* n = 0 .. 3 */ | ||
357 | |||
358 | |||
359 | |||
360 | /* | ||
361 | * External interrupt vectors/levels. | ||
362 | * These macros describe how Xtensa processor interrupt numbers | ||
363 | * (as numbered internally, eg. in INTERRUPT and INTENABLE registers) | ||
364 | * map to external BInterrupt<n> pins, for those interrupts | ||
365 | * configured as external (level-triggered, edge-triggered, or NMI). | ||
366 | * See the Xtensa processor databook for more details. | ||
367 | */ | ||
368 | |||
369 | /* Core interrupt numbers mapped to each EXTERNAL interrupt number: */ | ||
370 | #define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */ | ||
371 | #define XCHAL_EXTINT1_NUM 1 /* (intlevel 2) */ | ||
372 | #define XCHAL_EXTINT2_NUM 2 /* (intlevel 3) */ | ||
373 | #define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */ | ||
374 | #define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */ | ||
375 | #define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */ | ||
376 | #define XCHAL_EXTINT6_NUM 6 /* (intlevel 1) */ | ||
377 | #define XCHAL_EXTINT7_NUM 7 /* (intlevel 1) */ | ||
378 | #define XCHAL_EXTINT8_NUM 8 /* (intlevel 2) */ | ||
379 | #define XCHAL_EXTINT9_NUM 9 /* (intlevel 3) */ | ||
380 | |||
381 | /* Corresponding interrupt masks: */ | ||
382 | #define XCHAL_EXTINT0_MASK 0x00000001 | ||
383 | #define XCHAL_EXTINT1_MASK 0x00000002 | ||
384 | #define XCHAL_EXTINT2_MASK 0x00000004 | ||
385 | #define XCHAL_EXTINT3_MASK 0x00000008 | ||
386 | #define XCHAL_EXTINT4_MASK 0x00000010 | ||
387 | #define XCHAL_EXTINT5_MASK 0x00000020 | ||
388 | #define XCHAL_EXTINT6_MASK 0x00000040 | ||
389 | #define XCHAL_EXTINT7_MASK 0x00000080 | ||
390 | #define XCHAL_EXTINT8_MASK 0x00000100 | ||
391 | #define XCHAL_EXTINT9_MASK 0x00000200 | ||
392 | |||
393 | /* Core config interrupt levels mapped to each external interrupt: */ | ||
394 | #define XCHAL_EXTINT0_LEVEL 1 /* (int number 0) */ | ||
395 | #define XCHAL_EXTINT1_LEVEL 2 /* (int number 1) */ | ||
396 | #define XCHAL_EXTINT2_LEVEL 3 /* (int number 2) */ | ||
397 | #define XCHAL_EXTINT3_LEVEL 1 /* (int number 3) */ | ||
398 | #define XCHAL_EXTINT4_LEVEL 1 /* (int number 4) */ | ||
399 | #define XCHAL_EXTINT5_LEVEL 1 /* (int number 5) */ | ||
400 | #define XCHAL_EXTINT6_LEVEL 1 /* (int number 6) */ | ||
401 | #define XCHAL_EXTINT7_LEVEL 1 /* (int number 7) */ | ||
402 | #define XCHAL_EXTINT8_LEVEL 2 /* (int number 8) */ | ||
403 | #define XCHAL_EXTINT9_LEVEL 3 /* (int number 9) */ | ||
404 | |||
405 | |||
406 | /*---------------------------------------------------------------------- | ||
407 | EXCEPTIONS and VECTORS | ||
408 | ----------------------------------------------------------------------*/ | ||
409 | |||
410 | #define XCHAL_HAVE_EXCEPTIONS 1 /* 1 if exception option configured, 0 otherwise */ | ||
411 | |||
412 | #define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture number: 1 for XEA1 (old), 2 for XEA2 (new) */ | ||
413 | #define XCHAL_HAVE_XEA1 0 /* 1 if XEA1, 0 otherwise */ | ||
414 | #define XCHAL_HAVE_XEA2 1 /* 1 if XEA2, 0 otherwise */ | ||
415 | /* For backward compatibility ONLY -- DO NOT USE (will be removed in future release): */ | ||
416 | #define XCHAL_HAVE_OLD_EXC_ARCH XCHAL_HAVE_XEA1 /* (DEPRECATED) 1 if old exception architecture (XEA1), 0 otherwise (eg. XEA2) */ | ||
417 | #define XCHAL_HAVE_EXCM XCHAL_HAVE_XEA2 /* (DEPRECATED) 1 if PS.EXCM bit exists (currently equals XCHAL_HAVE_TLBS) */ | ||
418 | |||
419 | #define XCHAL_RESET_VECTOR_VADDR 0xFE000020 | ||
420 | #define XCHAL_RESET_VECTOR_PADDR 0xFE000020 | ||
421 | #define XCHAL_USER_VECTOR_VADDR 0xD0000220 | ||
422 | #define XCHAL_PROGRAMEXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR /* for backward compatibility */ | ||
423 | #define XCHAL_USEREXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR /* for backward compatibility */ | ||
424 | #define XCHAL_USER_VECTOR_PADDR 0x00000220 | ||
425 | #define XCHAL_PROGRAMEXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR /* for backward compatibility */ | ||
426 | #define XCHAL_USEREXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR /* for backward compatibility */ | ||
427 | #define XCHAL_KERNEL_VECTOR_VADDR 0xD0000200 | ||
428 | #define XCHAL_STACKEDEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR /* for backward compatibility */ | ||
429 | #define XCHAL_KERNELEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR /* for backward compatibility */ | ||
430 | #define XCHAL_KERNEL_VECTOR_PADDR 0x00000200 | ||
431 | #define XCHAL_STACKEDEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR /* for backward compatibility */ | ||
432 | #define XCHAL_KERNELEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR /* for backward compatibility */ | ||
433 | #define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xD0000290 | ||
434 | #define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x00000290 | ||
435 | #define XCHAL_WINDOW_VECTORS_VADDR 0xD0000000 | ||
436 | #define XCHAL_WINDOW_VECTORS_PADDR 0x00000000 | ||
437 | #define XCHAL_INTLEVEL2_VECTOR_VADDR 0xD0000240 | ||
438 | #define XCHAL_INTLEVEL2_VECTOR_PADDR 0x00000240 | ||
439 | #define XCHAL_INTLEVEL3_VECTOR_VADDR 0xD0000250 | ||
440 | #define XCHAL_INTLEVEL3_VECTOR_PADDR 0x00000250 | ||
441 | #define XCHAL_INTLEVEL4_VECTOR_VADDR 0xFE000520 | ||
442 | #define XCHAL_INTLEVEL4_VECTOR_PADDR 0xFE000520 | ||
443 | #define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL4_VECTOR_VADDR | ||
444 | #define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL4_VECTOR_PADDR | ||
445 | |||
446 | /* Indexing macros: */ | ||
447 | #define _XCHAL_INTLEVEL_VECTOR_VADDR(n) XCHAL_INTLEVEL ## n ## _VECTOR_VADDR | ||
448 | #define XCHAL_INTLEVEL_VECTOR_VADDR(n) _XCHAL_INTLEVEL_VECTOR_VADDR(n) /* n = 0 .. 15 */ | ||
449 | |||
450 | /* | ||
451 | * General Exception Causes | ||
452 | * (values of EXCCAUSE special register set by general exceptions, | ||
453 | * which vector to the user, kernel, or double-exception vectors): | ||
454 | */ | ||
455 | #define XCHAL_EXCCAUSE_ILLEGAL_INSTRUCTION 0 /* Illegal Instruction (IllegalInstruction) */ | ||
456 | #define XCHAL_EXCCAUSE_SYSTEM_CALL 1 /* System Call (SystemCall) */ | ||
457 | #define XCHAL_EXCCAUSE_INSTRUCTION_FETCH_ERROR 2 /* Instruction Fetch Error (InstructionFetchError) */ | ||
458 | #define XCHAL_EXCCAUSE_LOAD_STORE_ERROR 3 /* Load Store Error (LoadStoreError) */ | ||
459 | #define XCHAL_EXCCAUSE_LEVEL1_INTERRUPT 4 /* Level 1 Interrupt (Level1Interrupt) */ | ||
460 | #define XCHAL_EXCCAUSE_ALLOCA 5 /* Stack Extension Assist (Alloca) */ | ||
461 | #define XCHAL_EXCCAUSE_INTEGER_DIVIDE_BY_ZERO 6 /* Integer Divide by Zero (IntegerDivideByZero) */ | ||
462 | #define XCHAL_EXCCAUSE_SPECULATION 7 /* Speculation (Speculation) */ | ||
463 | #define XCHAL_EXCCAUSE_PRIVILEGED 8 /* Privileged Instruction (Privileged) */ | ||
464 | #define XCHAL_EXCCAUSE_UNALIGNED 9 /* Unaligned Load Store (Unaligned) */ | ||
465 | #define XCHAL_EXCCAUSE_ITLB_MISS 16 /* ITlb Miss Exception (ITlbMiss) */ | ||
466 | #define XCHAL_EXCCAUSE_ITLB_MULTIHIT 17 /* ITlb Mutltihit Exception (ITlbMultihit) */ | ||
467 | #define XCHAL_EXCCAUSE_ITLB_PRIVILEGE 18 /* ITlb Privilege Exception (ITlbPrivilege) */ | ||
468 | #define XCHAL_EXCCAUSE_ITLB_SIZE_RESTRICTION 19 /* ITlb Size Restriction Exception (ITlbSizeRestriction) */ | ||
469 | #define XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE 20 /* Fetch Cache Attribute Exception (FetchCacheAttribute) */ | ||
470 | #define XCHAL_EXCCAUSE_DTLB_MISS 24 /* DTlb Miss Exception (DTlbMiss) */ | ||
471 | #define XCHAL_EXCCAUSE_DTLB_MULTIHIT 25 /* DTlb Multihit Exception (DTlbMultihit) */ | ||
472 | #define XCHAL_EXCCAUSE_DTLB_PRIVILEGE 26 /* DTlb Privilege Exception (DTlbPrivilege) */ | ||
473 | #define XCHAL_EXCCAUSE_DTLB_SIZE_RESTRICTION 27 /* DTlb Size Restriction Exception (DTlbSizeRestriction) */ | ||
474 | #define XCHAL_EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28 /* Load Cache Attribute Exception (LoadCacheAttribute) */ | ||
475 | #define XCHAL_EXCCAUSE_STORE_CACHE_ATTRIBUTE 29 /* Store Cache Attribute Exception (StoreCacheAttribute) */ | ||
476 | #define XCHAL_EXCCAUSE_FLOATING_POINT 40 /* Floating Point Exception (FloatingPoint) */ | ||
477 | |||
478 | |||
479 | |||
480 | /*---------------------------------------------------------------------- | ||
481 | TIMERS | ||
482 | ----------------------------------------------------------------------*/ | ||
483 | |||
484 | #define XCHAL_HAVE_CCOUNT 1 /* 1 if have CCOUNT, 0 otherwise */ | ||
485 | /*#define XCHAL_HAVE_TIMERS XCHAL_HAVE_CCOUNT*/ | ||
486 | #define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */ | ||
487 | |||
488 | |||
489 | |||
490 | /*---------------------------------------------------------------------- | ||
491 | DEBUG | ||
492 | ----------------------------------------------------------------------*/ | ||
493 | |||
494 | #define XCHAL_HAVE_DEBUG 1 /* 1 if debug option configured, 0 otherwise */ | ||
495 | #define XCHAL_HAVE_OCD 1 /* 1 if OnChipDebug option configured, 0 otherwise */ | ||
496 | #define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */ | ||
497 | #define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */ | ||
498 | #define XCHAL_DEBUGLEVEL 4 /* debug interrupt level */ | ||
499 | /*DebugExternalInterrupt 0 0|1*/ | ||
500 | /*DebugUseDIRArray 0 0|1*/ | ||
501 | |||
502 | |||
503 | |||
504 | |||
505 | /*---------------------------------------------------------------------- | ||
506 | COPROCESSORS and EXTRA STATE | ||
507 | ----------------------------------------------------------------------*/ | ||
508 | |||
509 | #define XCHAL_HAVE_CP 0 /* 1 if coprocessor option configured (CPENABLE present) */ | ||
510 | #define XCHAL_CP_MAXCFG 0 /* max allowed cp id plus one (per cfg) */ | ||
511 | |||
512 | #include <xtensa/config/tie.h> | ||
513 | |||
514 | |||
515 | |||
516 | |||
517 | /*---------------------------------------------------------------------- | ||
518 | INTERNAL I/D RAM/ROMs and XLMI | ||
519 | ----------------------------------------------------------------------*/ | ||
520 | |||
521 | #define XCHAL_NUM_INSTROM 0 /* number of core instruction ROMs configured */ | ||
522 | #define XCHAL_NUM_INSTRAM 0 /* number of core instruction RAMs configured */ | ||
523 | #define XCHAL_NUM_DATAROM 0 /* number of core data ROMs configured */ | ||
524 | #define XCHAL_NUM_DATARAM 0 /* number of core data RAMs configured */ | ||
525 | #define XCHAL_NUM_XLMI 0 /* number of core XLMI ports configured */ | ||
526 | #define XCHAL_NUM_IROM XCHAL_NUM_INSTROM /* (DEPRECATED) */ | ||
527 | #define XCHAL_NUM_IRAM XCHAL_NUM_INSTRAM /* (DEPRECATED) */ | ||
528 | #define XCHAL_NUM_DROM XCHAL_NUM_DATAROM /* (DEPRECATED) */ | ||
529 | #define XCHAL_NUM_DRAM XCHAL_NUM_DATARAM /* (DEPRECATED) */ | ||
530 | |||
531 | |||
532 | |||
533 | /*---------------------------------------------------------------------- | ||
534 | CACHE | ||
535 | ----------------------------------------------------------------------*/ | ||
536 | |||
537 | /* Size of the cache lines in log2(bytes): */ | ||
538 | #define XCHAL_ICACHE_LINEWIDTH 4 | ||
539 | #define XCHAL_DCACHE_LINEWIDTH 4 | ||
540 | /* Size of the cache lines in bytes: */ | ||
541 | #define XCHAL_ICACHE_LINESIZE 16 | ||
542 | #define XCHAL_DCACHE_LINESIZE 16 | ||
543 | /* Max for both I-cache and D-cache (used for general alignment): */ | ||
544 | #define XCHAL_CACHE_LINEWIDTH_MAX 4 | ||
545 | #define XCHAL_CACHE_LINESIZE_MAX 16 | ||
546 | |||
547 | /* Number of cache sets in log2(lines per way): */ | ||
548 | #define XCHAL_ICACHE_SETWIDTH 8 | ||
549 | #define XCHAL_DCACHE_SETWIDTH 8 | ||
550 | /* Max for both I-cache and D-cache (used for general cache-coherency page alignment): */ | ||
551 | #define XCHAL_CACHE_SETWIDTH_MAX 8 | ||
552 | #define XCHAL_CACHE_SETSIZE_MAX 256 | ||
553 | |||
554 | /* Cache set associativity (number of ways): */ | ||
555 | #define XCHAL_ICACHE_WAYS 2 | ||
556 | #define XCHAL_DCACHE_WAYS 2 | ||
557 | |||
558 | /* Size of the caches in bytes (ways * 2^(linewidth + setwidth)): */ | ||
559 | #define XCHAL_ICACHE_SIZE 8192 | ||
560 | #define XCHAL_DCACHE_SIZE 8192 | ||
561 | |||
562 | /* Cache features: */ | ||
563 | #define XCHAL_DCACHE_IS_WRITEBACK 0 | ||
564 | /* Whether cache locking feature is available: */ | ||
565 | #define XCHAL_ICACHE_LINE_LOCKABLE 0 | ||
566 | #define XCHAL_DCACHE_LINE_LOCKABLE 0 | ||
567 | |||
568 | /* Number of (encoded) cache attribute bits: */ | ||
569 | #define XCHAL_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */ | ||
570 | /* (The number of access mode bits (decoded cache attribute bits) is defined by the architecture; see xtensa/hal.h?) */ | ||
571 | |||
572 | |||
573 | /* Cache Attribute encodings -- lists of access modes for each cache attribute: */ | ||
574 | #define XCHAL_FCA_LIST XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
575 | XTHAL_FAM_BYPASS XCHAL_SEP \ | ||
576 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
577 | XTHAL_FAM_BYPASS XCHAL_SEP \ | ||
578 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
579 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
580 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
581 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
582 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
583 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
584 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
585 | XTHAL_FAM_CACHED XCHAL_SEP \ | ||
586 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
587 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
588 | XTHAL_FAM_EXCEPTION XCHAL_SEP \ | ||
589 | XTHAL_FAM_EXCEPTION | ||
590 | #define XCHAL_LCA_LIST XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
591 | XTHAL_LAM_BYPASSG XCHAL_SEP \ | ||
592 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
593 | XTHAL_LAM_BYPASSG XCHAL_SEP \ | ||
594 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
595 | XTHAL_LAM_CACHED XCHAL_SEP \ | ||
596 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
597 | XTHAL_LAM_CACHED XCHAL_SEP \ | ||
598 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
599 | XTHAL_LAM_NACACHED XCHAL_SEP \ | ||
600 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
601 | XTHAL_LAM_NACACHED XCHAL_SEP \ | ||
602 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
603 | XTHAL_LAM_ISOLATE XCHAL_SEP \ | ||
604 | XTHAL_LAM_EXCEPTION XCHAL_SEP \ | ||
605 | XTHAL_LAM_CACHED | ||
606 | #define XCHAL_SCA_LIST XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
607 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
608 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
609 | XTHAL_SAM_BYPASS XCHAL_SEP \ | ||
610 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
611 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
612 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
613 | XTHAL_SAM_WRITETHRU XCHAL_SEP \ | ||
614 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
615 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
616 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
617 | XTHAL_SAM_WRITETHRU XCHAL_SEP \ | ||
618 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
619 | XTHAL_SAM_ISOLATE XCHAL_SEP \ | ||
620 | XTHAL_SAM_EXCEPTION XCHAL_SEP \ | ||
621 | XTHAL_SAM_WRITETHRU | ||
622 | |||
623 | /* Test: | ||
624 | read/only: 0 + 1 + 2 + 4 + 5 + 6 + 8 + 9 + 10 + 12 + 14 | ||
625 | read/only: 0 + 1 + 2 + 4 + 5 + 6 + 8 + 9 + 10 + 12 + 14 | ||
626 | all: 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 | ||
627 | fault: 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 | ||
628 | r/w/x cached: | ||
629 | r/w/x dcached: | ||
630 | I-bypass: 1 + 3 | ||
631 | |||
632 | load guard bit set: 1 + 3 | ||
633 | load guard bit clr: 0 + 2 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 | ||
634 | hit-cache r/w/x: 7 + 11 | ||
635 | |||
636 | fams: 5 | ||
637 | fams: 0 / 6 / 18 / 1 / 2 | ||
638 | fams: Bypass / Isolate / Cached / Exception / NACached | ||
639 | |||
640 | MMU okay: yes | ||
641 | */ | ||
642 | |||
643 | |||
644 | /*---------------------------------------------------------------------- | ||
645 | MMU | ||
646 | ----------------------------------------------------------------------*/ | ||
647 | |||
648 | /* | ||
649 | * General notes on MMU parameters. | ||
650 | * | ||
651 | * Terminology: | ||
652 | * ASID = address-space ID (acts as an "extension" of virtual addresses) | ||
653 | * VPN = virtual page number | ||
654 | * PPN = physical page number | ||
655 | * CA = encoded cache attribute (access modes) | ||
656 | * TLB = translation look-aside buffer (term is stretched somewhat here) | ||
657 | * I = instruction (fetch accesses) | ||
658 | * D = data (load and store accesses) | ||
659 | * way = each TLB (ITLB and DTLB) consists of a number of "ways" | ||
660 | * that simultaneously match the virtual address of an access; | ||
661 | * a TLB successfully translates a virtual address if exactly | ||
662 | * one way matches the vaddr; if none match, it is a miss; | ||
663 | * if multiple match, one gets a "multihit" exception; | ||
664 | * each way can be independently configured in terms of number of | ||
665 | * entries, page sizes, which fields are writable or constant, etc. | ||
666 | * set = group of contiguous ways with exactly identical parameters | ||
667 | * ARF = auto-refill; hardware services a 1st-level miss by loading a PTE | ||
668 | * from the page table and storing it in one of the auto-refill ways; | ||
669 | * if this PTE load also misses, a miss exception is posted for s/w. | ||
670 | * min-wired = a "min-wired" way can be used to map a single (minimum-sized) | ||
671 | * page arbitrarily under program control; it has a single entry, | ||
672 | * is non-auto-refill (some other way(s) must be auto-refill), | ||
673 | * all its fields (VPN, PPN, ASID, CA) are all writable, and it | ||
674 | * supports the XCHAL_MMU_MIN_PTE_PAGE_SIZE page size (a current | ||
675 | * restriction is that this be the only page size it supports). | ||
676 | * | ||
677 | * TLB way entries are virtually indexed. | ||
678 | * TLB ways that support multiple page sizes: | ||
679 | * - must have all writable VPN and PPN fields; | ||
680 | * - can only use one page size at any given time (eg. setup at startup), | ||
681 | * selected by the respective ITLBCFG or DTLBCFG special register, | ||
682 | * whose bits n*4+3 .. n*4 index the list of page sizes for way n | ||
683 | * (XCHAL_xTLB_SETm_PAGESZ_LOG2_LIST for set m corresponding to way n); | ||
684 | * this list may be sparse for auto-refill ways because auto-refill | ||
685 | * ways have independent lists of supported page sizes sharing a | ||
686 | * common encoding with PTE entries; the encoding is the index into | ||
687 | * this list; unsupported sizes for a given way are zero in the list; | ||
688 | * selecting unsupported sizes results in undefined hardware behaviour; | ||
689 | * - is only possible for ways 0 thru 7 (due to ITLBCFG/DTLBCFG definition). | ||
690 | */ | ||
691 | |||
692 | #define XCHAL_HAVE_CACHEATTR 0 /* 1 if CACHEATTR register present, 0 if TLBs present instead */ | ||
693 | #define XCHAL_HAVE_TLBS 1 /* 1 if TLBs present, 0 if CACHEATTR present instead */ | ||
694 | #define XCHAL_HAVE_MMU XCHAL_HAVE_TLBS /* (DEPRECATED; use XCHAL_HAVE_TLBS instead; will be removed in future release) */ | ||
695 | #define XCHAL_HAVE_SPANNING_WAY 0 /* 1 if single way maps entire virtual address space in I+D */ | ||
696 | #define XCHAL_HAVE_IDENTITY_MAP 0 /* 1 if virtual addr == physical addr always, 0 otherwise */ | ||
697 | #define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* 1 if have MMU that mimics a CACHEATTR config (CaMMU) */ | ||
698 | #define XCHAL_HAVE_XLT_CACHEATTR 0 /* 1 if have MMU that mimics a CACHEATTR config, but with translation (CaXltMMU) */ | ||
699 | |||
700 | #define XCHAL_MMU_ASID_BITS 8 /* number of bits in ASIDs (address space IDs) */ | ||
701 | #define XCHAL_MMU_ASID_INVALID 0 /* ASID value indicating invalid address space */ | ||
702 | #define XCHAL_MMU_ASID_KERNEL 1 /* ASID value indicating kernel (ring 0) address space */ | ||
703 | #define XCHAL_MMU_RINGS 4 /* number of rings supported (1..4) */ | ||
704 | #define XCHAL_MMU_RING_BITS 2 /* number of bits needed to hold ring number */ | ||
705 | #define XCHAL_MMU_SR_BITS 0 /* number of size-restriction bits supported */ | ||
706 | #define XCHAL_MMU_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */ | ||
707 | #define XCHAL_MMU_MAX_PTE_PAGE_SIZE 12 /* max page size in a PTE structure (log2) */ | ||
708 | #define XCHAL_MMU_MIN_PTE_PAGE_SIZE 12 /* min page size in a PTE structure (log2) */ | ||
709 | |||
710 | |||
711 | /*** Instruction TLB: ***/ | ||
712 | |||
713 | #define XCHAL_ITLB_WAY_BITS 3 /* number of bits holding the ways */ | ||
714 | #define XCHAL_ITLB_WAYS 7 /* number of ways (n-way set-associative TLB) */ | ||
715 | #define XCHAL_ITLB_ARF_WAYS 4 /* number of auto-refill ways */ | ||
716 | #define XCHAL_ITLB_SETS 4 /* number of sets (groups of ways with identical settings) */ | ||
717 | |||
718 | /* Way set to which each way belongs: */ | ||
719 | #define XCHAL_ITLB_WAY0_SET 0 | ||
720 | #define XCHAL_ITLB_WAY1_SET 0 | ||
721 | #define XCHAL_ITLB_WAY2_SET 0 | ||
722 | #define XCHAL_ITLB_WAY3_SET 0 | ||
723 | #define XCHAL_ITLB_WAY4_SET 1 | ||
724 | #define XCHAL_ITLB_WAY5_SET 2 | ||
725 | #define XCHAL_ITLB_WAY6_SET 3 | ||
726 | |||
727 | /* Ways sets that are used by hardware auto-refill (ARF): */ | ||
728 | #define XCHAL_ITLB_ARF_SETS 1 /* number of auto-refill sets */ | ||
729 | #define XCHAL_ITLB_ARF_SET0 0 /* index of n'th auto-refill set */ | ||
730 | |||
731 | /* Way sets that are "min-wired" (see terminology comment above): */ | ||
732 | #define XCHAL_ITLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ | ||
733 | |||
734 | |||
735 | /* ITLB way set 0 (group of ways 0 thru 3): */ | ||
736 | #define XCHAL_ITLB_SET0_WAY 0 /* index of first way in this way set */ | ||
737 | #define XCHAL_ITLB_SET0_WAYS 4 /* number of (contiguous) ways in this way set */ | ||
738 | #define XCHAL_ITLB_SET0_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
739 | #define XCHAL_ITLB_SET0_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
740 | #define XCHAL_ITLB_SET0_ARF 1 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
741 | #define XCHAL_ITLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
742 | #define XCHAL_ITLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
743 | #define XCHAL_ITLB_SET0_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */ | ||
744 | #define XCHAL_ITLB_SET0_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */ | ||
745 | #define XCHAL_ITLB_SET0_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
746 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
747 | #define XCHAL_ITLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
748 | #define XCHAL_ITLB_SET0_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
749 | #define XCHAL_ITLB_SET0_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
750 | #define XCHAL_ITLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
751 | #define XCHAL_ITLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
752 | #define XCHAL_ITLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
753 | #define XCHAL_ITLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
754 | #define XCHAL_ITLB_SET0_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
755 | |||
756 | /* ITLB way set 1 (group of ways 4 thru 4): */ | ||
757 | #define XCHAL_ITLB_SET1_WAY 4 /* index of first way in this way set */ | ||
758 | #define XCHAL_ITLB_SET1_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
759 | #define XCHAL_ITLB_SET1_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
760 | #define XCHAL_ITLB_SET1_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
761 | #define XCHAL_ITLB_SET1_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
762 | #define XCHAL_ITLB_SET1_PAGESIZES 4 /* number of supported page sizes in this way */ | ||
763 | #define XCHAL_ITLB_SET1_PAGESZ_BITS 2 /* number of bits to encode the page size */ | ||
764 | #define XCHAL_ITLB_SET1_PAGESZ_LOG2_MIN 20 /* log2(minimum supported page size) */ | ||
765 | #define XCHAL_ITLB_SET1_PAGESZ_LOG2_MAX 26 /* log2(maximum supported page size) */ | ||
766 | #define XCHAL_ITLB_SET1_PAGESZ_LOG2_LIST 20 XCHAL_SEP 22 XCHAL_SEP 24 XCHAL_SEP 26 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
767 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
768 | #define XCHAL_ITLB_SET1_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
769 | #define XCHAL_ITLB_SET1_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
770 | #define XCHAL_ITLB_SET1_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
771 | #define XCHAL_ITLB_SET1_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
772 | #define XCHAL_ITLB_SET1_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
773 | #define XCHAL_ITLB_SET1_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
774 | #define XCHAL_ITLB_SET1_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
775 | #define XCHAL_ITLB_SET1_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
776 | |||
777 | /* ITLB way set 2 (group of ways 5 thru 5): */ | ||
778 | #define XCHAL_ITLB_SET2_WAY 5 /* index of first way in this way set */ | ||
779 | #define XCHAL_ITLB_SET2_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
780 | #define XCHAL_ITLB_SET2_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
781 | #define XCHAL_ITLB_SET2_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
782 | #define XCHAL_ITLB_SET2_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
783 | #define XCHAL_ITLB_SET2_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
784 | #define XCHAL_ITLB_SET2_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
785 | #define XCHAL_ITLB_SET2_PAGESZ_LOG2_MIN 27 /* log2(minimum supported page size) */ | ||
786 | #define XCHAL_ITLB_SET2_PAGESZ_LOG2_MAX 27 /* log2(maximum supported page size) */ | ||
787 | #define XCHAL_ITLB_SET2_PAGESZ_LOG2_LIST 27 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
788 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
789 | #define XCHAL_ITLB_SET2_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
790 | #define XCHAL_ITLB_SET2_VPN_CONSTMASK 0xF0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
791 | #define XCHAL_ITLB_SET2_PPN_CONSTMASK 0xF8000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
792 | #define XCHAL_ITLB_SET2_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
793 | #define XCHAL_ITLB_SET2_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
794 | #define XCHAL_ITLB_SET2_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
795 | #define XCHAL_ITLB_SET2_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
796 | #define XCHAL_ITLB_SET2_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
797 | /* Constant ASID values for each entry of ITLB way set 2 (because ASID_CONSTMASK is non-zero): */ | ||
798 | #define XCHAL_ITLB_SET2_E0_ASID_CONST 0x01 | ||
799 | #define XCHAL_ITLB_SET2_E1_ASID_CONST 0x01 | ||
800 | /* Constant VPN values for each entry of ITLB way set 2 (because VPN_CONSTMASK is non-zero): */ | ||
801 | #define XCHAL_ITLB_SET2_E0_VPN_CONST 0xD0000000 | ||
802 | #define XCHAL_ITLB_SET2_E1_VPN_CONST 0xD8000000 | ||
803 | /* Constant PPN values for each entry of ITLB way set 2 (because PPN_CONSTMASK is non-zero): */ | ||
804 | #define XCHAL_ITLB_SET2_E0_PPN_CONST 0x00000000 | ||
805 | #define XCHAL_ITLB_SET2_E1_PPN_CONST 0x00000000 | ||
806 | /* Constant CA values for each entry of ITLB way set 2 (because CA_CONSTMASK is non-zero): */ | ||
807 | #define XCHAL_ITLB_SET2_E0_CA_CONST 0x07 | ||
808 | #define XCHAL_ITLB_SET2_E1_CA_CONST 0x03 | ||
809 | |||
810 | /* ITLB way set 3 (group of ways 6 thru 6): */ | ||
811 | #define XCHAL_ITLB_SET3_WAY 6 /* index of first way in this way set */ | ||
812 | #define XCHAL_ITLB_SET3_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
813 | #define XCHAL_ITLB_SET3_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
814 | #define XCHAL_ITLB_SET3_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
815 | #define XCHAL_ITLB_SET3_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
816 | #define XCHAL_ITLB_SET3_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
817 | #define XCHAL_ITLB_SET3_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
818 | #define XCHAL_ITLB_SET3_PAGESZ_LOG2_MIN 28 /* log2(minimum supported page size) */ | ||
819 | #define XCHAL_ITLB_SET3_PAGESZ_LOG2_MAX 28 /* log2(maximum supported page size) */ | ||
820 | #define XCHAL_ITLB_SET3_PAGESZ_LOG2_LIST 28 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
821 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
822 | #define XCHAL_ITLB_SET3_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
823 | #define XCHAL_ITLB_SET3_VPN_CONSTMASK 0xE0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
824 | #define XCHAL_ITLB_SET3_PPN_CONSTMASK 0xF0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
825 | #define XCHAL_ITLB_SET3_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
826 | #define XCHAL_ITLB_SET3_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
827 | #define XCHAL_ITLB_SET3_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
828 | #define XCHAL_ITLB_SET3_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
829 | #define XCHAL_ITLB_SET3_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
830 | /* Constant ASID values for each entry of ITLB way set 3 (because ASID_CONSTMASK is non-zero): */ | ||
831 | #define XCHAL_ITLB_SET3_E0_ASID_CONST 0x01 | ||
832 | #define XCHAL_ITLB_SET3_E1_ASID_CONST 0x01 | ||
833 | /* Constant VPN values for each entry of ITLB way set 3 (because VPN_CONSTMASK is non-zero): */ | ||
834 | #define XCHAL_ITLB_SET3_E0_VPN_CONST 0xE0000000 | ||
835 | #define XCHAL_ITLB_SET3_E1_VPN_CONST 0xF0000000 | ||
836 | /* Constant PPN values for each entry of ITLB way set 3 (because PPN_CONSTMASK is non-zero): */ | ||
837 | #define XCHAL_ITLB_SET3_E0_PPN_CONST 0xF0000000 | ||
838 | #define XCHAL_ITLB_SET3_E1_PPN_CONST 0xF0000000 | ||
839 | /* Constant CA values for each entry of ITLB way set 3 (because CA_CONSTMASK is non-zero): */ | ||
840 | #define XCHAL_ITLB_SET3_E0_CA_CONST 0x07 | ||
841 | #define XCHAL_ITLB_SET3_E1_CA_CONST 0x03 | ||
842 | |||
843 | /* Indexing macros: */ | ||
844 | #define _XCHAL_ITLB_SET(n,_what) XCHAL_ITLB_SET ## n ## _what | ||
845 | #define XCHAL_ITLB_SET(n,what) _XCHAL_ITLB_SET(n, _ ## what ) | ||
846 | #define _XCHAL_ITLB_SET_E(n,i,_what) XCHAL_ITLB_SET ## n ## _E ## i ## _what | ||
847 | #define XCHAL_ITLB_SET_E(n,i,what) _XCHAL_ITLB_SET_E(n,i, _ ## what ) | ||
848 | /* | ||
849 | * Example use: XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,ENTRIES) | ||
850 | * to get the value of XCHAL_ITLB_SET<n>_ENTRIES where <n> is the first auto-refill set. | ||
851 | */ | ||
852 | |||
853 | |||
854 | /*** Data TLB: ***/ | ||
855 | |||
856 | #define XCHAL_DTLB_WAY_BITS 4 /* number of bits holding the ways */ | ||
857 | #define XCHAL_DTLB_WAYS 10 /* number of ways (n-way set-associative TLB) */ | ||
858 | #define XCHAL_DTLB_ARF_WAYS 4 /* number of auto-refill ways */ | ||
859 | #define XCHAL_DTLB_SETS 5 /* number of sets (groups of ways with identical settings) */ | ||
860 | |||
861 | /* Way set to which each way belongs: */ | ||
862 | #define XCHAL_DTLB_WAY0_SET 0 | ||
863 | #define XCHAL_DTLB_WAY1_SET 0 | ||
864 | #define XCHAL_DTLB_WAY2_SET 0 | ||
865 | #define XCHAL_DTLB_WAY3_SET 0 | ||
866 | #define XCHAL_DTLB_WAY4_SET 1 | ||
867 | #define XCHAL_DTLB_WAY5_SET 2 | ||
868 | #define XCHAL_DTLB_WAY6_SET 3 | ||
869 | #define XCHAL_DTLB_WAY7_SET 4 | ||
870 | #define XCHAL_DTLB_WAY8_SET 4 | ||
871 | #define XCHAL_DTLB_WAY9_SET 4 | ||
872 | |||
873 | /* Ways sets that are used by hardware auto-refill (ARF): */ | ||
874 | #define XCHAL_DTLB_ARF_SETS 1 /* number of auto-refill sets */ | ||
875 | #define XCHAL_DTLB_ARF_SET0 0 /* index of n'th auto-refill set */ | ||
876 | |||
877 | /* Way sets that are "min-wired" (see terminology comment above): */ | ||
878 | #define XCHAL_DTLB_MINWIRED_SETS 1 /* number of "min-wired" sets */ | ||
879 | #define XCHAL_DTLB_MINWIRED_SET0 4 /* index of n'th "min-wired" set */ | ||
880 | |||
881 | |||
882 | /* DTLB way set 0 (group of ways 0 thru 3): */ | ||
883 | #define XCHAL_DTLB_SET0_WAY 0 /* index of first way in this way set */ | ||
884 | #define XCHAL_DTLB_SET0_WAYS 4 /* number of (contiguous) ways in this way set */ | ||
885 | #define XCHAL_DTLB_SET0_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
886 | #define XCHAL_DTLB_SET0_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
887 | #define XCHAL_DTLB_SET0_ARF 1 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
888 | #define XCHAL_DTLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
889 | #define XCHAL_DTLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
890 | #define XCHAL_DTLB_SET0_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */ | ||
891 | #define XCHAL_DTLB_SET0_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */ | ||
892 | #define XCHAL_DTLB_SET0_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
893 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
894 | #define XCHAL_DTLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
895 | #define XCHAL_DTLB_SET0_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
896 | #define XCHAL_DTLB_SET0_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
897 | #define XCHAL_DTLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
898 | #define XCHAL_DTLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
899 | #define XCHAL_DTLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
900 | #define XCHAL_DTLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
901 | #define XCHAL_DTLB_SET0_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
902 | |||
903 | /* DTLB way set 1 (group of ways 4 thru 4): */ | ||
904 | #define XCHAL_DTLB_SET1_WAY 4 /* index of first way in this way set */ | ||
905 | #define XCHAL_DTLB_SET1_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
906 | #define XCHAL_DTLB_SET1_ENTRIES_LOG2 2 /* log2(number of entries in this way) */ | ||
907 | #define XCHAL_DTLB_SET1_ENTRIES 4 /* number of entries in this way (always a power of 2) */ | ||
908 | #define XCHAL_DTLB_SET1_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
909 | #define XCHAL_DTLB_SET1_PAGESIZES 4 /* number of supported page sizes in this way */ | ||
910 | #define XCHAL_DTLB_SET1_PAGESZ_BITS 2 /* number of bits to encode the page size */ | ||
911 | #define XCHAL_DTLB_SET1_PAGESZ_LOG2_MIN 20 /* log2(minimum supported page size) */ | ||
912 | #define XCHAL_DTLB_SET1_PAGESZ_LOG2_MAX 26 /* log2(maximum supported page size) */ | ||
913 | #define XCHAL_DTLB_SET1_PAGESZ_LOG2_LIST 20 XCHAL_SEP 22 XCHAL_SEP 24 XCHAL_SEP 26 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
914 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
915 | #define XCHAL_DTLB_SET1_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
916 | #define XCHAL_DTLB_SET1_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
917 | #define XCHAL_DTLB_SET1_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
918 | #define XCHAL_DTLB_SET1_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
919 | #define XCHAL_DTLB_SET1_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
920 | #define XCHAL_DTLB_SET1_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
921 | #define XCHAL_DTLB_SET1_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
922 | #define XCHAL_DTLB_SET1_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
923 | |||
924 | /* DTLB way set 2 (group of ways 5 thru 5): */ | ||
925 | #define XCHAL_DTLB_SET2_WAY 5 /* index of first way in this way set */ | ||
926 | #define XCHAL_DTLB_SET2_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
927 | #define XCHAL_DTLB_SET2_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
928 | #define XCHAL_DTLB_SET2_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
929 | #define XCHAL_DTLB_SET2_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
930 | #define XCHAL_DTLB_SET2_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
931 | #define XCHAL_DTLB_SET2_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
932 | #define XCHAL_DTLB_SET2_PAGESZ_LOG2_MIN 27 /* log2(minimum supported page size) */ | ||
933 | #define XCHAL_DTLB_SET2_PAGESZ_LOG2_MAX 27 /* log2(maximum supported page size) */ | ||
934 | #define XCHAL_DTLB_SET2_PAGESZ_LOG2_LIST 27 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
935 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
936 | #define XCHAL_DTLB_SET2_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
937 | #define XCHAL_DTLB_SET2_VPN_CONSTMASK 0xF0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
938 | #define XCHAL_DTLB_SET2_PPN_CONSTMASK 0xF8000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
939 | #define XCHAL_DTLB_SET2_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
940 | #define XCHAL_DTLB_SET2_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
941 | #define XCHAL_DTLB_SET2_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
942 | #define XCHAL_DTLB_SET2_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
943 | #define XCHAL_DTLB_SET2_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
944 | /* Constant ASID values for each entry of DTLB way set 2 (because ASID_CONSTMASK is non-zero): */ | ||
945 | #define XCHAL_DTLB_SET2_E0_ASID_CONST 0x01 | ||
946 | #define XCHAL_DTLB_SET2_E1_ASID_CONST 0x01 | ||
947 | /* Constant VPN values for each entry of DTLB way set 2 (because VPN_CONSTMASK is non-zero): */ | ||
948 | #define XCHAL_DTLB_SET2_E0_VPN_CONST 0xD0000000 | ||
949 | #define XCHAL_DTLB_SET2_E1_VPN_CONST 0xD8000000 | ||
950 | /* Constant PPN values for each entry of DTLB way set 2 (because PPN_CONSTMASK is non-zero): */ | ||
951 | #define XCHAL_DTLB_SET2_E0_PPN_CONST 0x00000000 | ||
952 | #define XCHAL_DTLB_SET2_E1_PPN_CONST 0x00000000 | ||
953 | /* Constant CA values for each entry of DTLB way set 2 (because CA_CONSTMASK is non-zero): */ | ||
954 | #define XCHAL_DTLB_SET2_E0_CA_CONST 0x07 | ||
955 | #define XCHAL_DTLB_SET2_E1_CA_CONST 0x03 | ||
956 | |||
957 | /* DTLB way set 3 (group of ways 6 thru 6): */ | ||
958 | #define XCHAL_DTLB_SET3_WAY 6 /* index of first way in this way set */ | ||
959 | #define XCHAL_DTLB_SET3_WAYS 1 /* number of (contiguous) ways in this way set */ | ||
960 | #define XCHAL_DTLB_SET3_ENTRIES_LOG2 1 /* log2(number of entries in this way) */ | ||
961 | #define XCHAL_DTLB_SET3_ENTRIES 2 /* number of entries in this way (always a power of 2) */ | ||
962 | #define XCHAL_DTLB_SET3_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
963 | #define XCHAL_DTLB_SET3_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
964 | #define XCHAL_DTLB_SET3_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
965 | #define XCHAL_DTLB_SET3_PAGESZ_LOG2_MIN 28 /* log2(minimum supported page size) */ | ||
966 | #define XCHAL_DTLB_SET3_PAGESZ_LOG2_MAX 28 /* log2(maximum supported page size) */ | ||
967 | #define XCHAL_DTLB_SET3_PAGESZ_LOG2_LIST 28 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
968 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
969 | #define XCHAL_DTLB_SET3_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */ | ||
970 | #define XCHAL_DTLB_SET3_VPN_CONSTMASK 0xE0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
971 | #define XCHAL_DTLB_SET3_PPN_CONSTMASK 0xF0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
972 | #define XCHAL_DTLB_SET3_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */ | ||
973 | #define XCHAL_DTLB_SET3_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
974 | #define XCHAL_DTLB_SET3_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
975 | #define XCHAL_DTLB_SET3_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
976 | #define XCHAL_DTLB_SET3_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
977 | /* Constant ASID values for each entry of DTLB way set 3 (because ASID_CONSTMASK is non-zero): */ | ||
978 | #define XCHAL_DTLB_SET3_E0_ASID_CONST 0x01 | ||
979 | #define XCHAL_DTLB_SET3_E1_ASID_CONST 0x01 | ||
980 | /* Constant VPN values for each entry of DTLB way set 3 (because VPN_CONSTMASK is non-zero): */ | ||
981 | #define XCHAL_DTLB_SET3_E0_VPN_CONST 0xE0000000 | ||
982 | #define XCHAL_DTLB_SET3_E1_VPN_CONST 0xF0000000 | ||
983 | /* Constant PPN values for each entry of DTLB way set 3 (because PPN_CONSTMASK is non-zero): */ | ||
984 | #define XCHAL_DTLB_SET3_E0_PPN_CONST 0xF0000000 | ||
985 | #define XCHAL_DTLB_SET3_E1_PPN_CONST 0xF0000000 | ||
986 | /* Constant CA values for each entry of DTLB way set 3 (because CA_CONSTMASK is non-zero): */ | ||
987 | #define XCHAL_DTLB_SET3_E0_CA_CONST 0x07 | ||
988 | #define XCHAL_DTLB_SET3_E1_CA_CONST 0x03 | ||
989 | |||
990 | /* DTLB way set 4 (group of ways 7 thru 9): */ | ||
991 | #define XCHAL_DTLB_SET4_WAY 7 /* index of first way in this way set */ | ||
992 | #define XCHAL_DTLB_SET4_WAYS 3 /* number of (contiguous) ways in this way set */ | ||
993 | #define XCHAL_DTLB_SET4_ENTRIES_LOG2 0 /* log2(number of entries in this way) */ | ||
994 | #define XCHAL_DTLB_SET4_ENTRIES 1 /* number of entries in this way (always a power of 2) */ | ||
995 | #define XCHAL_DTLB_SET4_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ | ||
996 | #define XCHAL_DTLB_SET4_PAGESIZES 1 /* number of supported page sizes in this way */ | ||
997 | #define XCHAL_DTLB_SET4_PAGESZ_BITS 0 /* number of bits to encode the page size */ | ||
998 | #define XCHAL_DTLB_SET4_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */ | ||
999 | #define XCHAL_DTLB_SET4_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */ | ||
1000 | #define XCHAL_DTLB_SET4_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP; | ||
1001 | 2^PAGESZ_BITS entries in list, unsupported entries are zero */ | ||
1002 | #define XCHAL_DTLB_SET4_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ | ||
1003 | #define XCHAL_DTLB_SET4_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */ | ||
1004 | #define XCHAL_DTLB_SET4_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */ | ||
1005 | #define XCHAL_DTLB_SET4_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ | ||
1006 | #define XCHAL_DTLB_SET4_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ | ||
1007 | #define XCHAL_DTLB_SET4_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ | ||
1008 | #define XCHAL_DTLB_SET4_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ | ||
1009 | #define XCHAL_DTLB_SET4_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */ | ||
1010 | |||
1011 | /* Indexing macros: */ | ||
1012 | #define _XCHAL_DTLB_SET(n,_what) XCHAL_DTLB_SET ## n ## _what | ||
1013 | #define XCHAL_DTLB_SET(n,what) _XCHAL_DTLB_SET(n, _ ## what ) | ||
1014 | #define _XCHAL_DTLB_SET_E(n,i,_what) XCHAL_DTLB_SET ## n ## _E ## i ## _what | ||
1015 | #define XCHAL_DTLB_SET_E(n,i,what) _XCHAL_DTLB_SET_E(n,i, _ ## what ) | ||
1016 | /* | ||
1017 | * Example use: XCHAL_DTLB_SET(XCHAL_DTLB_ARF_SET0,ENTRIES) | ||
1018 | * to get the value of XCHAL_DTLB_SET<n>_ENTRIES where <n> is the first auto-refill set. | ||
1019 | */ | ||
1020 | |||
1021 | |||
1022 | /* | ||
1023 | * Determine whether we have a full MMU (with Page Table and Protection) | ||
1024 | * usable for an MMU-based OS: | ||
1025 | */ | ||
1026 | #if XCHAL_HAVE_TLBS && !XCHAL_HAVE_SPANNING_WAY && XCHAL_ITLB_ARF_WAYS > 0 && XCHAL_DTLB_ARF_WAYS > 0 && XCHAL_MMU_RINGS >= 2 | ||
1027 | # define XCHAL_HAVE_PTP_MMU 1 /* have full MMU (with page table [autorefill] and protection) */ | ||
1028 | #else | ||
1029 | # define XCHAL_HAVE_PTP_MMU 0 /* don't have full MMU */ | ||
1030 | #endif | ||
1031 | |||
1032 | /* | ||
1033 | * For full MMUs, report kernel RAM segment and kernel I/O segment static page mappings: | ||
1034 | */ | ||
1035 | #if XCHAL_HAVE_PTP_MMU | ||
1036 | #define XCHAL_KSEG_CACHED_VADDR 0xD0000000 /* virt.addr of kernel RAM cached static map */ | ||
1037 | #define XCHAL_KSEG_CACHED_PADDR 0x00000000 /* phys.addr of kseg_cached */ | ||
1038 | #define XCHAL_KSEG_CACHED_SIZE 0x08000000 /* size in bytes of kseg_cached (assumed power of 2!!!) */ | ||
1039 | #define XCHAL_KSEG_BYPASS_VADDR 0xD8000000 /* virt.addr of kernel RAM bypass (uncached) static map */ | ||
1040 | #define XCHAL_KSEG_BYPASS_PADDR 0x00000000 /* phys.addr of kseg_bypass */ | ||
1041 | #define XCHAL_KSEG_BYPASS_SIZE 0x08000000 /* size in bytes of kseg_bypass (assumed power of 2!!!) */ | ||
1042 | |||
1043 | #define XCHAL_KIO_CACHED_VADDR 0xE0000000 /* virt.addr of kernel I/O cached static map */ | ||
1044 | #define XCHAL_KIO_CACHED_PADDR 0xF0000000 /* phys.addr of kio_cached */ | ||
1045 | #define XCHAL_KIO_CACHED_SIZE 0x10000000 /* size in bytes of kio_cached (assumed power of 2!!!) */ | ||
1046 | #define XCHAL_KIO_BYPASS_VADDR 0xF0000000 /* virt.addr of kernel I/O bypass (uncached) static map */ | ||
1047 | #define XCHAL_KIO_BYPASS_PADDR 0xF0000000 /* phys.addr of kio_bypass */ | ||
1048 | #define XCHAL_KIO_BYPASS_SIZE 0x10000000 /* size in bytes of kio_bypass (assumed power of 2!!!) */ | ||
1049 | |||
1050 | #define XCHAL_SEG_MAPPABLE_VADDR 0x00000000 /* start of largest non-static-mapped virtual addr area */ | ||
1051 | #define XCHAL_SEG_MAPPABLE_SIZE 0xD0000000 /* size in bytes of " */ | ||
1052 | /* define XCHAL_SEG_MAPPABLE2_xxx if more areas present, sorted in order of descending size. */ | ||
1053 | #endif | ||
1054 | |||
1055 | |||
1056 | /*---------------------------------------------------------------------- | ||
1057 | MISC | ||
1058 | ----------------------------------------------------------------------*/ | ||
1059 | |||
1060 | #define XCHAL_NUM_WRITEBUFFER_ENTRIES 4 /* number of write buffer entries */ | ||
1061 | |||
1062 | #define XCHAL_CORE_ID "linux_be" /* configuration's alphanumeric core identifier | ||
1063 | (CoreID) set in the Xtensa Processor Generator */ | ||
1064 | |||
1065 | #define XCHAL_BUILD_UNIQUE_ID 0x00003256 /* software build-unique ID (22-bit) */ | ||
1066 | |||
1067 | /* These definitions describe the hardware targeted by this software: */ | ||
1068 | #define XCHAL_HW_CONFIGID0 0xC103D1FF /* config ID reg 0 value (upper 32 of 64 bits) */ | ||
1069 | #define XCHAL_HW_CONFIGID1 0x00803256 /* config ID reg 1 value (lower 32 of 64 bits) */ | ||
1070 | #define XCHAL_CONFIGID0 XCHAL_HW_CONFIGID0 /* for backward compatibility only -- don't use! */ | ||
1071 | #define XCHAL_CONFIGID1 XCHAL_HW_CONFIGID1 /* for backward compatibility only -- don't use! */ | ||
1072 | #define XCHAL_HW_RELEASE_MAJOR 1050 /* major release of targeted hardware */ | ||
1073 | #define XCHAL_HW_RELEASE_MINOR 1 /* minor release of targeted hardware */ | ||
1074 | #define XCHAL_HW_RELEASE_NAME "T1050.1" /* full release name of targeted hardware */ | ||
1075 | #define XTHAL_HW_REL_T1050 1 | ||
1076 | #define XTHAL_HW_REL_T1050_1 1 | ||
1077 | #define XCHAL_HW_CONFIGID_RELIABLE 1 | ||
1078 | |||
1079 | |||
1080 | /* | ||
1081 | * Miscellaneous special register fields: | ||
1082 | */ | ||
1083 | |||
1084 | |||
1085 | /* DBREAKC (special register number 160): */ | ||
1086 | #define XCHAL_DBREAKC_VALIDMASK 0xC000003F /* bits of DBREAKC that are defined */ | ||
1087 | /* MASK field: */ | ||
1088 | #define XCHAL_DBREAKC_MASK_BITS 6 /* number of bits in MASK field */ | ||
1089 | #define XCHAL_DBREAKC_MASK_NUM 64 /* max number of possible causes (2^bits) */ | ||
1090 | #define XCHAL_DBREAKC_MASK_SHIFT 0 /* position of MASK bits in DBREAKC, starting from lsbit */ | ||
1091 | #define XCHAL_DBREAKC_MASK_MASK 0x0000003F /* mask of bits in MASK field of DBREAKC */ | ||
1092 | /* LOADBREAK field: */ | ||
1093 | #define XCHAL_DBREAKC_LOADBREAK_BITS 1 /* number of bits in LOADBREAK field */ | ||
1094 | #define XCHAL_DBREAKC_LOADBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1095 | #define XCHAL_DBREAKC_LOADBREAK_SHIFT 30 /* position of LOADBREAK bits in DBREAKC, starting from lsbit */ | ||
1096 | #define XCHAL_DBREAKC_LOADBREAK_MASK 0x40000000 /* mask of bits in LOADBREAK field of DBREAKC */ | ||
1097 | /* STOREBREAK field: */ | ||
1098 | #define XCHAL_DBREAKC_STOREBREAK_BITS 1 /* number of bits in STOREBREAK field */ | ||
1099 | #define XCHAL_DBREAKC_STOREBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1100 | #define XCHAL_DBREAKC_STOREBREAK_SHIFT 31 /* position of STOREBREAK bits in DBREAKC, starting from lsbit */ | ||
1101 | #define XCHAL_DBREAKC_STOREBREAK_MASK 0x80000000 /* mask of bits in STOREBREAK field of DBREAKC */ | ||
1102 | |||
1103 | /* PS (special register number 230): */ | ||
1104 | #define XCHAL_PS_VALIDMASK 0x00070FFF /* bits of PS that are defined */ | ||
1105 | /* INTLEVEL field: */ | ||
1106 | #define XCHAL_PS_INTLEVEL_BITS 4 /* number of bits in INTLEVEL field */ | ||
1107 | #define XCHAL_PS_INTLEVEL_NUM 16 /* max number of possible causes (2^bits) */ | ||
1108 | #define XCHAL_PS_INTLEVEL_SHIFT 0 /* position of INTLEVEL bits in PS, starting from lsbit */ | ||
1109 | #define XCHAL_PS_INTLEVEL_MASK 0x0000000F /* mask of bits in INTLEVEL field of PS */ | ||
1110 | /* EXCM field: */ | ||
1111 | #define XCHAL_PS_EXCM_BITS 1 /* number of bits in EXCM field */ | ||
1112 | #define XCHAL_PS_EXCM_NUM 2 /* max number of possible causes (2^bits) */ | ||
1113 | #define XCHAL_PS_EXCM_SHIFT 4 /* position of EXCM bits in PS, starting from lsbit */ | ||
1114 | #define XCHAL_PS_EXCM_MASK 0x00000010 /* mask of bits in EXCM field of PS */ | ||
1115 | /* PROGSTACK field: */ | ||
1116 | #define XCHAL_PS_PROGSTACK_BITS 1 /* number of bits in PROGSTACK field */ | ||
1117 | #define XCHAL_PS_PROGSTACK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1118 | #define XCHAL_PS_PROGSTACK_SHIFT 5 /* position of PROGSTACK bits in PS, starting from lsbit */ | ||
1119 | #define XCHAL_PS_PROGSTACK_MASK 0x00000020 /* mask of bits in PROGSTACK field of PS */ | ||
1120 | /* RING field: */ | ||
1121 | #define XCHAL_PS_RING_BITS 2 /* number of bits in RING field */ | ||
1122 | #define XCHAL_PS_RING_NUM 4 /* max number of possible causes (2^bits) */ | ||
1123 | #define XCHAL_PS_RING_SHIFT 6 /* position of RING bits in PS, starting from lsbit */ | ||
1124 | #define XCHAL_PS_RING_MASK 0x000000C0 /* mask of bits in RING field of PS */ | ||
1125 | /* OWB field: */ | ||
1126 | #define XCHAL_PS_OWB_BITS 4 /* number of bits in OWB field */ | ||
1127 | #define XCHAL_PS_OWB_NUM 16 /* max number of possible causes (2^bits) */ | ||
1128 | #define XCHAL_PS_OWB_SHIFT 8 /* position of OWB bits in PS, starting from lsbit */ | ||
1129 | #define XCHAL_PS_OWB_MASK 0x00000F00 /* mask of bits in OWB field of PS */ | ||
1130 | /* CALLINC field: */ | ||
1131 | #define XCHAL_PS_CALLINC_BITS 2 /* number of bits in CALLINC field */ | ||
1132 | #define XCHAL_PS_CALLINC_NUM 4 /* max number of possible causes (2^bits) */ | ||
1133 | #define XCHAL_PS_CALLINC_SHIFT 16 /* position of CALLINC bits in PS, starting from lsbit */ | ||
1134 | #define XCHAL_PS_CALLINC_MASK 0x00030000 /* mask of bits in CALLINC field of PS */ | ||
1135 | /* WOE field: */ | ||
1136 | #define XCHAL_PS_WOE_BITS 1 /* number of bits in WOE field */ | ||
1137 | #define XCHAL_PS_WOE_NUM 2 /* max number of possible causes (2^bits) */ | ||
1138 | #define XCHAL_PS_WOE_SHIFT 18 /* position of WOE bits in PS, starting from lsbit */ | ||
1139 | #define XCHAL_PS_WOE_MASK 0x00040000 /* mask of bits in WOE field of PS */ | ||
1140 | |||
1141 | /* EXCCAUSE (special register number 232): */ | ||
1142 | #define XCHAL_EXCCAUSE_VALIDMASK 0x0000003F /* bits of EXCCAUSE that are defined */ | ||
1143 | /* EXCCAUSE field: */ | ||
1144 | #define XCHAL_EXCCAUSE_BITS 6 /* number of bits in EXCCAUSE register */ | ||
1145 | #define XCHAL_EXCCAUSE_NUM 64 /* max number of possible causes (2^bits) */ | ||
1146 | #define XCHAL_EXCCAUSE_SHIFT 0 /* position of EXCCAUSE bits in register, starting from lsbit */ | ||
1147 | #define XCHAL_EXCCAUSE_MASK 0x0000003F /* mask of bits in EXCCAUSE register */ | ||
1148 | |||
1149 | /* DEBUGCAUSE (special register number 233): */ | ||
1150 | #define XCHAL_DEBUGCAUSE_VALIDMASK 0x0000003F /* bits of DEBUGCAUSE that are defined */ | ||
1151 | /* ICOUNT field: */ | ||
1152 | #define XCHAL_DEBUGCAUSE_ICOUNT_BITS 1 /* number of bits in ICOUNT field */ | ||
1153 | #define XCHAL_DEBUGCAUSE_ICOUNT_NUM 2 /* max number of possible causes (2^bits) */ | ||
1154 | #define XCHAL_DEBUGCAUSE_ICOUNT_SHIFT 0 /* position of ICOUNT bits in DEBUGCAUSE, starting from lsbit */ | ||
1155 | #define XCHAL_DEBUGCAUSE_ICOUNT_MASK 0x00000001 /* mask of bits in ICOUNT field of DEBUGCAUSE */ | ||
1156 | /* IBREAK field: */ | ||
1157 | #define XCHAL_DEBUGCAUSE_IBREAK_BITS 1 /* number of bits in IBREAK field */ | ||
1158 | #define XCHAL_DEBUGCAUSE_IBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1159 | #define XCHAL_DEBUGCAUSE_IBREAK_SHIFT 1 /* position of IBREAK bits in DEBUGCAUSE, starting from lsbit */ | ||
1160 | #define XCHAL_DEBUGCAUSE_IBREAK_MASK 0x00000002 /* mask of bits in IBREAK field of DEBUGCAUSE */ | ||
1161 | /* DBREAK field: */ | ||
1162 | #define XCHAL_DEBUGCAUSE_DBREAK_BITS 1 /* number of bits in DBREAK field */ | ||
1163 | #define XCHAL_DEBUGCAUSE_DBREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1164 | #define XCHAL_DEBUGCAUSE_DBREAK_SHIFT 2 /* position of DBREAK bits in DEBUGCAUSE, starting from lsbit */ | ||
1165 | #define XCHAL_DEBUGCAUSE_DBREAK_MASK 0x00000004 /* mask of bits in DBREAK field of DEBUGCAUSE */ | ||
1166 | /* BREAK field: */ | ||
1167 | #define XCHAL_DEBUGCAUSE_BREAK_BITS 1 /* number of bits in BREAK field */ | ||
1168 | #define XCHAL_DEBUGCAUSE_BREAK_NUM 2 /* max number of possible causes (2^bits) */ | ||
1169 | #define XCHAL_DEBUGCAUSE_BREAK_SHIFT 3 /* position of BREAK bits in DEBUGCAUSE, starting from lsbit */ | ||
1170 | #define XCHAL_DEBUGCAUSE_BREAK_MASK 0x00000008 /* mask of bits in BREAK field of DEBUGCAUSE */ | ||
1171 | /* BREAKN field: */ | ||
1172 | #define XCHAL_DEBUGCAUSE_BREAKN_BITS 1 /* number of bits in BREAKN field */ | ||
1173 | #define XCHAL_DEBUGCAUSE_BREAKN_NUM 2 /* max number of possible causes (2^bits) */ | ||
1174 | #define XCHAL_DEBUGCAUSE_BREAKN_SHIFT 4 /* position of BREAKN bits in DEBUGCAUSE, starting from lsbit */ | ||
1175 | #define XCHAL_DEBUGCAUSE_BREAKN_MASK 0x00000010 /* mask of bits in BREAKN field of DEBUGCAUSE */ | ||
1176 | /* DEBUGINT field: */ | ||
1177 | #define XCHAL_DEBUGCAUSE_DEBUGINT_BITS 1 /* number of bits in DEBUGINT field */ | ||
1178 | #define XCHAL_DEBUGCAUSE_DEBUGINT_NUM 2 /* max number of possible causes (2^bits) */ | ||
1179 | #define XCHAL_DEBUGCAUSE_DEBUGINT_SHIFT 5 /* position of DEBUGINT bits in DEBUGCAUSE, starting from lsbit */ | ||
1180 | #define XCHAL_DEBUGCAUSE_DEBUGINT_MASK 0x00000020 /* mask of bits in DEBUGINT field of DEBUGCAUSE */ | ||
1181 | |||
1182 | |||
1183 | |||
1184 | /*---------------------------------------------------------------------- | ||
1185 | ISA | ||
1186 | ----------------------------------------------------------------------*/ | ||
1187 | |||
1188 | #define XCHAL_HAVE_DENSITY 1 /* 1 if density option configured, 0 otherwise */ | ||
1189 | #define XCHAL_HAVE_LOOPS 1 /* 1 if zero-overhead loops option configured, 0 otherwise */ | ||
1190 | /* Misc instructions: */ | ||
1191 | #define XCHAL_HAVE_NSA 0 /* 1 if NSA/NSAU instructions option configured, 0 otherwise */ | ||
1192 | #define XCHAL_HAVE_MINMAX 0 /* 1 if MIN/MAX instructions option configured, 0 otherwise */ | ||
1193 | #define XCHAL_HAVE_SEXT 0 /* 1 if sign-extend instruction option configured, 0 otherwise */ | ||
1194 | #define XCHAL_HAVE_CLAMPS 0 /* 1 if CLAMPS instruction option configured, 0 otherwise */ | ||
1195 | #define XCHAL_HAVE_MAC16 0 /* 1 if MAC16 option configured, 0 otherwise */ | ||
1196 | #define XCHAL_HAVE_MUL16 0 /* 1 if 16-bit integer multiply option configured, 0 otherwise */ | ||
1197 | /*#define XCHAL_HAVE_POPC 0*/ /* 1 if CRC instruction option configured, 0 otherwise */ | ||
1198 | /*#define XCHAL_HAVE_CRC 0*/ /* 1 if POPC instruction option configured, 0 otherwise */ | ||
1199 | |||
1200 | #define XCHAL_HAVE_SPECULATION 0 /* 1 if speculation option configured, 0 otherwise */ | ||
1201 | /*#define XCHAL_HAVE_MP_SYNC 0*/ /* 1 if multiprocessor sync. option configured, 0 otherwise */ | ||
1202 | #define XCHAL_HAVE_PRID 0 /* 1 if processor ID register configured, 0 otherwise */ | ||
1203 | |||
1204 | #define XCHAL_NUM_MISC_REGS 2 /* number of miscellaneous registers (0..4) */ | ||
1205 | |||
1206 | /* These relate a bit more to TIE: */ | ||
1207 | #define XCHAL_HAVE_BOOLEANS 0 /* 1 if booleans option configured, 0 otherwise */ | ||
1208 | #define XCHAL_HAVE_MUL32 0 /* 1 if 32-bit integer multiply option configured, 0 otherwise */ | ||
1209 | #define XCHAL_HAVE_MUL32_HIGH 0 /* 1 if MUL32 option includes MULUH and MULSH, 0 otherwise */ | ||
1210 | #define XCHAL_HAVE_FP 0 /* 1 if floating point option configured, 0 otherwise */ | ||
1211 | |||
1212 | |||
1213 | /*---------------------------------------------------------------------- | ||
1214 | DERIVED | ||
1215 | ----------------------------------------------------------------------*/ | ||
1216 | |||
1217 | #if XCHAL_HAVE_BE | ||
1218 | #define XCHAL_INST_ILLN 0xD60F /* 2-byte illegal instruction, msb-first */ | ||
1219 | #define XCHAL_INST_ILLN_BYTE0 0xD6 /* 2-byte illegal instruction, 1st byte */ | ||
1220 | #define XCHAL_INST_ILLN_BYTE1 0x0F /* 2-byte illegal instruction, 2nd byte */ | ||
1221 | #else | ||
1222 | #define XCHAL_INST_ILLN 0xF06D /* 2-byte illegal instruction, lsb-first */ | ||
1223 | #define XCHAL_INST_ILLN_BYTE0 0x6D /* 2-byte illegal instruction, 1st byte */ | ||
1224 | #define XCHAL_INST_ILLN_BYTE1 0xF0 /* 2-byte illegal instruction, 2nd byte */ | ||
1225 | #endif | ||
1226 | /* Belongs in xtensa/hal.h: */ | ||
1227 | #define XTHAL_INST_ILL 0x000000 /* 3-byte illegal instruction */ | ||
1228 | |||
1229 | |||
1230 | /* | ||
1231 | * Because information as to exactly which hardware release is targeted | ||
1232 | * by a given software build is not always available, compile-time HAL | ||
1233 | * Hardware-Release "_AT" macros are fuzzy (return 0, 1, or XCHAL_MAYBE): | ||
1234 | */ | ||
1235 | #ifndef XCHAL_HW_RELEASE_MAJOR | ||
1236 | # define XCHAL_HW_CONFIGID_RELIABLE 0 | ||
1237 | #endif | ||
1238 | #if XCHAL_HW_CONFIGID_RELIABLE | ||
1239 | # define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) (XTHAL_REL_LE( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0) | ||
1240 | # define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) (XTHAL_REL_GE( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0) | ||
1241 | # define XCHAL_HW_RELEASE_AT(major,minor) (XTHAL_REL_EQ( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0) | ||
1242 | # define XCHAL_HW_RELEASE_MAJOR_AT(major) ((XCHAL_HW_RELEASE_MAJOR == (major)) ? 1 : 0) | ||
1243 | #else | ||
1244 | # define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) ( ((major) < 1040 && XCHAL_HAVE_XEA2) ? 0 \ | ||
1245 | : ((major) > 1050 && XCHAL_HAVE_XEA1) ? 1 \ | ||
1246 | : XTHAL_MAYBE ) | ||
1247 | # define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) ( ((major) >= 2000 && XCHAL_HAVE_XEA1) ? 0 \ | ||
1248 | : (XTHAL_REL_LE(major,minor, 1040,0) && XCHAL_HAVE_XEA2) ? 1 \ | ||
1249 | : XTHAL_MAYBE ) | ||
1250 | # define XCHAL_HW_RELEASE_AT(major,minor) ( (((major) < 1040 && XCHAL_HAVE_XEA2) || \ | ||
1251 | ((major) >= 2000 && XCHAL_HAVE_XEA1)) ? 0 : XTHAL_MAYBE) | ||
1252 | # define XCHAL_HW_RELEASE_MAJOR_AT(major) XCHAL_HW_RELEASE_AT(major,0) | ||
1253 | #endif | ||
1254 | |||
1255 | /* | ||
1256 | * Specific errata: | ||
1257 | */ | ||
1258 | |||
1259 | /* | ||
1260 | * Erratum T1020.H13, T1030.H7, T1040.H10, T1050.H4 (fixed in T1040.3 and T1050.1; | ||
1261 | * relevant only in XEA1, kernel-vector mode, level-one interrupts and overflows enabled): | ||
1262 | */ | ||
1263 | #define XCHAL_MAYHAVE_ERRATUM_XEA1KWIN (XCHAL_HAVE_XEA1 && \ | ||
1264 | (XCHAL_HW_RELEASE_AT_OR_BELOW(1040,2) != 0 \ | ||
1265 | || XCHAL_HW_RELEASE_AT(1050,0))) | ||
1266 | |||
1267 | |||
1268 | |||
1269 | #endif /*XTENSA_CONFIG_CORE_H*/ | ||
1270 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/defs.h b/include/asm-xtensa/xtensa/config-linux_be/defs.h new file mode 100644 index 000000000000..f7c58b273371 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/defs.h | |||
@@ -0,0 +1,270 @@ | |||
1 | /* Definitions for Xtensa instructions, types, and protos. */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it would be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | * | ||
14 | * Further, this software is distributed without any warranty that it is | ||
15 | * free of the rightful claim of any third person regarding infringement | ||
16 | * or the like. Any license provided herein, whether implied or | ||
17 | * otherwise, applies only to this software file. Patent licenses, if | ||
18 | * any, provided herein do not apply to combinations of this program with | ||
19 | * other software, or any other product whatsoever. | ||
20 | * | ||
21 | * You should have received a copy of the GNU Lesser General Public | ||
22 | * License along with this program; if not, write the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
24 | * USA. | ||
25 | */ | ||
26 | |||
27 | /* Do not modify. This is automatically generated.*/ | ||
28 | |||
29 | #ifndef _XTENSA_BASE_HEADER | ||
30 | #define _XTENSA_BASE_HEADER | ||
31 | |||
32 | #ifdef __XTENSA__ | ||
33 | #if defined(__GNUC__) && !defined(__XCC__) | ||
34 | |||
35 | #define L8UI_ASM(arr, ars, imm) { \ | ||
36 | __asm__ volatile("l8ui %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
37 | } | ||
38 | |||
39 | #define XT_L8UI(ars, imm) \ | ||
40 | ({ \ | ||
41 | unsigned char _arr; \ | ||
42 | const unsigned char *_ars = ars; \ | ||
43 | L8UI_ASM(_arr, _ars, imm); \ | ||
44 | _arr; \ | ||
45 | }) | ||
46 | |||
47 | #define L16UI_ASM(arr, ars, imm) { \ | ||
48 | __asm__ volatile("l16ui %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
49 | } | ||
50 | |||
51 | #define XT_L16UI(ars, imm) \ | ||
52 | ({ \ | ||
53 | unsigned short _arr; \ | ||
54 | const unsigned short *_ars = ars; \ | ||
55 | L16UI_ASM(_arr, _ars, imm); \ | ||
56 | _arr; \ | ||
57 | }) | ||
58 | |||
59 | #define L16SI_ASM(arr, ars, imm) {\ | ||
60 | __asm__ volatile("l16si %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
61 | } | ||
62 | |||
63 | #define XT_L16SI(ars, imm) \ | ||
64 | ({ \ | ||
65 | signed short _arr; \ | ||
66 | const signed short *_ars = ars; \ | ||
67 | L16SI_ASM(_arr, _ars, imm); \ | ||
68 | _arr; \ | ||
69 | }) | ||
70 | |||
71 | #define L32I_ASM(arr, ars, imm) { \ | ||
72 | __asm__ volatile("l32i %0, %1, %2" : "=a" (arr) : "a" (ars) , "i" (imm)); \ | ||
73 | } | ||
74 | |||
75 | #define XT_L32I(ars, imm) \ | ||
76 | ({ \ | ||
77 | unsigned _arr; \ | ||
78 | const unsigned *_ars = ars; \ | ||
79 | L32I_ASM(_arr, _ars, imm); \ | ||
80 | _arr; \ | ||
81 | }) | ||
82 | |||
83 | #define S8I_ASM(arr, ars, imm) {\ | ||
84 | __asm__ volatile("s8i %0, %1, %2" : : "a" (arr), "a" (ars) , "i" (imm) : "memory" ); \ | ||
85 | } | ||
86 | |||
87 | #define XT_S8I(arr, ars, imm) \ | ||
88 | ({ \ | ||
89 | signed char _arr = arr; \ | ||
90 | const signed char *_ars = ars; \ | ||
91 | S8I_ASM(_arr, _ars, imm); \ | ||
92 | }) | ||
93 | |||
94 | #define S16I_ASM(arr, ars, imm) {\ | ||
95 | __asm__ volatile("s16i %0, %1, %2" : : "a" (arr), "a" (ars) , "i" (imm) : "memory" ); \ | ||
96 | } | ||
97 | |||
98 | #define XT_S16I(arr, ars, imm) \ | ||
99 | ({ \ | ||
100 | signed short _arr = arr; \ | ||
101 | const signed short *_ars = ars; \ | ||
102 | S16I_ASM(_arr, _ars, imm); \ | ||
103 | }) | ||
104 | |||
105 | #define S32I_ASM(arr, ars, imm) { \ | ||
106 | __asm__ volatile("s32i %0, %1, %2" : : "a" (arr), "a" (ars) , "i" (imm) : "memory" ); \ | ||
107 | } | ||
108 | |||
109 | #define XT_S32I(arr, ars, imm) \ | ||
110 | ({ \ | ||
111 | signed int _arr = arr; \ | ||
112 | const signed int *_ars = ars; \ | ||
113 | S32I_ASM(_arr, _ars, imm); \ | ||
114 | }) | ||
115 | |||
116 | #define ADDI_ASM(art, ars, imm) {\ | ||
117 | __asm__ ("addi %0, %1, %2" : "=a" (art) : "a" (ars), "i" (imm)); \ | ||
118 | } | ||
119 | |||
120 | #define XT_ADDI(ars, imm) \ | ||
121 | ({ \ | ||
122 | unsigned _art; \ | ||
123 | unsigned _ars = ars; \ | ||
124 | ADDI_ASM(_art, _ars, imm); \ | ||
125 | _art; \ | ||
126 | }) | ||
127 | |||
128 | #define ABS_ASM(arr, art) {\ | ||
129 | __asm__ ("abs %0, %1" : "=a" (arr) : "a" (art)); \ | ||
130 | } | ||
131 | |||
132 | #define XT_ABS(art) \ | ||
133 | ({ \ | ||
134 | unsigned _arr; \ | ||
135 | signed _art = art; \ | ||
136 | ABS_ASM(_arr, _art); \ | ||
137 | _arr; \ | ||
138 | }) | ||
139 | |||
140 | /* Note: In the following macros that reference SAR, the magic "state" | ||
141 | register is used to capture the dependency on SAR. This is because | ||
142 | SAR is a 5-bit register and thus there are no C types that can be | ||
143 | used to represent it. It doesn't appear that the SAR register is | ||
144 | even relevant to GCC, but it is marked as "clobbered" just in | ||
145 | case. */ | ||
146 | |||
147 | #define SRC_ASM(arr, ars, art) {\ | ||
148 | register int _xt_sar __asm__ ("state"); \ | ||
149 | __asm__ ("src %0, %1, %2" \ | ||
150 | : "=a" (arr) : "a" (ars), "a" (art), "t" (_xt_sar)); \ | ||
151 | } | ||
152 | |||
153 | #define XT_SRC(ars, art) \ | ||
154 | ({ \ | ||
155 | unsigned _arr; \ | ||
156 | unsigned _ars = ars; \ | ||
157 | unsigned _art = art; \ | ||
158 | SRC_ASM(_arr, _ars, _art); \ | ||
159 | _arr; \ | ||
160 | }) | ||
161 | |||
162 | #define SSR_ASM(ars) {\ | ||
163 | register int _xt_sar __asm__ ("state"); \ | ||
164 | __asm__ ("ssr %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
165 | } | ||
166 | |||
167 | #define XT_SSR(ars) \ | ||
168 | ({ \ | ||
169 | unsigned _ars = ars; \ | ||
170 | SSR_ASM(_ars); \ | ||
171 | }) | ||
172 | |||
173 | #define SSL_ASM(ars) {\ | ||
174 | register int _xt_sar __asm__ ("state"); \ | ||
175 | __asm__ ("ssl %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
176 | } | ||
177 | |||
178 | #define XT_SSL(ars) \ | ||
179 | ({ \ | ||
180 | unsigned _ars = ars; \ | ||
181 | SSL_ASM(_ars); \ | ||
182 | }) | ||
183 | |||
184 | #define SSA8B_ASM(ars) {\ | ||
185 | register int _xt_sar __asm__ ("state"); \ | ||
186 | __asm__ ("ssa8b %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
187 | } | ||
188 | |||
189 | #define XT_SSA8B(ars) \ | ||
190 | ({ \ | ||
191 | unsigned _ars = ars; \ | ||
192 | SSA8B_ASM(_ars); \ | ||
193 | }) | ||
194 | |||
195 | #define SSA8L_ASM(ars) {\ | ||
196 | register int _xt_sar __asm__ ("state"); \ | ||
197 | __asm__ ("ssa8l %1" : "=t" (_xt_sar) : "a" (ars) : "sar"); \ | ||
198 | } | ||
199 | |||
200 | #define XT_SSA8L(ars) \ | ||
201 | ({ \ | ||
202 | unsigned _ars = ars; \ | ||
203 | SSA8L_ASM(_ars); \ | ||
204 | }) | ||
205 | |||
206 | #define SSAI_ASM(imm) {\ | ||
207 | register int _xt_sar __asm__ ("state"); \ | ||
208 | __asm__ ("ssai %1" : "=t" (_xt_sar) : "i" (imm) : "sar"); \ | ||
209 | } | ||
210 | |||
211 | #define XT_SSAI(imm) \ | ||
212 | ({ \ | ||
213 | SSAI_ASM(imm); \ | ||
214 | }) | ||
215 | |||
216 | |||
217 | |||
218 | |||
219 | |||
220 | |||
221 | |||
222 | |||
223 | #endif /* __GNUC__ && !__XCC__ */ | ||
224 | |||
225 | #ifdef __XCC__ | ||
226 | |||
227 | /* Core load/store instructions */ | ||
228 | extern unsigned char _TIE_L8UI(const unsigned char * ars, immediate imm); | ||
229 | extern unsigned short _TIE_L16UI(const unsigned short * ars, immediate imm); | ||
230 | extern signed short _TIE_L16SI(const signed short * ars, immediate imm); | ||
231 | extern unsigned _TIE_L32I(const unsigned * ars, immediate imm); | ||
232 | extern void _TIE_S8I(unsigned char arr, unsigned char * ars, immediate imm); | ||
233 | extern void _TIE_S16I(unsigned short arr, unsigned short * ars, immediate imm); | ||
234 | extern void _TIE_S32I(unsigned arr, unsigned * ars, immediate imm); | ||
235 | |||
236 | #define XT_L8UI _TIE_L8UI | ||
237 | #define XT_L16UI _TIE_L16UI | ||
238 | #define XT_L16SI _TIE_L16SI | ||
239 | #define XT_L32I _TIE_L32I | ||
240 | #define XT_S8I _TIE_S8I | ||
241 | #define XT_S16I _TIE_S16I | ||
242 | #define XT_S32I _TIE_S32I | ||
243 | |||
244 | /* Add-immediate instruction */ | ||
245 | extern unsigned _TIE_ADDI(unsigned ars, immediate imm); | ||
246 | #define XT_ADDI _TIE_ADDI | ||
247 | |||
248 | /* Absolute value instruction */ | ||
249 | extern unsigned _TIE_ABS(int art); | ||
250 | #define XT_ABS _TIE_ABS | ||
251 | |||
252 | /* funnel shift instructions */ | ||
253 | extern unsigned _TIE_SRC(unsigned ars, unsigned art); | ||
254 | #define XT_SRC _TIE_SRC | ||
255 | extern void _TIE_SSR(unsigned ars); | ||
256 | #define XT_SSR _TIE_SSR | ||
257 | extern void _TIE_SSL(unsigned ars); | ||
258 | #define XT_SSL _TIE_SSL | ||
259 | extern void _TIE_SSA8B(unsigned ars); | ||
260 | #define XT_SSA8B _TIE_SSA8B | ||
261 | extern void _TIE_SSA8L(unsigned ars); | ||
262 | #define XT_SSA8L _TIE_SSA8L | ||
263 | extern void _TIE_SSAI(immediate imm); | ||
264 | #define XT_SSAI _TIE_SSAI | ||
265 | |||
266 | |||
267 | #endif /* __XCC__ */ | ||
268 | |||
269 | #endif /* __XTENSA__ */ | ||
270 | #endif /* !_XTENSA_BASE_HEADER */ | ||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/specreg.h b/include/asm-xtensa/xtensa/config-linux_be/specreg.h new file mode 100644 index 000000000000..fa4106aa9a02 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/specreg.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Xtensa Special Register symbolic names | ||
3 | */ | ||
4 | |||
5 | /* $Id: specreg.h,v 1.2 2003/03/07 19:15:18 joetaylor Exp $ */ | ||
6 | |||
7 | /* | ||
8 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
12 | * License as published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it would be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | * | ||
18 | * Further, this software is distributed without any warranty that it is | ||
19 | * free of the rightful claim of any third person regarding infringement | ||
20 | * or the like. Any license provided herein, whether implied or | ||
21 | * otherwise, applies only to this software file. Patent licenses, if | ||
22 | * any, provided herein do not apply to combinations of this program with | ||
23 | * other software, or any other product whatsoever. | ||
24 | * | ||
25 | * You should have received a copy of the GNU Lesser General Public | ||
26 | * License along with this program; if not, write the Free Software | ||
27 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
28 | * USA. | ||
29 | */ | ||
30 | |||
31 | #ifndef XTENSA_SPECREG_H | ||
32 | #define XTENSA_SPECREG_H | ||
33 | |||
34 | /* Include these special register bitfield definitions, for historical reasons: */ | ||
35 | #include <xtensa/corebits.h> | ||
36 | |||
37 | |||
38 | /* Special registers: */ | ||
39 | #define LBEG 0 | ||
40 | #define LEND 1 | ||
41 | #define LCOUNT 2 | ||
42 | #define SAR 3 | ||
43 | #define WINDOWBASE 72 | ||
44 | #define WINDOWSTART 73 | ||
45 | #define PTEVADDR 83 | ||
46 | #define RASID 90 | ||
47 | #define ITLBCFG 91 | ||
48 | #define DTLBCFG 92 | ||
49 | #define IBREAKENABLE 96 | ||
50 | #define DDR 104 | ||
51 | #define IBREAKA_0 128 | ||
52 | #define IBREAKA_1 129 | ||
53 | #define DBREAKA_0 144 | ||
54 | #define DBREAKA_1 145 | ||
55 | #define DBREAKC_0 160 | ||
56 | #define DBREAKC_1 161 | ||
57 | #define EPC_1 177 | ||
58 | #define EPC_2 178 | ||
59 | #define EPC_3 179 | ||
60 | #define EPC_4 180 | ||
61 | #define DEPC 192 | ||
62 | #define EPS_2 194 | ||
63 | #define EPS_3 195 | ||
64 | #define EPS_4 196 | ||
65 | #define EXCSAVE_1 209 | ||
66 | #define EXCSAVE_2 210 | ||
67 | #define EXCSAVE_3 211 | ||
68 | #define EXCSAVE_4 212 | ||
69 | #define INTERRUPT 226 | ||
70 | #define INTENABLE 228 | ||
71 | #define PS 230 | ||
72 | #define EXCCAUSE 232 | ||
73 | #define DEBUGCAUSE 233 | ||
74 | #define CCOUNT 234 | ||
75 | #define ICOUNT 236 | ||
76 | #define ICOUNTLEVEL 237 | ||
77 | #define EXCVADDR 238 | ||
78 | #define CCOMPARE_0 240 | ||
79 | #define CCOMPARE_1 241 | ||
80 | #define CCOMPARE_2 242 | ||
81 | #define MISC_REG_0 244 | ||
82 | #define MISC_REG_1 245 | ||
83 | |||
84 | /* Special cases (bases of special register series): */ | ||
85 | #define IBREAKA 128 | ||
86 | #define DBREAKA 144 | ||
87 | #define DBREAKC 160 | ||
88 | #define EPC 176 | ||
89 | #define EPS 192 | ||
90 | #define EXCSAVE 208 | ||
91 | #define CCOMPARE 240 | ||
92 | |||
93 | /* Special names for read-only and write-only interrupt registers: */ | ||
94 | #define INTREAD 226 | ||
95 | #define INTSET 226 | ||
96 | #define INTCLEAR 227 | ||
97 | |||
98 | #endif /* XTENSA_SPECREG_H */ | ||
99 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/system.h b/include/asm-xtensa/xtensa/config-linux_be/system.h new file mode 100644 index 000000000000..cf9d4d308e3a --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/system.h | |||
@@ -0,0 +1,198 @@ | |||
1 | /* | ||
2 | * xtensa/config/system.h -- HAL definitions that are dependent on SYSTEM configuration | ||
3 | * | ||
4 | * NOTE: The location and contents of this file are highly subject to change. | ||
5 | * | ||
6 | * Source for configuration-independent binaries (which link in a | ||
7 | * configuration-specific HAL library) must NEVER include this file. | ||
8 | * The HAL itself has historically included this file in some instances, | ||
9 | * but this is not appropriate either, because the HAL is meant to be | ||
10 | * core-specific but system independent. | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
18 | * License as published by the Free Software Foundation. | ||
19 | * | ||
20 | * This program is distributed in the hope that it would be useful, but | ||
21 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
23 | * | ||
24 | * Further, this software is distributed without any warranty that it is | ||
25 | * free of the rightful claim of any third person regarding infringement | ||
26 | * or the like. Any license provided herein, whether implied or | ||
27 | * otherwise, applies only to this software file. Patent licenses, if | ||
28 | * any, provided herein do not apply to combinations of this program with | ||
29 | * other software, or any other product whatsoever. | ||
30 | * | ||
31 | * You should have received a copy of the GNU Lesser General Public | ||
32 | * License along with this program; if not, write the Free Software | ||
33 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
34 | * USA. | ||
35 | */ | ||
36 | |||
37 | |||
38 | #ifndef XTENSA_CONFIG_SYSTEM_H | ||
39 | #define XTENSA_CONFIG_SYSTEM_H | ||
40 | |||
41 | /*#include <xtensa/hal.h>*/ | ||
42 | |||
43 | |||
44 | |||
45 | /*---------------------------------------------------------------------- | ||
46 | DEVICE ADDRESSES | ||
47 | ----------------------------------------------------------------------*/ | ||
48 | |||
49 | /* | ||
50 | * Strange place to find these, but the configuration GUI | ||
51 | * allows moving these around to account for various core | ||
52 | * configurations. Specific boards (and their BSP software) | ||
53 | * will have specific meanings for these components. | ||
54 | */ | ||
55 | |||
56 | /* I/O Block areas: */ | ||
57 | #define XSHAL_IOBLOCK_CACHED_VADDR 0xE0000000 | ||
58 | #define XSHAL_IOBLOCK_CACHED_PADDR 0xF0000000 | ||
59 | #define XSHAL_IOBLOCK_CACHED_SIZE 0x0E000000 | ||
60 | |||
61 | #define XSHAL_IOBLOCK_BYPASS_VADDR 0xF0000000 | ||
62 | #define XSHAL_IOBLOCK_BYPASS_PADDR 0xF0000000 | ||
63 | #define XSHAL_IOBLOCK_BYPASS_SIZE 0x0E000000 | ||
64 | |||
65 | /* System ROM: */ | ||
66 | #define XSHAL_ROM_VADDR 0xEE000000 | ||
67 | #define XSHAL_ROM_PADDR 0xFE000000 | ||
68 | #define XSHAL_ROM_SIZE 0x00400000 | ||
69 | /* Largest available area (free of vectors): */ | ||
70 | #define XSHAL_ROM_AVAIL_VADDR 0xEE00052C | ||
71 | #define XSHAL_ROM_AVAIL_VSIZE 0x003FFAD4 | ||
72 | |||
73 | /* System RAM: */ | ||
74 | #define XSHAL_RAM_VADDR 0xD0000000 | ||
75 | #define XSHAL_RAM_PADDR 0x00000000 | ||
76 | #define XSHAL_RAM_VSIZE 0x08000000 | ||
77 | #define XSHAL_RAM_PSIZE 0x10000000 | ||
78 | #define XSHAL_RAM_SIZE XSHAL_RAM_PSIZE | ||
79 | /* Largest available area (free of vectors): */ | ||
80 | #define XSHAL_RAM_AVAIL_VADDR 0xD0000370 | ||
81 | #define XSHAL_RAM_AVAIL_VSIZE 0x07FFFC90 | ||
82 | |||
83 | /* | ||
84 | * Shadow system RAM (same device as system RAM, at different address). | ||
85 | * (Emulation boards need this for the SONIC Ethernet driver | ||
86 | * when data caches are configured for writeback mode.) | ||
87 | * NOTE: on full MMU configs, this points to the BYPASS virtual address | ||
88 | * of system RAM, ie. is the same as XSHAL_RAM_* except that virtual | ||
89 | * addresses are viewed through the BYPASS static map rather than | ||
90 | * the CACHED static map. | ||
91 | */ | ||
92 | #define XSHAL_RAM_BYPASS_VADDR 0xD8000000 | ||
93 | #define XSHAL_RAM_BYPASS_PADDR 0x00000000 | ||
94 | #define XSHAL_RAM_BYPASS_PSIZE 0x08000000 | ||
95 | |||
96 | /* Alternate system RAM (different device than system RAM): */ | ||
97 | #define XSHAL_ALTRAM_VADDR 0xCEE00000 | ||
98 | #define XSHAL_ALTRAM_PADDR 0xC0000000 | ||
99 | #define XSHAL_ALTRAM_SIZE 0x00200000 | ||
100 | |||
101 | |||
102 | /*---------------------------------------------------------------------- | ||
103 | * DEVICE-ADDRESS DEPENDENT... | ||
104 | * | ||
105 | * Values written to CACHEATTR special register (or its equivalent) | ||
106 | * to enable and disable caches in various modes. | ||
107 | *----------------------------------------------------------------------*/ | ||
108 | |||
109 | /*---------------------------------------------------------------------- | ||
110 | BACKWARD COMPATIBILITY ... | ||
111 | ----------------------------------------------------------------------*/ | ||
112 | |||
113 | /* | ||
114 | * NOTE: the following two macros are DEPRECATED. Use the latter | ||
115 | * board-specific macros instead, which are specially tuned for the | ||
116 | * particular target environments' memory maps. | ||
117 | */ | ||
118 | #define XSHAL_CACHEATTR_BYPASS XSHAL_XT2000_CACHEATTR_BYPASS /* disable caches in bypass mode */ | ||
119 | #define XSHAL_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_DEFAULT /* default setting to enable caches (no writeback!) */ | ||
120 | |||
121 | /*---------------------------------------------------------------------- | ||
122 | ISS (Instruction Set Simulator) SPECIFIC ... | ||
123 | ----------------------------------------------------------------------*/ | ||
124 | |||
125 | #define XSHAL_ISS_CACHEATTR_WRITEBACK 0x1122222F /* enable caches in write-back mode */ | ||
126 | #define XSHAL_ISS_CACHEATTR_WRITEALLOC 0x1122222F /* enable caches in write-allocate mode */ | ||
127 | #define XSHAL_ISS_CACHEATTR_WRITETHRU 0x1122222F /* enable caches in write-through mode */ | ||
128 | #define XSHAL_ISS_CACHEATTR_BYPASS 0x2222222F /* disable caches in bypass mode */ | ||
129 | #define XSHAL_ISS_CACHEATTR_DEFAULT XSHAL_ISS_CACHEATTR_WRITEBACK /* default setting to enable caches */ | ||
130 | |||
131 | /* For Coware only: */ | ||
132 | #define XSHAL_COWARE_CACHEATTR_WRITEBACK 0x11222222 /* enable caches in write-back mode */ | ||
133 | #define XSHAL_COWARE_CACHEATTR_WRITEALLOC 0x11222222 /* enable caches in write-allocate mode */ | ||
134 | #define XSHAL_COWARE_CACHEATTR_WRITETHRU 0x11222222 /* enable caches in write-through mode */ | ||
135 | #define XSHAL_COWARE_CACHEATTR_BYPASS 0x22222222 /* disable caches in bypass mode */ | ||
136 | #define XSHAL_COWARE_CACHEATTR_DEFAULT XSHAL_COWARE_CACHEATTR_WRITEBACK /* default setting to enable caches */ | ||
137 | |||
138 | /* For BFM and other purposes: */ | ||
139 | #define XSHAL_ALLVALID_CACHEATTR_WRITEBACK 0x11222222 /* enable caches without any invalid regions */ | ||
140 | #define XSHAL_ALLVALID_CACHEATTR_DEFAULT XSHAL_ALLVALID_CACHEATTR_WRITEBACK /* default setting for caches without any invalid regions */ | ||
141 | |||
142 | #define XSHAL_ISS_PIPE_REGIONS 0 | ||
143 | #define XSHAL_ISS_SDRAM_REGIONS 0 | ||
144 | |||
145 | |||
146 | /*---------------------------------------------------------------------- | ||
147 | XT2000 BOARD SPECIFIC ... | ||
148 | ----------------------------------------------------------------------*/ | ||
149 | |||
150 | #define XSHAL_XT2000_CACHEATTR_WRITEBACK 0x22FFFFFF /* enable caches in write-back mode */ | ||
151 | #define XSHAL_XT2000_CACHEATTR_WRITEALLOC 0x22FFFFFF /* enable caches in write-allocate mode */ | ||
152 | #define XSHAL_XT2000_CACHEATTR_WRITETHRU 0x22FFFFFF /* enable caches in write-through mode */ | ||
153 | #define XSHAL_XT2000_CACHEATTR_BYPASS 0x22FFFFFF /* disable caches in bypass mode */ | ||
154 | #define XSHAL_XT2000_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_WRITEBACK /* default setting to enable caches */ | ||
155 | |||
156 | #define XSHAL_XT2000_PIPE_REGIONS 0x00001000 /* BusInt pipeline regions */ | ||
157 | #define XSHAL_XT2000_SDRAM_REGIONS 0x00000005 /* BusInt SDRAM regions */ | ||
158 | |||
159 | |||
160 | /*---------------------------------------------------------------------- | ||
161 | VECTOR SIZES | ||
162 | ----------------------------------------------------------------------*/ | ||
163 | |||
164 | /* | ||
165 | * Sizes allocated to vectors by the system (memory map) configuration. | ||
166 | * These sizes are constrained by core configuration (eg. one vector's | ||
167 | * code cannot overflow into another vector) but are dependent on the | ||
168 | * system or board (or LSP) memory map configuration. | ||
169 | * | ||
170 | * Whether or not each vector happens to be in a system ROM is also | ||
171 | * a system configuration matter, sometimes useful, included here also: | ||
172 | */ | ||
173 | #define XSHAL_RESET_VECTOR_SIZE 0x000004E0 | ||
174 | #define XSHAL_RESET_VECTOR_ISROM 1 | ||
175 | #define XSHAL_USER_VECTOR_SIZE 0x0000001C | ||
176 | #define XSHAL_USER_VECTOR_ISROM 0 | ||
177 | #define XSHAL_PROGRAMEXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ | ||
178 | #define XSHAL_USEREXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ | ||
179 | #define XSHAL_KERNEL_VECTOR_SIZE 0x0000001C | ||
180 | #define XSHAL_KERNEL_VECTOR_ISROM 0 | ||
181 | #define XSHAL_STACKEDEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ | ||
182 | #define XSHAL_KERNELEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ | ||
183 | #define XSHAL_DOUBLEEXC_VECTOR_SIZE 0x000000E0 | ||
184 | #define XSHAL_DOUBLEEXC_VECTOR_ISROM 0 | ||
185 | #define XSHAL_WINDOW_VECTORS_SIZE 0x00000180 | ||
186 | #define XSHAL_WINDOW_VECTORS_ISROM 0 | ||
187 | #define XSHAL_INTLEVEL2_VECTOR_SIZE 0x0000000C | ||
188 | #define XSHAL_INTLEVEL2_VECTOR_ISROM 0 | ||
189 | #define XSHAL_INTLEVEL3_VECTOR_SIZE 0x0000000C | ||
190 | #define XSHAL_INTLEVEL3_VECTOR_ISROM 0 | ||
191 | #define XSHAL_INTLEVEL4_VECTOR_SIZE 0x0000000C | ||
192 | #define XSHAL_INTLEVEL4_VECTOR_ISROM 1 | ||
193 | #define XSHAL_DEBUG_VECTOR_SIZE XSHAL_INTLEVEL4_VECTOR_SIZE | ||
194 | #define XSHAL_DEBUG_VECTOR_ISROM XSHAL_INTLEVEL4_VECTOR_ISROM | ||
195 | |||
196 | |||
197 | #endif /*XTENSA_CONFIG_SYSTEM_H*/ | ||
198 | |||
diff --git a/include/asm-xtensa/xtensa/config-linux_be/tie.h b/include/asm-xtensa/xtensa/config-linux_be/tie.h new file mode 100644 index 000000000000..3c2e514602f4 --- /dev/null +++ b/include/asm-xtensa/xtensa/config-linux_be/tie.h | |||
@@ -0,0 +1,275 @@ | |||
1 | /* | ||
2 | * xtensa/config/tie.h -- HAL definitions that are dependent on CORE and TIE configuration | ||
3 | * | ||
4 | * This header file is sometimes referred to as the "compile-time HAL" or CHAL. | ||
5 | * It was generated for a specific Xtensa processor configuration, | ||
6 | * and furthermore for a specific set of TIE source files that extend | ||
7 | * basic core functionality. | ||
8 | * | ||
9 | * Source for configuration-independent binaries (which link in a | ||
10 | * configuration-specific HAL library) must NEVER include this file. | ||
11 | * It is perfectly normal, however, for the HAL source itself to include this file. | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved. | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of version 2.1 of the GNU Lesser General Public | ||
19 | * License as published by the Free Software Foundation. | ||
20 | * | ||
21 | * This program is distributed in the hope that it would be useful, but | ||
22 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
24 | * | ||
25 | * Further, this software is distributed without any warranty that it is | ||
26 | * free of the rightful claim of any third person regarding infringement | ||
27 | * or the like. Any license provided herein, whether implied or | ||
28 | * otherwise, applies only to this software file. Patent licenses, if | ||
29 | * any, provided herein do not apply to combinations of this program with | ||
30 | * other software, or any other product whatsoever. | ||
31 | * | ||
32 | * You should have received a copy of the GNU Lesser General Public | ||
33 | * License along with this program; if not, write the Free Software | ||
34 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, | ||
35 | * USA. | ||
36 | */ | ||
37 | |||
38 | |||
39 | #ifndef XTENSA_CONFIG_TIE_H | ||
40 | #define XTENSA_CONFIG_TIE_H | ||
41 | |||
42 | #include <xtensa/hal.h> | ||
43 | |||
44 | |||
45 | /*---------------------------------------------------------------------- | ||
46 | GENERAL | ||
47 | ----------------------------------------------------------------------*/ | ||
48 | |||
49 | /* | ||
50 | * Separators for macros that expand into arrays. | ||
51 | * These can be predefined by files that #include this one, | ||
52 | * when different separators are required. | ||
53 | */ | ||
54 | /* Element separator for macros that expand into 1-dimensional arrays: */ | ||
55 | #ifndef XCHAL_SEP | ||
56 | #define XCHAL_SEP , | ||
57 | #endif | ||
58 | /* Array separator for macros that expand into 2-dimensional arrays: */ | ||
59 | #ifndef XCHAL_SEP2 | ||
60 | #define XCHAL_SEP2 },{ | ||
61 | #endif | ||
62 | |||
63 | |||
64 | |||
65 | |||
66 | |||
67 | |||
68 | /*---------------------------------------------------------------------- | ||
69 | COPROCESSORS and EXTRA STATE | ||
70 | ----------------------------------------------------------------------*/ | ||
71 | |||
72 | #define XCHAL_CP_NUM 0 /* number of coprocessors */ | ||
73 | #define XCHAL_CP_MAX 0 /* max coprocessor id plus one (0 if none) */ | ||
74 | #define XCHAL_CP_MASK 0x00 /* bitmask of coprocessors by id */ | ||
75 | |||
76 | /* Space for coprocessors' state save areas: */ | ||
77 | #define XCHAL_CP0_SA_SIZE 0 | ||
78 | #define XCHAL_CP1_SA_SIZE 0 | ||
79 | #define XCHAL_CP2_SA_SIZE 0 | ||
80 | #define XCHAL_CP3_SA_SIZE 0 | ||
81 | #define XCHAL_CP4_SA_SIZE 0 | ||
82 | #define XCHAL_CP5_SA_SIZE 0 | ||
83 | #define XCHAL_CP6_SA_SIZE 0 | ||
84 | #define XCHAL_CP7_SA_SIZE 0 | ||
85 | /* Minimum required alignments of CP state save areas: */ | ||
86 | #define XCHAL_CP0_SA_ALIGN 1 | ||
87 | #define XCHAL_CP1_SA_ALIGN 1 | ||
88 | #define XCHAL_CP2_SA_ALIGN 1 | ||
89 | #define XCHAL_CP3_SA_ALIGN 1 | ||
90 | #define XCHAL_CP4_SA_ALIGN 1 | ||
91 | #define XCHAL_CP5_SA_ALIGN 1 | ||
92 | #define XCHAL_CP6_SA_ALIGN 1 | ||
93 | #define XCHAL_CP7_SA_ALIGN 1 | ||
94 | |||
95 | /* Indexing macros: */ | ||
96 | #define _XCHAL_CP_SA_SIZE(n) XCHAL_CP ## n ## _SA_SIZE | ||
97 | #define XCHAL_CP_SA_SIZE(n) _XCHAL_CP_SA_SIZE(n) /* n = 0 .. 7 */ | ||
98 | #define _XCHAL_CP_SA_ALIGN(n) XCHAL_CP ## n ## _SA_ALIGN | ||
99 | #define XCHAL_CP_SA_ALIGN(n) _XCHAL_CP_SA_ALIGN(n) /* n = 0 .. 7 */ | ||
100 | |||
101 | |||
102 | /* Space for "extra" state (user special registers and non-cp TIE) save area: */ | ||
103 | #define XCHAL_EXTRA_SA_SIZE 0 | ||
104 | #define XCHAL_EXTRA_SA_ALIGN 1 | ||
105 | |||
106 | /* Total save area size (extra + all coprocessors) */ | ||
107 | /* (not useful until xthal_{save,restore}_all_extra() is implemented, */ | ||
108 | /* but included for Tor2 beta; doesn't account for alignment!): */ | ||
109 | #define XCHAL_CPEXTRA_SA_SIZE_TOR2 0 /* Tor2Beta temporary definition -- do not use */ | ||
110 | |||
111 | /* Combined required alignment for all CP and EXTRA state save areas */ | ||
112 | /* (does not include required alignment for any base config registers): */ | ||
113 | #define XCHAL_CPEXTRA_SA_ALIGN 1 | ||
114 | |||
115 | /* ... */ | ||
116 | |||
117 | |||
118 | #ifdef _ASMLANGUAGE | ||
119 | /* | ||
120 | * Assembly-language specific definitions (assembly macros, etc.). | ||
121 | */ | ||
122 | #include <xtensa/config/specreg.h> | ||
123 | |||
124 | /******************** | ||
125 | * Macros to save and restore the non-coprocessor TIE portion of EXTRA state. | ||
126 | */ | ||
127 | |||
128 | /* (none) */ | ||
129 | |||
130 | |||
131 | /******************** | ||
132 | * Macros to create functions that save and restore all EXTRA (non-coprocessor) state | ||
133 | * (does not include zero-overhead loop registers and non-optional registers). | ||
134 | */ | ||
135 | |||
136 | /* | ||
137 | * Macro that expands to the body of a function that | ||
138 | * stores the extra (non-coprocessor) optional/custom state. | ||
139 | * Entry: a2 = ptr to save area in which to save extra state | ||
140 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
141 | */ | ||
142 | .macro xchal_extra_store_funcbody | ||
143 | .endm | ||
144 | |||
145 | |||
146 | /* | ||
147 | * Macro that expands to the body of a function that | ||
148 | * loads the extra (non-coprocessor) optional/custom state. | ||
149 | * Entry: a2 = ptr to save area from which to restore extra state | ||
150 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
151 | */ | ||
152 | .macro xchal_extra_load_funcbody | ||
153 | .endm | ||
154 | |||
155 | |||
156 | /******************** | ||
157 | * Macros to save and restore the state of each TIE coprocessor. | ||
158 | */ | ||
159 | |||
160 | |||
161 | |||
162 | /******************** | ||
163 | * Macros to create functions that save and restore the state of *any* TIE coprocessor. | ||
164 | */ | ||
165 | |||
166 | /* | ||
167 | * Macro that expands to the body of a function | ||
168 | * that stores the selected coprocessor's state (registers etc). | ||
169 | * Entry: a2 = ptr to save area in which to save cp state | ||
170 | * a3 = coprocessor number | ||
171 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
172 | */ | ||
173 | .macro xchal_cpi_store_funcbody | ||
174 | .endm | ||
175 | |||
176 | |||
177 | /* | ||
178 | * Macro that expands to the body of a function | ||
179 | * that loads the selected coprocessor's state (registers etc). | ||
180 | * Entry: a2 = ptr to save area from which to restore cp state | ||
181 | * a3 = coprocessor number | ||
182 | * Exit: any register a2-a15 (?) may have been clobbered. | ||
183 | */ | ||
184 | .macro xchal_cpi_load_funcbody | ||
185 | .endm | ||
186 | |||
187 | #endif /*_ASMLANGUAGE*/ | ||
188 | |||
189 | |||
190 | /* | ||
191 | * Contents of save areas in terms of libdb register numbers. | ||
192 | * NOTE: CONTENTS_LIBDB_{UREG,REGF} macros are not defined in this file; | ||
193 | * it is up to the user of this header file to define these macros | ||
194 | * usefully before each expansion of the CONTENTS_LIBDB macros. | ||
195 | * (Fields rsv[123] are reserved for future additions; they are currently | ||
196 | * set to zero but may be set to some useful values in the future.) | ||
197 | * | ||
198 | * CONTENTS_LIBDB_SREG(libdbnum, offset, size, align, rsv1, name, sregnum, bitmask, rsv2, rsv3) | ||
199 | * CONTENTS_LIBDB_UREG(libdbnum, offset, size, align, rsv1, name, uregnum, bitmask, rsv2, rsv3) | ||
200 | * CONTENTS_LIBDB_REGF(libdbnum, offset, size, align, rsv1, name, index, numentries, contentsize, regname_base, regfile_name, rsv2, rsv3) | ||
201 | */ | ||
202 | |||
203 | #define XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM 0 | ||
204 | #define XCHAL_EXTRA_SA_CONTENTS_LIBDB /* empty */ | ||
205 | |||
206 | #define XCHAL_CP0_SA_CONTENTS_LIBDB_NUM 0 | ||
207 | #define XCHAL_CP0_SA_CONTENTS_LIBDB /* empty */ | ||
208 | |||
209 | #define XCHAL_CP1_SA_CONTENTS_LIBDB_NUM 0 | ||
210 | #define XCHAL_CP1_SA_CONTENTS_LIBDB /* empty */ | ||
211 | |||
212 | #define XCHAL_CP2_SA_CONTENTS_LIBDB_NUM 0 | ||
213 | #define XCHAL_CP2_SA_CONTENTS_LIBDB /* empty */ | ||
214 | |||
215 | #define XCHAL_CP3_SA_CONTENTS_LIBDB_NUM 0 | ||
216 | #define XCHAL_CP3_SA_CONTENTS_LIBDB /* empty */ | ||
217 | |||
218 | #define XCHAL_CP4_SA_CONTENTS_LIBDB_NUM 0 | ||
219 | #define XCHAL_CP4_SA_CONTENTS_LIBDB /* empty */ | ||
220 | |||
221 | #define XCHAL_CP5_SA_CONTENTS_LIBDB_NUM 0 | ||
222 | #define XCHAL_CP5_SA_CONTENTS_LIBDB /* empty */ | ||
223 | |||
224 | #define XCHAL_CP6_SA_CONTENTS_LIBDB_NUM 0 | ||
225 | #define XCHAL_CP6_SA_CONTENTS_LIBDB /* empty */ | ||
226 | |||
227 | #define XCHAL_CP7_SA_CONTENTS_LIBDB_NUM 0 | ||
228 | #define XCHAL_CP7_SA_CONTENTS_LIBDB /* empty */ | ||
229 | |||
230 | |||
231 | |||
232 | |||
233 | |||
234 | |||
235 | /*---------------------------------------------------------------------- | ||
236 | MISC | ||
237 | ----------------------------------------------------------------------*/ | ||
238 | |||
239 | #if 0 /* is there something equivalent for user TIE? */ | ||
240 | #define XCHAL_CORE_ID "linux_be" /* configuration's alphanumeric core identifier | ||
241 | (CoreID) set in the Xtensa Processor Generator */ | ||
242 | |||
243 | #define XCHAL_BUILD_UNIQUE_ID 0x00003256 /* software build-unique ID (22-bit) */ | ||
244 | |||
245 | /* These definitions describe the hardware targeted by this software: */ | ||
246 | #define XCHAL_HW_CONFIGID0 0xC103D1FF /* config ID reg 0 value (upper 32 of 64 bits) */ | ||
247 | #define XCHAL_HW_CONFIGID1 0x00803256 /* config ID reg 1 value (lower 32 of 64 bits) */ | ||
248 | #define XCHAL_CONFIGID0 XCHAL_HW_CONFIGID0 /* for backward compatibility only -- don't use! */ | ||
249 | #define XCHAL_CONFIGID1 XCHAL_HW_CONFIGID1 /* for backward compatibility only -- don't use! */ | ||
250 | #define XCHAL_HW_RELEASE_MAJOR 1050 /* major release of targeted hardware */ | ||
251 | #define XCHAL_HW_RELEASE_MINOR 1 /* minor release of targeted hardware */ | ||
252 | #define XCHAL_HW_RELEASE_NAME "T1050.1" /* full release name of targeted hardware */ | ||
253 | #define XTHAL_HW_REL_T1050 1 | ||
254 | #define XTHAL_HW_REL_T1050_1 1 | ||
255 | #define XCHAL_HW_CONFIGID_RELIABLE 1 | ||
256 | #endif /*0*/ | ||
257 | |||
258 | |||
259 | |||
260 | /*---------------------------------------------------------------------- | ||
261 | ISA | ||
262 | ----------------------------------------------------------------------*/ | ||
263 | |||
264 | #if 0 /* these probably don't belong here, but are related to or implemented using TIE */ | ||
265 | #define XCHAL_HAVE_BOOLEANS 0 /* 1 if booleans option configured, 0 otherwise */ | ||
266 | /* Misc instructions: */ | ||
267 | #define XCHAL_HAVE_MUL32 0 /* 1 if 32-bit integer multiply option configured, 0 otherwise */ | ||
268 | #define XCHAL_HAVE_MUL32_HIGH 0 /* 1 if MUL32 option includes MULUH and MULSH, 0 otherwise */ | ||
269 | |||
270 | #define XCHAL_HAVE_FP 0 /* 1 if floating point option configured, 0 otherwise */ | ||
271 | #endif /*0*/ | ||
272 | |||
273 | |||
274 | #endif /*XTENSA_CONFIG_TIE_H*/ | ||
275 | |||
diff --git a/include/asm-xtensa/xtensa/coreasm.h b/include/asm-xtensa/xtensa/coreasm.h new file mode 100644 index 000000000000..a8cfb54c20a1 --- /dev/null +++ b/include/asm-xtensa/xtensa/coreasm.h | |||
@@ -0,0 +1,526 @@ | |||
1 | #ifndef XTENSA_COREASM_H | ||
2 | #define XTENSA_COREASM_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/coreasm.h -- assembler-specific | ||
8 | * definitions that depend on CORE configuration. | ||
9 | * | ||
10 | * Source for configuration-independent binaries (which link in a | ||
11 | * configuration-specific HAL library) must NEVER include this file. | ||
12 | * It is perfectly normal, however, for the HAL itself to include this | ||
13 | * file. | ||
14 | * | ||
15 | * This file must NOT include xtensa/config/system.h. Any assembler | ||
16 | * header file that depends on system information should likely go in | ||
17 | * a new systemasm.h (or sysasm.h) header file. | ||
18 | * | ||
19 | * NOTE: macro beqi32 is NOT configuration-dependent, and is placed | ||
20 | * here til we will have configuration-independent header file. | ||
21 | * | ||
22 | * This file is subject to the terms and conditions of the GNU General | ||
23 | * Public License. See the file "COPYING" in the main directory of | ||
24 | * this archive for more details. | ||
25 | * | ||
26 | * Copyright (C) 2002 Tensilica Inc. | ||
27 | */ | ||
28 | |||
29 | |||
30 | #include <xtensa/config/core.h> | ||
31 | #include <xtensa/config/specreg.h> | ||
32 | |||
33 | /* | ||
34 | * Assembly-language specific definitions (assembly macros, etc.). | ||
35 | */ | ||
36 | |||
37 | /*---------------------------------------------------------------------- | ||
38 | * find_ms_setbit | ||
39 | * | ||
40 | * This macro finds the most significant bit that is set in <as> | ||
41 | * and return its index + <base> in <ad>, or <base> - 1 if <as> is zero. | ||
42 | * The index counts starting at zero for the lsbit, so the return | ||
43 | * value ranges from <base>-1 (no bit set) to <base>+31 (msbit set). | ||
44 | * | ||
45 | * Parameters: | ||
46 | * <ad> destination address register (any register) | ||
47 | * <as> source address register | ||
48 | * <at> temporary address register (must be different than <as>) | ||
49 | * <base> constant value added to result (usually 0 or 1) | ||
50 | * On entry: | ||
51 | * <ad> = undefined if different than <as> | ||
52 | * <as> = value whose most significant set bit is to be found | ||
53 | * <at> = undefined | ||
54 | * no other registers are used by this macro. | ||
55 | * On exit: | ||
56 | * <ad> = <base> + index of msbit set in original <as>, | ||
57 | * = <base> - 1 if original <as> was zero. | ||
58 | * <as> clobbered (if not <ad>) | ||
59 | * <at> clobbered (if not <ad>) | ||
60 | * Example: | ||
61 | * find_ms_setbit a0, a4, a0, 0 -- return in a0 index of msbit set in a4 | ||
62 | */ | ||
63 | |||
64 | .macro find_ms_setbit ad, as, at, base | ||
65 | #if XCHAL_HAVE_NSA | ||
66 | movi \at, 31+\base | ||
67 | nsau \as, \as // get index of \as, numbered from msbit (32 if absent) | ||
68 | sub \ad, \at, \as // get numbering from lsbit (0..31, -1 if absent) | ||
69 | #else /* XCHAL_HAVE_NSA */ | ||
70 | movi \at, \base // start with result of 0 (point to lsbit of 32) | ||
71 | |||
72 | beqz \as, 2f // special case for zero argument: return -1 | ||
73 | bltui \as, 0x10000, 1f // is it one of the 16 lsbits? (if so, check lower 16 bits) | ||
74 | addi \at, \at, 16 // no, increment result to upper 16 bits (of 32) | ||
75 | //srli \as, \as, 16 // check upper half (shift right 16 bits) | ||
76 | extui \as, \as, 16, 16 // check upper half (shift right 16 bits) | ||
77 | 1: bltui \as, 0x100, 1f // is it one of the 8 lsbits? (if so, check lower 8 bits) | ||
78 | addi \at, \at, 8 // no, increment result to upper 8 bits (of 16) | ||
79 | srli \as, \as, 8 // shift right to check upper 8 bits | ||
80 | 1: bltui \as, 0x10, 1f // is it one of the 4 lsbits? (if so, check lower 4 bits) | ||
81 | addi \at, \at, 4 // no, increment result to upper 4 bits (of 8) | ||
82 | srli \as, \as, 4 // shift right 4 bits to check upper half | ||
83 | 1: bltui \as, 0x4, 1f // is it one of the 2 lsbits? (if so, check lower 2 bits) | ||
84 | addi \at, \at, 2 // no, increment result to upper 2 bits (of 4) | ||
85 | srli \as, \as, 2 // shift right 2 bits to check upper half | ||
86 | 1: bltui \as, 0x2, 1f // is it the lsbit? | ||
87 | addi \at, \at, 2 // no, increment result to upper bit (of 2) | ||
88 | 2: addi \at, \at, -1 // (from just above: add 1; from beqz: return -1) | ||
89 | //srli \as, \as, 1 | ||
90 | 1: // done! \at contains index of msbit set (or -1 if none set) | ||
91 | .if 0x\ad - 0x\at // destination different than \at ? (works because regs are a0-a15) | ||
92 | mov \ad, \at // then move result to \ad | ||
93 | .endif | ||
94 | #endif /* XCHAL_HAVE_NSA */ | ||
95 | .endm // find_ms_setbit | ||
96 | |||
97 | /*---------------------------------------------------------------------- | ||
98 | * find_ls_setbit | ||
99 | * | ||
100 | * This macro finds the least significant bit that is set in <as>, | ||
101 | * and return its index in <ad>. | ||
102 | * Usage is the same as for the find_ms_setbit macro. | ||
103 | * Example: | ||
104 | * find_ls_setbit a0, a4, a0, 0 -- return in a0 index of lsbit set in a4 | ||
105 | */ | ||
106 | |||
107 | .macro find_ls_setbit ad, as, at, base | ||
108 | neg \at, \as // keep only the least-significant bit that is set... | ||
109 | and \as, \at, \as // ... in \as | ||
110 | find_ms_setbit \ad, \as, \at, \base | ||
111 | .endm // find_ls_setbit | ||
112 | |||
113 | /*---------------------------------------------------------------------- | ||
114 | * find_ls_one | ||
115 | * | ||
116 | * Same as find_ls_setbit with base zero. | ||
117 | * Source (as) and destination (ad) registers must be different. | ||
118 | * Provided for backward compatibility. | ||
119 | */ | ||
120 | |||
121 | .macro find_ls_one ad, as | ||
122 | find_ls_setbit \ad, \as, \ad, 0 | ||
123 | .endm // find_ls_one | ||
124 | |||
125 | /*---------------------------------------------------------------------- | ||
126 | * floop, floopnez, floopgtz, floopend | ||
127 | * | ||
128 | * These macros are used for fast inner loops that | ||
129 | * work whether or not the Loops options is configured. | ||
130 | * If the Loops option is configured, they simply use | ||
131 | * the zero-overhead LOOP instructions; otherwise | ||
132 | * they use explicit decrement and branch instructions. | ||
133 | * | ||
134 | * They are used in pairs, with floop, floopnez or floopgtz | ||
135 | * at the beginning of the loop, and floopend at the end. | ||
136 | * | ||
137 | * Each pair of loop macro calls must be given the loop count | ||
138 | * address register and a unique label for that loop. | ||
139 | * | ||
140 | * Example: | ||
141 | * | ||
142 | * movi a3, 16 // loop 16 times | ||
143 | * floop a3, myloop1 | ||
144 | * : | ||
145 | * bnez a7, end1 // exit loop if a7 != 0 | ||
146 | * : | ||
147 | * floopend a3, myloop1 | ||
148 | * end1: | ||
149 | * | ||
150 | * Like the LOOP instructions, these macros cannot be | ||
151 | * nested, must include at least one instruction, | ||
152 | * cannot call functions inside the loop, etc. | ||
153 | * The loop can be exited by jumping to the instruction | ||
154 | * following floopend (or elsewhere outside the loop), | ||
155 | * or continued by jumping to a NOP instruction placed | ||
156 | * immediately before floopend. | ||
157 | * | ||
158 | * Unlike LOOP instructions, the register passed to floop* | ||
159 | * cannot be used inside the loop, because it is used as | ||
160 | * the loop counter if the Loops option is not configured. | ||
161 | * And its value is undefined after exiting the loop. | ||
162 | * And because the loop counter register is active inside | ||
163 | * the loop, you can't easily use this construct to loop | ||
164 | * across a register file using ROTW as you might with LOOP | ||
165 | * instructions, unless you copy the loop register along. | ||
166 | */ | ||
167 | |||
168 | /* Named label version of the macros: */ | ||
169 | |||
170 | .macro floop ar, endlabel | ||
171 | floop_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
172 | .endm | ||
173 | |||
174 | .macro floopnez ar, endlabel | ||
175 | floopnez_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
176 | .endm | ||
177 | |||
178 | .macro floopgtz ar, endlabel | ||
179 | floopgtz_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
180 | .endm | ||
181 | |||
182 | .macro floopend ar, endlabel | ||
183 | floopend_ \ar, .Lfloopstart_\endlabel, .Lfloopend_\endlabel | ||
184 | .endm | ||
185 | |||
186 | /* Numbered local label version of the macros: */ | ||
187 | #if 0 /*UNTESTED*/ | ||
188 | .macro floop89 ar | ||
189 | floop_ \ar, 8, 9f | ||
190 | .endm | ||
191 | |||
192 | .macro floopnez89 ar | ||
193 | floopnez_ \ar, 8, 9f | ||
194 | .endm | ||
195 | |||
196 | .macro floopgtz89 ar | ||
197 | floopgtz_ \ar, 8, 9f | ||
198 | .endm | ||
199 | |||
200 | .macro floopend89 ar | ||
201 | floopend_ \ar, 8b, 9 | ||
202 | .endm | ||
203 | #endif /*0*/ | ||
204 | |||
205 | /* Underlying version of the macros: */ | ||
206 | |||
207 | .macro floop_ ar, startlabel, endlabelref | ||
208 | .ifdef _infloop_ | ||
209 | .if _infloop_ | ||
210 | .err // Error: floop cannot be nested | ||
211 | .endif | ||
212 | .endif | ||
213 | .set _infloop_, 1 | ||
214 | #if XCHAL_HAVE_LOOPS | ||
215 | loop \ar, \endlabelref | ||
216 | #else /* XCHAL_HAVE_LOOPS */ | ||
217 | \startlabel: | ||
218 | addi \ar, \ar, -1 | ||
219 | #endif /* XCHAL_HAVE_LOOPS */ | ||
220 | .endm // floop_ | ||
221 | |||
222 | .macro floopnez_ ar, startlabel, endlabelref | ||
223 | .ifdef _infloop_ | ||
224 | .if _infloop_ | ||
225 | .err // Error: floopnez cannot be nested | ||
226 | .endif | ||
227 | .endif | ||
228 | .set _infloop_, 1 | ||
229 | #if XCHAL_HAVE_LOOPS | ||
230 | loopnez \ar, \endlabelref | ||
231 | #else /* XCHAL_HAVE_LOOPS */ | ||
232 | beqz \ar, \endlabelref | ||
233 | \startlabel: | ||
234 | addi \ar, \ar, -1 | ||
235 | #endif /* XCHAL_HAVE_LOOPS */ | ||
236 | .endm // floopnez_ | ||
237 | |||
238 | .macro floopgtz_ ar, startlabel, endlabelref | ||
239 | .ifdef _infloop_ | ||
240 | .if _infloop_ | ||
241 | .err // Error: floopgtz cannot be nested | ||
242 | .endif | ||
243 | .endif | ||
244 | .set _infloop_, 1 | ||
245 | #if XCHAL_HAVE_LOOPS | ||
246 | loopgtz \ar, \endlabelref | ||
247 | #else /* XCHAL_HAVE_LOOPS */ | ||
248 | bltz \ar, \endlabelref | ||
249 | beqz \ar, \endlabelref | ||
250 | \startlabel: | ||
251 | addi \ar, \ar, -1 | ||
252 | #endif /* XCHAL_HAVE_LOOPS */ | ||
253 | .endm // floopgtz_ | ||
254 | |||
255 | |||
256 | .macro floopend_ ar, startlabelref, endlabel | ||
257 | .ifndef _infloop_ | ||
258 | .err // Error: floopend without matching floopXXX | ||
259 | .endif | ||
260 | .ifeq _infloop_ | ||
261 | .err // Error: floopend without matching floopXXX | ||
262 | .endif | ||
263 | .set _infloop_, 0 | ||
264 | #if ! XCHAL_HAVE_LOOPS | ||
265 | bnez \ar, \startlabelref | ||
266 | #endif /* XCHAL_HAVE_LOOPS */ | ||
267 | \endlabel: | ||
268 | .endm // floopend_ | ||
269 | |||
270 | /*---------------------------------------------------------------------- | ||
271 | * crsil -- conditional RSIL (read/set interrupt level) | ||
272 | * | ||
273 | * Executes the RSIL instruction if it exists, else just reads PS. | ||
274 | * The RSIL instruction does not exist in the new exception architecture | ||
275 | * if the interrupt option is not selected. | ||
276 | */ | ||
277 | |||
278 | .macro crsil ar, newlevel | ||
279 | #if XCHAL_HAVE_OLD_EXC_ARCH || XCHAL_HAVE_INTERRUPTS | ||
280 | rsil \ar, \newlevel | ||
281 | #else | ||
282 | rsr \ar, PS | ||
283 | #endif | ||
284 | .endm // crsil | ||
285 | |||
286 | /*---------------------------------------------------------------------- | ||
287 | * window_spill{4,8,12} | ||
288 | * | ||
289 | * These macros spill callers' register windows to the stack. | ||
290 | * They work for both privileged and non-privileged tasks. | ||
291 | * Must be called from a windowed ABI context, eg. within | ||
292 | * a windowed ABI function (ie. valid stack frame, window | ||
293 | * exceptions enabled, not in exception mode, etc). | ||
294 | * | ||
295 | * This macro requires a single invocation of the window_spill_common | ||
296 | * macro in the same assembly unit and section. | ||
297 | * | ||
298 | * Note that using window_spill{4,8,12} macros is more efficient | ||
299 | * than calling a function implemented using window_spill_function, | ||
300 | * because the latter needs extra code to figure out the size of | ||
301 | * the call to the spilling function. | ||
302 | * | ||
303 | * Example usage: | ||
304 | * | ||
305 | * .text | ||
306 | * .align 4 | ||
307 | * .global some_function | ||
308 | * .type some_function,@function | ||
309 | * some_function: | ||
310 | * entry a1, 16 | ||
311 | * : | ||
312 | * : | ||
313 | * | ||
314 | * window_spill4 // spill windows of some_function's callers; preserves a0..a3 only; | ||
315 | * // to use window_spill{8,12} in this example function we'd have | ||
316 | * // to increase space allocated by the entry instruction, because | ||
317 | * // 16 bytes only allows call4; 32 or 48 bytes (+locals) are needed | ||
318 | * // for call8/window_spill8 or call12/window_spill12 respectively. | ||
319 | * : | ||
320 | * | ||
321 | * retw | ||
322 | * | ||
323 | * window_spill_common // instantiates code used by window_spill4 | ||
324 | * | ||
325 | * | ||
326 | * On entry: | ||
327 | * none (if window_spill4) | ||
328 | * stack frame has enough space allocated for call8 (if window_spill8) | ||
329 | * stack frame has enough space allocated for call12 (if window_spill12) | ||
330 | * On exit: | ||
331 | * a4..a15 clobbered (if window_spill4) | ||
332 | * a8..a15 clobbered (if window_spill8) | ||
333 | * a12..a15 clobbered (if window_spill12) | ||
334 | * no caller windows are in live registers | ||
335 | */ | ||
336 | |||
337 | .macro window_spill4 | ||
338 | #if XCHAL_HAVE_WINDOWED | ||
339 | # if XCHAL_NUM_AREGS == 16 | ||
340 | movi a15, 0 // for 16-register files, no need to call to reach the end | ||
341 | # elif XCHAL_NUM_AREGS == 32 | ||
342 | call4 .L__wdwspill_assist28 // call deep enough to clear out any live callers | ||
343 | # elif XCHAL_NUM_AREGS == 64 | ||
344 | call4 .L__wdwspill_assist60 // call deep enough to clear out any live callers | ||
345 | # endif | ||
346 | #endif | ||
347 | .endm // window_spill4 | ||
348 | |||
349 | .macro window_spill8 | ||
350 | #if XCHAL_HAVE_WINDOWED | ||
351 | # if XCHAL_NUM_AREGS == 16 | ||
352 | movi a15, 0 // for 16-register files, no need to call to reach the end | ||
353 | # elif XCHAL_NUM_AREGS == 32 | ||
354 | call8 .L__wdwspill_assist24 // call deep enough to clear out any live callers | ||
355 | # elif XCHAL_NUM_AREGS == 64 | ||
356 | call8 .L__wdwspill_assist56 // call deep enough to clear out any live callers | ||
357 | # endif | ||
358 | #endif | ||
359 | .endm // window_spill8 | ||
360 | |||
361 | .macro window_spill12 | ||
362 | #if XCHAL_HAVE_WINDOWED | ||
363 | # if XCHAL_NUM_AREGS == 16 | ||
364 | movi a15, 0 // for 16-register files, no need to call to reach the end | ||
365 | # elif XCHAL_NUM_AREGS == 32 | ||
366 | call12 .L__wdwspill_assist20 // call deep enough to clear out any live callers | ||
367 | # elif XCHAL_NUM_AREGS == 64 | ||
368 | call12 .L__wdwspill_assist52 // call deep enough to clear out any live callers | ||
369 | # endif | ||
370 | #endif | ||
371 | .endm // window_spill12 | ||
372 | |||
373 | /*---------------------------------------------------------------------- | ||
374 | * window_spill_function | ||
375 | * | ||
376 | * This macro outputs a function that will spill its caller's callers' | ||
377 | * register windows to the stack. Eg. it could be used to implement | ||
378 | * a version of xthal_window_spill() that works in non-privileged tasks. | ||
379 | * This works for both privileged and non-privileged tasks. | ||
380 | * | ||
381 | * Typical usage: | ||
382 | * | ||
383 | * .text | ||
384 | * .align 4 | ||
385 | * .global my_spill_function | ||
386 | * .type my_spill_function,@function | ||
387 | * my_spill_function: | ||
388 | * window_spill_function | ||
389 | * | ||
390 | * On entry to resulting function: | ||
391 | * none | ||
392 | * On exit from resulting function: | ||
393 | * none (no caller windows are in live registers) | ||
394 | */ | ||
395 | |||
396 | .macro window_spill_function | ||
397 | #if XCHAL_HAVE_WINDOWED | ||
398 | # if XCHAL_NUM_AREGS == 32 | ||
399 | entry sp, 48 | ||
400 | bbci.l a0, 31, 1f // branch if called with call4 | ||
401 | bbsi.l a0, 30, 2f // branch if called with call12 | ||
402 | call8 .L__wdwspill_assist16 // called with call8, only need another 8 | ||
403 | retw | ||
404 | 1: call12 .L__wdwspill_assist16 // called with call4, only need another 12 | ||
405 | retw | ||
406 | 2: call4 .L__wdwspill_assist16 // called with call12, only need another 4 | ||
407 | retw | ||
408 | # elif XCHAL_NUM_AREGS == 64 | ||
409 | entry sp, 48 | ||
410 | bbci.l a0, 31, 1f // branch if called with call4 | ||
411 | bbsi.l a0, 30, 2f // branch if called with call12 | ||
412 | call4 .L__wdwspill_assist52 // called with call8, only need a call4 | ||
413 | retw | ||
414 | 1: call8 .L__wdwspill_assist52 // called with call4, only need a call8 | ||
415 | retw | ||
416 | 2: call12 .L__wdwspill_assist40 // called with call12, can skip a call12 | ||
417 | retw | ||
418 | # elif XCHAL_NUM_AREGS == 16 | ||
419 | entry sp, 16 | ||
420 | bbci.l a0, 31, 1f // branch if called with call4 | ||
421 | bbsi.l a0, 30, 2f // branch if called with call12 | ||
422 | movi a7, 0 // called with call8 | ||
423 | retw | ||
424 | 1: movi a11, 0 // called with call4 | ||
425 | 2: retw // if called with call12, everything already spilled | ||
426 | |||
427 | // movi a15, 0 // trick to spill all but the direct caller | ||
428 | // j 1f | ||
429 | // // The entry instruction is magical in the assembler (gets auto-aligned) | ||
430 | // // so we have to jump to it to avoid falling through the padding. | ||
431 | // // We need entry/retw to know where to return. | ||
432 | //1: entry sp, 16 | ||
433 | // retw | ||
434 | # else | ||
435 | # error "unrecognized address register file size" | ||
436 | # endif | ||
437 | #endif /* XCHAL_HAVE_WINDOWED */ | ||
438 | window_spill_common | ||
439 | .endm // window_spill_function | ||
440 | |||
441 | /*---------------------------------------------------------------------- | ||
442 | * window_spill_common | ||
443 | * | ||
444 | * Common code used by any number of invocations of the window_spill## | ||
445 | * and window_spill_function macros. | ||
446 | * | ||
447 | * Must be instantiated exactly once within a given assembly unit, | ||
448 | * within call/j range of and same section as window_spill## | ||
449 | * macro invocations for that assembly unit. | ||
450 | * (Is automatically instantiated by the window_spill_function macro.) | ||
451 | */ | ||
452 | |||
453 | .macro window_spill_common | ||
454 | #if XCHAL_HAVE_WINDOWED && (XCHAL_NUM_AREGS == 32 || XCHAL_NUM_AREGS == 64) | ||
455 | .ifndef .L__wdwspill_defined | ||
456 | # if XCHAL_NUM_AREGS >= 64 | ||
457 | .L__wdwspill_assist60: | ||
458 | entry sp, 32 | ||
459 | call8 .L__wdwspill_assist52 | ||
460 | retw | ||
461 | .L__wdwspill_assist56: | ||
462 | entry sp, 16 | ||
463 | call4 .L__wdwspill_assist52 | ||
464 | retw | ||
465 | .L__wdwspill_assist52: | ||
466 | entry sp, 48 | ||
467 | call12 .L__wdwspill_assist40 | ||
468 | retw | ||
469 | .L__wdwspill_assist40: | ||
470 | entry sp, 48 | ||
471 | call12 .L__wdwspill_assist28 | ||
472 | retw | ||
473 | # endif | ||
474 | .L__wdwspill_assist28: | ||
475 | entry sp, 48 | ||
476 | call12 .L__wdwspill_assist16 | ||
477 | retw | ||
478 | .L__wdwspill_assist24: | ||
479 | entry sp, 32 | ||
480 | call8 .L__wdwspill_assist16 | ||
481 | retw | ||
482 | .L__wdwspill_assist20: | ||
483 | entry sp, 16 | ||
484 | call4 .L__wdwspill_assist16 | ||
485 | retw | ||
486 | .L__wdwspill_assist16: | ||
487 | entry sp, 16 | ||
488 | movi a15, 0 | ||
489 | retw | ||
490 | .set .L__wdwspill_defined, 1 | ||
491 | .endif | ||
492 | #endif /* XCHAL_HAVE_WINDOWED with 32 or 64 aregs */ | ||
493 | .endm // window_spill_common | ||
494 | |||
495 | /*---------------------------------------------------------------------- | ||
496 | * beqi32 | ||
497 | * | ||
498 | * macro implements version of beqi for arbitrary 32-bit immidiate value | ||
499 | * | ||
500 | * beqi32 ax, ay, imm32, label | ||
501 | * | ||
502 | * Compares value in register ax with imm32 value and jumps to label if | ||
503 | * equal. Clobberes register ay if needed | ||
504 | * | ||
505 | */ | ||
506 | .macro beqi32 ax, ay, imm, label | ||
507 | .ifeq ((\imm-1) & ~7) // 1..8 ? | ||
508 | beqi \ax, \imm, \label | ||
509 | .else | ||
510 | .ifeq (\imm+1) // -1 ? | ||
511 | beqi \ax, \imm, \label | ||
512 | .else | ||
513 | .ifeq (\imm) // 0 ? | ||
514 | beqz \ax, \label | ||
515 | .else | ||
516 | // We could also handle immediates 10,12,16,32,64,128,256 | ||
517 | // but it would be a long macro... | ||
518 | movi \ay, \imm | ||
519 | beq \ax, \ay, \label | ||
520 | .endif | ||
521 | .endif | ||
522 | .endif | ||
523 | .endm // beqi32 | ||
524 | |||
525 | #endif /*XTENSA_COREASM_H*/ | ||
526 | |||
diff --git a/include/asm-xtensa/xtensa/corebits.h b/include/asm-xtensa/xtensa/corebits.h new file mode 100644 index 000000000000..e578ade41632 --- /dev/null +++ b/include/asm-xtensa/xtensa/corebits.h | |||
@@ -0,0 +1,77 @@ | |||
1 | #ifndef XTENSA_COREBITS_H | ||
2 | #define XTENSA_COREBITS_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * xtensa/corebits.h - Xtensa Special Register field positions and masks. | ||
8 | * | ||
9 | * (In previous releases, these were defined in specreg.h, a generated file. | ||
10 | * This file is not generated, i.e. it is processor configuration independent.) | ||
11 | */ | ||
12 | |||
13 | |||
14 | /* EXCCAUSE register fields: */ | ||
15 | #define EXCCAUSE_EXCCAUSE_SHIFT 0 | ||
16 | #define EXCCAUSE_EXCCAUSE_MASK 0x3F | ||
17 | /* Exception causes (mostly incomplete!): */ | ||
18 | #define EXCCAUSE_ILLEGAL 0 | ||
19 | #define EXCCAUSE_SYSCALL 1 | ||
20 | #define EXCCAUSE_IFETCHERROR 2 | ||
21 | #define EXCCAUSE_LOADSTOREERROR 3 | ||
22 | #define EXCCAUSE_LEVEL1INTERRUPT 4 | ||
23 | #define EXCCAUSE_ALLOCA 5 | ||
24 | |||
25 | /* PS register fields: */ | ||
26 | #define PS_WOE_SHIFT 18 | ||
27 | #define PS_WOE_MASK 0x00040000 | ||
28 | #define PS_WOE PS_WOE_MASK | ||
29 | #define PS_CALLINC_SHIFT 16 | ||
30 | #define PS_CALLINC_MASK 0x00030000 | ||
31 | #define PS_CALLINC(n) (((n)&3)<<PS_CALLINC_SHIFT) /* n = 0..3 */ | ||
32 | #define PS_OWB_SHIFT 8 | ||
33 | #define PS_OWB_MASK 0x00000F00 | ||
34 | #define PS_OWB(n) (((n)&15)<<PS_OWB_SHIFT) /* n = 0..15 (or 0..7) */ | ||
35 | #define PS_RING_SHIFT 6 | ||
36 | #define PS_RING_MASK 0x000000C0 | ||
37 | #define PS_RING(n) (((n)&3)<<PS_RING_SHIFT) /* n = 0..3 */ | ||
38 | #define PS_UM_SHIFT 5 | ||
39 | #define PS_UM_MASK 0x00000020 | ||
40 | #define PS_UM PS_UM_MASK | ||
41 | #define PS_EXCM_SHIFT 4 | ||
42 | #define PS_EXCM_MASK 0x00000010 | ||
43 | #define PS_EXCM PS_EXCM_MASK | ||
44 | #define PS_INTLEVEL_SHIFT 0 | ||
45 | #define PS_INTLEVEL_MASK 0x0000000F | ||
46 | #define PS_INTLEVEL(n) ((n)&PS_INTLEVEL_MASK) /* n = 0..15 */ | ||
47 | /* Backward compatibility (deprecated): */ | ||
48 | #define PS_PROGSTACK_SHIFT PS_UM_SHIFT | ||
49 | #define PS_PROGSTACK_MASK PS_UM_MASK | ||
50 | #define PS_PROG_SHIFT PS_UM_SHIFT | ||
51 | #define PS_PROG_MASK PS_UM_MASK | ||
52 | #define PS_PROG PS_UM | ||
53 | |||
54 | /* DBREAKCn register fields: */ | ||
55 | #define DBREAKC_MASK_SHIFT 0 | ||
56 | #define DBREAKC_MASK_MASK 0x0000003F | ||
57 | #define DBREAKC_LOADBREAK_SHIFT 30 | ||
58 | #define DBREAKC_LOADBREAK_MASK 0x40000000 | ||
59 | #define DBREAKC_STOREBREAK_SHIFT 31 | ||
60 | #define DBREAKC_STOREBREAK_MASK 0x80000000 | ||
61 | |||
62 | /* DEBUGCAUSE register fields: */ | ||
63 | #define DEBUGCAUSE_DEBUGINT_SHIFT 5 | ||
64 | #define DEBUGCAUSE_DEBUGINT_MASK 0x20 /* debug interrupt */ | ||
65 | #define DEBUGCAUSE_BREAKN_SHIFT 4 | ||
66 | #define DEBUGCAUSE_BREAKN_MASK 0x10 /* BREAK.N instruction */ | ||
67 | #define DEBUGCAUSE_BREAK_SHIFT 3 | ||
68 | #define DEBUGCAUSE_BREAK_MASK 0x08 /* BREAK instruction */ | ||
69 | #define DEBUGCAUSE_DBREAK_SHIFT 2 | ||
70 | #define DEBUGCAUSE_DBREAK_MASK 0x04 /* DBREAK match */ | ||
71 | #define DEBUGCAUSE_IBREAK_SHIFT 1 | ||
72 | #define DEBUGCAUSE_IBREAK_MASK 0x02 /* IBREAK match */ | ||
73 | #define DEBUGCAUSE_ICOUNT_SHIFT 0 | ||
74 | #define DEBUGCAUSE_ICOUNT_MASK 0x01 /* ICOUNT would increment to zero */ | ||
75 | |||
76 | #endif /*XTENSA_COREBITS_H*/ | ||
77 | |||
diff --git a/include/asm-xtensa/xtensa/hal.h b/include/asm-xtensa/xtensa/hal.h new file mode 100644 index 000000000000..d10472505454 --- /dev/null +++ b/include/asm-xtensa/xtensa/hal.h | |||
@@ -0,0 +1,822 @@ | |||
1 | #ifndef XTENSA_HAL_H | ||
2 | #define XTENSA_HAL_H | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/hal.h -- contains a definition of the | ||
8 | * Core HAL interface. | ||
9 | * | ||
10 | * All definitions in this header file are independent of any specific | ||
11 | * Xtensa processor configuration. Thus an OS or other software can | ||
12 | * include this header file and be compiled into configuration- | ||
13 | * independent objects that can be distributed and eventually linked | ||
14 | * to the HAL library (libhal.a) to create a configuration-specific | ||
15 | * final executable. | ||
16 | * | ||
17 | * Certain definitions, however, are release-specific -- such as the | ||
18 | * XTHAL_RELEASE_xxx macros (or additions made in later releases). | ||
19 | * | ||
20 | * This file is subject to the terms and conditions of the GNU General Public | ||
21 | * License. See the file "COPYING" in the main directory of this archive | ||
22 | * for more details. | ||
23 | * | ||
24 | * Copyright (C) 2002 Tensilica Inc. | ||
25 | */ | ||
26 | |||
27 | |||
28 | /*---------------------------------------------------------------------- | ||
29 | Constant Definitions | ||
30 | (shared with assembly) | ||
31 | ----------------------------------------------------------------------*/ | ||
32 | |||
33 | /* Software release information (not configuration-specific!): */ | ||
34 | #define XTHAL_RELEASE_MAJOR 1050 | ||
35 | #define XTHAL_RELEASE_MINOR 0 | ||
36 | #define XTHAL_RELEASE_NAME "T1050.0-2002-08-06-eng0" | ||
37 | #define XTHAL_RELEASE_INTERNAL "2002-08-06-eng0" | ||
38 | #define XTHAL_REL_T1050 1 | ||
39 | #define XTHAL_REL_T1050_0 1 | ||
40 | #define XTHAL_REL_T1050_0_2002 1 | ||
41 | #define XTHAL_REL_T1050_0_2002_08 1 | ||
42 | #define XTHAL_REL_T1050_0_2002_08_06 1 | ||
43 | #define XTHAL_REL_T1050_0_2002_08_06_ENG0 1 | ||
44 | |||
45 | /* HAL version numbers (these names are for backward compatibility): */ | ||
46 | #define XTHAL_MAJOR_REV XTHAL_RELEASE_MAJOR | ||
47 | #define XTHAL_MINOR_REV XTHAL_RELEASE_MINOR | ||
48 | /* | ||
49 | * A bit of software release history on values of XTHAL_{MAJOR,MINOR}_REV: | ||
50 | * | ||
51 | * Release MAJOR MINOR Comment | ||
52 | * ======= ===== ===== ======= | ||
53 | * T1015.n n/a n/a (HAL not yet available) | ||
54 | * T1020.{0,1,2} 0 1 (HAL beta) | ||
55 | * T1020.{3,4} 0 2 First release. | ||
56 | * T1020.n (n>4) 0 2 or >3 (TBD) | ||
57 | * T1030.0 0 1 (HAL beta) | ||
58 | * T1030.{1,2} 0 3 Equivalent to first release. | ||
59 | * T1030.n (n>=3) 0 >= 3 (TBD) | ||
60 | * T1040.n 1040 n Full CHAL available from T1040.2 | ||
61 | * T1050.n 1050 n Current release. | ||
62 | * | ||
63 | * | ||
64 | * Note: there is a distinction between the software release with | ||
65 | * which something is compiled (accessible using XTHAL_RELEASE_* macros) | ||
66 | * and the software release with which the HAL library was compiled | ||
67 | * (accessible using Xthal_release_* global variables). This | ||
68 | * distinction is particularly relevant for vendors that distribute | ||
69 | * configuration-independent binaries (eg. an OS), where their customer | ||
70 | * might link it with a HAL of a different Xtensa software release. | ||
71 | * In this case, it may be appropriate for the OS to verify at run-time | ||
72 | * whether XTHAL_RELEASE_* and Xthal_release_* are compatible. | ||
73 | * [Guidelines as to which release is compatible with which are not | ||
74 | * currently provided explicitly, but might be inferred from reading | ||
75 | * OSKit documentation for all releases -- compatibility is also highly | ||
76 | * dependent on which HAL features are used. Each release is usually | ||
77 | * backward compatible, with very few exceptions if any.] | ||
78 | * | ||
79 | * Notes: | ||
80 | * Tornado 2.0 supported in T1020.3+, T1030.1+, and T1040.{0,1} only. | ||
81 | * Tornado 2.0.2 supported in T1040.2+, and T1050. | ||
82 | * Compile-time HAL port of NucleusPlus supported by T1040.2+ and T1050. | ||
83 | */ | ||
84 | |||
85 | |||
86 | /* | ||
87 | * Architectural limits, independent of configuration. | ||
88 | * Note that these are ISA-defined limits, not micro-architecture implementation | ||
89 | * limits enforced by the Xtensa Processor Generator (which may be stricter than | ||
90 | * these below). | ||
91 | */ | ||
92 | #define XTHAL_MAX_CPS 8 /* max number of coprocessors (0..7) */ | ||
93 | #define XTHAL_MAX_INTERRUPTS 32 /* max number of interrupts (0..31) */ | ||
94 | #define XTHAL_MAX_INTLEVELS 16 /* max number of interrupt levels (0..15) */ | ||
95 | /* (as of T1040, implementation limit is 7: 0..6) */ | ||
96 | #define XTHAL_MAX_TIMERS 4 /* max number of timers (CCOMPARE0..CCOMPARE3) */ | ||
97 | /* (as of T1040, implementation limit is 3: 0..2) */ | ||
98 | |||
99 | /* Misc: */ | ||
100 | #define XTHAL_LITTLEENDIAN 0 | ||
101 | #define XTHAL_BIGENDIAN 1 | ||
102 | |||
103 | |||
104 | /* Interrupt types: */ | ||
105 | #define XTHAL_INTTYPE_UNCONFIGURED 0 | ||
106 | #define XTHAL_INTTYPE_SOFTWARE 1 | ||
107 | #define XTHAL_INTTYPE_EXTERN_EDGE 2 | ||
108 | #define XTHAL_INTTYPE_EXTERN_LEVEL 3 | ||
109 | #define XTHAL_INTTYPE_TIMER 4 | ||
110 | #define XTHAL_INTTYPE_NMI 5 | ||
111 | #define XTHAL_MAX_INTTYPES 6 /* number of interrupt types */ | ||
112 | |||
113 | /* Timer related: */ | ||
114 | #define XTHAL_TIMER_UNCONFIGURED -1 /* Xthal_timer_interrupt[] value for non-existent timers */ | ||
115 | #define XTHAL_TIMER_UNASSIGNED XTHAL_TIMER_UNCONFIGURED /* (for backwards compatibility only) */ | ||
116 | |||
117 | |||
118 | /* Access Mode bits (tentative): */ /* bit abbr unit short_name PPC equ - Description */ | ||
119 | #define XTHAL_AMB_EXCEPTION 0 /* 001 E EX fls: EXception none - generate exception on any access (aka "illegal") */ | ||
120 | #define XTHAL_AMB_HITCACHE 1 /* 002 C CH fls: use Cache on Hit ~(I CI) - use cache on hit -- way from tag match [or H HC, or U UC] (ISA: same, except for Isolate case) */ | ||
121 | #define XTHAL_AMB_ALLOCATE 2 /* 004 A AL fl?: ALlocate none - refill cache on miss -- way from LRU [or F FI fill] (ISA: Read/Write Miss Refill) */ | ||
122 | #define XTHAL_AMB_WRITETHRU 3 /* 008 W WT --s: WriteThrough W WT - store immediately to memory (ISA: same) */ | ||
123 | #define XTHAL_AMB_ISOLATE 4 /* 010 I IS fls: ISolate none - use cache regardless of hit-vs-miss -- way from vaddr (ISA: use-cache-on-miss+hit) */ | ||
124 | #define XTHAL_AMB_GUARD 5 /* 020 G GU ?l?: GUard G * - non-speculative; spec/replay refs not permitted */ | ||
125 | #if 0 | ||
126 | #define XTHAL_AMB_ORDERED x /* 000 O OR fls: ORdered G * - mem accesses cannot be out of order */ | ||
127 | #define XTHAL_AMB_FUSEWRITES x /* 000 F FW --s: FuseWrites none - allow combining/merging multiple writes (to same datapath data unit) into one (implied by writeback) */ | ||
128 | #define XTHAL_AMB_COHERENT x /* 000 M MC fl?: Mem/MP Coherent M - on reads, other CPUs/bus-masters may need to supply data */ | ||
129 | #define XTHAL_AMB_TRUSTED x /* 000 T TR ?l?: TRusted none - memory will not bus error (if it does, handle as fatal imprecise interrupt) */ | ||
130 | #define XTHAL_AMB_PREFETCH x /* 000 P PR fl?: PRefetch none - on refill, read line+1 into prefetch buffers */ | ||
131 | #define XTHAL_AMB_STREAM x /* 000 S ST ???: STreaming none - access one of N stream buffers */ | ||
132 | #endif /*0*/ | ||
133 | |||
134 | #define XTHAL_AM_EXCEPTION (1<<XTHAL_AMB_EXCEPTION) | ||
135 | #define XTHAL_AM_HITCACHE (1<<XTHAL_AMB_HITCACHE) | ||
136 | #define XTHAL_AM_ALLOCATE (1<<XTHAL_AMB_ALLOCATE) | ||
137 | #define XTHAL_AM_WRITETHRU (1<<XTHAL_AMB_WRITETHRU) | ||
138 | #define XTHAL_AM_ISOLATE (1<<XTHAL_AMB_ISOLATE) | ||
139 | #define XTHAL_AM_GUARD (1<<XTHAL_AMB_GUARD) | ||
140 | #if 0 | ||
141 | #define XTHAL_AM_ORDERED (1<<XTHAL_AMB_ORDERED) | ||
142 | #define XTHAL_AM_FUSEWRITES (1<<XTHAL_AMB_FUSEWRITES) | ||
143 | #define XTHAL_AM_COHERENT (1<<XTHAL_AMB_COHERENT) | ||
144 | #define XTHAL_AM_TRUSTED (1<<XTHAL_AMB_TRUSTED) | ||
145 | #define XTHAL_AM_PREFETCH (1<<XTHAL_AMB_PREFETCH) | ||
146 | #define XTHAL_AM_STREAM (1<<XTHAL_AMB_STREAM) | ||
147 | #endif /*0*/ | ||
148 | |||
149 | /* | ||
150 | * Allowed Access Modes (bit combinations). | ||
151 | * | ||
152 | * Columns are: | ||
153 | * "FOGIWACE" | ||
154 | * Access mode bits (see XTHAL_AMB_xxx above). | ||
155 | * <letter> = bit is set | ||
156 | * '-' = bit is clear | ||
157 | * '.' = bit is irrelevant / don't care, as follows: | ||
158 | * E=1 makes all others irrelevant | ||
159 | * W,F relevant only for stores | ||
160 | * "2345" | ||
161 | * Indicates which Xtensa releases support the corresponding | ||
162 | * access mode. Releases for each character column are: | ||
163 | * 2 = prior to T1020.2: T1015 (V1.5), T1020.0, T1020.1 | ||
164 | * 3 = T1020.2 and later: T1020.2+, T1030 | ||
165 | * 4 = T1040 | ||
166 | * 5 = T1050 (maybe) | ||
167 | * And the character column contents are: | ||
168 | * <number> = support by release(s) | ||
169 | * "." = unsupported by release(s) | ||
170 | * "?" = support unknown | ||
171 | */ | ||
172 | /* FOGIWACE 2345 */ | ||
173 | /* For instruction fetch: */ | ||
174 | #define XTHAL_FAM_EXCEPTION 0x001 /* .......E 2345 exception */ | ||
175 | #define XTHAL_FAM_ISOLATE 0x012 /* .--I.-C- .... isolate */ | ||
176 | #define XTHAL_FAM_BYPASS 0x000 /* .---.--- 2345 bypass */ | ||
177 | #define XTHAL_FAM_NACACHED 0x002 /* .---.-C- .... cached no-allocate (frozen) */ | ||
178 | #define XTHAL_FAM_CACHED 0x006 /* .---.AC- 2345 cached */ | ||
179 | /* For data load: */ | ||
180 | #define XTHAL_LAM_EXCEPTION 0x001 /* .......E 2345 exception */ | ||
181 | #define XTHAL_LAM_ISOLATE 0x012 /* .--I.-C- 2345 isolate */ | ||
182 | #define XTHAL_LAM_BYPASS 0x000 /* .O--.--- 2... bypass speculative */ | ||
183 | #define XTHAL_LAM_BYPASSG 0x020 /* .OG-.--- .345 bypass guarded */ | ||
184 | #define XTHAL_LAM_NACACHED 0x002 /* .O--.-C- 2... cached no-allocate speculative */ | ||
185 | #define XTHAL_LAM_NACACHEDG 0x022 /* .OG-.-C- .345 cached no-allocate guarded */ | ||
186 | #define XTHAL_LAM_CACHED 0x006 /* .---.AC- 2345 cached speculative */ | ||
187 | #define XTHAL_LAM_CACHEDG 0x026 /* .?G-.AC- .... cached guarded */ | ||
188 | /* For data store: */ | ||
189 | #define XTHAL_SAM_EXCEPTION 0x001 /* .......E 2345 exception */ | ||
190 | #define XTHAL_SAM_ISOLATE 0x032 /* .-GI--C- 2345 isolate */ | ||
191 | #define XTHAL_SAM_BYPASS 0x028 /* -OG-W--- 2345 bypass */ | ||
192 | /*efine XTHAL_SAM_BYPASSF 0x028*/ /* F-G-W--- ...? bypass write-combined */ | ||
193 | #define XTHAL_SAM_WRITETHRU 0x02A /* -OG-W-C- 234? writethrough */ | ||
194 | /*efine XTHAL_SAM_WRITETHRUF 0x02A*/ /* F-G-W-C- ...5 writethrough write-combined */ | ||
195 | #define XTHAL_SAM_WRITEALLOC 0x02E /* -OG-WAC- ...? writethrough-allocate */ | ||
196 | /*efine XTHAL_SAM_WRITEALLOCF 0x02E*/ /* F-G-WAC- ...? writethrough-allocate write-combined */ | ||
197 | #define XTHAL_SAM_WRITEBACK 0x026 /* F-G--AC- ...5 writeback */ | ||
198 | |||
199 | #if 0 | ||
200 | /* | ||
201 | Cache attribute encoding for CACHEATTR (per ISA): | ||
202 | (Note: if this differs from ISA Ref Manual, ISA has precedence) | ||
203 | |||
204 | Inst-fetches Loads Stores | ||
205 | ------------- ------------ ------------- | ||
206 | 0x0 FCA_EXCEPTION ?LCA_NACACHED_G* SCA_WRITETHRU "uncached" | ||
207 | 0x1 FCA_CACHED LCA_CACHED SCA_WRITETHRU cached | ||
208 | 0x2 FCA_BYPASS LCA_BYPASS_G* SCA_BYPASS bypass | ||
209 | 0x3 FCA_CACHED LCA_CACHED SCA_WRITEALLOCF write-allocate | ||
210 | or LCA_EXCEPTION SCA_EXCEPTION (if unimplemented) | ||
211 | 0x4 FCA_CACHED LCA_CACHED SCA_WRITEBACK write-back | ||
212 | or LCA_EXCEPTION SCA_EXCEPTION (if unimplemented) | ||
213 | 0x5..D FCA_EXCEPTION LCA_EXCEPTION SCA_EXCEPTION (reserved) | ||
214 | 0xE FCA_EXCEPTION LCA_ISOLATE SCA_ISOLATE isolate | ||
215 | 0xF FCA_EXCEPTION LCA_EXCEPTION SCA_EXCEPTION illegal | ||
216 | * Prior to T1020.2?, guard feature not supported, this defaulted to speculative (no _G) | ||
217 | */ | ||
218 | #endif /*0*/ | ||
219 | |||
220 | |||
221 | #if !defined(__ASSEMBLY__) && !defined(_NOCLANGUAGE) | ||
222 | #ifdef __cplusplus | ||
223 | extern "C" { | ||
224 | #endif | ||
225 | |||
226 | /*---------------------------------------------------------------------- | ||
227 | HAL | ||
228 | ----------------------------------------------------------------------*/ | ||
229 | |||
230 | /* Constant to be checked in build = (XTHAL_MAJOR_REV<<16)|XTHAL_MINOR_REV */ | ||
231 | extern const unsigned int Xthal_rev_no; | ||
232 | |||
233 | |||
234 | /*---------------------------------------------------------------------- | ||
235 | Processor State | ||
236 | ----------------------------------------------------------------------*/ | ||
237 | /* save & restore the extra processor state */ | ||
238 | extern void xthal_save_extra(void *base); | ||
239 | extern void xthal_restore_extra(void *base); | ||
240 | |||
241 | extern void xthal_save_cpregs(void *base, int); | ||
242 | extern void xthal_restore_cpregs(void *base, int); | ||
243 | |||
244 | /*extern void xthal_save_all_extra(void *base);*/ | ||
245 | /*extern void xthal_restore_all_extra(void *base);*/ | ||
246 | |||
247 | /* space for processor state */ | ||
248 | extern const unsigned int Xthal_extra_size; | ||
249 | extern const unsigned int Xthal_extra_align; | ||
250 | /* space for TIE register files */ | ||
251 | extern const unsigned int Xthal_cpregs_size[XTHAL_MAX_CPS]; | ||
252 | extern const unsigned int Xthal_cpregs_align[XTHAL_MAX_CPS]; | ||
253 | |||
254 | /* total of space for the processor state (for Tor2) */ | ||
255 | extern const unsigned int Xthal_all_extra_size; | ||
256 | extern const unsigned int Xthal_all_extra_align; | ||
257 | |||
258 | /* initialize the extra processor */ | ||
259 | /*extern void xthal_init_extra(void);*/ | ||
260 | /* initialize the TIE coprocessor */ | ||
261 | /*extern void xthal_init_cp(int);*/ | ||
262 | |||
263 | /* initialize the extra processor */ | ||
264 | extern void xthal_init_mem_extra(void *); | ||
265 | /* initialize the TIE coprocessor */ | ||
266 | extern void xthal_init_mem_cp(void *, int); | ||
267 | |||
268 | /* validate & invalidate the TIE register file */ | ||
269 | extern void xthal_validate_cp(int); | ||
270 | extern void xthal_invalidate_cp(int); | ||
271 | |||
272 | /* the number of TIE coprocessors contiguous from zero (for Tor2) */ | ||
273 | extern const unsigned int Xthal_num_coprocessors; | ||
274 | |||
275 | /* actual number of coprocessors */ | ||
276 | extern const unsigned char Xthal_cp_num; | ||
277 | /* index of highest numbered coprocessor, plus one */ | ||
278 | extern const unsigned char Xthal_cp_max; | ||
279 | /* index of highest allowed coprocessor number, per cfg, plus one */ | ||
280 | /*extern const unsigned char Xthal_cp_maxcfg;*/ | ||
281 | /* bitmask of which coprocessors are present */ | ||
282 | extern const unsigned int Xthal_cp_mask; | ||
283 | |||
284 | /* read and write cpenable register */ | ||
285 | extern void xthal_set_cpenable(unsigned); | ||
286 | extern unsigned xthal_get_cpenable(void); | ||
287 | |||
288 | /* read & write extra state register */ | ||
289 | /*extern int xthal_read_extra(void *base, unsigned reg, unsigned *value);*/ | ||
290 | /*extern int xthal_write_extra(void *base, unsigned reg, unsigned value);*/ | ||
291 | |||
292 | /* read & write a TIE coprocessor register */ | ||
293 | /*extern int xthal_read_cpreg(void *base, int cp, unsigned reg, unsigned *value);*/ | ||
294 | /*extern int xthal_write_cpreg(void *base, int cp, unsigned reg, unsigned value);*/ | ||
295 | |||
296 | /* return coprocessor number based on register */ | ||
297 | /*extern int xthal_which_cp(unsigned reg);*/ | ||
298 | |||
299 | /*---------------------------------------------------------------------- | ||
300 | Interrupts | ||
301 | ----------------------------------------------------------------------*/ | ||
302 | |||
303 | /* the number of interrupt levels */ | ||
304 | extern const unsigned char Xthal_num_intlevels; | ||
305 | /* the number of interrupts */ | ||
306 | extern const unsigned char Xthal_num_interrupts; | ||
307 | |||
308 | /* mask for level of interrupts */ | ||
309 | extern const unsigned int Xthal_intlevel_mask[XTHAL_MAX_INTLEVELS]; | ||
310 | /* mask for level 0 to N interrupts */ | ||
311 | extern const unsigned int Xthal_intlevel_andbelow_mask[XTHAL_MAX_INTLEVELS]; | ||
312 | |||
313 | /* level of each interrupt */ | ||
314 | extern const unsigned char Xthal_intlevel[XTHAL_MAX_INTERRUPTS]; | ||
315 | |||
316 | /* type per interrupt */ | ||
317 | extern const unsigned char Xthal_inttype[XTHAL_MAX_INTERRUPTS]; | ||
318 | |||
319 | /* masks of each type of interrupt */ | ||
320 | extern const unsigned int Xthal_inttype_mask[XTHAL_MAX_INTTYPES]; | ||
321 | |||
322 | /* interrupt numbers assigned to each timer interrupt */ | ||
323 | extern const int Xthal_timer_interrupt[XTHAL_MAX_TIMERS]; | ||
324 | |||
325 | /*** Virtual interrupt prioritization: ***/ | ||
326 | |||
327 | /* Convert between interrupt levels (as per PS.INTLEVEL) and virtual interrupt priorities: */ | ||
328 | extern unsigned xthal_vpri_to_intlevel(unsigned vpri); | ||
329 | extern unsigned xthal_intlevel_to_vpri(unsigned intlevel); | ||
330 | |||
331 | /* Enables/disables given set (mask) of interrupts; returns previous enabled-mask of all ints: */ | ||
332 | extern unsigned xthal_int_enable(unsigned); | ||
333 | extern unsigned xthal_int_disable(unsigned); | ||
334 | |||
335 | /* Set/get virtual priority of an interrupt: */ | ||
336 | extern int xthal_set_int_vpri(int intnum, int vpri); | ||
337 | extern int xthal_get_int_vpri(int intnum); | ||
338 | |||
339 | /* Set/get interrupt lockout level for exclusive access to virtual priority data structures: */ | ||
340 | extern void xthal_set_vpri_locklevel(unsigned intlevel); | ||
341 | extern unsigned xthal_get_vpri_locklevel(void); | ||
342 | |||
343 | /* Set/get current virtual interrupt priority: */ | ||
344 | extern unsigned xthal_set_vpri(unsigned vpri); | ||
345 | extern unsigned xthal_get_vpri(unsigned vpri); | ||
346 | extern unsigned xthal_set_vpri_intlevel(unsigned intlevel); | ||
347 | extern unsigned xthal_set_vpri_lock(void); | ||
348 | |||
349 | |||
350 | |||
351 | /*---------------------------------------------------------------------- | ||
352 | Generic Interrupt Trampolining Support | ||
353 | ----------------------------------------------------------------------*/ | ||
354 | |||
355 | typedef void (XtHalVoidFunc)(void); | ||
356 | |||
357 | /* | ||
358 | * Bitmask of interrupts currently trampolining down: | ||
359 | */ | ||
360 | extern unsigned Xthal_tram_pending; | ||
361 | |||
362 | /* | ||
363 | * Bitmask of which interrupts currently trampolining down | ||
364 | * synchronously are actually enabled; this bitmask is necessary | ||
365 | * because INTENABLE cannot hold that state (sync-trampolining | ||
366 | * interrupts must be kept disabled while trampolining); | ||
367 | * in the current implementation, any bit set here is not set | ||
368 | * in INTENABLE, and vice-versa; once a sync-trampoline is | ||
369 | * handled (at level one), its enable bit must be moved from | ||
370 | * here to INTENABLE: | ||
371 | */ | ||
372 | extern unsigned Xthal_tram_enabled; | ||
373 | |||
374 | /* | ||
375 | * Bitmask of interrupts configured for sync trampolining: | ||
376 | */ | ||
377 | extern unsigned Xthal_tram_sync; | ||
378 | |||
379 | |||
380 | /* Trampoline support functions: */ | ||
381 | extern unsigned xthal_tram_pending_to_service( void ); | ||
382 | extern void xthal_tram_done( unsigned serviced_mask ); | ||
383 | extern int xthal_tram_set_sync( int intnum, int sync ); | ||
384 | extern XtHalVoidFunc* xthal_set_tram_trigger_func( XtHalVoidFunc *trigger_fn ); | ||
385 | |||
386 | /* INTENABLE,INTREAD,INTSET,INTCLEAR register access functions: */ | ||
387 | extern unsigned xthal_get_intenable( void ); | ||
388 | extern void xthal_set_intenable( unsigned ); | ||
389 | extern unsigned xthal_get_intread( void ); | ||
390 | extern void xthal_set_intset( unsigned ); | ||
391 | extern void xthal_set_intclear( unsigned ); | ||
392 | |||
393 | |||
394 | /*---------------------------------------------------------------------- | ||
395 | Register Windows | ||
396 | ----------------------------------------------------------------------*/ | ||
397 | |||
398 | /* number of registers in register window */ | ||
399 | extern const unsigned int Xthal_num_aregs; | ||
400 | extern const unsigned char Xthal_num_aregs_log2; | ||
401 | |||
402 | /* This spill any live register windows (other than the caller's): */ | ||
403 | extern void xthal_window_spill( void ); | ||
404 | |||
405 | |||
406 | /*---------------------------------------------------------------------- | ||
407 | Cache | ||
408 | ----------------------------------------------------------------------*/ | ||
409 | |||
410 | /* size of the cache lines in log2(bytes) */ | ||
411 | extern const unsigned char Xthal_icache_linewidth; | ||
412 | extern const unsigned char Xthal_dcache_linewidth; | ||
413 | /* size of the cache lines in bytes */ | ||
414 | extern const unsigned short Xthal_icache_linesize; | ||
415 | extern const unsigned short Xthal_dcache_linesize; | ||
416 | /* number of cache sets in log2(lines per way) */ | ||
417 | extern const unsigned char Xthal_icache_setwidth; | ||
418 | extern const unsigned char Xthal_dcache_setwidth; | ||
419 | /* cache set associativity (number of ways) */ | ||
420 | extern const unsigned int Xthal_icache_ways; | ||
421 | extern const unsigned int Xthal_dcache_ways; | ||
422 | /* size of the caches in bytes (ways * 2^(linewidth + setwidth)) */ | ||
423 | extern const unsigned int Xthal_icache_size; | ||
424 | extern const unsigned int Xthal_dcache_size; | ||
425 | /* cache features */ | ||
426 | extern const unsigned char Xthal_dcache_is_writeback; | ||
427 | extern const unsigned char Xthal_icache_line_lockable; | ||
428 | extern const unsigned char Xthal_dcache_line_lockable; | ||
429 | |||
430 | /* cache attribute register control (used by other HAL routines) */ | ||
431 | extern unsigned xthal_get_cacheattr( void ); | ||
432 | extern unsigned xthal_get_icacheattr( void ); | ||
433 | extern unsigned xthal_get_dcacheattr( void ); | ||
434 | extern void xthal_set_cacheattr( unsigned ); | ||
435 | extern void xthal_set_icacheattr( unsigned ); | ||
436 | extern void xthal_set_dcacheattr( unsigned ); | ||
437 | |||
438 | /* initialize cache support (must be called once at startup, before all other cache calls) */ | ||
439 | /*extern void xthal_cache_startinit( void );*/ | ||
440 | /* reset caches */ | ||
441 | /*extern void xthal_icache_reset( void );*/ | ||
442 | /*extern void xthal_dcache_reset( void );*/ | ||
443 | /* enable caches */ | ||
444 | extern void xthal_icache_enable( void ); /* DEPRECATED */ | ||
445 | extern void xthal_dcache_enable( void ); /* DEPRECATED */ | ||
446 | /* disable caches */ | ||
447 | extern void xthal_icache_disable( void ); /* DEPRECATED */ | ||
448 | extern void xthal_dcache_disable( void ); /* DEPRECATED */ | ||
449 | |||
450 | /* invalidate the caches */ | ||
451 | extern void xthal_icache_all_invalidate( void ); | ||
452 | extern void xthal_dcache_all_invalidate( void ); | ||
453 | extern void xthal_icache_region_invalidate( void *addr, unsigned size ); | ||
454 | extern void xthal_dcache_region_invalidate( void *addr, unsigned size ); | ||
455 | extern void xthal_icache_line_invalidate(void *addr); | ||
456 | extern void xthal_dcache_line_invalidate(void *addr); | ||
457 | /* write dirty data back */ | ||
458 | extern void xthal_dcache_all_writeback( void ); | ||
459 | extern void xthal_dcache_region_writeback( void *addr, unsigned size ); | ||
460 | extern void xthal_dcache_line_writeback(void *addr); | ||
461 | /* write dirty data back and invalidate */ | ||
462 | extern void xthal_dcache_all_writeback_inv( void ); | ||
463 | extern void xthal_dcache_region_writeback_inv( void *addr, unsigned size ); | ||
464 | extern void xthal_dcache_line_writeback_inv(void *addr); | ||
465 | /* prefetch and lock specified memory range into cache */ | ||
466 | extern void xthal_icache_region_lock( void *addr, unsigned size ); | ||
467 | extern void xthal_dcache_region_lock( void *addr, unsigned size ); | ||
468 | extern void xthal_icache_line_lock(void *addr); | ||
469 | extern void xthal_dcache_line_lock(void *addr); | ||
470 | /* unlock from cache */ | ||
471 | extern void xthal_icache_all_unlock( void ); | ||
472 | extern void xthal_dcache_all_unlock( void ); | ||
473 | extern void xthal_icache_region_unlock( void *addr, unsigned size ); | ||
474 | extern void xthal_dcache_region_unlock( void *addr, unsigned size ); | ||
475 | extern void xthal_icache_line_unlock(void *addr); | ||
476 | extern void xthal_dcache_line_unlock(void *addr); | ||
477 | |||
478 | |||
479 | /* sync icache and memory */ | ||
480 | extern void xthal_icache_sync( void ); | ||
481 | /* sync dcache and memory */ | ||
482 | extern void xthal_dcache_sync( void ); | ||
483 | |||
484 | /*---------------------------------------------------------------------- | ||
485 | Debug | ||
486 | ----------------------------------------------------------------------*/ | ||
487 | |||
488 | /* 1 if debug option configured, 0 if not: */ | ||
489 | extern const int Xthal_debug_configured; | ||
490 | |||
491 | /* Number of instruction and data break registers: */ | ||
492 | extern const int Xthal_num_ibreak; | ||
493 | extern const int Xthal_num_dbreak; | ||
494 | |||
495 | /* Set (plant) and remove software breakpoint, both synchronizing cache: */ | ||
496 | extern unsigned int xthal_set_soft_break(void *addr); | ||
497 | extern void xthal_remove_soft_break(void *addr, unsigned int); | ||
498 | |||
499 | |||
500 | /*---------------------------------------------------------------------- | ||
501 | Disassembler | ||
502 | ----------------------------------------------------------------------*/ | ||
503 | |||
504 | /* Max expected size of the return buffer for a disassembled instruction (hint only): */ | ||
505 | #define XTHAL_DISASM_BUFSIZE 80 | ||
506 | |||
507 | /* Disassembly option bits for selecting what to return: */ | ||
508 | #define XTHAL_DISASM_OPT_ADDR 0x0001 /* display address */ | ||
509 | #define XTHAL_DISASM_OPT_OPHEX 0x0002 /* display opcode bytes in hex */ | ||
510 | #define XTHAL_DISASM_OPT_OPCODE 0x0004 /* display opcode name (mnemonic) */ | ||
511 | #define XTHAL_DISASM_OPT_PARMS 0x0008 /* display parameters */ | ||
512 | #define XTHAL_DISASM_OPT_ALL 0x0FFF /* display everything */ | ||
513 | |||
514 | /* routine to get a string for the disassembled instruction */ | ||
515 | extern int xthal_disassemble( unsigned char *instr_buf, void *tgt_addr, | ||
516 | char *buffer, unsigned buflen, unsigned options ); | ||
517 | |||
518 | /* routine to get the size of the next instruction. Returns 0 for | ||
519 | illegal instruction */ | ||
520 | extern int xthal_disassemble_size( unsigned char *instr_buf ); | ||
521 | |||
522 | |||
523 | /*---------------------------------------------------------------------- | ||
524 | Core Counter | ||
525 | ----------------------------------------------------------------------*/ | ||
526 | |||
527 | /* counter info */ | ||
528 | extern const unsigned char Xthal_have_ccount; /* set if CCOUNT register present */ | ||
529 | extern const unsigned char Xthal_num_ccompare; /* number of CCOMPAREn registers */ | ||
530 | |||
531 | /* get CCOUNT register (if not present return 0) */ | ||
532 | extern unsigned xthal_get_ccount(void); | ||
533 | |||
534 | /* set and get CCOMPAREn registers (if not present, get returns 0) */ | ||
535 | extern void xthal_set_ccompare(int, unsigned); | ||
536 | extern unsigned xthal_get_ccompare(int); | ||
537 | |||
538 | |||
539 | /*---------------------------------------------------------------------- | ||
540 | Instruction/Data RAM/ROM Access | ||
541 | ----------------------------------------------------------------------*/ | ||
542 | |||
543 | extern void* xthal_memcpy(void *dst, const void *src, unsigned len); | ||
544 | extern void* xthal_bcopy(const void *src, void *dst, unsigned len); | ||
545 | |||
546 | /*---------------------------------------------------------------------- | ||
547 | MP Synchronization | ||
548 | ----------------------------------------------------------------------*/ | ||
549 | extern int xthal_compare_and_set( int *addr, int test_val, int compare_val ); | ||
550 | extern unsigned xthal_get_prid( void ); | ||
551 | |||
552 | /*extern const char Xthal_have_s32c1i;*/ | ||
553 | extern const unsigned char Xthal_have_prid; | ||
554 | |||
555 | |||
556 | /*---------------------------------------------------------------------- | ||
557 | Miscellaneous | ||
558 | ----------------------------------------------------------------------*/ | ||
559 | |||
560 | extern const unsigned int Xthal_release_major; | ||
561 | extern const unsigned int Xthal_release_minor; | ||
562 | extern const char * const Xthal_release_name; | ||
563 | extern const char * const Xthal_release_internal; | ||
564 | |||
565 | extern const unsigned char Xthal_memory_order; | ||
566 | extern const unsigned char Xthal_have_windowed; | ||
567 | extern const unsigned char Xthal_have_density; | ||
568 | extern const unsigned char Xthal_have_booleans; | ||
569 | extern const unsigned char Xthal_have_loops; | ||
570 | extern const unsigned char Xthal_have_nsa; | ||
571 | extern const unsigned char Xthal_have_minmax; | ||
572 | extern const unsigned char Xthal_have_sext; | ||
573 | extern const unsigned char Xthal_have_clamps; | ||
574 | extern const unsigned char Xthal_have_mac16; | ||
575 | extern const unsigned char Xthal_have_mul16; | ||
576 | extern const unsigned char Xthal_have_fp; | ||
577 | extern const unsigned char Xthal_have_speculation; | ||
578 | extern const unsigned char Xthal_have_exceptions; | ||
579 | extern const unsigned char Xthal_xea_version; | ||
580 | extern const unsigned char Xthal_have_interrupts; | ||
581 | extern const unsigned char Xthal_have_highlevel_interrupts; | ||
582 | extern const unsigned char Xthal_have_nmi; | ||
583 | |||
584 | extern const unsigned short Xthal_num_writebuffer_entries; | ||
585 | |||
586 | extern const unsigned int Xthal_build_unique_id; | ||
587 | /* Release info for hardware targeted by software upgrades: */ | ||
588 | extern const unsigned int Xthal_hw_configid0; | ||
589 | extern const unsigned int Xthal_hw_configid1; | ||
590 | extern const unsigned int Xthal_hw_release_major; | ||
591 | extern const unsigned int Xthal_hw_release_minor; | ||
592 | extern const char * const Xthal_hw_release_name; | ||
593 | extern const char * const Xthal_hw_release_internal; | ||
594 | |||
595 | |||
596 | /* Internal memories... */ | ||
597 | |||
598 | extern const unsigned char Xthal_num_instrom; | ||
599 | extern const unsigned char Xthal_num_instram; | ||
600 | extern const unsigned char Xthal_num_datarom; | ||
601 | extern const unsigned char Xthal_num_dataram; | ||
602 | extern const unsigned char Xthal_num_xlmi; | ||
603 | extern const unsigned int Xthal_instrom_vaddr[1]; | ||
604 | extern const unsigned int Xthal_instrom_paddr[1]; | ||
605 | extern const unsigned int Xthal_instrom_size [1]; | ||
606 | extern const unsigned int Xthal_instram_vaddr[1]; | ||
607 | extern const unsigned int Xthal_instram_paddr[1]; | ||
608 | extern const unsigned int Xthal_instram_size [1]; | ||
609 | extern const unsigned int Xthal_datarom_vaddr[1]; | ||
610 | extern const unsigned int Xthal_datarom_paddr[1]; | ||
611 | extern const unsigned int Xthal_datarom_size [1]; | ||
612 | extern const unsigned int Xthal_dataram_vaddr[1]; | ||
613 | extern const unsigned int Xthal_dataram_paddr[1]; | ||
614 | extern const unsigned int Xthal_dataram_size [1]; | ||
615 | extern const unsigned int Xthal_xlmi_vaddr[1]; | ||
616 | extern const unsigned int Xthal_xlmi_paddr[1]; | ||
617 | extern const unsigned int Xthal_xlmi_size [1]; | ||
618 | |||
619 | |||
620 | |||
621 | /*---------------------------------------------------------------------- | ||
622 | Memory Management Unit | ||
623 | ----------------------------------------------------------------------*/ | ||
624 | |||
625 | extern const unsigned char Xthal_have_spanning_way; | ||
626 | extern const unsigned char Xthal_have_identity_map; | ||
627 | extern const unsigned char Xthal_have_mimic_cacheattr; | ||
628 | extern const unsigned char Xthal_have_xlt_cacheattr; | ||
629 | extern const unsigned char Xthal_have_cacheattr; | ||
630 | extern const unsigned char Xthal_have_tlbs; | ||
631 | |||
632 | extern const unsigned char Xthal_mmu_asid_bits; /* 0 .. 8 */ | ||
633 | extern const unsigned char Xthal_mmu_asid_kernel; | ||
634 | extern const unsigned char Xthal_mmu_rings; /* 1 .. 4 (perhaps 0 if no MMU and/or no protection?) */ | ||
635 | extern const unsigned char Xthal_mmu_ring_bits; | ||
636 | extern const unsigned char Xthal_mmu_sr_bits; | ||
637 | extern const unsigned char Xthal_mmu_ca_bits; | ||
638 | extern const unsigned int Xthal_mmu_max_pte_page_size; | ||
639 | extern const unsigned int Xthal_mmu_min_pte_page_size; | ||
640 | |||
641 | extern const unsigned char Xthal_itlb_way_bits; | ||
642 | extern const unsigned char Xthal_itlb_ways; | ||
643 | extern const unsigned char Xthal_itlb_arf_ways; | ||
644 | extern const unsigned char Xthal_dtlb_way_bits; | ||
645 | extern const unsigned char Xthal_dtlb_ways; | ||
646 | extern const unsigned char Xthal_dtlb_arf_ways; | ||
647 | |||
648 | /* Convert between virtual and physical addresses (through static maps only): */ | ||
649 | /*** WARNING: these two functions may go away in a future release; don't depend on them! ***/ | ||
650 | extern int xthal_static_v2p( unsigned vaddr, unsigned *paddrp ); | ||
651 | extern int xthal_static_p2v( unsigned paddr, unsigned *vaddrp, unsigned cached ); | ||
652 | |||
653 | #if 0 | ||
654 | /******************* EXPERIMENTAL AND TENTATIVE ONLY ********************/ | ||
655 | |||
656 | #define XTHAL_MMU_PAGESZ_COUNT_MAX 8 /* maximum number of different page sizes */ | ||
657 | extern const char Xthal_mmu_pagesz_count; /* 0 .. 8 number of different page sizes configured */ | ||
658 | |||
659 | /* Note: the following table doesn't necessarily have page sizes in increasing order: */ | ||
660 | extern const char Xthal_mmu_pagesz_log2[XTHAL_MMU_PAGESZ_COUNT_MAX]; /* 10 .. 28 (0 past count) */ | ||
661 | |||
662 | /* Sorted (increasing) table of page sizes, that indexes into the above table: */ | ||
663 | extern const char Xthal_mmu_pagesz_sorted[XTHAL_MMU_PAGESZ_COUNT_MAX]; /* 0 .. 7 (0 past count) */ | ||
664 | |||
665 | /*u32 Xthal_virtual_exceptions;*/ /* bitmask of which exceptions execute in virtual mode... */ | ||
666 | |||
667 | extern const char Xthal_mmu_pte_pagesz_log2_min; /* ?? minimum page size in PTEs */ | ||
668 | extern const char Xthal_mmu_pte_pagesz_log2_max; /* ?? maximum page size in PTEs */ | ||
669 | |||
670 | /* Cache Attribute Bits Implemented by the Cache (part of the cache abstraction) */ | ||
671 | extern const char Xthal_icache_fca_bits_implemented; /* ITLB/UTLB only! */ | ||
672 | extern const char Xthal_dcache_lca_bits_implemented; /* DTLB/UTLB only! */ | ||
673 | extern const char Xthal_dcache_sca_bits_implemented; /* DTLB/UTLB only! */ | ||
674 | |||
675 | /* Per TLB Parameters (Instruction, Data, Unified) */ | ||
676 | struct XtHalMmuTlb Xthal_itlb; /* description of MMU I-TLB generic features */ | ||
677 | struct XtHalMmuTlb Xthal_dtlb; /* description of MMU D-TLB generic features */ | ||
678 | struct XtHalMmuTlb Xthal_utlb; /* description of MMU U-TLB generic features */ | ||
679 | |||
680 | #define XTHAL_MMU_WAYS_MAX 8 /* maximum number of ways (associativities) for each TLB */ | ||
681 | |||
682 | /* Structure for common information described for each possible TLB (instruction, data and unified): */ | ||
683 | typedef struct XtHalMmuTlb { | ||
684 | u8 va_bits; /* 32 (number of virtual address bits) */ | ||
685 | u8 pa_bits; /* 32 (number of physical address bits) */ | ||
686 | bool tlb_va_indexed; /* 1 (set if TLB is indexed by virtual address) */ | ||
687 | bool tlb_va_tagged; /* 0 (set if TLB is tagged by virtual address) */ | ||
688 | bool cache_va_indexed; /* 1 (set if cache is indexed by virtual address) */ | ||
689 | bool cache_va_tagged; /* 0 (set if cache is tagged by virtual address) */ | ||
690 | /*bool (whether page tables are traversed in vaddr sorted order, paddr sorted order, ...) */ | ||
691 | /*u8 (set of available page attribute bits, other than cache attribute bits defined above) */ | ||
692 | /*u32 (various masks for pages, MMU table/TLB entries, etc.) */ | ||
693 | u8 way_count; /* 0 .. 8 (number of ways, a.k.a. associativities, for this TLB) */ | ||
694 | XtHalMmuTlbWay * ways[XTHAL_MMU_WAYS_MAX]; /* pointers to per-way parms for each way */ | ||
695 | } XtHalMmuTlb; | ||
696 | |||
697 | /* Per TLB Way (Per Associativity) Parameters */ | ||
698 | typedef struct XtHalMmuTlbWay { | ||
699 | u32 index_count_log2; /* 0 .. 4 */ | ||
700 | u32 pagesz_mask; /* 0 .. 2^pagesz_count - 1 (each bit corresponds to a size */ | ||
701 | /* defined in the Xthal_mmu_pagesz_log2[] table) */ | ||
702 | u32 vpn_const_mask; | ||
703 | u32 vpn_const_value; | ||
704 | u64 ppn_const_mask; /* future may support pa_bits > 32 */ | ||
705 | u64 ppn_const_value; | ||
706 | u32 ppn_id_mask; /* paddr bits taken directly from vaddr */ | ||
707 | bool backgnd_match; /* 0 or 1 */ | ||
708 | /* These are defined in terms of the XTHAL_CACHE_xxx bits: */ | ||
709 | u8 fca_const_mask; /* ITLB/UTLB only! */ | ||
710 | u8 fca_const_value; /* ITLB/UTLB only! */ | ||
711 | u8 lca_const_mask; /* DTLB/UTLB only! */ | ||
712 | u8 lca_const_value; /* DTLB/UTLB only! */ | ||
713 | u8 sca_const_mask; /* DTLB/UTLB only! */ | ||
714 | u8 sca_const_value; /* DTLB/UTLB only! */ | ||
715 | /* These define an encoding that map 5 bits in TLB and PTE entries to */ | ||
716 | /* 8 bits (FCA, ITLB), 16 bits (LCA+SCA, DTLB) or 24 bits (FCA+LCA+SCA, UTLB): */ | ||
717 | /* (they may be moved to struct XtHalMmuTlb) */ | ||
718 | u8 ca_bits; /* number of bits in TLB/PTE entries for cache attributes */ | ||
719 | u32 * ca_map; /* pointer to array of 2^ca_bits entries of FCA+LCA+SCA bits */ | ||
720 | } XtHalMmuTlbWay; | ||
721 | |||
722 | /* | ||
723 | * The way to determine whether protection support is present in core | ||
724 | * is to [look at Xthal_mmu_rings ???]. | ||
725 | * Give info on memory requirements for MMU tables and other in-memory | ||
726 | * data structures (globally, per task, base and per page, etc.) - whatever bounds can be calculated. | ||
727 | */ | ||
728 | |||
729 | |||
730 | /* Default vectors: */ | ||
731 | xthal_immu_fetch_miss_vector | ||
732 | xthal_dmmu_load_miss_vector | ||
733 | xthal_dmmu_store_miss_vector | ||
734 | |||
735 | /* Functions called when a fault is detected: */ | ||
736 | typedef void (XtHalMmuFaultFunc)( unsigned vaddr, ...context... ); | ||
737 | /* Or, */ | ||
738 | /* a? = vaddr */ | ||
739 | /* a? = context... */ | ||
740 | /* PS.xxx = xxx */ | ||
741 | XtHalMMuFaultFunc *Xthal_immu_fetch_fault_func; | ||
742 | XtHalMMuFaultFunc *Xthal_dmmu_load_fault_func; | ||
743 | XtHalMMuFaultFunc *Xthal_dmmu_store_fault_func; | ||
744 | |||
745 | /* Default Handlers: */ | ||
746 | /* The user and/or kernel exception handlers may jump to these handlers to handle the relevant exceptions, | ||
747 | * according to the value of EXCCAUSE. The exact register state on entry to these handlers is TBD. */ | ||
748 | /* When multiple TLB entries match (hit) on the same access: */ | ||
749 | xthal_immu_fetch_multihit_handler | ||
750 | xthal_dmmu_load_multihit_handler | ||
751 | xthal_dmmu_store_multihit_handler | ||
752 | /* Protection violations according to cache attributes, and other cache attribute mismatches: */ | ||
753 | xthal_immu_fetch_attr_handler | ||
754 | xthal_dmmu_load_attr_handler | ||
755 | xthal_dmmu_store_attr_handler | ||
756 | /* Protection violations due to insufficient ring level: */ | ||
757 | xthal_immu_fetch_priv_handler | ||
758 | xthal_dmmu_load_priv_handler | ||
759 | xthal_dmmu_store_priv_handler | ||
760 | /* Alignment exception handlers (if supported by the particular Xtensa MMU configuration): */ | ||
761 | xthal_dmmu_load_align_handler | ||
762 | xthal_dmmu_store_align_handler | ||
763 | |||
764 | /* Or, alternatively, the OS user and/or kernel exception handlers may simply jump to the | ||
765 | * following entry points which will handle any values of EXCCAUSE not handled by the OS: */ | ||
766 | xthal_user_exc_default_handler | ||
767 | xthal_kernel_exc_default_handler | ||
768 | |||
769 | #endif /*0*/ | ||
770 | |||
771 | #ifdef INCLUDE_DEPRECATED_HAL_CODE | ||
772 | extern const unsigned char Xthal_have_old_exc_arch; | ||
773 | extern const unsigned char Xthal_have_mmu; | ||
774 | extern const unsigned int Xthal_num_regs; | ||
775 | extern const unsigned char Xthal_num_iroms; | ||
776 | extern const unsigned char Xthal_num_irams; | ||
777 | extern const unsigned char Xthal_num_droms; | ||
778 | extern const unsigned char Xthal_num_drams; | ||
779 | extern const unsigned int Xthal_configid0; | ||
780 | extern const unsigned int Xthal_configid1; | ||
781 | #endif | ||
782 | |||
783 | #ifdef INCLUDE_DEPRECATED_HAL_DEBUG_CODE | ||
784 | #define XTHAL_24_BIT_BREAK 0x80000000 | ||
785 | #define XTHAL_16_BIT_BREAK 0x40000000 | ||
786 | extern const unsigned short Xthal_ill_inst_16[16]; | ||
787 | #define XTHAL_DEST_REG 0xf0000000 /* Mask for destination register */ | ||
788 | #define XTHAL_DEST_REG_INST 0x08000000 /* Branch address is in register */ | ||
789 | #define XTHAL_DEST_REL_INST 0x04000000 /* Branch address is relative */ | ||
790 | #define XTHAL_RFW_INST 0x00000800 | ||
791 | #define XTHAL_RFUE_INST 0x00000400 | ||
792 | #define XTHAL_RFI_INST 0x00000200 | ||
793 | #define XTHAL_RFE_INST 0x00000100 | ||
794 | #define XTHAL_RET_INST 0x00000080 | ||
795 | #define XTHAL_BREAK_INST 0x00000040 | ||
796 | #define XTHAL_SYSCALL_INST 0x00000020 | ||
797 | #define XTHAL_LOOP_END 0x00000010 /* Not set by xthal_inst_type */ | ||
798 | #define XTHAL_JUMP_INST 0x00000008 /* Call or jump instruction */ | ||
799 | #define XTHAL_BRANCH_INST 0x00000004 /* Branch instruction */ | ||
800 | #define XTHAL_24_BIT_INST 0x00000002 | ||
801 | #define XTHAL_16_BIT_INST 0x00000001 | ||
802 | typedef struct xthal_state { | ||
803 | unsigned pc; | ||
804 | unsigned ar[16]; | ||
805 | unsigned lbeg; | ||
806 | unsigned lend; | ||
807 | unsigned lcount; | ||
808 | unsigned extra_ptr; | ||
809 | unsigned cpregs_ptr[XTHAL_MAX_CPS]; | ||
810 | } XTHAL_STATE; | ||
811 | extern unsigned int xthal_inst_type(void *addr); | ||
812 | extern unsigned int xthal_branch_addr(void *addr); | ||
813 | extern unsigned int xthal_get_npc(XTHAL_STATE *user_state); | ||
814 | #endif /* INCLUDE_DEPRECATED_HAL_DEBUG_CODE */ | ||
815 | |||
816 | #ifdef __cplusplus | ||
817 | } | ||
818 | #endif | ||
819 | #endif /*!__ASSEMBLY__ */ | ||
820 | |||
821 | #endif /*XTENSA_HAL_H*/ | ||
822 | |||
diff --git a/include/asm-xtensa/xtensa/simcall.h b/include/asm-xtensa/xtensa/simcall.h new file mode 100644 index 000000000000..a2b868929a49 --- /dev/null +++ b/include/asm-xtensa/xtensa/simcall.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef SIMCALL_INCLUDED | ||
2 | #define SIMCALL_INCLUDED | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/simcall.h - Simulator call numbers | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General | ||
10 | * Public License. See the file "COPYING" in the main directory of | ||
11 | * this archive for more details. | ||
12 | * | ||
13 | * Copyright (C) 2002 Tensilica Inc. | ||
14 | */ | ||
15 | |||
16 | |||
17 | /* | ||
18 | * System call like services offered by the simulator host. | ||
19 | * These are modeled after the Linux 2.4 kernel system calls | ||
20 | * for Xtensa processors. However not all system calls and | ||
21 | * not all functionality of a given system call are implemented, | ||
22 | * or necessarily have well defined or equivalent semantics in | ||
23 | * the context of a simulation (as opposed to a Unix kernel). | ||
24 | * | ||
25 | * These services behave largely as if they had been invoked | ||
26 | * as a task in the simulator host's operating system | ||
27 | * (eg. files accessed are those of the simulator host). | ||
28 | * However, these SIMCALLs model a virtual operating system | ||
29 | * so that various definitions, bit assignments etc | ||
30 | * (eg. open mode bits, errno values, etc) are independent | ||
31 | * of the host operating system used to run the simulation. | ||
32 | * Rather these definitions are specific to the Xtensa ISS. | ||
33 | * This way Xtensa ISA code written to use these SIMCALLs | ||
34 | * can (in principle) be simulated on any host. | ||
35 | * | ||
36 | * Up to 6 parameters are passed in registers a3 to a8 | ||
37 | * (note the 6th parameter isn't passed on the stack, | ||
38 | * unlike windowed function calling conventions). | ||
39 | * The return value is in a2. A negative value in the | ||
40 | * range -4096 to -1 indicates a negated error code to be | ||
41 | * reported in errno with a return value of -1, otherwise | ||
42 | * the value in a2 is returned as is. | ||
43 | */ | ||
44 | |||
45 | /* These #defines need to match what's in Xtensa/OS/vxworks/xtiss/simcalls.c */ | ||
46 | |||
47 | #define SYS_nop 0 /* n/a - setup; used to flush register windows */ | ||
48 | #define SYS_exit 1 /*x*/ | ||
49 | #define SYS_fork 2 | ||
50 | #define SYS_read 3 /*x*/ | ||
51 | #define SYS_write 4 /*x*/ | ||
52 | #define SYS_open 5 /*x*/ | ||
53 | #define SYS_close 6 /*x*/ | ||
54 | #define SYS_rename 7 /*x 38 - waitpid */ | ||
55 | #define SYS_creat 8 /*x*/ | ||
56 | #define SYS_link 9 /*x (not implemented on WIN32) */ | ||
57 | #define SYS_unlink 10 /*x*/ | ||
58 | #define SYS_execv 11 /* n/a - execve */ | ||
59 | #define SYS_execve 12 /* 11 - chdir */ | ||
60 | #define SYS_pipe 13 /* 42 - time */ | ||
61 | #define SYS_stat 14 /* 106 - mknod */ | ||
62 | #define SYS_chmod 15 | ||
63 | #define SYS_chown 16 /* 202 - lchown */ | ||
64 | #define SYS_utime 17 /* 30 - break */ | ||
65 | #define SYS_wait 18 /* n/a - oldstat */ | ||
66 | #define SYS_lseek 19 /*x*/ | ||
67 | #define SYS_getpid 20 | ||
68 | #define SYS_isatty 21 /* n/a - mount */ | ||
69 | #define SYS_fstat 22 /* 108 - oldumount */ | ||
70 | #define SYS_time 23 /* 13 - setuid */ | ||
71 | #define SYS_gettimeofday 24 /*x 78 - getuid (not implemented on WIN32) */ | ||
72 | #define SYS_times 25 /*X 43 - stime (Xtensa-specific implementation) */ | ||
73 | #define SYS_socket 26 | ||
74 | #define SYS_sendto 27 | ||
75 | #define SYS_recvfrom 28 | ||
76 | #define SYS_select_one 29 /* not compitible select, one file descriptor at the time */ | ||
77 | #define SYS_bind 30 | ||
78 | #define SYS_ioctl 31 | ||
79 | |||
80 | /* | ||
81 | * Other... | ||
82 | */ | ||
83 | #define SYS_iss_argc 1000 /* returns value of argc */ | ||
84 | #define SYS_iss_argv_size 1001 /* bytes needed for argv & arg strings */ | ||
85 | #define SYS_iss_set_argv 1002 /* saves argv & arg strings at given addr */ | ||
86 | |||
87 | /* | ||
88 | * SIMCALLs for the ferret memory debugger. All are invoked by | ||
89 | * libferret.a ... ( Xtensa/Target-Libs/ferret ) | ||
90 | */ | ||
91 | #define SYS_ferret 1010 | ||
92 | #define SYS_malloc 1011 | ||
93 | #define SYS_free 1012 | ||
94 | #define SYS_more_heap 1013 | ||
95 | #define SYS_no_heap 1014 | ||
96 | |||
97 | |||
98 | /* | ||
99 | * Extra SIMCALLs for GDB: | ||
100 | */ | ||
101 | #define SYS_gdb_break -1 /* invoked by XTOS on user exceptions if EPC points | ||
102 | to a break.n/break, regardless of cause! */ | ||
103 | #define SYS_xmon_out -2 /* invoked by XMON: ... */ | ||
104 | #define SYS_xmon_in -3 /* invoked by XMON: ... */ | ||
105 | #define SYS_xmon_flush -4 /* invoked by XMON: ... */ | ||
106 | #define SYS_gdb_abort -5 /* invoked by XTOS in _xtos_panic() */ | ||
107 | #define SYS_gdb_illegal_inst -6 /* invoked by XTOS for illegal instructions (too deeply) */ | ||
108 | #define SYS_xmon_init -7 /* invoked by XMON: ... */ | ||
109 | #define SYS_gdb_enter_sktloop -8 /* invoked by XTOS on debug exceptions */ | ||
110 | |||
111 | /* | ||
112 | * SIMCALLs for vxWorks xtiss BSP: | ||
113 | */ | ||
114 | #define SYS_setup_ppp_pipes -83 | ||
115 | #define SYS_log_msg -84 | ||
116 | |||
117 | /* | ||
118 | * Test SIMCALLs: | ||
119 | */ | ||
120 | #define SYS_test_write_state -100 | ||
121 | #define SYS_test_read_state -101 | ||
122 | |||
123 | /* | ||
124 | * SYS_select_one specifiers | ||
125 | */ | ||
126 | #define XTISS_SELECT_ONE_READ 1 | ||
127 | #define XTISS_SELECT_ONE_WRITE 2 | ||
128 | #define XTISS_SELECT_ONE_EXCEPT 3 | ||
129 | |||
130 | #endif /* !SIMCALL_INCLUDED */ | ||
diff --git a/include/asm-xtensa/xtensa/xt2000-uart.h b/include/asm-xtensa/xtensa/xt2000-uart.h new file mode 100644 index 000000000000..0154460f0ed8 --- /dev/null +++ b/include/asm-xtensa/xtensa/xt2000-uart.h | |||
@@ -0,0 +1,155 @@ | |||
1 | #ifndef _uart_h_included_ | ||
2 | #define _uart_h_included_ | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/xt2000-uart.h -- NatSemi PC16552D DUART | ||
8 | * definitions | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | * | ||
14 | * Copyright (C) 2002 Tensilica Inc. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include <xtensa/xt2000.h> | ||
19 | |||
20 | |||
21 | /* 16550 UART DEVICE REGISTERS | ||
22 | The XT2000 board aligns each register to a 32-bit word but the UART device only uses | ||
23 | one byte of the word, which is the least-significant byte regardless of the | ||
24 | endianness of the core (ie. byte offset 0 for little-endian and 3 for big-endian). | ||
25 | So if using word accesses then endianness doesn't matter. | ||
26 | The macros provided here do that. | ||
27 | */ | ||
28 | struct uart_dev_s { | ||
29 | union { | ||
30 | unsigned int rxb; /* DLAB=0: receive buffer, read-only */ | ||
31 | unsigned int txb; /* DLAB=0: transmit buffer, write-only */ | ||
32 | unsigned int dll; /* DLAB=1: divisor, least-significant byte latch (was write-only?) */ | ||
33 | } w0; | ||
34 | union { | ||
35 | unsigned int ier; /* DLAB=0: interrupt-enable register (was write-only?) */ | ||
36 | unsigned int dlm; /* DLAB=1: divisor, most-significant byte latch (was write-only?) */ | ||
37 | } w1; | ||
38 | |||
39 | union { | ||
40 | unsigned int isr; /* DLAB=0: interrupt status register, read-only */ | ||
41 | unsigned int fcr; /* DLAB=0: FIFO control register, write-only */ | ||
42 | unsigned int afr; /* DLAB=1: alternate function register */ | ||
43 | } w2; | ||
44 | |||
45 | unsigned int lcr; /* line control-register, write-only */ | ||
46 | unsigned int mcr; /* modem control-regsiter, write-only */ | ||
47 | unsigned int lsr; /* line status register, read-only */ | ||
48 | unsigned int msr; /* modem status register, read-only */ | ||
49 | unsigned int scr; /* scratch regsiter, read/write */ | ||
50 | }; | ||
51 | |||
52 | #define _RXB(u) ((u)->w0.rxb) | ||
53 | #define _TXB(u) ((u)->w0.txb) | ||
54 | #define _DLL(u) ((u)->w0.dll) | ||
55 | #define _IER(u) ((u)->w1.ier) | ||
56 | #define _DLM(u) ((u)->w1.dlm) | ||
57 | #define _ISR(u) ((u)->w2.isr) | ||
58 | #define _FCR(u) ((u)->w2.fcr) | ||
59 | #define _AFR(u) ((u)->w2.afr) | ||
60 | #define _LCR(u) ((u)->lcr) | ||
61 | #define _MCR(u) ((u)->mcr) | ||
62 | #define _LSR(u) ((u)->lsr) | ||
63 | #define _MSR(u) ((u)->msr) | ||
64 | #define _SCR(u) ((u)->scr) | ||
65 | |||
66 | typedef volatile struct uart_dev_s uart_dev_t; | ||
67 | |||
68 | /* IER bits */ | ||
69 | #define RCVR_DATA_REG_INTENABLE 0x01 | ||
70 | #define XMIT_HOLD_REG_INTENABLE 0x02 | ||
71 | #define RCVR_STATUS_INTENABLE 0x04 | ||
72 | #define MODEM_STATUS_INTENABLE 0x08 | ||
73 | |||
74 | /* FCR bits */ | ||
75 | #define _FIFO_ENABLE 0x01 | ||
76 | #define RCVR_FIFO_RESET 0x02 | ||
77 | #define XMIT_FIFO_RESET 0x04 | ||
78 | #define DMA_MODE_SELECT 0x08 | ||
79 | #define RCVR_TRIGGER_LSB 0x40 | ||
80 | #define RCVR_TRIGGER_MSB 0x80 | ||
81 | |||
82 | /* AFR bits */ | ||
83 | #define AFR_CONC_WRITE 0x01 | ||
84 | #define AFR_BAUDOUT_SEL 0x02 | ||
85 | #define AFR_RXRDY_SEL 0x04 | ||
86 | |||
87 | /* ISR bits */ | ||
88 | #define INT_STATUS(r) ((r)&1) | ||
89 | #define INT_PRIORITY(r) (((r)>>1)&0x7) | ||
90 | |||
91 | /* LCR bits */ | ||
92 | #define WORD_LENGTH(n) (((n)-5)&0x3) | ||
93 | #define STOP_BIT_ENABLE 0x04 | ||
94 | #define PARITY_ENABLE 0x08 | ||
95 | #define EVEN_PARITY 0x10 | ||
96 | #define FORCE_PARITY 0x20 | ||
97 | #define XMIT_BREAK 0x40 | ||
98 | #define DLAB_ENABLE 0x80 | ||
99 | |||
100 | /* MCR bits */ | ||
101 | #define _DTR 0x01 | ||
102 | #define _RTS 0x02 | ||
103 | #define _OP1 0x04 | ||
104 | #define _OP2 0x08 | ||
105 | #define LOOP_BACK 0x10 | ||
106 | |||
107 | /* LSR Bits */ | ||
108 | #define RCVR_DATA_READY 0x01 | ||
109 | #define OVERRUN_ERROR 0x02 | ||
110 | #define PARITY_ERROR 0x04 | ||
111 | #define FRAMING_ERROR 0x08 | ||
112 | #define BREAK_INTERRUPT 0x10 | ||
113 | #define XMIT_HOLD_EMPTY 0x20 | ||
114 | #define XMIT_EMPTY 0x40 | ||
115 | #define FIFO_ERROR 0x80 | ||
116 | #define RCVR_READY(u) (_LSR(u)&RCVR_DATA_READY) | ||
117 | #define XMIT_READY(u) (_LSR(u)&XMIT_HOLD_EMPTY) | ||
118 | |||
119 | /* MSR bits */ | ||
120 | #define _RDR 0x01 | ||
121 | #define DELTA_DSR 0x02 | ||
122 | #define DELTA_RI 0x04 | ||
123 | #define DELTA_CD 0x08 | ||
124 | #define _CTS 0x10 | ||
125 | #define _DSR 0x20 | ||
126 | #define _RI 0x40 | ||
127 | #define _CD 0x80 | ||
128 | |||
129 | /* prototypes */ | ||
130 | void uart_init( uart_dev_t *u, int bitrate ); | ||
131 | void uart_out( uart_dev_t *u, char c ); | ||
132 | void uart_puts( uart_dev_t *u, char *s ); | ||
133 | char uart_in( uart_dev_t *u ); | ||
134 | void uart_enable_rcvr_int( uart_dev_t *u ); | ||
135 | void uart_disable_rcvr_int( uart_dev_t *u ); | ||
136 | |||
137 | #ifdef DUART16552_1_VADDR | ||
138 | /* DUART present. */ | ||
139 | #define DUART_1_BASE (*(uart_dev_t*)DUART16552_1_VADDR) | ||
140 | #define DUART_2_BASE (*(uart_dev_t*)DUART16552_2_VADDR) | ||
141 | #define UART1_PUTS(s) uart_puts( &DUART_1_BASE, s ) | ||
142 | #define UART2_PUTS(s) uart_puts( &DUART_2_BASE, s ) | ||
143 | #else | ||
144 | /* DUART not configured, use dummy placeholders to allow compiles to work. */ | ||
145 | #define DUART_1_BASE (*(uart_dev_t*)0) | ||
146 | #define DUART_2_BASE (*(uart_dev_t*)0) | ||
147 | #define UART1_PUTS(s) | ||
148 | #define UART2_PUTS(s) | ||
149 | #endif | ||
150 | |||
151 | /* Compute 16-bit divisor for baudrate generator, with rounding: */ | ||
152 | #define DUART_DIVISOR(crystal,speed) (((crystal)/16 + (speed)/2)/(speed)) | ||
153 | |||
154 | #endif /*_uart_h_included_*/ | ||
155 | |||
diff --git a/include/asm-xtensa/xtensa/xt2000.h b/include/asm-xtensa/xtensa/xt2000.h new file mode 100644 index 000000000000..703a45002f8f --- /dev/null +++ b/include/asm-xtensa/xtensa/xt2000.h | |||
@@ -0,0 +1,408 @@ | |||
1 | #ifndef _INC_XT2000_H_ | ||
2 | #define _INC_XT2000_H_ | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * include/asm-xtensa/xtensa/xt2000.h - Definitions specific to the | ||
8 | * Tensilica XT2000 Emulation Board | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | * | ||
14 | * Copyright (C) 2002 Tensilica Inc. | ||
15 | */ | ||
16 | |||
17 | |||
18 | #include <xtensa/config/core.h> | ||
19 | #include <xtensa/config/system.h> | ||
20 | |||
21 | |||
22 | /* | ||
23 | * Default assignment of XT2000 devices to external interrupts. | ||
24 | */ | ||
25 | |||
26 | /* Ethernet interrupt: */ | ||
27 | #ifdef XCHAL_EXTINT3_NUM | ||
28 | #define SONIC83934_INTNUM XCHAL_EXTINT3_NUM | ||
29 | #define SONIC83934_INTLEVEL XCHAL_EXTINT3_LEVEL | ||
30 | #define SONIC83934_INTMASK XCHAL_EXTINT3_MASK | ||
31 | #else | ||
32 | #define SONIC83934_INTMASK 0 | ||
33 | #endif | ||
34 | |||
35 | /* DUART channel 1 interrupt (P1 - console): */ | ||
36 | #ifdef XCHAL_EXTINT4_NUM | ||
37 | #define DUART16552_1_INTNUM XCHAL_EXTINT4_NUM | ||
38 | #define DUART16552_1_INTLEVEL XCHAL_EXTINT4_LEVEL | ||
39 | #define DUART16552_1_INTMASK XCHAL_EXTINT4_MASK | ||
40 | #else | ||
41 | #define DUART16552_1_INTMASK 0 | ||
42 | #endif | ||
43 | |||
44 | /* DUART channel 2 interrupt (P2 - 2nd serial port): */ | ||
45 | #ifdef XCHAL_EXTINT5_NUM | ||
46 | #define DUART16552_2_INTNUM XCHAL_EXTINT5_NUM | ||
47 | #define DUART16552_2_INTLEVEL XCHAL_EXTINT5_LEVEL | ||
48 | #define DUART16552_2_INTMASK XCHAL_EXTINT5_MASK | ||
49 | #else | ||
50 | #define DUART16552_2_INTMASK 0 | ||
51 | #endif | ||
52 | |||
53 | /* FPGA-combined PCI/etc interrupts: */ | ||
54 | #ifdef XCHAL_EXTINT6_NUM | ||
55 | #define XT2000_FPGAPCI_INTNUM XCHAL_EXTINT6_NUM | ||
56 | #define XT2000_FPGAPCI_INTLEVEL XCHAL_EXTINT6_LEVEL | ||
57 | #define XT2000_FPGAPCI_INTMASK XCHAL_EXTINT6_MASK | ||
58 | #else | ||
59 | #define XT2000_FPGAPCI_INTMASK 0 | ||
60 | #endif | ||
61 | |||
62 | |||
63 | |||
64 | /* | ||
65 | * Device addresses. | ||
66 | * | ||
67 | * Note: for endianness-independence, use 32-bit loads and stores for all | ||
68 | * register accesses to Ethernet, DUART and LED devices. Undefined bits | ||
69 | * may need to be masked out if needed when reading if the actual register | ||
70 | * size is smaller than 32 bits. | ||
71 | * | ||
72 | * Note: XT2000 bus byte lanes are defined in terms of msbyte and lsbyte | ||
73 | * relative to the processor. So 32-bit registers are accessed consistently | ||
74 | * from both big and little endian processors. However, this means byte | ||
75 | * sequences are not consistent between big and little endian processors. | ||
76 | * This is fine for RAM, and for ROM if ROM is created for a specific | ||
77 | * processor (and thus has correct byte sequences). However this may be | ||
78 | * unexpected for Flash, which might contain a file-system that one wants | ||
79 | * to use for multiple processor configurations (eg. the Flash might contain | ||
80 | * the Ethernet card's address, endianness-independent application data, etc). | ||
81 | * That is, byte sequences written in Flash by a core of a given endianness | ||
82 | * will be byte-swapped when seen by a core of the other endianness. | ||
83 | * Someone implementing an endianness-independent Flash file system will | ||
84 | * likely handle this byte-swapping issue in the Flash driver software. | ||
85 | */ | ||
86 | |||
87 | #define DUART16552_XTAL_FREQ 18432000 /* crystal frequency in Hz */ | ||
88 | #define XTBOARD_FLASH_MAXSIZE 0x4000000 /* 64 MB (max; depends on what is socketed!) */ | ||
89 | #define XTBOARD_EPROM_MAXSIZE 0x0400000 /* 4 MB (max; depends on what is socketed!) */ | ||
90 | #define XTBOARD_EEPROM_MAXSIZE 0x0080000 /* 512 kB (max; depends on what is socketed!) */ | ||
91 | #define XTBOARD_ASRAM_SIZE 0x0100000 /* 1 MB */ | ||
92 | #define XTBOARD_PCI_MEM_SIZE 0x8000000 /* 128 MB (allocated) */ | ||
93 | #define XTBOARD_PCI_IO_SIZE 0x1000000 /* 16 MB (allocated) */ | ||
94 | |||
95 | #ifdef XSHAL_IOBLOCK_BYPASS_PADDR | ||
96 | /* PCI memory space: */ | ||
97 | # define XTBOARD_PCI_MEM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0x0000000) | ||
98 | /* Socketed Flash (eg. 2 x 16-bit devices): */ | ||
99 | # define XTBOARD_FLASH_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0x8000000) | ||
100 | /* PCI I/O space: */ | ||
101 | # define XTBOARD_PCI_IO_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xC000000) | ||
102 | /* V3 PCI interface chip register/config space: */ | ||
103 | # define XTBOARD_V3PCI_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD000000) | ||
104 | /* Bus Interface registers: */ | ||
105 | # define XTBOARD_BUSINT_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD010000) | ||
106 | /* FPGA registers: */ | ||
107 | # define XT2000_FPGAREGS_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD020000) | ||
108 | /* SONIC SN83934 Ethernet controller/transceiver: */ | ||
109 | # define SONIC83934_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD030000) | ||
110 | /* 8-character bitmapped LED display: */ | ||
111 | # define XTBOARD_LED_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD040000) | ||
112 | /* National-Semi PC16552D DUART: */ | ||
113 | # define DUART16552_1_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD050020) /* channel 1 (P1 - console) */ | ||
114 | # define DUART16552_2_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD050000) /* channel 2 (P2) */ | ||
115 | /* Asynchronous Static RAM: */ | ||
116 | # define XTBOARD_ASRAM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD400000) | ||
117 | /* 8-bit EEPROM: */ | ||
118 | # define XTBOARD_EEPROM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD600000) | ||
119 | /* 2 x 16-bit EPROMs: */ | ||
120 | # define XTBOARD_EPROM_PADDR (XSHAL_IOBLOCK_BYPASS_PADDR+0xD800000) | ||
121 | #endif /* XSHAL_IOBLOCK_BYPASS_PADDR */ | ||
122 | |||
123 | /* These devices might be accessed cached: */ | ||
124 | #ifdef XSHAL_IOBLOCK_CACHED_PADDR | ||
125 | # define XTBOARD_PCI_MEM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0x0000000) | ||
126 | # define XTBOARD_FLASH_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0x8000000) | ||
127 | # define XTBOARD_ASRAM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0xD400000) | ||
128 | # define XTBOARD_EEPROM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0xD600000) | ||
129 | # define XTBOARD_EPROM_CACHED_PADDR (XSHAL_IOBLOCK_CACHED_PADDR+0xD800000) | ||
130 | #endif /* XSHAL_IOBLOCK_CACHED_PADDR */ | ||
131 | |||
132 | |||
133 | /*** Same thing over again, this time with virtual addresses: ***/ | ||
134 | |||
135 | #ifdef XSHAL_IOBLOCK_BYPASS_VADDR | ||
136 | /* PCI memory space: */ | ||
137 | # define XTBOARD_PCI_MEM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0x0000000) | ||
138 | /* Socketed Flash (eg. 2 x 16-bit devices): */ | ||
139 | # define XTBOARD_FLASH_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0x8000000) | ||
140 | /* PCI I/O space: */ | ||
141 | # define XTBOARD_PCI_IO_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xC000000) | ||
142 | /* V3 PCI interface chip register/config space: */ | ||
143 | # define XTBOARD_V3PCI_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD000000) | ||
144 | /* Bus Interface registers: */ | ||
145 | # define XTBOARD_BUSINT_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD010000) | ||
146 | /* FPGA registers: */ | ||
147 | # define XT2000_FPGAREGS_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD020000) | ||
148 | /* SONIC SN83934 Ethernet controller/transceiver: */ | ||
149 | # define SONIC83934_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD030000) | ||
150 | /* 8-character bitmapped LED display: */ | ||
151 | # define XTBOARD_LED_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD040000) | ||
152 | /* National-Semi PC16552D DUART: */ | ||
153 | # define DUART16552_1_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD050020) /* channel 1 (P1 - console) */ | ||
154 | # define DUART16552_2_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD050000) /* channel 2 (P2) */ | ||
155 | /* Asynchronous Static RAM: */ | ||
156 | # define XTBOARD_ASRAM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD400000) | ||
157 | /* 8-bit EEPROM: */ | ||
158 | # define XTBOARD_EEPROM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD600000) | ||
159 | /* 2 x 16-bit EPROMs: */ | ||
160 | # define XTBOARD_EPROM_VADDR (XSHAL_IOBLOCK_BYPASS_VADDR+0xD800000) | ||
161 | #endif /* XSHAL_IOBLOCK_BYPASS_VADDR */ | ||
162 | |||
163 | /* These devices might be accessed cached: */ | ||
164 | #ifdef XSHAL_IOBLOCK_CACHED_VADDR | ||
165 | # define XTBOARD_PCI_MEM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0x0000000) | ||
166 | # define XTBOARD_FLASH_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0x8000000) | ||
167 | # define XTBOARD_ASRAM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0xD400000) | ||
168 | # define XTBOARD_EEPROM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0xD600000) | ||
169 | # define XTBOARD_EPROM_CACHED_VADDR (XSHAL_IOBLOCK_CACHED_VADDR+0xD800000) | ||
170 | #endif /* XSHAL_IOBLOCK_CACHED_VADDR */ | ||
171 | |||
172 | |||
173 | /* System ROM: */ | ||
174 | #define XTBOARD_ROM_SIZE XSHAL_ROM_SIZE | ||
175 | #ifdef XSHAL_ROM_VADDR | ||
176 | #define XTBOARD_ROM_VADDR XSHAL_ROM_VADDR | ||
177 | #endif | ||
178 | #ifdef XSHAL_ROM_PADDR | ||
179 | #define XTBOARD_ROM_PADDR XSHAL_ROM_PADDR | ||
180 | #endif | ||
181 | |||
182 | /* System RAM: */ | ||
183 | #define XTBOARD_RAM_SIZE XSHAL_RAM_SIZE | ||
184 | #ifdef XSHAL_RAM_VADDR | ||
185 | #define XTBOARD_RAM_VADDR XSHAL_RAM_VADDR | ||
186 | #endif | ||
187 | #ifdef XSHAL_RAM_PADDR | ||
188 | #define XTBOARD_RAM_PADDR XSHAL_RAM_PADDR | ||
189 | #endif | ||
190 | #define XTBOARD_RAM_BYPASS_VADDR XSHAL_RAM_BYPASS_VADDR | ||
191 | #define XTBOARD_RAM_BYPASS_PADDR XSHAL_RAM_BYPASS_PADDR | ||
192 | |||
193 | |||
194 | |||
195 | /* | ||
196 | * Things that depend on device addresses. | ||
197 | */ | ||
198 | |||
199 | |||
200 | #define XTBOARD_CACHEATTR_WRITEBACK XSHAL_XT2000_CACHEATTR_WRITEBACK | ||
201 | #define XTBOARD_CACHEATTR_WRITEALLOC XSHAL_XT2000_CACHEATTR_WRITEALLOC | ||
202 | #define XTBOARD_CACHEATTR_WRITETHRU XSHAL_XT2000_CACHEATTR_WRITETHRU | ||
203 | #define XTBOARD_CACHEATTR_BYPASS XSHAL_XT2000_CACHEATTR_BYPASS | ||
204 | #define XTBOARD_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_DEFAULT | ||
205 | |||
206 | #define XTBOARD_BUSINT_PIPE_REGIONS XSHAL_XT2000_PIPE_REGIONS | ||
207 | #define XTBOARD_BUSINT_SDRAM_REGIONS XSHAL_XT2000_SDRAM_REGIONS | ||
208 | |||
209 | |||
210 | |||
211 | /* | ||
212 | * BusLogic (FPGA) registers. | ||
213 | * All these registers are normally accessed using 32-bit loads/stores. | ||
214 | */ | ||
215 | |||
216 | /* Register offsets: */ | ||
217 | #define XT2000_DATECD_OFS 0x00 /* date code (read-only) */ | ||
218 | #define XT2000_STSREG_OFS 0x04 /* status (read-only) */ | ||
219 | #define XT2000_SYSLED_OFS 0x08 /* system LED */ | ||
220 | #define XT2000_WRPROT_OFS 0x0C /* write protect */ | ||
221 | #define XT2000_SWRST_OFS 0x10 /* software reset */ | ||
222 | #define XT2000_SYSRST_OFS 0x14 /* system (peripherals) reset */ | ||
223 | #define XT2000_IMASK_OFS 0x18 /* interrupt mask */ | ||
224 | #define XT2000_ISTAT_OFS 0x1C /* interrupt status */ | ||
225 | #define XT2000_V3CFG_OFS 0x20 /* V3 config (V320 PCI) */ | ||
226 | |||
227 | /* Physical register addresses: */ | ||
228 | #ifdef XT2000_FPGAREGS_PADDR | ||
229 | #define XT2000_DATECD_PADDR (XT2000_FPGAREGS_PADDR+XT2000_DATECD_OFS) | ||
230 | #define XT2000_STSREG_PADDR (XT2000_FPGAREGS_PADDR+XT2000_STSREG_OFS) | ||
231 | #define XT2000_SYSLED_PADDR (XT2000_FPGAREGS_PADDR+XT2000_SYSLED_OFS) | ||
232 | #define XT2000_WRPROT_PADDR (XT2000_FPGAREGS_PADDR+XT2000_WRPROT_OFS) | ||
233 | #define XT2000_SWRST_PADDR (XT2000_FPGAREGS_PADDR+XT2000_SWRST_OFS) | ||
234 | #define XT2000_SYSRST_PADDR (XT2000_FPGAREGS_PADDR+XT2000_SYSRST_OFS) | ||
235 | #define XT2000_IMASK_PADDR (XT2000_FPGAREGS_PADDR+XT2000_IMASK_OFS) | ||
236 | #define XT2000_ISTAT_PADDR (XT2000_FPGAREGS_PADDR+XT2000_ISTAT_OFS) | ||
237 | #define XT2000_V3CFG_PADDR (XT2000_FPGAREGS_PADDR+XT2000_V3CFG_OFS) | ||
238 | #endif | ||
239 | |||
240 | /* Virtual register addresses: */ | ||
241 | #ifdef XT2000_FPGAREGS_VADDR | ||
242 | #define XT2000_DATECD_VADDR (XT2000_FPGAREGS_VADDR+XT2000_DATECD_OFS) | ||
243 | #define XT2000_STSREG_VADDR (XT2000_FPGAREGS_VADDR+XT2000_STSREG_OFS) | ||
244 | #define XT2000_SYSLED_VADDR (XT2000_FPGAREGS_VADDR+XT2000_SYSLED_OFS) | ||
245 | #define XT2000_WRPROT_VADDR (XT2000_FPGAREGS_VADDR+XT2000_WRPROT_OFS) | ||
246 | #define XT2000_SWRST_VADDR (XT2000_FPGAREGS_VADDR+XT2000_SWRST_OFS) | ||
247 | #define XT2000_SYSRST_VADDR (XT2000_FPGAREGS_VADDR+XT2000_SYSRST_OFS) | ||
248 | #define XT2000_IMASK_VADDR (XT2000_FPGAREGS_VADDR+XT2000_IMASK_OFS) | ||
249 | #define XT2000_ISTAT_VADDR (XT2000_FPGAREGS_VADDR+XT2000_ISTAT_OFS) | ||
250 | #define XT2000_V3CFG_VADDR (XT2000_FPGAREGS_VADDR+XT2000_V3CFG_OFS) | ||
251 | /* Register access (for C code): */ | ||
252 | #define XT2000_DATECD_REG (*(volatile unsigned*) XT2000_DATECD_VADDR) | ||
253 | #define XT2000_STSREG_REG (*(volatile unsigned*) XT2000_STSREG_VADDR) | ||
254 | #define XT2000_SYSLED_REG (*(volatile unsigned*) XT2000_SYSLED_VADDR) | ||
255 | #define XT2000_WRPROT_REG (*(volatile unsigned*) XT2000_WRPROT_VADDR) | ||
256 | #define XT2000_SWRST_REG (*(volatile unsigned*) XT2000_SWRST_VADDR) | ||
257 | #define XT2000_SYSRST_REG (*(volatile unsigned*) XT2000_SYSRST_VADDR) | ||
258 | #define XT2000_IMASK_REG (*(volatile unsigned*) XT2000_IMASK_VADDR) | ||
259 | #define XT2000_ISTAT_REG (*(volatile unsigned*) XT2000_ISTAT_VADDR) | ||
260 | #define XT2000_V3CFG_REG (*(volatile unsigned*) XT2000_V3CFG_VADDR) | ||
261 | #endif | ||
262 | |||
263 | /* DATECD (date code) bit fields: */ | ||
264 | |||
265 | /* BCD-coded month (01..12): */ | ||
266 | #define XT2000_DATECD_MONTH_SHIFT 24 | ||
267 | #define XT2000_DATECD_MONTH_BITS 8 | ||
268 | #define XT2000_DATECD_MONTH_MASK 0xFF000000 | ||
269 | /* BCD-coded day (01..31): */ | ||
270 | #define XT2000_DATECD_DAY_SHIFT 16 | ||
271 | #define XT2000_DATECD_DAY_BITS 8 | ||
272 | #define XT2000_DATECD_DAY_MASK 0x00FF0000 | ||
273 | /* BCD-coded year (2001..9999): */ | ||
274 | #define XT2000_DATECD_YEAR_SHIFT 0 | ||
275 | #define XT2000_DATECD_YEAR_BITS 16 | ||
276 | #define XT2000_DATECD_YEAR_MASK 0x0000FFFF | ||
277 | |||
278 | /* STSREG (status) bit fields: */ | ||
279 | |||
280 | /* Switch SW3 setting bit fields (0=off/up, 1=on/down): */ | ||
281 | #define XT2000_STSREG_SW3_SHIFT 0 | ||
282 | #define XT2000_STSREG_SW3_BITS 4 | ||
283 | #define XT2000_STSREG_SW3_MASK 0x0000000F | ||
284 | /* Boot-select bits of switch SW3: */ | ||
285 | #define XT2000_STSREG_BOOTSEL_SHIFT 0 | ||
286 | #define XT2000_STSREG_BOOTSEL_BITS 2 | ||
287 | #define XT2000_STSREG_BOOTSEL_MASK 0x00000003 | ||
288 | /* Boot-select values: */ | ||
289 | #define XT2000_STSREG_BOOTSEL_FLASH 0 | ||
290 | #define XT2000_STSREG_BOOTSEL_EPROM16 1 | ||
291 | #define XT2000_STSREG_BOOTSEL_PROM8 2 | ||
292 | #define XT2000_STSREG_BOOTSEL_ASRAM 3 | ||
293 | /* User-defined bits of switch SW3: */ | ||
294 | #define XT2000_STSREG_SW3_2_SHIFT 2 | ||
295 | #define XT2000_STSREG_SW3_2_MASK 0x00000004 | ||
296 | #define XT2000_STSREG_SW3_3_SHIFT 3 | ||
297 | #define XT2000_STSREG_SW3_3_MASK 0x00000008 | ||
298 | |||
299 | /* SYSLED (system LED) bit fields: */ | ||
300 | |||
301 | /* LED control bit (0=off, 1=on): */ | ||
302 | #define XT2000_SYSLED_LEDON_SHIFT 0 | ||
303 | #define XT2000_SYSLED_LEDON_MASK 0x00000001 | ||
304 | |||
305 | /* WRPROT (write protect) bit fields (0=writable, 1=write-protected [default]): */ | ||
306 | |||
307 | /* Flash write protect: */ | ||
308 | #define XT2000_WRPROT_FLWP_SHIFT 0 | ||
309 | #define XT2000_WRPROT_FLWP_MASK 0x00000001 | ||
310 | /* Reserved but present write protect bits: */ | ||
311 | #define XT2000_WRPROT_WRP_SHIFT 1 | ||
312 | #define XT2000_WRPROT_WRP_BITS 7 | ||
313 | #define XT2000_WRPROT_WRP_MASK 0x000000FE | ||
314 | |||
315 | /* SWRST (software reset; allows s/w to generate power-on equivalent reset): */ | ||
316 | |||
317 | /* Software reset bits: */ | ||
318 | #define XT2000_SWRST_SWR_SHIFT 0 | ||
319 | #define XT2000_SWRST_SWR_BITS 16 | ||
320 | #define XT2000_SWRST_SWR_MASK 0x0000FFFF | ||
321 | /* Software reset value -- writing this value resets the board: */ | ||
322 | #define XT2000_SWRST_RESETVALUE 0x0000DEAD | ||
323 | |||
324 | /* SYSRST (system reset; controls reset of individual peripherals): */ | ||
325 | |||
326 | /* All-device reset: */ | ||
327 | #define XT2000_SYSRST_ALL_SHIFT 0 | ||
328 | #define XT2000_SYSRST_ALL_BITS 4 | ||
329 | #define XT2000_SYSRST_ALL_MASK 0x0000000F | ||
330 | /* HDSP-2534 LED display reset (1=reset, 0=nothing): */ | ||
331 | #define XT2000_SYSRST_LED_SHIFT 0 | ||
332 | #define XT2000_SYSRST_LED_MASK 0x00000001 | ||
333 | /* Sonic DP83934 Ethernet controller reset (1=reset, 0=nothing): */ | ||
334 | #define XT2000_SYSRST_SONIC_SHIFT 1 | ||
335 | #define XT2000_SYSRST_SONIC_MASK 0x00000002 | ||
336 | /* DP16552 DUART reset (1=reset, 0=nothing): */ | ||
337 | #define XT2000_SYSRST_DUART_SHIFT 2 | ||
338 | #define XT2000_SYSRST_DUART_MASK 0x00000004 | ||
339 | /* V3 V320 PCI bridge controller reset (1=reset, 0=nothing): */ | ||
340 | #define XT2000_SYSRST_V3_SHIFT 3 | ||
341 | #define XT2000_SYSRST_V3_MASK 0x00000008 | ||
342 | |||
343 | /* IMASK (interrupt mask; 0=disable, 1=enable): */ | ||
344 | /* ISTAT (interrupt status; 0=inactive, 1=pending): */ | ||
345 | |||
346 | /* PCI INTP interrupt: */ | ||
347 | #define XT2000_INTMUX_PCI_INTP_SHIFT 2 | ||
348 | #define XT2000_INTMUX_PCI_INTP_MASK 0x00000004 | ||
349 | /* PCI INTS interrupt: */ | ||
350 | #define XT2000_INTMUX_PCI_INTS_SHIFT 3 | ||
351 | #define XT2000_INTMUX_PCI_INTS_MASK 0x00000008 | ||
352 | /* PCI INTD interrupt: */ | ||
353 | #define XT2000_INTMUX_PCI_INTD_SHIFT 4 | ||
354 | #define XT2000_INTMUX_PCI_INTD_MASK 0x00000010 | ||
355 | /* V320 PCI controller interrupt: */ | ||
356 | #define XT2000_INTMUX_V3_SHIFT 5 | ||
357 | #define XT2000_INTMUX_V3_MASK 0x00000020 | ||
358 | /* PCI ENUM interrupt: */ | ||
359 | #define XT2000_INTMUX_PCI_ENUM_SHIFT 6 | ||
360 | #define XT2000_INTMUX_PCI_ENUM_MASK 0x00000040 | ||
361 | /* PCI DEG interrupt: */ | ||
362 | #define XT2000_INTMUX_PCI_DEG_SHIFT 7 | ||
363 | #define XT2000_INTMUX_PCI_DEG_MASK 0x00000080 | ||
364 | |||
365 | /* V3CFG (V3 config, V320 PCI controller): */ | ||
366 | |||
367 | /* V3 address control (0=pass-thru, 1=V3 address bits 31:28 set to 4'b0001 [default]): */ | ||
368 | #define XT2000_V3CFG_V3ADC_SHIFT 0 | ||
369 | #define XT2000_V3CFG_V3ADC_MASK 0x00000001 | ||
370 | |||
371 | /* I2C Devices */ | ||
372 | |||
373 | #define XT2000_I2C_RTC_ID 0x68 | ||
374 | #define XT2000_I2C_NVRAM0_ID 0x56 /* 1st 256 byte block */ | ||
375 | #define XT2000_I2C_NVRAM1_ID 0x57 /* 2nd 256 byte block */ | ||
376 | |||
377 | /* NVRAM Board Info structure: */ | ||
378 | |||
379 | #define XT2000_NVRAM_SIZE 512 | ||
380 | |||
381 | #define XT2000_NVRAM_BINFO_START 0x100 | ||
382 | #define XT2000_NVRAM_BINFO_SIZE 0x20 | ||
383 | #define XT2000_NVRAM_BINFO_VERSION 0x10 /* version 1.0 */ | ||
384 | #if 0 | ||
385 | #define XT2000_NVRAM_BINFO_VERSION_OFFSET 0x00 | ||
386 | #define XT2000_NVRAM_BINFO_VERSION_SIZE 0x1 | ||
387 | #define XT2000_NVRAM_BINFO_ETH_ADDR_OFFSET 0x02 | ||
388 | #define XT2000_NVRAM_BINFO_ETH_ADDR_SIZE 0x6 | ||
389 | #define XT2000_NVRAM_BINFO_SN_OFFSET 0x10 | ||
390 | #define XT2000_NVRAM_BINFO_SN_SIZE 0xE | ||
391 | #define XT2000_NVRAM_BINFO_CRC_OFFSET 0x1E | ||
392 | #define XT2000_NVRAM_BINFO_CRC_SIZE 0x2 | ||
393 | #endif /*0*/ | ||
394 | |||
395 | #if !defined(__ASSEMBLY__) && !defined(_NOCLANGUAGE) | ||
396 | typedef struct xt2000_nvram_binfo { | ||
397 | unsigned char version; | ||
398 | unsigned char reserved1; | ||
399 | unsigned char eth_addr[6]; | ||
400 | unsigned char reserved8[8]; | ||
401 | unsigned char serialno[14]; | ||
402 | unsigned char crc[2]; /* 16-bit CRC */ | ||
403 | } xt2000_nvram_binfo; | ||
404 | #endif /*!__ASSEMBLY__ && !_NOCLANGUAGE*/ | ||
405 | |||
406 | |||
407 | #endif /*_INC_XT2000_H_*/ | ||
408 | |||
diff --git a/include/asm-xtensa/xtensa/xtboard.h b/include/asm-xtensa/xtensa/xtboard.h new file mode 100644 index 000000000000..22469c175307 --- /dev/null +++ b/include/asm-xtensa/xtensa/xtboard.h | |||
@@ -0,0 +1,120 @@ | |||
1 | #ifndef _xtboard_h_included_ | ||
2 | #define _xtboard_h_included_ | ||
3 | |||
4 | /* | ||
5 | * THIS FILE IS GENERATED -- DO NOT MODIFY BY HAND | ||
6 | * | ||
7 | * xtboard.h -- Routines for getting useful information from the board. | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file "COPYING" in the main directory of this archive | ||
11 | * for more details. | ||
12 | * | ||
13 | * Copyright (C) 2002 Tensilica Inc. | ||
14 | */ | ||
15 | |||
16 | |||
17 | #include <xtensa/xt2000.h> | ||
18 | |||
19 | #define XTBOARD_RTC_ERROR -1 | ||
20 | #define XTBOARD_RTC_STOPPED -2 | ||
21 | |||
22 | |||
23 | /* xt2000-i2cdev.c: */ | ||
24 | typedef void XtboardDelayFunc( unsigned ); | ||
25 | extern XtboardDelayFunc* xtboard_set_nsdelay_func( XtboardDelayFunc *delay_fn ); | ||
26 | extern int xtboard_i2c_read (unsigned id, unsigned char *buf, unsigned addr, unsigned size); | ||
27 | extern int xtboard_i2c_write(unsigned id, unsigned char *buf, unsigned addr, unsigned size); | ||
28 | extern int xtboard_i2c_wait_nvram_ack(unsigned id, unsigned swtimer); | ||
29 | |||
30 | /* xtboard.c: */ | ||
31 | extern int xtboard_nvram_read (unsigned addr, unsigned len, unsigned char *buf); | ||
32 | extern int xtboard_nvram_write(unsigned addr, unsigned len, unsigned char *buf); | ||
33 | extern int xtboard_nvram_binfo_read (xt2000_nvram_binfo *buf); | ||
34 | extern int xtboard_nvram_binfo_write(xt2000_nvram_binfo *buf); | ||
35 | extern int xtboard_nvram_binfo_valid(xt2000_nvram_binfo *buf); | ||
36 | extern int xtboard_ethermac_get(unsigned char *buf); | ||
37 | extern int xtboard_ethermac_set(unsigned char *buf); | ||
38 | |||
39 | /*+*---------------------------------------------------------------------------- | ||
40 | / Function: xtboard_get_rtc_time | ||
41 | / | ||
42 | / Description: Get time stored in real-time clock. | ||
43 | / | ||
44 | / Returns: time in seconds stored in real-time clock. | ||
45 | /-**----------------------------------------------------------------------------*/ | ||
46 | |||
47 | extern unsigned xtboard_get_rtc_time(void); | ||
48 | |||
49 | /*+*---------------------------------------------------------------------------- | ||
50 | / Function: xtboard_set_rtc_time | ||
51 | / | ||
52 | / Description: Set time stored in real-time clock. | ||
53 | / | ||
54 | / Parameters: time -- time in seconds to store to real-time clock | ||
55 | / | ||
56 | / Returns: 0 on success, xtboard_i2c_write() error code otherwise. | ||
57 | /-**----------------------------------------------------------------------------*/ | ||
58 | |||
59 | extern int xtboard_set_rtc_time(unsigned time); | ||
60 | |||
61 | |||
62 | /* xtfreq.c: */ | ||
63 | /*+*---------------------------------------------------------------------------- | ||
64 | / Function: xtboard_measure_sys_clk | ||
65 | / | ||
66 | / Description: Get frequency of system clock. | ||
67 | / | ||
68 | / Parameters: none | ||
69 | / | ||
70 | / Returns: frequency of system clock. | ||
71 | /-**----------------------------------------------------------------------------*/ | ||
72 | |||
73 | extern unsigned xtboard_measure_sys_clk(void); | ||
74 | |||
75 | |||
76 | #if 0 /* old stuff from xtboard.c: */ | ||
77 | |||
78 | /*+*---------------------------------------------------------------------------- | ||
79 | / Function: xtboard_nvram valid | ||
80 | / | ||
81 | / Description: Determines if data in NVRAM is valid. | ||
82 | / | ||
83 | / Parameters: delay -- 10us delay function | ||
84 | / | ||
85 | / Returns: 1 if NVRAM is valid, 0 otherwise | ||
86 | /-**----------------------------------------------------------------------------*/ | ||
87 | |||
88 | extern unsigned xtboard_nvram_valid(void (*delay)( void )); | ||
89 | |||
90 | /*+*---------------------------------------------------------------------------- | ||
91 | / Function: xtboard_get_nvram_contents | ||
92 | / | ||
93 | / Description: Returns contents of NVRAM. | ||
94 | / | ||
95 | / Parameters: buf -- buffer to NVRAM contents. | ||
96 | / delay -- 10us delay function | ||
97 | / | ||
98 | / Returns: 1 if NVRAM is valid, 0 otherwise | ||
99 | /-**----------------------------------------------------------------------------*/ | ||
100 | |||
101 | extern unsigned xtboard_get_nvram_contents(unsigned char *buf, void (*delay)( void )); | ||
102 | |||
103 | /*+*---------------------------------------------------------------------------- | ||
104 | / Function: xtboard_get_ether_addr | ||
105 | / | ||
106 | / Description: Returns ethernet address of board. | ||
107 | / | ||
108 | / Parameters: buf -- buffer to store ethernet address | ||
109 | / delay -- 10us delay function | ||
110 | / | ||
111 | / Returns: nothing. | ||
112 | /-**----------------------------------------------------------------------------*/ | ||
113 | |||
114 | extern void xtboard_get_ether_addr(unsigned char *buf, void (*delay)( void )); | ||
115 | |||
116 | #endif /*0*/ | ||
117 | |||
118 | |||
119 | #endif /*_xtboard_h_included_*/ | ||
120 | |||
diff --git a/include/linux/a.out.h b/include/linux/a.out.h index af8a1dfa5c32..f913cc3e1b0d 100644 --- a/include/linux/a.out.h +++ b/include/linux/a.out.h | |||
@@ -138,7 +138,7 @@ enum machine_type { | |||
138 | #endif | 138 | #endif |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1)) | 141 | #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) |
142 | 142 | ||
143 | #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) | 143 | #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) |
144 | 144 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index aefe6d051ace..b123cc08773d 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -25,6 +25,10 @@ | |||
25 | #ifndef _LINUX_ACPI_H | 25 | #ifndef _LINUX_ACPI_H |
26 | #define _LINUX_ACPI_H | 26 | #define _LINUX_ACPI_H |
27 | 27 | ||
28 | #include <linux/config.h> | ||
29 | |||
30 | #ifdef CONFIG_ACPI | ||
31 | |||
28 | #ifndef _LINUX | 32 | #ifndef _LINUX |
29 | #define _LINUX | 33 | #define _LINUX |
30 | #endif | 34 | #endif |
@@ -533,4 +537,5 @@ static inline int acpi_get_pxm(acpi_handle handle) | |||
533 | 537 | ||
534 | extern int pnpacpi_disabled; | 538 | extern int pnpacpi_disabled; |
535 | 539 | ||
536 | #endif /*_LINUX_ACPI_H*/ | 540 | #endif /* CONFIG_ACPI */ |
541 | #endif /*_LINUX_ACPI_H*/ | ||
diff --git a/include/linux/arcfb.h b/include/linux/arcfb.h new file mode 100644 index 000000000000..721e7654daeb --- /dev/null +++ b/include/linux/arcfb.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __LINUX_ARCFB_H__ | ||
2 | #define __LINUX_ARCFB_H__ | ||
3 | |||
4 | #define FBIO_WAITEVENT _IO('F', 0x88) | ||
5 | #define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t) | ||
6 | |||
7 | #endif | ||
8 | |||
diff --git a/include/linux/ata.h b/include/linux/ata.h index f178894edd04..ca5fcadf9981 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -224,6 +224,7 @@ struct ata_taskfile { | |||
224 | }; | 224 | }; |
225 | 225 | ||
226 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) | 226 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) |
227 | #define ata_id_is_sata(id) ((id)[93] == 0) | ||
227 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) | 228 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) |
228 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) | 229 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) |
229 | #define ata_id_has_flush(id) ((id)[83] & (1 << 12)) | 230 | #define ata_id_has_flush(id) ((id)[83] & (1 << 12)) |
diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 31d3fc25ccbd..09a1451c1159 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) | 20 | #define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) |
21 | 21 | ||
22 | struct atalk_addr { | 22 | struct atalk_addr { |
23 | __u16 s_net; | 23 | __be16 s_net; |
24 | __u8 s_node; | 24 | __u8 s_node; |
25 | }; | 25 | }; |
26 | 26 | ||
@@ -33,8 +33,8 @@ struct sockaddr_at { | |||
33 | 33 | ||
34 | struct atalk_netrange { | 34 | struct atalk_netrange { |
35 | __u8 nr_phase; | 35 | __u8 nr_phase; |
36 | __u16 nr_firstnet; | 36 | __be16 nr_firstnet; |
37 | __u16 nr_lastnet; | 37 | __be16 nr_lastnet; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | #ifdef __KERNEL__ | 40 | #ifdef __KERNEL__ |
@@ -70,8 +70,8 @@ struct atalk_iface { | |||
70 | struct atalk_sock { | 70 | struct atalk_sock { |
71 | /* struct sock has to be the first member of atalk_sock */ | 71 | /* struct sock has to be the first member of atalk_sock */ |
72 | struct sock sk; | 72 | struct sock sk; |
73 | unsigned short dest_net; | 73 | __be16 dest_net; |
74 | unsigned short src_net; | 74 | __be16 src_net; |
75 | unsigned char dest_node; | 75 | unsigned char dest_node; |
76 | unsigned char src_node; | 76 | unsigned char src_node; |
77 | unsigned char dest_port; | 77 | unsigned char dest_port; |
@@ -95,9 +95,9 @@ struct ddpehdr { | |||
95 | deh_hops:4, | 95 | deh_hops:4, |
96 | deh_len:10; | 96 | deh_len:10; |
97 | #endif | 97 | #endif |
98 | __u16 deh_sum; | 98 | __be16 deh_sum; |
99 | __u16 deh_dnet; | 99 | __be16 deh_dnet; |
100 | __u16 deh_snet; | 100 | __be16 deh_snet; |
101 | __u8 deh_dnode; | 101 | __u8 deh_dnode; |
102 | __u8 deh_snode; | 102 | __u8 deh_snode; |
103 | __u8 deh_dport; | 103 | __u8 deh_dport; |
@@ -142,24 +142,24 @@ struct ddpshdr { | |||
142 | 142 | ||
143 | /* AppleTalk AARP headers */ | 143 | /* AppleTalk AARP headers */ |
144 | struct elapaarp { | 144 | struct elapaarp { |
145 | __u16 hw_type; | 145 | __be16 hw_type; |
146 | #define AARP_HW_TYPE_ETHERNET 1 | 146 | #define AARP_HW_TYPE_ETHERNET 1 |
147 | #define AARP_HW_TYPE_TOKENRING 2 | 147 | #define AARP_HW_TYPE_TOKENRING 2 |
148 | __u16 pa_type; | 148 | __be16 pa_type; |
149 | __u8 hw_len; | 149 | __u8 hw_len; |
150 | __u8 pa_len; | 150 | __u8 pa_len; |
151 | #define AARP_PA_ALEN 4 | 151 | #define AARP_PA_ALEN 4 |
152 | __u16 function; | 152 | __be16 function; |
153 | #define AARP_REQUEST 1 | 153 | #define AARP_REQUEST 1 |
154 | #define AARP_REPLY 2 | 154 | #define AARP_REPLY 2 |
155 | #define AARP_PROBE 3 | 155 | #define AARP_PROBE 3 |
156 | __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); | 156 | __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); |
157 | __u8 pa_src_zero __attribute__ ((packed)); | 157 | __u8 pa_src_zero __attribute__ ((packed)); |
158 | __u16 pa_src_net __attribute__ ((packed)); | 158 | __be16 pa_src_net __attribute__ ((packed)); |
159 | __u8 pa_src_node __attribute__ ((packed)); | 159 | __u8 pa_src_node __attribute__ ((packed)); |
160 | __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); | 160 | __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); |
161 | __u8 pa_dst_zero __attribute__ ((packed)); | 161 | __u8 pa_dst_zero __attribute__ ((packed)); |
162 | __u16 pa_dst_net __attribute__ ((packed)); | 162 | __be16 pa_dst_net __attribute__ ((packed)); |
163 | __u8 pa_dst_node __attribute__ ((packed)); | 163 | __u8 pa_dst_node __attribute__ ((packed)); |
164 | }; | 164 | }; |
165 | 165 | ||
diff --git a/include/linux/audit.h b/include/linux/audit.h index 19f04b049798..bf2ad3ba72eb 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -27,15 +27,52 @@ | |||
27 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
28 | #include <linux/elf.h> | 28 | #include <linux/elf.h> |
29 | 29 | ||
30 | /* Request and reply types */ | 30 | /* The netlink messages for the audit system is divided into blocks: |
31 | #define AUDIT_GET 1000 /* Get status */ | 31 | * 1000 - 1099 are for commanding the audit system |
32 | #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ | 32 | * 1100 - 1199 user space trusted application messages |
33 | #define AUDIT_LIST 1002 /* List filtering rules */ | 33 | * 1200 - 1299 messages internal to the audit daemon |
34 | #define AUDIT_ADD 1003 /* Add filtering rule */ | 34 | * 1300 - 1399 audit event messages |
35 | #define AUDIT_DEL 1004 /* Delete filtering rule */ | 35 | * 1400 - 1499 SE Linux use |
36 | #define AUDIT_USER 1005 /* Send a message from user-space */ | 36 | * 1500 - 1999 future use |
37 | #define AUDIT_LOGIN 1006 /* Define the login id and informaiton */ | 37 | * 2000 is for otherwise unclassified kernel audit messages |
38 | #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ | 38 | * |
39 | * Messages from 1000-1199 are bi-directional. 1200-1299 are exclusively user | ||
40 | * space. Anything over that is kernel --> user space communication. | ||
41 | */ | ||
42 | #define AUDIT_GET 1000 /* Get status */ | ||
43 | #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ | ||
44 | #define AUDIT_LIST 1002 /* List syscall filtering rules */ | ||
45 | #define AUDIT_ADD 1003 /* Add syscall filtering rule */ | ||
46 | #define AUDIT_DEL 1004 /* Delete syscall filtering rule */ | ||
47 | #define AUDIT_USER 1005 /* Message from userspace -- deprecated */ | ||
48 | #define AUDIT_LOGIN 1006 /* Define the login id and information */ | ||
49 | #define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ | ||
50 | #define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ | ||
51 | #define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ | ||
52 | #define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ | ||
53 | |||
54 | #define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages uninteresting to kernel */ | ||
55 | #define AUDIT_LAST_USER_MSG 1199 | ||
56 | |||
57 | #define AUDIT_DAEMON_START 1200 /* Daemon startup record */ | ||
58 | #define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ | ||
59 | #define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */ | ||
60 | #define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */ | ||
61 | |||
62 | #define AUDIT_SYSCALL 1300 /* Syscall event */ | ||
63 | #define AUDIT_FS_WATCH 1301 /* Filesystem watch event */ | ||
64 | #define AUDIT_PATH 1302 /* Filename path information */ | ||
65 | #define AUDIT_IPC 1303 /* IPC record */ | ||
66 | #define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */ | ||
67 | #define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */ | ||
68 | #define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */ | ||
69 | #define AUDIT_CWD 1307 /* Current working directory */ | ||
70 | |||
71 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ | ||
72 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ | ||
73 | #define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ | ||
74 | |||
75 | #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ | ||
39 | 76 | ||
40 | /* Rule flags */ | 77 | /* Rule flags */ |
41 | #define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ | 78 | #define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ |
@@ -132,16 +169,9 @@ | |||
132 | #define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) | 169 | #define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) |
133 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | 170 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
134 | 171 | ||
135 | #ifndef __KERNEL__ | ||
136 | struct audit_message { | ||
137 | struct nlmsghdr nlh; | ||
138 | char data[1200]; | ||
139 | }; | ||
140 | #endif | ||
141 | |||
142 | struct audit_status { | 172 | struct audit_status { |
143 | __u32 mask; /* Bit mask for valid entries */ | 173 | __u32 mask; /* Bit mask for valid entries */ |
144 | __u32 enabled; /* 1 = enabled, 0 = disbaled */ | 174 | __u32 enabled; /* 1 = enabled, 0 = disabled */ |
145 | __u32 failure; /* Failure-to-log action */ | 175 | __u32 failure; /* Failure-to-log action */ |
146 | __u32 pid; /* pid of auditd process */ | 176 | __u32 pid; /* pid of auditd process */ |
147 | __u32 rate_limit; /* messages rate limit (per second) */ | 177 | __u32 rate_limit; /* messages rate limit (per second) */ |
@@ -161,6 +191,11 @@ struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ | |||
161 | 191 | ||
162 | #ifdef __KERNEL__ | 192 | #ifdef __KERNEL__ |
163 | 193 | ||
194 | struct audit_sig_info { | ||
195 | uid_t uid; | ||
196 | pid_t pid; | ||
197 | }; | ||
198 | |||
164 | struct audit_buffer; | 199 | struct audit_buffer; |
165 | struct audit_context; | 200 | struct audit_context; |
166 | struct inode; | 201 | struct inode; |
@@ -185,11 +220,16 @@ extern void audit_inode(const char *name, const struct inode *inode); | |||
185 | /* Private API (for audit.c only) */ | 220 | /* Private API (for audit.c only) */ |
186 | extern int audit_receive_filter(int type, int pid, int uid, int seq, | 221 | extern int audit_receive_filter(int type, int pid, int uid, int seq, |
187 | void *data, uid_t loginuid); | 222 | void *data, uid_t loginuid); |
188 | extern void audit_get_stamp(struct audit_context *ctx, | 223 | extern unsigned int audit_serial(void); |
189 | struct timespec *t, unsigned int *serial); | 224 | extern void auditsc_get_stamp(struct audit_context *ctx, |
225 | struct timespec *t, unsigned int *serial); | ||
190 | extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); | 226 | extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); |
191 | extern uid_t audit_get_loginuid(struct audit_context *ctx); | 227 | extern uid_t audit_get_loginuid(struct audit_context *ctx); |
192 | extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); | 228 | extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); |
229 | extern int audit_socketcall(int nargs, unsigned long *args); | ||
230 | extern int audit_sockaddr(int len, void *addr); | ||
231 | extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); | ||
232 | extern void audit_signal_info(int sig, struct task_struct *t); | ||
193 | #else | 233 | #else |
194 | #define audit_alloc(t) ({ 0; }) | 234 | #define audit_alloc(t) ({ 0; }) |
195 | #define audit_free(t) do { ; } while (0) | 235 | #define audit_free(t) do { ; } while (0) |
@@ -198,18 +238,24 @@ extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mo | |||
198 | #define audit_getname(n) do { ; } while (0) | 238 | #define audit_getname(n) do { ; } while (0) |
199 | #define audit_putname(n) do { ; } while (0) | 239 | #define audit_putname(n) do { ; } while (0) |
200 | #define audit_inode(n,i) do { ; } while (0) | 240 | #define audit_inode(n,i) do { ; } while (0) |
241 | #define audit_receive_filter(t,p,u,s,d,l) ({ -EOPNOTSUPP; }) | ||
242 | #define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) | ||
201 | #define audit_get_loginuid(c) ({ -1; }) | 243 | #define audit_get_loginuid(c) ({ -1; }) |
202 | #define audit_ipc_perms(q,u,g,m) ({ 0; }) | 244 | #define audit_ipc_perms(q,u,g,m) ({ 0; }) |
245 | #define audit_socketcall(n,a) ({ 0; }) | ||
246 | #define audit_sockaddr(len, addr) ({ 0; }) | ||
247 | #define audit_avc_path(dentry, mnt) ({ 0; }) | ||
248 | #define audit_signal_info(s,t) do { ; } while (0) | ||
203 | #endif | 249 | #endif |
204 | 250 | ||
205 | #ifdef CONFIG_AUDIT | 251 | #ifdef CONFIG_AUDIT |
206 | /* These are defined in audit.c */ | 252 | /* These are defined in audit.c */ |
207 | /* Public API */ | 253 | /* Public API */ |
208 | extern void audit_log(struct audit_context *ctx, | 254 | extern void audit_log(struct audit_context *ctx, int type, |
209 | const char *fmt, ...) | 255 | const char *fmt, ...) |
210 | __attribute__((format(printf,2,3))); | 256 | __attribute__((format(printf,3,4))); |
211 | 257 | ||
212 | extern struct audit_buffer *audit_log_start(struct audit_context *ctx); | 258 | extern struct audit_buffer *audit_log_start(struct audit_context *ctx,int type); |
213 | extern void audit_log_format(struct audit_buffer *ab, | 259 | extern void audit_log_format(struct audit_buffer *ab, |
214 | const char *fmt, ...) | 260 | const char *fmt, ...) |
215 | __attribute__((format(printf,2,3))); | 261 | __attribute__((format(printf,2,3))); |
@@ -229,8 +275,8 @@ extern void audit_send_reply(int pid, int seq, int type, | |||
229 | void *payload, int size); | 275 | void *payload, int size); |
230 | extern void audit_log_lost(const char *message); | 276 | extern void audit_log_lost(const char *message); |
231 | #else | 277 | #else |
232 | #define audit_log(t,f,...) do { ; } while (0) | 278 | #define audit_log(c,t,f,...) do { ; } while (0) |
233 | #define audit_log_start(t) ({ NULL; }) | 279 | #define audit_log_start(c,t) ({ NULL; }) |
234 | #define audit_log_vformat(b,f,a) do { ; } while (0) | 280 | #define audit_log_vformat(b,f,a) do { ; } while (0) |
235 | #define audit_log_format(b,f,...) do { ; } while (0) | 281 | #define audit_log_format(b,f,...) do { ; } while (0) |
236 | #define audit_log_end(b) do { ; } while (0) | 282 | #define audit_log_end(b) do { ; } while (0) |
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h index a1657fb99516..9343c89d843c 100644 --- a/include/linux/auto_fs4.h +++ b/include/linux/auto_fs4.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #define AUTOFS_MIN_PROTO_VERSION 3 | 23 | #define AUTOFS_MIN_PROTO_VERSION 3 |
24 | #define AUTOFS_MAX_PROTO_VERSION 4 | 24 | #define AUTOFS_MAX_PROTO_VERSION 4 |
25 | 25 | ||
26 | #define AUTOFS_PROTO_SUBVERSION 6 | 26 | #define AUTOFS_PROTO_SUBVERSION 7 |
27 | 27 | ||
28 | /* Mask for expire behaviour */ | 28 | /* Mask for expire behaviour */ |
29 | #define AUTOFS_EXP_IMMEDIATE 1 | 29 | #define AUTOFS_EXP_IMMEDIATE 1 |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 7e736e201c46..c1e82c514443 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -69,6 +69,11 @@ extern void remove_arg_zero(struct linux_binprm *); | |||
69 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); | 69 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); |
70 | extern int flush_old_exec(struct linux_binprm * bprm); | 70 | extern int flush_old_exec(struct linux_binprm * bprm); |
71 | 71 | ||
72 | extern int suid_dumpable; | ||
73 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | ||
74 | #define SUID_DUMP_USER 1 /* Dump as user of process */ | ||
75 | #define SUID_DUMP_ROOT 2 /* Dump as root */ | ||
76 | |||
72 | /* Stack area protections */ | 77 | /* Stack area protections */ |
73 | #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ | 78 | #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ |
74 | #define EXSTACK_DISABLE_X 1 /* Disable executable stacks */ | 79 | #define EXSTACK_DISABLE_X 1 /* Disable executable stacks */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ef1afc178c0a..b54a0348a890 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -285,16 +285,12 @@ enum blk_queue_state { | |||
285 | Queue_up, | 285 | Queue_up, |
286 | }; | 286 | }; |
287 | 287 | ||
288 | #define BLK_TAGS_PER_LONG (sizeof(unsigned long) * 8) | ||
289 | #define BLK_TAGS_MASK (BLK_TAGS_PER_LONG - 1) | ||
290 | |||
291 | struct blk_queue_tag { | 288 | struct blk_queue_tag { |
292 | struct request **tag_index; /* map of busy tags */ | 289 | struct request **tag_index; /* map of busy tags */ |
293 | unsigned long *tag_map; /* bit map of free/busy tags */ | 290 | unsigned long *tag_map; /* bit map of free/busy tags */ |
294 | struct list_head busy_list; /* fifo list of busy tags */ | 291 | struct list_head busy_list; /* fifo list of busy tags */ |
295 | int busy; /* current depth */ | 292 | int busy; /* current depth */ |
296 | int max_depth; /* what we will send to device */ | 293 | int max_depth; /* what we will send to device */ |
297 | int real_max_depth; /* what the array can hold */ | ||
298 | atomic_t refcnt; /* map can be shared */ | 294 | atomic_t refcnt; /* map can be shared */ |
299 | }; | 295 | }; |
300 | 296 | ||
@@ -396,6 +392,7 @@ struct request_queue | |||
396 | */ | 392 | */ |
397 | unsigned int sg_timeout; | 393 | unsigned int sg_timeout; |
398 | unsigned int sg_reserved_size; | 394 | unsigned int sg_reserved_size; |
395 | int node; | ||
399 | 396 | ||
400 | struct list_head drain_list; | 397 | struct list_head drain_list; |
401 | 398 | ||
@@ -542,15 +539,12 @@ extern void generic_make_request(struct bio *bio); | |||
542 | extern void blk_put_request(struct request *); | 539 | extern void blk_put_request(struct request *); |
543 | extern void blk_end_sync_rq(struct request *rq); | 540 | extern void blk_end_sync_rq(struct request *rq); |
544 | extern void blk_attempt_remerge(request_queue_t *, struct request *); | 541 | extern void blk_attempt_remerge(request_queue_t *, struct request *); |
545 | extern void __blk_attempt_remerge(request_queue_t *, struct request *); | ||
546 | extern struct request *blk_get_request(request_queue_t *, int, int); | 542 | extern struct request *blk_get_request(request_queue_t *, int, int); |
547 | extern void blk_insert_request(request_queue_t *, struct request *, int, void *, int); | 543 | extern void blk_insert_request(request_queue_t *, struct request *, int, void *); |
548 | extern void blk_requeue_request(request_queue_t *, struct request *); | 544 | extern void blk_requeue_request(request_queue_t *, struct request *); |
549 | extern void blk_plug_device(request_queue_t *); | 545 | extern void blk_plug_device(request_queue_t *); |
550 | extern int blk_remove_plug(request_queue_t *); | 546 | extern int blk_remove_plug(request_queue_t *); |
551 | extern void blk_recount_segments(request_queue_t *, struct bio *); | 547 | extern void blk_recount_segments(request_queue_t *, struct bio *); |
552 | extern int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *); | ||
553 | extern int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *); | ||
554 | extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); | 548 | extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); |
555 | extern void blk_start_queue(request_queue_t *q); | 549 | extern void blk_start_queue(request_queue_t *q); |
556 | extern void blk_stop_queue(request_queue_t *q); | 550 | extern void blk_stop_queue(request_queue_t *q); |
@@ -615,6 +609,8 @@ static inline void blkdev_dequeue_request(struct request *req) | |||
615 | /* | 609 | /* |
616 | * Access functions for manipulating queue properties | 610 | * Access functions for manipulating queue properties |
617 | */ | 611 | */ |
612 | extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn, | ||
613 | spinlock_t *lock, int node_id); | ||
618 | extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); | 614 | extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); |
619 | extern void blk_cleanup_queue(request_queue_t *); | 615 | extern void blk_cleanup_queue(request_queue_t *); |
620 | extern void blk_queue_make_request(request_queue_t *, make_request_fn *); | 616 | extern void blk_queue_make_request(request_queue_t *, make_request_fn *); |
@@ -632,7 +628,6 @@ extern void blk_queue_dma_alignment(request_queue_t *, int); | |||
632 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 628 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
633 | extern void blk_queue_ordered(request_queue_t *, int); | 629 | extern void blk_queue_ordered(request_queue_t *, int); |
634 | extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); | 630 | extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); |
635 | extern int blkdev_scsi_issue_flush_fn(request_queue_t *, struct gendisk *, sector_t *); | ||
636 | extern struct request *blk_start_pre_flush(request_queue_t *,struct request *); | 631 | extern struct request *blk_start_pre_flush(request_queue_t *,struct request *); |
637 | extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); | 632 | extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); |
638 | extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); | 633 | extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); |
@@ -646,7 +641,8 @@ extern void blk_wait_queue_drained(request_queue_t *, int); | |||
646 | extern void blk_finish_queue_drain(request_queue_t *); | 641 | extern void blk_finish_queue_drain(request_queue_t *); |
647 | 642 | ||
648 | int blk_get_queue(request_queue_t *); | 643 | int blk_get_queue(request_queue_t *); |
649 | request_queue_t *blk_alloc_queue(int); | 644 | request_queue_t *blk_alloc_queue(int gfp_mask); |
645 | request_queue_t *blk_alloc_queue_node(int,int); | ||
650 | #define blk_put_queue(q) blk_cleanup_queue((q)) | 646 | #define blk_put_queue(q) blk_cleanup_queue((q)) |
651 | 647 | ||
652 | /* | 648 | /* |
@@ -675,8 +671,6 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *); | |||
675 | 671 | ||
676 | #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) | 672 | #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) |
677 | 673 | ||
678 | extern void drive_stat_acct(struct request *, int, int); | ||
679 | |||
680 | static inline int queue_hardsect_size(request_queue_t *q) | 674 | static inline int queue_hardsect_size(request_queue_t *q) |
681 | { | 675 | { |
682 | int retval = 512; | 676 | int retval = 512; |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 0dd8ca1a3d5a..82bd8842d11c 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -22,6 +22,10 @@ extern unsigned long min_low_pfn; | |||
22 | */ | 22 | */ |
23 | extern unsigned long max_pfn; | 23 | extern unsigned long max_pfn; |
24 | 24 | ||
25 | #ifdef CONFIG_CRASH_DUMP | ||
26 | extern unsigned long saved_max_pfn; | ||
27 | #endif | ||
28 | |||
25 | /* | 29 | /* |
26 | * node_bootmem_map is a map pointer - the bits represent all physical | 30 | * node_bootmem_map is a map pointer - the bits represent all physical |
27 | * memory pages (including holes) on the node. | 31 | * memory pages (including holes) on the node. |
@@ -67,6 +71,15 @@ extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, | |||
67 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) | 71 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) |
68 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 72 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
69 | 73 | ||
74 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP | ||
75 | extern void *alloc_remap(int nid, unsigned long size); | ||
76 | #else | ||
77 | static inline void *alloc_remap(int nid, unsigned long size) | ||
78 | { | ||
79 | return NULL; | ||
80 | } | ||
81 | #endif | ||
82 | |||
70 | extern unsigned long __initdata nr_kernel_pages; | 83 | extern unsigned long __initdata nr_kernel_pages; |
71 | extern unsigned long __initdata nr_all_pages; | 84 | extern unsigned long __initdata nr_all_pages; |
72 | 85 | ||
diff --git a/include/linux/chio.h b/include/linux/chio.h new file mode 100644 index 000000000000..63035ae67e63 --- /dev/null +++ b/include/linux/chio.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * ioctl interface for the scsi media changer driver | ||
3 | */ | ||
4 | |||
5 | /* changer element types */ | ||
6 | #define CHET_MT 0 /* media transport element (robot) */ | ||
7 | #define CHET_ST 1 /* storage element (media slots) */ | ||
8 | #define CHET_IE 2 /* import/export element */ | ||
9 | #define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */ | ||
10 | #define CHET_V1 4 /* vendor specific #1 */ | ||
11 | #define CHET_V2 5 /* vendor specific #2 */ | ||
12 | #define CHET_V3 6 /* vendor specific #3 */ | ||
13 | #define CHET_V4 7 /* vendor specific #4 */ | ||
14 | |||
15 | |||
16 | /* | ||
17 | * CHIOGPARAMS | ||
18 | * query changer properties | ||
19 | * | ||
20 | * CHIOVGPARAMS | ||
21 | * query vendor-specific element types | ||
22 | * | ||
23 | * accessing elements works by specifing type and unit of the element. | ||
24 | * for eample, storage elements are addressed with type = CHET_ST and | ||
25 | * unit = 0 .. cp_nslots-1 | ||
26 | * | ||
27 | */ | ||
28 | struct changer_params { | ||
29 | int cp_curpicker; /* current transport element */ | ||
30 | int cp_npickers; /* number of transport elements (CHET_MT) */ | ||
31 | int cp_nslots; /* number of storage elements (CHET_ST) */ | ||
32 | int cp_nportals; /* number of import/export elements (CHET_IE) */ | ||
33 | int cp_ndrives; /* number of data transfer elements (CHET_DT) */ | ||
34 | }; | ||
35 | struct changer_vendor_params { | ||
36 | int cvp_n1; /* number of vendor specific elems (CHET_V1) */ | ||
37 | char cvp_label1[16]; | ||
38 | int cvp_n2; /* number of vendor specific elems (CHET_V2) */ | ||
39 | char cvp_label2[16]; | ||
40 | int cvp_n3; /* number of vendor specific elems (CHET_V3) */ | ||
41 | char cvp_label3[16]; | ||
42 | int cvp_n4; /* number of vendor specific elems (CHET_V4) */ | ||
43 | char cvp_label4[16]; | ||
44 | int reserved[8]; | ||
45 | }; | ||
46 | |||
47 | |||
48 | /* | ||
49 | * CHIOMOVE | ||
50 | * move a medium from one element to another | ||
51 | */ | ||
52 | struct changer_move { | ||
53 | int cm_fromtype; /* type/unit of source element */ | ||
54 | int cm_fromunit; | ||
55 | int cm_totype; /* type/unit of destination element */ | ||
56 | int cm_tounit; | ||
57 | int cm_flags; | ||
58 | }; | ||
59 | #define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */ | ||
60 | |||
61 | |||
62 | /* | ||
63 | * CHIOEXCHANGE | ||
64 | * move one medium from element #1 to element #2, | ||
65 | * and another one from element #2 to element #3. | ||
66 | * element #1 and #3 are allowed to be identical. | ||
67 | */ | ||
68 | struct changer_exchange { | ||
69 | int ce_srctype; /* type/unit of element #1 */ | ||
70 | int ce_srcunit; | ||
71 | int ce_fdsttype; /* type/unit of element #2 */ | ||
72 | int ce_fdstunit; | ||
73 | int ce_sdsttype; /* type/unit of element #3 */ | ||
74 | int ce_sdstunit; | ||
75 | int ce_flags; | ||
76 | }; | ||
77 | #define CE_INVERT1 1 | ||
78 | #define CE_INVERT2 2 | ||
79 | |||
80 | |||
81 | /* | ||
82 | * CHIOPOSITION | ||
83 | * move the transport element (robot arm) to a specific element. | ||
84 | */ | ||
85 | struct changer_position { | ||
86 | int cp_type; | ||
87 | int cp_unit; | ||
88 | int cp_flags; | ||
89 | }; | ||
90 | #define CP_INVERT 1 | ||
91 | |||
92 | |||
93 | /* | ||
94 | * CHIOGSTATUS | ||
95 | * get element status for all elements of a specific type | ||
96 | */ | ||
97 | struct changer_element_status { | ||
98 | int ces_type; | ||
99 | unsigned char *ces_data; | ||
100 | }; | ||
101 | #define CESTATUS_FULL 0x01 /* full */ | ||
102 | #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ | ||
103 | #define CESTATUS_EXCEPT 0x04 /* error condition */ | ||
104 | #define CESTATUS_ACCESS 0x08 /* access allowed */ | ||
105 | #define CESTATUS_EXENAB 0x10 /* element can export media */ | ||
106 | #define CESTATUS_INENAB 0x20 /* element can import media */ | ||
107 | |||
108 | |||
109 | /* | ||
110 | * CHIOGELEM | ||
111 | * get more detailed status informtion for a single element | ||
112 | */ | ||
113 | struct changer_get_element { | ||
114 | int cge_type; /* type/unit */ | ||
115 | int cge_unit; | ||
116 | int cge_status; /* status */ | ||
117 | int cge_errno; /* errno */ | ||
118 | int cge_srctype; /* source element of the last move/exchange */ | ||
119 | int cge_srcunit; | ||
120 | int cge_id; /* scsi id (for data transfer elements) */ | ||
121 | int cge_lun; /* scsi lun (for data transfer elements) */ | ||
122 | char cge_pvoltag[36]; /* primary volume tag */ | ||
123 | char cge_avoltag[36]; /* alternate volume tag */ | ||
124 | int cge_flags; | ||
125 | }; | ||
126 | /* flags */ | ||
127 | #define CGE_ERRNO 0x01 /* errno available */ | ||
128 | #define CGE_INVERT 0x02 /* media inverted */ | ||
129 | #define CGE_SRC 0x04 /* media src available */ | ||
130 | #define CGE_IDLUN 0x08 /* ID+LUN available */ | ||
131 | #define CGE_PVOLTAG 0x10 /* primary volume tag available */ | ||
132 | #define CGE_AVOLTAG 0x20 /* alternate volume tag available */ | ||
133 | |||
134 | |||
135 | /* | ||
136 | * CHIOSVOLTAG | ||
137 | * set volume tag | ||
138 | */ | ||
139 | struct changer_set_voltag { | ||
140 | int csv_type; /* type/unit */ | ||
141 | int csv_unit; | ||
142 | char csv_voltag[36]; /* volume tag */ | ||
143 | int csv_flags; | ||
144 | }; | ||
145 | #define CSV_PVOLTAG 0x01 /* primary volume tag */ | ||
146 | #define CSV_AVOLTAG 0x02 /* alternate volume tag */ | ||
147 | #define CSV_CLEARTAG 0x04 /* clear volume tag */ | ||
148 | |||
149 | /* ioctls */ | ||
150 | #define CHIOMOVE _IOW('c', 1,struct changer_move) | ||
151 | #define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange) | ||
152 | #define CHIOPOSITION _IOW('c', 3,struct changer_position) | ||
153 | #define CHIOGPICKER _IOR('c', 4,int) /* not impl. */ | ||
154 | #define CHIOSPICKER _IOW('c', 5,int) /* not impl. */ | ||
155 | #define CHIOGPARAMS _IOR('c', 6,struct changer_params) | ||
156 | #define CHIOGSTATUS _IOW('c', 8,struct changer_element_status) | ||
157 | #define CHIOGELEM _IOW('c',16,struct changer_get_element) | ||
158 | #define CHIOINITELEM _IO('c',17) | ||
159 | #define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag) | ||
160 | #define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params) | ||
161 | |||
162 | /* ---------------------------------------------------------------------- */ | ||
163 | |||
164 | /* | ||
165 | * Local variables: | ||
166 | * c-basic-offset: 8 | ||
167 | * End: | ||
168 | */ | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index fe0298e5dae1..e8904c0da686 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -69,6 +69,7 @@ extern struct semaphore cpucontrol; | |||
69 | register_cpu_notifier(&fn##_nb); \ | 69 | register_cpu_notifier(&fn##_nb); \ |
70 | } | 70 | } |
71 | int cpu_down(unsigned int cpu); | 71 | int cpu_down(unsigned int cpu); |
72 | extern int __attribute__((weak)) smp_prepare_cpu(int cpu); | ||
72 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) | 73 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) |
73 | #else | 74 | #else |
74 | #define lock_cpu_hotplug() do { } while (0) | 75 | #define lock_cpu_hotplug() do { } while (0) |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index f21af067d015..927daa86c9b3 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -49,7 +49,7 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); | |||
49 | /* Frequency values here are CPU kHz so that hardware which doesn't run | 49 | /* Frequency values here are CPU kHz so that hardware which doesn't run |
50 | * with some frequencies can complain without having to guess what per | 50 | * with some frequencies can complain without having to guess what per |
51 | * cent / per mille means. | 51 | * cent / per mille means. |
52 | * Maximum transition latency is in microseconds - if it's unknown, | 52 | * Maximum transition latency is in nanoseconds - if it's unknown, |
53 | * CPUFREQ_ETERNAL shall be used. | 53 | * CPUFREQ_ETERNAL shall be used. |
54 | */ | 54 | */ |
55 | 55 | ||
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h new file mode 100644 index 000000000000..534d750d922d --- /dev/null +++ b/include/linux/crash_dump.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef LINUX_CRASH_DUMP_H | ||
2 | #define LINUX_CRASH_DUMP_H | ||
3 | |||
4 | #ifdef CONFIG_CRASH_DUMP | ||
5 | #include <linux/kexec.h> | ||
6 | #include <linux/smp_lock.h> | ||
7 | #include <linux/device.h> | ||
8 | #include <linux/proc_fs.h> | ||
9 | |||
10 | #define ELFCORE_ADDR_MAX (-1ULL) | ||
11 | extern unsigned long long elfcorehdr_addr; | ||
12 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, | ||
13 | unsigned long, int); | ||
14 | extern struct file_operations proc_vmcore_operations; | ||
15 | extern struct proc_dir_entry *proc_vmcore; | ||
16 | |||
17 | #endif /* CONFIG_CRASH_DUMP */ | ||
18 | #endif /* LINUX_CRASHDUMP_H */ | ||
diff --git a/include/linux/device.h b/include/linux/device.h index df94c0de53f2..7b781a72b293 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/config.h> | 14 | #include <linux/config.h> |
15 | #include <linux/ioport.h> | 15 | #include <linux/ioport.h> |
16 | #include <linux/kobject.h> | 16 | #include <linux/kobject.h> |
17 | #include <linux/klist.h> | ||
17 | #include <linux/list.h> | 18 | #include <linux/list.h> |
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -44,14 +45,15 @@ struct device; | |||
44 | struct device_driver; | 45 | struct device_driver; |
45 | struct class; | 46 | struct class; |
46 | struct class_device; | 47 | struct class_device; |
47 | struct class_simple; | ||
48 | 48 | ||
49 | struct bus_type { | 49 | struct bus_type { |
50 | char * name; | 50 | const char * name; |
51 | 51 | ||
52 | struct subsystem subsys; | 52 | struct subsystem subsys; |
53 | struct kset drivers; | 53 | struct kset drivers; |
54 | struct kset devices; | 54 | struct kset devices; |
55 | struct klist klist_devices; | ||
56 | struct klist klist_drivers; | ||
55 | 57 | ||
56 | struct bus_attribute * bus_attrs; | 58 | struct bus_attribute * bus_attrs; |
57 | struct device_attribute * dev_attrs; | 59 | struct device_attribute * dev_attrs; |
@@ -98,17 +100,18 @@ extern int bus_create_file(struct bus_type *, struct bus_attribute *); | |||
98 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | 100 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); |
99 | 101 | ||
100 | struct device_driver { | 102 | struct device_driver { |
101 | char * name; | 103 | const char * name; |
102 | struct bus_type * bus; | 104 | struct bus_type * bus; |
103 | 105 | ||
104 | struct completion unloaded; | 106 | struct completion unloaded; |
105 | struct kobject kobj; | 107 | struct kobject kobj; |
106 | struct list_head devices; | 108 | struct klist klist_devices; |
109 | struct klist_node knode_bus; | ||
107 | 110 | ||
108 | struct module * owner; | 111 | struct module * owner; |
109 | 112 | ||
110 | int (*probe) (struct device * dev); | 113 | int (*probe) (struct device * dev); |
111 | int (*remove) (struct device * dev); | 114 | int (*remove) (struct device * dev); |
112 | void (*shutdown) (struct device * dev); | 115 | void (*shutdown) (struct device * dev); |
113 | int (*suspend) (struct device * dev, pm_message_t state, u32 level); | 116 | int (*suspend) (struct device * dev, pm_message_t state, u32 level); |
114 | int (*resume) (struct device * dev, u32 level); | 117 | int (*resume) (struct device * dev, u32 level); |
@@ -137,12 +140,16 @@ struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) | |||
137 | extern int driver_create_file(struct device_driver *, struct driver_attribute *); | 140 | extern int driver_create_file(struct device_driver *, struct driver_attribute *); |
138 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); | 141 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); |
139 | 142 | ||
143 | extern int driver_for_each_device(struct device_driver * drv, struct device * start, | ||
144 | void * data, int (*fn)(struct device *, void *)); | ||
145 | |||
140 | 146 | ||
141 | /* | 147 | /* |
142 | * device classes | 148 | * device classes |
143 | */ | 149 | */ |
144 | struct class { | 150 | struct class { |
145 | char * name; | 151 | const char * name; |
152 | struct module * owner; | ||
146 | 153 | ||
147 | struct subsystem subsys; | 154 | struct subsystem subsys; |
148 | struct list_head children; | 155 | struct list_head children; |
@@ -185,6 +192,7 @@ struct class_device { | |||
185 | struct kobject kobj; | 192 | struct kobject kobj; |
186 | struct class * class; /* required */ | 193 | struct class * class; /* required */ |
187 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 194 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
195 | struct class_device_attribute *devt_attr; | ||
188 | struct device * dev; /* not necessary, but nice to have */ | 196 | struct device * dev; /* not necessary, but nice to have */ |
189 | void * class_data; /* class-specific data */ | 197 | void * class_data; /* class-specific data */ |
190 | 198 | ||
@@ -245,26 +253,28 @@ struct class_interface { | |||
245 | extern int class_interface_register(struct class_interface *); | 253 | extern int class_interface_register(struct class_interface *); |
246 | extern void class_interface_unregister(struct class_interface *); | 254 | extern void class_interface_unregister(struct class_interface *); |
247 | 255 | ||
248 | /* interface for class simple stuff */ | 256 | extern struct class *class_create(struct module *owner, char *name); |
249 | extern struct class_simple *class_simple_create(struct module *owner, char *name); | 257 | extern void class_destroy(struct class *cls); |
250 | extern void class_simple_destroy(struct class_simple *cs); | 258 | extern struct class_device *class_device_create(struct class *cls, dev_t devt, |
251 | extern struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...) | 259 | struct device *device, char *fmt, ...) |
252 | __attribute__((format(printf,4,5))); | 260 | __attribute__((format(printf,4,5))); |
253 | extern int class_simple_set_hotplug(struct class_simple *, | 261 | extern void class_device_destroy(struct class *cls, dev_t devt); |
254 | int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size)); | ||
255 | extern void class_simple_device_remove(dev_t dev); | ||
256 | 262 | ||
257 | 263 | ||
258 | struct device { | 264 | struct device { |
259 | struct list_head node; /* node in sibling list */ | 265 | struct klist klist_children; |
260 | struct list_head bus_list; /* node in bus's list */ | 266 | struct klist_node knode_parent; /* node in sibling list */ |
261 | struct list_head driver_list; | 267 | struct klist_node knode_driver; |
262 | struct list_head children; | 268 | struct klist_node knode_bus; |
263 | struct device * parent; | 269 | struct device * parent; |
264 | 270 | ||
265 | struct kobject kobj; | 271 | struct kobject kobj; |
266 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 272 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
267 | 273 | ||
274 | struct semaphore sem; /* semaphore to synchronize calls to | ||
275 | * its driver. | ||
276 | */ | ||
277 | |||
268 | struct bus_type * bus; /* type of bus device is on */ | 278 | struct bus_type * bus; /* type of bus device is on */ |
269 | struct device_driver *driver; /* which driver has allocated this | 279 | struct device_driver *driver; /* which driver has allocated this |
270 | device */ | 280 | device */ |
@@ -288,12 +298,6 @@ struct device { | |||
288 | void (*release)(struct device * dev); | 298 | void (*release)(struct device * dev); |
289 | }; | 299 | }; |
290 | 300 | ||
291 | static inline struct device * | ||
292 | list_to_dev(struct list_head *node) | ||
293 | { | ||
294 | return list_entry(node, struct device, node); | ||
295 | } | ||
296 | |||
297 | static inline void * | 301 | static inline void * |
298 | dev_get_drvdata (struct device *dev) | 302 | dev_get_drvdata (struct device *dev) |
299 | { | 303 | { |
@@ -321,7 +325,6 @@ extern int device_for_each_child(struct device *, void *, | |||
321 | * Manual binding of a device to driver. See drivers/base/bus.c | 325 | * Manual binding of a device to driver. See drivers/base/bus.c |
322 | * for information on use. | 326 | * for information on use. |
323 | */ | 327 | */ |
324 | extern int driver_probe_device(struct device_driver * drv, struct device * dev); | ||
325 | extern void device_bind_driver(struct device * dev); | 328 | extern void device_bind_driver(struct device * dev); |
326 | extern void device_release_driver(struct device * dev); | 329 | extern void device_release_driver(struct device * dev); |
327 | extern int device_attach(struct device * dev); | 330 | extern int device_attach(struct device * dev); |
@@ -332,8 +335,10 @@ extern void driver_attach(struct device_driver * drv); | |||
332 | 335 | ||
333 | struct device_attribute { | 336 | struct device_attribute { |
334 | struct attribute attr; | 337 | struct attribute attr; |
335 | ssize_t (*show)(struct device * dev, char * buf); | 338 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, |
336 | ssize_t (*store)(struct device * dev, const char * buf, size_t count); | 339 | char *buf); |
340 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | ||
341 | const char *buf, size_t count); | ||
337 | }; | 342 | }; |
338 | 343 | ||
339 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ | 344 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ |
@@ -360,13 +365,12 @@ extern int (*platform_notify_remove)(struct device * dev); | |||
360 | */ | 365 | */ |
361 | extern struct device * get_device(struct device * dev); | 366 | extern struct device * get_device(struct device * dev); |
362 | extern void put_device(struct device * dev); | 367 | extern void put_device(struct device * dev); |
363 | extern struct device *device_find(const char *name, struct bus_type *bus); | ||
364 | 368 | ||
365 | 369 | ||
366 | /* drivers/base/platform.c */ | 370 | /* drivers/base/platform.c */ |
367 | 371 | ||
368 | struct platform_device { | 372 | struct platform_device { |
369 | char * name; | 373 | const char * name; |
370 | u32 id; | 374 | u32 id; |
371 | struct device dev; | 375 | struct device dev; |
372 | u32 num_resources; | 376 | u32 num_resources; |
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h new file mode 100644 index 000000000000..0008e2ad0c9f --- /dev/null +++ b/include/linux/dm9000.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* include/linux/dm9000.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for dm9000 platform data | ||
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 | */ | ||
13 | |||
14 | #ifndef __DM9000_PLATFORM_DATA | ||
15 | #define __DM9000_PLATFORM_DATA __FILE__ | ||
16 | |||
17 | /* IO control flags */ | ||
18 | |||
19 | #define DM9000_PLATF_8BITONLY (0x0001) | ||
20 | #define DM9000_PLATF_16BITONLY (0x0002) | ||
21 | #define DM9000_PLATF_32BITONLY (0x0004) | ||
22 | |||
23 | /* platfrom data for platfrom device structure's platfrom_data field */ | ||
24 | |||
25 | struct dm9000_plat_data { | ||
26 | unsigned int flags; | ||
27 | |||
28 | /* allow replacement IO routines */ | ||
29 | |||
30 | void (*inblk)(void __iomem *reg, void *data, int len); | ||
31 | void (*outblk)(void __iomem *reg, void *data, int len); | ||
32 | void (*dumpblk)(void __iomem *reg, int len); | ||
33 | }; | ||
34 | |||
35 | #endif /* __DM9000_PLATFORM_DATA */ | ||
36 | |||
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 806c305332c1..2d80cc761a15 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -14,7 +14,12 @@ enum dma_data_direction { | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | #define DMA_64BIT_MASK 0xffffffffffffffffULL | 16 | #define DMA_64BIT_MASK 0xffffffffffffffffULL |
17 | #define DMA_40BIT_MASK 0x000000ffffffffffULL | ||
18 | #define DMA_39BIT_MASK 0x0000007fffffffffULL | ||
17 | #define DMA_32BIT_MASK 0x00000000ffffffffULL | 19 | #define DMA_32BIT_MASK 0x00000000ffffffffULL |
20 | #define DMA_31BIT_MASK 0x000000007fffffffULL | ||
21 | #define DMA_30BIT_MASK 0x000000003fffffffULL | ||
22 | #define DMA_29BIT_MASK 0x000000001fffffffULL | ||
18 | 23 | ||
19 | #include <asm/dma-mapping.h> | 24 | #include <asm/dma-mapping.h> |
20 | 25 | ||
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index d2bcf556088b..5e93e6dce9a4 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -9,6 +9,7 @@ enum dmi_field { | |||
9 | DMI_SYS_VENDOR, | 9 | DMI_SYS_VENDOR, |
10 | DMI_PRODUCT_NAME, | 10 | DMI_PRODUCT_NAME, |
11 | DMI_PRODUCT_VERSION, | 11 | DMI_PRODUCT_VERSION, |
12 | DMI_PRODUCT_SERIAL, | ||
12 | DMI_BOARD_VENDOR, | 13 | DMI_BOARD_VENDOR, |
13 | DMI_BOARD_NAME, | 14 | DMI_BOARD_NAME, |
14 | DMI_BOARD_VERSION, | 15 | DMI_BOARD_VERSION, |
diff --git a/include/linux/dqblk_v1.h b/include/linux/dqblk_v1.h index 42fbf4797156..57f1250d5a52 100644 --- a/include/linux/dqblk_v1.h +++ b/include/linux/dqblk_v1.h | |||
@@ -11,6 +11,12 @@ | |||
11 | /* Root squash turned on */ | 11 | /* Root squash turned on */ |
12 | #define V1_DQF_RSQUASH 1 | 12 | #define V1_DQF_RSQUASH 1 |
13 | 13 | ||
14 | /* Numbers of blocks needed for updates */ | ||
15 | #define V1_INIT_ALLOC 1 | ||
16 | #define V1_INIT_REWRITE 1 | ||
17 | #define V1_DEL_ALLOC 0 | ||
18 | #define V1_DEL_REWRITE 2 | ||
19 | |||
14 | /* Special information about quotafile */ | 20 | /* Special information about quotafile */ |
15 | struct v1_mem_dqinfo { | 21 | struct v1_mem_dqinfo { |
16 | }; | 22 | }; |
diff --git a/include/linux/dqblk_v2.h b/include/linux/dqblk_v2.h index 4a6c5f6867bb..4f853322cb7f 100644 --- a/include/linux/dqblk_v2.h +++ b/include/linux/dqblk_v2.h | |||
@@ -10,6 +10,12 @@ | |||
10 | /* id numbers of quota format */ | 10 | /* id numbers of quota format */ |
11 | #define QFMT_VFS_V0 2 | 11 | #define QFMT_VFS_V0 2 |
12 | 12 | ||
13 | /* Numbers of blocks needed for updates */ | ||
14 | #define V2_INIT_ALLOC 4 | ||
15 | #define V2_INIT_REWRITE 2 | ||
16 | #define V2_DEL_ALLOC 0 | ||
17 | #define V2_DEL_REWRITE 6 | ||
18 | |||
13 | /* Inmemory copy of version specific information */ | 19 | /* Inmemory copy of version specific information */ |
14 | struct v2_mem_dqinfo { | 20 | struct v2_mem_dqinfo { |
15 | unsigned int dqi_blocks; | 21 | unsigned int dqi_blocks; |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 047e7222df7a..73781ec165b4 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -315,7 +315,7 @@ extern struct efi_memory_map memmap; | |||
315 | */ | 315 | */ |
316 | static inline int efi_range_is_wc(unsigned long start, unsigned long len) | 316 | static inline int efi_range_is_wc(unsigned long start, unsigned long len) |
317 | { | 317 | { |
318 | int i; | 318 | unsigned long i; |
319 | 319 | ||
320 | for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) { | 320 | for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) { |
321 | unsigned long paddr = __pa(start + i); | 321 | unsigned long paddr = __pa(start + i); |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 220748b7abea..a1478258d002 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -56,18 +56,32 @@ static inline int is_zero_ether_addr(const u8 *addr) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * is_multicast_ether_addr - Determine if the given Ethernet address is a | ||
60 | * multicast address. | ||
61 | * | ||
62 | * @addr: Pointer to a six-byte array containing the Ethernet address | ||
63 | * | ||
64 | * Return true if the address is a multicast address. | ||
65 | */ | ||
66 | static inline int is_multicast_ether_addr(const u8 *addr) | ||
67 | { | ||
68 | return addr[0] & 0x01; | ||
69 | } | ||
70 | |||
71 | /** | ||
59 | * is_valid_ether_addr - Determine if the given Ethernet address is valid | 72 | * is_valid_ether_addr - Determine if the given Ethernet address is valid |
60 | * @addr: Pointer to a six-byte array containing the Ethernet address | 73 | * @addr: Pointer to a six-byte array containing the Ethernet address |
61 | * | 74 | * |
62 | * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not | 75 | * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not |
63 | * a multicast address, and is not FF:FF:FF:FF:FF:FF. The multicast | 76 | * a multicast address, and is not FF:FF:FF:FF:FF:FF. |
64 | * and FF:FF:... tests are combined into the single test "!(addr[0]&1)". | ||
65 | * | 77 | * |
66 | * Return true if the address is valid. | 78 | * Return true if the address is valid. |
67 | */ | 79 | */ |
68 | static inline int is_valid_ether_addr(const u8 *addr) | 80 | static inline int is_valid_ether_addr(const u8 *addr) |
69 | { | 81 | { |
70 | return !(addr[0]&1) && !is_zero_ether_addr(addr); | 82 | /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to |
83 | * explicitly check for it here. */ | ||
84 | return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); | ||
71 | } | 85 | } |
72 | 86 | ||
73 | /** | 87 | /** |
@@ -83,6 +97,6 @@ static inline void random_ether_addr(u8 *addr) | |||
83 | addr [0] &= 0xfe; /* clear multicast bit */ | 97 | addr [0] &= 0xfe; /* clear multicast bit */ |
84 | addr [0] |= 0x02; /* set local assignment bit (IEEE802) */ | 98 | addr [0] |= 0x02; /* set local assignment bit (IEEE802) */ |
85 | } | 99 | } |
86 | #endif | 100 | #endif /* __KERNEL__ */ |
87 | 101 | ||
88 | #endif /* _LINUX_ETHERDEVICE_H */ | 102 | #endif /* _LINUX_ETHERDEVICE_H */ |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index c85b210490ea..a0ab26aab450 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -256,6 +256,7 @@ struct net_device; | |||
256 | u32 ethtool_op_get_link(struct net_device *dev); | 256 | u32 ethtool_op_get_link(struct net_device *dev); |
257 | u32 ethtool_op_get_tx_csum(struct net_device *dev); | 257 | u32 ethtool_op_get_tx_csum(struct net_device *dev); |
258 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); | 258 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); |
259 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); | ||
259 | u32 ethtool_op_get_sg(struct net_device *dev); | 260 | u32 ethtool_op_get_sg(struct net_device *dev); |
260 | int ethtool_op_set_sg(struct net_device *dev, u32 data); | 261 | int ethtool_op_set_sg(struct net_device *dev, u32 data); |
261 | u32 ethtool_op_get_tso(struct net_device *dev); | 262 | u32 ethtool_op_get_tso(struct net_device *dev); |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index fab43527e597..a657130ba03a 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
@@ -300,18 +300,19 @@ struct ext2_inode { | |||
300 | /* | 300 | /* |
301 | * Mount flags | 301 | * Mount flags |
302 | */ | 302 | */ |
303 | #define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */ | 303 | #define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */ |
304 | #define EXT2_MOUNT_OLDALLOC 0x0002 /* Don't use the new Orlov allocator */ | 304 | #define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */ |
305 | #define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */ | 305 | #define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */ |
306 | #define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */ | 306 | #define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */ |
307 | #define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ | 307 | #define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */ |
308 | #define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ | 308 | #define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */ |
309 | #define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ | 309 | #define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */ |
310 | #define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */ | 310 | #define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */ |
311 | #define EXT2_MOUNT_NOBH 0x0100 /* No buffer_heads */ | 311 | #define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */ |
312 | #define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */ | 312 | #define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */ |
313 | #define EXT2_MOUNT_XATTR_USER 0x4000 /* Extended user attributes */ | 313 | #define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */ |
314 | #define EXT2_MOUNT_POSIX_ACL 0x8000 /* POSIX Access Control Lists */ | 314 | #define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */ |
315 | #define EXT2_MOUNT_XIP 0x010000 /* Execute in place */ | ||
315 | 316 | ||
316 | #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt | 317 | #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt |
317 | #define set_opt(o, opt) o |= EXT2_MOUNT_##opt | 318 | #define set_opt(o, opt) o |= EXT2_MOUNT_##opt |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 74ad31781e3e..4b6e1ab216a5 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -358,6 +358,7 @@ struct ext3_inode { | |||
358 | #define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ | 358 | #define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ |
359 | #define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ | 359 | #define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ |
360 | #define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */ | 360 | #define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */ |
361 | #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ | ||
361 | 362 | ||
362 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ | 363 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ |
363 | #ifndef _LINUX_EXT2_FS_H | 364 | #ifndef _LINUX_EXT2_FS_H |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index e8292af9033b..c8307c02dd07 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
@@ -42,15 +42,15 @@ | |||
42 | * superblock only gets updated once, of course, so don't bother | 42 | * superblock only gets updated once, of course, so don't bother |
43 | * counting that again for the quota updates. */ | 43 | * counting that again for the quota updates. */ |
44 | 44 | ||
45 | #define EXT3_DATA_TRANS_BLOCKS (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ |
46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ |
47 | 2*EXT3_QUOTA_TRANS_BLOCKS) | 47 | 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) |
48 | 48 | ||
49 | /* Delete operations potentially hit one directory's namespace plus an | 49 | /* Delete operations potentially hit one directory's namespace plus an |
50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be |
51 | * generous. We can grow the delete transaction later if necessary. */ | 51 | * generous. We can grow the delete transaction later if necessary. */ |
52 | 52 | ||
53 | #define EXT3_DELETE_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS + 64) | 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) |
54 | 54 | ||
55 | /* Define an arbitrary limit for the amount of data we will anticipate | 55 | /* Define an arbitrary limit for the amount of data we will anticipate |
56 | * writing to any given transaction. For unbounded transactions such as | 56 | * writing to any given transaction. For unbounded transactions such as |
@@ -74,14 +74,17 @@ | |||
74 | #ifdef CONFIG_QUOTA | 74 | #ifdef CONFIG_QUOTA |
75 | /* Amount of blocks needed for quota update - we know that the structure was | 75 | /* Amount of blocks needed for quota update - we know that the structure was |
76 | * allocated so we need to update only inode+data */ | 76 | * allocated so we need to update only inode+data */ |
77 | #define EXT3_QUOTA_TRANS_BLOCKS 2 | 77 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) |
78 | /* Amount of blocks needed for quota insert/delete - we do some block writes | 78 | /* Amount of blocks needed for quota insert/delete - we do some block writes |
79 | * but inode, sb and group updates are done only once */ | 79 | * but inode, sb and group updates are done only once */ |
80 | #define EXT3_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*\ | 80 | #define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ |
81 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3) | 81 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0) |
82 | #define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ | ||
83 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0) | ||
82 | #else | 84 | #else |
83 | #define EXT3_QUOTA_TRANS_BLOCKS 0 | 85 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) 0 |
84 | #define EXT3_QUOTA_INIT_BLOCKS 0 | 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 |
87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | ||
85 | #endif | 88 | #endif |
86 | 89 | ||
87 | int | 90 | int |
diff --git a/include/linux/fb.h b/include/linux/fb.h index b468bf496547..bc24beeed971 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -524,11 +524,11 @@ struct fb_pixmap { | |||
524 | u32 offset; /* current offset to buffer */ | 524 | u32 offset; /* current offset to buffer */ |
525 | u32 buf_align; /* byte alignment of each bitmap */ | 525 | u32 buf_align; /* byte alignment of each bitmap */ |
526 | u32 scan_align; /* alignment per scanline */ | 526 | u32 scan_align; /* alignment per scanline */ |
527 | u32 access_align; /* alignment per read/write */ | 527 | u32 access_align; /* alignment per read/write (bits) */ |
528 | u32 flags; /* see FB_PIXMAP_* */ | 528 | u32 flags; /* see FB_PIXMAP_* */ |
529 | /* access methods */ | 529 | /* access methods */ |
530 | void (*outbuf)(struct fb_info *info, u8 *addr, u8 *src, unsigned int size); | 530 | void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size); |
531 | u8 (*inbuf) (struct fb_info *info, u8 *addr); | 531 | void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size); |
532 | }; | 532 | }; |
533 | 533 | ||
534 | 534 | ||
@@ -816,18 +816,9 @@ extern int unregister_framebuffer(struct fb_info *fb_info); | |||
816 | extern int fb_prepare_logo(struct fb_info *fb_info); | 816 | extern int fb_prepare_logo(struct fb_info *fb_info); |
817 | extern int fb_show_logo(struct fb_info *fb_info); | 817 | extern int fb_show_logo(struct fb_info *fb_info); |
818 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); | 818 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); |
819 | extern void fb_iomove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, | 819 | extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, |
820 | u8 *dst, u32 d_pitch, u8 *src, u32 idx, | ||
821 | u32 height, u32 shift_high, u32 shift_low, u32 mod); | 820 | u32 height, u32 shift_high, u32 shift_low, u32 mod); |
822 | extern void fb_iomove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, | 821 | extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); |
823 | u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, | ||
824 | u32 height); | ||
825 | extern void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, | ||
826 | u8 *dst, u32 d_pitch, u8 *src, u32 idx, | ||
827 | u32 height, u32 shift_high, u32 shift_low, u32 mod); | ||
828 | extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, | ||
829 | u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, | ||
830 | u32 height); | ||
831 | extern void fb_set_suspend(struct fb_info *info, int state); | 822 | extern void fb_set_suspend(struct fb_info *info, int state); |
832 | extern int fb_get_color_depth(struct fb_var_screeninfo *var); | 823 | extern int fb_get_color_depth(struct fb_var_screeninfo *var); |
833 | extern int fb_get_options(char *name, char **option); | 824 | extern int fb_get_options(char *name, char **option); |
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index 704fb76b6334..8a7c82151de9 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h | |||
@@ -25,6 +25,10 @@ | |||
25 | 25 | ||
26 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
27 | 27 | ||
28 | #ifndef force_o_largefile | ||
29 | #define force_o_largefile() (BITS_PER_LONG != 32) | ||
30 | #endif | ||
31 | |||
28 | #if BITS_PER_LONG == 32 | 32 | #if BITS_PER_LONG == 32 |
29 | #define IS_GETLK32(cmd) ((cmd) == F_GETLK) | 33 | #define IS_GETLK32(cmd) ((cmd) == F_GETLK) |
30 | #define IS_SETLK32(cmd) ((cmd) == F_SETLK) | 34 | #define IS_SETLK32(cmd) ((cmd) == F_SETLK) |
diff --git a/include/linux/font.h b/include/linux/font.h index fc2d690c9d5f..8fc80a7d78ac 100644 --- a/include/linux/font.h +++ b/include/linux/font.h | |||
@@ -25,19 +25,23 @@ struct font_desc { | |||
25 | #define VGA8x16_IDX 1 | 25 | #define VGA8x16_IDX 1 |
26 | #define PEARL8x8_IDX 2 | 26 | #define PEARL8x8_IDX 2 |
27 | #define VGA6x11_IDX 3 | 27 | #define VGA6x11_IDX 3 |
28 | #define SUN8x16_IDX 4 | 28 | #define FONT7x14_IDX 4 |
29 | #define SUN12x22_IDX 5 | 29 | #define FONT10x18_IDX 5 |
30 | #define ACORN8x8_IDX 6 | 30 | #define SUN8x16_IDX 6 |
31 | #define MINI4x6_IDX 7 | 31 | #define SUN12x22_IDX 7 |
32 | #define ACORN8x8_IDX 8 | ||
33 | #define MINI4x6_IDX 9 | ||
32 | 34 | ||
33 | extern struct font_desc font_vga_8x8, | 35 | extern struct font_desc font_vga_8x8, |
34 | font_vga_8x16, | 36 | font_vga_8x16, |
35 | font_pearl_8x8, | 37 | font_pearl_8x8, |
36 | font_vga_6x11, | 38 | font_vga_6x11, |
37 | font_sun_8x16, | 39 | font_7x14, |
38 | font_sun_12x22, | 40 | font_10x18, |
39 | font_acorn_8x8, | 41 | font_sun_8x16, |
40 | font_mini_4x6; | 42 | font_sun_12x22, |
43 | font_acorn_8x8, | ||
44 | font_mini_4x6; | ||
41 | 45 | ||
42 | /* Find a font with a specific name */ | 46 | /* Find a font with a specific name */ |
43 | 47 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 0180102dace1..3ae8e37bdfc8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -220,6 +220,7 @@ extern int dir_notify_enable; | |||
220 | 220 | ||
221 | struct iovec; | 221 | struct iovec; |
222 | struct nameidata; | 222 | struct nameidata; |
223 | struct kiocb; | ||
223 | struct pipe_inode_info; | 224 | struct pipe_inode_info; |
224 | struct poll_table_struct; | 225 | struct poll_table_struct; |
225 | struct kstatfs; | 226 | struct kstatfs; |
@@ -240,7 +241,7 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock, | |||
240 | typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, | 241 | typedef int (get_blocks_t)(struct inode *inode, sector_t iblock, |
241 | unsigned long max_blocks, | 242 | unsigned long max_blocks, |
242 | struct buffer_head *bh_result, int create); | 243 | struct buffer_head *bh_result, int create); |
243 | typedef void (dio_iodone_t)(struct inode *inode, loff_t offset, | 244 | typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, |
244 | ssize_t bytes, void *private); | 245 | ssize_t bytes, void *private); |
245 | 246 | ||
246 | /* | 247 | /* |
@@ -302,7 +303,6 @@ struct iattr { | |||
302 | struct page; | 303 | struct page; |
303 | struct address_space; | 304 | struct address_space; |
304 | struct writeback_control; | 305 | struct writeback_control; |
305 | struct kiocb; | ||
306 | 306 | ||
307 | struct address_space_operations { | 307 | struct address_space_operations { |
308 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 308 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
@@ -330,6 +330,8 @@ struct address_space_operations { | |||
330 | int (*releasepage) (struct page *, int); | 330 | int (*releasepage) (struct page *, int); |
331 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 331 | ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
332 | loff_t offset, unsigned long nr_segs); | 332 | loff_t offset, unsigned long nr_segs); |
333 | struct page* (*get_xip_page)(struct address_space *, sector_t, | ||
334 | int); | ||
333 | }; | 335 | }; |
334 | 336 | ||
335 | struct backing_dev_info; | 337 | struct backing_dev_info; |
@@ -581,7 +583,6 @@ struct file { | |||
581 | atomic_t f_count; | 583 | atomic_t f_count; |
582 | unsigned int f_flags; | 584 | unsigned int f_flags; |
583 | mode_t f_mode; | 585 | mode_t f_mode; |
584 | int f_error; | ||
585 | loff_t f_pos; | 586 | loff_t f_pos; |
586 | struct fown_struct f_owner; | 587 | struct fown_struct f_owner; |
587 | unsigned int f_uid, f_gid; | 588 | unsigned int f_uid, f_gid; |
@@ -674,6 +675,7 @@ struct file_lock { | |||
674 | struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ | 675 | struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ |
675 | union { | 676 | union { |
676 | struct nfs_lock_info nfs_fl; | 677 | struct nfs_lock_info nfs_fl; |
678 | struct nfs4_lock_info nfs4_fl; | ||
677 | } fl_u; | 679 | } fl_u; |
678 | }; | 680 | }; |
679 | 681 | ||
@@ -883,7 +885,9 @@ struct block_device_operations { | |||
883 | int (*open) (struct inode *, struct file *); | 885 | int (*open) (struct inode *, struct file *); |
884 | int (*release) (struct inode *, struct file *); | 886 | int (*release) (struct inode *, struct file *); |
885 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); | 887 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); |
888 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); | ||
886 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); | 889 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); |
890 | int (*direct_access) (struct block_device *, sector_t, unsigned long *); | ||
887 | int (*media_changed) (struct gendisk *); | 891 | int (*media_changed) (struct gendisk *); |
888 | int (*revalidate_disk) (struct gendisk *); | 892 | int (*revalidate_disk) (struct gendisk *); |
889 | struct module *owner; | 893 | struct module *owner; |
@@ -1024,6 +1028,7 @@ struct super_operations { | |||
1024 | #define I_FREEING 16 | 1028 | #define I_FREEING 16 |
1025 | #define I_CLEAR 32 | 1029 | #define I_CLEAR 32 |
1026 | #define I_NEW 64 | 1030 | #define I_NEW 64 |
1031 | #define I_WILL_FREE 128 | ||
1027 | 1032 | ||
1028 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1033 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
1029 | 1034 | ||
@@ -1494,6 +1499,23 @@ extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); | |||
1494 | extern int generic_file_open(struct inode * inode, struct file * filp); | 1499 | extern int generic_file_open(struct inode * inode, struct file * filp); |
1495 | extern int nonseekable_open(struct inode * inode, struct file * filp); | 1500 | extern int nonseekable_open(struct inode * inode, struct file * filp); |
1496 | 1501 | ||
1502 | #ifdef CONFIG_FS_XIP | ||
1503 | extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len, | ||
1504 | loff_t *ppos); | ||
1505 | extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos, | ||
1506 | size_t count, read_actor_t actor, | ||
1507 | void *target); | ||
1508 | extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma); | ||
1509 | extern ssize_t xip_file_write(struct file *filp, const char __user *buf, | ||
1510 | size_t len, loff_t *ppos); | ||
1511 | extern int xip_truncate_page(struct address_space *mapping, loff_t from); | ||
1512 | #else | ||
1513 | static inline int xip_truncate_page(struct address_space *mapping, loff_t from) | ||
1514 | { | ||
1515 | return 0; | ||
1516 | } | ||
1517 | #endif | ||
1518 | |||
1497 | static inline void do_generic_file_read(struct file * filp, loff_t *ppos, | 1519 | static inline void do_generic_file_read(struct file * filp, loff_t *ppos, |
1498 | read_descriptor_t * desc, | 1520 | read_descriptor_t * desc, |
1499 | read_actor_t actor) | 1521 | read_actor_t actor) |
@@ -1657,6 +1679,52 @@ static inline void simple_transaction_set(struct file *file, size_t n) | |||
1657 | ar->size = n; | 1679 | ar->size = n; |
1658 | } | 1680 | } |
1659 | 1681 | ||
1682 | /* | ||
1683 | * simple attribute files | ||
1684 | * | ||
1685 | * These attributes behave similar to those in sysfs: | ||
1686 | * | ||
1687 | * Writing to an attribute immediately sets a value, an open file can be | ||
1688 | * written to multiple times. | ||
1689 | * | ||
1690 | * Reading from an attribute creates a buffer from the value that might get | ||
1691 | * read with multiple read calls. When the attribute has been read | ||
1692 | * completely, no further read calls are possible until the file is opened | ||
1693 | * again. | ||
1694 | * | ||
1695 | * All attributes contain a text representation of a numeric value | ||
1696 | * that are accessed with the get() and set() functions. | ||
1697 | */ | ||
1698 | #define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \ | ||
1699 | static int __fops ## _open(struct inode *inode, struct file *file) \ | ||
1700 | { \ | ||
1701 | __simple_attr_check_format(__fmt, 0ull); \ | ||
1702 | return simple_attr_open(inode, file, __get, __set, __fmt); \ | ||
1703 | } \ | ||
1704 | static struct file_operations __fops = { \ | ||
1705 | .owner = THIS_MODULE, \ | ||
1706 | .open = __fops ## _open, \ | ||
1707 | .release = simple_attr_close, \ | ||
1708 | .read = simple_attr_read, \ | ||
1709 | .write = simple_attr_write, \ | ||
1710 | }; | ||
1711 | |||
1712 | static inline void __attribute__((format(printf, 1, 2))) | ||
1713 | __simple_attr_check_format(const char *fmt, ...) | ||
1714 | { | ||
1715 | /* don't do anything, just let the compiler check the arguments; */ | ||
1716 | } | ||
1717 | |||
1718 | int simple_attr_open(struct inode *inode, struct file *file, | ||
1719 | u64 (*get)(void *), void (*set)(void *, u64), | ||
1720 | const char *fmt); | ||
1721 | int simple_attr_close(struct inode *inode, struct file *file); | ||
1722 | ssize_t simple_attr_read(struct file *file, char __user *buf, | ||
1723 | size_t len, loff_t *ppos); | ||
1724 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | ||
1725 | size_t len, loff_t *ppos); | ||
1726 | |||
1727 | |||
1660 | #ifdef CONFIG_SECURITY | 1728 | #ifdef CONFIG_SECURITY |
1661 | static inline char *alloc_secdata(void) | 1729 | static inline char *alloc_secdata(void) |
1662 | { | 1730 | { |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index faaff4c64559..70f54af87b9f 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -51,6 +51,7 @@ struct gianfar_platform_data { | |||
51 | 51 | ||
52 | /* board specific information */ | 52 | /* board specific information */ |
53 | u32 board_flags; | 53 | u32 board_flags; |
54 | u32 phy_flags; | ||
54 | u32 phyid; | 55 | u32 phyid; |
55 | u32 interruptPHY; | 56 | u32 interruptPHY; |
56 | u8 mac_addr[6]; | 57 | u8 mac_addr[6]; |
@@ -61,9 +62,14 @@ struct gianfar_platform_data { | |||
61 | #define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002 | 62 | #define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002 |
62 | #define FSL_GIANFAR_DEV_HAS_RMON 0x00000004 | 63 | #define FSL_GIANFAR_DEV_HAS_RMON 0x00000004 |
63 | #define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008 | 64 | #define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008 |
65 | #define FSL_GIANFAR_DEV_HAS_CSUM 0x00000010 | ||
66 | #define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020 | ||
67 | #define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040 | ||
68 | #define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080 | ||
64 | 69 | ||
65 | /* Flags in gianfar_platform_data */ | 70 | /* Flags in gianfar_platform_data */ |
66 | #define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* if not set use a timer */ | 71 | #define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ |
72 | #define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */ | ||
67 | 73 | ||
68 | struct fsl_i2c_platform_data { | 74 | struct fsl_i2c_platform_data { |
69 | /* device specific information */ | 75 | /* device specific information */ |
diff --git a/include/linux/gameport.h b/include/linux/gameport.h index b1272f822cfa..cd623eccdbea 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h | |||
@@ -67,6 +67,8 @@ int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mo | |||
67 | void gameport_close(struct gameport *gameport); | 67 | void gameport_close(struct gameport *gameport); |
68 | void gameport_rescan(struct gameport *gameport); | 68 | void gameport_rescan(struct gameport *gameport); |
69 | 69 | ||
70 | #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) | ||
71 | |||
70 | void __gameport_register_port(struct gameport *gameport, struct module *owner); | 72 | void __gameport_register_port(struct gameport *gameport, struct module *owner); |
71 | static inline void gameport_register_port(struct gameport *gameport) | 73 | static inline void gameport_register_port(struct gameport *gameport) |
72 | { | 74 | { |
@@ -75,6 +77,29 @@ static inline void gameport_register_port(struct gameport *gameport) | |||
75 | 77 | ||
76 | void gameport_unregister_port(struct gameport *gameport); | 78 | void gameport_unregister_port(struct gameport *gameport); |
77 | 79 | ||
80 | void gameport_set_phys(struct gameport *gameport, const char *fmt, ...) | ||
81 | __attribute__ ((format (printf, 2, 3))); | ||
82 | |||
83 | #else | ||
84 | |||
85 | static inline void gameport_register_port(struct gameport *gameport) | ||
86 | { | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | static inline void gameport_unregister_port(struct gameport *gameport) | ||
91 | { | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | static inline void gameport_set_phys(struct gameport *gameport, | ||
96 | const char *fmt, ...) | ||
97 | { | ||
98 | return; | ||
99 | } | ||
100 | |||
101 | #endif | ||
102 | |||
78 | static inline struct gameport *gameport_allocate_port(void) | 103 | static inline struct gameport *gameport_allocate_port(void) |
79 | { | 104 | { |
80 | struct gameport *gameport = kcalloc(1, sizeof(struct gameport), GFP_KERNEL); | 105 | struct gameport *gameport = kcalloc(1, sizeof(struct gameport), GFP_KERNEL); |
@@ -92,9 +117,6 @@ static inline void gameport_set_name(struct gameport *gameport, const char *name | |||
92 | strlcpy(gameport->name, name, sizeof(gameport->name)); | 117 | strlcpy(gameport->name, name, sizeof(gameport->name)); |
93 | } | 118 | } |
94 | 119 | ||
95 | void gameport_set_phys(struct gameport *gameport, const char *fmt, ...) | ||
96 | __attribute__ ((format (printf, 2, 3))); | ||
97 | |||
98 | /* | 120 | /* |
99 | * Use the following fucntions to manipulate gameport's per-port | 121 | * Use the following fucntions to manipulate gameport's per-port |
100 | * driver-specific data. | 122 | * driver-specific data. |
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h new file mode 100644 index 000000000000..7fd0576a4454 --- /dev/null +++ b/include/linux/genalloc.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Basic general purpose allocator for managing special purpose memory | ||
3 | * not managed by the regular kmalloc/kfree interface. | ||
4 | * Uses for this includes on-device special memory, uncached memory | ||
5 | * etc. | ||
6 | * | ||
7 | * This code is based on the buddy allocator found in the sym53c8xx_2 | ||
8 | * driver, adapted for general purpose use. | ||
9 | * | ||
10 | * This source code is licensed under the GNU General Public License, | ||
11 | * Version 2. See the file COPYING for more details. | ||
12 | */ | ||
13 | |||
14 | #include <linux/spinlock.h> | ||
15 | |||
16 | #define ALLOC_MIN_SHIFT 5 /* 32 bytes minimum */ | ||
17 | /* | ||
18 | * Link between free memory chunks of a given size. | ||
19 | */ | ||
20 | struct gen_pool_link { | ||
21 | struct gen_pool_link *next; | ||
22 | }; | ||
23 | |||
24 | /* | ||
25 | * Memory pool descriptor. | ||
26 | */ | ||
27 | struct gen_pool { | ||
28 | spinlock_t lock; | ||
29 | unsigned long (*get_new_chunk)(struct gen_pool *); | ||
30 | struct gen_pool *next; | ||
31 | struct gen_pool_link *h; | ||
32 | unsigned long private; | ||
33 | int max_chunk_shift; | ||
34 | }; | ||
35 | |||
36 | unsigned long gen_pool_alloc(struct gen_pool *poolp, int size); | ||
37 | void gen_pool_free(struct gen_pool *mp, unsigned long ptr, int size); | ||
38 | struct gen_pool *gen_pool_create(int nr_chunks, int max_chunk_shift, | ||
39 | unsigned long (*fp)(struct gen_pool *), | ||
40 | unsigned long data); | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 47dedaf971d6..01796c41c951 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -224,7 +224,7 @@ static inline void free_disk_stats(struct gendisk *disk) | |||
224 | extern void disk_round_stats(struct gendisk *disk); | 224 | extern void disk_round_stats(struct gendisk *disk); |
225 | 225 | ||
226 | /* drivers/block/genhd.c */ | 226 | /* drivers/block/genhd.c */ |
227 | extern int get_blkdev_list(char *); | 227 | extern int get_blkdev_list(char *, int); |
228 | extern void add_disk(struct gendisk *disk); | 228 | extern void add_disk(struct gendisk *disk); |
229 | extern void del_gendisk(struct gendisk *gp); | 229 | extern void del_gendisk(struct gendisk *gp); |
230 | extern void unlink_gendisk(struct gendisk *gp); | 230 | extern void unlink_gendisk(struct gendisk *gp); |
@@ -403,6 +403,7 @@ extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | |||
403 | extern void add_partition(struct gendisk *, int, sector_t, sector_t); | 403 | extern void add_partition(struct gendisk *, int, sector_t, sector_t); |
404 | extern void delete_partition(struct gendisk *, int); | 404 | extern void delete_partition(struct gendisk *, int); |
405 | 405 | ||
406 | extern struct gendisk *alloc_disk_node(int minors, int node_id); | ||
406 | extern struct gendisk *alloc_disk(int minors); | 407 | extern struct gendisk *alloc_disk(int minors); |
407 | extern struct kobject *get_disk(struct gendisk *disk); | 408 | extern struct kobject *get_disk(struct gendisk *disk); |
408 | extern void put_disk(struct gendisk *disk); | 409 | extern void put_disk(struct gendisk *disk); |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index af7407e8cfc5..8d6bf608b199 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -39,6 +39,7 @@ struct vm_area_struct; | |||
39 | #define __GFP_COMP 0x4000u /* Add compound page metadata */ | 39 | #define __GFP_COMP 0x4000u /* Add compound page metadata */ |
40 | #define __GFP_ZERO 0x8000u /* Return zeroed page on success */ | 40 | #define __GFP_ZERO 0x8000u /* Return zeroed page on success */ |
41 | #define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */ | 41 | #define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */ |
42 | #define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */ | ||
42 | 43 | ||
43 | #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ | 44 | #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ |
44 | #define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) | 45 | #define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) |
@@ -47,7 +48,7 @@ struct vm_area_struct; | |||
47 | #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ | 48 | #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ |
48 | __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ | 49 | __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ |
49 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ | 50 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ |
50 | __GFP_NOMEMALLOC) | 51 | __GFP_NOMEMALLOC|__GFP_NORECLAIM) |
51 | 52 | ||
52 | #define GFP_ATOMIC (__GFP_HIGH) | 53 | #define GFP_ATOMIC (__GFP_HIGH) |
53 | #define GFP_NOIO (__GFP_WAIT) | 54 | #define GFP_NOIO (__GFP_WAIT) |
@@ -132,5 +133,10 @@ extern void FASTCALL(free_cold_page(struct page *page)); | |||
132 | #define free_page(addr) free_pages((addr),0) | 133 | #define free_page(addr) free_pages((addr),0) |
133 | 134 | ||
134 | void page_alloc_init(void); | 135 | void page_alloc_init(void); |
136 | #ifdef CONFIG_NUMA | ||
137 | void drain_remote_pages(void); | ||
138 | #else | ||
139 | static inline void drain_remote_pages(void) { }; | ||
140 | #endif | ||
135 | 141 | ||
136 | #endif /* __LINUX_GFP_H */ | 142 | #endif /* __LINUX_GFP_H */ |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index ebc712e91066..8336dba18971 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
@@ -43,13 +43,17 @@ | |||
43 | #define __IRQ_MASK(x) ((1UL << (x))-1) | 43 | #define __IRQ_MASK(x) ((1UL << (x))-1) |
44 | 44 | ||
45 | #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) | 45 | #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) |
46 | #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) | ||
47 | #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) | 46 | #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) |
47 | #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) | ||
48 | 48 | ||
49 | #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) | 49 | #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) |
50 | #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) | 50 | #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) |
51 | #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) | 51 | #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) |
52 | 52 | ||
53 | #if PREEMPT_ACTIVE < (1 << (HARDIRQ_SHIFT + HARDIRQ_BITS)) | ||
54 | #error PREEMPT_ACTIVE is too low! | ||
55 | #endif | ||
56 | |||
53 | #define hardirq_count() (preempt_count() & HARDIRQ_MASK) | 57 | #define hardirq_count() (preempt_count() & HARDIRQ_MASK) |
54 | #define softirq_count() (preempt_count() & SOFTIRQ_MASK) | 58 | #define softirq_count() (preempt_count() & SOFTIRQ_MASK) |
55 | #define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) | 59 | #define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) |
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h index 503194e62fe1..ed2927ef1ff7 100644 --- a/include/linux/hdlc.h +++ b/include/linux/hdlc.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Generic HDLC support routines for Linux | 2 | * Generic HDLC support routines for Linux |
3 | * | 3 | * |
4 | * Copyright (C) 1999-2003 Krzysztof Halasa <khc@pm.waw.pl> | 4 | * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of version 2 of the GNU General Public License | 7 | * under the terms of version 2 of the GNU General Public License |
@@ -41,6 +41,7 @@ | |||
41 | #define LMI_NONE 1 /* No LMI, all PVCs are static */ | 41 | #define LMI_NONE 1 /* No LMI, all PVCs are static */ |
42 | #define LMI_ANSI 2 /* ANSI Annex D */ | 42 | #define LMI_ANSI 2 /* ANSI Annex D */ |
43 | #define LMI_CCITT 3 /* ITU-T Annex A */ | 43 | #define LMI_CCITT 3 /* ITU-T Annex A */ |
44 | #define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ | ||
44 | 45 | ||
45 | #define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ | 46 | #define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ |
46 | #define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ | 47 | #define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ |
@@ -89,6 +90,7 @@ typedef struct pvc_device_struct { | |||
89 | unsigned int deleted: 1; | 90 | unsigned int deleted: 1; |
90 | unsigned int fecn: 1; | 91 | unsigned int fecn: 1; |
91 | unsigned int becn: 1; | 92 | unsigned int becn: 1; |
93 | unsigned int bandwidth; /* Cisco LMI reporting only */ | ||
92 | }state; | 94 | }state; |
93 | }pvc_device; | 95 | }pvc_device; |
94 | 96 | ||
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 2a7e6c65c882..6bece9280eb7 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -28,6 +28,7 @@ static inline void *kmap(struct page *page) | |||
28 | 28 | ||
29 | #define kmap_atomic(page, idx) page_address(page) | 29 | #define kmap_atomic(page, idx) page_address(page) |
30 | #define kunmap_atomic(addr, idx) do { } while (0) | 30 | #define kunmap_atomic(addr, idx) do { } while (0) |
31 | #define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) | ||
31 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) | 32 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) |
32 | 33 | ||
33 | #endif /* CONFIG_HIGHMEM */ | 34 | #endif /* CONFIG_HIGHMEM */ |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 6af1ae4a8211..f529d1442815 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #ifdef CONFIG_HUGETLB_PAGE | 4 | #ifdef CONFIG_HUGETLB_PAGE |
5 | 5 | ||
6 | #include <linux/mempolicy.h> | 6 | #include <linux/mempolicy.h> |
7 | #include <asm/tlbflush.h> | ||
7 | 8 | ||
8 | struct ctl_table; | 9 | struct ctl_table; |
9 | 10 | ||
@@ -22,12 +23,6 @@ int hugetlb_report_meminfo(char *); | |||
22 | int hugetlb_report_node_meminfo(int, char *); | 23 | int hugetlb_report_node_meminfo(int, char *); |
23 | int is_hugepage_mem_enough(size_t); | 24 | int is_hugepage_mem_enough(size_t); |
24 | unsigned long hugetlb_total_pages(void); | 25 | unsigned long hugetlb_total_pages(void); |
25 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, | ||
26 | int write); | ||
27 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, | ||
28 | pmd_t *pmd, int write); | ||
29 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len); | ||
30 | int pmd_huge(pmd_t pmd); | ||
31 | struct page *alloc_huge_page(void); | 26 | struct page *alloc_huge_page(void); |
32 | void free_huge_page(struct page *); | 27 | void free_huge_page(struct page *); |
33 | 28 | ||
@@ -35,6 +30,17 @@ extern unsigned long max_huge_pages; | |||
35 | extern const unsigned long hugetlb_zero, hugetlb_infinity; | 30 | extern const unsigned long hugetlb_zero, hugetlb_infinity; |
36 | extern int sysctl_hugetlb_shm_group; | 31 | extern int sysctl_hugetlb_shm_group; |
37 | 32 | ||
33 | /* arch callbacks */ | ||
34 | |||
35 | pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr); | ||
36 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); | ||
37 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, | ||
38 | int write); | ||
39 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, | ||
40 | pmd_t *pmd, int write); | ||
41 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len); | ||
42 | int pmd_huge(pmd_t pmd); | ||
43 | |||
38 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE | 44 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE |
39 | #define is_hugepage_only_range(mm, addr, len) 0 | 45 | #define is_hugepage_only_range(mm, addr, len) 0 |
40 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ | 46 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ |
@@ -48,6 +54,28 @@ extern int sysctl_hugetlb_shm_group; | |||
48 | int prepare_hugepage_range(unsigned long addr, unsigned long len); | 54 | int prepare_hugepage_range(unsigned long addr, unsigned long len); |
49 | #endif | 55 | #endif |
50 | 56 | ||
57 | #ifndef ARCH_HAS_SETCLEAR_HUGE_PTE | ||
58 | #define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte) | ||
59 | #define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep) | ||
60 | #else | ||
61 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
62 | pte_t *ptep, pte_t pte); | ||
63 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | ||
64 | pte_t *ptep); | ||
65 | #endif | ||
66 | |||
67 | #ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK | ||
68 | #define hugetlb_prefault_arch_hook(mm) do { } while (0) | ||
69 | #else | ||
70 | void hugetlb_prefault_arch_hook(struct mm_struct *mm); | ||
71 | #endif | ||
72 | |||
73 | #ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE | ||
74 | #define hugetlb_clean_stale_pgtable(pte) BUG() | ||
75 | #else | ||
76 | void hugetlb_clean_stale_pgtable(pte_t *pte); | ||
77 | #endif | ||
78 | |||
51 | #else /* !CONFIG_HUGETLB_PAGE */ | 79 | #else /* !CONFIG_HUGETLB_PAGE */ |
52 | 80 | ||
53 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | 81 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h new file mode 100644 index 000000000000..1b5018a965f5 --- /dev/null +++ b/include/linux/hwmon-sysfs.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * hwmon-sysfs.h - hardware monitoring chip driver sysfs defines | ||
3 | * | ||
4 | * Copyright (C) 2005 Yani Ioannou <yani.ioannou@gmail.com> | ||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | #ifndef _LINUX_HWMON_SYSFS_H | ||
21 | #define _LINUX_HWMON_SYSFS_H | ||
22 | |||
23 | struct sensor_device_attribute{ | ||
24 | struct device_attribute dev_attr; | ||
25 | int index; | ||
26 | }; | ||
27 | #define to_sensor_dev_attr(_dev_attr) \ | ||
28 | container_of(_dev_attr, struct sensor_device_attribute, dev_attr) | ||
29 | |||
30 | #define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index) \ | ||
31 | struct sensor_device_attribute sensor_dev_attr_##_name = { \ | ||
32 | .dev_attr = __ATTR(_name,_mode,_show,_store), \ | ||
33 | .index = _index, \ | ||
34 | } | ||
35 | |||
36 | #endif /* _LINUX_HWMON_SYSFS_H */ | ||
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 89270ce51470..33f08258f22b 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -108,6 +108,7 @@ | |||
108 | #define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */ | 108 | #define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */ |
109 | #define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ | 109 | #define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ |
110 | #define I2C_DRIVERID_SAA7114H 64 /* video decoder */ | 110 | #define I2C_DRIVERID_SAA7114H 64 /* video decoder */ |
111 | #define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */ | ||
111 | 112 | ||
112 | 113 | ||
113 | #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ | 114 | #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ |
diff --git a/include/linux/i2c-vid.h b/include/linux/i2c-vid.h index 974835e3530f..41d0635e0ba9 100644 --- a/include/linux/i2c-vid.h +++ b/include/linux/i2c-vid.h | |||
@@ -97,3 +97,15 @@ static inline int vid_from_reg(int val, int vrm) | |||
97 | 2050 - (val) * 50); | 97 | 2050 - (val) * 50); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | |||
101 | static inline int vid_to_reg(int val, int vrm) | ||
102 | { | ||
103 | switch (vrm) { | ||
104 | case 91: /* VRM 9.1 */ | ||
105 | case 90: /* VRM 9.0 */ | ||
106 | return ((val >= 1100) && (val <= 1850) ? | ||
107 | ((18499 - val * 10) / 25 + 5) / 10 : -1); | ||
108 | default: | ||
109 | return -1; | ||
110 | } | ||
111 | } | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index ebcd745f4cd6..be837b13f297 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -290,11 +290,8 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) | |||
290 | */ | 290 | */ |
291 | struct i2c_client_address_data { | 291 | struct i2c_client_address_data { |
292 | unsigned short *normal_i2c; | 292 | unsigned short *normal_i2c; |
293 | unsigned short *normal_i2c_range; | ||
294 | unsigned short *probe; | 293 | unsigned short *probe; |
295 | unsigned short *probe_range; | ||
296 | unsigned short *ignore; | 294 | unsigned short *ignore; |
297 | unsigned short *ignore_range; | ||
298 | unsigned short *force; | 295 | unsigned short *force; |
299 | }; | 296 | }; |
300 | 297 | ||
@@ -563,24 +560,15 @@ union i2c_smbus_data { | |||
563 | #define I2C_CLIENT_INSMOD \ | 560 | #define I2C_CLIENT_INSMOD \ |
564 | I2C_CLIENT_MODULE_PARM(probe, \ | 561 | I2C_CLIENT_MODULE_PARM(probe, \ |
565 | "List of adapter,address pairs to scan additionally"); \ | 562 | "List of adapter,address pairs to scan additionally"); \ |
566 | I2C_CLIENT_MODULE_PARM(probe_range, \ | ||
567 | "List of adapter,start-addr,end-addr triples to scan " \ | ||
568 | "additionally"); \ | ||
569 | I2C_CLIENT_MODULE_PARM(ignore, \ | 563 | I2C_CLIENT_MODULE_PARM(ignore, \ |
570 | "List of adapter,address pairs not to scan"); \ | 564 | "List of adapter,address pairs not to scan"); \ |
571 | I2C_CLIENT_MODULE_PARM(ignore_range, \ | ||
572 | "List of adapter,start-addr,end-addr triples not to " \ | ||
573 | "scan"); \ | ||
574 | I2C_CLIENT_MODULE_PARM(force, \ | 565 | I2C_CLIENT_MODULE_PARM(force, \ |
575 | "List of adapter,address pairs to boldly assume " \ | 566 | "List of adapter,address pairs to boldly assume " \ |
576 | "to be present"); \ | 567 | "to be present"); \ |
577 | static struct i2c_client_address_data addr_data = { \ | 568 | static struct i2c_client_address_data addr_data = { \ |
578 | .normal_i2c = normal_i2c, \ | 569 | .normal_i2c = normal_i2c, \ |
579 | .normal_i2c_range = normal_i2c_range, \ | ||
580 | .probe = probe, \ | 570 | .probe = probe, \ |
581 | .probe_range = probe_range, \ | ||
582 | .ignore = ignore, \ | 571 | .ignore = ignore, \ |
583 | .ignore_range = ignore_range, \ | ||
584 | .force = force, \ | 572 | .force = force, \ |
585 | } | 573 | } |
586 | 574 | ||
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h index ef7f644dd873..36fd18cdad28 100644 --- a/include/linux/i2o-dev.h +++ b/include/linux/i2o-dev.h | |||
@@ -24,6 +24,13 @@ | |||
24 | #define MAX_I2O_CONTROLLERS 32 | 24 | #define MAX_I2O_CONTROLLERS 32 |
25 | 25 | ||
26 | //#include <linux/ioctl.h> | 26 | //#include <linux/ioctl.h> |
27 | #ifndef __KERNEL__ | ||
28 | |||
29 | typedef unsigned char u8; | ||
30 | typedef unsigned short u16; | ||
31 | typedef unsigned int u32; | ||
32 | |||
33 | #endif /* __KERNEL__ */ | ||
27 | 34 | ||
28 | /* | 35 | /* |
29 | * I2O Control IOCTLs and structures | 36 | * I2O Control IOCTLs and structures |
@@ -113,6 +120,10 @@ struct i2o_evt_get { | |||
113 | int lost; | 120 | int lost; |
114 | }; | 121 | }; |
115 | 122 | ||
123 | typedef struct i2o_sg_io_hdr { | ||
124 | unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */ | ||
125 | } i2o_sg_io_hdr_t; | ||
126 | |||
116 | /************************************************************************** | 127 | /************************************************************************** |
117 | * HRT related constants and structures | 128 | * HRT related constants and structures |
118 | **************************************************************************/ | 129 | **************************************************************************/ |
@@ -126,14 +137,6 @@ struct i2o_evt_get { | |||
126 | #define I2O_BUS_CARDBUS 7 | 137 | #define I2O_BUS_CARDBUS 7 |
127 | #define I2O_BUS_UNKNOWN 0x80 | 138 | #define I2O_BUS_UNKNOWN 0x80 |
128 | 139 | ||
129 | #ifndef __KERNEL__ | ||
130 | |||
131 | typedef unsigned char u8; | ||
132 | typedef unsigned short u16; | ||
133 | typedef unsigned int u32; | ||
134 | |||
135 | #endif /* __KERNEL__ */ | ||
136 | |||
137 | typedef struct _i2o_pci_bus { | 140 | typedef struct _i2o_pci_bus { |
138 | u8 PciFunctionNumber; | 141 | u8 PciFunctionNumber; |
139 | u8 PciDeviceNumber; | 142 | u8 PciDeviceNumber; |
@@ -333,7 +336,7 @@ typedef struct _i2o_status_block { | |||
333 | #define I2O_CLASS_ATE_PERIPHERAL 0x061 | 336 | #define I2O_CLASS_ATE_PERIPHERAL 0x061 |
334 | #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 | 337 | #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 |
335 | #define I2O_CLASS_FLOPPY_DEVICE 0x071 | 338 | #define I2O_CLASS_FLOPPY_DEVICE 0x071 |
336 | #define I2O_CLASS_BUS_ADAPTER_PORT 0x080 | 339 | #define I2O_CLASS_BUS_ADAPTER 0x080 |
337 | #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 | 340 | #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 |
338 | #define I2O_CLASS_PEER_TRANSPORT 0x091 | 341 | #define I2O_CLASS_PEER_TRANSPORT 0x091 |
339 | #define I2O_CLASS_END 0xfff | 342 | #define I2O_CLASS_END 0xfff |
@@ -399,4 +402,26 @@ typedef struct _i2o_status_block { | |||
399 | #define ADAPTER_STATE_FAILED 0x10 | 402 | #define ADAPTER_STATE_FAILED 0x10 |
400 | #define ADAPTER_STATE_FAULTED 0x11 | 403 | #define ADAPTER_STATE_FAULTED 0x11 |
401 | 404 | ||
405 | /* | ||
406 | * Software module types | ||
407 | */ | ||
408 | #define I2O_SOFTWARE_MODULE_IRTOS 0x11 | ||
409 | #define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22 | ||
410 | #define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23 | ||
411 | |||
412 | /* | ||
413 | * Vendors | ||
414 | */ | ||
415 | #define I2O_VENDOR_DPT 0x001b | ||
416 | |||
417 | /* | ||
418 | * DPT / Adaptec specific values for i2o_sg_io_hdr flags. | ||
419 | */ | ||
420 | #define I2O_DPT_SG_FLAG_INTERPRET 0x00010000 | ||
421 | #define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000 | ||
422 | |||
423 | #define I2O_DPT_FLASH_FRAG_SIZE 0x10000 | ||
424 | #define I2O_DPT_FLASH_READ 0x0101 | ||
425 | #define I2O_DPT_FLASH_WRITE 0x0102 | ||
426 | |||
402 | #endif /* _I2O_DEV_H */ | 427 | #endif /* _I2O_DEV_H */ |
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index ea9a3ad4b67f..bdc286ec947c 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -119,12 +119,21 @@ struct i2o_driver { | |||
119 | }; | 119 | }; |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Contains all information which are necessary for DMA operations | 122 | * Contains DMA mapped address information |
123 | */ | 123 | */ |
124 | struct i2o_dma { | 124 | struct i2o_dma { |
125 | void *virt; | 125 | void *virt; |
126 | dma_addr_t phys; | 126 | dma_addr_t phys; |
127 | u32 len; | 127 | size_t len; |
128 | }; | ||
129 | |||
130 | /* | ||
131 | * Contains IO mapped address information | ||
132 | */ | ||
133 | struct i2o_io { | ||
134 | void __iomem *virt; | ||
135 | unsigned long phys; | ||
136 | unsigned long len; | ||
128 | }; | 137 | }; |
129 | 138 | ||
130 | /* | 139 | /* |
@@ -147,28 +156,25 @@ struct i2o_controller { | |||
147 | 156 | ||
148 | struct pci_dev *pdev; /* PCI device */ | 157 | struct pci_dev *pdev; /* PCI device */ |
149 | 158 | ||
150 | unsigned int short_req:1; /* use small block sizes */ | 159 | unsigned int promise:1; /* Promise controller */ |
160 | unsigned int adaptec:1; /* DPT / Adaptec controller */ | ||
161 | unsigned int raptor:1; /* split bar */ | ||
151 | unsigned int no_quiesce:1; /* dont quiesce before reset */ | 162 | unsigned int no_quiesce:1; /* dont quiesce before reset */ |
152 | unsigned int raptor:1; /* split bar */ | 163 | unsigned int short_req:1; /* use small block sizes */ |
153 | unsigned int promise:1; /* Promise controller */ | 164 | unsigned int limit_sectors:1; /* limit number of sectors / request */ |
154 | 165 | unsigned int pae_support:1; /* controller has 64-bit SGL support */ | |
155 | #ifdef CONFIG_MTRR | ||
156 | int mtrr_reg0; | ||
157 | int mtrr_reg1; | ||
158 | #endif | ||
159 | 166 | ||
160 | struct list_head devices; /* list of I2O devices */ | 167 | struct list_head devices; /* list of I2O devices */ |
161 | |||
162 | struct notifier_block *event_notifer; /* Events */ | ||
163 | atomic_t users; | ||
164 | struct list_head list; /* Controller list */ | 168 | struct list_head list; /* Controller list */ |
165 | void __iomem *post_port; /* Inbout port address */ | 169 | |
166 | void __iomem *reply_port; /* Outbound port address */ | 170 | void __iomem *in_port; /* Inbout port address */ |
167 | void __iomem *irq_mask; /* Interrupt register address */ | 171 | void __iomem *out_port; /* Outbound port address */ |
172 | void __iomem *irq_status; /* Interrupt status register address */ | ||
173 | void __iomem *irq_mask; /* Interrupt mask register address */ | ||
168 | 174 | ||
169 | /* Dynamic LCT related data */ | 175 | /* Dynamic LCT related data */ |
170 | 176 | ||
171 | struct i2o_dma status; /* status of IOP */ | 177 | struct i2o_dma status; /* IOP status block */ |
172 | 178 | ||
173 | struct i2o_dma hrt; /* HW Resource Table */ | 179 | struct i2o_dma hrt; /* HW Resource Table */ |
174 | i2o_lct *lct; /* Logical Config Table */ | 180 | i2o_lct *lct; /* Logical Config Table */ |
@@ -176,21 +182,19 @@ struct i2o_controller { | |||
176 | struct semaphore lct_lock; /* Lock for LCT updates */ | 182 | struct semaphore lct_lock; /* Lock for LCT updates */ |
177 | struct i2o_dma status_block; /* IOP status block */ | 183 | struct i2o_dma status_block; /* IOP status block */ |
178 | 184 | ||
179 | struct i2o_dma base; /* controller messaging unit */ | 185 | struct i2o_io base; /* controller messaging unit */ |
180 | struct i2o_dma in_queue; /* inbound message queue Host->IOP */ | 186 | struct i2o_io in_queue; /* inbound message queue Host->IOP */ |
181 | struct i2o_dma out_queue; /* outbound message queue IOP->Host */ | 187 | struct i2o_dma out_queue; /* outbound message queue IOP->Host */ |
182 | 188 | ||
183 | unsigned int battery:1; /* Has a battery backup */ | 189 | unsigned int battery:1; /* Has a battery backup */ |
184 | unsigned int io_alloc:1; /* An I/O resource was allocated */ | 190 | unsigned int io_alloc:1; /* An I/O resource was allocated */ |
185 | unsigned int mem_alloc:1; /* A memory resource was allocated */ | 191 | unsigned int mem_alloc:1; /* A memory resource was allocated */ |
186 | 192 | ||
187 | struct resource io_resource; /* I/O resource allocated to the IOP */ | 193 | struct resource io_resource; /* I/O resource allocated to the IOP */ |
188 | struct resource mem_resource; /* Mem resource allocated to the IOP */ | 194 | struct resource mem_resource; /* Mem resource allocated to the IOP */ |
189 | 195 | ||
190 | struct proc_dir_entry *proc_entry; /* /proc dir */ | ||
191 | |||
192 | struct list_head bus_list; /* list of busses on IOP */ | ||
193 | struct device device; | 196 | struct device device; |
197 | struct class_device classdev; /* I2O controller class */ | ||
194 | struct i2o_device *exec; /* Executive */ | 198 | struct i2o_device *exec; /* Executive */ |
195 | #if BITS_PER_LONG == 64 | 199 | #if BITS_PER_LONG == 64 |
196 | spinlock_t context_list_lock; /* lock for context_list */ | 200 | spinlock_t context_list_lock; /* lock for context_list */ |
@@ -241,9 +245,10 @@ struct i2o_sys_tbl { | |||
241 | extern struct list_head i2o_controllers; | 245 | extern struct list_head i2o_controllers; |
242 | 246 | ||
243 | /* Message functions */ | 247 | /* Message functions */ |
244 | static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message __iomem **); | 248 | static inline u32 i2o_msg_get(struct i2o_controller *, |
245 | extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message __iomem **, | 249 | struct i2o_message __iomem **); |
246 | int); | 250 | extern u32 i2o_msg_get_wait(struct i2o_controller *, |
251 | struct i2o_message __iomem **, int); | ||
247 | static inline void i2o_msg_post(struct i2o_controller *, u32); | 252 | static inline void i2o_msg_post(struct i2o_controller *, u32); |
248 | static inline int i2o_msg_post_wait(struct i2o_controller *, u32, | 253 | static inline int i2o_msg_post_wait(struct i2o_controller *, u32, |
249 | unsigned long); | 254 | unsigned long); |
@@ -252,15 +257,6 @@ extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long, | |||
252 | extern void i2o_msg_nop(struct i2o_controller *, u32); | 257 | extern void i2o_msg_nop(struct i2o_controller *, u32); |
253 | static inline void i2o_flush_reply(struct i2o_controller *, u32); | 258 | static inline void i2o_flush_reply(struct i2o_controller *, u32); |
254 | 259 | ||
255 | /* DMA handling functions */ | ||
256 | static inline int i2o_dma_alloc(struct device *, struct i2o_dma *, size_t, | ||
257 | unsigned int); | ||
258 | static inline void i2o_dma_free(struct device *, struct i2o_dma *); | ||
259 | int i2o_dma_realloc(struct device *, struct i2o_dma *, size_t, unsigned int); | ||
260 | |||
261 | static inline int i2o_dma_map(struct device *, struct i2o_dma *); | ||
262 | static inline void i2o_dma_unmap(struct device *, struct i2o_dma *); | ||
263 | |||
264 | /* IOP functions */ | 260 | /* IOP functions */ |
265 | extern int i2o_status_get(struct i2o_controller *); | 261 | extern int i2o_status_get(struct i2o_controller *); |
266 | 262 | ||
@@ -285,6 +281,16 @@ static inline u32 i2o_ptr_high(void *ptr) | |||
285 | { | 281 | { |
286 | return (u32) ((u64) ptr >> 32); | 282 | return (u32) ((u64) ptr >> 32); |
287 | }; | 283 | }; |
284 | |||
285 | static inline u32 i2o_dma_low(dma_addr_t dma_addr) | ||
286 | { | ||
287 | return (u32) (u64) dma_addr; | ||
288 | }; | ||
289 | |||
290 | static inline u32 i2o_dma_high(dma_addr_t dma_addr) | ||
291 | { | ||
292 | return (u32) ((u64) dma_addr >> 32); | ||
293 | }; | ||
288 | #else | 294 | #else |
289 | static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr) | 295 | static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr) |
290 | { | 296 | { |
@@ -315,8 +321,246 @@ static inline u32 i2o_ptr_high(void *ptr) | |||
315 | { | 321 | { |
316 | return 0; | 322 | return 0; |
317 | }; | 323 | }; |
324 | |||
325 | static inline u32 i2o_dma_low(dma_addr_t dma_addr) | ||
326 | { | ||
327 | return (u32) dma_addr; | ||
328 | }; | ||
329 | |||
330 | static inline u32 i2o_dma_high(dma_addr_t dma_addr) | ||
331 | { | ||
332 | return 0; | ||
333 | }; | ||
318 | #endif | 334 | #endif |
319 | 335 | ||
336 | /** | ||
337 | * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL | ||
338 | * @c: I2O controller for which the calculation should be done | ||
339 | * @body_size: maximum body size used for message in 32-bit words. | ||
340 | * | ||
341 | * Return the maximum number of SG elements in a SG list. | ||
342 | */ | ||
343 | static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size) | ||
344 | { | ||
345 | i2o_status_block *sb = c->status_block.virt; | ||
346 | u16 sg_count = | ||
347 | (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) - | ||
348 | body_size; | ||
349 | |||
350 | if (c->pae_support) { | ||
351 | /* | ||
352 | * for 64-bit a SG attribute element must be added and each | ||
353 | * SG element needs 12 bytes instead of 8. | ||
354 | */ | ||
355 | sg_count -= 2; | ||
356 | sg_count /= 3; | ||
357 | } else | ||
358 | sg_count /= 2; | ||
359 | |||
360 | if (c->short_req && (sg_count > 8)) | ||
361 | sg_count = 8; | ||
362 | |||
363 | return sg_count; | ||
364 | }; | ||
365 | |||
366 | /** | ||
367 | * i2o_dma_map_single - Map pointer to controller and fill in I2O message. | ||
368 | * @c: I2O controller | ||
369 | * @ptr: pointer to the data which should be mapped | ||
370 | * @size: size of data in bytes | ||
371 | * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE | ||
372 | * @sg_ptr: pointer to the SG list inside the I2O message | ||
373 | * | ||
374 | * This function does all necessary DMA handling and also writes the I2O | ||
375 | * SGL elements into the I2O message. For details on DMA handling see also | ||
376 | * dma_map_single(). The pointer sg_ptr will only be set to the end of the | ||
377 | * SG list if the allocation was successful. | ||
378 | * | ||
379 | * Returns DMA address which must be checked for failures using | ||
380 | * dma_mapping_error(). | ||
381 | */ | ||
382 | static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, | ||
383 | size_t size, | ||
384 | enum dma_data_direction direction, | ||
385 | u32 __iomem ** sg_ptr) | ||
386 | { | ||
387 | u32 sg_flags; | ||
388 | u32 __iomem *mptr = *sg_ptr; | ||
389 | dma_addr_t dma_addr; | ||
390 | |||
391 | switch (direction) { | ||
392 | case DMA_TO_DEVICE: | ||
393 | sg_flags = 0xd4000000; | ||
394 | break; | ||
395 | case DMA_FROM_DEVICE: | ||
396 | sg_flags = 0xd0000000; | ||
397 | break; | ||
398 | default: | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); | ||
403 | if (!dma_mapping_error(dma_addr)) { | ||
404 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
405 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { | ||
406 | writel(0x7C020002, mptr++); | ||
407 | writel(PAGE_SIZE, mptr++); | ||
408 | } | ||
409 | #endif | ||
410 | |||
411 | writel(sg_flags | size, mptr++); | ||
412 | writel(i2o_dma_low(dma_addr), mptr++); | ||
413 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
414 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) | ||
415 | writel(i2o_dma_high(dma_addr), mptr++); | ||
416 | #endif | ||
417 | *sg_ptr = mptr; | ||
418 | } | ||
419 | return dma_addr; | ||
420 | }; | ||
421 | |||
422 | /** | ||
423 | * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message. | ||
424 | * @c: I2O controller | ||
425 | * @sg: SG list to be mapped | ||
426 | * @sg_count: number of elements in the SG list | ||
427 | * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE | ||
428 | * @sg_ptr: pointer to the SG list inside the I2O message | ||
429 | * | ||
430 | * This function does all necessary DMA handling and also writes the I2O | ||
431 | * SGL elements into the I2O message. For details on DMA handling see also | ||
432 | * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG | ||
433 | * list if the allocation was successful. | ||
434 | * | ||
435 | * Returns 0 on failure or 1 on success. | ||
436 | */ | ||
437 | static inline int i2o_dma_map_sg(struct i2o_controller *c, | ||
438 | struct scatterlist *sg, int sg_count, | ||
439 | enum dma_data_direction direction, | ||
440 | u32 __iomem ** sg_ptr) | ||
441 | { | ||
442 | u32 sg_flags; | ||
443 | u32 __iomem *mptr = *sg_ptr; | ||
444 | |||
445 | switch (direction) { | ||
446 | case DMA_TO_DEVICE: | ||
447 | sg_flags = 0x14000000; | ||
448 | break; | ||
449 | case DMA_FROM_DEVICE: | ||
450 | sg_flags = 0x10000000; | ||
451 | break; | ||
452 | default: | ||
453 | return 0; | ||
454 | } | ||
455 | |||
456 | sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction); | ||
457 | if (!sg_count) | ||
458 | return 0; | ||
459 | |||
460 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
461 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { | ||
462 | writel(0x7C020002, mptr++); | ||
463 | writel(PAGE_SIZE, mptr++); | ||
464 | } | ||
465 | #endif | ||
466 | |||
467 | while (sg_count-- > 0) { | ||
468 | if (!sg_count) | ||
469 | sg_flags |= 0xC0000000; | ||
470 | writel(sg_flags | sg_dma_len(sg), mptr++); | ||
471 | writel(i2o_dma_low(sg_dma_address(sg)), mptr++); | ||
472 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
473 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) | ||
474 | writel(i2o_dma_high(sg_dma_address(sg)), mptr++); | ||
475 | #endif | ||
476 | sg++; | ||
477 | } | ||
478 | *sg_ptr = mptr; | ||
479 | |||
480 | return 1; | ||
481 | }; | ||
482 | |||
483 | /** | ||
484 | * i2o_dma_alloc - Allocate DMA memory | ||
485 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
486 | * @addr: i2o_dma struct which should get the DMA buffer | ||
487 | * @len: length of the new DMA memory | ||
488 | * @gfp_mask: GFP mask | ||
489 | * | ||
490 | * Allocate a coherent DMA memory and write the pointers into addr. | ||
491 | * | ||
492 | * Returns 0 on success or -ENOMEM on failure. | ||
493 | */ | ||
494 | static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, | ||
495 | size_t len, unsigned int gfp_mask) | ||
496 | { | ||
497 | struct pci_dev *pdev = to_pci_dev(dev); | ||
498 | int dma_64 = 0; | ||
499 | |||
500 | if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) { | ||
501 | dma_64 = 1; | ||
502 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) | ||
503 | return -ENOMEM; | ||
504 | } | ||
505 | |||
506 | addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); | ||
507 | |||
508 | if ((sizeof(dma_addr_t) > 4) && dma_64) | ||
509 | if (pci_set_dma_mask(pdev, DMA_64BIT_MASK)) | ||
510 | printk(KERN_WARNING "i2o: unable to set 64-bit DMA"); | ||
511 | |||
512 | if (!addr->virt) | ||
513 | return -ENOMEM; | ||
514 | |||
515 | memset(addr->virt, 0, len); | ||
516 | addr->len = len; | ||
517 | |||
518 | return 0; | ||
519 | }; | ||
520 | |||
521 | /** | ||
522 | * i2o_dma_free - Free DMA memory | ||
523 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
524 | * @addr: i2o_dma struct which contains the DMA buffer | ||
525 | * | ||
526 | * Free a coherent DMA memory and set virtual address of addr to NULL. | ||
527 | */ | ||
528 | static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr) | ||
529 | { | ||
530 | if (addr->virt) { | ||
531 | if (addr->phys) | ||
532 | dma_free_coherent(dev, addr->len, addr->virt, | ||
533 | addr->phys); | ||
534 | else | ||
535 | kfree(addr->virt); | ||
536 | addr->virt = NULL; | ||
537 | } | ||
538 | }; | ||
539 | |||
540 | /** | ||
541 | * i2o_dma_realloc - Realloc DMA memory | ||
542 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
543 | * @addr: pointer to a i2o_dma struct DMA buffer | ||
544 | * @len: new length of memory | ||
545 | * @gfp_mask: GFP mask | ||
546 | * | ||
547 | * If there was something allocated in the addr, free it first. If len > 0 | ||
548 | * than try to allocate it and write the addresses back to the addr | ||
549 | * structure. If len == 0 set the virtual address to NULL. | ||
550 | * | ||
551 | * Returns the 0 on success or negative error code on failure. | ||
552 | */ | ||
553 | static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr, | ||
554 | size_t len, unsigned int gfp_mask) | ||
555 | { | ||
556 | i2o_dma_free(dev, addr); | ||
557 | |||
558 | if (len) | ||
559 | return i2o_dma_alloc(dev, addr, len, gfp_mask); | ||
560 | |||
561 | return 0; | ||
562 | }; | ||
563 | |||
320 | /* I2O driver (OSM) functions */ | 564 | /* I2O driver (OSM) functions */ |
321 | extern int i2o_driver_register(struct i2o_driver *); | 565 | extern int i2o_driver_register(struct i2o_driver *); |
322 | extern void i2o_driver_unregister(struct i2o_driver *); | 566 | extern void i2o_driver_unregister(struct i2o_driver *); |
@@ -385,49 +629,11 @@ extern int i2o_device_claim_release(struct i2o_device *); | |||
385 | /* Exec OSM functions */ | 629 | /* Exec OSM functions */ |
386 | extern int i2o_exec_lct_get(struct i2o_controller *); | 630 | extern int i2o_exec_lct_get(struct i2o_controller *); |
387 | 631 | ||
388 | /* device to i2o_device and driver to i2o_driver convertion functions */ | 632 | /* device / driver / kobject conversion functions */ |
389 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) | 633 | #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) |
390 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) | 634 | #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) |
391 | 635 | #define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device) | |
392 | /* | 636 | #define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj)) |
393 | * Messenger inlines | ||
394 | */ | ||
395 | static inline u32 I2O_POST_READ32(struct i2o_controller *c) | ||
396 | { | ||
397 | rmb(); | ||
398 | return readl(c->post_port); | ||
399 | }; | ||
400 | |||
401 | static inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 val) | ||
402 | { | ||
403 | wmb(); | ||
404 | writel(val, c->post_port); | ||
405 | }; | ||
406 | |||
407 | static inline u32 I2O_REPLY_READ32(struct i2o_controller *c) | ||
408 | { | ||
409 | rmb(); | ||
410 | return readl(c->reply_port); | ||
411 | }; | ||
412 | |||
413 | static inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 val) | ||
414 | { | ||
415 | wmb(); | ||
416 | writel(val, c->reply_port); | ||
417 | }; | ||
418 | |||
419 | static inline u32 I2O_IRQ_READ32(struct i2o_controller *c) | ||
420 | { | ||
421 | rmb(); | ||
422 | return readl(c->irq_mask); | ||
423 | }; | ||
424 | |||
425 | static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val) | ||
426 | { | ||
427 | wmb(); | ||
428 | writel(val, c->irq_mask); | ||
429 | wmb(); | ||
430 | }; | ||
431 | 637 | ||
432 | /** | 638 | /** |
433 | * i2o_msg_get - obtain an I2O message from the IOP | 639 | * i2o_msg_get - obtain an I2O message from the IOP |
@@ -443,11 +649,11 @@ static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val) | |||
443 | * available returns I2O_QUEUE_EMPTY and msg is leaved untouched. | 649 | * available returns I2O_QUEUE_EMPTY and msg is leaved untouched. |
444 | */ | 650 | */ |
445 | static inline u32 i2o_msg_get(struct i2o_controller *c, | 651 | static inline u32 i2o_msg_get(struct i2o_controller *c, |
446 | struct i2o_message __iomem **msg) | 652 | struct i2o_message __iomem ** msg) |
447 | { | 653 | { |
448 | u32 m; | 654 | u32 m = readl(c->in_port); |
449 | 655 | ||
450 | if ((m = I2O_POST_READ32(c)) != I2O_QUEUE_EMPTY) | 656 | if (m != I2O_QUEUE_EMPTY) |
451 | *msg = c->in_queue.virt + m; | 657 | *msg = c->in_queue.virt + m; |
452 | 658 | ||
453 | return m; | 659 | return m; |
@@ -462,7 +668,7 @@ static inline u32 i2o_msg_get(struct i2o_controller *c, | |||
462 | */ | 668 | */ |
463 | static inline void i2o_msg_post(struct i2o_controller *c, u32 m) | 669 | static inline void i2o_msg_post(struct i2o_controller *c, u32 m) |
464 | { | 670 | { |
465 | I2O_POST_WRITE32(c, m); | 671 | writel(m, c->in_port); |
466 | }; | 672 | }; |
467 | 673 | ||
468 | /** | 674 | /** |
@@ -491,12 +697,10 @@ static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m, | |||
491 | * The I2O controller must be informed that the reply message is not needed | 697 | * The I2O controller must be informed that the reply message is not needed |
492 | * anymore. If you forget to flush the reply, the message frame can't be | 698 | * anymore. If you forget to flush the reply, the message frame can't be |
493 | * used by the controller anymore and is therefore lost. | 699 | * used by the controller anymore and is therefore lost. |
494 | * | ||
495 | * FIXME: is there a timeout after which the controller reuse the message? | ||
496 | */ | 700 | */ |
497 | static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) | 701 | static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) |
498 | { | 702 | { |
499 | I2O_REPLY_WRITE32(c, m); | 703 | writel(m, c->out_port); |
500 | }; | 704 | }; |
501 | 705 | ||
502 | /** | 706 | /** |
@@ -530,97 +734,13 @@ static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c, | |||
530 | * work for receive side messages as they are kmalloc objects | 734 | * work for receive side messages as they are kmalloc objects |
531 | * in a different pool. | 735 | * in a different pool. |
532 | */ | 736 | */ |
533 | static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct i2o_controller *c, | 737 | static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct |
534 | u32 m) | 738 | i2o_controller *c, |
739 | u32 m) | ||
535 | { | 740 | { |
536 | return c->in_queue.virt + m; | 741 | return c->in_queue.virt + m; |
537 | }; | 742 | }; |
538 | 743 | ||
539 | /** | ||
540 | * i2o_dma_alloc - Allocate DMA memory | ||
541 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
542 | * @addr: i2o_dma struct which should get the DMA buffer | ||
543 | * @len: length of the new DMA memory | ||
544 | * @gfp_mask: GFP mask | ||
545 | * | ||
546 | * Allocate a coherent DMA memory and write the pointers into addr. | ||
547 | * | ||
548 | * Returns 0 on success or -ENOMEM on failure. | ||
549 | */ | ||
550 | static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, | ||
551 | size_t len, unsigned int gfp_mask) | ||
552 | { | ||
553 | addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); | ||
554 | if (!addr->virt) | ||
555 | return -ENOMEM; | ||
556 | |||
557 | memset(addr->virt, 0, len); | ||
558 | addr->len = len; | ||
559 | |||
560 | return 0; | ||
561 | }; | ||
562 | |||
563 | /** | ||
564 | * i2o_dma_free - Free DMA memory | ||
565 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
566 | * @addr: i2o_dma struct which contains the DMA buffer | ||
567 | * | ||
568 | * Free a coherent DMA memory and set virtual address of addr to NULL. | ||
569 | */ | ||
570 | static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr) | ||
571 | { | ||
572 | if (addr->virt) { | ||
573 | if (addr->phys) | ||
574 | dma_free_coherent(dev, addr->len, addr->virt, | ||
575 | addr->phys); | ||
576 | else | ||
577 | kfree(addr->virt); | ||
578 | addr->virt = NULL; | ||
579 | } | ||
580 | }; | ||
581 | |||
582 | /** | ||
583 | * i2o_dma_map - Map the memory to DMA | ||
584 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
585 | * @addr: i2o_dma struct which should be mapped | ||
586 | * | ||
587 | * Map the memory in addr->virt to coherent DMA memory and write the | ||
588 | * physical address into addr->phys. | ||
589 | * | ||
590 | * Returns 0 on success or -ENOMEM on failure. | ||
591 | */ | ||
592 | static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr) | ||
593 | { | ||
594 | if (!addr->virt) | ||
595 | return -EFAULT; | ||
596 | |||
597 | if (!addr->phys) | ||
598 | addr->phys = dma_map_single(dev, addr->virt, addr->len, | ||
599 | DMA_BIDIRECTIONAL); | ||
600 | if (!addr->phys) | ||
601 | return -ENOMEM; | ||
602 | |||
603 | return 0; | ||
604 | }; | ||
605 | |||
606 | /** | ||
607 | * i2o_dma_unmap - Unmap the DMA memory | ||
608 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
609 | * @addr: i2o_dma struct which should be unmapped | ||
610 | * | ||
611 | * Unmap the memory in addr->virt from DMA memory. | ||
612 | */ | ||
613 | static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr) | ||
614 | { | ||
615 | if (!addr->virt) | ||
616 | return; | ||
617 | |||
618 | if (addr->phys) { | ||
619 | dma_unmap_single(dev, addr->phys, addr->len, DMA_BIDIRECTIONAL); | ||
620 | addr->phys = 0; | ||
621 | } | ||
622 | }; | ||
623 | |||
624 | /* | 744 | /* |
625 | * Endian handling wrapped into the macro - keeps the core code | 745 | * Endian handling wrapped into the macro - keeps the core code |
626 | * cleaner. | 746 | * cleaner. |
@@ -773,6 +893,14 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
773 | #define I2O_CMD_SCSI_BUSRESET 0x27 | 893 | #define I2O_CMD_SCSI_BUSRESET 0x27 |
774 | 894 | ||
775 | /* | 895 | /* |
896 | * Bus Adapter Class | ||
897 | */ | ||
898 | #define I2O_CMD_BUS_ADAPTER_RESET 0x85 | ||
899 | #define I2O_CMD_BUS_RESET 0x87 | ||
900 | #define I2O_CMD_BUS_SCAN 0x89 | ||
901 | #define I2O_CMD_BUS_QUIESCE 0x8b | ||
902 | |||
903 | /* | ||
776 | * Random Block Storage Class | 904 | * Random Block Storage Class |
777 | */ | 905 | */ |
778 | #define I2O_CMD_BLOCK_READ 0x30 | 906 | #define I2O_CMD_BLOCK_READ 0x30 |
@@ -784,7 +912,7 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
784 | #define I2O_CMD_BLOCK_MEJECT 0x43 | 912 | #define I2O_CMD_BLOCK_MEJECT 0x43 |
785 | #define I2O_CMD_BLOCK_POWER 0x70 | 913 | #define I2O_CMD_BLOCK_POWER 0x70 |
786 | 914 | ||
787 | #define I2O_PRIVATE_MSG 0xFF | 915 | #define I2O_CMD_PRIVATE 0xFF |
788 | 916 | ||
789 | /* Command status values */ | 917 | /* Command status values */ |
790 | 918 | ||
@@ -922,7 +1050,7 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
922 | #define I2OVER15 0x0001 | 1050 | #define I2OVER15 0x0001 |
923 | #define I2OVER20 0x0002 | 1051 | #define I2OVER20 0x0002 |
924 | 1052 | ||
925 | /* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */ | 1053 | /* Default is 1.5 */ |
926 | #define I2OVERSION I2OVER15 | 1054 | #define I2OVERSION I2OVER15 |
927 | 1055 | ||
928 | #define SGL_OFFSET_0 I2OVERSION | 1056 | #define SGL_OFFSET_0 I2OVERSION |
@@ -933,9 +1061,9 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
933 | #define SGL_OFFSET_8 (0x0080 | I2OVERSION) | 1061 | #define SGL_OFFSET_8 (0x0080 | I2OVERSION) |
934 | #define SGL_OFFSET_9 (0x0090 | I2OVERSION) | 1062 | #define SGL_OFFSET_9 (0x0090 | I2OVERSION) |
935 | #define SGL_OFFSET_10 (0x00A0 | I2OVERSION) | 1063 | #define SGL_OFFSET_10 (0x00A0 | I2OVERSION) |
936 | 1064 | #define SGL_OFFSET_11 (0x00B0 | I2OVERSION) | |
937 | #define TRL_OFFSET_5 (0x0050 | I2OVERSION) | 1065 | #define SGL_OFFSET_12 (0x00C0 | I2OVERSION) |
938 | #define TRL_OFFSET_6 (0x0060 | I2OVERSION) | 1066 | #define SGL_OFFSET(x) (((x)<<4) | I2OVERSION) |
939 | 1067 | ||
940 | /* Transaction Reply Lists (TRL) Control Word structure */ | 1068 | /* Transaction Reply Lists (TRL) Control Word structure */ |
941 | #define TRL_SINGLE_FIXED_LENGTH 0x00 | 1069 | #define TRL_SINGLE_FIXED_LENGTH 0x00 |
@@ -962,17 +1090,13 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
962 | #define ELEVEN_WORD_MSG_SIZE 0x000B0000 | 1090 | #define ELEVEN_WORD_MSG_SIZE 0x000B0000 |
963 | #define I2O_MESSAGE_SIZE(x) ((x)<<16) | 1091 | #define I2O_MESSAGE_SIZE(x) ((x)<<16) |
964 | 1092 | ||
965 | /* Special TID Assignments */ | 1093 | /* special TID assignments */ |
966 | |||
967 | #define ADAPTER_TID 0 | 1094 | #define ADAPTER_TID 0 |
968 | #define HOST_TID 1 | 1095 | #define HOST_TID 1 |
969 | 1096 | ||
970 | #define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */ | 1097 | /* outbound queue defines */ |
971 | #define REPLY_FRAME_SIZE 17 | 1098 | #define I2O_MAX_OUTBOUND_MSG_FRAMES 128 |
972 | #define SG_TABLESIZE 30 | 1099 | #define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */ |
973 | #define NMBR_MSG_FRAMES 128 | ||
974 | |||
975 | #define MSG_POOL_SIZE (MSG_FRAME_SIZE*NMBR_MSG_FRAMES*sizeof(u32)) | ||
976 | 1100 | ||
977 | #define I2O_POST_WAIT_OK 0 | 1101 | #define I2O_POST_WAIT_OK 0 |
978 | #define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT | 1102 | #define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT |
@@ -993,11 +1117,10 @@ extern void i2o_debug_state(struct i2o_controller *c); | |||
993 | #define I2O_HRT_GET_TRIES 3 | 1117 | #define I2O_HRT_GET_TRIES 3 |
994 | #define I2O_LCT_GET_TRIES 3 | 1118 | #define I2O_LCT_GET_TRIES 3 |
995 | 1119 | ||
996 | /* request queue sizes */ | 1120 | /* defines for max_sectors and max_phys_segments */ |
997 | #define I2O_MAX_SECTORS 1024 | 1121 | #define I2O_MAX_SECTORS 1024 |
998 | #define I2O_MAX_SEGMENTS 128 | 1122 | #define I2O_MAX_SECTORS_LIMITED 256 |
999 | 1123 | #define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS | |
1000 | #define I2O_REQ_MEMPOOL_SIZE 32 | ||
1001 | 1124 | ||
1002 | #endif /* __KERNEL__ */ | 1125 | #endif /* __KERNEL__ */ |
1003 | #endif /* _I2O_H */ | 1126 | #endif /* _I2O_H */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 9cfc0999becb..92129078d4f3 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -664,7 +664,6 @@ typedef struct ide_drive_s { | |||
664 | 664 | ||
665 | struct request *rq; /* current request */ | 665 | struct request *rq; /* current request */ |
666 | struct ide_drive_s *next; /* circular list of hwgroup drives */ | 666 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
667 | struct ide_driver_s *driver;/* (ide_driver_t *) */ | ||
668 | void *driver_data; /* extra driver data */ | 667 | void *driver_data; /* extra driver data */ |
669 | struct hd_driveid *id; /* drive model identification info */ | 668 | struct hd_driveid *id; /* drive model identification info */ |
670 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 669 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
@@ -758,6 +757,8 @@ typedef struct ide_drive_s { | |||
758 | struct semaphore gendev_rel_sem; /* to deal with device release() */ | 757 | struct semaphore gendev_rel_sem; /* to deal with device release() */ |
759 | } ide_drive_t; | 758 | } ide_drive_t; |
760 | 759 | ||
760 | #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) | ||
761 | |||
761 | #define IDE_CHIPSET_PCI_MASK \ | 762 | #define IDE_CHIPSET_PCI_MASK \ |
762 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) | 763 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) |
763 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) | 764 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) |
@@ -916,7 +917,7 @@ typedef struct hwif_s { | |||
916 | unsigned dma; | 917 | unsigned dma; |
917 | 918 | ||
918 | void (*led_act)(void *data, int rw); | 919 | void (*led_act)(void *data, int rw); |
919 | } ide_hwif_t; | 920 | } ____cacheline_maxaligned_in_smp ide_hwif_t; |
920 | 921 | ||
921 | /* | 922 | /* |
922 | * internal ide interrupt handler type | 923 | * internal ide interrupt handler type |
@@ -1086,28 +1087,20 @@ enum { | |||
1086 | */ | 1087 | */ |
1087 | typedef struct ide_driver_s { | 1088 | typedef struct ide_driver_s { |
1088 | struct module *owner; | 1089 | struct module *owner; |
1089 | const char *name; | ||
1090 | const char *version; | 1090 | const char *version; |
1091 | u8 media; | 1091 | u8 media; |
1092 | unsigned busy : 1; | ||
1093 | unsigned supports_dsc_overlap : 1; | 1092 | unsigned supports_dsc_overlap : 1; |
1094 | int (*cleanup)(ide_drive_t *); | ||
1095 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 1093 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
1096 | int (*end_request)(ide_drive_t *, int, int); | 1094 | int (*end_request)(ide_drive_t *, int, int); |
1097 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); | 1095 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); |
1098 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); | 1096 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); |
1099 | int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); | 1097 | int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); |
1100 | ide_proc_entry_t *proc; | 1098 | ide_proc_entry_t *proc; |
1101 | int (*attach)(ide_drive_t *); | ||
1102 | void (*ata_prebuilder)(ide_drive_t *); | 1099 | void (*ata_prebuilder)(ide_drive_t *); |
1103 | void (*atapi_prebuilder)(ide_drive_t *); | 1100 | void (*atapi_prebuilder)(ide_drive_t *); |
1104 | struct device_driver gen_driver; | 1101 | struct device_driver gen_driver; |
1105 | struct list_head drives; | ||
1106 | struct list_head drivers; | ||
1107 | } ide_driver_t; | 1102 | } ide_driver_t; |
1108 | 1103 | ||
1109 | #define DRIVER(drive) ((drive)->driver) | ||
1110 | |||
1111 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); | 1104 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); |
1112 | 1105 | ||
1113 | /* | 1106 | /* |
@@ -1328,8 +1321,6 @@ extern void ide_init_subdrivers(void); | |||
1328 | 1321 | ||
1329 | void ide_init_disk(struct gendisk *, ide_drive_t *); | 1322 | void ide_init_disk(struct gendisk *, ide_drive_t *); |
1330 | 1323 | ||
1331 | extern int ata_attach(ide_drive_t *); | ||
1332 | |||
1333 | extern int ideprobe_init(void); | 1324 | extern int ideprobe_init(void); |
1334 | 1325 | ||
1335 | extern void ide_scan_pcibus(int scan_direction) __init; | 1326 | extern void ide_scan_pcibus(int scan_direction) __init; |
@@ -1342,11 +1333,8 @@ extern void default_hwif_iops(ide_hwif_t *); | |||
1342 | extern void default_hwif_mmiops(ide_hwif_t *); | 1333 | extern void default_hwif_mmiops(ide_hwif_t *); |
1343 | extern void default_hwif_transport(ide_hwif_t *); | 1334 | extern void default_hwif_transport(ide_hwif_t *); |
1344 | 1335 | ||
1345 | int ide_register_driver(ide_driver_t *driver); | 1336 | void ide_register_subdriver(ide_drive_t *, ide_driver_t *); |
1346 | void ide_unregister_driver(ide_driver_t *driver); | 1337 | void ide_unregister_subdriver(ide_drive_t *, ide_driver_t *); |
1347 | int ide_register_subdriver(ide_drive_t *, ide_driver_t *); | ||
1348 | int ide_unregister_subdriver (ide_drive_t *drive); | ||
1349 | int ide_replace_subdriver(ide_drive_t *drive, const char *driver); | ||
1350 | 1338 | ||
1351 | #define ON_BOARD 1 | 1339 | #define ON_BOARD 1 |
1352 | #define NEVER_BOARD 0 | 1340 | #define NEVER_BOARD 0 |
diff --git a/include/linux/if.h b/include/linux/if.h index d73a9d62f208..ce627d9092ef 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define IFF_LOOPBACK 0x8 /* is a loopback net */ | 33 | #define IFF_LOOPBACK 0x8 /* is a loopback net */ |
34 | #define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ | 34 | #define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ |
35 | #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ | 35 | #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ |
36 | #define IFF_RUNNING 0x40 /* resources allocated */ | 36 | #define IFF_RUNNING 0x40 /* interface running and carrier ok */ |
37 | #define IFF_NOARP 0x80 /* no ARP protocol */ | 37 | #define IFF_NOARP 0x80 /* no ARP protocol */ |
38 | #define IFF_PROMISC 0x100 /* receive all packets */ | 38 | #define IFF_PROMISC 0x100 /* receive all packets */ |
39 | #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ | 39 | #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ |
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h index 0485b256d043..004e6f09a6e2 100644 --- a/include/linux/if_shaper.h +++ b/include/linux/if_shaper.h | |||
@@ -23,7 +23,7 @@ struct shaper | |||
23 | __u32 shapeclock; | 23 | __u32 shapeclock; |
24 | unsigned long recovery; /* Time we can next clock a packet out on | 24 | unsigned long recovery; /* Time we can next clock a packet out on |
25 | an empty queue */ | 25 | an empty queue */ |
26 | unsigned long locked; | 26 | struct semaphore sem; |
27 | struct net_device_stats stats; | 27 | struct net_device_stats stats; |
28 | struct net_device *dev; | 28 | struct net_device *dev; |
29 | int (*hard_start_xmit) (struct sk_buff *skb, | 29 | int (*hard_start_xmit) (struct sk_buff *skb, |
@@ -38,7 +38,6 @@ struct shaper | |||
38 | int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh); | 38 | int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh); |
39 | void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr); | 39 | void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr); |
40 | struct net_device_stats* (*get_stats)(struct net_device *dev); | 40 | struct net_device_stats* (*get_stats)(struct net_device *dev); |
41 | wait_queue_head_t wait_queue; | ||
42 | struct timer_list timer; | 41 | struct timer_list timer; |
43 | }; | 42 | }; |
44 | 43 | ||
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h index 4fd451f81ccb..3fba9e2f5427 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
11 | * Donald Becker, <becker@super.org> | 11 | * Donald Becker, <becker@super.org> |
12 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> | 12 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or | 14 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License | 15 | * modify it under the terms of the GNU General Public License |
@@ -19,24 +19,18 @@ | |||
19 | #ifndef _LINUX_IF_TR_H | 19 | #ifndef _LINUX_IF_TR_H |
20 | #define _LINUX_IF_TR_H | 20 | #define _LINUX_IF_TR_H |
21 | 21 | ||
22 | #include <asm/byteorder.h> /* For __be16 */ | ||
22 | 23 | ||
23 | /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble | 24 | /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble |
24 | and FCS/CRC (frame check sequence). */ | 25 | and FCS/CRC (frame check sequence). */ |
25 | #define TR_ALEN 6 /* Octets in one ethernet addr */ | 26 | #define TR_ALEN 6 /* Octets in one token-ring addr */ |
26 | #define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc)) | 27 | #define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc)) |
27 | #define AC 0x10 | 28 | #define AC 0x10 |
28 | #define LLC_FRAME 0x40 | 29 | #define LLC_FRAME 0x40 |
29 | #if 0 | ||
30 | #define ETH_HLEN 14 /* Total octets in header. */ | ||
31 | #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ | ||
32 | #define ETH_DATA_LEN 1500 /* Max. octets in payload */ | ||
33 | #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ | ||
34 | #endif | ||
35 | |||
36 | 30 | ||
37 | /* LLC and SNAP constants */ | 31 | /* LLC and SNAP constants */ |
38 | #define EXTENDED_SAP 0xAA | 32 | #define EXTENDED_SAP 0xAA |
39 | #define UI_CMD 0x03 | 33 | #define UI_CMD 0x03 |
40 | 34 | ||
41 | /* This is an Token-Ring frame header. */ | 35 | /* This is an Token-Ring frame header. */ |
42 | struct trh_hdr { | 36 | struct trh_hdr { |
@@ -44,8 +38,8 @@ struct trh_hdr { | |||
44 | __u8 fc; /* frame control field */ | 38 | __u8 fc; /* frame control field */ |
45 | __u8 daddr[TR_ALEN]; /* destination address */ | 39 | __u8 daddr[TR_ALEN]; /* destination address */ |
46 | __u8 saddr[TR_ALEN]; /* source address */ | 40 | __u8 saddr[TR_ALEN]; /* source address */ |
47 | __u16 rcf; /* route control field */ | 41 | __be16 rcf; /* route control field */ |
48 | __u16 rseg[8]; /* routing registers */ | 42 | __be16 rseg[8]; /* routing registers */ |
49 | }; | 43 | }; |
50 | 44 | ||
51 | #ifdef __KERNEL__ | 45 | #ifdef __KERNEL__ |
@@ -63,7 +57,7 @@ struct trllc { | |||
63 | __u8 ssap; /* source SAP */ | 57 | __u8 ssap; /* source SAP */ |
64 | __u8 llc; /* LLC control field */ | 58 | __u8 llc; /* LLC control field */ |
65 | __u8 protid[3]; /* protocol id */ | 59 | __u8 protid[3]; /* protocol id */ |
66 | __u16 ethertype; /* ether type field */ | 60 | __be16 ethertype; /* ether type field */ |
67 | }; | 61 | }; |
68 | 62 | ||
69 | /* Token-Ring statistics collection data. */ | 63 | /* Token-Ring statistics collection data. */ |
@@ -96,14 +90,13 @@ struct tr_statistics { | |||
96 | }; | 90 | }; |
97 | 91 | ||
98 | /* source routing stuff */ | 92 | /* source routing stuff */ |
99 | 93 | #define TR_RII 0x80 | |
100 | #define TR_RII 0x80 | 94 | #define TR_RCF_DIR_BIT 0x80 |
101 | #define TR_RCF_DIR_BIT 0x80 | 95 | #define TR_RCF_LEN_MASK 0x1f00 |
102 | #define TR_RCF_LEN_MASK 0x1f00 | 96 | #define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ |
103 | #define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ | 97 | #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ |
104 | #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ | 98 | #define TR_RCF_FRAME2K 0x20 |
105 | #define TR_RCF_FRAME2K 0x20 | 99 | #define TR_RCF_BROADCAST_MASK 0xC000 |
106 | #define TR_RCF_BROADCAST_MASK 0xC000 | 100 | #define TR_MAXRIFLEN 18 |
107 | #define TR_MAXRIFLEN 18 | ||
108 | 101 | ||
109 | #endif /* _LINUX_IF_TR_H */ | 102 | #endif /* _LINUX_IF_TR_H */ |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 6fafb27877a7..7e1e15f934f3 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -29,6 +29,7 @@ struct ipv4_devconf | |||
29 | int no_xfrm; | 29 | int no_xfrm; |
30 | int no_policy; | 30 | int no_policy; |
31 | int force_igmp_version; | 31 | int force_igmp_version; |
32 | int promote_secondaries; | ||
32 | void *sysctl; | 33 | void *sysctl; |
33 | }; | 34 | }; |
34 | 35 | ||
@@ -71,6 +72,7 @@ struct in_device | |||
71 | #define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects) | 72 | #define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects) |
72 | #define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag) | 73 | #define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag) |
73 | #define IN_DEV_MEDIUM_ID(in_dev) ((in_dev)->cnf.medium_id) | 74 | #define IN_DEV_MEDIUM_ID(in_dev) ((in_dev)->cnf.medium_id) |
75 | #define IN_DEV_PROMOTE_SECONDARIES(in_dev) (ipv4_devconf.promote_secondaries || (in_dev)->cnf.promote_secondaries) | ||
74 | 76 | ||
75 | #define IN_DEV_RX_REDIRECTS(in_dev) \ | 77 | #define IN_DEV_RX_REDIRECTS(in_dev) \ |
76 | ((IN_DEV_FORWARD(in_dev) && \ | 78 | ((IN_DEV_FORWARD(in_dev) && \ |
diff --git a/include/linux/init.h b/include/linux/init.h index 05c83e0521ca..59008c3826cf 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -229,6 +229,18 @@ void __init parse_early_param(void); | |||
229 | #define __devexitdata __exitdata | 229 | #define __devexitdata __exitdata |
230 | #endif | 230 | #endif |
231 | 231 | ||
232 | #ifdef CONFIG_HOTPLUG_CPU | ||
233 | #define __cpuinit | ||
234 | #define __cpuinitdata | ||
235 | #define __cpuexit | ||
236 | #define __cpuexitdata | ||
237 | #else | ||
238 | #define __cpuinit __init | ||
239 | #define __cpuinitdata __initdata | ||
240 | #define __cpuexit __exit | ||
241 | #define __cpuexitdata __exitdata | ||
242 | #endif | ||
243 | |||
232 | /* Functions marked as __devexit may be discarded at kernel link time, depending | 244 | /* Functions marked as __devexit may be discarded at kernel link time, depending |
233 | on config options. Newer versions of binutils detect references from | 245 | on config options. Newer versions of binutils detect references from |
234 | retained sections to discarded sections and flag an error. Pointers to | 246 | retained sections to discarded sections and flag an error. Pointers to |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index a6a8c1a38d5e..03206a425d7a 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -108,7 +108,6 @@ extern struct group_info init_groups; | |||
108 | .blocked = {{0}}, \ | 108 | .blocked = {{0}}, \ |
109 | .alloc_lock = SPIN_LOCK_UNLOCKED, \ | 109 | .alloc_lock = SPIN_LOCK_UNLOCKED, \ |
110 | .proc_lock = SPIN_LOCK_UNLOCKED, \ | 110 | .proc_lock = SPIN_LOCK_UNLOCKED, \ |
111 | .switch_lock = SPIN_LOCK_UNLOCKED, \ | ||
112 | .journal_info = NULL, \ | 111 | .journal_info = NULL, \ |
113 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ | 112 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
114 | } | 113 | } |
diff --git a/include/linux/input.h b/include/linux/input.h index 72731d7d189e..9d9598ed760d 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -1015,7 +1015,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min | |||
1015 | dev->absbit[LONG(axis)] |= BIT(axis); | 1015 | dev->absbit[LONG(axis)] |= BIT(axis); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | extern struct class_simple *input_class; | 1018 | extern struct class *input_class; |
1019 | 1019 | ||
1020 | #endif | 1020 | #endif |
1021 | #endif | 1021 | #endif |
diff --git a/include/linux/ioc4.h b/include/linux/ioc4.h new file mode 100644 index 000000000000..3dd18b785ebd --- /dev/null +++ b/include/linux/ioc4.h | |||
@@ -0,0 +1,179 @@ | |||
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 (c) 2005 Silicon Graphics, Inc. All Rights Reserved. | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_IOC4_H | ||
10 | #define _LINUX_IOC4_H | ||
11 | |||
12 | #include <linux/interrupt.h> | ||
13 | |||
14 | /*************** | ||
15 | * Definitions * | ||
16 | ***************/ | ||
17 | |||
18 | /* Miscellaneous values inherent to hardware */ | ||
19 | |||
20 | #define IOC4_EXTINT_COUNT_DIVISOR 520 /* PCI clocks per COUNT tick */ | ||
21 | |||
22 | /*********************************** | ||
23 | * Structures needed by subdrivers * | ||
24 | ***********************************/ | ||
25 | |||
26 | /* This structure fully describes the IOC4 miscellaneous registers which | ||
27 | * appear at bar[0]+0x00000 through bar[0]+0x0005c. The corresponding | ||
28 | * PCI resource is managed by the main IOC4 driver because it contains | ||
29 | * registers of interest to many different IOC4 subdrivers. | ||
30 | */ | ||
31 | struct ioc4_misc_regs { | ||
32 | /* Miscellaneous IOC4 registers */ | ||
33 | union ioc4_pci_err_addr_l { | ||
34 | uint32_t raw; | ||
35 | struct { | ||
36 | uint32_t valid:1; /* Address captured */ | ||
37 | uint32_t master_id:4; /* Unit causing error | ||
38 | * 0/1: Serial port 0 TX/RX | ||
39 | * 2/3: Serial port 1 TX/RX | ||
40 | * 4/5: Serial port 2 TX/RX | ||
41 | * 6/7: Serial port 3 TX/RX | ||
42 | * 8: ATA/ATAPI | ||
43 | * 9-15: Undefined | ||
44 | */ | ||
45 | uint32_t mul_err:1; /* Multiple errors occurred */ | ||
46 | uint32_t addr:26; /* Bits 31-6 of error addr */ | ||
47 | } fields; | ||
48 | } pci_err_addr_l; | ||
49 | uint32_t pci_err_addr_h; /* Bits 63-32 of error addr */ | ||
50 | union ioc4_sio_int { | ||
51 | uint32_t raw; | ||
52 | struct { | ||
53 | uint8_t tx_mt:1; /* TX ring buffer empty */ | ||
54 | uint8_t rx_full:1; /* RX ring buffer full */ | ||
55 | uint8_t rx_high:1; /* RX high-water exceeded */ | ||
56 | uint8_t rx_timer:1; /* RX timer has triggered */ | ||
57 | uint8_t delta_dcd:1; /* DELTA_DCD seen */ | ||
58 | uint8_t delta_cts:1; /* DELTA_CTS seen */ | ||
59 | uint8_t intr_pass:1; /* Interrupt pass-through */ | ||
60 | uint8_t tx_explicit:1; /* TX, MCW, or delay complete */ | ||
61 | } fields[4]; | ||
62 | } sio_ir; /* Serial interrupt state */ | ||
63 | union ioc4_other_int { | ||
64 | uint32_t raw; | ||
65 | struct { | ||
66 | uint32_t ata_int:1; /* ATA port passthru */ | ||
67 | uint32_t ata_memerr:1; /* ATA halted by mem error */ | ||
68 | uint32_t memerr:4; /* Serial halted by mem err */ | ||
69 | uint32_t kbd_int:1; /* kbd/mouse intr asserted */ | ||
70 | uint32_t reserved:16; /* zero */ | ||
71 | uint32_t rt_int:1; /* INT_OUT section latch */ | ||
72 | uint32_t gen_int:8; /* Intr. from generic pins */ | ||
73 | } fields; | ||
74 | } other_ir; /* Other interrupt state */ | ||
75 | union ioc4_sio_int sio_ies; /* Serial interrupt enable set */ | ||
76 | union ioc4_other_int other_ies; /* Other interrupt enable set */ | ||
77 | union ioc4_sio_int sio_iec; /* Serial interrupt enable clear */ | ||
78 | union ioc4_other_int other_iec; /* Other interrupt enable clear */ | ||
79 | union ioc4_sio_cr { | ||
80 | uint32_t raw; | ||
81 | struct { | ||
82 | uint32_t cmd_pulse:4; /* Bytebus strobe width */ | ||
83 | uint32_t arb_diag:3; /* PCI bus requester */ | ||
84 | uint32_t sio_diag_idle:1; /* Active ser req? */ | ||
85 | uint32_t ata_diag_idle:1; /* Active ATA req? */ | ||
86 | uint32_t ata_diag_active:1; /* ATA req is winner */ | ||
87 | uint32_t reserved:22; /* zero */ | ||
88 | } fields; | ||
89 | } sio_cr; | ||
90 | uint32_t unused1; | ||
91 | union ioc4_int_out { | ||
92 | uint32_t raw; | ||
93 | struct { | ||
94 | uint32_t count:16; /* Period control */ | ||
95 | uint32_t mode:3; /* Output signal shape */ | ||
96 | uint32_t reserved:11; /* zero */ | ||
97 | uint32_t diag:1; /* Timebase control */ | ||
98 | uint32_t int_out:1; /* Current value */ | ||
99 | } fields; | ||
100 | } int_out; /* External interrupt output control */ | ||
101 | uint32_t unused2; | ||
102 | union ioc4_gpcr { | ||
103 | uint32_t raw; | ||
104 | struct { | ||
105 | uint32_t dir:8; /* Pin direction */ | ||
106 | uint32_t edge:8; /* Edge/level mode */ | ||
107 | uint32_t reserved1:4; /* zero */ | ||
108 | uint32_t int_out_en:1; /* INT_OUT enable */ | ||
109 | uint32_t reserved2:11; /* zero */ | ||
110 | } fields; | ||
111 | } gpcr_s; /* Generic PIO control set */ | ||
112 | union ioc4_gpcr gpcr_c; /* Generic PIO control clear */ | ||
113 | union ioc4_gpdr { | ||
114 | uint32_t raw; | ||
115 | struct { | ||
116 | uint32_t gen_pin:8; /* State of pins */ | ||
117 | uint32_t reserved:24; | ||
118 | } fields; | ||
119 | } gpdr; /* Generic PIO data */ | ||
120 | uint32_t unused3; | ||
121 | union ioc4_gppr { | ||
122 | uint32_t raw; | ||
123 | struct { | ||
124 | uint32_t gen_pin:1; /* Single pin state */ | ||
125 | uint32_t reserved:31; | ||
126 | } fields; | ||
127 | } gppr[8]; /* Generic PIO pins */ | ||
128 | }; | ||
129 | |||
130 | /* Masks for GPCR DIR pins */ | ||
131 | #define IOC4_GPCR_DIR_0 0x01 /* External interrupt output */ | ||
132 | #define IOC4_GPCR_DIR_1 0x02 /* External interrupt input */ | ||
133 | #define IOC4_GPCR_DIR_2 0x04 | ||
134 | #define IOC4_GPCR_DIR_3 0x08 /* Keyboard/mouse presence */ | ||
135 | #define IOC4_GPCR_DIR_4 0x10 /* Ser. port 0 xcvr select (0=232, 1=422) */ | ||
136 | #define IOC4_GPCR_DIR_5 0x20 /* Ser. port 1 xcvr select (0=232, 1=422) */ | ||
137 | #define IOC4_GPCR_DIR_6 0x40 /* Ser. port 2 xcvr select (0=232, 1=422) */ | ||
138 | #define IOC4_GPCR_DIR_7 0x80 /* Ser. port 3 xcvr select (0=232, 1=422) */ | ||
139 | |||
140 | /* Masks for GPCR EDGE pins */ | ||
141 | #define IOC4_GPCR_EDGE_0 0x01 | ||
142 | #define IOC4_GPCR_EDGE_1 0x02 /* External interrupt input */ | ||
143 | #define IOC4_GPCR_EDGE_2 0x04 | ||
144 | #define IOC4_GPCR_EDGE_3 0x08 | ||
145 | #define IOC4_GPCR_EDGE_4 0x10 | ||
146 | #define IOC4_GPCR_EDGE_5 0x20 | ||
147 | #define IOC4_GPCR_EDGE_6 0x40 | ||
148 | #define IOC4_GPCR_EDGE_7 0x80 | ||
149 | |||
150 | /* One of these per IOC4 */ | ||
151 | struct ioc4_driver_data { | ||
152 | struct list_head idd_list; | ||
153 | unsigned long idd_bar0; | ||
154 | struct pci_dev *idd_pdev; | ||
155 | const struct pci_device_id *idd_pci_id; | ||
156 | struct __iomem ioc4_misc_regs *idd_misc_regs; | ||
157 | unsigned long count_period; | ||
158 | void *idd_serial_data; | ||
159 | }; | ||
160 | |||
161 | /* One per submodule */ | ||
162 | struct ioc4_submodule { | ||
163 | struct list_head is_list; | ||
164 | char *is_name; | ||
165 | struct module *is_owner; | ||
166 | int (*is_probe) (struct ioc4_driver_data *); | ||
167 | int (*is_remove) (struct ioc4_driver_data *); | ||
168 | }; | ||
169 | |||
170 | #define IOC4_NUM_CARDS 8 /* max cards per partition */ | ||
171 | |||
172 | /********************************** | ||
173 | * Functions needed by submodules * | ||
174 | **********************************/ | ||
175 | |||
176 | extern int ioc4_register_submodule(struct ioc4_submodule *); | ||
177 | extern void ioc4_unregister_submodule(struct ioc4_submodule *); | ||
178 | |||
179 | #endif /* _LINUX_IOC4_H */ | ||
diff --git a/include/linux/ioc4_common.h b/include/linux/ioc4_common.h deleted file mode 100644 index b03bcc46df55..000000000000 --- a/include/linux/ioc4_common.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
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 (c) 2005 Silicon Graphics, Inc. All Rights Reserved. | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_IOC4_COMMON_H | ||
10 | #define _LINUX_IOC4_COMMON_H | ||
11 | |||
12 | /* prototypes */ | ||
13 | |||
14 | int ioc4_serial_init(void); | ||
15 | |||
16 | int ioc4_serial_attach_one(struct pci_dev *pdev, const struct | ||
17 | pci_device_id *pci_id); | ||
18 | int ioc4_ide_attach_one(struct pci_dev *pdev, const struct | ||
19 | pci_device_id *pci_id); | ||
20 | |||
21 | #endif /* _LINUX_IOC4_COMMON_H */ | ||
diff --git a/include/linux/ip.h b/include/linux/ip.h index 8438c68591f9..31e7cedd9f84 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h | |||
@@ -81,6 +81,7 @@ | |||
81 | #ifdef __KERNEL__ | 81 | #ifdef __KERNEL__ |
82 | #include <linux/config.h> | 82 | #include <linux/config.h> |
83 | #include <linux/types.h> | 83 | #include <linux/types.h> |
84 | #include <net/request_sock.h> | ||
84 | #include <net/sock.h> | 85 | #include <net/sock.h> |
85 | #include <linux/igmp.h> | 86 | #include <linux/igmp.h> |
86 | #include <net/flow.h> | 87 | #include <net/flow.h> |
@@ -107,6 +108,26 @@ struct ip_options { | |||
107 | 108 | ||
108 | #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) | 109 | #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) |
109 | 110 | ||
111 | struct inet_request_sock { | ||
112 | struct request_sock req; | ||
113 | u32 loc_addr; | ||
114 | u32 rmt_addr; | ||
115 | u16 rmt_port; | ||
116 | u16 snd_wscale : 4, | ||
117 | rcv_wscale : 4, | ||
118 | tstamp_ok : 1, | ||
119 | sack_ok : 1, | ||
120 | wscale_ok : 1, | ||
121 | ecn_ok : 1, | ||
122 | acked : 1; | ||
123 | struct ip_options *opt; | ||
124 | }; | ||
125 | |||
126 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | ||
127 | { | ||
128 | return (struct inet_request_sock *)sk; | ||
129 | } | ||
130 | |||
110 | struct ipv6_pinfo; | 131 | struct ipv6_pinfo; |
111 | 132 | ||
112 | struct inet_sock { | 133 | struct inet_sock { |
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 2ec265e1045f..596ca6130159 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
@@ -209,6 +209,11 @@ struct kernel_ipmi_msg | |||
209 | #include <linux/list.h> | 209 | #include <linux/list.h> |
210 | #include <linux/module.h> | 210 | #include <linux/module.h> |
211 | 211 | ||
212 | #ifdef CONFIG_PROC_FS | ||
213 | #include <linux/proc_fs.h> | ||
214 | extern struct proc_dir_entry *proc_ipmi_root; | ||
215 | #endif /* CONFIG_PROC_FS */ | ||
216 | |||
212 | /* Opaque type for a IPMI message user. One of these is needed to | 217 | /* Opaque type for a IPMI message user. One of these is needed to |
213 | send and receive messages. */ | 218 | send and receive messages. */ |
214 | typedef struct ipmi_user *ipmi_user_t; | 219 | typedef struct ipmi_user *ipmi_user_t; |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index ab0d0efbf240..6fcd6a0ade24 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -193,6 +193,19 @@ struct inet6_skb_parm { | |||
193 | 193 | ||
194 | #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) | 194 | #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) |
195 | 195 | ||
196 | struct tcp6_request_sock { | ||
197 | struct tcp_request_sock req; | ||
198 | struct in6_addr loc_addr; | ||
199 | struct in6_addr rmt_addr; | ||
200 | struct sk_buff *pktopts; | ||
201 | int iif; | ||
202 | }; | ||
203 | |||
204 | static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) | ||
205 | { | ||
206 | return (struct tcp6_request_sock *)sk; | ||
207 | } | ||
208 | |||
196 | /** | 209 | /** |
197 | * struct ipv6_pinfo - ipv6 private area | 210 | * struct ipv6_pinfo - ipv6 private area |
198 | * | 211 | * |
diff --git a/include/linux/irq.h b/include/linux/irq.h index c3ff4d101667..12277799c007 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -47,6 +47,10 @@ struct hw_interrupt_type { | |||
47 | void (*ack)(unsigned int irq); | 47 | void (*ack)(unsigned int irq); |
48 | void (*end)(unsigned int irq); | 48 | void (*end)(unsigned int irq); |
49 | void (*set_affinity)(unsigned int irq, cpumask_t dest); | 49 | void (*set_affinity)(unsigned int irq, cpumask_t dest); |
50 | /* Currently used only by UML, might disappear one day.*/ | ||
51 | #ifdef CONFIG_IRQ_RELEASE_METHOD | ||
52 | void (*release)(unsigned int irq, void *dev_id); | ||
53 | #endif | ||
50 | }; | 54 | }; |
51 | 55 | ||
52 | typedef struct hw_interrupt_type hw_irq_controller; | 56 | typedef struct hw_interrupt_type hw_irq_controller; |
@@ -84,7 +88,6 @@ extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, | |||
84 | struct irqaction *action); | 88 | struct irqaction *action); |
85 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); | 89 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); |
86 | extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret); | 90 | extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret); |
87 | extern void report_bad_irq(unsigned int irq, irq_desc_t *desc, int action_ret); | ||
88 | extern int can_request_irq(unsigned int irq, unsigned long irqflags); | 91 | extern int can_request_irq(unsigned int irq, unsigned long irqflags); |
89 | 92 | ||
90 | extern void init_irq_proc(void); | 93 | extern void init_irq_proc(void); |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e25b97062ce1..687ba8c9973d 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -58,15 +58,23 @@ struct completion; | |||
58 | * be biten later when the calling function happens to sleep when it is not | 58 | * be biten later when the calling function happens to sleep when it is not |
59 | * supposed to. | 59 | * supposed to. |
60 | */ | 60 | */ |
61 | #ifdef CONFIG_PREEMPT_VOLUNTARY | ||
62 | extern int cond_resched(void); | ||
63 | # define might_resched() cond_resched() | ||
64 | #else | ||
65 | # define might_resched() do { } while (0) | ||
66 | #endif | ||
67 | |||
61 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 68 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
62 | #define might_sleep() __might_sleep(__FILE__, __LINE__) | 69 | void __might_sleep(char *file, int line); |
63 | #define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0) | 70 | # define might_sleep() \ |
64 | void __might_sleep(char *file, int line); | 71 | do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) |
65 | #else | 72 | #else |
66 | #define might_sleep() do {} while(0) | 73 | # define might_sleep() do { might_resched(); } while (0) |
67 | #define might_sleep_if(cond) do {} while (0) | ||
68 | #endif | 74 | #endif |
69 | 75 | ||
76 | #define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0) | ||
77 | |||
70 | #define abs(x) ({ \ | 78 | #define abs(x) ({ \ |
71 | int __x = (x); \ | 79 | int __x = (x); \ |
72 | (__x < 0) ? -__x : __x; \ | 80 | (__x < 0) ? -__x : __x; \ |
diff --git a/include/linux/kexec.h b/include/linux/kexec.h new file mode 100644 index 000000000000..c8468472aec0 --- /dev/null +++ b/include/linux/kexec.h | |||
@@ -0,0 +1,135 @@ | |||
1 | #ifndef LINUX_KEXEC_H | ||
2 | #define LINUX_KEXEC_H | ||
3 | |||
4 | #ifdef CONFIG_KEXEC | ||
5 | #include <linux/types.h> | ||
6 | #include <linux/list.h> | ||
7 | #include <linux/linkage.h> | ||
8 | #include <linux/compat.h> | ||
9 | #include <asm/kexec.h> | ||
10 | |||
11 | /* Verify architecture specific macros are defined */ | ||
12 | |||
13 | #ifndef KEXEC_SOURCE_MEMORY_LIMIT | ||
14 | #error KEXEC_SOURCE_MEMORY_LIMIT not defined | ||
15 | #endif | ||
16 | |||
17 | #ifndef KEXEC_DESTINATION_MEMORY_LIMIT | ||
18 | #error KEXEC_DESTINATION_MEMORY_LIMIT not defined | ||
19 | #endif | ||
20 | |||
21 | #ifndef KEXEC_CONTROL_MEMORY_LIMIT | ||
22 | #error KEXEC_CONTROL_MEMORY_LIMIT not defined | ||
23 | #endif | ||
24 | |||
25 | #ifndef KEXEC_CONTROL_CODE_SIZE | ||
26 | #error KEXEC_CONTROL_CODE_SIZE not defined | ||
27 | #endif | ||
28 | |||
29 | #ifndef KEXEC_ARCH | ||
30 | #error KEXEC_ARCH not defined | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * This structure is used to hold the arguments that are used when loading | ||
35 | * kernel binaries. | ||
36 | */ | ||
37 | |||
38 | typedef unsigned long kimage_entry_t; | ||
39 | #define IND_DESTINATION 0x1 | ||
40 | #define IND_INDIRECTION 0x2 | ||
41 | #define IND_DONE 0x4 | ||
42 | #define IND_SOURCE 0x8 | ||
43 | |||
44 | #define KEXEC_SEGMENT_MAX 8 | ||
45 | struct kexec_segment { | ||
46 | void __user *buf; | ||
47 | size_t bufsz; | ||
48 | unsigned long mem; /* User space sees this as a (void *) ... */ | ||
49 | size_t memsz; | ||
50 | }; | ||
51 | |||
52 | #ifdef CONFIG_COMPAT | ||
53 | struct compat_kexec_segment { | ||
54 | compat_uptr_t buf; | ||
55 | compat_size_t bufsz; | ||
56 | compat_ulong_t mem; /* User space sees this as a (void *) ... */ | ||
57 | compat_size_t memsz; | ||
58 | }; | ||
59 | #endif | ||
60 | |||
61 | struct kimage { | ||
62 | kimage_entry_t head; | ||
63 | kimage_entry_t *entry; | ||
64 | kimage_entry_t *last_entry; | ||
65 | |||
66 | unsigned long destination; | ||
67 | |||
68 | unsigned long start; | ||
69 | struct page *control_code_page; | ||
70 | |||
71 | unsigned long nr_segments; | ||
72 | struct kexec_segment segment[KEXEC_SEGMENT_MAX]; | ||
73 | |||
74 | struct list_head control_pages; | ||
75 | struct list_head dest_pages; | ||
76 | struct list_head unuseable_pages; | ||
77 | |||
78 | /* Address of next control page to allocate for crash kernels. */ | ||
79 | unsigned long control_page; | ||
80 | |||
81 | /* Flags to indicate special processing */ | ||
82 | unsigned int type : 1; | ||
83 | #define KEXEC_TYPE_DEFAULT 0 | ||
84 | #define KEXEC_TYPE_CRASH 1 | ||
85 | }; | ||
86 | |||
87 | |||
88 | |||
89 | /* kexec interface functions */ | ||
90 | extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET; | ||
91 | extern int machine_kexec_prepare(struct kimage *image); | ||
92 | extern void machine_kexec_cleanup(struct kimage *image); | ||
93 | extern asmlinkage long sys_kexec_load(unsigned long entry, | ||
94 | unsigned long nr_segments, | ||
95 | struct kexec_segment __user *segments, | ||
96 | unsigned long flags); | ||
97 | #ifdef CONFIG_COMPAT | ||
98 | extern asmlinkage long compat_sys_kexec_load(unsigned long entry, | ||
99 | unsigned long nr_segments, | ||
100 | struct compat_kexec_segment __user *segments, | ||
101 | unsigned long flags); | ||
102 | #endif | ||
103 | extern struct page *kimage_alloc_control_pages(struct kimage *image, | ||
104 | unsigned int order); | ||
105 | extern void crash_kexec(struct pt_regs *); | ||
106 | int kexec_should_crash(struct task_struct *); | ||
107 | extern struct kimage *kexec_image; | ||
108 | |||
109 | #define KEXEC_ON_CRASH 0x00000001 | ||
110 | #define KEXEC_ARCH_MASK 0xffff0000 | ||
111 | |||
112 | /* These values match the ELF architecture values. | ||
113 | * Unless there is a good reason that should continue to be the case. | ||
114 | */ | ||
115 | #define KEXEC_ARCH_DEFAULT ( 0 << 16) | ||
116 | #define KEXEC_ARCH_386 ( 3 << 16) | ||
117 | #define KEXEC_ARCH_X86_64 (62 << 16) | ||
118 | #define KEXEC_ARCH_PPC (20 << 16) | ||
119 | #define KEXEC_ARCH_PPC64 (21 << 16) | ||
120 | #define KEXEC_ARCH_IA_64 (50 << 16) | ||
121 | #define KEXEC_ARCH_S390 (22 << 16) | ||
122 | |||
123 | #define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ | ||
124 | |||
125 | /* Location of a reserved region to hold the crash kernel. | ||
126 | */ | ||
127 | extern struct resource crashk_res; | ||
128 | |||
129 | #else /* !CONFIG_KEXEC */ | ||
130 | struct pt_regs; | ||
131 | struct task_struct; | ||
132 | static inline void crash_kexec(struct pt_regs *regs) { } | ||
133 | static inline int kexec_should_crash(struct task_struct *p) { return 0; } | ||
134 | #endif /* CONFIG_KEXEC */ | ||
135 | #endif /* LINUX_KEXEC_H */ | ||
diff --git a/include/linux/key-ui.h b/include/linux/key-ui.h index 60cc7b762e78..cc326174a808 100644 --- a/include/linux/key-ui.h +++ b/include/linux/key-ui.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* key-ui.h: key userspace interface stuff for use by keyfs | 1 | /* key-ui.h: key userspace interface stuff |
2 | * | 2 | * |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -31,8 +31,10 @@ extern spinlock_t key_serial_lock; | |||
31 | * subscribed | 31 | * subscribed |
32 | */ | 32 | */ |
33 | struct keyring_list { | 33 | struct keyring_list { |
34 | unsigned maxkeys; /* max keys this list can hold */ | 34 | struct rcu_head rcu; /* RCU deletion hook */ |
35 | unsigned nkeys; /* number of keys currently held */ | 35 | unsigned short maxkeys; /* max keys this list can hold */ |
36 | unsigned short nkeys; /* number of keys currently held */ | ||
37 | unsigned short delkey; /* key to be unlinked by RCU */ | ||
36 | struct key *keys[0]; | 38 | struct key *keys[0]; |
37 | }; | 39 | }; |
38 | 40 | ||
@@ -82,8 +84,45 @@ static inline int key_any_permission(const struct key *key, key_perm_t perm) | |||
82 | return kperm != 0; | 84 | return kperm != 0; |
83 | } | 85 | } |
84 | 86 | ||
87 | static inline int key_task_groups_search(struct task_struct *tsk, gid_t gid) | ||
88 | { | ||
89 | int ret; | ||
90 | |||
91 | task_lock(tsk); | ||
92 | ret = groups_search(tsk->group_info, gid); | ||
93 | task_unlock(tsk); | ||
94 | return ret; | ||
95 | } | ||
96 | |||
97 | static inline int key_task_permission(const struct key *key, | ||
98 | struct task_struct *context, | ||
99 | key_perm_t perm) | ||
100 | { | ||
101 | key_perm_t kperm; | ||
102 | |||
103 | if (key->uid == context->fsuid) { | ||
104 | kperm = key->perm >> 16; | ||
105 | } | ||
106 | else if (key->gid != -1 && | ||
107 | key->perm & KEY_GRP_ALL && ( | ||
108 | key->gid == context->fsgid || | ||
109 | key_task_groups_search(context, key->gid) | ||
110 | ) | ||
111 | ) { | ||
112 | kperm = key->perm >> 8; | ||
113 | } | ||
114 | else { | ||
115 | kperm = key->perm; | ||
116 | } | ||
117 | |||
118 | kperm = kperm & perm & KEY_ALL; | ||
119 | |||
120 | return kperm == perm; | ||
121 | |||
122 | } | ||
85 | 123 | ||
86 | extern struct key *lookup_user_key(key_serial_t id, int create, int part, | 124 | extern struct key *lookup_user_key(struct task_struct *context, |
125 | key_serial_t id, int create, int partial, | ||
87 | key_perm_t perm); | 126 | key_perm_t perm); |
88 | 127 | ||
89 | extern long join_session_keyring(const char *name); | 128 | extern long join_session_keyring(const char *name); |
diff --git a/include/linux/key.h b/include/linux/key.h index 6aa46d0e812f..970bbd916cf4 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/rbtree.h> | 20 | #include <linux/rbtree.h> |
21 | #include <linux/spinlock.h> | 21 | #include <linux/rcupdate.h> |
22 | #include <asm/atomic.h> | 22 | #include <asm/atomic.h> |
23 | 23 | ||
24 | #ifdef __KERNEL__ | 24 | #ifdef __KERNEL__ |
@@ -78,7 +78,6 @@ struct key { | |||
78 | key_serial_t serial; /* key serial number */ | 78 | key_serial_t serial; /* key serial number */ |
79 | struct rb_node serial_node; | 79 | struct rb_node serial_node; |
80 | struct key_type *type; /* type of key */ | 80 | struct key_type *type; /* type of key */ |
81 | rwlock_t lock; /* examination vs change lock */ | ||
82 | struct rw_semaphore sem; /* change vs change sem */ | 81 | struct rw_semaphore sem; /* change vs change sem */ |
83 | struct key_user *user; /* owner of this key */ | 82 | struct key_user *user; /* owner of this key */ |
84 | time_t expiry; /* time at which key expires (or 0) */ | 83 | time_t expiry; /* time at which key expires (or 0) */ |
@@ -86,14 +85,10 @@ struct key { | |||
86 | gid_t gid; | 85 | gid_t gid; |
87 | key_perm_t perm; /* access permissions */ | 86 | key_perm_t perm; /* access permissions */ |
88 | unsigned short quotalen; /* length added to quota */ | 87 | unsigned short quotalen; /* length added to quota */ |
89 | unsigned short datalen; /* payload data length */ | 88 | unsigned short datalen; /* payload data length |
90 | unsigned short flags; /* status flags (change with lock writelocked) */ | 89 | * - may not match RCU dereferenced payload |
91 | #define KEY_FLAG_INSTANTIATED 0x00000001 /* set if key has been instantiated */ | 90 | * - payload should contain own length |
92 | #define KEY_FLAG_DEAD 0x00000002 /* set if key type has been deleted */ | 91 | */ |
93 | #define KEY_FLAG_REVOKED 0x00000004 /* set if key had been revoked */ | ||
94 | #define KEY_FLAG_IN_QUOTA 0x00000008 /* set if key consumes quota */ | ||
95 | #define KEY_FLAG_USER_CONSTRUCT 0x00000010 /* set if key is being constructed in userspace */ | ||
96 | #define KEY_FLAG_NEGATIVE 0x00000020 /* set if key is negative */ | ||
97 | 92 | ||
98 | #ifdef KEY_DEBUGGING | 93 | #ifdef KEY_DEBUGGING |
99 | unsigned magic; | 94 | unsigned magic; |
@@ -101,6 +96,14 @@ struct key { | |||
101 | #define KEY_DEBUG_MAGIC_X 0xf8e9dacbu | 96 | #define KEY_DEBUG_MAGIC_X 0xf8e9dacbu |
102 | #endif | 97 | #endif |
103 | 98 | ||
99 | unsigned long flags; /* status flags (change with bitops) */ | ||
100 | #define KEY_FLAG_INSTANTIATED 0 /* set if key has been instantiated */ | ||
101 | #define KEY_FLAG_DEAD 1 /* set if key type has been deleted */ | ||
102 | #define KEY_FLAG_REVOKED 2 /* set if key had been revoked */ | ||
103 | #define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */ | ||
104 | #define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ | ||
105 | #define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ | ||
106 | |||
104 | /* the description string | 107 | /* the description string |
105 | * - this is used to match a key against search criteria | 108 | * - this is used to match a key against search criteria |
106 | * - this should be a printable string | 109 | * - this should be a printable string |
@@ -196,10 +199,12 @@ extern int key_payload_reserve(struct key *key, size_t datalen); | |||
196 | extern int key_instantiate_and_link(struct key *key, | 199 | extern int key_instantiate_and_link(struct key *key, |
197 | const void *data, | 200 | const void *data, |
198 | size_t datalen, | 201 | size_t datalen, |
199 | struct key *keyring); | 202 | struct key *keyring, |
203 | struct key *instkey); | ||
200 | extern int key_negate_and_link(struct key *key, | 204 | extern int key_negate_and_link(struct key *key, |
201 | unsigned timeout, | 205 | unsigned timeout, |
202 | struct key *keyring); | 206 | struct key *keyring, |
207 | struct key *instkey); | ||
203 | extern void key_revoke(struct key *key); | 208 | extern void key_revoke(struct key *key); |
204 | extern void key_put(struct key *key); | 209 | extern void key_put(struct key *key); |
205 | 210 | ||
@@ -242,14 +247,13 @@ extern struct key *keyring_search(struct key *keyring, | |||
242 | struct key_type *type, | 247 | struct key_type *type, |
243 | const char *description); | 248 | const char *description); |
244 | 249 | ||
245 | extern struct key *search_process_keyrings(struct key_type *type, | ||
246 | const char *description); | ||
247 | |||
248 | extern int keyring_add_key(struct key *keyring, | 250 | extern int keyring_add_key(struct key *keyring, |
249 | struct key *key); | 251 | struct key *key); |
250 | 252 | ||
251 | extern struct key *key_lookup(key_serial_t id); | 253 | extern struct key *key_lookup(key_serial_t id); |
252 | 254 | ||
255 | extern void keyring_replace_payload(struct key *key, void *replacement); | ||
256 | |||
253 | #define key_serial(key) ((key) ? (key)->serial : 0) | 257 | #define key_serial(key) ((key) ? (key)->serial : 0) |
254 | 258 | ||
255 | /* | 259 | /* |
@@ -268,14 +272,22 @@ extern void key_fsuid_changed(struct task_struct *tsk); | |||
268 | extern void key_fsgid_changed(struct task_struct *tsk); | 272 | extern void key_fsgid_changed(struct task_struct *tsk); |
269 | extern void key_init(void); | 273 | extern void key_init(void); |
270 | 274 | ||
275 | #define __install_session_keyring(tsk, keyring) \ | ||
276 | ({ \ | ||
277 | struct key *old_session = tsk->signal->session_keyring; \ | ||
278 | tsk->signal->session_keyring = keyring; \ | ||
279 | old_session; \ | ||
280 | }) | ||
281 | |||
271 | #else /* CONFIG_KEYS */ | 282 | #else /* CONFIG_KEYS */ |
272 | 283 | ||
273 | #define key_validate(k) 0 | 284 | #define key_validate(k) 0 |
274 | #define key_serial(k) 0 | 285 | #define key_serial(k) 0 |
275 | #define key_get(k) NULL | 286 | #define key_get(k) ({ NULL; }) |
276 | #define key_put(k) do { } while(0) | 287 | #define key_put(k) do { } while(0) |
277 | #define alloc_uid_keyring(u) 0 | 288 | #define alloc_uid_keyring(u) 0 |
278 | #define switch_uid_keyring(u) do { } while(0) | 289 | #define switch_uid_keyring(u) do { } while(0) |
290 | #define __install_session_keyring(t, k) ({ NULL; }) | ||
279 | #define copy_keys(f,t) 0 | 291 | #define copy_keys(f,t) 0 |
280 | #define copy_thread_group_keys(t) 0 | 292 | #define copy_thread_group_keys(t) 0 |
281 | #define exit_keys(t) do { } while(0) | 293 | #define exit_keys(t) do { } while(0) |
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h index 381dedc370a3..8d7c59a29e09 100644 --- a/include/linux/keyctl.h +++ b/include/linux/keyctl.h | |||
@@ -20,6 +20,16 @@ | |||
20 | #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ | 20 | #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ |
21 | #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ | 21 | #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ |
22 | 22 | ||
23 | /* request-key default keyrings */ | ||
24 | #define KEY_REQKEY_DEFL_NO_CHANGE -1 | ||
25 | #define KEY_REQKEY_DEFL_DEFAULT 0 | ||
26 | #define KEY_REQKEY_DEFL_THREAD_KEYRING 1 | ||
27 | #define KEY_REQKEY_DEFL_PROCESS_KEYRING 2 | ||
28 | #define KEY_REQKEY_DEFL_SESSION_KEYRING 3 | ||
29 | #define KEY_REQKEY_DEFL_USER_KEYRING 4 | ||
30 | #define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 | ||
31 | #define KEY_REQKEY_DEFL_GROUP_KEYRING 6 | ||
32 | |||
23 | /* keyctl commands */ | 33 | /* keyctl commands */ |
24 | #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ | 34 | #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ |
25 | #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ | 35 | #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ |
@@ -35,5 +45,6 @@ | |||
35 | #define KEYCTL_READ 11 /* read a key or keyring's contents */ | 45 | #define KEYCTL_READ 11 /* read a key or keyring's contents */ |
36 | #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ | 46 | #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ |
37 | #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ | 47 | #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ |
48 | #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ | ||
38 | 49 | ||
39 | #endif /* _LINUX_KEYCTL_H */ | 50 | #endif /* _LINUX_KEYCTL_H */ |
diff --git a/include/linux/klist.h b/include/linux/klist.h new file mode 100644 index 000000000000..eebf5e5696ec --- /dev/null +++ b/include/linux/klist.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * klist.h - Some generic list helpers, extending struct list_head a bit. | ||
3 | * | ||
4 | * Implementations are found in lib/klist.c | ||
5 | * | ||
6 | * | ||
7 | * Copyright (C) 2005 Patrick Mochel | ||
8 | * | ||
9 | * This file is rleased under the GPL v2. | ||
10 | */ | ||
11 | |||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/completion.h> | ||
14 | #include <linux/kref.h> | ||
15 | #include <linux/list.h> | ||
16 | |||
17 | |||
18 | struct klist { | ||
19 | spinlock_t k_lock; | ||
20 | struct list_head k_list; | ||
21 | }; | ||
22 | |||
23 | |||
24 | extern void klist_init(struct klist * k); | ||
25 | |||
26 | |||
27 | struct klist_node { | ||
28 | struct klist * n_klist; | ||
29 | struct list_head n_node; | ||
30 | struct kref n_ref; | ||
31 | struct completion n_removed; | ||
32 | }; | ||
33 | |||
34 | extern void klist_add_tail(struct klist * k, struct klist_node * n); | ||
35 | extern void klist_add_head(struct klist * k, struct klist_node * n); | ||
36 | |||
37 | extern void klist_del(struct klist_node * n); | ||
38 | extern void klist_remove(struct klist_node * n); | ||
39 | |||
40 | extern int klist_node_attached(struct klist_node * n); | ||
41 | |||
42 | |||
43 | struct klist_iter { | ||
44 | struct klist * i_klist; | ||
45 | struct list_head * i_head; | ||
46 | struct klist_node * i_cur; | ||
47 | }; | ||
48 | |||
49 | |||
50 | extern void klist_iter_init(struct klist * k, struct klist_iter * i); | ||
51 | extern void klist_iter_init_node(struct klist * k, struct klist_iter * i, | ||
52 | struct klist_node * n); | ||
53 | extern void klist_iter_exit(struct klist_iter * i); | ||
54 | extern struct klist_node * klist_next(struct klist_iter * i); | ||
55 | |||
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 95d0e4b0814d..e4a231549407 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -19,6 +19,7 @@ | |||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/stddef.h> | ||
22 | #include <linux/config.h> | 23 | #include <linux/config.h> |
23 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
24 | #include <linux/compiler.h> | 25 | #include <linux/compiler.h> |
@@ -34,7 +35,17 @@ static inline int request_module(const char * name, ...) { return -ENOSYS; } | |||
34 | #endif | 35 | #endif |
35 | 36 | ||
36 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | 37 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) |
37 | extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait); | 38 | |
39 | struct key; | ||
40 | extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[], | ||
41 | struct key *session_keyring, int wait); | ||
42 | |||
43 | static inline int | ||
44 | call_usermodehelper(char *path, char **argv, char **envp, int wait) | ||
45 | { | ||
46 | return call_usermodehelper_keys(path, argv, envp, NULL, wait); | ||
47 | } | ||
48 | |||
38 | extern void usermodehelper_init(void); | 49 | extern void usermodehelper_init(void); |
39 | 50 | ||
40 | #endif /* __LINUX_KMOD_H__ */ | 51 | #endif /* __LINUX_KMOD_H__ */ |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 765d660d3bea..3b22304f12fd 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -33,7 +33,7 @@ | |||
33 | extern u64 hotplug_seqnum; | 33 | extern u64 hotplug_seqnum; |
34 | 34 | ||
35 | struct kobject { | 35 | struct kobject { |
36 | char * k_name; | 36 | const char * k_name; |
37 | char name[KOBJ_NAME_LEN]; | 37 | char name[KOBJ_NAME_LEN]; |
38 | struct kref kref; | 38 | struct kref kref; |
39 | struct list_head entry; | 39 | struct list_head entry; |
@@ -46,7 +46,7 @@ struct kobject { | |||
46 | extern int kobject_set_name(struct kobject *, const char *, ...) | 46 | extern int kobject_set_name(struct kobject *, const char *, ...) |
47 | __attribute__((format(printf,2,3))); | 47 | __attribute__((format(printf,2,3))); |
48 | 48 | ||
49 | static inline char * kobject_name(struct kobject * kobj) | 49 | static inline const char * kobject_name(const struct kobject * kobj) |
50 | { | 50 | { |
51 | return kobj->k_name; | 51 | return kobj->k_name; |
52 | } | 52 | } |
@@ -57,7 +57,7 @@ extern void kobject_cleanup(struct kobject *); | |||
57 | extern int kobject_add(struct kobject *); | 57 | extern int kobject_add(struct kobject *); |
58 | extern void kobject_del(struct kobject *); | 58 | extern void kobject_del(struct kobject *); |
59 | 59 | ||
60 | extern int kobject_rename(struct kobject *, char *new_name); | 60 | extern int kobject_rename(struct kobject *, const char *new_name); |
61 | 61 | ||
62 | extern int kobject_register(struct kobject *); | 62 | extern int kobject_register(struct kobject *); |
63 | extern void kobject_unregister(struct kobject *); | 63 | extern void kobject_unregister(struct kobject *); |
@@ -94,7 +94,7 @@ struct kobj_type { | |||
94 | */ | 94 | */ |
95 | struct kset_hotplug_ops { | 95 | struct kset_hotplug_ops { |
96 | int (*filter)(struct kset *kset, struct kobject *kobj); | 96 | int (*filter)(struct kset *kset, struct kobject *kobj); |
97 | char *(*name)(struct kset *kset, struct kobject *kobj); | 97 | const char *(*name)(struct kset *kset, struct kobject *kobj); |
98 | int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, | 98 | int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, |
99 | int num_envp, char *buffer, int buffer_size); | 99 | int num_envp, char *buffer, int buffer_size); |
100 | }; | 100 | }; |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 99ddba5a4e00..5e1a7b0d7b3f 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -25,27 +25,45 @@ | |||
25 | * Rusty Russell). | 25 | * Rusty Russell). |
26 | * 2004-July Suparna Bhattacharya <suparna@in.ibm.com> added jumper probes | 26 | * 2004-July Suparna Bhattacharya <suparna@in.ibm.com> added jumper probes |
27 | * interface to access function arguments. | 27 | * interface to access function arguments. |
28 | * 2005-May Hien Nguyen <hien@us.ibm.com> and Jim Keniston | ||
29 | * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi | ||
30 | * <prasanna@in.ibm.com> added function-return probes. | ||
28 | */ | 31 | */ |
29 | #include <linux/config.h> | 32 | #include <linux/config.h> |
30 | #include <linux/list.h> | 33 | #include <linux/list.h> |
31 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
32 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
36 | |||
33 | #include <asm/kprobes.h> | 37 | #include <asm/kprobes.h> |
34 | 38 | ||
39 | /* kprobe_status settings */ | ||
40 | #define KPROBE_HIT_ACTIVE 0x00000001 | ||
41 | #define KPROBE_HIT_SS 0x00000002 | ||
42 | #define KPROBE_REENTER 0x00000004 | ||
43 | #define KPROBE_HIT_SSDONE 0x00000008 | ||
44 | |||
35 | struct kprobe; | 45 | struct kprobe; |
36 | struct pt_regs; | 46 | struct pt_regs; |
47 | struct kretprobe; | ||
48 | struct kretprobe_instance; | ||
37 | typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *); | 49 | typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *); |
38 | typedef int (*kprobe_break_handler_t) (struct kprobe *, struct pt_regs *); | 50 | typedef int (*kprobe_break_handler_t) (struct kprobe *, struct pt_regs *); |
39 | typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *, | 51 | typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *, |
40 | unsigned long flags); | 52 | unsigned long flags); |
41 | typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *, | 53 | typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *, |
42 | int trapnr); | 54 | int trapnr); |
55 | typedef int (*kretprobe_handler_t) (struct kretprobe_instance *, | ||
56 | struct pt_regs *); | ||
57 | |||
43 | struct kprobe { | 58 | struct kprobe { |
44 | struct hlist_node hlist; | 59 | struct hlist_node hlist; |
45 | 60 | ||
46 | /* list of kprobes for multi-handler support */ | 61 | /* list of kprobes for multi-handler support */ |
47 | struct list_head list; | 62 | struct list_head list; |
48 | 63 | ||
64 | /*count the number of times this probe was temporarily disarmed */ | ||
65 | unsigned long nmissed; | ||
66 | |||
49 | /* location of the probe point */ | 67 | /* location of the probe point */ |
50 | kprobe_opcode_t *addr; | 68 | kprobe_opcode_t *addr; |
51 | 69 | ||
@@ -85,6 +103,62 @@ struct jprobe { | |||
85 | kprobe_opcode_t *entry; /* probe handling code to jump to */ | 103 | kprobe_opcode_t *entry; /* probe handling code to jump to */ |
86 | }; | 104 | }; |
87 | 105 | ||
106 | #ifdef ARCH_SUPPORTS_KRETPROBES | ||
107 | extern int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs); | ||
108 | extern void trampoline_post_handler(struct kprobe *p, struct pt_regs *regs, | ||
109 | unsigned long flags); | ||
110 | extern struct task_struct *arch_get_kprobe_task(void *ptr); | ||
111 | extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); | ||
112 | extern void arch_kprobe_flush_task(struct task_struct *tk); | ||
113 | #else /* ARCH_SUPPORTS_KRETPROBES */ | ||
114 | static inline void kretprobe_trampoline(void) | ||
115 | { | ||
116 | } | ||
117 | static inline int trampoline_probe_handler(struct kprobe *p, | ||
118 | struct pt_regs *regs) | ||
119 | { | ||
120 | return 0; | ||
121 | } | ||
122 | static inline void trampoline_post_handler(struct kprobe *p, | ||
123 | struct pt_regs *regs, unsigned long flags) | ||
124 | { | ||
125 | } | ||
126 | static inline void arch_prepare_kretprobe(struct kretprobe *rp, | ||
127 | struct pt_regs *regs) | ||
128 | { | ||
129 | } | ||
130 | static inline void arch_kprobe_flush_task(struct task_struct *tk) | ||
131 | { | ||
132 | } | ||
133 | #define arch_get_kprobe_task(ptr) ((struct task_struct *)NULL) | ||
134 | #endif /* ARCH_SUPPORTS_KRETPROBES */ | ||
135 | /* | ||
136 | * Function-return probe - | ||
137 | * Note: | ||
138 | * User needs to provide a handler function, and initialize maxactive. | ||
139 | * maxactive - The maximum number of instances of the probed function that | ||
140 | * can be active concurrently. | ||
141 | * nmissed - tracks the number of times the probed function's return was | ||
142 | * ignored, due to maxactive being too low. | ||
143 | * | ||
144 | */ | ||
145 | struct kretprobe { | ||
146 | struct kprobe kp; | ||
147 | kretprobe_handler_t handler; | ||
148 | int maxactive; | ||
149 | int nmissed; | ||
150 | struct hlist_head free_instances; | ||
151 | struct hlist_head used_instances; | ||
152 | }; | ||
153 | |||
154 | struct kretprobe_instance { | ||
155 | struct hlist_node uflist; /* either on free list or used list */ | ||
156 | struct hlist_node hlist; | ||
157 | struct kretprobe *rp; | ||
158 | void *ret_addr; | ||
159 | void *stack_addr; | ||
160 | }; | ||
161 | |||
88 | #ifdef CONFIG_KPROBES | 162 | #ifdef CONFIG_KPROBES |
89 | /* Locks kprobe: irq must be disabled */ | 163 | /* Locks kprobe: irq must be disabled */ |
90 | void lock_kprobes(void); | 164 | void lock_kprobes(void); |
@@ -99,11 +173,14 @@ static inline int kprobe_running(void) | |||
99 | 173 | ||
100 | extern int arch_prepare_kprobe(struct kprobe *p); | 174 | extern int arch_prepare_kprobe(struct kprobe *p); |
101 | extern void arch_copy_kprobe(struct kprobe *p); | 175 | extern void arch_copy_kprobe(struct kprobe *p); |
176 | extern void arch_arm_kprobe(struct kprobe *p); | ||
177 | extern void arch_disarm_kprobe(struct kprobe *p); | ||
102 | extern void arch_remove_kprobe(struct kprobe *p); | 178 | extern void arch_remove_kprobe(struct kprobe *p); |
103 | extern void show_registers(struct pt_regs *regs); | 179 | extern void show_registers(struct pt_regs *regs); |
104 | 180 | ||
105 | /* Get the kprobe at this addr (if any). Must have called lock_kprobes */ | 181 | /* Get the kprobe at this addr (if any). Must have called lock_kprobes */ |
106 | struct kprobe *get_kprobe(void *addr); | 182 | struct kprobe *get_kprobe(void *addr); |
183 | struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); | ||
107 | 184 | ||
108 | int register_kprobe(struct kprobe *p); | 185 | int register_kprobe(struct kprobe *p); |
109 | void unregister_kprobe(struct kprobe *p); | 186 | void unregister_kprobe(struct kprobe *p); |
@@ -113,7 +190,16 @@ int register_jprobe(struct jprobe *p); | |||
113 | void unregister_jprobe(struct jprobe *p); | 190 | void unregister_jprobe(struct jprobe *p); |
114 | void jprobe_return(void); | 191 | void jprobe_return(void); |
115 | 192 | ||
116 | #else | 193 | int register_kretprobe(struct kretprobe *rp); |
194 | void unregister_kretprobe(struct kretprobe *rp); | ||
195 | |||
196 | struct kretprobe_instance *get_free_rp_inst(struct kretprobe *rp); | ||
197 | struct kretprobe_instance *get_rp_inst(void *sara); | ||
198 | struct kretprobe_instance *get_rp_inst_tsk(struct task_struct *tk); | ||
199 | void add_rp_inst(struct kretprobe_instance *ri); | ||
200 | void kprobe_flush_task(struct task_struct *tk); | ||
201 | void recycle_rp_inst(struct kretprobe_instance *ri); | ||
202 | #else /* CONFIG_KPROBES */ | ||
117 | static inline int kprobe_running(void) | 203 | static inline int kprobe_running(void) |
118 | { | 204 | { |
119 | return 0; | 205 | return 0; |
@@ -135,5 +221,15 @@ static inline void unregister_jprobe(struct jprobe *p) | |||
135 | static inline void jprobe_return(void) | 221 | static inline void jprobe_return(void) |
136 | { | 222 | { |
137 | } | 223 | } |
138 | #endif | 224 | static inline int register_kretprobe(struct kretprobe *rp) |
225 | { | ||
226 | return -ENOSYS; | ||
227 | } | ||
228 | static inline void unregister_kretprobe(struct kretprobe *rp) | ||
229 | { | ||
230 | } | ||
231 | static inline void kprobe_flush_task(struct task_struct *tk) | ||
232 | { | ||
233 | } | ||
234 | #endif /* CONFIG_KPROBES */ | ||
139 | #endif /* _LINUX_KPROBES_H */ | 235 | #endif /* _LINUX_KPROBES_H */ |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 1f7e2039a04e..6cd9ba63563b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -410,6 +410,7 @@ extern u8 ata_chk_err(struct ata_port *ap); | |||
410 | extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); | 410 | extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); |
411 | extern int ata_port_start (struct ata_port *ap); | 411 | extern int ata_port_start (struct ata_port *ap); |
412 | extern void ata_port_stop (struct ata_port *ap); | 412 | extern void ata_port_stop (struct ata_port *ap); |
413 | extern void ata_host_stop (struct ata_host_set *host_set); | ||
413 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 414 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); |
414 | extern void ata_qc_prep(struct ata_queued_cmd *qc); | 415 | extern void ata_qc_prep(struct ata_queued_cmd *qc); |
415 | extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); | 416 | extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); |
@@ -420,6 +421,7 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | |||
420 | extern unsigned int ata_dev_classify(struct ata_taskfile *tf); | 421 | extern unsigned int ata_dev_classify(struct ata_taskfile *tf); |
421 | extern void ata_dev_id_string(u16 *id, unsigned char *s, | 422 | extern void ata_dev_id_string(u16 *id, unsigned char *s, |
422 | unsigned int ofs, unsigned int len); | 423 | unsigned int ofs, unsigned int len); |
424 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); | ||
423 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 425 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
424 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); | 426 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); |
425 | extern void ata_bmdma_stop(struct ata_port *ap); | 427 | extern void ata_bmdma_stop(struct ata_port *ap); |
@@ -466,12 +468,34 @@ static inline u8 ata_chk_status(struct ata_port *ap) | |||
466 | return ap->ops->check_status(ap); | 468 | return ap->ops->check_status(ap); |
467 | } | 469 | } |
468 | 470 | ||
471 | |||
472 | /** | ||
473 | * ata_pause - Flush writes and pause 400 nanoseconds. | ||
474 | * @ap: Port to wait for. | ||
475 | * | ||
476 | * LOCKING: | ||
477 | * Inherited from caller. | ||
478 | */ | ||
479 | |||
469 | static inline void ata_pause(struct ata_port *ap) | 480 | static inline void ata_pause(struct ata_port *ap) |
470 | { | 481 | { |
471 | ata_altstatus(ap); | 482 | ata_altstatus(ap); |
472 | ndelay(400); | 483 | ndelay(400); |
473 | } | 484 | } |
474 | 485 | ||
486 | |||
487 | /** | ||
488 | * ata_busy_wait - Wait for a port status register | ||
489 | * @ap: Port to wait for. | ||
490 | * | ||
491 | * Waits up to max*10 microseconds for the selected bits in the port's | ||
492 | * status register to be cleared. | ||
493 | * Returns final value of status register. | ||
494 | * | ||
495 | * LOCKING: | ||
496 | * Inherited from caller. | ||
497 | */ | ||
498 | |||
475 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | 499 | static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, |
476 | unsigned int max) | 500 | unsigned int max) |
477 | { | 501 | { |
@@ -486,6 +510,18 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits, | |||
486 | return status; | 510 | return status; |
487 | } | 511 | } |
488 | 512 | ||
513 | |||
514 | /** | ||
515 | * ata_wait_idle - Wait for a port to be idle. | ||
516 | * @ap: Port to wait for. | ||
517 | * | ||
518 | * Waits up to 10ms for port's BUSY and DRQ signals to clear. | ||
519 | * Returns final value of status register. | ||
520 | * | ||
521 | * LOCKING: | ||
522 | * Inherited from caller. | ||
523 | */ | ||
524 | |||
489 | static inline u8 ata_wait_idle(struct ata_port *ap) | 525 | static inline u8 ata_wait_idle(struct ata_port *ap) |
490 | { | 526 | { |
491 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 527 | u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
@@ -524,6 +560,18 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns | |||
524 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; | 560 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; |
525 | } | 561 | } |
526 | 562 | ||
563 | |||
564 | /** | ||
565 | * ata_irq_on - Enable interrupts on a port. | ||
566 | * @ap: Port on which interrupts are enabled. | ||
567 | * | ||
568 | * Enable interrupts on a legacy IDE device using MMIO or PIO, | ||
569 | * wait for idle, clear any pending interrupts. | ||
570 | * | ||
571 | * LOCKING: | ||
572 | * Inherited from caller. | ||
573 | */ | ||
574 | |||
527 | static inline u8 ata_irq_on(struct ata_port *ap) | 575 | static inline u8 ata_irq_on(struct ata_port *ap) |
528 | { | 576 | { |
529 | struct ata_ioports *ioaddr = &ap->ioaddr; | 577 | struct ata_ioports *ioaddr = &ap->ioaddr; |
@@ -543,6 +591,18 @@ static inline u8 ata_irq_on(struct ata_port *ap) | |||
543 | return tmp; | 591 | return tmp; |
544 | } | 592 | } |
545 | 593 | ||
594 | |||
595 | /** | ||
596 | * ata_irq_ack - Acknowledge a device interrupt. | ||
597 | * @ap: Port on which interrupts are enabled. | ||
598 | * | ||
599 | * Wait up to 10 ms for legacy IDE device to become idle (BUSY | ||
600 | * or BUSY+DRQ clear). Obtain dma status and port status from | ||
601 | * device. Clear the interrupt. Return port status. | ||
602 | * | ||
603 | * LOCKING: | ||
604 | */ | ||
605 | |||
546 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | 606 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) |
547 | { | 607 | { |
548 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | 608 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; |
diff --git a/include/linux/list.h b/include/linux/list.h index 399b51d17218..aab2db21b013 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -185,7 +185,7 @@ static inline void list_del(struct list_head *entry) | |||
185 | * list_for_each_entry_rcu(). | 185 | * list_for_each_entry_rcu(). |
186 | * | 186 | * |
187 | * Note that the caller is not permitted to immediately free | 187 | * Note that the caller is not permitted to immediately free |
188 | * the newly deleted entry. Instead, either synchronize_kernel() | 188 | * the newly deleted entry. Instead, either synchronize_rcu() |
189 | * or call_rcu() must be used to defer freeing until an RCU | 189 | * or call_rcu() must be used to defer freeing until an RCU |
190 | * grace period has elapsed. | 190 | * grace period has elapsed. |
191 | */ | 191 | */ |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 0d9d22578212..16d4e5a08e1d 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -72,6 +72,8 @@ struct nlm_lockowner { | |||
72 | uint32_t pid; | 72 | uint32_t pid; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | struct nlm_wait; | ||
76 | |||
75 | /* | 77 | /* |
76 | * Memory chunk for NLM client RPC request. | 78 | * Memory chunk for NLM client RPC request. |
77 | */ | 79 | */ |
@@ -81,6 +83,7 @@ struct nlm_rqst { | |||
81 | struct nlm_host * a_host; /* host handle */ | 83 | struct nlm_host * a_host; /* host handle */ |
82 | struct nlm_args a_args; /* arguments */ | 84 | struct nlm_args a_args; /* arguments */ |
83 | struct nlm_res a_res; /* result */ | 85 | struct nlm_res a_res; /* result */ |
86 | struct nlm_wait * a_block; | ||
84 | char a_owner[NLMCLNT_OHSIZE]; | 87 | char a_owner[NLMCLNT_OHSIZE]; |
85 | }; | 88 | }; |
86 | 89 | ||
@@ -142,7 +145,9 @@ extern unsigned long nlmsvc_timeout; | |||
142 | * Lockd client functions | 145 | * Lockd client functions |
143 | */ | 146 | */ |
144 | struct nlm_rqst * nlmclnt_alloc_call(void); | 147 | struct nlm_rqst * nlmclnt_alloc_call(void); |
145 | int nlmclnt_block(struct nlm_host *, struct file_lock *, u32 *); | 148 | int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl); |
149 | void nlmclnt_finish_block(struct nlm_rqst *req); | ||
150 | long nlmclnt_block(struct nlm_rqst *req, long timeout); | ||
146 | int nlmclnt_cancel(struct nlm_host *, struct file_lock *); | 151 | int nlmclnt_cancel(struct nlm_host *, struct file_lock *); |
147 | u32 nlmclnt_grant(struct nlm_lock *); | 152 | u32 nlmclnt_grant(struct nlm_lock *); |
148 | void nlmclnt_recovery(struct nlm_host *, u32); | 153 | void nlmclnt_recovery(struct nlm_host *, u32); |
diff --git a/include/linux/loop.h b/include/linux/loop.h index 8220d9c9da00..53fa51595443 100644 --- a/include/linux/loop.h +++ b/include/linux/loop.h | |||
@@ -61,7 +61,7 @@ struct loop_device { | |||
61 | struct semaphore lo_sem; | 61 | struct semaphore lo_sem; |
62 | struct semaphore lo_ctl_mutex; | 62 | struct semaphore lo_ctl_mutex; |
63 | struct semaphore lo_bh_mutex; | 63 | struct semaphore lo_bh_mutex; |
64 | atomic_t lo_pending; | 64 | int lo_pending; |
65 | 65 | ||
66 | request_queue_t *lo_queue; | 66 | request_queue_t *lo_queue; |
67 | }; | 67 | }; |
diff --git a/include/linux/major.h b/include/linux/major.h index 4b62c42b842c..e36a46702d94 100644 --- a/include/linux/major.h +++ b/include/linux/major.h | |||
@@ -100,6 +100,7 @@ | |||
100 | #define I2O_MAJOR 80 /* 80->87 */ | 100 | #define I2O_MAJOR 80 /* 80->87 */ |
101 | 101 | ||
102 | #define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ | 102 | #define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ |
103 | #define SCSI_CHANGER_MAJOR 86 | ||
103 | 104 | ||
104 | #define IDE6_MAJOR 88 | 105 | #define IDE6_MAJOR 88 |
105 | #define IDE7_MAJOR 89 | 106 | #define IDE7_MAJOR 89 |
diff --git a/include/linux/mempool.h b/include/linux/mempool.h index 4a36edf1c974..796220ce47cc 100644 --- a/include/linux/mempool.h +++ b/include/linux/mempool.h | |||
@@ -20,9 +20,14 @@ typedef struct mempool_s { | |||
20 | mempool_free_t *free; | 20 | mempool_free_t *free; |
21 | wait_queue_head_t wait; | 21 | wait_queue_head_t wait; |
22 | } mempool_t; | 22 | } mempool_t; |
23 | extern mempool_t * mempool_create(int min_nr, mempool_alloc_t *alloc_fn, | 23 | |
24 | mempool_free_t *free_fn, void *pool_data); | 24 | extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn, |
25 | extern int mempool_resize(mempool_t *pool, int new_min_nr, unsigned int __nocast gfp_mask); | 25 | mempool_free_t *free_fn, void *pool_data); |
26 | extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn, | ||
27 | mempool_free_t *free_fn, void *pool_data, int nid); | ||
28 | |||
29 | extern int mempool_resize(mempool_t *pool, int new_min_nr, | ||
30 | unsigned int __nocast gfp_mask); | ||
26 | extern void mempool_destroy(mempool_t *pool); | 31 | extern void mempool_destroy(mempool_t *pool); |
27 | extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); | 32 | extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); |
28 | extern void mempool_free(void *element, mempool_t *pool); | 33 | extern void mempool_free(void *element, mempool_t *pool); |
diff --git a/include/linux/mii.h b/include/linux/mii.h index 20971fe78a8d..374b615ea9ea 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h | |||
@@ -65,9 +65,13 @@ | |||
65 | #define ADVERTISE_SLCT 0x001f /* Selector bits */ | 65 | #define ADVERTISE_SLCT 0x001f /* Selector bits */ |
66 | #define ADVERTISE_CSMA 0x0001 /* Only selector supported */ | 66 | #define ADVERTISE_CSMA 0x0001 /* Only selector supported */ |
67 | #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ | 67 | #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ |
68 | #define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */ | ||
68 | #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ | 69 | #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ |
70 | #define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */ | ||
69 | #define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ | 71 | #define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ |
72 | #define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */ | ||
70 | #define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ | 73 | #define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ |
74 | #define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */ | ||
71 | #define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ | 75 | #define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ |
72 | #define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ | 76 | #define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ |
73 | #define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */ | 77 | #define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */ |
@@ -84,9 +88,13 @@ | |||
84 | /* Link partner ability register. */ | 88 | /* Link partner ability register. */ |
85 | #define LPA_SLCT 0x001f /* Same as advertise selector */ | 89 | #define LPA_SLCT 0x001f /* Same as advertise selector */ |
86 | #define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ | 90 | #define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ |
91 | #define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */ | ||
87 | #define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ | 92 | #define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ |
93 | #define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */ | ||
88 | #define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ | 94 | #define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ |
95 | #define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */ | ||
89 | #define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ | 96 | #define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ |
97 | #define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/ | ||
90 | #define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ | 98 | #define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ |
91 | #define LPA_PAUSE_CAP 0x0400 /* Can pause */ | 99 | #define LPA_PAUSE_CAP 0x0400 /* Can pause */ |
92 | #define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ | 100 | #define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 17518fe0b311..6eb7f48317f8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -395,19 +395,81 @@ static inline void put_page(struct page *page) | |||
395 | /* | 395 | /* |
396 | * The zone field is never updated after free_area_init_core() | 396 | * The zone field is never updated after free_area_init_core() |
397 | * sets it, so none of the operations on it need to be atomic. | 397 | * sets it, so none of the operations on it need to be atomic. |
398 | * We'll have up to (MAX_NUMNODES * MAX_NR_ZONES) zones total, | ||
399 | * so we use (MAX_NODES_SHIFT + MAX_ZONES_SHIFT) here to get enough bits. | ||
400 | */ | 398 | */ |
401 | #define NODEZONE_SHIFT (sizeof(page_flags_t)*8 - MAX_NODES_SHIFT - MAX_ZONES_SHIFT) | 399 | |
402 | #define NODEZONE(node, zone) ((node << ZONES_SHIFT) | zone) | 400 | |
401 | /* | ||
402 | * page->flags layout: | ||
403 | * | ||
404 | * There are three possibilities for how page->flags get | ||
405 | * laid out. The first is for the normal case, without | ||
406 | * sparsemem. The second is for sparsemem when there is | ||
407 | * plenty of space for node and section. The last is when | ||
408 | * we have run out of space and have to fall back to an | ||
409 | * alternate (slower) way of determining the node. | ||
410 | * | ||
411 | * No sparsemem: | NODE | ZONE | ... | FLAGS | | ||
412 | * with space for node: | SECTION | NODE | ZONE | ... | FLAGS | | ||
413 | * no space for node: | SECTION | ZONE | ... | FLAGS | | ||
414 | */ | ||
415 | #ifdef CONFIG_SPARSEMEM | ||
416 | #define SECTIONS_WIDTH SECTIONS_SHIFT | ||
417 | #else | ||
418 | #define SECTIONS_WIDTH 0 | ||
419 | #endif | ||
420 | |||
421 | #define ZONES_WIDTH ZONES_SHIFT | ||
422 | |||
423 | #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED | ||
424 | #define NODES_WIDTH NODES_SHIFT | ||
425 | #else | ||
426 | #define NODES_WIDTH 0 | ||
427 | #endif | ||
428 | |||
429 | /* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */ | ||
430 | #define SECTIONS_PGOFF ((sizeof(page_flags_t)*8) - SECTIONS_WIDTH) | ||
431 | #define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) | ||
432 | #define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) | ||
433 | |||
434 | /* | ||
435 | * We are going to use the flags for the page to node mapping if its in | ||
436 | * there. This includes the case where there is no node, so it is implicit. | ||
437 | */ | ||
438 | #define FLAGS_HAS_NODE (NODES_WIDTH > 0 || NODES_SHIFT == 0) | ||
439 | |||
440 | #ifndef PFN_SECTION_SHIFT | ||
441 | #define PFN_SECTION_SHIFT 0 | ||
442 | #endif | ||
443 | |||
444 | /* | ||
445 | * Define the bit shifts to access each section. For non-existant | ||
446 | * sections we define the shift as 0; that plus a 0 mask ensures | ||
447 | * the compiler will optimise away reference to them. | ||
448 | */ | ||
449 | #define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0)) | ||
450 | #define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) | ||
451 | #define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) | ||
452 | |||
453 | /* NODE:ZONE or SECTION:ZONE is used to lookup the zone from a page. */ | ||
454 | #if FLAGS_HAS_NODE | ||
455 | #define ZONETABLE_SHIFT (NODES_SHIFT + ZONES_SHIFT) | ||
456 | #else | ||
457 | #define ZONETABLE_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT) | ||
458 | #endif | ||
459 | #define ZONETABLE_PGSHIFT ZONES_PGSHIFT | ||
460 | |||
461 | #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED | ||
462 | #error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED | ||
463 | #endif | ||
464 | |||
465 | #define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) | ||
466 | #define NODES_MASK ((1UL << NODES_WIDTH) - 1) | ||
467 | #define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) | ||
468 | #define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) | ||
403 | 469 | ||
404 | static inline unsigned long page_zonenum(struct page *page) | 470 | static inline unsigned long page_zonenum(struct page *page) |
405 | { | 471 | { |
406 | return (page->flags >> NODEZONE_SHIFT) & (~(~0UL << ZONES_SHIFT)); | 472 | return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; |
407 | } | ||
408 | static inline unsigned long page_to_nid(struct page *page) | ||
409 | { | ||
410 | return (page->flags >> (NODEZONE_SHIFT + ZONES_SHIFT)); | ||
411 | } | 473 | } |
412 | 474 | ||
413 | struct zone; | 475 | struct zone; |
@@ -415,13 +477,44 @@ extern struct zone *zone_table[]; | |||
415 | 477 | ||
416 | static inline struct zone *page_zone(struct page *page) | 478 | static inline struct zone *page_zone(struct page *page) |
417 | { | 479 | { |
418 | return zone_table[page->flags >> NODEZONE_SHIFT]; | 480 | return zone_table[(page->flags >> ZONETABLE_PGSHIFT) & |
481 | ZONETABLE_MASK]; | ||
419 | } | 482 | } |
420 | 483 | ||
421 | static inline void set_page_zone(struct page *page, unsigned long nodezone_num) | 484 | static inline unsigned long page_to_nid(struct page *page) |
485 | { | ||
486 | if (FLAGS_HAS_NODE) | ||
487 | return (page->flags >> NODES_PGSHIFT) & NODES_MASK; | ||
488 | else | ||
489 | return page_zone(page)->zone_pgdat->node_id; | ||
490 | } | ||
491 | static inline unsigned long page_to_section(struct page *page) | ||
422 | { | 492 | { |
423 | page->flags &= ~(~0UL << NODEZONE_SHIFT); | 493 | return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; |
424 | page->flags |= nodezone_num << NODEZONE_SHIFT; | 494 | } |
495 | |||
496 | static inline void set_page_zone(struct page *page, unsigned long zone) | ||
497 | { | ||
498 | page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); | ||
499 | page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; | ||
500 | } | ||
501 | static inline void set_page_node(struct page *page, unsigned long node) | ||
502 | { | ||
503 | page->flags &= ~(NODES_MASK << NODES_PGSHIFT); | ||
504 | page->flags |= (node & NODES_MASK) << NODES_PGSHIFT; | ||
505 | } | ||
506 | static inline void set_page_section(struct page *page, unsigned long section) | ||
507 | { | ||
508 | page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); | ||
509 | page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; | ||
510 | } | ||
511 | |||
512 | static inline void set_page_links(struct page *page, unsigned long zone, | ||
513 | unsigned long node, unsigned long pfn) | ||
514 | { | ||
515 | set_page_zone(page, zone); | ||
516 | set_page_node(page, node); | ||
517 | set_page_section(page, pfn_to_section_nr(pfn)); | ||
425 | } | 518 | } |
426 | 519 | ||
427 | #ifndef CONFIG_DISCONTIGMEM | 520 | #ifndef CONFIG_DISCONTIGMEM |
@@ -691,6 +784,12 @@ extern void show_mem(void); | |||
691 | extern void si_meminfo(struct sysinfo * val); | 784 | extern void si_meminfo(struct sysinfo * val); |
692 | extern void si_meminfo_node(struct sysinfo *val, int nid); | 785 | extern void si_meminfo_node(struct sysinfo *val, int nid); |
693 | 786 | ||
787 | #ifdef CONFIG_NUMA | ||
788 | extern void setup_per_cpu_pageset(void); | ||
789 | #else | ||
790 | static inline void setup_per_cpu_pageset(void) {} | ||
791 | #endif | ||
792 | |||
694 | /* prio_tree.c */ | 793 | /* prio_tree.c */ |
695 | void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); | 794 | void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); |
696 | void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); | 795 | void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index e530c6c092f1..6c90461ed99f 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -63,6 +63,12 @@ struct per_cpu_pageset { | |||
63 | #endif | 63 | #endif |
64 | } ____cacheline_aligned_in_smp; | 64 | } ____cacheline_aligned_in_smp; |
65 | 65 | ||
66 | #ifdef CONFIG_NUMA | ||
67 | #define zone_pcp(__z, __cpu) ((__z)->pageset[(__cpu)]) | ||
68 | #else | ||
69 | #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) | ||
70 | #endif | ||
71 | |||
66 | #define ZONE_DMA 0 | 72 | #define ZONE_DMA 0 |
67 | #define ZONE_NORMAL 1 | 73 | #define ZONE_NORMAL 1 |
68 | #define ZONE_HIGHMEM 2 | 74 | #define ZONE_HIGHMEM 2 |
@@ -122,8 +128,11 @@ struct zone { | |||
122 | */ | 128 | */ |
123 | unsigned long lowmem_reserve[MAX_NR_ZONES]; | 129 | unsigned long lowmem_reserve[MAX_NR_ZONES]; |
124 | 130 | ||
131 | #ifdef CONFIG_NUMA | ||
132 | struct per_cpu_pageset *pageset[NR_CPUS]; | ||
133 | #else | ||
125 | struct per_cpu_pageset pageset[NR_CPUS]; | 134 | struct per_cpu_pageset pageset[NR_CPUS]; |
126 | 135 | #endif | |
127 | /* | 136 | /* |
128 | * free areas of different sizes | 137 | * free areas of different sizes |
129 | */ | 138 | */ |
@@ -145,6 +154,14 @@ struct zone { | |||
145 | int all_unreclaimable; /* All pages pinned */ | 154 | int all_unreclaimable; /* All pages pinned */ |
146 | 155 | ||
147 | /* | 156 | /* |
157 | * Does the allocator try to reclaim pages from the zone as soon | ||
158 | * as it fails a watermark_ok() in __alloc_pages? | ||
159 | */ | ||
160 | int reclaim_pages; | ||
161 | /* A count of how many reclaimers are scanning this zone */ | ||
162 | atomic_t reclaim_in_progress; | ||
163 | |||
164 | /* | ||
148 | * prev_priority holds the scanning priority for this zone. It is | 165 | * prev_priority holds the scanning priority for this zone. It is |
149 | * defined as the scanning priority at which we achieved our reclaim | 166 | * defined as the scanning priority at which we achieved our reclaim |
150 | * target at the previous try_to_free_pages() or balance_pgdat() | 167 | * target at the previous try_to_free_pages() or balance_pgdat() |
@@ -252,7 +269,9 @@ typedef struct pglist_data { | |||
252 | struct zone node_zones[MAX_NR_ZONES]; | 269 | struct zone node_zones[MAX_NR_ZONES]; |
253 | struct zonelist node_zonelists[GFP_ZONETYPES]; | 270 | struct zonelist node_zonelists[GFP_ZONETYPES]; |
254 | int nr_zones; | 271 | int nr_zones; |
272 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | ||
255 | struct page *node_mem_map; | 273 | struct page *node_mem_map; |
274 | #endif | ||
256 | struct bootmem_data *bdata; | 275 | struct bootmem_data *bdata; |
257 | unsigned long node_start_pfn; | 276 | unsigned long node_start_pfn; |
258 | unsigned long node_present_pages; /* total number of physical pages */ | 277 | unsigned long node_present_pages; /* total number of physical pages */ |
@@ -267,6 +286,12 @@ typedef struct pglist_data { | |||
267 | 286 | ||
268 | #define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) | 287 | #define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) |
269 | #define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages) | 288 | #define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages) |
289 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | ||
290 | #define pgdat_page_nr(pgdat, pagenr) ((pgdat)->node_mem_map + (pagenr)) | ||
291 | #else | ||
292 | #define pgdat_page_nr(pgdat, pagenr) pfn_to_page((pgdat)->node_start_pfn + (pagenr)) | ||
293 | #endif | ||
294 | #define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr)) | ||
270 | 295 | ||
271 | extern struct pglist_data *pgdat_list; | 296 | extern struct pglist_data *pgdat_list; |
272 | 297 | ||
@@ -381,9 +406,9 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, | |||
381 | 406 | ||
382 | #include <linux/topology.h> | 407 | #include <linux/topology.h> |
383 | /* Returns the number of the current Node. */ | 408 | /* Returns the number of the current Node. */ |
384 | #define numa_node_id() (cpu_to_node(_smp_processor_id())) | 409 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) |
385 | 410 | ||
386 | #ifndef CONFIG_DISCONTIGMEM | 411 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
387 | 412 | ||
388 | extern struct pglist_data contig_page_data; | 413 | extern struct pglist_data contig_page_data; |
389 | #define NODE_DATA(nid) (&contig_page_data) | 414 | #define NODE_DATA(nid) (&contig_page_data) |
@@ -391,36 +416,177 @@ extern struct pglist_data contig_page_data; | |||
391 | #define MAX_NODES_SHIFT 1 | 416 | #define MAX_NODES_SHIFT 1 |
392 | #define pfn_to_nid(pfn) (0) | 417 | #define pfn_to_nid(pfn) (0) |
393 | 418 | ||
394 | #else /* CONFIG_DISCONTIGMEM */ | 419 | #else /* CONFIG_NEED_MULTIPLE_NODES */ |
395 | 420 | ||
396 | #include <asm/mmzone.h> | 421 | #include <asm/mmzone.h> |
397 | 422 | ||
423 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | ||
424 | |||
425 | #ifdef CONFIG_SPARSEMEM | ||
426 | #include <asm/sparsemem.h> | ||
427 | #endif | ||
428 | |||
398 | #if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) | 429 | #if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) |
399 | /* | 430 | /* |
400 | * with 32 bit page->flags field, we reserve 8 bits for node/zone info. | 431 | * with 32 bit page->flags field, we reserve 8 bits for node/zone info. |
401 | * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes. | 432 | * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes. |
402 | */ | 433 | */ |
403 | #define MAX_NODES_SHIFT 6 | 434 | #define FLAGS_RESERVED 8 |
435 | |||
404 | #elif BITS_PER_LONG == 64 | 436 | #elif BITS_PER_LONG == 64 |
405 | /* | 437 | /* |
406 | * with 64 bit flags field, there's plenty of room. | 438 | * with 64 bit flags field, there's plenty of room. |
407 | */ | 439 | */ |
408 | #define MAX_NODES_SHIFT 10 | 440 | #define FLAGS_RESERVED 32 |
441 | |||
442 | #else | ||
443 | |||
444 | #error BITS_PER_LONG not defined | ||
445 | |||
409 | #endif | 446 | #endif |
410 | 447 | ||
411 | #endif /* !CONFIG_DISCONTIGMEM */ | 448 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID |
449 | #define early_pfn_to_nid(nid) (0UL) | ||
450 | #endif | ||
451 | |||
452 | #define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT) | ||
453 | #define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT) | ||
454 | |||
455 | #ifdef CONFIG_SPARSEMEM | ||
456 | |||
457 | /* | ||
458 | * SECTION_SHIFT #bits space required to store a section # | ||
459 | * | ||
460 | * PA_SECTION_SHIFT physical address to/from section number | ||
461 | * PFN_SECTION_SHIFT pfn to/from section number | ||
462 | */ | ||
463 | #define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS) | ||
464 | |||
465 | #define PA_SECTION_SHIFT (SECTION_SIZE_BITS) | ||
466 | #define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT) | ||
467 | |||
468 | #define NR_MEM_SECTIONS (1UL << SECTIONS_SHIFT) | ||
469 | |||
470 | #define PAGES_PER_SECTION (1UL << PFN_SECTION_SHIFT) | ||
471 | #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) | ||
472 | |||
473 | #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS | ||
474 | #error Allocator MAX_ORDER exceeds SECTION_SIZE | ||
475 | #endif | ||
476 | |||
477 | struct page; | ||
478 | struct mem_section { | ||
479 | /* | ||
480 | * This is, logically, a pointer to an array of struct | ||
481 | * pages. However, it is stored with some other magic. | ||
482 | * (see sparse.c::sparse_init_one_section()) | ||
483 | * | ||
484 | * Making it a UL at least makes someone do a cast | ||
485 | * before using it wrong. | ||
486 | */ | ||
487 | unsigned long section_mem_map; | ||
488 | }; | ||
489 | |||
490 | extern struct mem_section mem_section[NR_MEM_SECTIONS]; | ||
491 | |||
492 | static inline struct mem_section *__nr_to_section(unsigned long nr) | ||
493 | { | ||
494 | return &mem_section[nr]; | ||
495 | } | ||
496 | |||
497 | /* | ||
498 | * We use the lower bits of the mem_map pointer to store | ||
499 | * a little bit of information. There should be at least | ||
500 | * 3 bits here due to 32-bit alignment. | ||
501 | */ | ||
502 | #define SECTION_MARKED_PRESENT (1UL<<0) | ||
503 | #define SECTION_HAS_MEM_MAP (1UL<<1) | ||
504 | #define SECTION_MAP_LAST_BIT (1UL<<2) | ||
505 | #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) | ||
506 | |||
507 | static inline struct page *__section_mem_map_addr(struct mem_section *section) | ||
508 | { | ||
509 | unsigned long map = section->section_mem_map; | ||
510 | map &= SECTION_MAP_MASK; | ||
511 | return (struct page *)map; | ||
512 | } | ||
513 | |||
514 | static inline int valid_section(struct mem_section *section) | ||
515 | { | ||
516 | return (section->section_mem_map & SECTION_MARKED_PRESENT); | ||
517 | } | ||
518 | |||
519 | static inline int section_has_mem_map(struct mem_section *section) | ||
520 | { | ||
521 | return (section->section_mem_map & SECTION_HAS_MEM_MAP); | ||
522 | } | ||
523 | |||
524 | static inline int valid_section_nr(unsigned long nr) | ||
525 | { | ||
526 | return valid_section(__nr_to_section(nr)); | ||
527 | } | ||
412 | 528 | ||
413 | #if NODES_SHIFT > MAX_NODES_SHIFT | 529 | /* |
414 | #error NODES_SHIFT > MAX_NODES_SHIFT | 530 | * Given a kernel address, find the home node of the underlying memory. |
531 | */ | ||
532 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) | ||
533 | |||
534 | static inline struct mem_section *__pfn_to_section(unsigned long pfn) | ||
535 | { | ||
536 | return __nr_to_section(pfn_to_section_nr(pfn)); | ||
537 | } | ||
538 | |||
539 | #define pfn_to_page(pfn) \ | ||
540 | ({ \ | ||
541 | unsigned long __pfn = (pfn); \ | ||
542 | __section_mem_map_addr(__pfn_to_section(__pfn)) + __pfn; \ | ||
543 | }) | ||
544 | #define page_to_pfn(page) \ | ||
545 | ({ \ | ||
546 | page - __section_mem_map_addr(__nr_to_section( \ | ||
547 | page_to_section(page))); \ | ||
548 | }) | ||
549 | |||
550 | static inline int pfn_valid(unsigned long pfn) | ||
551 | { | ||
552 | if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) | ||
553 | return 0; | ||
554 | return valid_section(__nr_to_section(pfn_to_section_nr(pfn))); | ||
555 | } | ||
556 | |||
557 | /* | ||
558 | * These are _only_ used during initialisation, therefore they | ||
559 | * can use __initdata ... They could have names to indicate | ||
560 | * this restriction. | ||
561 | */ | ||
562 | #ifdef CONFIG_NUMA | ||
563 | #define pfn_to_nid early_pfn_to_nid | ||
415 | #endif | 564 | #endif |
416 | 565 | ||
417 | /* There are currently 3 zones: DMA, Normal & Highmem, thus we need 2 bits */ | 566 | #define pfn_to_pgdat(pfn) \ |
418 | #define MAX_ZONES_SHIFT 2 | 567 | ({ \ |
568 | NODE_DATA(pfn_to_nid(pfn)); \ | ||
569 | }) | ||
570 | |||
571 | #define early_pfn_valid(pfn) pfn_valid(pfn) | ||
572 | void sparse_init(void); | ||
573 | #else | ||
574 | #define sparse_init() do {} while (0) | ||
575 | #endif /* CONFIG_SPARSEMEM */ | ||
419 | 576 | ||
420 | #if ZONES_SHIFT > MAX_ZONES_SHIFT | 577 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES |
421 | #error ZONES_SHIFT > MAX_ZONES_SHIFT | 578 | #define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid)) |
579 | #else | ||
580 | #define early_pfn_in_nid(pfn, nid) (1) | ||
422 | #endif | 581 | #endif |
423 | 582 | ||
583 | #ifndef early_pfn_valid | ||
584 | #define early_pfn_valid(pfn) (1) | ||
585 | #endif | ||
586 | |||
587 | void memory_present(int nid, unsigned long start, unsigned long end); | ||
588 | unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); | ||
589 | |||
424 | #endif /* !__ASSEMBLY__ */ | 590 | #endif /* !__ASSEMBLY__ */ |
425 | #endif /* __KERNEL__ */ | 591 | #endif /* __KERNEL__ */ |
426 | #endif /* _LINUX_MMZONE_H */ | 592 | #endif /* _LINUX_MMZONE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 0e432a0f4aee..f05372b7fe77 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -51,6 +51,9 @@ struct module_attribute { | |||
51 | ssize_t (*show)(struct module_attribute *, struct module *, char *); | 51 | ssize_t (*show)(struct module_attribute *, struct module *, char *); |
52 | ssize_t (*store)(struct module_attribute *, struct module *, | 52 | ssize_t (*store)(struct module_attribute *, struct module *, |
53 | const char *, size_t count); | 53 | const char *, size_t count); |
54 | void (*setup)(struct module *, const char *); | ||
55 | int (*test)(struct module *); | ||
56 | void (*free)(struct module *); | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | struct module_kobject | 59 | struct module_kobject |
@@ -239,6 +242,8 @@ struct module | |||
239 | /* Sysfs stuff. */ | 242 | /* Sysfs stuff. */ |
240 | struct module_kobject mkobj; | 243 | struct module_kobject mkobj; |
241 | struct module_param_attrs *param_attrs; | 244 | struct module_param_attrs *param_attrs; |
245 | const char *version; | ||
246 | const char *srcversion; | ||
242 | 247 | ||
243 | /* Exported symbols */ | 248 | /* Exported symbols */ |
244 | const struct kernel_symbol *syms; | 249 | const struct kernel_symbol *syms; |
diff --git a/include/linux/namespace.h b/include/linux/namespace.h index 9eca1558d72f..697991b69f9b 100644 --- a/include/linux/namespace.h +++ b/include/linux/namespace.h | |||
@@ -12,7 +12,6 @@ struct namespace { | |||
12 | struct rw_semaphore sem; | 12 | struct rw_semaphore sem; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | extern void umount_tree(struct vfsmount *); | ||
16 | extern int copy_namespace(int, struct task_struct *); | 15 | extern int copy_namespace(int, struct task_struct *); |
17 | extern void __put_namespace(struct namespace *namespace); | 16 | extern void __put_namespace(struct namespace *namespace); |
18 | 17 | ||
diff --git a/include/linux/net.h b/include/linux/net.h index 6d997ff3f103..20cb226b2268 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -101,7 +101,6 @@ enum sock_type { | |||
101 | * @sk: internal networking protocol agnostic socket representation | 101 | * @sk: internal networking protocol agnostic socket representation |
102 | * @wait: wait queue for several uses | 102 | * @wait: wait queue for several uses |
103 | * @type: socket type (%SOCK_STREAM, etc) | 103 | * @type: socket type (%SOCK_STREAM, etc) |
104 | * @passcred: credentials (used only in Unix Sockets (aka PF_LOCAL)) | ||
105 | */ | 104 | */ |
106 | struct socket { | 105 | struct socket { |
107 | socket_state state; | 106 | socket_state state; |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ac11d73be4ce..3a0ed7f9e801 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -41,7 +41,7 @@ | |||
41 | struct divert_blk; | 41 | struct divert_blk; |
42 | struct vlan_group; | 42 | struct vlan_group; |
43 | struct ethtool_ops; | 43 | struct ethtool_ops; |
44 | struct netpoll; | 44 | struct netpoll_info; |
45 | /* source back-compat hooks */ | 45 | /* source back-compat hooks */ |
46 | #define SET_ETHTOOL_OPS(netdev,ops) \ | 46 | #define SET_ETHTOOL_OPS(netdev,ops) \ |
47 | ( (netdev)->ethtool_ops = (ops) ) | 47 | ( (netdev)->ethtool_ops = (ops) ) |
@@ -164,12 +164,6 @@ struct netif_rx_stats | |||
164 | unsigned total; | 164 | unsigned total; |
165 | unsigned dropped; | 165 | unsigned dropped; |
166 | unsigned time_squeeze; | 166 | unsigned time_squeeze; |
167 | unsigned throttled; | ||
168 | unsigned fastroute_hit; | ||
169 | unsigned fastroute_success; | ||
170 | unsigned fastroute_defer; | ||
171 | unsigned fastroute_deferred_out; | ||
172 | unsigned fastroute_latency_reduction; | ||
173 | unsigned cpu_collision; | 167 | unsigned cpu_collision; |
174 | }; | 168 | }; |
175 | 169 | ||
@@ -204,7 +198,7 @@ struct hh_cache | |||
204 | /* cached hardware header; allow for machine alignment needs. */ | 198 | /* cached hardware header; allow for machine alignment needs. */ |
205 | #define HH_DATA_MOD 16 | 199 | #define HH_DATA_MOD 16 |
206 | #define HH_DATA_OFF(__len) \ | 200 | #define HH_DATA_OFF(__len) \ |
207 | (HH_DATA_MOD - ((__len) & (HH_DATA_MOD - 1))) | 201 | (HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1)) |
208 | #define HH_DATA_ALIGN(__len) \ | 202 | #define HH_DATA_ALIGN(__len) \ |
209 | (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1)) | 203 | (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1)) |
210 | unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; | 204 | unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; |
@@ -401,7 +395,7 @@ struct net_device | |||
401 | } reg_state; | 395 | } reg_state; |
402 | 396 | ||
403 | /* Net device features */ | 397 | /* Net device features */ |
404 | int features; | 398 | unsigned long features; |
405 | #define NETIF_F_SG 1 /* Scatter/gather IO. */ | 399 | #define NETIF_F_SG 1 /* Scatter/gather IO. */ |
406 | #define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ | 400 | #define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ |
407 | #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ | 401 | #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ |
@@ -468,7 +462,7 @@ struct net_device | |||
468 | unsigned char *haddr); | 462 | unsigned char *haddr); |
469 | int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); | 463 | int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); |
470 | #ifdef CONFIG_NETPOLL | 464 | #ifdef CONFIG_NETPOLL |
471 | struct netpoll *np; | 465 | struct netpoll_info *npinfo; |
472 | #endif | 466 | #endif |
473 | #ifdef CONFIG_NET_POLL_CONTROLLER | 467 | #ifdef CONFIG_NET_POLL_CONTROLLER |
474 | void (*poll_controller)(struct net_device *dev); | 468 | void (*poll_controller)(struct net_device *dev); |
@@ -503,7 +497,7 @@ static inline void *netdev_priv(struct net_device *dev) | |||
503 | #define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) | 497 | #define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) |
504 | 498 | ||
505 | struct packet_type { | 499 | struct packet_type { |
506 | unsigned short type; /* This is really htons(ether_type). */ | 500 | __be16 type; /* This is really htons(ether_type). */ |
507 | struct net_device *dev; /* NULL is wildcarded here */ | 501 | struct net_device *dev; /* NULL is wildcarded here */ |
508 | int (*func) (struct sk_buff *, struct net_device *, | 502 | int (*func) (struct sk_buff *, struct net_device *, |
509 | struct packet_type *); | 503 | struct packet_type *); |
@@ -562,12 +556,9 @@ static inline int unregister_gifconf(unsigned int family) | |||
562 | 556 | ||
563 | struct softnet_data | 557 | struct softnet_data |
564 | { | 558 | { |
565 | int throttle; | 559 | struct net_device *output_queue; |
566 | int cng_level; | ||
567 | int avg_blog; | ||
568 | struct sk_buff_head input_pkt_queue; | 560 | struct sk_buff_head input_pkt_queue; |
569 | struct list_head poll_list; | 561 | struct list_head poll_list; |
570 | struct net_device *output_queue; | ||
571 | struct sk_buff *completion_queue; | 562 | struct sk_buff *completion_queue; |
572 | 563 | ||
573 | struct net_device backlog_dev; /* Sorry. 8) */ | 564 | struct net_device backlog_dev; /* Sorry. 8) */ |
@@ -913,6 +904,7 @@ extern void dev_mc_discard(struct net_device *dev); | |||
913 | extern void dev_set_promiscuity(struct net_device *dev, int inc); | 904 | extern void dev_set_promiscuity(struct net_device *dev, int inc); |
914 | extern void dev_set_allmulti(struct net_device *dev, int inc); | 905 | extern void dev_set_allmulti(struct net_device *dev, int inc); |
915 | extern void netdev_state_change(struct net_device *dev); | 906 | extern void netdev_state_change(struct net_device *dev); |
907 | extern void netdev_features_change(struct net_device *dev); | ||
916 | /* Load a device via the kmod */ | 908 | /* Load a device via the kmod */ |
917 | extern void dev_load(const char *name); | 909 | extern void dev_load(const char *name); |
918 | extern void dev_mcast_init(void); | 910 | extern void dev_mcast_init(void); |
@@ -924,10 +916,6 @@ extern int skb_checksum_help(struct sk_buff *skb, int inward); | |||
924 | extern void net_enable_timestamp(void); | 916 | extern void net_enable_timestamp(void); |
925 | extern void net_disable_timestamp(void); | 917 | extern void net_disable_timestamp(void); |
926 | 918 | ||
927 | #ifdef CONFIG_SYSCTL | ||
928 | extern char *net_sysctl_strdup(const char *s); | ||
929 | #endif | ||
930 | |||
931 | #endif /* __KERNEL__ */ | 919 | #endif /* __KERNEL__ */ |
932 | 920 | ||
933 | #endif /* _LINUX_DEV_H */ | 921 | #endif /* _LINUX_DEV_H */ |
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index 9e5750079e09..3ebc36afae1a 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h | |||
@@ -75,12 +75,6 @@ enum nf_ip_hook_priorities { | |||
75 | #define SO_ORIGINAL_DST 80 | 75 | #define SO_ORIGINAL_DST 80 |
76 | 76 | ||
77 | #ifdef __KERNEL__ | 77 | #ifdef __KERNEL__ |
78 | #ifdef CONFIG_NETFILTER_DEBUG | ||
79 | void nf_debug_ip_local_deliver(struct sk_buff *skb); | ||
80 | void nf_debug_ip_loopback_xmit(struct sk_buff *newskb); | ||
81 | void nf_debug_ip_finish_output2(struct sk_buff *skb); | ||
82 | #endif /*CONFIG_NETFILTER_DEBUG*/ | ||
83 | |||
84 | extern int ip_route_me_harder(struct sk_buff **pskb); | 78 | extern int ip_route_me_harder(struct sk_buff **pskb); |
85 | 79 | ||
86 | /* Call this before modifying an existing IP packet: ensures it is | 80 | /* Call this before modifying an existing IP packet: ensures it is |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h index d84be02cb4fc..694aec9b4784 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_core.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _IP_CONNTRACK_CORE_H | 1 | #ifndef _IP_CONNTRACK_CORE_H |
2 | #define _IP_CONNTRACK_CORE_H | 2 | #define _IP_CONNTRACK_CORE_H |
3 | #include <linux/netfilter.h> | 3 | #include <linux/netfilter.h> |
4 | #include <linux/netfilter_ipv4/lockhelp.h> | ||
5 | 4 | ||
6 | /* This header is used to share core functionality between the | 5 | /* This header is used to share core functionality between the |
7 | standalone connection tracking module, and the compatibility layer's use | 6 | standalone connection tracking module, and the compatibility layer's use |
@@ -47,6 +46,6 @@ static inline int ip_conntrack_confirm(struct sk_buff **pskb) | |||
47 | 46 | ||
48 | extern struct list_head *ip_conntrack_hash; | 47 | extern struct list_head *ip_conntrack_hash; |
49 | extern struct list_head ip_conntrack_expect_list; | 48 | extern struct list_head ip_conntrack_expect_list; |
50 | DECLARE_RWLOCK_EXTERN(ip_conntrack_lock); | 49 | extern rwlock_t ip_conntrack_lock; |
51 | #endif /* _IP_CONNTRACK_CORE_H */ | 50 | #endif /* _IP_CONNTRACK_CORE_H */ |
52 | 51 | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h index 2b72b86176f0..e201ec6e9905 100644 --- a/include/linux/netfilter_ipv4/ip_nat.h +++ b/include/linux/netfilter_ipv4/ip_nat.h | |||
@@ -50,10 +50,9 @@ struct ip_nat_multi_range_compat | |||
50 | 50 | ||
51 | #ifdef __KERNEL__ | 51 | #ifdef __KERNEL__ |
52 | #include <linux/list.h> | 52 | #include <linux/list.h> |
53 | #include <linux/netfilter_ipv4/lockhelp.h> | ||
54 | 53 | ||
55 | /* Protects NAT hash tables, and NAT-private part of conntracks. */ | 54 | /* Protects NAT hash tables, and NAT-private part of conntracks. */ |
56 | DECLARE_RWLOCK_EXTERN(ip_nat_lock); | 55 | extern rwlock_t ip_nat_lock; |
57 | 56 | ||
58 | /* The structure embedded in the conntrack structure. */ | 57 | /* The structure embedded in the conntrack structure. */ |
59 | struct ip_nat_info | 58 | struct ip_nat_info |
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h index baa83e757156..d9bceedfb3dc 100644 --- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h +++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h | |||
@@ -18,7 +18,6 @@ struct clusterip_config; | |||
18 | struct ipt_clusterip_tgt_info { | 18 | struct ipt_clusterip_tgt_info { |
19 | 19 | ||
20 | u_int32_t flags; | 20 | u_int32_t flags; |
21 | struct clusterip_config *config; | ||
22 | 21 | ||
23 | /* only relevant for new ones */ | 22 | /* only relevant for new ones */ |
24 | u_int8_t clustermac[6]; | 23 | u_int8_t clustermac[6]; |
@@ -27,6 +26,8 @@ struct ipt_clusterip_tgt_info { | |||
27 | u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; | 26 | u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; |
28 | enum clusterip_hashmode hash_mode; | 27 | enum clusterip_hashmode hash_mode; |
29 | u_int32_t hash_initval; | 28 | u_int32_t hash_initval; |
29 | |||
30 | struct clusterip_config *config; | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | #endif /*_IPT_CLUSTERIP_H_target*/ | 33 | #endif /*_IPT_CLUSTERIP_H_target*/ |
diff --git a/include/linux/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h index f2ae7c5e57bb..360429f48737 100644 --- a/include/linux/netfilter_ipv4/listhelp.h +++ b/include/linux/netfilter_ipv4/listhelp.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _LISTHELP_H | 2 | #define _LISTHELP_H |
3 | #include <linux/config.h> | 3 | #include <linux/config.h> |
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/netfilter_ipv4/lockhelp.h> | ||
6 | 5 | ||
7 | /* Header to do more comprehensive job than linux/list.h; assume list | 6 | /* Header to do more comprehensive job than linux/list.h; assume list |
8 | is first entry in structure. */ | 7 | is first entry in structure. */ |
diff --git a/include/linux/netfilter_ipv4/lockhelp.h b/include/linux/netfilter_ipv4/lockhelp.h deleted file mode 100644 index a3288633ab46..000000000000 --- a/include/linux/netfilter_ipv4/lockhelp.h +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | #ifndef _LOCKHELP_H | ||
2 | #define _LOCKHELP_H | ||
3 | #include <linux/config.h> | ||
4 | |||
5 | #include <linux/spinlock.h> | ||
6 | #include <asm/atomic.h> | ||
7 | #include <linux/interrupt.h> | ||
8 | #include <linux/smp.h> | ||
9 | |||
10 | /* Header to do help in lock debugging. */ | ||
11 | |||
12 | #ifdef CONFIG_NETFILTER_DEBUG | ||
13 | struct spinlock_debug | ||
14 | { | ||
15 | spinlock_t l; | ||
16 | atomic_t locked_by; | ||
17 | }; | ||
18 | |||
19 | struct rwlock_debug | ||
20 | { | ||
21 | rwlock_t l; | ||
22 | long read_locked_map; | ||
23 | long write_locked_map; | ||
24 | }; | ||
25 | |||
26 | #define DECLARE_LOCK(l) \ | ||
27 | struct spinlock_debug l = { SPIN_LOCK_UNLOCKED, ATOMIC_INIT(-1) } | ||
28 | #define DECLARE_LOCK_EXTERN(l) \ | ||
29 | extern struct spinlock_debug l | ||
30 | #define DECLARE_RWLOCK(l) \ | ||
31 | struct rwlock_debug l = { RW_LOCK_UNLOCKED, 0, 0 } | ||
32 | #define DECLARE_RWLOCK_EXTERN(l) \ | ||
33 | extern struct rwlock_debug l | ||
34 | |||
35 | #define MUST_BE_LOCKED(l) \ | ||
36 | do { if (atomic_read(&(l)->locked_by) != smp_processor_id()) \ | ||
37 | printk("ASSERT %s:%u %s unlocked\n", __FILE__, __LINE__, #l); \ | ||
38 | } while(0) | ||
39 | |||
40 | #define MUST_BE_UNLOCKED(l) \ | ||
41 | do { if (atomic_read(&(l)->locked_by) == smp_processor_id()) \ | ||
42 | printk("ASSERT %s:%u %s locked\n", __FILE__, __LINE__, #l); \ | ||
43 | } while(0) | ||
44 | |||
45 | /* Write locked OK as well. */ | ||
46 | #define MUST_BE_READ_LOCKED(l) \ | ||
47 | do { if (!((l)->read_locked_map & (1UL << smp_processor_id())) \ | ||
48 | && !((l)->write_locked_map & (1UL << smp_processor_id()))) \ | ||
49 | printk("ASSERT %s:%u %s not readlocked\n", __FILE__, __LINE__, #l); \ | ||
50 | } while(0) | ||
51 | |||
52 | #define MUST_BE_WRITE_LOCKED(l) \ | ||
53 | do { if (!((l)->write_locked_map & (1UL << smp_processor_id()))) \ | ||
54 | printk("ASSERT %s:%u %s not writelocked\n", __FILE__, __LINE__, #l); \ | ||
55 | } while(0) | ||
56 | |||
57 | #define MUST_BE_READ_WRITE_UNLOCKED(l) \ | ||
58 | do { if ((l)->read_locked_map & (1UL << smp_processor_id())) \ | ||
59 | printk("ASSERT %s:%u %s readlocked\n", __FILE__, __LINE__, #l); \ | ||
60 | else if ((l)->write_locked_map & (1UL << smp_processor_id())) \ | ||
61 | printk("ASSERT %s:%u %s writelocked\n", __FILE__, __LINE__, #l); \ | ||
62 | } while(0) | ||
63 | |||
64 | #define LOCK_BH(lk) \ | ||
65 | do { \ | ||
66 | MUST_BE_UNLOCKED(lk); \ | ||
67 | spin_lock_bh(&(lk)->l); \ | ||
68 | atomic_set(&(lk)->locked_by, smp_processor_id()); \ | ||
69 | } while(0) | ||
70 | |||
71 | #define UNLOCK_BH(lk) \ | ||
72 | do { \ | ||
73 | MUST_BE_LOCKED(lk); \ | ||
74 | atomic_set(&(lk)->locked_by, -1); \ | ||
75 | spin_unlock_bh(&(lk)->l); \ | ||
76 | } while(0) | ||
77 | |||
78 | #define READ_LOCK(lk) \ | ||
79 | do { \ | ||
80 | MUST_BE_READ_WRITE_UNLOCKED(lk); \ | ||
81 | read_lock_bh(&(lk)->l); \ | ||
82 | set_bit(smp_processor_id(), &(lk)->read_locked_map); \ | ||
83 | } while(0) | ||
84 | |||
85 | #define WRITE_LOCK(lk) \ | ||
86 | do { \ | ||
87 | MUST_BE_READ_WRITE_UNLOCKED(lk); \ | ||
88 | write_lock_bh(&(lk)->l); \ | ||
89 | set_bit(smp_processor_id(), &(lk)->write_locked_map); \ | ||
90 | } while(0) | ||
91 | |||
92 | #define READ_UNLOCK(lk) \ | ||
93 | do { \ | ||
94 | if (!((lk)->read_locked_map & (1UL << smp_processor_id()))) \ | ||
95 | printk("ASSERT: %s:%u %s not readlocked\n", \ | ||
96 | __FILE__, __LINE__, #lk); \ | ||
97 | clear_bit(smp_processor_id(), &(lk)->read_locked_map); \ | ||
98 | read_unlock_bh(&(lk)->l); \ | ||
99 | } while(0) | ||
100 | |||
101 | #define WRITE_UNLOCK(lk) \ | ||
102 | do { \ | ||
103 | MUST_BE_WRITE_LOCKED(lk); \ | ||
104 | clear_bit(smp_processor_id(), &(lk)->write_locked_map); \ | ||
105 | write_unlock_bh(&(lk)->l); \ | ||
106 | } while(0) | ||
107 | |||
108 | #else | ||
109 | #define DECLARE_LOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED | ||
110 | #define DECLARE_LOCK_EXTERN(l) extern spinlock_t l | ||
111 | #define DECLARE_RWLOCK(l) rwlock_t l = RW_LOCK_UNLOCKED | ||
112 | #define DECLARE_RWLOCK_EXTERN(l) extern rwlock_t l | ||
113 | |||
114 | #define MUST_BE_LOCKED(l) | ||
115 | #define MUST_BE_UNLOCKED(l) | ||
116 | #define MUST_BE_READ_LOCKED(l) | ||
117 | #define MUST_BE_WRITE_LOCKED(l) | ||
118 | #define MUST_BE_READ_WRITE_UNLOCKED(l) | ||
119 | |||
120 | #define LOCK_BH(l) spin_lock_bh(l) | ||
121 | #define UNLOCK_BH(l) spin_unlock_bh(l) | ||
122 | |||
123 | #define READ_LOCK(l) read_lock_bh(l) | ||
124 | #define WRITE_LOCK(l) write_lock_bh(l) | ||
125 | #define READ_UNLOCK(l) read_unlock_bh(l) | ||
126 | #define WRITE_UNLOCK(l) write_unlock_bh(l) | ||
127 | #endif /*CONFIG_NETFILTER_DEBUG*/ | ||
128 | |||
129 | #endif /* _LOCKHELP_H */ | ||
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index b2738ac8bc99..3029cad63a01 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #define NETLINK_SELINUX 7 /* SELinux event notifications */ | 14 | #define NETLINK_SELINUX 7 /* SELinux event notifications */ |
15 | #define NETLINK_ARPD 8 | 15 | #define NETLINK_ARPD 8 |
16 | #define NETLINK_AUDIT 9 /* auditing */ | 16 | #define NETLINK_AUDIT 9 /* auditing */ |
17 | #define NETLINK_FIB_LOOKUP 10 | ||
17 | #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ | 18 | #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ |
18 | #define NETLINK_IP6_FW 13 | 19 | #define NETLINK_IP6_FW 13 |
19 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ | 20 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ |
@@ -146,7 +147,7 @@ struct netlink_callback | |||
146 | int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); | 147 | int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); |
147 | int (*done)(struct netlink_callback *cb); | 148 | int (*done)(struct netlink_callback *cb); |
148 | int family; | 149 | int family; |
149 | long args[4]; | 150 | long args[5]; |
150 | }; | 151 | }; |
151 | 152 | ||
152 | struct netlink_notify | 153 | struct netlink_notify |
@@ -156,7 +157,7 @@ struct netlink_notify | |||
156 | }; | 157 | }; |
157 | 158 | ||
158 | static __inline__ struct nlmsghdr * | 159 | static __inline__ struct nlmsghdr * |
159 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) | 160 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) |
160 | { | 161 | { |
161 | struct nlmsghdr *nlh; | 162 | struct nlmsghdr *nlh; |
162 | int size = NLMSG_LENGTH(len); | 163 | int size = NLMSG_LENGTH(len); |
@@ -164,15 +165,31 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) | |||
164 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); | 165 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); |
165 | nlh->nlmsg_type = type; | 166 | nlh->nlmsg_type = type; |
166 | nlh->nlmsg_len = size; | 167 | nlh->nlmsg_len = size; |
167 | nlh->nlmsg_flags = 0; | 168 | nlh->nlmsg_flags = flags; |
168 | nlh->nlmsg_pid = pid; | 169 | nlh->nlmsg_pid = pid; |
169 | nlh->nlmsg_seq = seq; | 170 | nlh->nlmsg_seq = seq; |
170 | return nlh; | 171 | return nlh; |
171 | } | 172 | } |
172 | 173 | ||
174 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ | ||
175 | ({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \ | ||
176 | goto nlmsg_failure; \ | ||
177 | __nlmsg_put(skb, pid, seq, type, len, flags); }) | ||
178 | |||
173 | #define NLMSG_PUT(skb, pid, seq, type, len) \ | 179 | #define NLMSG_PUT(skb, pid, seq, type, len) \ |
174 | ({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) goto nlmsg_failure; \ | 180 | NLMSG_NEW(skb, pid, seq, type, len, 0) |
175 | __nlmsg_put(skb, pid, seq, type, len); }) | 181 | |
182 | #define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \ | ||
183 | NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \ | ||
184 | (cb)->nlh->nlmsg_seq, type, len, flags) | ||
185 | |||
186 | #define NLMSG_END(skb, nlh) \ | ||
187 | ({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \ | ||
188 | (skb)->len; }) | ||
189 | |||
190 | #define NLMSG_CANCEL(skb, nlh) \ | ||
191 | ({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \ | ||
192 | -1; }) | ||
176 | 193 | ||
177 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | 194 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
178 | struct nlmsghdr *nlh, | 195 | struct nlmsghdr *nlh, |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index c0d8b90c5202..bcd0ac33f592 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -16,14 +16,19 @@ struct netpoll; | |||
16 | struct netpoll { | 16 | struct netpoll { |
17 | struct net_device *dev; | 17 | struct net_device *dev; |
18 | char dev_name[16], *name; | 18 | char dev_name[16], *name; |
19 | int rx_flags; | ||
20 | void (*rx_hook)(struct netpoll *, int, char *, int); | 19 | void (*rx_hook)(struct netpoll *, int, char *, int); |
21 | void (*drop)(struct sk_buff *skb); | 20 | void (*drop)(struct sk_buff *skb); |
22 | u32 local_ip, remote_ip; | 21 | u32 local_ip, remote_ip; |
23 | u16 local_port, remote_port; | 22 | u16 local_port, remote_port; |
24 | unsigned char local_mac[6], remote_mac[6]; | 23 | unsigned char local_mac[6], remote_mac[6]; |
24 | }; | ||
25 | |||
26 | struct netpoll_info { | ||
25 | spinlock_t poll_lock; | 27 | spinlock_t poll_lock; |
26 | int poll_owner; | 28 | int poll_owner; |
29 | int rx_flags; | ||
30 | spinlock_t rx_lock; | ||
31 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ | ||
27 | }; | 32 | }; |
28 | 33 | ||
29 | void netpoll_poll(struct netpoll *np); | 34 | void netpoll_poll(struct netpoll *np); |
@@ -39,22 +44,35 @@ void netpoll_queue(struct sk_buff *skb); | |||
39 | #ifdef CONFIG_NETPOLL | 44 | #ifdef CONFIG_NETPOLL |
40 | static inline int netpoll_rx(struct sk_buff *skb) | 45 | static inline int netpoll_rx(struct sk_buff *skb) |
41 | { | 46 | { |
42 | return skb->dev->np && skb->dev->np->rx_flags && __netpoll_rx(skb); | 47 | struct netpoll_info *npinfo = skb->dev->npinfo; |
48 | unsigned long flags; | ||
49 | int ret = 0; | ||
50 | |||
51 | if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) | ||
52 | return 0; | ||
53 | |||
54 | spin_lock_irqsave(&npinfo->rx_lock, flags); | ||
55 | /* check rx_flags again with the lock held */ | ||
56 | if (npinfo->rx_flags && __netpoll_rx(skb)) | ||
57 | ret = 1; | ||
58 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); | ||
59 | |||
60 | return ret; | ||
43 | } | 61 | } |
44 | 62 | ||
45 | static inline void netpoll_poll_lock(struct net_device *dev) | 63 | static inline void netpoll_poll_lock(struct net_device *dev) |
46 | { | 64 | { |
47 | if (dev->np) { | 65 | if (dev->npinfo) { |
48 | spin_lock(&dev->np->poll_lock); | 66 | spin_lock(&dev->npinfo->poll_lock); |
49 | dev->np->poll_owner = smp_processor_id(); | 67 | dev->npinfo->poll_owner = smp_processor_id(); |
50 | } | 68 | } |
51 | } | 69 | } |
52 | 70 | ||
53 | static inline void netpoll_poll_unlock(struct net_device *dev) | 71 | static inline void netpoll_poll_unlock(struct net_device *dev) |
54 | { | 72 | { |
55 | if (dev->np) { | 73 | if (dev->npinfo) { |
56 | spin_unlock(&dev->np->poll_lock); | 74 | dev->npinfo->poll_owner = -1; |
57 | dev->np->poll_owner = -1; | 75 | spin_unlock(&dev->npinfo->poll_lock); |
58 | } | 76 | } |
59 | } | 77 | } |
60 | 78 | ||
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 5ca8a8d8ccdf..0c1c306cdaec 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #define NFS4_ACCESS_DELETE 0x0010 | 28 | #define NFS4_ACCESS_DELETE 0x0010 |
29 | #define NFS4_ACCESS_EXECUTE 0x0020 | 29 | #define NFS4_ACCESS_EXECUTE 0x0020 |
30 | 30 | ||
31 | #define NFS4_FH_PERISTENT 0x0000 | 31 | #define NFS4_FH_PERSISTENT 0x0000 |
32 | #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 | 32 | #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 |
33 | #define NFS4_FH_VOLATILE_ANY 0x0002 | 33 | #define NFS4_FH_VOLATILE_ANY 0x0002 |
34 | #define NFS4_FH_VOL_MIGRATION 0x0004 | 34 | #define NFS4_FH_VOL_MIGRATION 0x0004 |
@@ -382,6 +382,8 @@ enum { | |||
382 | NFSPROC4_CLNT_READDIR, | 382 | NFSPROC4_CLNT_READDIR, |
383 | NFSPROC4_CLNT_SERVER_CAPS, | 383 | NFSPROC4_CLNT_SERVER_CAPS, |
384 | NFSPROC4_CLNT_DELEGRETURN, | 384 | NFSPROC4_CLNT_DELEGRETURN, |
385 | NFSPROC4_CLNT_GETACL, | ||
386 | NFSPROC4_CLNT_SETACL, | ||
385 | }; | 387 | }; |
386 | 388 | ||
387 | #endif | 389 | #endif |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index dbac7f363e5d..8ea249110fb0 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | #include <linux/rwsem.h> | 16 | #include <linux/rwsem.h> |
17 | #include <linux/wait.h> | 17 | #include <linux/wait.h> |
18 | #include <linux/uio.h> | ||
19 | 18 | ||
20 | #include <linux/nfs_fs_sb.h> | 19 | #include <linux/nfs_fs_sb.h> |
21 | 20 | ||
@@ -29,7 +28,6 @@ | |||
29 | #include <linux/nfs4.h> | 28 | #include <linux/nfs4.h> |
30 | #include <linux/nfs_xdr.h> | 29 | #include <linux/nfs_xdr.h> |
31 | #include <linux/rwsem.h> | 30 | #include <linux/rwsem.h> |
32 | #include <linux/workqueue.h> | ||
33 | #include <linux/mempool.h> | 31 | #include <linux/mempool.h> |
34 | 32 | ||
35 | /* | 33 | /* |
@@ -44,13 +42,6 @@ | |||
44 | #define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 | 42 | #define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 |
45 | 43 | ||
46 | /* | 44 | /* |
47 | * The upper limit on timeouts for the exponential backoff algorithm. | ||
48 | */ | ||
49 | #define NFS_WRITEBACK_DELAY (5*HZ) | ||
50 | #define NFS_WRITEBACK_LOCKDELAY (60*HZ) | ||
51 | #define NFS_COMMIT_DELAY (5*HZ) | ||
52 | |||
53 | /* | ||
54 | * superblock magic number for NFS | 45 | * superblock magic number for NFS |
55 | */ | 46 | */ |
56 | #define NFS_SUPER_MAGIC 0x6969 | 47 | #define NFS_SUPER_MAGIC 0x6969 |
@@ -60,9 +51,6 @@ | |||
60 | */ | 51 | */ |
61 | #define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) | 52 | #define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) |
62 | 53 | ||
63 | #define NFS_RW_SYNC 0x0001 /* O_SYNC handling */ | ||
64 | #define NFS_RW_SWAP 0x0002 /* This is a swap request */ | ||
65 | |||
66 | /* | 54 | /* |
67 | * When flushing a cluster of dirty pages, there can be different | 55 | * When flushing a cluster of dirty pages, there can be different |
68 | * strategies: | 56 | * strategies: |
@@ -96,7 +84,8 @@ struct nfs_open_context { | |||
96 | int error; | 84 | int error; |
97 | 85 | ||
98 | struct list_head list; | 86 | struct list_head list; |
99 | wait_queue_head_t waitq; | 87 | |
88 | __u64 dir_cookie; | ||
100 | }; | 89 | }; |
101 | 90 | ||
102 | /* | 91 | /* |
@@ -104,6 +93,8 @@ struct nfs_open_context { | |||
104 | */ | 93 | */ |
105 | struct nfs_delegation; | 94 | struct nfs_delegation; |
106 | 95 | ||
96 | struct posix_acl; | ||
97 | |||
107 | /* | 98 | /* |
108 | * nfs fs inode data in memory | 99 | * nfs fs inode data in memory |
109 | */ | 100 | */ |
@@ -140,7 +131,6 @@ struct nfs_inode { | |||
140 | * | 131 | * |
141 | * mtime != read_cache_mtime | 132 | * mtime != read_cache_mtime |
142 | */ | 133 | */ |
143 | unsigned long readdir_timestamp; | ||
144 | unsigned long read_cache_jiffies; | 134 | unsigned long read_cache_jiffies; |
145 | unsigned long attrtimeo; | 135 | unsigned long attrtimeo; |
146 | unsigned long attrtimeo_timestamp; | 136 | unsigned long attrtimeo_timestamp; |
@@ -158,6 +148,10 @@ struct nfs_inode { | |||
158 | atomic_t data_updates; | 148 | atomic_t data_updates; |
159 | 149 | ||
160 | struct nfs_access_entry cache_access; | 150 | struct nfs_access_entry cache_access; |
151 | #ifdef CONFIG_NFS_V3_ACL | ||
152 | struct posix_acl *acl_access; | ||
153 | struct posix_acl *acl_default; | ||
154 | #endif | ||
161 | 155 | ||
162 | /* | 156 | /* |
163 | * This is the cookie verifier used for NFSv3 readdir | 157 | * This is the cookie verifier used for NFSv3 readdir |
@@ -183,13 +177,13 @@ struct nfs_inode { | |||
183 | wait_queue_head_t nfs_i_wait; | 177 | wait_queue_head_t nfs_i_wait; |
184 | 178 | ||
185 | #ifdef CONFIG_NFS_V4 | 179 | #ifdef CONFIG_NFS_V4 |
180 | struct nfs4_cached_acl *nfs4_acl; | ||
186 | /* NFSv4 state */ | 181 | /* NFSv4 state */ |
187 | struct list_head open_states; | 182 | struct list_head open_states; |
188 | struct nfs_delegation *delegation; | 183 | struct nfs_delegation *delegation; |
189 | int delegation_state; | 184 | int delegation_state; |
190 | struct rw_semaphore rwsem; | 185 | struct rw_semaphore rwsem; |
191 | #endif /* CONFIG_NFS_V4*/ | 186 | #endif /* CONFIG_NFS_V4*/ |
192 | |||
193 | struct inode vfs_inode; | 187 | struct inode vfs_inode; |
194 | }; | 188 | }; |
195 | 189 | ||
@@ -203,6 +197,8 @@ struct nfs_inode { | |||
203 | #define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */ | 197 | #define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */ |
204 | #define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */ | 198 | #define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */ |
205 | #define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */ | 199 | #define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */ |
200 | #define NFS_INO_INVALID_ACL 0x0080 /* cached acls are invalid */ | ||
201 | #define NFS_INO_REVAL_PAGECACHE 0x1000 /* must revalidate pagecache */ | ||
206 | 202 | ||
207 | static inline struct nfs_inode *NFS_I(struct inode *inode) | 203 | static inline struct nfs_inode *NFS_I(struct inode *inode) |
208 | { | 204 | { |
@@ -294,12 +290,12 @@ extern int nfs_release(struct inode *, struct file *); | |||
294 | extern int nfs_attribute_timeout(struct inode *inode); | 290 | extern int nfs_attribute_timeout(struct inode *inode); |
295 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); | 291 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); |
296 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); | 292 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); |
293 | extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); | ||
297 | extern int nfs_setattr(struct dentry *, struct iattr *); | 294 | extern int nfs_setattr(struct dentry *, struct iattr *); |
298 | extern void nfs_begin_attr_update(struct inode *); | 295 | extern void nfs_begin_attr_update(struct inode *); |
299 | extern void nfs_end_attr_update(struct inode *); | 296 | extern void nfs_end_attr_update(struct inode *); |
300 | extern void nfs_begin_data_update(struct inode *); | 297 | extern void nfs_begin_data_update(struct inode *); |
301 | extern void nfs_end_data_update(struct inode *); | 298 | extern void nfs_end_data_update(struct inode *); |
302 | extern void nfs_end_data_update_defer(struct inode *); | ||
303 | extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred); | 299 | extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred); |
304 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 300 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
305 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 301 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
@@ -314,6 +310,9 @@ extern u32 root_nfs_parse_addr(char *name); /*__init*/ | |||
314 | * linux/fs/nfs/file.c | 310 | * linux/fs/nfs/file.c |
315 | */ | 311 | */ |
316 | extern struct inode_operations nfs_file_inode_operations; | 312 | extern struct inode_operations nfs_file_inode_operations; |
313 | #ifdef CONFIG_NFS_V3 | ||
314 | extern struct inode_operations nfs3_file_inode_operations; | ||
315 | #endif /* CONFIG_NFS_V3 */ | ||
317 | extern struct file_operations nfs_file_operations; | 316 | extern struct file_operations nfs_file_operations; |
318 | extern struct address_space_operations nfs_file_aops; | 317 | extern struct address_space_operations nfs_file_aops; |
319 | 318 | ||
@@ -329,6 +328,22 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file) | |||
329 | } | 328 | } |
330 | 329 | ||
331 | /* | 330 | /* |
331 | * linux/fs/nfs/xattr.c | ||
332 | */ | ||
333 | #ifdef CONFIG_NFS_V3_ACL | ||
334 | extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t); | ||
335 | extern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t); | ||
336 | extern int nfs3_setxattr(struct dentry *, const char *, | ||
337 | const void *, size_t, int); | ||
338 | extern int nfs3_removexattr (struct dentry *, const char *name); | ||
339 | #else | ||
340 | # define nfs3_listxattr NULL | ||
341 | # define nfs3_getxattr NULL | ||
342 | # define nfs3_setxattr NULL | ||
343 | # define nfs3_removexattr NULL | ||
344 | #endif | ||
345 | |||
346 | /* | ||
332 | * linux/fs/nfs/direct.c | 347 | * linux/fs/nfs/direct.c |
333 | */ | 348 | */ |
334 | extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, | 349 | extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, |
@@ -342,6 +357,9 @@ extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, | |||
342 | * linux/fs/nfs/dir.c | 357 | * linux/fs/nfs/dir.c |
343 | */ | 358 | */ |
344 | extern struct inode_operations nfs_dir_inode_operations; | 359 | extern struct inode_operations nfs_dir_inode_operations; |
360 | #ifdef CONFIG_NFS_V3 | ||
361 | extern struct inode_operations nfs3_dir_inode_operations; | ||
362 | #endif /* CONFIG_NFS_V3 */ | ||
345 | extern struct file_operations nfs_dir_operations; | 363 | extern struct file_operations nfs_dir_operations; |
346 | extern struct dentry_operations nfs_dentry_operations; | 364 | extern struct dentry_operations nfs_dentry_operations; |
347 | 365 | ||
@@ -377,10 +395,10 @@ extern void nfs_commit_done(struct rpc_task *); | |||
377 | */ | 395 | */ |
378 | extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); | 396 | extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); |
379 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 397 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
380 | extern int nfs_commit_inode(struct inode *, unsigned long, unsigned int, int); | 398 | extern int nfs_commit_inode(struct inode *, int); |
381 | #else | 399 | #else |
382 | static inline int | 400 | static inline int |
383 | nfs_commit_inode(struct inode *inode, unsigned long idx_start, unsigned int npages, int how) | 401 | nfs_commit_inode(struct inode *inode, int how) |
384 | { | 402 | { |
385 | return 0; | 403 | return 0; |
386 | } | 404 | } |
@@ -434,11 +452,6 @@ static inline void nfs_writedata_free(struct nfs_write_data *p) | |||
434 | mempool_free(p, nfs_wdata_mempool); | 452 | mempool_free(p, nfs_wdata_mempool); |
435 | } | 453 | } |
436 | 454 | ||
437 | /* Hack for future NFS swap support */ | ||
438 | #ifndef IS_SWAPFILE | ||
439 | # define IS_SWAPFILE(inode) (0) | ||
440 | #endif | ||
441 | |||
442 | /* | 455 | /* |
443 | * linux/fs/nfs/read.c | 456 | * linux/fs/nfs/read.c |
444 | */ | 457 | */ |
@@ -468,6 +481,29 @@ static inline void nfs_readdata_free(struct nfs_read_data *p) | |||
468 | extern void nfs_readdata_release(struct rpc_task *task); | 481 | extern void nfs_readdata_release(struct rpc_task *task); |
469 | 482 | ||
470 | /* | 483 | /* |
484 | * linux/fs/nfs3proc.c | ||
485 | */ | ||
486 | #ifdef CONFIG_NFS_V3_ACL | ||
487 | extern struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type); | ||
488 | extern int nfs3_proc_setacl(struct inode *inode, int type, | ||
489 | struct posix_acl *acl); | ||
490 | extern int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode, | ||
491 | mode_t mode); | ||
492 | extern void nfs3_forget_cached_acls(struct inode *inode); | ||
493 | #else | ||
494 | static inline int nfs3_proc_set_default_acl(struct inode *dir, | ||
495 | struct inode *inode, | ||
496 | mode_t mode) | ||
497 | { | ||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | static inline void nfs3_forget_cached_acls(struct inode *inode) | ||
502 | { | ||
503 | } | ||
504 | #endif /* CONFIG_NFS_V3_ACL */ | ||
505 | |||
506 | /* | ||
471 | * linux/fs/mount_clnt.c | 507 | * linux/fs/mount_clnt.c |
472 | * (Used only by nfsroot module) | 508 | * (Used only by nfsroot module) |
473 | */ | 509 | */ |
@@ -515,230 +551,6 @@ extern void * nfs_root_data(void); | |||
515 | 551 | ||
516 | #define NFS_JUKEBOX_RETRY_TIME (5 * HZ) | 552 | #define NFS_JUKEBOX_RETRY_TIME (5 * HZ) |
517 | 553 | ||
518 | #ifdef CONFIG_NFS_V4 | ||
519 | |||
520 | struct idmap; | ||
521 | |||
522 | /* | ||
523 | * In a seqid-mutating op, this macro controls which error return | ||
524 | * values trigger incrementation of the seqid. | ||
525 | * | ||
526 | * from rfc 3010: | ||
527 | * The client MUST monotonically increment the sequence number for the | ||
528 | * CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE | ||
529 | * operations. This is true even in the event that the previous | ||
530 | * operation that used the sequence number received an error. The only | ||
531 | * exception to this rule is if the previous operation received one of | ||
532 | * the following errors: NFSERR_STALE_CLIENTID, NFSERR_STALE_STATEID, | ||
533 | * NFSERR_BAD_STATEID, NFSERR_BAD_SEQID, NFSERR_BADXDR, | ||
534 | * NFSERR_RESOURCE, NFSERR_NOFILEHANDLE. | ||
535 | * | ||
536 | */ | ||
537 | #define seqid_mutating_err(err) \ | ||
538 | (((err) != NFSERR_STALE_CLIENTID) && \ | ||
539 | ((err) != NFSERR_STALE_STATEID) && \ | ||
540 | ((err) != NFSERR_BAD_STATEID) && \ | ||
541 | ((err) != NFSERR_BAD_SEQID) && \ | ||
542 | ((err) != NFSERR_BAD_XDR) && \ | ||
543 | ((err) != NFSERR_RESOURCE) && \ | ||
544 | ((err) != NFSERR_NOFILEHANDLE)) | ||
545 | |||
546 | enum nfs4_client_state { | ||
547 | NFS4CLNT_OK = 0, | ||
548 | }; | ||
549 | |||
550 | /* | ||
551 | * The nfs4_client identifies our client state to the server. | ||
552 | */ | ||
553 | struct nfs4_client { | ||
554 | struct list_head cl_servers; /* Global list of servers */ | ||
555 | struct in_addr cl_addr; /* Server identifier */ | ||
556 | u64 cl_clientid; /* constant */ | ||
557 | nfs4_verifier cl_confirm; | ||
558 | unsigned long cl_state; | ||
559 | |||
560 | u32 cl_lockowner_id; | ||
561 | |||
562 | /* | ||
563 | * The following rwsem ensures exclusive access to the server | ||
564 | * while we recover the state following a lease expiration. | ||
565 | */ | ||
566 | struct rw_semaphore cl_sem; | ||
567 | |||
568 | struct list_head cl_delegations; | ||
569 | struct list_head cl_state_owners; | ||
570 | struct list_head cl_unused; | ||
571 | int cl_nunused; | ||
572 | spinlock_t cl_lock; | ||
573 | atomic_t cl_count; | ||
574 | |||
575 | struct rpc_clnt * cl_rpcclient; | ||
576 | struct rpc_cred * cl_cred; | ||
577 | |||
578 | struct list_head cl_superblocks; /* List of nfs_server structs */ | ||
579 | |||
580 | unsigned long cl_lease_time; | ||
581 | unsigned long cl_last_renewal; | ||
582 | struct work_struct cl_renewd; | ||
583 | struct work_struct cl_recoverd; | ||
584 | |||
585 | wait_queue_head_t cl_waitq; | ||
586 | struct rpc_wait_queue cl_rpcwaitq; | ||
587 | |||
588 | /* used for the setclientid verifier */ | ||
589 | struct timespec cl_boot_time; | ||
590 | |||
591 | /* idmapper */ | ||
592 | struct idmap * cl_idmap; | ||
593 | |||
594 | /* Our own IP address, as a null-terminated string. | ||
595 | * This is used to generate the clientid, and the callback address. | ||
596 | */ | ||
597 | char cl_ipaddr[16]; | ||
598 | unsigned char cl_id_uniquifier; | ||
599 | }; | ||
600 | |||
601 | /* | ||
602 | * NFS4 state_owners and lock_owners are simply labels for ordered | ||
603 | * sequences of RPC calls. Their sole purpose is to provide once-only | ||
604 | * semantics by allowing the server to identify replayed requests. | ||
605 | * | ||
606 | * The ->so_sema is held during all state_owner seqid-mutating operations: | ||
607 | * OPEN, OPEN_DOWNGRADE, and CLOSE. Its purpose is to properly serialize | ||
608 | * so_seqid. | ||
609 | */ | ||
610 | struct nfs4_state_owner { | ||
611 | struct list_head so_list; /* per-clientid list of state_owners */ | ||
612 | struct nfs4_client *so_client; | ||
613 | u32 so_id; /* 32-bit identifier, unique */ | ||
614 | struct semaphore so_sema; | ||
615 | u32 so_seqid; /* protected by so_sema */ | ||
616 | atomic_t so_count; | ||
617 | |||
618 | struct rpc_cred *so_cred; /* Associated cred */ | ||
619 | struct list_head so_states; | ||
620 | struct list_head so_delegations; | ||
621 | }; | ||
622 | |||
623 | /* | ||
624 | * struct nfs4_state maintains the client-side state for a given | ||
625 | * (state_owner,inode) tuple (OPEN) or state_owner (LOCK). | ||
626 | * | ||
627 | * OPEN: | ||
628 | * In order to know when to OPEN_DOWNGRADE or CLOSE the state on the server, | ||
629 | * we need to know how many files are open for reading or writing on a | ||
630 | * given inode. This information too is stored here. | ||
631 | * | ||
632 | * LOCK: one nfs4_state (LOCK) to hold the lock stateid nfs4_state(OPEN) | ||
633 | */ | ||
634 | |||
635 | struct nfs4_lock_state { | ||
636 | struct list_head ls_locks; /* Other lock stateids */ | ||
637 | fl_owner_t ls_owner; /* POSIX lock owner */ | ||
638 | #define NFS_LOCK_INITIALIZED 1 | ||
639 | int ls_flags; | ||
640 | u32 ls_seqid; | ||
641 | u32 ls_id; | ||
642 | nfs4_stateid ls_stateid; | ||
643 | atomic_t ls_count; | ||
644 | }; | ||
645 | |||
646 | /* bits for nfs4_state->flags */ | ||
647 | enum { | ||
648 | LK_STATE_IN_USE, | ||
649 | NFS_DELEGATED_STATE, | ||
650 | }; | ||
651 | |||
652 | struct nfs4_state { | ||
653 | struct list_head open_states; /* List of states for the same state_owner */ | ||
654 | struct list_head inode_states; /* List of states for the same inode */ | ||
655 | struct list_head lock_states; /* List of subservient lock stateids */ | ||
656 | |||
657 | struct nfs4_state_owner *owner; /* Pointer to the open owner */ | ||
658 | struct inode *inode; /* Pointer to the inode */ | ||
659 | |||
660 | unsigned long flags; /* Do we hold any locks? */ | ||
661 | struct semaphore lock_sema; /* Serializes file locking operations */ | ||
662 | rwlock_t state_lock; /* Protects the lock_states list */ | ||
663 | |||
664 | nfs4_stateid stateid; | ||
665 | |||
666 | unsigned int nreaders; | ||
667 | unsigned int nwriters; | ||
668 | int state; /* State on the server (R,W, or RW) */ | ||
669 | atomic_t count; | ||
670 | }; | ||
671 | |||
672 | |||
673 | struct nfs4_exception { | ||
674 | long timeout; | ||
675 | int retry; | ||
676 | }; | ||
677 | |||
678 | struct nfs4_state_recovery_ops { | ||
679 | int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); | ||
680 | int (*recover_lock)(struct nfs4_state *, struct file_lock *); | ||
681 | }; | ||
682 | |||
683 | extern struct dentry_operations nfs4_dentry_operations; | ||
684 | extern struct inode_operations nfs4_dir_inode_operations; | ||
685 | |||
686 | /* nfs4proc.c */ | ||
687 | extern int nfs4_map_errors(int err); | ||
688 | extern int nfs4_proc_setclientid(struct nfs4_client *, u32, unsigned short); | ||
689 | extern int nfs4_proc_setclientid_confirm(struct nfs4_client *); | ||
690 | extern int nfs4_proc_async_renew(struct nfs4_client *); | ||
691 | extern int nfs4_proc_renew(struct nfs4_client *); | ||
692 | extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state, mode_t mode); | ||
693 | extern struct inode *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); | ||
694 | extern int nfs4_open_revalidate(struct inode *, struct dentry *, int); | ||
695 | |||
696 | extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops; | ||
697 | extern struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops; | ||
698 | |||
699 | /* nfs4renewd.c */ | ||
700 | extern void nfs4_schedule_state_renewal(struct nfs4_client *); | ||
701 | extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); | ||
702 | extern void nfs4_kill_renewd(struct nfs4_client *); | ||
703 | |||
704 | /* nfs4state.c */ | ||
705 | extern void init_nfsv4_state(struct nfs_server *); | ||
706 | extern void destroy_nfsv4_state(struct nfs_server *); | ||
707 | extern struct nfs4_client *nfs4_get_client(struct in_addr *); | ||
708 | extern void nfs4_put_client(struct nfs4_client *clp); | ||
709 | extern int nfs4_init_client(struct nfs4_client *clp); | ||
710 | extern struct nfs4_client *nfs4_find_client(struct in_addr *); | ||
711 | extern u32 nfs4_alloc_lockowner_id(struct nfs4_client *); | ||
712 | |||
713 | extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); | ||
714 | extern void nfs4_put_state_owner(struct nfs4_state_owner *); | ||
715 | extern void nfs4_drop_state_owner(struct nfs4_state_owner *); | ||
716 | extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); | ||
717 | extern void nfs4_put_open_state(struct nfs4_state *); | ||
718 | extern void nfs4_close_state(struct nfs4_state *, mode_t); | ||
719 | extern struct nfs4_state *nfs4_find_state(struct inode *, struct rpc_cred *, mode_t mode); | ||
720 | extern void nfs4_increment_seqid(int status, struct nfs4_state_owner *sp); | ||
721 | extern void nfs4_schedule_state_recovery(struct nfs4_client *); | ||
722 | extern struct nfs4_lock_state *nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t); | ||
723 | extern struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t); | ||
724 | extern void nfs4_put_lock_state(struct nfs4_lock_state *state); | ||
725 | extern void nfs4_increment_lock_seqid(int status, struct nfs4_lock_state *ls); | ||
726 | extern void nfs4_notify_setlk(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *); | ||
727 | extern void nfs4_notify_unlck(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *); | ||
728 | extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t); | ||
729 | |||
730 | |||
731 | |||
732 | struct nfs4_mount_data; | ||
733 | #else | ||
734 | #define init_nfsv4_state(server) do { } while (0) | ||
735 | #define destroy_nfsv4_state(server) do { } while (0) | ||
736 | #define nfs4_put_state_owner(inode, owner) do { } while (0) | ||
737 | #define nfs4_put_open_state(state) do { } while (0) | ||
738 | #define nfs4_close_state(a, b) do { } while (0) | ||
739 | #define nfs4_renewd_prepare_shutdown(server) do { } while (0) | ||
740 | #endif | ||
741 | |||
742 | #endif /* __KERNEL__ */ | 554 | #endif /* __KERNEL__ */ |
743 | 555 | ||
744 | /* | 556 | /* |
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index e9a749588a7b..e2c18dabff86 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h | |||
@@ -16,6 +16,11 @@ struct nfs_lock_info { | |||
16 | struct nlm_lockowner *owner; | 16 | struct nlm_lockowner *owner; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | struct nfs4_lock_state; | ||
20 | struct nfs4_lock_info { | ||
21 | struct nfs4_lock_state *owner; | ||
22 | }; | ||
23 | |||
19 | /* | 24 | /* |
20 | * Lock flag values | 25 | * Lock flag values |
21 | */ | 26 | */ |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index fc51645d61ee..3d3a305488cf 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -10,6 +10,7 @@ | |||
10 | struct nfs_server { | 10 | struct nfs_server { |
11 | struct rpc_clnt * client; /* RPC client handle */ | 11 | struct rpc_clnt * client; /* RPC client handle */ |
12 | struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */ | 12 | struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */ |
13 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ | ||
13 | struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ | 14 | struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ |
14 | struct backing_dev_info backing_dev_info; | 15 | struct backing_dev_info backing_dev_info; |
15 | int flags; /* various flags */ | 16 | int flags; /* various flags */ |
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h index 0071428231f9..659c75438454 100644 --- a/include/linux/nfs_mount.h +++ b/include/linux/nfs_mount.h | |||
@@ -58,6 +58,7 @@ struct nfs_mount_data { | |||
58 | #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ | 58 | #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ |
59 | #define NFS_MOUNT_NONLM 0x0200 /* 3 */ | 59 | #define NFS_MOUNT_NONLM 0x0200 /* 3 */ |
60 | #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ | 60 | #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ |
61 | #define NFS_MOUNT_NOACL 0x0800 /* 4 */ | ||
61 | #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ | 62 | #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ |
62 | #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ | 63 | #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ |
63 | #define NFS_MOUNT_FLAGMASK 0xFFFF | 64 | #define NFS_MOUNT_FLAGMASK 0xFFFF |
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 39e4895bcdb4..da2e077b65e2 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
@@ -20,12 +20,19 @@ | |||
20 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Valid flags for the radix tree | ||
24 | */ | ||
25 | #define NFS_PAGE_TAG_DIRTY 0 | ||
26 | #define NFS_PAGE_TAG_WRITEBACK 1 | ||
27 | |||
28 | /* | ||
23 | * Valid flags for a dirty buffer | 29 | * Valid flags for a dirty buffer |
24 | */ | 30 | */ |
25 | #define PG_BUSY 0 | 31 | #define PG_BUSY 0 |
26 | #define PG_NEED_COMMIT 1 | 32 | #define PG_NEED_COMMIT 1 |
27 | #define PG_NEED_RESCHED 2 | 33 | #define PG_NEED_RESCHED 2 |
28 | 34 | ||
35 | struct nfs_inode; | ||
29 | struct nfs_page { | 36 | struct nfs_page { |
30 | struct list_head wb_list, /* Defines state of page: */ | 37 | struct list_head wb_list, /* Defines state of page: */ |
31 | *wb_list_head; /* read/write/commit */ | 38 | *wb_list_head; /* read/write/commit */ |
@@ -54,14 +61,17 @@ extern void nfs_clear_request(struct nfs_page *req); | |||
54 | extern void nfs_release_request(struct nfs_page *req); | 61 | extern void nfs_release_request(struct nfs_page *req); |
55 | 62 | ||
56 | 63 | ||
57 | extern void nfs_list_add_request(struct nfs_page *, struct list_head *); | 64 | extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst, |
58 | 65 | unsigned long idx_start, unsigned int npages); | |
59 | extern int nfs_scan_list(struct list_head *, struct list_head *, | 66 | extern int nfs_scan_list(struct list_head *, struct list_head *, |
60 | unsigned long, unsigned int); | 67 | unsigned long, unsigned int); |
61 | extern int nfs_coalesce_requests(struct list_head *, struct list_head *, | 68 | extern int nfs_coalesce_requests(struct list_head *, struct list_head *, |
62 | unsigned int); | 69 | unsigned int); |
63 | extern int nfs_wait_on_request(struct nfs_page *); | 70 | extern int nfs_wait_on_request(struct nfs_page *); |
64 | extern void nfs_unlock_request(struct nfs_page *req); | 71 | extern void nfs_unlock_request(struct nfs_page *req); |
72 | extern int nfs_set_page_writeback_locked(struct nfs_page *req); | ||
73 | extern void nfs_clear_page_writeback(struct nfs_page *req); | ||
74 | |||
65 | 75 | ||
66 | /* | 76 | /* |
67 | * Lock the page of an asynchronous request without incrementing the wb_count | 77 | * Lock the page of an asynchronous request without incrementing the wb_count |
@@ -86,6 +96,18 @@ nfs_lock_request(struct nfs_page *req) | |||
86 | return 1; | 96 | return 1; |
87 | } | 97 | } |
88 | 98 | ||
99 | /** | ||
100 | * nfs_list_add_request - Insert a request into a list | ||
101 | * @req: request | ||
102 | * @head: head of list into which to insert the request. | ||
103 | */ | ||
104 | static inline void | ||
105 | nfs_list_add_request(struct nfs_page *req, struct list_head *head) | ||
106 | { | ||
107 | list_add_tail(&req->wb_list, head); | ||
108 | req->wb_list_head = head; | ||
109 | } | ||
110 | |||
89 | 111 | ||
90 | /** | 112 | /** |
91 | * nfs_list_remove_request - Remove a request from its wb_list | 113 | * nfs_list_remove_request - Remove a request from its wb_list |
@@ -96,10 +118,6 @@ nfs_list_remove_request(struct nfs_page *req) | |||
96 | { | 118 | { |
97 | if (list_empty(&req->wb_list)) | 119 | if (list_empty(&req->wb_list)) |
98 | return; | 120 | return; |
99 | if (!NFS_WBACK_BUSY(req)) { | ||
100 | printk(KERN_ERR "NFS: unlocked request attempted removed from list!\n"); | ||
101 | BUG(); | ||
102 | } | ||
103 | list_del_init(&req->wb_list); | 121 | list_del_init(&req->wb_list); |
104 | req->wb_list_head = NULL; | 122 | req->wb_list_head = NULL; |
105 | } | 123 | } |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 47037d9521cb..a2bf6914ff1b 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_NFS_XDR_H | 2 | #define _LINUX_NFS_XDR_H |
3 | 3 | ||
4 | #include <linux/sunrpc/xprt.h> | 4 | #include <linux/sunrpc/xprt.h> |
5 | #include <linux/nfsacl.h> | ||
5 | 6 | ||
6 | struct nfs4_fsid { | 7 | struct nfs4_fsid { |
7 | __u64 major; | 8 | __u64 major; |
@@ -326,6 +327,20 @@ struct nfs_setattrargs { | |||
326 | const u32 * bitmask; | 327 | const u32 * bitmask; |
327 | }; | 328 | }; |
328 | 329 | ||
330 | struct nfs_setaclargs { | ||
331 | struct nfs_fh * fh; | ||
332 | size_t acl_len; | ||
333 | unsigned int acl_pgbase; | ||
334 | struct page ** acl_pages; | ||
335 | }; | ||
336 | |||
337 | struct nfs_getaclargs { | ||
338 | struct nfs_fh * fh; | ||
339 | size_t acl_len; | ||
340 | unsigned int acl_pgbase; | ||
341 | struct page ** acl_pages; | ||
342 | }; | ||
343 | |||
329 | struct nfs_setattrres { | 344 | struct nfs_setattrres { |
330 | struct nfs_fattr * fattr; | 345 | struct nfs_fattr * fattr; |
331 | const struct nfs_server * server; | 346 | const struct nfs_server * server; |
@@ -354,6 +369,20 @@ struct nfs_readdirargs { | |||
354 | struct page ** pages; | 369 | struct page ** pages; |
355 | }; | 370 | }; |
356 | 371 | ||
372 | struct nfs3_getaclargs { | ||
373 | struct nfs_fh * fh; | ||
374 | int mask; | ||
375 | struct page ** pages; | ||
376 | }; | ||
377 | |||
378 | struct nfs3_setaclargs { | ||
379 | struct inode * inode; | ||
380 | int mask; | ||
381 | struct posix_acl * acl_access; | ||
382 | struct posix_acl * acl_default; | ||
383 | struct page ** pages; | ||
384 | }; | ||
385 | |||
357 | struct nfs_diropok { | 386 | struct nfs_diropok { |
358 | struct nfs_fh * fh; | 387 | struct nfs_fh * fh; |
359 | struct nfs_fattr * fattr; | 388 | struct nfs_fattr * fattr; |
@@ -477,6 +506,15 @@ struct nfs3_readdirres { | |||
477 | int plus; | 506 | int plus; |
478 | }; | 507 | }; |
479 | 508 | ||
509 | struct nfs3_getaclres { | ||
510 | struct nfs_fattr * fattr; | ||
511 | int mask; | ||
512 | unsigned int acl_access_count; | ||
513 | unsigned int acl_default_count; | ||
514 | struct posix_acl * acl_access; | ||
515 | struct posix_acl * acl_default; | ||
516 | }; | ||
517 | |||
480 | #ifdef CONFIG_NFS_V4 | 518 | #ifdef CONFIG_NFS_V4 |
481 | 519 | ||
482 | typedef u64 clientid4; | 520 | typedef u64 clientid4; |
@@ -667,6 +705,7 @@ struct nfs_rpc_ops { | |||
667 | int version; /* Protocol version */ | 705 | int version; /* Protocol version */ |
668 | struct dentry_operations *dentry_ops; | 706 | struct dentry_operations *dentry_ops; |
669 | struct inode_operations *dir_inode_ops; | 707 | struct inode_operations *dir_inode_ops; |
708 | struct inode_operations *file_inode_ops; | ||
670 | 709 | ||
671 | int (*getroot) (struct nfs_server *, struct nfs_fh *, | 710 | int (*getroot) (struct nfs_server *, struct nfs_fh *, |
672 | struct nfs_fsinfo *); | 711 | struct nfs_fsinfo *); |
@@ -713,6 +752,7 @@ struct nfs_rpc_ops { | |||
713 | int (*file_open) (struct inode *, struct file *); | 752 | int (*file_open) (struct inode *, struct file *); |
714 | int (*file_release) (struct inode *, struct file *); | 753 | int (*file_release) (struct inode *, struct file *); |
715 | int (*lock)(struct file *, int, struct file_lock *); | 754 | int (*lock)(struct file *, int, struct file_lock *); |
755 | void (*clear_acl_cache)(struct inode *); | ||
716 | }; | 756 | }; |
717 | 757 | ||
718 | /* | 758 | /* |
@@ -732,4 +772,7 @@ extern struct rpc_version nfs_version2; | |||
732 | extern struct rpc_version nfs_version3; | 772 | extern struct rpc_version nfs_version3; |
733 | extern struct rpc_version nfs_version4; | 773 | extern struct rpc_version nfs_version4; |
734 | 774 | ||
775 | extern struct rpc_version nfsacl_version3; | ||
776 | extern struct rpc_program nfsacl_program; | ||
777 | |||
735 | #endif | 778 | #endif |
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h new file mode 100644 index 000000000000..54487a99beb8 --- /dev/null +++ b/include/linux/nfsacl.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * File: linux/nfsacl.h | ||
3 | * | ||
4 | * (C) 2003 Andreas Gruenbacher <agruen@suse.de> | ||
5 | */ | ||
6 | #ifndef __LINUX_NFSACL_H | ||
7 | #define __LINUX_NFSACL_H | ||
8 | |||
9 | #define NFS_ACL_PROGRAM 100227 | ||
10 | |||
11 | #define ACLPROC2_GETACL 1 | ||
12 | #define ACLPROC2_SETACL 2 | ||
13 | #define ACLPROC2_GETATTR 3 | ||
14 | #define ACLPROC2_ACCESS 4 | ||
15 | |||
16 | #define ACLPROC3_GETACL 1 | ||
17 | #define ACLPROC3_SETACL 2 | ||
18 | |||
19 | |||
20 | /* Flags for the getacl/setacl mode */ | ||
21 | #define NFS_ACL 0x0001 | ||
22 | #define NFS_ACLCNT 0x0002 | ||
23 | #define NFS_DFACL 0x0004 | ||
24 | #define NFS_DFACLCNT 0x0008 | ||
25 | |||
26 | /* Flag for Default ACL entries */ | ||
27 | #define NFS_ACL_DEFAULT 0x1000 | ||
28 | |||
29 | #ifdef __KERNEL__ | ||
30 | |||
31 | #include <linux/posix_acl.h> | ||
32 | |||
33 | /* Maximum number of ACL entries over NFS */ | ||
34 | #define NFS_ACL_MAX_ENTRIES 1024 | ||
35 | |||
36 | #define NFSACL_MAXWORDS (2*(2+3*NFS_ACL_MAX_ENTRIES)) | ||
37 | #define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \ | ||
38 | >> PAGE_SHIFT) | ||
39 | |||
40 | static inline unsigned int | ||
41 | nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default) | ||
42 | { | ||
43 | unsigned int w = 16; | ||
44 | w += max(acl_access ? (int)acl_access->a_count : 3, 4) * 12; | ||
45 | if (acl_default) | ||
46 | w += max((int)acl_default->a_count, 4) * 12; | ||
47 | return w; | ||
48 | } | ||
49 | |||
50 | extern unsigned int | ||
51 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | ||
52 | struct posix_acl *acl, int encode_entries, int typeflag); | ||
53 | extern unsigned int | ||
54 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | ||
55 | struct posix_acl **pacl); | ||
56 | |||
57 | #endif /* __KERNEL__ */ | ||
58 | #endif /* __LINUX_NFSACL_H */ | ||
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 8f85d9a59607..5791dfd30dd0 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/unistd.h> | 15 | #include <linux/unistd.h> |
16 | #include <linux/dirent.h> | 16 | #include <linux/dirent.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/posix_acl.h> | ||
18 | #include <linux/mount.h> | 19 | #include <linux/mount.h> |
19 | 20 | ||
20 | #include <linux/nfsd/debug.h> | 21 | #include <linux/nfsd/debug.h> |
@@ -124,20 +125,39 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *, | |||
124 | int nfsd_notify_change(struct inode *, struct iattr *); | 125 | int nfsd_notify_change(struct inode *, struct iattr *); |
125 | int nfsd_permission(struct svc_export *, struct dentry *, int); | 126 | int nfsd_permission(struct svc_export *, struct dentry *, int); |
126 | 127 | ||
128 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
129 | #ifdef CONFIG_NFSD_V2_ACL | ||
130 | extern struct svc_version nfsd_acl_version2; | ||
131 | #else | ||
132 | #define nfsd_acl_version2 NULL | ||
133 | #endif | ||
134 | #ifdef CONFIG_NFSD_V3_ACL | ||
135 | extern struct svc_version nfsd_acl_version3; | ||
136 | #else | ||
137 | #define nfsd_acl_version3 NULL | ||
138 | #endif | ||
139 | struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); | ||
140 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | ||
141 | #endif | ||
142 | |||
127 | 143 | ||
128 | /* | 144 | /* |
129 | * NFSv4 State | 145 | * NFSv4 State |
130 | */ | 146 | */ |
131 | #ifdef CONFIG_NFSD_V4 | 147 | #ifdef CONFIG_NFSD_V4 |
132 | int nfs4_state_init(void); | 148 | void nfs4_state_init(void); |
149 | int nfs4_state_start(void); | ||
133 | void nfs4_state_shutdown(void); | 150 | void nfs4_state_shutdown(void); |
134 | time_t nfs4_lease_time(void); | 151 | time_t nfs4_lease_time(void); |
135 | void nfs4_reset_lease(time_t leasetime); | 152 | void nfs4_reset_lease(time_t leasetime); |
153 | int nfs4_reset_recoverydir(char *recdir); | ||
136 | #else | 154 | #else |
137 | static inline int nfs4_state_init(void){return 0;} | 155 | static inline void nfs4_state_init(void){}; |
156 | static inline int nfs4_state_start(void){return 0;} | ||
138 | static inline void nfs4_state_shutdown(void){} | 157 | static inline void nfs4_state_shutdown(void){} |
139 | static inline time_t nfs4_lease_time(void){return 0;} | 158 | static inline time_t nfs4_lease_time(void){return 0;} |
140 | static inline void nfs4_reset_lease(time_t leasetime){} | 159 | static inline void nfs4_reset_lease(time_t leasetime){} |
160 | static inline int nfs4_reset_recoverydir(char *recdir) {return 0;} | ||
141 | #endif | 161 | #endif |
142 | 162 | ||
143 | /* | 163 | /* |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index b6b2fe1e7c63..a84a3fa99be1 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -61,11 +61,6 @@ typedef struct { | |||
61 | #define si_stateownerid si_opaque.so_stateownerid | 61 | #define si_stateownerid si_opaque.so_stateownerid |
62 | #define si_fileid si_opaque.so_fileid | 62 | #define si_fileid si_opaque.so_fileid |
63 | 63 | ||
64 | extern stateid_t zerostateid; | ||
65 | extern stateid_t onestateid; | ||
66 | |||
67 | #define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t))) | ||
68 | #define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t))) | ||
69 | 64 | ||
70 | struct nfs4_cb_recall { | 65 | struct nfs4_cb_recall { |
71 | u32 cbr_ident; | 66 | u32 cbr_ident; |
@@ -77,8 +72,8 @@ struct nfs4_cb_recall { | |||
77 | }; | 72 | }; |
78 | 73 | ||
79 | struct nfs4_delegation { | 74 | struct nfs4_delegation { |
80 | struct list_head dl_del_perfile; /* nfs4_file->fi_del_perfile */ | 75 | struct list_head dl_perfile; |
81 | struct list_head dl_del_perclnt; /* nfs4_client->cl_del_perclnt*/ | 76 | struct list_head dl_perclnt; |
82 | struct list_head dl_recall_lru; /* delegation recalled */ | 77 | struct list_head dl_recall_lru; /* delegation recalled */ |
83 | atomic_t dl_count; /* ref count */ | 78 | atomic_t dl_count; /* ref count */ |
84 | struct nfs4_client *dl_client; | 79 | struct nfs4_client *dl_client; |
@@ -97,7 +92,6 @@ struct nfs4_delegation { | |||
97 | /* client delegation callback info */ | 92 | /* client delegation callback info */ |
98 | struct nfs4_callback { | 93 | struct nfs4_callback { |
99 | /* SETCLIENTID info */ | 94 | /* SETCLIENTID info */ |
100 | u32 cb_parsed; /* addr parsed */ | ||
101 | u32 cb_addr; | 95 | u32 cb_addr; |
102 | unsigned short cb_port; | 96 | unsigned short cb_port; |
103 | u32 cb_prog; | 97 | u32 cb_prog; |
@@ -109,6 +103,8 @@ struct nfs4_callback { | |||
109 | struct rpc_clnt * cb_client; | 103 | struct rpc_clnt * cb_client; |
110 | }; | 104 | }; |
111 | 105 | ||
106 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ | ||
107 | |||
112 | /* | 108 | /* |
113 | * struct nfs4_client - one per client. Clientids live here. | 109 | * struct nfs4_client - one per client. Clientids live here. |
114 | * o Each nfs4_client is hashed by clientid. | 110 | * o Each nfs4_client is hashed by clientid. |
@@ -122,10 +118,11 @@ struct nfs4_callback { | |||
122 | struct nfs4_client { | 118 | struct nfs4_client { |
123 | struct list_head cl_idhash; /* hash by cl_clientid.id */ | 119 | struct list_head cl_idhash; /* hash by cl_clientid.id */ |
124 | struct list_head cl_strhash; /* hash by cl_name */ | 120 | struct list_head cl_strhash; /* hash by cl_name */ |
125 | struct list_head cl_perclient; /* list: stateowners */ | 121 | struct list_head cl_openowners; |
126 | struct list_head cl_del_perclnt; /* list: delegations */ | 122 | struct list_head cl_delegations; |
127 | struct list_head cl_lru; /* tail queue */ | 123 | struct list_head cl_lru; /* tail queue */ |
128 | struct xdr_netobj cl_name; /* id generated by client */ | 124 | struct xdr_netobj cl_name; /* id generated by client */ |
125 | char cl_recdir[HEXDIR_LEN]; /* recovery dir */ | ||
129 | nfs4_verifier cl_verifier; /* generated by client */ | 126 | nfs4_verifier cl_verifier; /* generated by client */ |
130 | time_t cl_time; /* time of last lease renewal */ | 127 | time_t cl_time; /* time of last lease renewal */ |
131 | u32 cl_addr; /* client ipaddress */ | 128 | u32 cl_addr; /* client ipaddress */ |
@@ -134,6 +131,7 @@ struct nfs4_client { | |||
134 | nfs4_verifier cl_confirm; /* generated by server */ | 131 | nfs4_verifier cl_confirm; /* generated by server */ |
135 | struct nfs4_callback cl_callback; /* callback info */ | 132 | struct nfs4_callback cl_callback; /* callback info */ |
136 | atomic_t cl_count; /* ref count */ | 133 | atomic_t cl_count; /* ref count */ |
134 | u32 cl_firststate; /* recovery dir creation */ | ||
137 | }; | 135 | }; |
138 | 136 | ||
139 | /* struct nfs4_client_reset | 137 | /* struct nfs4_client_reset |
@@ -143,7 +141,7 @@ struct nfs4_client { | |||
143 | */ | 141 | */ |
144 | struct nfs4_client_reclaim { | 142 | struct nfs4_client_reclaim { |
145 | struct list_head cr_strhash; /* hash by cr_name */ | 143 | struct list_head cr_strhash; /* hash by cr_name */ |
146 | struct xdr_netobj cr_name; /* id generated by client */ | 144 | char cr_recdir[HEXDIR_LEN]; /* recover dir */ |
147 | }; | 145 | }; |
148 | 146 | ||
149 | static inline void | 147 | static inline void |
@@ -197,9 +195,9 @@ struct nfs4_stateowner { | |||
197 | struct kref so_ref; | 195 | struct kref so_ref; |
198 | struct list_head so_idhash; /* hash by so_id */ | 196 | struct list_head so_idhash; /* hash by so_id */ |
199 | struct list_head so_strhash; /* hash by op_name */ | 197 | struct list_head so_strhash; /* hash by op_name */ |
200 | struct list_head so_perclient; /* nfs4_client->cl_perclient */ | 198 | struct list_head so_perclient; |
201 | struct list_head so_perfilestate; /* list: nfs4_stateid */ | 199 | struct list_head so_stateids; |
202 | struct list_head so_perlockowner; /* nfs4_stateid->st_perlockowner */ | 200 | struct list_head so_perstateid; /* for lockowners only */ |
203 | struct list_head so_close_lru; /* tail queue */ | 201 | struct list_head so_close_lru; /* tail queue */ |
204 | time_t so_time; /* time of placement on so_close_lru */ | 202 | time_t so_time; /* time of placement on so_close_lru */ |
205 | int so_is_open_owner; /* 1=openowner,0=lockowner */ | 203 | int so_is_open_owner; /* 1=openowner,0=lockowner */ |
@@ -217,9 +215,10 @@ struct nfs4_stateowner { | |||
217 | * share_acces, share_deny on the file. | 215 | * share_acces, share_deny on the file. |
218 | */ | 216 | */ |
219 | struct nfs4_file { | 217 | struct nfs4_file { |
218 | struct kref fi_ref; | ||
220 | struct list_head fi_hash; /* hash by "struct inode *" */ | 219 | struct list_head fi_hash; /* hash by "struct inode *" */ |
221 | struct list_head fi_perfile; /* list: nfs4_stateid */ | 220 | struct list_head fi_stateids; |
222 | struct list_head fi_del_perfile; /* list: nfs4_delegation */ | 221 | struct list_head fi_delegations; |
223 | struct inode *fi_inode; | 222 | struct inode *fi_inode; |
224 | u32 fi_id; /* used with stateowner->so_id | 223 | u32 fi_id; /* used with stateowner->so_id |
225 | * for stateid_hashtbl hash */ | 224 | * for stateid_hashtbl hash */ |
@@ -241,8 +240,8 @@ struct nfs4_file { | |||
241 | struct nfs4_stateid { | 240 | struct nfs4_stateid { |
242 | struct list_head st_hash; | 241 | struct list_head st_hash; |
243 | struct list_head st_perfile; | 242 | struct list_head st_perfile; |
244 | struct list_head st_perfilestate; | 243 | struct list_head st_perstateowner; |
245 | struct list_head st_perlockowner; | 244 | struct list_head st_lockowners; |
246 | struct nfs4_stateowner * st_stateowner; | 245 | struct nfs4_stateowner * st_stateowner; |
247 | struct nfs4_file * st_file; | 246 | struct nfs4_file * st_file; |
248 | stateid_t st_stateid; | 247 | stateid_t st_stateid; |
@@ -267,12 +266,9 @@ struct nfs4_stateid { | |||
267 | ((err) != nfserr_stale_stateid) && \ | 266 | ((err) != nfserr_stale_stateid) && \ |
268 | ((err) != nfserr_bad_stateid)) | 267 | ((err) != nfserr_bad_stateid)) |
269 | 268 | ||
270 | extern time_t nfs4_laundromat(void); | ||
271 | extern int nfsd4_renew(clientid_t *clid); | 269 | extern int nfsd4_renew(clientid_t *clid); |
272 | extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, | 270 | extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, |
273 | stateid_t *stateid, int flags, struct file **filp); | 271 | stateid_t *stateid, int flags, struct file **filp); |
274 | extern int nfs4_share_conflict(struct svc_fh *current_fh, | ||
275 | unsigned int deny_type); | ||
276 | extern void nfs4_lock_state(void); | 272 | extern void nfs4_lock_state(void); |
277 | extern void nfs4_unlock_state(void); | 273 | extern void nfs4_unlock_state(void); |
278 | extern int nfs4_in_grace(void); | 274 | extern int nfs4_in_grace(void); |
@@ -282,6 +278,15 @@ extern void nfs4_free_stateowner(struct kref *kref); | |||
282 | extern void nfsd4_probe_callback(struct nfs4_client *clp); | 278 | extern void nfsd4_probe_callback(struct nfs4_client *clp); |
283 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); | 279 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); |
284 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); | 280 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); |
281 | extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); | ||
282 | extern void nfsd4_init_recdir(char *recdir_name); | ||
283 | extern int nfsd4_recdir_load(void); | ||
284 | extern void nfsd4_shutdown_recdir(void); | ||
285 | extern int nfs4_client_to_reclaim(const char *name); | ||
286 | extern int nfs4_has_reclaimed_state(const char *name); | ||
287 | extern void nfsd4_recdir_purge_old(void); | ||
288 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); | ||
289 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); | ||
285 | 290 | ||
286 | static inline void | 291 | static inline void |
287 | nfs4_put_stateowner(struct nfs4_stateowner *so) | 292 | nfs4_put_stateowner(struct nfs4_stateowner *so) |
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h index ecccef777dae..130d4f588a37 100644 --- a/include/linux/nfsd/xdr.h +++ b/include/linux/nfsd/xdr.h | |||
@@ -169,4 +169,8 @@ int nfssvc_encode_entry(struct readdir_cd *, const char *name, | |||
169 | 169 | ||
170 | int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); | 170 | int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); |
171 | 171 | ||
172 | /* Helper functions for NFSv2 ACL code */ | ||
173 | u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp); | ||
174 | u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp); | ||
175 | |||
172 | #endif /* LINUX_NFSD_H */ | 176 | #endif /* LINUX_NFSD_H */ |
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h index 0ae9e0ef5f68..21e18ce7ca63 100644 --- a/include/linux/nfsd/xdr3.h +++ b/include/linux/nfsd/xdr3.h | |||
@@ -110,6 +110,19 @@ struct nfsd3_commitargs { | |||
110 | __u32 count; | 110 | __u32 count; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | struct nfsd3_getaclargs { | ||
114 | struct svc_fh fh; | ||
115 | int mask; | ||
116 | }; | ||
117 | |||
118 | struct posix_acl; | ||
119 | struct nfsd3_setaclargs { | ||
120 | struct svc_fh fh; | ||
121 | int mask; | ||
122 | struct posix_acl *acl_access; | ||
123 | struct posix_acl *acl_default; | ||
124 | }; | ||
125 | |||
113 | struct nfsd3_attrstat { | 126 | struct nfsd3_attrstat { |
114 | __u32 status; | 127 | __u32 status; |
115 | struct svc_fh fh; | 128 | struct svc_fh fh; |
@@ -209,6 +222,14 @@ struct nfsd3_commitres { | |||
209 | struct svc_fh fh; | 222 | struct svc_fh fh; |
210 | }; | 223 | }; |
211 | 224 | ||
225 | struct nfsd3_getaclres { | ||
226 | __u32 status; | ||
227 | struct svc_fh fh; | ||
228 | int mask; | ||
229 | struct posix_acl *acl_access; | ||
230 | struct posix_acl *acl_default; | ||
231 | }; | ||
232 | |||
212 | /* dummy type for release */ | 233 | /* dummy type for release */ |
213 | struct nfsd3_fhandle_pair { | 234 | struct nfsd3_fhandle_pair { |
214 | __u32 dummy; | 235 | __u32 dummy; |
@@ -241,6 +262,7 @@ union nfsd3_xdrstore { | |||
241 | struct nfsd3_fsinfores fsinfores; | 262 | struct nfsd3_fsinfores fsinfores; |
242 | struct nfsd3_pathconfres pathconfres; | 263 | struct nfsd3_pathconfres pathconfres; |
243 | struct nfsd3_commitres commitres; | 264 | struct nfsd3_commitres commitres; |
265 | struct nfsd3_getaclres getaclres; | ||
244 | }; | 266 | }; |
245 | 267 | ||
246 | #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) | 268 | #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) |
@@ -316,6 +338,10 @@ int nfs3svc_encode_entry(struct readdir_cd *, const char *name, | |||
316 | int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, | 338 | int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, |
317 | int namlen, loff_t offset, ino_t ino, | 339 | int namlen, loff_t offset, ino_t ino, |
318 | unsigned int); | 340 | unsigned int); |
341 | /* Helper functions for NFSv3 ACL code */ | ||
342 | u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, | ||
343 | struct svc_fh *fhp); | ||
344 | u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp); | ||
319 | 345 | ||
320 | 346 | ||
321 | #endif /* _LINUX_NFSD_XDR3_H */ | 347 | #endif /* _LINUX_NFSD_XDR3_H */ |
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index a1f5ad0be1bf..4d24d65c0e88 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h | |||
@@ -210,6 +210,7 @@ struct nfsd4_open { | |||
210 | u32 op_share_access; /* request */ | 210 | u32 op_share_access; /* request */ |
211 | u32 op_share_deny; /* request */ | 211 | u32 op_share_deny; /* request */ |
212 | stateid_t op_stateid; /* response */ | 212 | stateid_t op_stateid; /* response */ |
213 | u32 op_recall; /* recall */ | ||
213 | struct nfsd4_change_info op_cinfo; /* response */ | 214 | struct nfsd4_change_info op_cinfo; /* response */ |
214 | u32 op_rflags; /* response */ | 215 | u32 op_rflags; /* response */ |
215 | int op_truncate; /* used during processing */ | 216 | int op_truncate; /* used during processing */ |
diff --git a/include/linux/nfsd_idmap.h b/include/linux/nfsd_idmap.h index 9bb7f30e923b..e82746fcad14 100644 --- a/include/linux/nfsd_idmap.h +++ b/include/linux/nfsd_idmap.h | |||
@@ -43,8 +43,13 @@ | |||
43 | /* XXX from linux/nfs_idmap.h */ | 43 | /* XXX from linux/nfs_idmap.h */ |
44 | #define IDMAP_NAMESZ 128 | 44 | #define IDMAP_NAMESZ 128 |
45 | 45 | ||
46 | #ifdef CONFIG_NFSD_V4 | ||
46 | void nfsd_idmap_init(void); | 47 | void nfsd_idmap_init(void); |
47 | void nfsd_idmap_shutdown(void); | 48 | void nfsd_idmap_shutdown(void); |
49 | #else | ||
50 | static inline void nfsd_idmap_init(void) {}; | ||
51 | static inline void nfsd_idmap_shutdown(void) {}; | ||
52 | #endif | ||
48 | 53 | ||
49 | int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); | 54 | int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); |
50 | int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *); | 55 | int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *); |
diff --git a/include/linux/node.h b/include/linux/node.h index 6e0a697e594e..254dc3de650b 100644 --- a/include/linux/node.h +++ b/include/linux/node.h | |||
@@ -27,6 +27,7 @@ struct node { | |||
27 | }; | 27 | }; |
28 | 28 | ||
29 | extern int register_node(struct node *, int, struct node *); | 29 | extern int register_node(struct node *, int, struct node *); |
30 | extern void unregister_node(struct node *node); | ||
30 | 31 | ||
31 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) | 32 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) |
32 | 33 | ||
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 9303a003e9ab..5937dd6053c3 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
@@ -56,6 +56,7 @@ extern int notifier_call_chain(struct notifier_block **n, unsigned long val, voi | |||
56 | #define NETDEV_CHANGEADDR 0x0008 | 56 | #define NETDEV_CHANGEADDR 0x0008 |
57 | #define NETDEV_GOING_DOWN 0x0009 | 57 | #define NETDEV_GOING_DOWN 0x0009 |
58 | #define NETDEV_CHANGENAME 0x000A | 58 | #define NETDEV_CHANGENAME 0x000A |
59 | #define NETDEV_FEAT_CHANGE 0x000B | ||
59 | 60 | ||
60 | #define SYS_DOWN 0x0001 /* Notify of system down */ | 61 | #define SYS_DOWN 0x0001 /* Notify of system down */ |
61 | #define SYS_RESTART SYS_DOWN | 62 | #define SYS_RESTART SYS_DOWN |
diff --git a/include/linux/numa.h b/include/linux/numa.h index bd0c8c4e9a95..f0c539bd3cfc 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | #ifdef CONFIG_DISCONTIGMEM | 6 | #ifndef CONFIG_FLATMEM |
7 | #include <asm/numnodes.h> | 7 | #include <asm/numnodes.h> |
8 | #endif | 8 | #endif |
9 | 9 | ||
diff --git a/include/linux/nvram.h b/include/linux/nvram.h index b031e41b5e0d..9189829c131c 100644 --- a/include/linux/nvram.h +++ b/include/linux/nvram.h | |||
@@ -20,8 +20,6 @@ extern void __nvram_write_byte(unsigned char c, int i); | |||
20 | extern void nvram_write_byte(unsigned char c, int i); | 20 | extern void nvram_write_byte(unsigned char c, int i); |
21 | extern int __nvram_check_checksum(void); | 21 | extern int __nvram_check_checksum(void); |
22 | extern int nvram_check_checksum(void); | 22 | extern int nvram_check_checksum(void); |
23 | extern void __nvram_set_checksum(void); | ||
24 | extern void nvram_set_checksum(void); | ||
25 | #endif | 23 | #endif |
26 | 24 | ||
27 | #endif /* _LINUX_NVRAM_H */ | 25 | #endif /* _LINUX_NVRAM_H */ |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 39ab8c6b5652..f5a6695d4d21 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -61,21 +61,20 @@ | |||
61 | #define PG_active 6 | 61 | #define PG_active 6 |
62 | #define PG_slab 7 /* slab debug (Suparna wants this) */ | 62 | #define PG_slab 7 /* slab debug (Suparna wants this) */ |
63 | 63 | ||
64 | #define PG_highmem 8 | 64 | #define PG_checked 8 /* kill me in 2.5.<early>. */ |
65 | #define PG_checked 9 /* kill me in 2.5.<early>. */ | 65 | #define PG_arch_1 9 |
66 | #define PG_arch_1 10 | 66 | #define PG_reserved 10 |
67 | #define PG_reserved 11 | 67 | #define PG_private 11 /* Has something at ->private */ |
68 | 68 | ||
69 | #define PG_private 12 /* Has something at ->private */ | 69 | #define PG_writeback 12 /* Page is under writeback */ |
70 | #define PG_writeback 13 /* Page is under writeback */ | 70 | #define PG_nosave 13 /* Used for system suspend/resume */ |
71 | #define PG_nosave 14 /* Used for system suspend/resume */ | 71 | #define PG_compound 14 /* Part of a compound page */ |
72 | #define PG_compound 15 /* Part of a compound page */ | 72 | #define PG_swapcache 15 /* Swap page: swp_entry_t in private */ |
73 | 73 | ||
74 | #define PG_swapcache 16 /* Swap page: swp_entry_t in private */ | 74 | #define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ |
75 | #define PG_mappedtodisk 17 /* Has blocks allocated on-disk */ | 75 | #define PG_reclaim 17 /* To be reclaimed asap */ |
76 | #define PG_reclaim 18 /* To be reclaimed asap */ | 76 | #define PG_nosave_free 18 /* Free, should not be written */ |
77 | #define PG_nosave_free 19 /* Free, should not be written */ | 77 | #define PG_uncached 19 /* Page has been mapped as uncached */ |
78 | #define PG_uncached 20 /* Page has been mapped as uncached */ | ||
79 | 78 | ||
80 | /* | 79 | /* |
81 | * Global page accounting. One instance per CPU. Only unsigned longs are | 80 | * Global page accounting. One instance per CPU. Only unsigned longs are |
@@ -136,8 +135,8 @@ struct page_state { | |||
136 | 135 | ||
137 | extern void get_page_state(struct page_state *ret); | 136 | extern void get_page_state(struct page_state *ret); |
138 | extern void get_full_page_state(struct page_state *ret); | 137 | extern void get_full_page_state(struct page_state *ret); |
139 | extern unsigned long __read_page_state(unsigned offset); | 138 | extern unsigned long __read_page_state(unsigned long offset); |
140 | extern void __mod_page_state(unsigned offset, unsigned long delta); | 139 | extern void __mod_page_state(unsigned long offset, unsigned long delta); |
141 | 140 | ||
142 | #define read_page_state(member) \ | 141 | #define read_page_state(member) \ |
143 | __read_page_state(offsetof(struct page_state, member)) | 142 | __read_page_state(offsetof(struct page_state, member)) |
@@ -215,7 +214,7 @@ extern void __mod_page_state(unsigned offset, unsigned long delta); | |||
215 | #define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags) | 214 | #define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags) |
216 | 215 | ||
217 | #ifdef CONFIG_HIGHMEM | 216 | #ifdef CONFIG_HIGHMEM |
218 | #define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) | 217 | #define PageHighMem(page) is_highmem(page_zone(page)) |
219 | #else | 218 | #else |
220 | #define PageHighMem(page) 0 /* needed to optimize away at compile time */ | 219 | #define PageHighMem(page) 0 /* needed to optimize away at compile time */ |
221 | #endif | 220 | #endif |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 0422031161ba..d9a25647a295 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -52,12 +52,12 @@ void release_pages(struct page **pages, int nr, int cold); | |||
52 | 52 | ||
53 | static inline struct page *page_cache_alloc(struct address_space *x) | 53 | static inline struct page *page_cache_alloc(struct address_space *x) |
54 | { | 54 | { |
55 | return alloc_pages(mapping_gfp_mask(x), 0); | 55 | return alloc_pages(mapping_gfp_mask(x)|__GFP_NORECLAIM, 0); |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline struct page *page_cache_alloc_cold(struct address_space *x) | 58 | static inline struct page *page_cache_alloc_cold(struct address_space *x) |
59 | { | 59 | { |
60 | return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); | 60 | return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD|__GFP_NORECLAIM, 0); |
61 | } | 61 | } |
62 | 62 | ||
63 | typedef int filler_t(void *, struct page *); | 63 | typedef int filler_t(void *, struct page *); |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index ae27792b5aa4..bf608808a60c 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -575,6 +575,7 @@ | |||
575 | #define PCI_DEVICE_ID_CT_65550 0x00e0 | 575 | #define PCI_DEVICE_ID_CT_65550 0x00e0 |
576 | #define PCI_DEVICE_ID_CT_65554 0x00e4 | 576 | #define PCI_DEVICE_ID_CT_65554 0x00e4 |
577 | #define PCI_DEVICE_ID_CT_65555 0x00e5 | 577 | #define PCI_DEVICE_ID_CT_65555 0x00e5 |
578 | #define PCI_DEVICE_ID_CT_69000 0x00c0 | ||
578 | 579 | ||
579 | #define PCI_VENDOR_ID_MIRO 0x1031 | 580 | #define PCI_VENDOR_ID_MIRO 0x1031 |
580 | #define PCI_DEVICE_ID_MIRO_36050 0x5601 | 581 | #define PCI_DEVICE_ID_MIRO_36050 0x5601 |
@@ -874,6 +875,7 @@ | |||
874 | #define PCI_DEVICE_ID_APPLE_KL_USB_P 0x0026 | 875 | #define PCI_DEVICE_ID_APPLE_KL_USB_P 0x0026 |
875 | #define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027 | 876 | #define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027 |
876 | #define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d | 877 | #define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d |
878 | #define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e | ||
877 | #define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 | 879 | #define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 |
878 | #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 | 880 | #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 |
879 | #define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033 | 881 | #define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033 |
@@ -1230,6 +1232,12 @@ | |||
1230 | #define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258 | 1232 | #define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258 |
1231 | #define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259 | 1233 | #define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259 |
1232 | #define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B | 1234 | #define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B |
1235 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 | ||
1236 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 | ||
1237 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 | ||
1238 | #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 | ||
1239 | #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 | ||
1240 | #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B | ||
1233 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 | 1241 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 |
1234 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 | 1242 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 |
1235 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 | 1243 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 |
@@ -1560,6 +1568,7 @@ | |||
1560 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 | 1568 | #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 |
1561 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB | 1569 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB |
1562 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 | 1570 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 |
1571 | #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 | ||
1563 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 | 1572 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 |
1564 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 | 1573 | #define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 |
1565 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 | 1574 | #define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 |
@@ -2064,12 +2073,14 @@ | |||
2064 | 2073 | ||
2065 | #define PCI_VENDOR_ID_BROADCOM 0x14e4 | 2074 | #define PCI_VENDOR_ID_BROADCOM 0x14e4 |
2066 | #define PCI_DEVICE_ID_TIGON3_5752 0x1600 | 2075 | #define PCI_DEVICE_ID_TIGON3_5752 0x1600 |
2076 | #define PCI_DEVICE_ID_TIGON3_5752M 0x1601 | ||
2067 | #define PCI_DEVICE_ID_TIGON3_5700 0x1644 | 2077 | #define PCI_DEVICE_ID_TIGON3_5700 0x1644 |
2068 | #define PCI_DEVICE_ID_TIGON3_5701 0x1645 | 2078 | #define PCI_DEVICE_ID_TIGON3_5701 0x1645 |
2069 | #define PCI_DEVICE_ID_TIGON3_5702 0x1646 | 2079 | #define PCI_DEVICE_ID_TIGON3_5702 0x1646 |
2070 | #define PCI_DEVICE_ID_TIGON3_5703 0x1647 | 2080 | #define PCI_DEVICE_ID_TIGON3_5703 0x1647 |
2071 | #define PCI_DEVICE_ID_TIGON3_5704 0x1648 | 2081 | #define PCI_DEVICE_ID_TIGON3_5704 0x1648 |
2072 | #define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 | 2082 | #define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 |
2083 | #define PCI_DEVICE_ID_NX2_5706 0x164a | ||
2073 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d | 2084 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d |
2074 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 | 2085 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 |
2075 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 | 2086 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 |
@@ -2089,6 +2100,7 @@ | |||
2089 | #define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 | 2100 | #define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 |
2090 | #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 | 2101 | #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 |
2091 | #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 | 2102 | #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 |
2103 | #define PCI_DEVICE_ID_NX2_5706S 0x16aa | ||
2092 | #define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 | 2104 | #define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 |
2093 | #define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 | 2105 | #define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 |
2094 | #define PCI_DEVICE_ID_TIGON3_5781 0x16dd | 2106 | #define PCI_DEVICE_ID_TIGON3_5781 0x16dd |
@@ -2373,6 +2385,8 @@ | |||
2373 | #define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 | 2385 | #define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 |
2374 | #define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 | 2386 | #define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 |
2375 | #define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 | 2387 | #define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 |
2388 | #define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 | ||
2389 | #define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 | ||
2376 | #define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 | 2390 | #define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 |
2377 | #define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 | 2391 | #define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 |
2378 | #define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 | 2392 | #define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 |
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index e6b519220245..724066778aff 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h | |||
@@ -245,6 +245,7 @@ struct sadb_x_nat_t_port { | |||
245 | 245 | ||
246 | /* Security Association flags */ | 246 | /* Security Association flags */ |
247 | #define SADB_SAFLAGS_PFS 1 | 247 | #define SADB_SAFLAGS_PFS 1 |
248 | #define SADB_SAFLAGS_NOPMTUDISC 0x20000000 | ||
248 | #define SADB_SAFLAGS_DECAP_DSCP 0x40000000 | 249 | #define SADB_SAFLAGS_DECAP_DSCP 0x40000000 |
249 | #define SADB_SAFLAGS_NOECN 0x80000000 | 250 | #define SADB_SAFLAGS_NOECN 0x80000000 |
250 | 251 | ||
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index d2aa214d6803..25d2d67c1faf 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h | |||
@@ -408,6 +408,7 @@ enum | |||
408 | TCF_EM_NBYTE, | 408 | TCF_EM_NBYTE, |
409 | TCF_EM_U32, | 409 | TCF_EM_U32, |
410 | TCF_EM_META, | 410 | TCF_EM_META, |
411 | TCF_EM_TEXT, | ||
411 | __TCF_EM_MAX | 412 | __TCF_EM_MAX |
412 | }; | 413 | }; |
413 | 414 | ||
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 73d84c071cb1..1d9da36eb9db 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -427,6 +427,7 @@ enum | |||
427 | TCA_NETEM_UNSPEC, | 427 | TCA_NETEM_UNSPEC, |
428 | TCA_NETEM_CORR, | 428 | TCA_NETEM_CORR, |
429 | TCA_NETEM_DELAY_DIST, | 429 | TCA_NETEM_DELAY_DIST, |
430 | TCA_NETEM_REORDER, | ||
430 | __TCA_NETEM_MAX, | 431 | __TCA_NETEM_MAX, |
431 | }; | 432 | }; |
432 | 433 | ||
@@ -437,7 +438,7 @@ struct tc_netem_qopt | |||
437 | __u32 latency; /* added delay (us) */ | 438 | __u32 latency; /* added delay (us) */ |
438 | __u32 limit; /* fifo limit (packets) */ | 439 | __u32 limit; /* fifo limit (packets) */ |
439 | __u32 loss; /* random packet loss (0=none ~0=100%) */ | 440 | __u32 loss; /* random packet loss (0=none ~0=100%) */ |
440 | __u32 gap; /* re-ordering gap (0 for delay all) */ | 441 | __u32 gap; /* re-ordering gap (0 for none) */ |
441 | __u32 duplicate; /* random packet dup (0=none ~0=100%) */ | 442 | __u32 duplicate; /* random packet dup (0=none ~0=100%) */ |
442 | __u32 jitter; /* random jitter in latency (us) */ | 443 | __u32 jitter; /* random jitter in latency (us) */ |
443 | }; | 444 | }; |
@@ -449,6 +450,12 @@ struct tc_netem_corr | |||
449 | __u32 dup_corr; /* duplicate correlation */ | 450 | __u32 dup_corr; /* duplicate correlation */ |
450 | }; | 451 | }; |
451 | 452 | ||
453 | struct tc_netem_reorder | ||
454 | { | ||
455 | __u32 probability; | ||
456 | __u32 correlation; | ||
457 | }; | ||
458 | |||
452 | #define NETEM_DIST_SCALE 8192 | 459 | #define NETEM_DIST_SCALE 8192 |
453 | 460 | ||
454 | #endif | 461 | #endif |
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h index 4e2d2a942ecb..4b32bce9a289 100644 --- a/include/linux/pktcdvd.h +++ b/include/linux/pktcdvd.h | |||
@@ -159,7 +159,7 @@ struct packet_iosched | |||
159 | struct bio *read_queue_tail; | 159 | struct bio *read_queue_tail; |
160 | struct bio *write_queue; | 160 | struct bio *write_queue; |
161 | struct bio *write_queue_tail; | 161 | struct bio *write_queue_tail; |
162 | int high_prio_read; /* An important read request has been queued */ | 162 | sector_t last_write; /* The sector where the last write ended */ |
163 | int successive_reads; | 163 | int successive_reads; |
164 | }; | 164 | }; |
165 | 165 | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index ed2b76e75199..14479325e3f3 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -103,7 +103,8 @@ extern int pm_active; | |||
103 | /* | 103 | /* |
104 | * Register a device with power management | 104 | * Register a device with power management |
105 | */ | 105 | */ |
106 | struct pm_dev __deprecated *pm_register(pm_dev_t type, unsigned long id, pm_callback callback); | 106 | struct pm_dev __deprecated * |
107 | pm_register(pm_dev_t type, unsigned long id, pm_callback callback); | ||
107 | 108 | ||
108 | /* | 109 | /* |
109 | * Unregister a device with power management | 110 | * Unregister a device with power management |
@@ -190,17 +191,18 @@ typedef u32 __bitwise pm_message_t; | |||
190 | /* | 191 | /* |
191 | * There are 4 important states driver can be in: | 192 | * There are 4 important states driver can be in: |
192 | * ON -- driver is working | 193 | * ON -- driver is working |
193 | * FREEZE -- stop operations and apply whatever policy is applicable to a suspended driver | 194 | * FREEZE -- stop operations and apply whatever policy is applicable to a |
194 | * of that class, freeze queues for block like IDE does, drop packets for | 195 | * suspended driver of that class, freeze queues for block like IDE |
195 | * ethernet, etc... stop DMA engine too etc... so a consistent image can be | 196 | * does, drop packets for ethernet, etc... stop DMA engine too etc... |
196 | * saved; but do not power any hardware down. | 197 | * so a consistent image can be saved; but do not power any hardware |
197 | * SUSPEND - like FREEZE, but hardware is doing as much powersaving as possible. Roughly | 198 | * down. |
198 | * pci D3. | 199 | * SUSPEND - like FREEZE, but hardware is doing as much powersaving as |
200 | * possible. Roughly pci D3. | ||
199 | * | 201 | * |
200 | * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3 (SUSPEND). | 202 | * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3 |
201 | * We'll need to fix the drivers. So yes, putting 3 to all diferent defines is intentional, | 203 | * (SUSPEND). We'll need to fix the drivers. So yes, putting 3 to all different |
202 | * and will go away as soon as drivers are fixed. Also note that typedef is neccessary, | 204 | * defines is intentional, and will go away as soon as drivers are fixed. Also |
203 | * we'll probably want to switch to | 205 | * note that typedef is neccessary, we'll probably want to switch to |
204 | * typedef struct pm_message_t { int event; int flags; } pm_message_t | 206 | * typedef struct pm_message_t { int event; int flags; } pm_message_t |
205 | * or something similar soon. | 207 | * or something similar soon. |
206 | */ | 208 | */ |
@@ -222,11 +224,18 @@ struct dev_pm_info { | |||
222 | 224 | ||
223 | extern void device_pm_set_parent(struct device * dev, struct device * parent); | 225 | extern void device_pm_set_parent(struct device * dev, struct device * parent); |
224 | 226 | ||
225 | extern int device_suspend(pm_message_t state); | ||
226 | extern int device_power_down(pm_message_t state); | 227 | extern int device_power_down(pm_message_t state); |
227 | extern void device_power_up(void); | 228 | extern void device_power_up(void); |
228 | extern void device_resume(void); | 229 | extern void device_resume(void); |
229 | 230 | ||
231 | #ifdef CONFIG_PM | ||
232 | extern int device_suspend(pm_message_t state); | ||
233 | #else | ||
234 | static inline int device_suspend(pm_message_t state) | ||
235 | { | ||
236 | return 0; | ||
237 | } | ||
238 | #endif | ||
230 | 239 | ||
231 | #endif /* __KERNEL__ */ | 240 | #endif /* __KERNEL__ */ |
232 | 241 | ||
diff --git a/include/linux/posix_acl_xattr.h b/include/linux/posix_acl_xattr.h index 5efd0a6dad94..6e53c34035cd 100644 --- a/include/linux/posix_acl_xattr.h +++ b/include/linux/posix_acl_xattr.h | |||
@@ -23,13 +23,13 @@ | |||
23 | #define ACL_UNDEFINED_ID (-1) | 23 | #define ACL_UNDEFINED_ID (-1) |
24 | 24 | ||
25 | typedef struct { | 25 | typedef struct { |
26 | __u16 e_tag; | 26 | __le16 e_tag; |
27 | __u16 e_perm; | 27 | __le16 e_perm; |
28 | __u32 e_id; | 28 | __le32 e_id; |
29 | } posix_acl_xattr_entry; | 29 | } posix_acl_xattr_entry; |
30 | 30 | ||
31 | typedef struct { | 31 | typedef struct { |
32 | __u32 a_version; | 32 | __le32 a_version; |
33 | posix_acl_xattr_entry a_entries[0]; | 33 | posix_acl_xattr_entry a_entries[0]; |
34 | } posix_acl_xattr_header; | 34 | } posix_acl_xattr_header; |
35 | 35 | ||
@@ -52,4 +52,7 @@ posix_acl_xattr_count(size_t size) | |||
52 | return size / sizeof(posix_acl_xattr_entry); | 52 | return size / sizeof(posix_acl_xattr_entry); |
53 | } | 53 | } |
54 | 54 | ||
55 | struct posix_acl *posix_acl_from_xattr(const void *value, size_t size); | ||
56 | int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size); | ||
57 | |||
55 | #endif /* _POSIX_ACL_XATTR_H */ | 58 | #endif /* _POSIX_ACL_XATTR_H */ |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 59e505261fd6..0563581e3a02 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -74,6 +74,13 @@ struct kcore_list { | |||
74 | size_t size; | 74 | size_t size; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | struct vmcore { | ||
78 | struct list_head list; | ||
79 | unsigned long long paddr; | ||
80 | unsigned long size; | ||
81 | loff_t offset; | ||
82 | }; | ||
83 | |||
77 | #ifdef CONFIG_PROC_FS | 84 | #ifdef CONFIG_PROC_FS |
78 | 85 | ||
79 | extern struct proc_dir_entry proc_root; | 86 | extern struct proc_dir_entry proc_root; |
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h index 22ba580b0ae8..fc610bb0f733 100644 --- a/include/linux/qnx4_fs.h +++ b/include/linux/qnx4_fs.h | |||
@@ -46,11 +46,11 @@ struct qnx4_inode_entry { | |||
46 | char di_fname[QNX4_SHORT_NAME_MAX]; | 46 | char di_fname[QNX4_SHORT_NAME_MAX]; |
47 | qnx4_off_t di_size; | 47 | qnx4_off_t di_size; |
48 | qnx4_xtnt_t di_first_xtnt; | 48 | qnx4_xtnt_t di_first_xtnt; |
49 | __u32 di_xblk; | 49 | __le32 di_xblk; |
50 | __s32 di_ftime; | 50 | __le32 di_ftime; |
51 | __s32 di_mtime; | 51 | __le32 di_mtime; |
52 | __s32 di_atime; | 52 | __le32 di_atime; |
53 | __s32 di_ctime; | 53 | __le32 di_ctime; |
54 | qnx4_nxtnt_t di_num_xtnts; | 54 | qnx4_nxtnt_t di_num_xtnts; |
55 | qnx4_mode_t di_mode; | 55 | qnx4_mode_t di_mode; |
56 | qnx4_muid_t di_uid; | 56 | qnx4_muid_t di_uid; |
@@ -63,18 +63,18 @@ struct qnx4_inode_entry { | |||
63 | 63 | ||
64 | struct qnx4_link_info { | 64 | struct qnx4_link_info { |
65 | char dl_fname[QNX4_NAME_MAX]; | 65 | char dl_fname[QNX4_NAME_MAX]; |
66 | __u32 dl_inode_blk; | 66 | __le32 dl_inode_blk; |
67 | __u8 dl_inode_ndx; | 67 | __u8 dl_inode_ndx; |
68 | __u8 dl_spare[10]; | 68 | __u8 dl_spare[10]; |
69 | __u8 dl_status; | 69 | __u8 dl_status; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct qnx4_xblk { | 72 | struct qnx4_xblk { |
73 | __u32 xblk_next_xblk; | 73 | __le32 xblk_next_xblk; |
74 | __u32 xblk_prev_xblk; | 74 | __le32 xblk_prev_xblk; |
75 | __u8 xblk_num_xtnts; | 75 | __u8 xblk_num_xtnts; |
76 | __u8 xblk_spare[3]; | 76 | __u8 xblk_spare[3]; |
77 | __s32 xblk_num_blocks; | 77 | __le32 xblk_num_blocks; |
78 | qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; | 78 | qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; |
79 | char xblk_signature[8]; | 79 | char xblk_signature[8]; |
80 | qnx4_xtnt_t xblk_first_xtnt; | 80 | qnx4_xtnt_t xblk_first_xtnt; |
diff --git a/include/linux/qnxtypes.h b/include/linux/qnxtypes.h index fb518e318c7c..a3eb1137857b 100644 --- a/include/linux/qnxtypes.h +++ b/include/linux/qnxtypes.h | |||
@@ -12,18 +12,18 @@ | |||
12 | #ifndef _QNX4TYPES_H | 12 | #ifndef _QNX4TYPES_H |
13 | #define _QNX4TYPES_H | 13 | #define _QNX4TYPES_H |
14 | 14 | ||
15 | typedef __u16 qnx4_nxtnt_t; | 15 | typedef __le16 qnx4_nxtnt_t; |
16 | typedef __u8 qnx4_ftype_t; | 16 | typedef __u8 qnx4_ftype_t; |
17 | 17 | ||
18 | typedef struct { | 18 | typedef struct { |
19 | __u32 xtnt_blk; | 19 | __le32 xtnt_blk; |
20 | __u32 xtnt_size; | 20 | __le32 xtnt_size; |
21 | } qnx4_xtnt_t; | 21 | } qnx4_xtnt_t; |
22 | 22 | ||
23 | typedef __u16 qnx4_mode_t; | 23 | typedef __le16 qnx4_mode_t; |
24 | typedef __u16 qnx4_muid_t; | 24 | typedef __le16 qnx4_muid_t; |
25 | typedef __u16 qnx4_mgid_t; | 25 | typedef __le16 qnx4_mgid_t; |
26 | typedef __u32 qnx4_off_t; | 26 | typedef __le32 qnx4_off_t; |
27 | typedef __u16 qnx4_nlink_t; | 27 | typedef __le16 qnx4_nlink_t; |
28 | 28 | ||
29 | #endif | 29 | #endif |
diff --git a/include/linux/quota.h b/include/linux/quota.h index ac5b90f4f256..700ead45084f 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -138,8 +138,11 @@ struct if_dqinfo { | |||
138 | #include <linux/dqblk_v2.h> | 138 | #include <linux/dqblk_v2.h> |
139 | 139 | ||
140 | /* Maximal numbers of writes for quota operation (insert/delete/update) | 140 | /* Maximal numbers of writes for quota operation (insert/delete/update) |
141 | * (over all formats) - info block, 4 pointer blocks, data block */ | 141 | * (over VFS all formats) */ |
142 | #define DQUOT_MAX_WRITES 6 | 142 | #define DQUOT_INIT_ALLOC max(V1_INIT_ALLOC, V2_INIT_ALLOC) |
143 | #define DQUOT_INIT_REWRITE max(V1_INIT_REWRITE, V2_INIT_REWRITE) | ||
144 | #define DQUOT_DEL_ALLOC max(V1_DEL_ALLOC, V2_DEL_ALLOC) | ||
145 | #define DQUOT_DEL_REWRITE max(V1_DEL_REWRITE, V2_DEL_REWRITE) | ||
143 | 146 | ||
144 | /* | 147 | /* |
145 | * Data for one user/group kept in memory | 148 | * Data for one user/group kept in memory |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index e57baa85e744..d211507ab246 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -39,7 +39,8 @@ extern int dquot_commit_info(struct super_block *sb, int type); | |||
39 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); | 39 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); |
40 | 40 | ||
41 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); | 41 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); |
42 | extern int vfs_quota_on_mount(int type, int format_id, struct dentry *dentry); | 42 | extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, |
43 | int format_id, int type); | ||
43 | extern int vfs_quota_off(struct super_block *sb, int type); | 44 | extern int vfs_quota_off(struct super_block *sb, int type); |
44 | #define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type) | 45 | #define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type) |
45 | extern int vfs_quota_sync(struct super_block *sb, int type); | 46 | extern int vfs_quota_sync(struct super_block *sb, int type); |
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h new file mode 100644 index 000000000000..e24b74b11150 --- /dev/null +++ b/include/linux/raid/bitmap.h | |||
@@ -0,0 +1,273 @@ | |||
1 | /* | ||
2 | * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003 | ||
3 | * | ||
4 | * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc. | ||
5 | */ | ||
6 | #ifndef BITMAP_H | ||
7 | #define BITMAP_H 1 | ||
8 | |||
9 | #define BITMAP_MAJOR 3 | ||
10 | #define BITMAP_MINOR 38 | ||
11 | |||
12 | /* | ||
13 | * in-memory bitmap: | ||
14 | * | ||
15 | * Use 16 bit block counters to track pending writes to each "chunk". | ||
16 | * The 2 high order bits are special-purpose, the first is a flag indicating | ||
17 | * whether a resync is needed. The second is a flag indicating whether a | ||
18 | * resync is active. | ||
19 | * This means that the counter is actually 14 bits: | ||
20 | * | ||
21 | * +--------+--------+------------------------------------------------+ | ||
22 | * | resync | resync | counter | | ||
23 | * | needed | active | | | ||
24 | * | (0-1) | (0-1) | (0-16383) | | ||
25 | * +--------+--------+------------------------------------------------+ | ||
26 | * | ||
27 | * The "resync needed" bit is set when: | ||
28 | * a '1' bit is read from storage at startup. | ||
29 | * a write request fails on some drives | ||
30 | * a resync is aborted on a chunk with 'resync active' set | ||
31 | * It is cleared (and resync-active set) when a resync starts across all drives | ||
32 | * of the chunk. | ||
33 | * | ||
34 | * | ||
35 | * The "resync active" bit is set when: | ||
36 | * a resync is started on all drives, and resync_needed is set. | ||
37 | * resync_needed will be cleared (as long as resync_active wasn't already set). | ||
38 | * It is cleared when a resync completes. | ||
39 | * | ||
40 | * The counter counts pending write requests, plus the on-disk bit. | ||
41 | * When the counter is '1' and the resync bits are clear, the on-disk | ||
42 | * bit can be cleared aswell, thus setting the counter to 0. | ||
43 | * When we set a bit, or in the counter (to start a write), if the fields is | ||
44 | * 0, we first set the disk bit and set the counter to 1. | ||
45 | * | ||
46 | * If the counter is 0, the on-disk bit is clear and the stipe is clean | ||
47 | * Anything that dirties the stipe pushes the counter to 2 (at least) | ||
48 | * and sets the on-disk bit (lazily). | ||
49 | * If a periodic sweep find the counter at 2, it is decremented to 1. | ||
50 | * If the sweep find the counter at 1, the on-disk bit is cleared and the | ||
51 | * counter goes to zero. | ||
52 | * | ||
53 | * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block | ||
54 | * counters as a fallback when "page" memory cannot be allocated: | ||
55 | * | ||
56 | * Normal case (page memory allocated): | ||
57 | * | ||
58 | * page pointer (32-bit) | ||
59 | * | ||
60 | * [ ] ------+ | ||
61 | * | | ||
62 | * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters) | ||
63 | * c1 c2 c2048 | ||
64 | * | ||
65 | * Hijacked case (page memory allocation failed): | ||
66 | * | ||
67 | * hijacked page pointer (32-bit) | ||
68 | * | ||
69 | * [ ][ ] (no page memory allocated) | ||
70 | * counter #1 (16-bit) counter #2 (16-bit) | ||
71 | * | ||
72 | */ | ||
73 | |||
74 | #ifdef __KERNEL__ | ||
75 | |||
76 | #define PAGE_BITS (PAGE_SIZE << 3) | ||
77 | #define PAGE_BIT_SHIFT (PAGE_SHIFT + 3) | ||
78 | |||
79 | typedef __u16 bitmap_counter_t; | ||
80 | #define COUNTER_BITS 16 | ||
81 | #define COUNTER_BIT_SHIFT 4 | ||
82 | #define COUNTER_BYTE_RATIO (COUNTER_BITS / 8) | ||
83 | #define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3) | ||
84 | |||
85 | #define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1))) | ||
86 | #define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2))) | ||
87 | #define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1) | ||
88 | #define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK) | ||
89 | #define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK) | ||
90 | #define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX) | ||
91 | |||
92 | /* how many counters per page? */ | ||
93 | #define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS) | ||
94 | /* same, except a shift value for more efficient bitops */ | ||
95 | #define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT) | ||
96 | /* same, except a mask value for more efficient bitops */ | ||
97 | #define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1) | ||
98 | |||
99 | #define BITMAP_BLOCK_SIZE 512 | ||
100 | #define BITMAP_BLOCK_SHIFT 9 | ||
101 | |||
102 | /* how many blocks per chunk? (this is variable) */ | ||
103 | #define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT) | ||
104 | #define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT) | ||
105 | #define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1) | ||
106 | |||
107 | /* when hijacked, the counters and bits represent even larger "chunks" */ | ||
108 | /* there will be 1024 chunks represented by each counter in the page pointers */ | ||
109 | #define PAGEPTR_BLOCK_RATIO(bitmap) \ | ||
110 | (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1) | ||
111 | #define PAGEPTR_BLOCK_SHIFT(bitmap) \ | ||
112 | (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1) | ||
113 | #define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1) | ||
114 | |||
115 | /* | ||
116 | * on-disk bitmap: | ||
117 | * | ||
118 | * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap | ||
119 | * file a page at a time. There's a superblock at the start of the file. | ||
120 | */ | ||
121 | |||
122 | /* map chunks (bits) to file pages - offset by the size of the superblock */ | ||
123 | #define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3)) | ||
124 | |||
125 | #endif | ||
126 | |||
127 | /* | ||
128 | * bitmap structures: | ||
129 | */ | ||
130 | |||
131 | #define BITMAP_MAGIC 0x6d746962 | ||
132 | |||
133 | /* use these for bitmap->flags and bitmap->sb->state bit-fields */ | ||
134 | enum bitmap_state { | ||
135 | BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ | ||
136 | BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */ | ||
137 | }; | ||
138 | |||
139 | /* the superblock at the front of the bitmap file -- little endian */ | ||
140 | typedef struct bitmap_super_s { | ||
141 | __u32 magic; /* 0 BITMAP_MAGIC */ | ||
142 | __u32 version; /* 4 the bitmap major for now, could change... */ | ||
143 | __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */ | ||
144 | __u64 events; /* 24 event counter for the bitmap (1)*/ | ||
145 | __u64 events_cleared;/*32 event counter when last bit cleared (2) */ | ||
146 | __u64 sync_size; /* 40 the size of the md device's sync range(3) */ | ||
147 | __u32 state; /* 48 bitmap state information */ | ||
148 | __u32 chunksize; /* 52 the bitmap chunk size in bytes */ | ||
149 | __u32 daemon_sleep; /* 56 seconds between disk flushes */ | ||
150 | |||
151 | __u8 pad[256 - 60]; /* set to zero */ | ||
152 | } bitmap_super_t; | ||
153 | |||
154 | /* notes: | ||
155 | * (1) This event counter is updated before the eventcounter in the md superblock | ||
156 | * When a bitmap is loaded, it is only accepted if this event counter is equal | ||
157 | * to, or one greater than, the event counter in the superblock. | ||
158 | * (2) This event counter is updated when the other one is *if*and*only*if* the | ||
159 | * array is not degraded. As bits are not cleared when the array is degraded, | ||
160 | * this represents the last time that any bits were cleared. | ||
161 | * If a device is being added that has an event count with this value or | ||
162 | * higher, it is accepted as conforming to the bitmap. | ||
163 | * (3)This is the number of sectors represented by the bitmap, and is the range that | ||
164 | * resync happens across. For raid1 and raid5/6 it is the size of individual | ||
165 | * devices. For raid10 it is the size of the array. | ||
166 | */ | ||
167 | |||
168 | #ifdef __KERNEL__ | ||
169 | |||
170 | /* the in-memory bitmap is represented by bitmap_pages */ | ||
171 | struct bitmap_page { | ||
172 | /* | ||
173 | * map points to the actual memory page | ||
174 | */ | ||
175 | char *map; | ||
176 | /* | ||
177 | * in emergencies (when map cannot be alloced), hijack the map | ||
178 | * pointer and use it as two counters itself | ||
179 | */ | ||
180 | unsigned int hijacked:1; | ||
181 | /* | ||
182 | * count of dirty bits on the page | ||
183 | */ | ||
184 | unsigned int count:31; | ||
185 | }; | ||
186 | |||
187 | /* keep track of bitmap file pages that have pending writes on them */ | ||
188 | struct page_list { | ||
189 | struct list_head list; | ||
190 | struct page *page; | ||
191 | }; | ||
192 | |||
193 | /* the main bitmap structure - one per mddev */ | ||
194 | struct bitmap { | ||
195 | struct bitmap_page *bp; | ||
196 | unsigned long pages; /* total number of pages in the bitmap */ | ||
197 | unsigned long missing_pages; /* number of pages not yet allocated */ | ||
198 | |||
199 | mddev_t *mddev; /* the md device that the bitmap is for */ | ||
200 | |||
201 | int counter_bits; /* how many bits per block counter */ | ||
202 | |||
203 | /* bitmap chunksize -- how much data does each bit represent? */ | ||
204 | unsigned long chunksize; | ||
205 | unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */ | ||
206 | unsigned long chunks; /* total number of data chunks for the array */ | ||
207 | |||
208 | /* We hold a count on the chunk currently being synced, and drop | ||
209 | * it when the last block is started. If the resync is aborted | ||
210 | * midway, we need to be able to drop that count, so we remember | ||
211 | * the counted chunk.. | ||
212 | */ | ||
213 | unsigned long syncchunk; | ||
214 | |||
215 | __u64 events_cleared; | ||
216 | |||
217 | /* bitmap spinlock */ | ||
218 | spinlock_t lock; | ||
219 | |||
220 | long offset; /* offset from superblock if file is NULL */ | ||
221 | struct file *file; /* backing disk file */ | ||
222 | struct page *sb_page; /* cached copy of the bitmap file superblock */ | ||
223 | struct page **filemap; /* list of cache pages for the file */ | ||
224 | unsigned long *filemap_attr; /* attributes associated w/ filemap pages */ | ||
225 | unsigned long file_pages; /* number of pages in the file */ | ||
226 | |||
227 | unsigned long flags; | ||
228 | |||
229 | /* | ||
230 | * the bitmap daemon - periodically wakes up and sweeps the bitmap | ||
231 | * file, cleaning up bits and flushing out pages to disk as necessary | ||
232 | */ | ||
233 | unsigned long daemon_lastrun; /* jiffies of last run */ | ||
234 | unsigned long daemon_sleep; /* how many seconds between updates? */ | ||
235 | |||
236 | /* | ||
237 | * bitmap_writeback_daemon waits for file-pages that have been written, | ||
238 | * as there is no way to get a call-back when a page write completes. | ||
239 | */ | ||
240 | mdk_thread_t *writeback_daemon; | ||
241 | spinlock_t write_lock; | ||
242 | wait_queue_head_t write_wait; | ||
243 | struct list_head complete_pages; | ||
244 | mempool_t *write_pool; | ||
245 | }; | ||
246 | |||
247 | /* the bitmap API */ | ||
248 | |||
249 | /* these are used only by md/bitmap */ | ||
250 | int bitmap_create(mddev_t *mddev); | ||
251 | void bitmap_destroy(mddev_t *mddev); | ||
252 | int bitmap_active(struct bitmap *bitmap); | ||
253 | |||
254 | char *file_path(struct file *file, char *buf, int count); | ||
255 | void bitmap_print_sb(struct bitmap *bitmap); | ||
256 | int bitmap_update_sb(struct bitmap *bitmap); | ||
257 | |||
258 | int bitmap_setallbits(struct bitmap *bitmap); | ||
259 | void bitmap_write_all(struct bitmap *bitmap); | ||
260 | |||
261 | /* these are exported */ | ||
262 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); | ||
263 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, | ||
264 | int success); | ||
265 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks); | ||
266 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); | ||
267 | void bitmap_close_sync(struct bitmap *bitmap); | ||
268 | |||
269 | int bitmap_unplug(struct bitmap *bitmap); | ||
270 | int bitmap_daemon_work(struct bitmap *bitmap); | ||
271 | #endif | ||
272 | |||
273 | #endif | ||
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index a6a67d102bfa..ffa316ce4dc8 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h | |||
@@ -60,7 +60,14 @@ | |||
60 | */ | 60 | */ |
61 | #define MD_MAJOR_VERSION 0 | 61 | #define MD_MAJOR_VERSION 0 |
62 | #define MD_MINOR_VERSION 90 | 62 | #define MD_MINOR_VERSION 90 |
63 | #define MD_PATCHLEVEL_VERSION 1 | 63 | /* |
64 | * MD_PATCHLEVEL_VERSION indicates kernel functionality. | ||
65 | * >=1 means different superblock formats are selectable using SET_ARRAY_INFO | ||
66 | * and major_version/minor_version accordingly | ||
67 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT | ||
68 | * in the super status byte | ||
69 | */ | ||
70 | #define MD_PATCHLEVEL_VERSION 2 | ||
64 | 71 | ||
65 | extern int register_md_personality (int p_num, mdk_personality_t *p); | 72 | extern int register_md_personality (int p_num, mdk_personality_t *p); |
66 | extern int unregister_md_personality (int p_num); | 73 | extern int unregister_md_personality (int p_num); |
@@ -69,7 +76,7 @@ extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), | |||
69 | extern void md_unregister_thread (mdk_thread_t *thread); | 76 | extern void md_unregister_thread (mdk_thread_t *thread); |
70 | extern void md_wakeup_thread(mdk_thread_t *thread); | 77 | extern void md_wakeup_thread(mdk_thread_t *thread); |
71 | extern void md_check_recovery(mddev_t *mddev); | 78 | extern void md_check_recovery(mddev_t *mddev); |
72 | extern void md_write_start(mddev_t *mddev); | 79 | extern void md_write_start(mddev_t *mddev, struct bio *bi); |
73 | extern void md_write_end(mddev_t *mddev); | 80 | extern void md_write_end(mddev_t *mddev); |
74 | extern void md_handle_safemode(mddev_t *mddev); | 81 | extern void md_handle_safemode(mddev_t *mddev); |
75 | extern void md_done_sync(mddev_t *mddev, int blocks, int ok); | 82 | extern void md_done_sync(mddev_t *mddev, int blocks, int ok); |
@@ -78,6 +85,12 @@ extern void md_unplug_mddev(mddev_t *mddev); | |||
78 | 85 | ||
79 | extern void md_print_devices (void); | 86 | extern void md_print_devices (void); |
80 | 87 | ||
88 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | ||
89 | sector_t sector, int size, struct page *page); | ||
90 | extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, | ||
91 | struct page *page, int rw); | ||
92 | |||
93 | |||
81 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } | 94 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } |
82 | 95 | ||
83 | #endif | 96 | #endif |
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index c9a0d4013be7..8c14ba565a45 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -15,6 +15,9 @@ | |||
15 | #ifndef _MD_K_H | 15 | #ifndef _MD_K_H |
16 | #define _MD_K_H | 16 | #define _MD_K_H |
17 | 17 | ||
18 | /* and dm-bio-list.h is not under include/linux because.... ??? */ | ||
19 | #include "../../../drivers/md/dm-bio-list.h" | ||
20 | |||
18 | #define MD_RESERVED 0UL | 21 | #define MD_RESERVED 0UL |
19 | #define LINEAR 1UL | 22 | #define LINEAR 1UL |
20 | #define RAID0 2UL | 23 | #define RAID0 2UL |
@@ -180,6 +183,10 @@ struct mdk_rdev_s | |||
180 | 183 | ||
181 | int desc_nr; /* descriptor index in the superblock */ | 184 | int desc_nr; /* descriptor index in the superblock */ |
182 | int raid_disk; /* role of device in array */ | 185 | int raid_disk; /* role of device in array */ |
186 | int saved_raid_disk; /* role that device used to have in the | ||
187 | * array and could again if we did a partial | ||
188 | * resync from the bitmap | ||
189 | */ | ||
183 | 190 | ||
184 | atomic_t nr_pending; /* number of pending requests. | 191 | atomic_t nr_pending; /* number of pending requests. |
185 | * only maintained for arrays that | 192 | * only maintained for arrays that |
@@ -252,6 +259,11 @@ struct mddev_s | |||
252 | atomic_t recovery_active; /* blocks scheduled, but not written */ | 259 | atomic_t recovery_active; /* blocks scheduled, but not written */ |
253 | wait_queue_head_t recovery_wait; | 260 | wait_queue_head_t recovery_wait; |
254 | sector_t recovery_cp; | 261 | sector_t recovery_cp; |
262 | |||
263 | spinlock_t write_lock; | ||
264 | wait_queue_head_t sb_wait; /* for waiting on superblock updates */ | ||
265 | atomic_t pending_writes; /* number of active superblock writes */ | ||
266 | |||
255 | unsigned int safemode; /* if set, update "clean" superblock | 267 | unsigned int safemode; /* if set, update "clean" superblock |
256 | * when no writes pending. | 268 | * when no writes pending. |
257 | */ | 269 | */ |
@@ -260,6 +272,13 @@ struct mddev_s | |||
260 | atomic_t writes_pending; | 272 | atomic_t writes_pending; |
261 | request_queue_t *queue; /* for plugging ... */ | 273 | request_queue_t *queue; /* for plugging ... */ |
262 | 274 | ||
275 | struct bitmap *bitmap; /* the bitmap for the device */ | ||
276 | struct file *bitmap_file; /* the bitmap file */ | ||
277 | long bitmap_offset; /* offset from superblock of | ||
278 | * start of bitmap. May be | ||
279 | * negative, but not '0' | ||
280 | */ | ||
281 | |||
263 | struct list_head all_mddevs; | 282 | struct list_head all_mddevs; |
264 | }; | 283 | }; |
265 | 284 | ||
@@ -291,7 +310,7 @@ struct mdk_personality_s | |||
291 | int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev); | 310 | int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev); |
292 | int (*hot_remove_disk) (mddev_t *mddev, int number); | 311 | int (*hot_remove_disk) (mddev_t *mddev, int number); |
293 | int (*spare_active) (mddev_t *mddev); | 312 | int (*spare_active) (mddev_t *mddev); |
294 | int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster); | 313 | sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); |
295 | int (*resize) (mddev_t *mddev, sector_t sectors); | 314 | int (*resize) (mddev_t *mddev, sector_t sectors); |
296 | int (*reshape) (mddev_t *mddev, int raid_disks); | 315 | int (*reshape) (mddev_t *mddev, int raid_disks); |
297 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); | 316 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); |
@@ -334,6 +353,7 @@ typedef struct mdk_thread_s { | |||
334 | unsigned long flags; | 353 | unsigned long flags; |
335 | struct completion *event; | 354 | struct completion *event; |
336 | struct task_struct *tsk; | 355 | struct task_struct *tsk; |
356 | unsigned long timeout; | ||
337 | const char *name; | 357 | const char *name; |
338 | } mdk_thread_t; | 358 | } mdk_thread_t; |
339 | 359 | ||
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index 8ba95d67329f..dc65cd435494 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
@@ -96,6 +96,7 @@ typedef struct mdp_device_descriptor_s { | |||
96 | #define MD_SB_CLEAN 0 | 96 | #define MD_SB_CLEAN 0 |
97 | #define MD_SB_ERRORS 1 | 97 | #define MD_SB_ERRORS 1 |
98 | 98 | ||
99 | #define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ | ||
99 | typedef struct mdp_superblock_s { | 100 | typedef struct mdp_superblock_s { |
100 | /* | 101 | /* |
101 | * Constant generic information | 102 | * Constant generic information |
@@ -184,7 +185,7 @@ struct mdp_superblock_1 { | |||
184 | /* constant array information - 128 bytes */ | 185 | /* constant array information - 128 bytes */ |
185 | __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ | 186 | __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ |
186 | __u32 major_version; /* 1 */ | 187 | __u32 major_version; /* 1 */ |
187 | __u32 feature_map; /* 0 for now */ | 188 | __u32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */ |
188 | __u32 pad0; /* always set to 0 when writing */ | 189 | __u32 pad0; /* always set to 0 when writing */ |
189 | 190 | ||
190 | __u8 set_uuid[16]; /* user-space generated. */ | 191 | __u8 set_uuid[16]; /* user-space generated. */ |
@@ -197,7 +198,11 @@ struct mdp_superblock_1 { | |||
197 | 198 | ||
198 | __u32 chunksize; /* in 512byte sectors */ | 199 | __u32 chunksize; /* in 512byte sectors */ |
199 | __u32 raid_disks; | 200 | __u32 raid_disks; |
200 | __u8 pad1[128-96]; /* set to 0 when written */ | 201 | __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts |
202 | * NOTE: signed, so bitmap can be before superblock | ||
203 | * only meaningful of feature_map[0] is set. | ||
204 | */ | ||
205 | __u8 pad1[128-100]; /* set to 0 when written */ | ||
201 | 206 | ||
202 | /* constant this-device information - 64 bytes */ | 207 | /* constant this-device information - 64 bytes */ |
203 | __u64 data_offset; /* sector start of data, often 0 */ | 208 | __u64 data_offset; /* sector start of data, often 0 */ |
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h index a2df5c2a42af..81da20ccec4d 100644 --- a/include/linux/raid/md_u.h +++ b/include/linux/raid/md_u.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) | 23 | #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) |
24 | #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) | 24 | #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) |
25 | #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) | 25 | #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) |
26 | #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) | ||
26 | 27 | ||
27 | /* configuration */ | 28 | /* configuration */ |
28 | #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) | 29 | #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) |
@@ -36,6 +37,7 @@ | |||
36 | #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) | 37 | #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) |
37 | #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) | 38 | #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) |
38 | #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) | 39 | #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) |
40 | #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) | ||
39 | 41 | ||
40 | /* usage */ | 42 | /* usage */ |
41 | #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) | 43 | #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) |
@@ -106,6 +108,11 @@ typedef struct mdu_start_info_s { | |||
106 | 108 | ||
107 | } mdu_start_info_t; | 109 | } mdu_start_info_t; |
108 | 110 | ||
111 | typedef struct mdu_bitmap_file_s | ||
112 | { | ||
113 | char pathname[4096]; | ||
114 | } mdu_bitmap_file_t; | ||
115 | |||
109 | typedef struct mdu_param_s | 116 | typedef struct mdu_param_s |
110 | { | 117 | { |
111 | int personality; /* 1,2,3,4 */ | 118 | int personality; /* 1,2,3,4 */ |
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index abbfdd9afe1e..9d93cf12e890 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h | |||
@@ -36,12 +36,21 @@ struct r1_private_data_s { | |||
36 | spinlock_t device_lock; | 36 | spinlock_t device_lock; |
37 | 37 | ||
38 | struct list_head retry_list; | 38 | struct list_head retry_list; |
39 | /* queue pending writes and submit them on unplug */ | ||
40 | struct bio_list pending_bio_list; | ||
41 | /* queue of writes that have been unplugged */ | ||
42 | struct bio_list flushing_bio_list; | ||
43 | |||
39 | /* for use when syncing mirrors: */ | 44 | /* for use when syncing mirrors: */ |
40 | 45 | ||
41 | spinlock_t resync_lock; | 46 | spinlock_t resync_lock; |
42 | int nr_pending; | 47 | int nr_pending; |
43 | int barrier; | 48 | int barrier; |
44 | sector_t next_resync; | 49 | sector_t next_resync; |
50 | int fullsync; /* set to 1 if a full sync is needed, | ||
51 | * (fresh device added). | ||
52 | * Cleared when a sync completes. | ||
53 | */ | ||
45 | 54 | ||
46 | wait_queue_head_t wait_idle; | 55 | wait_queue_head_t wait_idle; |
47 | wait_queue_head_t wait_resume; | 56 | wait_queue_head_t wait_resume; |
@@ -85,14 +94,17 @@ struct r1bio_s { | |||
85 | int read_disk; | 94 | int read_disk; |
86 | 95 | ||
87 | struct list_head retry_list; | 96 | struct list_head retry_list; |
97 | struct bitmap_update *bitmap_update; | ||
88 | /* | 98 | /* |
89 | * if the IO is in WRITE direction, then multiple bios are used. | 99 | * if the IO is in WRITE direction, then multiple bios are used. |
90 | * We choose the number when they are allocated. | 100 | * We choose the number when they are allocated. |
91 | */ | 101 | */ |
92 | struct bio *bios[0]; | 102 | struct bio *bios[0]; |
103 | /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/ | ||
93 | }; | 104 | }; |
94 | 105 | ||
95 | /* bits for r1bio.state */ | 106 | /* bits for r1bio.state */ |
96 | #define R1BIO_Uptodate 0 | 107 | #define R1BIO_Uptodate 0 |
97 | #define R1BIO_IsSync 1 | 108 | #define R1BIO_IsSync 1 |
109 | #define R1BIO_Degraded 2 | ||
98 | #endif | 110 | #endif |
diff --git a/include/linux/reboot.h b/include/linux/reboot.h index d60fafc8bdc5..2d4dd23168dd 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h | |||
@@ -51,6 +51,10 @@ extern void machine_restart(char *cmd); | |||
51 | extern void machine_halt(void); | 51 | extern void machine_halt(void); |
52 | extern void machine_power_off(void); | 52 | extern void machine_power_off(void); |
53 | 53 | ||
54 | extern void machine_shutdown(void); | ||
55 | struct pt_regs; | ||
56 | extern void machine_crash_shutdown(struct pt_regs *); | ||
57 | |||
54 | #endif | 58 | #endif |
55 | 59 | ||
56 | #endif /* _LINUX_REBOOT_H */ | 60 | #endif /* _LINUX_REBOOT_H */ |
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h index 2aef9c3f5ce8..0760507a545b 100644 --- a/include/linux/reiserfs_acl.h +++ b/include/linux/reiserfs_acl.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/posix_acl.h> | 2 | #include <linux/posix_acl.h> |
3 | #include <linux/xattr_acl.h> | ||
4 | 3 | ||
5 | #define REISERFS_ACL_VERSION 0x0001 | 4 | #define REISERFS_ACL_VERSION 0x0001 |
6 | 5 | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 32148625fc2f..4c7c5689ad93 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1644,11 +1644,18 @@ struct reiserfs_journal_header { | |||
1644 | #define JOURNAL_MAX_TRANS_AGE 30 | 1644 | #define JOURNAL_MAX_TRANS_AGE 30 |
1645 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | 1645 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) |
1646 | #ifdef CONFIG_QUOTA | 1646 | #ifdef CONFIG_QUOTA |
1647 | #define REISERFS_QUOTA_TRANS_BLOCKS 2 /* We need to update data and inode (atime) */ | 1647 | /* We need to update data and inode (atime) */ |
1648 | #define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*(JOURNAL_PER_BALANCE_CNT+2)+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ | 1648 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) |
1649 | /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ | ||
1650 | #define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ | ||
1651 | (DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) | ||
1652 | /* same as with INIT */ | ||
1653 | #define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ | ||
1654 | (DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) | ||
1649 | #else | 1655 | #else |
1650 | #define REISERFS_QUOTA_TRANS_BLOCKS 0 | 1656 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 |
1651 | #define REISERFS_QUOTA_INIT_BLOCKS 0 | 1657 | #define REISERFS_QUOTA_INIT_BLOCKS(s) 0 |
1658 | #define REISERFS_QUOTA_DEL_BLOCKS(s) 0 | ||
1652 | #endif | 1659 | #endif |
1653 | 1660 | ||
1654 | /* both of these can be as low as 1, or as high as you want. The min is the | 1661 | /* both of these can be as low as 1, or as high as you want. The min is the |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 37a3a7afbec7..31c709d0fe18 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -467,6 +467,8 @@ enum reiserfs_mount_options { | |||
467 | REISERFS_ERROR_RO, | 467 | REISERFS_ERROR_RO, |
468 | REISERFS_ERROR_CONTINUE, | 468 | REISERFS_ERROR_CONTINUE, |
469 | 469 | ||
470 | REISERFS_QUOTA, /* Some quota option specified */ | ||
471 | |||
470 | REISERFS_TEST1, | 472 | REISERFS_TEST1, |
471 | REISERFS_TEST2, | 473 | REISERFS_TEST2, |
472 | REISERFS_TEST3, | 474 | REISERFS_TEST3, |
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 11b484e37ac9..e80fb7ee6efd 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -93,6 +93,12 @@ int page_referenced(struct page *, int is_locked, int ignore_token); | |||
93 | int try_to_unmap(struct page *); | 93 | int try_to_unmap(struct page *); |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * Called from mm/filemap_xip.c to unmap empty zero page | ||
97 | */ | ||
98 | pte_t *page_check_address(struct page *, struct mm_struct *, unsigned long); | ||
99 | |||
100 | |||
101 | /* | ||
96 | * Used by swapoff to help locate where page is expected in vma. | 102 | * Used by swapoff to help locate where page is expected in vma. |
97 | */ | 103 | */ |
98 | 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 *); |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 91ac97c20777..d021888b58f1 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -89,6 +89,13 @@ enum { | |||
89 | RTM_GETANYCAST = 62, | 89 | RTM_GETANYCAST = 62, |
90 | #define RTM_GETANYCAST RTM_GETANYCAST | 90 | #define RTM_GETANYCAST RTM_GETANYCAST |
91 | 91 | ||
92 | RTM_NEWNEIGHTBL = 64, | ||
93 | #define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL | ||
94 | RTM_GETNEIGHTBL = 66, | ||
95 | #define RTM_GETNEIGHTBL RTM_GETNEIGHTBL | ||
96 | RTM_SETNEIGHTBL, | ||
97 | #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL | ||
98 | |||
92 | __RTM_MAX, | 99 | __RTM_MAX, |
93 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) | 100 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) |
94 | }; | 101 | }; |
@@ -493,6 +500,106 @@ struct nda_cacheinfo | |||
493 | __u32 ndm_refcnt; | 500 | __u32 ndm_refcnt; |
494 | }; | 501 | }; |
495 | 502 | ||
503 | |||
504 | /***************************************************************** | ||
505 | * Neighbour tables specific messages. | ||
506 | * | ||
507 | * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the | ||
508 | * NLM_F_DUMP flag set. Every neighbour table configuration is | ||
509 | * spread over multiple messages to avoid running into message | ||
510 | * size limits on systems with many interfaces. The first message | ||
511 | * in the sequence transports all not device specific data such as | ||
512 | * statistics, configuration, and the default parameter set. | ||
513 | * This message is followed by 0..n messages carrying device | ||
514 | * specific parameter sets. | ||
515 | * Although the ordering should be sufficient, NDTA_NAME can be | ||
516 | * used to identify sequences. The initial message can be identified | ||
517 | * by checking for NDTA_CONFIG. The device specific messages do | ||
518 | * not contain this TLV but have NDTPA_IFINDEX set to the | ||
519 | * corresponding interface index. | ||
520 | * | ||
521 | * To change neighbour table attributes, send RTM_SETNEIGHTBL | ||
522 | * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], | ||
523 | * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked | ||
524 | * otherwise. Device specific parameter sets can be changed by | ||
525 | * setting NDTPA_IFINDEX to the interface index of the corresponding | ||
526 | * device. | ||
527 | ****/ | ||
528 | |||
529 | struct ndt_stats | ||
530 | { | ||
531 | __u64 ndts_allocs; | ||
532 | __u64 ndts_destroys; | ||
533 | __u64 ndts_hash_grows; | ||
534 | __u64 ndts_res_failed; | ||
535 | __u64 ndts_lookups; | ||
536 | __u64 ndts_hits; | ||
537 | __u64 ndts_rcv_probes_mcast; | ||
538 | __u64 ndts_rcv_probes_ucast; | ||
539 | __u64 ndts_periodic_gc_runs; | ||
540 | __u64 ndts_forced_gc_runs; | ||
541 | }; | ||
542 | |||
543 | enum { | ||
544 | NDTPA_UNSPEC, | ||
545 | NDTPA_IFINDEX, /* u32, unchangeable */ | ||
546 | NDTPA_REFCNT, /* u32, read-only */ | ||
547 | NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ | ||
548 | NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ | ||
549 | NDTPA_RETRANS_TIME, /* u64, msecs */ | ||
550 | NDTPA_GC_STALETIME, /* u64, msecs */ | ||
551 | NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ | ||
552 | NDTPA_QUEUE_LEN, /* u32 */ | ||
553 | NDTPA_APP_PROBES, /* u32 */ | ||
554 | NDTPA_UCAST_PROBES, /* u32 */ | ||
555 | NDTPA_MCAST_PROBES, /* u32 */ | ||
556 | NDTPA_ANYCAST_DELAY, /* u64, msecs */ | ||
557 | NDTPA_PROXY_DELAY, /* u64, msecs */ | ||
558 | NDTPA_PROXY_QLEN, /* u32 */ | ||
559 | NDTPA_LOCKTIME, /* u64, msecs */ | ||
560 | __NDTPA_MAX | ||
561 | }; | ||
562 | #define NDTPA_MAX (__NDTPA_MAX - 1) | ||
563 | |||
564 | struct ndtmsg | ||
565 | { | ||
566 | __u8 ndtm_family; | ||
567 | __u8 ndtm_pad1; | ||
568 | __u16 ndtm_pad2; | ||
569 | }; | ||
570 | |||
571 | struct ndt_config | ||
572 | { | ||
573 | __u16 ndtc_key_len; | ||
574 | __u16 ndtc_entry_size; | ||
575 | __u32 ndtc_entries; | ||
576 | __u32 ndtc_last_flush; /* delta to now in msecs */ | ||
577 | __u32 ndtc_last_rand; /* delta to now in msecs */ | ||
578 | __u32 ndtc_hash_rnd; | ||
579 | __u32 ndtc_hash_mask; | ||
580 | __u32 ndtc_hash_chain_gc; | ||
581 | __u32 ndtc_proxy_qlen; | ||
582 | }; | ||
583 | |||
584 | enum { | ||
585 | NDTA_UNSPEC, | ||
586 | NDTA_NAME, /* char *, unchangeable */ | ||
587 | NDTA_THRESH1, /* u32 */ | ||
588 | NDTA_THRESH2, /* u32 */ | ||
589 | NDTA_THRESH3, /* u32 */ | ||
590 | NDTA_CONFIG, /* struct ndt_config, read-only */ | ||
591 | NDTA_PARMS, /* nested TLV NDTPA_* */ | ||
592 | NDTA_STATS, /* struct ndt_stats, read-only */ | ||
593 | NDTA_GC_INTERVAL, /* u64, msecs */ | ||
594 | __NDTA_MAX | ||
595 | }; | ||
596 | #define NDTA_MAX (__NDTA_MAX - 1) | ||
597 | |||
598 | #define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \ | ||
599 | NLMSG_ALIGN(sizeof(struct ndtmsg)))) | ||
600 | #define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg)) | ||
601 | |||
602 | |||
496 | /**** | 603 | /**** |
497 | * General form of address family dependent message. | 604 | * General form of address family dependent message. |
498 | ****/ | 605 | ****/ |
@@ -785,10 +892,82 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
785 | goto rtattr_failure; \ | 892 | goto rtattr_failure; \ |
786 | __rta_fill(skb, attrtype, attrlen, data); }) | 893 | __rta_fill(skb, attrtype, attrlen, data); }) |
787 | 894 | ||
788 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | 895 | #define RTA_APPEND(skb, attrlen, data) \ |
789 | ({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ | 896 | ({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ |
790 | goto rtattr_failure; \ | 897 | goto rtattr_failure; \ |
791 | memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) | 898 | memcpy(skb_put(skb, attrlen), data, attrlen); }) |
899 | |||
900 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | ||
901 | RTA_APPEND(skb, RTA_ALIGN(attrlen), data) | ||
902 | |||
903 | #define RTA_PUT_U8(skb, attrtype, value) \ | ||
904 | ({ u8 _tmp = (value); \ | ||
905 | RTA_PUT(skb, attrtype, sizeof(u8), &_tmp); }) | ||
906 | |||
907 | #define RTA_PUT_U16(skb, attrtype, value) \ | ||
908 | ({ u16 _tmp = (value); \ | ||
909 | RTA_PUT(skb, attrtype, sizeof(u16), &_tmp); }) | ||
910 | |||
911 | #define RTA_PUT_U32(skb, attrtype, value) \ | ||
912 | ({ u32 _tmp = (value); \ | ||
913 | RTA_PUT(skb, attrtype, sizeof(u32), &_tmp); }) | ||
914 | |||
915 | #define RTA_PUT_U64(skb, attrtype, value) \ | ||
916 | ({ u64 _tmp = (value); \ | ||
917 | RTA_PUT(skb, attrtype, sizeof(u64), &_tmp); }) | ||
918 | |||
919 | #define RTA_PUT_SECS(skb, attrtype, value) \ | ||
920 | RTA_PUT_U64(skb, attrtype, (value) / HZ) | ||
921 | |||
922 | #define RTA_PUT_MSECS(skb, attrtype, value) \ | ||
923 | RTA_PUT_U64(skb, attrtype, jiffies_to_msecs(value)) | ||
924 | |||
925 | #define RTA_PUT_STRING(skb, attrtype, value) \ | ||
926 | RTA_PUT(skb, attrtype, strlen(value) + 1, value) | ||
927 | |||
928 | #define RTA_PUT_FLAG(skb, attrtype) \ | ||
929 | RTA_PUT(skb, attrtype, 0, NULL); | ||
930 | |||
931 | #define RTA_NEST(skb, type) \ | ||
932 | ({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ | ||
933 | RTA_PUT(skb, type, 0, NULL); \ | ||
934 | __start; }) | ||
935 | |||
936 | #define RTA_NEST_END(skb, start) \ | ||
937 | ({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ | ||
938 | (skb)->len; }) | ||
939 | |||
940 | #define RTA_NEST_CANCEL(skb, start) \ | ||
941 | ({ if (start) \ | ||
942 | skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ | ||
943 | -1; }) | ||
944 | |||
945 | #define RTA_GET_U8(rta) \ | ||
946 | ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u8)) \ | ||
947 | goto rtattr_failure; \ | ||
948 | *(u8 *) RTA_DATA(rta); }) | ||
949 | |||
950 | #define RTA_GET_U16(rta) \ | ||
951 | ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u16)) \ | ||
952 | goto rtattr_failure; \ | ||
953 | *(u16 *) RTA_DATA(rta); }) | ||
954 | |||
955 | #define RTA_GET_U32(rta) \ | ||
956 | ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \ | ||
957 | goto rtattr_failure; \ | ||
958 | *(u32 *) RTA_DATA(rta); }) | ||
959 | |||
960 | #define RTA_GET_U64(rta) \ | ||
961 | ({ u64 _tmp; \ | ||
962 | if (!rta || RTA_PAYLOAD(rta) < sizeof(u64)) \ | ||
963 | goto rtattr_failure; \ | ||
964 | memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \ | ||
965 | _tmp; }) | ||
966 | |||
967 | #define RTA_GET_FLAG(rta) (!!(rta)) | ||
968 | |||
969 | #define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ) | ||
970 | #define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta))) | ||
792 | 971 | ||
793 | static inline struct rtattr * | 972 | static inline struct rtattr * |
794 | __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) | 973 | __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4dbb109022f3..9530b1903160 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -201,8 +201,8 @@ extern unsigned long | |||
201 | arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, | 201 | arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, |
202 | unsigned long len, unsigned long pgoff, | 202 | unsigned long len, unsigned long pgoff, |
203 | unsigned long flags); | 203 | unsigned long flags); |
204 | extern void arch_unmap_area(struct vm_area_struct *area); | 204 | extern void arch_unmap_area(struct mm_struct *, unsigned long); |
205 | extern void arch_unmap_area_topdown(struct vm_area_struct *area); | 205 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); |
206 | 206 | ||
207 | #define set_mm_counter(mm, member, value) (mm)->_##member = (value) | 207 | #define set_mm_counter(mm, member, value) (mm)->_##member = (value) |
208 | #define get_mm_counter(mm, member) ((mm)->_##member) | 208 | #define get_mm_counter(mm, member) ((mm)->_##member) |
@@ -218,9 +218,10 @@ struct mm_struct { | |||
218 | unsigned long (*get_unmapped_area) (struct file *filp, | 218 | unsigned long (*get_unmapped_area) (struct file *filp, |
219 | unsigned long addr, unsigned long len, | 219 | unsigned long addr, unsigned long len, |
220 | unsigned long pgoff, unsigned long flags); | 220 | unsigned long pgoff, unsigned long flags); |
221 | void (*unmap_area) (struct vm_area_struct *area); | 221 | void (*unmap_area) (struct mm_struct *mm, unsigned long addr); |
222 | unsigned long mmap_base; /* base of mmap area */ | 222 | unsigned long mmap_base; /* base of mmap area */ |
223 | unsigned long free_area_cache; /* first hole */ | 223 | unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ |
224 | unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */ | ||
224 | pgd_t * pgd; | 225 | pgd_t * pgd; |
225 | atomic_t mm_users; /* How many users with user space? */ | 226 | atomic_t mm_users; /* How many users with user space? */ |
226 | atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ | 227 | atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ |
@@ -245,7 +246,7 @@ struct mm_struct { | |||
245 | 246 | ||
246 | unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ | 247 | unsigned long saved_auxv[42]; /* for /proc/PID/auxv */ |
247 | 248 | ||
248 | unsigned dumpable:1; | 249 | unsigned dumpable:2; |
249 | cpumask_t cpu_vm_mask; | 250 | cpumask_t cpu_vm_mask; |
250 | 251 | ||
251 | /* Architecture-specific MM context */ | 252 | /* Architecture-specific MM context */ |
@@ -367,6 +368,11 @@ struct signal_struct { | |||
367 | #endif | 368 | #endif |
368 | }; | 369 | }; |
369 | 370 | ||
371 | /* Context switch must be unlocked if interrupts are to be enabled */ | ||
372 | #ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW | ||
373 | # define __ARCH_WANT_UNLOCKED_CTXSW | ||
374 | #endif | ||
375 | |||
370 | /* | 376 | /* |
371 | * Bits in flags field of signal_struct. | 377 | * Bits in flags field of signal_struct. |
372 | */ | 378 | */ |
@@ -459,10 +465,11 @@ enum idle_type | |||
459 | #define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ | 465 | #define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ |
460 | #define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ | 466 | #define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ |
461 | #define SD_BALANCE_EXEC 4 /* Balance on exec */ | 467 | #define SD_BALANCE_EXEC 4 /* Balance on exec */ |
462 | #define SD_WAKE_IDLE 8 /* Wake to idle CPU on task wakeup */ | 468 | #define SD_BALANCE_FORK 8 /* Balance on fork, clone */ |
463 | #define SD_WAKE_AFFINE 16 /* Wake task to waking CPU */ | 469 | #define SD_WAKE_IDLE 16 /* Wake to idle CPU on task wakeup */ |
464 | #define SD_WAKE_BALANCE 32 /* Perform balancing at task wakeup */ | 470 | #define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ |
465 | #define SD_SHARE_CPUPOWER 64 /* Domain members share cpu power */ | 471 | #define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ |
472 | #define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ | ||
466 | 473 | ||
467 | struct sched_group { | 474 | struct sched_group { |
468 | struct sched_group *next; /* Must be a circular list */ | 475 | struct sched_group *next; /* Must be a circular list */ |
@@ -487,6 +494,11 @@ struct sched_domain { | |||
487 | unsigned long long cache_hot_time; /* Task considered cache hot (ns) */ | 494 | unsigned long long cache_hot_time; /* Task considered cache hot (ns) */ |
488 | unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ | 495 | unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ |
489 | unsigned int per_cpu_gain; /* CPU % gained by adding domain cpus */ | 496 | unsigned int per_cpu_gain; /* CPU % gained by adding domain cpus */ |
497 | unsigned int busy_idx; | ||
498 | unsigned int idle_idx; | ||
499 | unsigned int newidle_idx; | ||
500 | unsigned int wake_idx; | ||
501 | unsigned int forkexec_idx; | ||
490 | int flags; /* See SD_* */ | 502 | int flags; /* See SD_* */ |
491 | 503 | ||
492 | /* Runtime fields. */ | 504 | /* Runtime fields. */ |
@@ -510,10 +522,16 @@ struct sched_domain { | |||
510 | unsigned long alb_failed; | 522 | unsigned long alb_failed; |
511 | unsigned long alb_pushed; | 523 | unsigned long alb_pushed; |
512 | 524 | ||
513 | /* sched_balance_exec() stats */ | 525 | /* SD_BALANCE_EXEC stats */ |
514 | unsigned long sbe_attempts; | 526 | unsigned long sbe_cnt; |
527 | unsigned long sbe_balanced; | ||
515 | unsigned long sbe_pushed; | 528 | unsigned long sbe_pushed; |
516 | 529 | ||
530 | /* SD_BALANCE_FORK stats */ | ||
531 | unsigned long sbf_cnt; | ||
532 | unsigned long sbf_balanced; | ||
533 | unsigned long sbf_pushed; | ||
534 | |||
517 | /* try_to_wake_up() stats */ | 535 | /* try_to_wake_up() stats */ |
518 | unsigned long ttwu_wake_remote; | 536 | unsigned long ttwu_wake_remote; |
519 | unsigned long ttwu_move_affine; | 537 | unsigned long ttwu_move_affine; |
@@ -521,6 +539,8 @@ struct sched_domain { | |||
521 | #endif | 539 | #endif |
522 | }; | 540 | }; |
523 | 541 | ||
542 | extern void partition_sched_domains(cpumask_t *partition1, | ||
543 | cpumask_t *partition2); | ||
524 | #ifdef ARCH_HAS_SCHED_DOMAIN | 544 | #ifdef ARCH_HAS_SCHED_DOMAIN |
525 | /* Useful helpers that arch setup code may use. Defined in kernel/sched.c */ | 545 | /* Useful helpers that arch setup code may use. Defined in kernel/sched.c */ |
526 | extern cpumask_t cpu_isolated_map; | 546 | extern cpumask_t cpu_isolated_map; |
@@ -560,9 +580,10 @@ struct group_info { | |||
560 | groups_free(group_info); \ | 580 | groups_free(group_info); \ |
561 | } while (0) | 581 | } while (0) |
562 | 582 | ||
563 | struct group_info *groups_alloc(int gidsetsize); | 583 | extern struct group_info *groups_alloc(int gidsetsize); |
564 | void groups_free(struct group_info *group_info); | 584 | extern void groups_free(struct group_info *group_info); |
565 | int set_current_groups(struct group_info *group_info); | 585 | extern int set_current_groups(struct group_info *group_info); |
586 | extern int groups_search(struct group_info *group_info, gid_t grp); | ||
566 | /* access the groups "array" with this macro */ | 587 | /* access the groups "array" with this macro */ |
567 | #define GROUP_AT(gi, i) \ | 588 | #define GROUP_AT(gi, i) \ |
568 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) | 589 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) |
@@ -580,6 +601,9 @@ struct task_struct { | |||
580 | 601 | ||
581 | int lock_depth; /* BKL lock depth */ | 602 | int lock_depth; /* BKL lock depth */ |
582 | 603 | ||
604 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) | ||
605 | int oncpu; | ||
606 | #endif | ||
583 | int prio, static_prio; | 607 | int prio, static_prio; |
584 | struct list_head run_list; | 608 | struct list_head run_list; |
585 | prio_array_t *array; | 609 | prio_array_t *array; |
@@ -659,6 +683,7 @@ struct task_struct { | |||
659 | struct user_struct *user; | 683 | struct user_struct *user; |
660 | #ifdef CONFIG_KEYS | 684 | #ifdef CONFIG_KEYS |
661 | struct key *thread_keyring; /* keyring private to this thread */ | 685 | struct key *thread_keyring; /* keyring private to this thread */ |
686 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ | ||
662 | #endif | 687 | #endif |
663 | int oomkilladj; /* OOM kill score adjustment (bit shift). */ | 688 | int oomkilladj; /* OOM kill score adjustment (bit shift). */ |
664 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 689 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
@@ -701,8 +726,6 @@ struct task_struct { | |||
701 | spinlock_t alloc_lock; | 726 | spinlock_t alloc_lock; |
702 | /* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ | 727 | /* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ |
703 | spinlock_t proc_lock; | 728 | spinlock_t proc_lock; |
704 | /* context-switch lock */ | ||
705 | spinlock_t switch_lock; | ||
706 | 729 | ||
707 | /* journalling filesystem info */ | 730 | /* journalling filesystem info */ |
708 | void *journal_info; | 731 | void *journal_info; |
@@ -909,7 +932,7 @@ extern void FASTCALL(wake_up_new_task(struct task_struct * tsk, | |||
909 | #else | 932 | #else |
910 | static inline void kick_process(struct task_struct *tsk) { } | 933 | static inline void kick_process(struct task_struct *tsk) { } |
911 | #endif | 934 | #endif |
912 | extern void FASTCALL(sched_fork(task_t * p)); | 935 | extern void FASTCALL(sched_fork(task_t * p, int clone_flags)); |
913 | extern void FASTCALL(sched_exit(task_t * p)); | 936 | extern void FASTCALL(sched_exit(task_t * p)); |
914 | 937 | ||
915 | extern int in_group_p(gid_t); | 938 | extern int in_group_p(gid_t); |
@@ -1242,33 +1265,78 @@ extern void normalize_rt_tasks(void); | |||
1242 | 1265 | ||
1243 | #endif | 1266 | #endif |
1244 | 1267 | ||
1245 | /* try_to_freeze | ||
1246 | * | ||
1247 | * Checks whether we need to enter the refrigerator | ||
1248 | * and returns 1 if we did so. | ||
1249 | */ | ||
1250 | #ifdef CONFIG_PM | 1268 | #ifdef CONFIG_PM |
1251 | extern void refrigerator(unsigned long); | 1269 | /* |
1270 | * Check if a process has been frozen | ||
1271 | */ | ||
1272 | static inline int frozen(struct task_struct *p) | ||
1273 | { | ||
1274 | return p->flags & PF_FROZEN; | ||
1275 | } | ||
1276 | |||
1277 | /* | ||
1278 | * Check if there is a request to freeze a process | ||
1279 | */ | ||
1280 | static inline int freezing(struct task_struct *p) | ||
1281 | { | ||
1282 | return p->flags & PF_FREEZE; | ||
1283 | } | ||
1284 | |||
1285 | /* | ||
1286 | * Request that a process be frozen | ||
1287 | * FIXME: SMP problem. We may not modify other process' flags! | ||
1288 | */ | ||
1289 | static inline void freeze(struct task_struct *p) | ||
1290 | { | ||
1291 | p->flags |= PF_FREEZE; | ||
1292 | } | ||
1293 | |||
1294 | /* | ||
1295 | * Wake up a frozen process | ||
1296 | */ | ||
1297 | static inline int thaw_process(struct task_struct *p) | ||
1298 | { | ||
1299 | if (frozen(p)) { | ||
1300 | p->flags &= ~PF_FROZEN; | ||
1301 | wake_up_process(p); | ||
1302 | return 1; | ||
1303 | } | ||
1304 | return 0; | ||
1305 | } | ||
1306 | |||
1307 | /* | ||
1308 | * freezing is complete, mark process as frozen | ||
1309 | */ | ||
1310 | static inline void frozen_process(struct task_struct *p) | ||
1311 | { | ||
1312 | p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN; | ||
1313 | } | ||
1314 | |||
1315 | extern void refrigerator(void); | ||
1252 | extern int freeze_processes(void); | 1316 | extern int freeze_processes(void); |
1253 | extern void thaw_processes(void); | 1317 | extern void thaw_processes(void); |
1254 | 1318 | ||
1255 | static inline int try_to_freeze(unsigned long refrigerator_flags) | 1319 | static inline int try_to_freeze(void) |
1256 | { | 1320 | { |
1257 | if (unlikely(current->flags & PF_FREEZE)) { | 1321 | if (freezing(current)) { |
1258 | refrigerator(refrigerator_flags); | 1322 | refrigerator(); |
1259 | return 1; | 1323 | return 1; |
1260 | } else | 1324 | } else |
1261 | return 0; | 1325 | return 0; |
1262 | } | 1326 | } |
1263 | #else | 1327 | #else |
1264 | static inline void refrigerator(unsigned long flag) {} | 1328 | static inline int frozen(struct task_struct *p) { return 0; } |
1329 | static inline int freezing(struct task_struct *p) { return 0; } | ||
1330 | static inline void freeze(struct task_struct *p) { BUG(); } | ||
1331 | static inline int thaw_process(struct task_struct *p) { return 1; } | ||
1332 | static inline void frozen_process(struct task_struct *p) { BUG(); } | ||
1333 | |||
1334 | static inline void refrigerator(void) {} | ||
1265 | static inline int freeze_processes(void) { BUG(); return 0; } | 1335 | static inline int freeze_processes(void) { BUG(); return 0; } |
1266 | static inline void thaw_processes(void) {} | 1336 | static inline void thaw_processes(void) {} |
1267 | 1337 | ||
1268 | static inline int try_to_freeze(unsigned long refrigerator_flags) | 1338 | static inline int try_to_freeze(void) { return 0; } |
1269 | { | 1339 | |
1270 | return 0; | ||
1271 | } | ||
1272 | #endif /* CONFIG_PM */ | 1340 | #endif /* CONFIG_PM */ |
1273 | #endif /* __KERNEL__ */ | 1341 | #endif /* __KERNEL__ */ |
1274 | 1342 | ||
diff --git a/include/linux/signal.h b/include/linux/signal.h index 0a98f5ec5cae..7be18b5e2fb4 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -231,10 +231,8 @@ extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); | |||
231 | extern long do_sigpending(void __user *, unsigned long); | 231 | extern long do_sigpending(void __user *, unsigned long); |
232 | extern int sigprocmask(int, sigset_t *, sigset_t *); | 232 | extern int sigprocmask(int, sigset_t *, sigset_t *); |
233 | 233 | ||
234 | #ifndef HAVE_ARCH_GET_SIGNAL_TO_DELIVER | ||
235 | struct pt_regs; | 234 | struct pt_regs; |
236 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); | 235 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); |
237 | #endif | ||
238 | 236 | ||
239 | #endif /* __KERNEL__ */ | 237 | #endif /* __KERNEL__ */ |
240 | 238 | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index cc04f5cd2286..416a2e4024b2 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/highmem.h> | 27 | #include <linux/highmem.h> |
28 | #include <linux/poll.h> | 28 | #include <linux/poll.h> |
29 | #include <linux/net.h> | 29 | #include <linux/net.h> |
30 | #include <linux/textsearch.h> | ||
30 | #include <net/checksum.h> | 31 | #include <net/checksum.h> |
31 | 32 | ||
32 | #define HAVE_ALLOC_SKB /* For the drivers to know */ | 33 | #define HAVE_ALLOC_SKB /* For the drivers to know */ |
@@ -193,7 +194,6 @@ struct skb_shared_info { | |||
193 | * @nfcache: Cache info | 194 | * @nfcache: Cache info |
194 | * @nfct: Associated connection, if any | 195 | * @nfct: Associated connection, if any |
195 | * @nfctinfo: Relationship of this skb to the connection | 196 | * @nfctinfo: Relationship of this skb to the connection |
196 | * @nf_debug: Netfilter debugging | ||
197 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c | 197 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c |
198 | * @private: Data which is private to the HIPPI implementation | 198 | * @private: Data which is private to the HIPPI implementation |
199 | * @tc_index: Traffic control index | 199 | * @tc_index: Traffic control index |
@@ -264,9 +264,6 @@ struct sk_buff { | |||
264 | __u32 nfcache; | 264 | __u32 nfcache; |
265 | __u32 nfctinfo; | 265 | __u32 nfctinfo; |
266 | struct nf_conntrack *nfct; | 266 | struct nf_conntrack *nfct; |
267 | #ifdef CONFIG_NETFILTER_DEBUG | ||
268 | unsigned int nf_debug; | ||
269 | #endif | ||
270 | #ifdef CONFIG_BRIDGE_NETFILTER | 267 | #ifdef CONFIG_BRIDGE_NETFILTER |
271 | struct nf_bridge_info *nf_bridge; | 268 | struct nf_bridge_info *nf_bridge; |
272 | #endif | 269 | #endif |
@@ -325,6 +322,28 @@ extern void skb_over_panic(struct sk_buff *skb, int len, | |||
325 | extern void skb_under_panic(struct sk_buff *skb, int len, | 322 | extern void skb_under_panic(struct sk_buff *skb, int len, |
326 | void *here); | 323 | void *here); |
327 | 324 | ||
325 | struct skb_seq_state | ||
326 | { | ||
327 | __u32 lower_offset; | ||
328 | __u32 upper_offset; | ||
329 | __u32 frag_idx; | ||
330 | __u32 stepped_offset; | ||
331 | struct sk_buff *root_skb; | ||
332 | struct sk_buff *cur_skb; | ||
333 | __u8 *frag_data; | ||
334 | }; | ||
335 | |||
336 | extern void skb_prepare_seq_read(struct sk_buff *skb, | ||
337 | unsigned int from, unsigned int to, | ||
338 | struct skb_seq_state *st); | ||
339 | extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data, | ||
340 | struct skb_seq_state *st); | ||
341 | extern void skb_abort_seq_read(struct skb_seq_state *st); | ||
342 | |||
343 | extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, | ||
344 | unsigned int to, struct ts_config *config, | ||
345 | struct ts_state *state); | ||
346 | |||
328 | /* Internal */ | 347 | /* Internal */ |
329 | #define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) | 348 | #define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) |
330 | 349 | ||
@@ -1219,15 +1238,6 @@ static inline void nf_reset(struct sk_buff *skb) | |||
1219 | { | 1238 | { |
1220 | nf_conntrack_put(skb->nfct); | 1239 | nf_conntrack_put(skb->nfct); |
1221 | skb->nfct = NULL; | 1240 | skb->nfct = NULL; |
1222 | #ifdef CONFIG_NETFILTER_DEBUG | ||
1223 | skb->nf_debug = 0; | ||
1224 | #endif | ||
1225 | } | ||
1226 | static inline void nf_reset_debug(struct sk_buff *skb) | ||
1227 | { | ||
1228 | #ifdef CONFIG_NETFILTER_DEBUG | ||
1229 | skb->nf_debug = 0; | ||
1230 | #endif | ||
1231 | } | 1241 | } |
1232 | 1242 | ||
1233 | #ifdef CONFIG_BRIDGE_NETFILTER | 1243 | #ifdef CONFIG_BRIDGE_NETFILTER |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 7d66385ae750..76cf7e60216c 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -64,6 +64,7 @@ extern int kmem_cache_shrink(kmem_cache_t *); | |||
64 | extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); | 64 | extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); |
65 | extern void kmem_cache_free(kmem_cache_t *, void *); | 65 | extern void kmem_cache_free(kmem_cache_t *, void *); |
66 | extern unsigned int kmem_cache_size(kmem_cache_t *); | 66 | extern unsigned int kmem_cache_size(kmem_cache_t *); |
67 | extern const char *kmem_cache_name(kmem_cache_t *); | ||
67 | extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags); | 68 | extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags); |
68 | 69 | ||
69 | /* Size description struct for general caches. */ | 70 | /* Size description struct for general caches. */ |
diff --git a/include/linux/smp.h b/include/linux/smp.h index dcf1db3b35d3..9dfa3ee769ae 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -92,10 +92,7 @@ void smp_prepare_boot_cpu(void); | |||
92 | /* | 92 | /* |
93 | * These macros fold the SMP functionality into a single CPU system | 93 | * These macros fold the SMP functionality into a single CPU system |
94 | */ | 94 | */ |
95 | 95 | #define raw_smp_processor_id() 0 | |
96 | #if !defined(__smp_processor_id) || !defined(CONFIG_PREEMPT) | ||
97 | # define smp_processor_id() 0 | ||
98 | #endif | ||
99 | #define hard_smp_processor_id() 0 | 96 | #define hard_smp_processor_id() 0 |
100 | #define smp_call_function(func,info,retry,wait) ({ 0; }) | 97 | #define smp_call_function(func,info,retry,wait) ({ 0; }) |
101 | #define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) | 98 | #define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) |
@@ -106,30 +103,25 @@ static inline void smp_send_reschedule(int cpu) { } | |||
106 | #endif /* !SMP */ | 103 | #endif /* !SMP */ |
107 | 104 | ||
108 | /* | 105 | /* |
109 | * DEBUG_PREEMPT support: check whether smp_processor_id() is being | 106 | * smp_processor_id(): get the current CPU ID. |
110 | * used in a preemption-safe way. | ||
111 | * | 107 | * |
112 | * An architecture has to enable this debugging code explicitly. | 108 | * if DEBUG_PREEMPT is enabled the we check whether it is |
113 | * It can do so by renaming the smp_processor_id() macro to | 109 | * used in a preemption-safe way. (smp_processor_id() is safe |
114 | * __smp_processor_id(). This should only be done after some minimal | 110 | * if it's used in a preemption-off critical section, or in |
115 | * testing, because usually there are a number of false positives | 111 | * a thread that is bound to the current CPU.) |
116 | * that an architecture will trigger. | ||
117 | * | 112 | * |
118 | * To fix a false positive (i.e. smp_processor_id() use that the | 113 | * NOTE: raw_smp_processor_id() is for internal use only |
119 | * debugging code reports but which use for some reason is legal), | 114 | * (smp_processor_id() is the preferred variant), but in rare |
120 | * change the smp_processor_id() reference to _smp_processor_id(), | 115 | * instances it might also be used to turn off false positives |
121 | * which is the nondebug variant. NOTE: don't use this to hack around | 116 | * (i.e. smp_processor_id() use that the debugging code reports but |
122 | * real bugs. | 117 | * which use for some reason is legal). Don't use this to hack around |
118 | * the warning message, as your code might not work under PREEMPT. | ||
123 | */ | 119 | */ |
124 | #ifdef __smp_processor_id | 120 | #ifdef CONFIG_DEBUG_PREEMPT |
125 | # if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT) | 121 | extern unsigned int debug_smp_processor_id(void); |
126 | extern unsigned int smp_processor_id(void); | 122 | # define smp_processor_id() debug_smp_processor_id() |
127 | # else | ||
128 | # define smp_processor_id() __smp_processor_id() | ||
129 | # endif | ||
130 | # define _smp_processor_id() __smp_processor_id() | ||
131 | #else | 123 | #else |
132 | # define _smp_processor_id() smp_processor_id() | 124 | # define smp_processor_id() raw_smp_processor_id() |
133 | #endif | 125 | #endif |
134 | 126 | ||
135 | #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) | 127 | #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) |
diff --git a/include/linux/string.h b/include/linux/string.h index b9fc59469956..93994c613095 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -88,6 +88,8 @@ extern int memcmp(const void *,const void *,__kernel_size_t); | |||
88 | extern void * memchr(const void *,int,__kernel_size_t); | 88 | extern void * memchr(const void *,int,__kernel_size_t); |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | extern char *kstrdup(const char *s, int gfp); | ||
92 | |||
91 | #ifdef __cplusplus | 93 | #ifdef __cplusplus |
92 | } | 94 | } |
93 | #endif | 95 | #endif |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 2709caf4d128..ab151bbb66df 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -111,6 +111,11 @@ struct rpc_procinfo { | |||
111 | struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, | 111 | struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, |
112 | struct rpc_program *info, | 112 | struct rpc_program *info, |
113 | u32 version, rpc_authflavor_t authflavor); | 113 | u32 version, rpc_authflavor_t authflavor); |
114 | struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname, | ||
115 | struct rpc_program *info, | ||
116 | u32 version, rpc_authflavor_t authflavor); | ||
117 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | ||
118 | struct rpc_program *, int); | ||
114 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 119 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
115 | int rpc_shutdown_client(struct rpc_clnt *); | 120 | int rpc_shutdown_client(struct rpc_clnt *); |
116 | int rpc_destroy_client(struct rpc_clnt *); | 121 | int rpc_destroy_client(struct rpc_clnt *); |
@@ -129,6 +134,7 @@ void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset); | |||
129 | void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); | 134 | void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); |
130 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); | 135 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); |
131 | size_t rpc_max_payload(struct rpc_clnt *); | 136 | size_t rpc_max_payload(struct rpc_clnt *); |
137 | int rpc_ping(struct rpc_clnt *clnt, int flags); | ||
132 | 138 | ||
133 | static __inline__ | 139 | static __inline__ |
134 | int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags) | 140 | int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags) |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 99d17ed7cebb..4d77e90d0b30 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -31,7 +31,6 @@ struct rpc_wait_queue; | |||
31 | struct rpc_wait { | 31 | struct rpc_wait { |
32 | struct list_head list; /* wait queue links */ | 32 | struct list_head list; /* wait queue links */ |
33 | struct list_head links; /* Links to related tasks */ | 33 | struct list_head links; /* Links to related tasks */ |
34 | wait_queue_head_t waitq; /* sync: sleep on this q */ | ||
35 | struct rpc_wait_queue * rpc_waitq; /* RPC wait queue we're on */ | 34 | struct rpc_wait_queue * rpc_waitq; /* RPC wait queue we're on */ |
36 | }; | 35 | }; |
37 | 36 | ||
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 37003970cf2e..5af8800e0ce3 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -185,6 +185,17 @@ xdr_ressize_check(struct svc_rqst *rqstp, u32 *p) | |||
185 | return vec->iov_len <= PAGE_SIZE; | 185 | return vec->iov_len <= PAGE_SIZE; |
186 | } | 186 | } |
187 | 187 | ||
188 | static inline struct page * | ||
189 | svc_take_res_page(struct svc_rqst *rqstp) | ||
190 | { | ||
191 | if (rqstp->rq_arghi <= rqstp->rq_argused) | ||
192 | return NULL; | ||
193 | rqstp->rq_arghi--; | ||
194 | rqstp->rq_respages[rqstp->rq_resused] = | ||
195 | rqstp->rq_argpages[rqstp->rq_arghi]; | ||
196 | return rqstp->rq_respages[rqstp->rq_resused++]; | ||
197 | } | ||
198 | |||
188 | static inline int svc_take_page(struct svc_rqst *rqstp) | 199 | static inline int svc_take_page(struct svc_rqst *rqstp) |
189 | { | 200 | { |
190 | if (rqstp->rq_arghi <= rqstp->rq_argused) | 201 | if (rqstp->rq_arghi <= rqstp->rq_argused) |
@@ -240,9 +251,10 @@ struct svc_deferred_req { | |||
240 | }; | 251 | }; |
241 | 252 | ||
242 | /* | 253 | /* |
243 | * RPC program | 254 | * List of RPC programs on the same transport endpoint |
244 | */ | 255 | */ |
245 | struct svc_program { | 256 | struct svc_program { |
257 | struct svc_program * pg_next; /* other programs (same xprt) */ | ||
246 | u32 pg_prog; /* program number */ | 258 | u32 pg_prog; /* program number */ |
247 | unsigned int pg_lovers; /* lowest version */ | 259 | unsigned int pg_lovers; /* lowest version */ |
248 | unsigned int pg_hivers; /* lowest version */ | 260 | unsigned int pg_hivers; /* lowest version */ |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 541dcf838abf..34ec3e8d99b3 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -146,7 +146,8 @@ extern void xdr_shift_buf(struct xdr_buf *, size_t); | |||
146 | extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); | 146 | extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); |
147 | extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, int, int); | 147 | extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, int, int); |
148 | extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, int); | 148 | extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, int); |
149 | extern int read_bytes_from_xdr_buf(struct xdr_buf *buf, int base, void *obj, int len); | 149 | extern int read_bytes_from_xdr_buf(struct xdr_buf *, int, void *, int); |
150 | extern int write_bytes_to_xdr_buf(struct xdr_buf *, int, void *, int); | ||
150 | 151 | ||
151 | /* | 152 | /* |
152 | * Helper structure for copying from an sk_buff. | 153 | * Helper structure for copying from an sk_buff. |
@@ -160,7 +161,7 @@ typedef struct { | |||
160 | 161 | ||
161 | typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len); | 162 | typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len); |
162 | 163 | ||
163 | extern void xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int, | 164 | extern ssize_t xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int, |
164 | skb_reader_t *, skb_read_actor_t); | 165 | skb_reader_t *, skb_read_actor_t); |
165 | 166 | ||
166 | struct socket; | 167 | struct socket; |
@@ -168,6 +169,22 @@ struct sockaddr; | |||
168 | extern int xdr_sendpages(struct socket *, struct sockaddr *, int, | 169 | extern int xdr_sendpages(struct socket *, struct sockaddr *, int, |
169 | struct xdr_buf *, unsigned int, int); | 170 | struct xdr_buf *, unsigned int, int); |
170 | 171 | ||
172 | extern int xdr_encode_word(struct xdr_buf *, int, u32); | ||
173 | extern int xdr_decode_word(struct xdr_buf *, int, u32 *); | ||
174 | |||
175 | struct xdr_array2_desc; | ||
176 | typedef int (*xdr_xcode_elem_t)(struct xdr_array2_desc *desc, void *elem); | ||
177 | struct xdr_array2_desc { | ||
178 | unsigned int elem_size; | ||
179 | unsigned int array_len; | ||
180 | xdr_xcode_elem_t xcode; | ||
181 | }; | ||
182 | |||
183 | extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base, | ||
184 | struct xdr_array2_desc *desc); | ||
185 | extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, | ||
186 | struct xdr_array2_desc *desc); | ||
187 | |||
171 | /* | 188 | /* |
172 | * Provide some simple tools for XDR buffer overflow-checking etc. | 189 | * Provide some simple tools for XDR buffer overflow-checking etc. |
173 | */ | 190 | */ |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 2bf0d5fabcdb..f2e96fdfaae0 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -58,7 +58,7 @@ static inline int software_suspend(void) | |||
58 | } | 58 | } |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #ifdef CONFIG_SMP | 61 | #ifdef CONFIG_SUSPEND_SMP |
62 | extern void disable_nonboot_cpus(void); | 62 | extern void disable_nonboot_cpus(void); |
63 | extern void enable_nonboot_cpus(void); | 63 | extern void enable_nonboot_cpus(void); |
64 | #else | 64 | #else |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 3bbc41be9bd0..2343f999e6e1 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -172,7 +172,8 @@ extern int rotate_reclaimable_page(struct page *page); | |||
172 | extern void swap_setup(void); | 172 | extern void swap_setup(void); |
173 | 173 | ||
174 | /* linux/mm/vmscan.c */ | 174 | /* linux/mm/vmscan.c */ |
175 | extern int try_to_free_pages(struct zone **, unsigned int, unsigned int); | 175 | extern int try_to_free_pages(struct zone **, unsigned int); |
176 | extern int zone_reclaim(struct zone *, unsigned int, unsigned int); | ||
176 | extern int shrink_all_memory(int); | 177 | extern int shrink_all_memory(int); |
177 | extern int vm_swappiness; | 178 | extern int vm_swappiness; |
178 | 179 | ||
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index c39f6f72cbbc..52830b6d94e5 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -159,8 +159,9 @@ asmlinkage long sys_shutdown(int, int); | |||
159 | asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, | 159 | asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, |
160 | void __user *arg); | 160 | void __user *arg); |
161 | asmlinkage long sys_restart_syscall(void); | 161 | asmlinkage long sys_restart_syscall(void); |
162 | asmlinkage long sys_kexec_load(void *entry, unsigned long nr_segments, | 162 | asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, |
163 | struct kexec_segment *segments, unsigned long flags); | 163 | struct kexec_segment __user *segments, |
164 | unsigned long flags); | ||
164 | 165 | ||
165 | asmlinkage long sys_exit(int error_code); | 166 | asmlinkage long sys_exit(int error_code); |
166 | asmlinkage void sys_exit_group(int error_code); | 167 | asmlinkage void sys_exit_group(int error_code); |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 772998147e3e..ebfe1250f0a4 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -136,6 +136,7 @@ enum | |||
136 | KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ | 136 | KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ |
137 | KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ | 137 | KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ |
138 | KERN_RANDOMIZE=68, /* int: randomize virtual address space */ | 138 | KERN_RANDOMIZE=68, /* int: randomize virtual address space */ |
139 | KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ | ||
139 | }; | 140 | }; |
140 | 141 | ||
141 | 142 | ||
@@ -242,6 +243,7 @@ enum | |||
242 | NET_CORE_MOD_CONG=16, | 243 | NET_CORE_MOD_CONG=16, |
243 | NET_CORE_DEV_WEIGHT=17, | 244 | NET_CORE_DEV_WEIGHT=17, |
244 | NET_CORE_SOMAXCONN=18, | 245 | NET_CORE_SOMAXCONN=18, |
246 | NET_CORE_BUDGET=19, | ||
245 | }; | 247 | }; |
246 | 248 | ||
247 | /* /proc/sys/net/ethernet */ | 249 | /* /proc/sys/net/ethernet */ |
@@ -332,20 +334,14 @@ enum | |||
332 | NET_TCP_FRTO=92, | 334 | NET_TCP_FRTO=92, |
333 | NET_TCP_LOW_LATENCY=93, | 335 | NET_TCP_LOW_LATENCY=93, |
334 | NET_IPV4_IPFRAG_SECRET_INTERVAL=94, | 336 | NET_IPV4_IPFRAG_SECRET_INTERVAL=94, |
335 | NET_TCP_WESTWOOD=95, | ||
336 | NET_IPV4_IGMP_MAX_MSF=96, | 337 | NET_IPV4_IGMP_MAX_MSF=96, |
337 | NET_TCP_NO_METRICS_SAVE=97, | 338 | NET_TCP_NO_METRICS_SAVE=97, |
338 | NET_TCP_VEGAS=98, | ||
339 | NET_TCP_VEGAS_ALPHA=99, | ||
340 | NET_TCP_VEGAS_BETA=100, | ||
341 | NET_TCP_VEGAS_GAMMA=101, | ||
342 | NET_TCP_BIC=102, | ||
343 | NET_TCP_BIC_FAST_CONVERGENCE=103, | ||
344 | NET_TCP_BIC_LOW_WINDOW=104, | ||
345 | NET_TCP_DEFAULT_WIN_SCALE=105, | 339 | NET_TCP_DEFAULT_WIN_SCALE=105, |
346 | NET_TCP_MODERATE_RCVBUF=106, | 340 | NET_TCP_MODERATE_RCVBUF=106, |
347 | NET_TCP_TSO_WIN_DIVISOR=107, | 341 | NET_TCP_TSO_WIN_DIVISOR=107, |
348 | NET_TCP_BIC_BETA=108, | 342 | NET_TCP_BIC_BETA=108, |
343 | NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, | ||
344 | NET_TCP_CONG_CONTROL=110, | ||
349 | }; | 345 | }; |
350 | 346 | ||
351 | enum { | 347 | enum { |
@@ -399,6 +395,7 @@ enum | |||
399 | NET_IPV4_CONF_FORCE_IGMP_VERSION=17, | 395 | NET_IPV4_CONF_FORCE_IGMP_VERSION=17, |
400 | NET_IPV4_CONF_ARP_ANNOUNCE=18, | 396 | NET_IPV4_CONF_ARP_ANNOUNCE=18, |
401 | NET_IPV4_CONF_ARP_IGNORE=19, | 397 | NET_IPV4_CONF_ARP_IGNORE=19, |
398 | NET_IPV4_CONF_PROMOTE_SECONDARIES=20, | ||
402 | __NET_IPV4_CONF_MAX | 399 | __NET_IPV4_CONF_MAX |
403 | }; | 400 | }; |
404 | 401 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 38b58b30814a..392da5a6dacb 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -16,13 +16,13 @@ struct kobject; | |||
16 | struct module; | 16 | struct module; |
17 | 17 | ||
18 | struct attribute { | 18 | struct attribute { |
19 | char * name; | 19 | const char * name; |
20 | struct module * owner; | 20 | struct module * owner; |
21 | mode_t mode; | 21 | mode_t mode; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | struct attribute_group { | 24 | struct attribute_group { |
25 | char * name; | 25 | const char * name; |
26 | struct attribute ** attrs; | 26 | struct attribute ** attrs; |
27 | }; | 27 | }; |
28 | 28 | ||
@@ -73,6 +73,7 @@ struct sysfs_dirent { | |||
73 | int s_type; | 73 | int s_type; |
74 | umode_t s_mode; | 74 | umode_t s_mode; |
75 | struct dentry * s_dentry; | 75 | struct dentry * s_dentry; |
76 | struct iattr * s_iattr; | ||
76 | }; | 77 | }; |
77 | 78 | ||
78 | #define SYSFS_ROOT 0x0001 | 79 | #define SYSFS_ROOT 0x0001 |
@@ -105,11 +106,11 @@ sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); | |||
105 | extern void | 106 | extern void |
106 | sysfs_remove_file(struct kobject *, const struct attribute *); | 107 | sysfs_remove_file(struct kobject *, const struct attribute *); |
107 | 108 | ||
108 | extern int | 109 | extern int |
109 | sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name); | 110 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); |
110 | 111 | ||
111 | extern void | 112 | extern void |
112 | sysfs_remove_link(struct kobject *, char * name); | 113 | sysfs_remove_link(struct kobject *, const char * name); |
113 | 114 | ||
114 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); | 115 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); |
115 | int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); | 116 | int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); |
@@ -153,12 +154,12 @@ static inline void sysfs_remove_file(struct kobject * k, const struct attribute | |||
153 | ; | 154 | ; |
154 | } | 155 | } |
155 | 156 | ||
156 | static inline int sysfs_create_link(struct kobject * k, struct kobject * t, char * n) | 157 | static inline int sysfs_create_link(struct kobject * k, struct kobject * t, const char * n) |
157 | { | 158 | { |
158 | return 0; | 159 | return 0; |
159 | } | 160 | } |
160 | 161 | ||
161 | static inline void sysfs_remove_link(struct kobject * k, char * name) | 162 | static inline void sysfs_remove_link(struct kobject * k, const char * name) |
162 | { | 163 | { |
163 | ; | 164 | ; |
164 | } | 165 | } |
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h index aa6b48bb4dcd..a6b2cc530af5 100644 --- a/include/linux/tc_ematch/tc_em_meta.h +++ b/include/linux/tc_ematch/tc_em_meta.h | |||
@@ -56,6 +56,36 @@ enum | |||
56 | TCF_META_ID_TCCLASSID, | 56 | TCF_META_ID_TCCLASSID, |
57 | TCF_META_ID_RTCLASSID, | 57 | TCF_META_ID_RTCLASSID, |
58 | TCF_META_ID_RTIIF, | 58 | TCF_META_ID_RTIIF, |
59 | TCF_META_ID_SK_FAMILY, | ||
60 | TCF_META_ID_SK_STATE, | ||
61 | TCF_META_ID_SK_REUSE, | ||
62 | TCF_META_ID_SK_BOUND_IF, | ||
63 | TCF_META_ID_SK_REFCNT, | ||
64 | TCF_META_ID_SK_SHUTDOWN, | ||
65 | TCF_META_ID_SK_PROTO, | ||
66 | TCF_META_ID_SK_TYPE, | ||
67 | TCF_META_ID_SK_RCVBUF, | ||
68 | TCF_META_ID_SK_RMEM_ALLOC, | ||
69 | TCF_META_ID_SK_WMEM_ALLOC, | ||
70 | TCF_META_ID_SK_OMEM_ALLOC, | ||
71 | TCF_META_ID_SK_WMEM_QUEUED, | ||
72 | TCF_META_ID_SK_RCV_QLEN, | ||
73 | TCF_META_ID_SK_SND_QLEN, | ||
74 | TCF_META_ID_SK_ERR_QLEN, | ||
75 | TCF_META_ID_SK_FORWARD_ALLOCS, | ||
76 | TCF_META_ID_SK_SNDBUF, | ||
77 | TCF_META_ID_SK_ALLOCS, | ||
78 | TCF_META_ID_SK_ROUTE_CAPS, | ||
79 | TCF_META_ID_SK_HASHENT, | ||
80 | TCF_META_ID_SK_LINGERTIME, | ||
81 | TCF_META_ID_SK_ACK_BACKLOG, | ||
82 | TCF_META_ID_SK_MAX_ACK_BACKLOG, | ||
83 | TCF_META_ID_SK_PRIO, | ||
84 | TCF_META_ID_SK_RCVLOWAT, | ||
85 | TCF_META_ID_SK_RCVTIMEO, | ||
86 | TCF_META_ID_SK_SNDTIMEO, | ||
87 | TCF_META_ID_SK_SENDMSG_OFF, | ||
88 | TCF_META_ID_SK_WRITE_PENDING, | ||
59 | __TCF_META_ID_MAX | 89 | __TCF_META_ID_MAX |
60 | }; | 90 | }; |
61 | #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) | 91 | #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) |
diff --git a/include/linux/tc_ematch/tc_em_text.h b/include/linux/tc_ematch/tc_em_text.h new file mode 100644 index 000000000000..7cd43e99c7f5 --- /dev/null +++ b/include/linux/tc_ematch/tc_em_text.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __LINUX_TC_EM_TEXT_H | ||
2 | #define __LINUX_TC_EM_TEXT_H | ||
3 | |||
4 | #include <linux/pkt_cls.h> | ||
5 | |||
6 | #define TC_EM_TEXT_ALGOSIZ 16 | ||
7 | |||
8 | struct tcf_em_text | ||
9 | { | ||
10 | char algo[TC_EM_TEXT_ALGOSIZ]; | ||
11 | __u16 from_offset; | ||
12 | __u16 to_offset; | ||
13 | __u16 pattern_len; | ||
14 | __u8 from_layer:4; | ||
15 | __u8 to_layer:4; | ||
16 | __u8 pad; | ||
17 | }; | ||
18 | |||
19 | #endif | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 14a55e3e3a50..dfd93d03f5d2 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -127,6 +127,7 @@ enum { | |||
127 | #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ | 127 | #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ |
128 | #define TCP_INFO 11 /* Information about this connection. */ | 128 | #define TCP_INFO 11 /* Information about this connection. */ |
129 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ | 129 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ |
130 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ | ||
130 | 131 | ||
131 | #define TCPI_OPT_TIMESTAMPS 1 | 132 | #define TCPI_OPT_TIMESTAMPS 1 |
132 | #define TCPI_OPT_SACK 2 | 133 | #define TCPI_OPT_SACK 2 |
@@ -203,13 +204,6 @@ struct tcp_sack_block { | |||
203 | __u32 end_seq; | 204 | __u32 end_seq; |
204 | }; | 205 | }; |
205 | 206 | ||
206 | enum tcp_congestion_algo { | ||
207 | TCP_RENO=0, | ||
208 | TCP_VEGAS, | ||
209 | TCP_WESTWOOD, | ||
210 | TCP_BIC, | ||
211 | }; | ||
212 | |||
213 | struct tcp_options_received { | 207 | struct tcp_options_received { |
214 | /* PAWS/RTTM data */ | 208 | /* PAWS/RTTM data */ |
215 | long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ | 209 | long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ |
@@ -230,6 +224,17 @@ struct tcp_options_received { | |||
230 | __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ | 224 | __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ |
231 | }; | 225 | }; |
232 | 226 | ||
227 | struct tcp_request_sock { | ||
228 | struct inet_request_sock req; | ||
229 | __u32 rcv_isn; | ||
230 | __u32 snt_isn; | ||
231 | }; | ||
232 | |||
233 | static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) | ||
234 | { | ||
235 | return (struct tcp_request_sock *)req; | ||
236 | } | ||
237 | |||
233 | struct tcp_sock { | 238 | struct tcp_sock { |
234 | /* inet_sock has to be the first member of tcp_sock */ | 239 | /* inet_sock has to be the first member of tcp_sock */ |
235 | struct inet_sock inet; | 240 | struct inet_sock inet; |
@@ -294,7 +299,7 @@ struct tcp_sock { | |||
294 | __u8 reordering; /* Packet reordering metric. */ | 299 | __u8 reordering; /* Packet reordering metric. */ |
295 | __u8 frto_counter; /* Number of new acks after RTO */ | 300 | __u8 frto_counter; /* Number of new acks after RTO */ |
296 | 301 | ||
297 | __u8 adv_cong; /* Using Vegas, Westwood, or BIC */ | 302 | __u8 unused; |
298 | __u8 defer_accept; /* User waits for some data after accept() */ | 303 | __u8 defer_accept; /* User waits for some data after accept() */ |
299 | 304 | ||
300 | /* RTT measurement */ | 305 | /* RTT measurement */ |
@@ -368,22 +373,7 @@ struct tcp_sock { | |||
368 | 373 | ||
369 | __u32 total_retrans; /* Total retransmits for entire connection */ | 374 | __u32 total_retrans; /* Total retransmits for entire connection */ |
370 | 375 | ||
371 | /* The syn_wait_lock is necessary only to avoid proc interface having | 376 | struct request_sock_queue accept_queue; /* FIFO of established children */ |
372 | * to grab the main lock sock while browsing the listening hash | ||
373 | * (otherwise it's deadlock prone). | ||
374 | * This lock is acquired in read mode only from listening_get_next() | ||
375 | * and it's acquired in write mode _only_ from code that is actively | ||
376 | * changing the syn_wait_queue. All readers that are holding | ||
377 | * the master sock lock don't need to grab this lock in read mode | ||
378 | * too as the syn_wait_queue writes are always protected from | ||
379 | * the main sock lock. | ||
380 | */ | ||
381 | rwlock_t syn_wait_lock; | ||
382 | struct tcp_listen_opt *listen_opt; | ||
383 | |||
384 | /* FIFO of established children */ | ||
385 | struct open_request *accept_queue; | ||
386 | struct open_request *accept_queue_tail; | ||
387 | 377 | ||
388 | unsigned int keepalive_time; /* time before keep alive takes place */ | 378 | unsigned int keepalive_time; /* time before keep alive takes place */ |
389 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ | 379 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ |
@@ -405,37 +395,10 @@ struct tcp_sock { | |||
405 | __u32 time; | 395 | __u32 time; |
406 | } rcvq_space; | 396 | } rcvq_space; |
407 | 397 | ||
408 | /* TCP Westwood structure */ | 398 | /* Pluggable TCP congestion control hook */ |
409 | struct { | 399 | struct tcp_congestion_ops *ca_ops; |
410 | __u32 bw_ns_est; /* first bandwidth estimation..not too smoothed 8) */ | 400 | u32 ca_priv[16]; |
411 | __u32 bw_est; /* bandwidth estimate */ | 401 | #define TCP_CA_PRIV_SIZE (16*sizeof(u32)) |
412 | __u32 rtt_win_sx; /* here starts a new evaluation... */ | ||
413 | __u32 bk; | ||
414 | __u32 snd_una; /* used for evaluating the number of acked bytes */ | ||
415 | __u32 cumul_ack; | ||
416 | __u32 accounted; | ||
417 | __u32 rtt; | ||
418 | __u32 rtt_min; /* minimum observed RTT */ | ||
419 | } westwood; | ||
420 | |||
421 | /* Vegas variables */ | ||
422 | struct { | ||
423 | __u32 beg_snd_nxt; /* right edge during last RTT */ | ||
424 | __u32 beg_snd_una; /* left edge during last RTT */ | ||
425 | __u32 beg_snd_cwnd; /* saves the size of the cwnd */ | ||
426 | __u8 doing_vegas_now;/* if true, do vegas for this RTT */ | ||
427 | __u16 cntRTT; /* # of RTTs measured within last RTT */ | ||
428 | __u32 minRTT; /* min of RTTs measured within last RTT (in usec) */ | ||
429 | __u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */ | ||
430 | } vegas; | ||
431 | |||
432 | /* BI TCP Parameters */ | ||
433 | struct { | ||
434 | __u32 cnt; /* increase cwnd by 1 after this number of ACKs */ | ||
435 | __u32 last_max_cwnd; /* last maximium snd_cwnd */ | ||
436 | __u32 last_cwnd; /* the last snd_cwnd */ | ||
437 | __u32 last_stamp; /* time when updated last_cwnd */ | ||
438 | } bictcp; | ||
439 | }; | 402 | }; |
440 | 403 | ||
441 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 404 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
@@ -443,6 +406,11 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk) | |||
443 | return (struct tcp_sock *)sk; | 406 | return (struct tcp_sock *)sk; |
444 | } | 407 | } |
445 | 408 | ||
409 | static inline void *tcp_ca(const struct tcp_sock *tp) | ||
410 | { | ||
411 | return (void *) tp->ca_priv; | ||
412 | } | ||
413 | |||
446 | #endif | 414 | #endif |
447 | 415 | ||
448 | #endif /* _LINUX_TCP_H */ | 416 | #endif /* _LINUX_TCP_H */ |
diff --git a/include/linux/tcp_diag.h b/include/linux/tcp_diag.h index ceee962e1d15..7a5996743946 100644 --- a/include/linux/tcp_diag.h +++ b/include/linux/tcp_diag.h | |||
@@ -99,9 +99,10 @@ enum | |||
99 | TCPDIAG_MEMINFO, | 99 | TCPDIAG_MEMINFO, |
100 | TCPDIAG_INFO, | 100 | TCPDIAG_INFO, |
101 | TCPDIAG_VEGASINFO, | 101 | TCPDIAG_VEGASINFO, |
102 | TCPDIAG_CONG, | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | #define TCPDIAG_MAX TCPDIAG_VEGASINFO | 105 | #define TCPDIAG_MAX TCPDIAG_CONG |
105 | 106 | ||
106 | 107 | ||
107 | /* TCPDIAG_MEM */ | 108 | /* TCPDIAG_MEM */ |
@@ -123,5 +124,4 @@ struct tcpvegas_info { | |||
123 | __u32 tcpv_minrtt; | 124 | __u32 tcpv_minrtt; |
124 | }; | 125 | }; |
125 | 126 | ||
126 | |||
127 | #endif /* _TCP_DIAG_H_ */ | 127 | #endif /* _TCP_DIAG_H_ */ |
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h new file mode 100644 index 000000000000..941f45ac117a --- /dev/null +++ b/include/linux/textsearch.h | |||
@@ -0,0 +1,180 @@ | |||
1 | #ifndef __LINUX_TEXTSEARCH_H | ||
2 | #define __LINUX_TEXTSEARCH_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/types.h> | ||
7 | #include <linux/list.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/err.h> | ||
11 | |||
12 | struct ts_config; | ||
13 | |||
14 | /** | ||
15 | * TS_AUTOLOAD - Automatically load textsearch modules when needed | ||
16 | */ | ||
17 | #define TS_AUTOLOAD 1 | ||
18 | |||
19 | /** | ||
20 | * struct ts_state - search state | ||
21 | * @offset: offset for next match | ||
22 | * @cb: control buffer, for persistant variables of get_next_block() | ||
23 | */ | ||
24 | struct ts_state | ||
25 | { | ||
26 | unsigned int offset; | ||
27 | char cb[40]; | ||
28 | }; | ||
29 | |||
30 | /** | ||
31 | * struct ts_ops - search module operations | ||
32 | * @name: name of search algorithm | ||
33 | * @init: initialization function to prepare a search | ||
34 | * @find: find the next occurrence of the pattern | ||
35 | * @destroy: destroy algorithm specific parts of a search configuration | ||
36 | * @get_pattern: return head of pattern | ||
37 | * @get_pattern_len: return length of pattern | ||
38 | * @owner: module reference to algorithm | ||
39 | */ | ||
40 | struct ts_ops | ||
41 | { | ||
42 | const char *name; | ||
43 | struct ts_config * (*init)(const void *, unsigned int, int); | ||
44 | unsigned int (*find)(struct ts_config *, | ||
45 | struct ts_state *); | ||
46 | void (*destroy)(struct ts_config *); | ||
47 | void * (*get_pattern)(struct ts_config *); | ||
48 | unsigned int (*get_pattern_len)(struct ts_config *); | ||
49 | struct module *owner; | ||
50 | struct list_head list; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * struct ts_config - search configuration | ||
55 | * @ops: operations of chosen algorithm | ||
56 | * @get_next_block: callback to fetch the next block to search in | ||
57 | * @finish: callback to finalize a search | ||
58 | */ | ||
59 | struct ts_config | ||
60 | { | ||
61 | struct ts_ops *ops; | ||
62 | |||
63 | /** | ||
64 | * get_next_block - fetch next block of data | ||
65 | * @consumed: number of bytes consumed by the caller | ||
66 | * @dst: destination buffer | ||
67 | * @conf: search configuration | ||
68 | * @state: search state | ||
69 | * | ||
70 | * Called repeatedly until 0 is returned. Must assign the | ||
71 | * head of the next block of data to &*dst and return the length | ||
72 | * of the block or 0 if at the end. consumed == 0 indicates | ||
73 | * a new search. May store/read persistant values in state->cb. | ||
74 | */ | ||
75 | unsigned int (*get_next_block)(unsigned int consumed, | ||
76 | const u8 **dst, | ||
77 | struct ts_config *conf, | ||
78 | struct ts_state *state); | ||
79 | |||
80 | /** | ||
81 | * finish - finalize/clean a series of get_next_block() calls | ||
82 | * @conf: search configuration | ||
83 | * @state: search state | ||
84 | * | ||
85 | * Called after the last use of get_next_block(), may be used | ||
86 | * to cleanup any leftovers. | ||
87 | */ | ||
88 | void (*finish)(struct ts_config *conf, | ||
89 | struct ts_state *state); | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * textsearch_next - continue searching for a pattern | ||
94 | * @conf: search configuration | ||
95 | * @state: search state | ||
96 | * | ||
97 | * Continues a search looking for more occurrences of the pattern. | ||
98 | * textsearch_find() must be called to find the first occurrence | ||
99 | * in order to reset the state. | ||
100 | * | ||
101 | * Returns the position of the next occurrence of the pattern or | ||
102 | * UINT_MAX if not match was found. | ||
103 | */ | ||
104 | static inline unsigned int textsearch_next(struct ts_config *conf, | ||
105 | struct ts_state *state) | ||
106 | { | ||
107 | unsigned int ret = conf->ops->find(conf, state); | ||
108 | |||
109 | if (conf->finish) | ||
110 | conf->finish(conf, state); | ||
111 | |||
112 | return ret; | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * textsearch_find - start searching for a pattern | ||
117 | * @conf: search configuration | ||
118 | * @state: search state | ||
119 | * | ||
120 | * Returns the position of first occurrence of the pattern or | ||
121 | * UINT_MAX if no match was found. | ||
122 | */ | ||
123 | static inline unsigned int textsearch_find(struct ts_config *conf, | ||
124 | struct ts_state *state) | ||
125 | { | ||
126 | state->offset = 0; | ||
127 | return textsearch_next(conf, state); | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * textsearch_get_pattern - return head of the pattern | ||
132 | * @conf: search configuration | ||
133 | */ | ||
134 | static inline void *textsearch_get_pattern(struct ts_config *conf) | ||
135 | { | ||
136 | return conf->ops->get_pattern(conf); | ||
137 | } | ||
138 | |||
139 | /** | ||
140 | * textsearch_get_pattern_len - return length of the pattern | ||
141 | * @conf: search configuration | ||
142 | */ | ||
143 | static inline unsigned int textsearch_get_pattern_len(struct ts_config *conf) | ||
144 | { | ||
145 | return conf->ops->get_pattern_len(conf); | ||
146 | } | ||
147 | |||
148 | extern int textsearch_register(struct ts_ops *); | ||
149 | extern int textsearch_unregister(struct ts_ops *); | ||
150 | extern struct ts_config *textsearch_prepare(const char *, const void *, | ||
151 | unsigned int, int, int); | ||
152 | extern void textsearch_destroy(struct ts_config *conf); | ||
153 | extern unsigned int textsearch_find_continuous(struct ts_config *, | ||
154 | struct ts_state *, | ||
155 | const void *, unsigned int); | ||
156 | |||
157 | |||
158 | #define TS_PRIV_ALIGNTO 8 | ||
159 | #define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) | ||
160 | |||
161 | static inline struct ts_config *alloc_ts_config(size_t payload, int gfp_mask) | ||
162 | { | ||
163 | struct ts_config *conf; | ||
164 | |||
165 | conf = kmalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask); | ||
166 | if (conf == NULL) | ||
167 | return ERR_PTR(-ENOMEM); | ||
168 | |||
169 | memset(conf, 0, TS_PRIV_ALIGN(sizeof(*conf)) + payload); | ||
170 | return conf; | ||
171 | } | ||
172 | |||
173 | static inline void *ts_config_priv(struct ts_config *conf) | ||
174 | { | ||
175 | return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); | ||
176 | } | ||
177 | |||
178 | #endif /* __KERNEL__ */ | ||
179 | |||
180 | #endif | ||
diff --git a/include/linux/textsearch_fsm.h b/include/linux/textsearch_fsm.h new file mode 100644 index 000000000000..fdfa078c66e5 --- /dev/null +++ b/include/linux/textsearch_fsm.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef __LINUX_TEXTSEARCH_FSM_H | ||
2 | #define __LINUX_TEXTSEARCH_FSM_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | TS_FSM_SPECIFIC, /* specific character */ | ||
8 | TS_FSM_WILDCARD, /* any character */ | ||
9 | TS_FSM_DIGIT, /* isdigit() */ | ||
10 | TS_FSM_XDIGIT, /* isxdigit() */ | ||
11 | TS_FSM_PRINT, /* isprint() */ | ||
12 | TS_FSM_ALPHA, /* isalpha() */ | ||
13 | TS_FSM_ALNUM, /* isalnum() */ | ||
14 | TS_FSM_ASCII, /* isascii() */ | ||
15 | TS_FSM_CNTRL, /* iscntrl() */ | ||
16 | TS_FSM_GRAPH, /* isgraph() */ | ||
17 | TS_FSM_LOWER, /* islower() */ | ||
18 | TS_FSM_UPPER, /* isupper() */ | ||
19 | TS_FSM_PUNCT, /* ispunct() */ | ||
20 | TS_FSM_SPACE, /* isspace() */ | ||
21 | __TS_FSM_TYPE_MAX, | ||
22 | }; | ||
23 | #define TS_FSM_TYPE_MAX (__TS_FSM_TYPE_MAX - 1) | ||
24 | |||
25 | enum { | ||
26 | TS_FSM_SINGLE, /* 1 occurrence */ | ||
27 | TS_FSM_PERHAPS, /* 1 or 0 occurrence */ | ||
28 | TS_FSM_ANY, /* 0..n occurrences */ | ||
29 | TS_FSM_MULTI, /* 1..n occurrences */ | ||
30 | TS_FSM_HEAD_IGNORE, /* 0..n ignored occurrences at head */ | ||
31 | __TS_FSM_RECUR_MAX, | ||
32 | }; | ||
33 | #define TS_FSM_RECUR_MAX (__TS_FSM_RECUR_MAX - 1) | ||
34 | |||
35 | /** | ||
36 | * struct ts_fsm_token - state machine token (state) | ||
37 | * @type: type of token | ||
38 | * @recur: number of recurrences | ||
39 | * @value: character value for TS_FSM_SPECIFIC | ||
40 | */ | ||
41 | struct ts_fsm_token | ||
42 | { | ||
43 | __u16 type; | ||
44 | __u8 recur; | ||
45 | __u8 value; | ||
46 | }; | ||
47 | |||
48 | #endif | ||
diff --git a/include/linux/timer.h b/include/linux/timer.h index 90db1cc62ddd..221f81ac2002 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -6,45 +6,33 @@ | |||
6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
7 | #include <linux/stddef.h> | 7 | #include <linux/stddef.h> |
8 | 8 | ||
9 | struct tvec_t_base_s; | 9 | struct timer_base_s; |
10 | 10 | ||
11 | struct timer_list { | 11 | struct timer_list { |
12 | struct list_head entry; | 12 | struct list_head entry; |
13 | unsigned long expires; | 13 | unsigned long expires; |
14 | 14 | ||
15 | spinlock_t lock; | ||
16 | unsigned long magic; | 15 | unsigned long magic; |
17 | 16 | ||
18 | void (*function)(unsigned long); | 17 | void (*function)(unsigned long); |
19 | unsigned long data; | 18 | unsigned long data; |
20 | 19 | ||
21 | struct tvec_t_base_s *base; | 20 | struct timer_base_s *base; |
22 | }; | 21 | }; |
23 | 22 | ||
24 | #define TIMER_MAGIC 0x4b87ad6e | 23 | #define TIMER_MAGIC 0x4b87ad6e |
25 | 24 | ||
25 | extern struct timer_base_s __init_timer_base; | ||
26 | |||
26 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ | 27 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ |
27 | .function = (_function), \ | 28 | .function = (_function), \ |
28 | .expires = (_expires), \ | 29 | .expires = (_expires), \ |
29 | .data = (_data), \ | 30 | .data = (_data), \ |
30 | .base = NULL, \ | 31 | .base = &__init_timer_base, \ |
31 | .magic = TIMER_MAGIC, \ | 32 | .magic = TIMER_MAGIC, \ |
32 | .lock = SPIN_LOCK_UNLOCKED, \ | ||
33 | } | 33 | } |
34 | 34 | ||
35 | /*** | 35 | void fastcall init_timer(struct timer_list * timer); |
36 | * init_timer - initialize a timer. | ||
37 | * @timer: the timer to be initialized | ||
38 | * | ||
39 | * init_timer() must be done to a timer prior calling *any* of the | ||
40 | * other timer functions. | ||
41 | */ | ||
42 | static inline void init_timer(struct timer_list * timer) | ||
43 | { | ||
44 | timer->base = NULL; | ||
45 | timer->magic = TIMER_MAGIC; | ||
46 | spin_lock_init(&timer->lock); | ||
47 | } | ||
48 | 36 | ||
49 | /*** | 37 | /*** |
50 | * timer_pending - is a timer pending? | 38 | * timer_pending - is a timer pending? |
@@ -58,7 +46,7 @@ static inline void init_timer(struct timer_list * timer) | |||
58 | */ | 46 | */ |
59 | static inline int timer_pending(const struct timer_list * timer) | 47 | static inline int timer_pending(const struct timer_list * timer) |
60 | { | 48 | { |
61 | return timer->base != NULL; | 49 | return timer->entry.next != NULL; |
62 | } | 50 | } |
63 | 51 | ||
64 | extern void add_timer_on(struct timer_list *timer, int cpu); | 52 | extern void add_timer_on(struct timer_list *timer, int cpu); |
@@ -88,13 +76,15 @@ static inline void add_timer(struct timer_list * timer) | |||
88 | } | 76 | } |
89 | 77 | ||
90 | #ifdef CONFIG_SMP | 78 | #ifdef CONFIG_SMP |
79 | extern int try_to_del_timer_sync(struct timer_list *timer); | ||
91 | extern int del_timer_sync(struct timer_list *timer); | 80 | extern int del_timer_sync(struct timer_list *timer); |
92 | extern int del_singleshot_timer_sync(struct timer_list *timer); | ||
93 | #else | 81 | #else |
94 | # define del_timer_sync(t) del_timer(t) | 82 | # define try_to_del_timer_sync(t) del_timer(t) |
95 | # define del_singleshot_timer_sync(t) del_timer(t) | 83 | # define del_timer_sync(t) del_timer(t) |
96 | #endif | 84 | #endif |
97 | 85 | ||
86 | #define del_singleshot_timer_sync(t) del_timer_sync(t) | ||
87 | |||
98 | extern void init_timers(void); | 88 | extern void init_timers(void); |
99 | extern void run_local_timers(void); | 89 | extern void run_local_timers(void); |
100 | extern void it_real_fn(unsigned long); | 90 | extern void it_real_fn(unsigned long); |
diff --git a/include/linux/topology.h b/include/linux/topology.h index d70e8972c67f..0320225e96da 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -89,6 +89,11 @@ | |||
89 | .cache_hot_time = 0, \ | 89 | .cache_hot_time = 0, \ |
90 | .cache_nice_tries = 0, \ | 90 | .cache_nice_tries = 0, \ |
91 | .per_cpu_gain = 25, \ | 91 | .per_cpu_gain = 25, \ |
92 | .busy_idx = 0, \ | ||
93 | .idle_idx = 0, \ | ||
94 | .newidle_idx = 1, \ | ||
95 | .wake_idx = 0, \ | ||
96 | .forkexec_idx = 0, \ | ||
92 | .flags = SD_LOAD_BALANCE \ | 97 | .flags = SD_LOAD_BALANCE \ |
93 | | SD_BALANCE_NEWIDLE \ | 98 | | SD_BALANCE_NEWIDLE \ |
94 | | SD_BALANCE_EXEC \ | 99 | | SD_BALANCE_EXEC \ |
@@ -115,12 +120,15 @@ | |||
115 | .cache_hot_time = (5*1000000/2), \ | 120 | .cache_hot_time = (5*1000000/2), \ |
116 | .cache_nice_tries = 1, \ | 121 | .cache_nice_tries = 1, \ |
117 | .per_cpu_gain = 100, \ | 122 | .per_cpu_gain = 100, \ |
123 | .busy_idx = 2, \ | ||
124 | .idle_idx = 1, \ | ||
125 | .newidle_idx = 2, \ | ||
126 | .wake_idx = 1, \ | ||
127 | .forkexec_idx = 1, \ | ||
118 | .flags = SD_LOAD_BALANCE \ | 128 | .flags = SD_LOAD_BALANCE \ |
119 | | SD_BALANCE_NEWIDLE \ | 129 | | SD_BALANCE_NEWIDLE \ |
120 | | SD_BALANCE_EXEC \ | 130 | | SD_BALANCE_EXEC \ |
121 | | SD_WAKE_AFFINE \ | 131 | | SD_WAKE_AFFINE, \ |
122 | | SD_WAKE_IDLE \ | ||
123 | | SD_WAKE_BALANCE, \ | ||
124 | .last_balance = jiffies, \ | 132 | .last_balance = jiffies, \ |
125 | .balance_interval = 1, \ | 133 | .balance_interval = 1, \ |
126 | .nr_balance_failed = 0, \ | 134 | .nr_balance_failed = 0, \ |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 1b76106272d3..59ff42c629ec 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -345,6 +345,7 @@ extern int tty_check_change(struct tty_struct * tty); | |||
345 | extern void stop_tty(struct tty_struct * tty); | 345 | extern void stop_tty(struct tty_struct * tty); |
346 | extern void start_tty(struct tty_struct * tty); | 346 | extern void start_tty(struct tty_struct * tty); |
347 | extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); | 347 | extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); |
348 | extern int tty_unregister_ldisc(int disc); | ||
348 | extern int tty_register_driver(struct tty_driver *driver); | 349 | extern int tty_register_driver(struct tty_driver *driver); |
349 | extern int tty_unregister_driver(struct tty_driver *driver); | 350 | extern int tty_unregister_driver(struct tty_driver *driver); |
350 | extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev); | 351 | extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 41d1a644c9d4..eb282b581546 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -287,15 +287,14 @@ struct usb_bus { | |||
287 | 287 | ||
288 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 288 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
289 | 289 | ||
290 | struct class_device class_dev; /* class device for this bus */ | 290 | struct class_device *class_dev; /* class device for this bus */ |
291 | struct kref kref; /* handles reference counting this bus */ | ||
291 | void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ | 292 | void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ |
292 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) | 293 | #if defined(CONFIG_USB_MON) |
293 | struct mon_bus *mon_bus; /* non-null when associated */ | 294 | struct mon_bus *mon_bus; /* non-null when associated */ |
294 | int monitored; /* non-zero when monitored */ | 295 | int monitored; /* non-zero when monitored */ |
295 | #endif | 296 | #endif |
296 | }; | 297 | }; |
297 | #define to_usb_bus(d) container_of(d, struct usb_bus, class_dev) | ||
298 | |||
299 | 298 | ||
300 | /* -------------------------------------------------------------------------- */ | 299 | /* -------------------------------------------------------------------------- */ |
301 | 300 | ||
@@ -796,6 +795,10 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *); | |||
796 | * of the iso_frame_desc array, and the number of errors is reported in | 795 | * of the iso_frame_desc array, and the number of errors is reported in |
797 | * error_count. Completion callbacks for ISO transfers will normally | 796 | * error_count. Completion callbacks for ISO transfers will normally |
798 | * (re)submit URBs to ensure a constant transfer rate. | 797 | * (re)submit URBs to ensure a constant transfer rate. |
798 | * | ||
799 | * Note that even fields marked "public" should not be touched by the driver | ||
800 | * when the urb is owned by the hcd, that is, since the call to | ||
801 | * usb_submit_urb() till the entry into the completion routine. | ||
799 | */ | 802 | */ |
800 | struct urb | 803 | struct urb |
801 | { | 804 | { |
@@ -803,12 +806,12 @@ struct urb | |||
803 | struct kref kref; /* reference count of the URB */ | 806 | struct kref kref; /* reference count of the URB */ |
804 | spinlock_t lock; /* lock for the URB */ | 807 | spinlock_t lock; /* lock for the URB */ |
805 | void *hcpriv; /* private data for host controller */ | 808 | void *hcpriv; /* private data for host controller */ |
806 | struct list_head urb_list; /* list pointer to all active urbs */ | ||
807 | int bandwidth; /* bandwidth for INT/ISO request */ | 809 | int bandwidth; /* bandwidth for INT/ISO request */ |
808 | atomic_t use_count; /* concurrent submissions counter */ | 810 | atomic_t use_count; /* concurrent submissions counter */ |
809 | u8 reject; /* submissions will fail */ | 811 | u8 reject; /* submissions will fail */ |
810 | 812 | ||
811 | /* public, documented fields in the urb that can be used by drivers */ | 813 | /* public, documented fields in the urb that can be used by drivers */ |
814 | struct list_head urb_list; /* list head for use by the urb owner */ | ||
812 | struct usb_device *dev; /* (in) pointer to associated device */ | 815 | struct usb_device *dev; /* (in) pointer to associated device */ |
813 | unsigned int pipe; /* (in) pipe information */ | 816 | unsigned int pipe; /* (in) pipe information */ |
814 | int status; /* (return) non-ISO status */ | 817 | int status; /* (return) non-ISO status */ |
diff --git a/include/linux/wait.h b/include/linux/wait.h index 17c874a8eb3f..d38c9fecdc36 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -33,7 +33,7 @@ int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key | |||
33 | struct __wait_queue { | 33 | struct __wait_queue { |
34 | unsigned int flags; | 34 | unsigned int flags; |
35 | #define WQ_FLAG_EXCLUSIVE 0x01 | 35 | #define WQ_FLAG_EXCLUSIVE 0x01 |
36 | struct task_struct * task; | 36 | void *private; |
37 | wait_queue_func_t func; | 37 | wait_queue_func_t func; |
38 | struct list_head task_list; | 38 | struct list_head task_list; |
39 | }; | 39 | }; |
@@ -60,7 +60,7 @@ typedef struct __wait_queue_head wait_queue_head_t; | |||
60 | */ | 60 | */ |
61 | 61 | ||
62 | #define __WAITQUEUE_INITIALIZER(name, tsk) { \ | 62 | #define __WAITQUEUE_INITIALIZER(name, tsk) { \ |
63 | .task = tsk, \ | 63 | .private = tsk, \ |
64 | .func = default_wake_function, \ | 64 | .func = default_wake_function, \ |
65 | .task_list = { NULL, NULL } } | 65 | .task_list = { NULL, NULL } } |
66 | 66 | ||
@@ -86,7 +86,7 @@ static inline void init_waitqueue_head(wait_queue_head_t *q) | |||
86 | static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) | 86 | static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) |
87 | { | 87 | { |
88 | q->flags = 0; | 88 | q->flags = 0; |
89 | q->task = p; | 89 | q->private = p; |
90 | q->func = default_wake_function; | 90 | q->func = default_wake_function; |
91 | } | 91 | } |
92 | 92 | ||
@@ -94,7 +94,7 @@ static inline void init_waitqueue_func_entry(wait_queue_t *q, | |||
94 | wait_queue_func_t func) | 94 | wait_queue_func_t func) |
95 | { | 95 | { |
96 | q->flags = 0; | 96 | q->flags = 0; |
97 | q->task = NULL; | 97 | q->private = NULL; |
98 | q->func = func; | 98 | q->func = func; |
99 | } | 99 | } |
100 | 100 | ||
@@ -110,7 +110,7 @@ static inline int waitqueue_active(wait_queue_head_t *q) | |||
110 | * aio specifies a wait queue entry with an async notification | 110 | * aio specifies a wait queue entry with an async notification |
111 | * callback routine, not associated with any task. | 111 | * callback routine, not associated with any task. |
112 | */ | 112 | */ |
113 | #define is_sync_wait(wait) (!(wait) || ((wait)->task)) | 113 | #define is_sync_wait(wait) (!(wait) || ((wait)->private)) |
114 | 114 | ||
115 | extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); | 115 | extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); |
116 | extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)); | 116 | extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)); |
@@ -384,18 +384,16 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | |||
384 | 384 | ||
385 | #define DEFINE_WAIT(name) \ | 385 | #define DEFINE_WAIT(name) \ |
386 | wait_queue_t name = { \ | 386 | wait_queue_t name = { \ |
387 | .task = current, \ | 387 | .private = current, \ |
388 | .func = autoremove_wake_function, \ | 388 | .func = autoremove_wake_function, \ |
389 | .task_list = { .next = &(name).task_list, \ | 389 | .task_list = LIST_HEAD_INIT((name).task_list), \ |
390 | .prev = &(name).task_list, \ | ||
391 | }, \ | ||
392 | } | 390 | } |
393 | 391 | ||
394 | #define DEFINE_WAIT_BIT(name, word, bit) \ | 392 | #define DEFINE_WAIT_BIT(name, word, bit) \ |
395 | struct wait_bit_queue name = { \ | 393 | struct wait_bit_queue name = { \ |
396 | .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ | 394 | .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ |
397 | .wait = { \ | 395 | .wait = { \ |
398 | .task = current, \ | 396 | .private = current, \ |
399 | .func = wake_bit_function, \ | 397 | .func = wake_bit_function, \ |
400 | .task_list = \ | 398 | .task_list = \ |
401 | LIST_HEAD_INIT((name).wait.task_list), \ | 399 | LIST_HEAD_INIT((name).wait.task_list), \ |
@@ -404,7 +402,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | |||
404 | 402 | ||
405 | #define init_wait(wait) \ | 403 | #define init_wait(wait) \ |
406 | do { \ | 404 | do { \ |
407 | (wait)->task = current; \ | 405 | (wait)->private = current; \ |
408 | (wait)->func = autoremove_wake_function; \ | 406 | (wait)->func = autoremove_wake_function; \ |
409 | INIT_LIST_HEAD(&(wait)->task_list); \ | 407 | INIT_LIST_HEAD(&(wait)->task_list); \ |
410 | } while (0) | 408 | } while (0) |
diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 2f51f2b6562e..ae485f9c916e 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h | |||
@@ -1,10 +1,10 @@ | |||
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 : 17 21.6.04 | 4 | * Version : 18 12.3.05 |
5 | * | 5 | * |
6 | * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> | 6 | * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> |
7 | * Copyright (c) 1997-2004 Jean Tourrilhes, All Rights Reserved. | 7 | * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifndef _LINUX_WIRELESS_H | 10 | #ifndef _LINUX_WIRELESS_H |
@@ -82,7 +82,7 @@ | |||
82 | * (there is some stuff that will be added in the future...) | 82 | * (there is some stuff that will be added in the future...) |
83 | * I just plan to increment with each new version. | 83 | * I just plan to increment with each new version. |
84 | */ | 84 | */ |
85 | #define WIRELESS_EXT 17 | 85 | #define WIRELESS_EXT 18 |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Changes : | 88 | * Changes : |
@@ -182,6 +182,21 @@ | |||
182 | * - Document (struct iw_quality *)->updated, add new flags (INVALID) | 182 | * - Document (struct iw_quality *)->updated, add new flags (INVALID) |
183 | * - Wireless Event capability in struct iw_range | 183 | * - Wireless Event capability in struct iw_range |
184 | * - Add support for relative TxPower (yick !) | 184 | * - Add support for relative TxPower (yick !) |
185 | * | ||
186 | * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>) | ||
187 | * ---------- | ||
188 | * - Add support for WPA/WPA2 | ||
189 | * - Add extended encoding configuration (SIOCSIWENCODEEXT and | ||
190 | * SIOCGIWENCODEEXT) | ||
191 | * - Add SIOCSIWGENIE/SIOCGIWGENIE | ||
192 | * - Add SIOCSIWMLME | ||
193 | * - Add SIOCSIWPMKSA | ||
194 | * - Add struct iw_range bit field for supported encoding capabilities | ||
195 | * - Add optional scan request parameters for SIOCSIWSCAN | ||
196 | * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA | ||
197 | * related parameters (extensible up to 4096 parameter values) | ||
198 | * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE, | ||
199 | * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND | ||
185 | */ | 200 | */ |
186 | 201 | ||
187 | /**************************** CONSTANTS ****************************/ | 202 | /**************************** CONSTANTS ****************************/ |
@@ -256,6 +271,30 @@ | |||
256 | #define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ | 271 | #define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ |
257 | #define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ | 272 | #define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ |
258 | 273 | ||
274 | /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). | ||
275 | * This ioctl uses struct iw_point and data buffer that includes IE id and len | ||
276 | * fields. More than one IE may be included in the request. Setting the generic | ||
277 | * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers | ||
278 | * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers | ||
279 | * are required to report the used IE as a wireless event, e.g., when | ||
280 | * associating with an AP. */ | ||
281 | #define SIOCSIWGENIE 0x8B30 /* set generic IE */ | ||
282 | #define SIOCGIWGENIE 0x8B31 /* get generic IE */ | ||
283 | |||
284 | /* WPA : IEEE 802.11 MLME requests */ | ||
285 | #define SIOCSIWMLME 0x8B16 /* request MLME operation; uses | ||
286 | * struct iw_mlme */ | ||
287 | /* WPA : Authentication mode parameters */ | ||
288 | #define SIOCSIWAUTH 0x8B32 /* set authentication mode params */ | ||
289 | #define SIOCGIWAUTH 0x8B33 /* get authentication mode params */ | ||
290 | |||
291 | /* WPA : Extended version of encoding configuration */ | ||
292 | #define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ | ||
293 | #define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ | ||
294 | |||
295 | /* WPA2 : PMKSA cache management */ | ||
296 | #define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ | ||
297 | |||
259 | /* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ | 298 | /* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ |
260 | 299 | ||
261 | /* These 32 ioctl are wireless device private, for 16 commands. | 300 | /* These 32 ioctl are wireless device private, for 16 commands. |
@@ -297,6 +336,34 @@ | |||
297 | #define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ | 336 | #define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ |
298 | #define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ | 337 | #define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ |
299 | #define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ | 338 | #define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ |
339 | #define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..) | ||
340 | * (scan results); This includes id and | ||
341 | * length fields. One IWEVGENIE may | ||
342 | * contain more than one IE. Scan | ||
343 | * results may contain one or more | ||
344 | * IWEVGENIE events. */ | ||
345 | #define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure | ||
346 | * (struct iw_michaelmicfailure) | ||
347 | */ | ||
348 | #define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request. | ||
349 | * The data includes id and length | ||
350 | * fields and may contain more than one | ||
351 | * IE. This event is required in | ||
352 | * Managed mode if the driver | ||
353 | * generates its own WPA/RSN IE. This | ||
354 | * should be sent just before | ||
355 | * IWEVREGISTERED event for the | ||
356 | * association. */ | ||
357 | #define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association | ||
358 | * Response. The data includes id and | ||
359 | * length fields and may contain more | ||
360 | * than one IE. This may be sent | ||
361 | * between IWEVASSOCREQIE and | ||
362 | * IWEVREGISTERED events for the | ||
363 | * association. */ | ||
364 | #define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN | ||
365 | * pre-authentication | ||
366 | * (struct iw_pmkid_cand) */ | ||
300 | 367 | ||
301 | #define IWEVFIRST 0x8C00 | 368 | #define IWEVFIRST 0x8C00 |
302 | 369 | ||
@@ -432,12 +499,94 @@ | |||
432 | #define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ | 499 | #define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ |
433 | #define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ | 500 | #define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ |
434 | #define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ | 501 | #define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ |
502 | /* struct iw_scan_req scan_type */ | ||
503 | #define IW_SCAN_TYPE_ACTIVE 0 | ||
504 | #define IW_SCAN_TYPE_PASSIVE 1 | ||
435 | /* Maximum size of returned data */ | 505 | /* Maximum size of returned data */ |
436 | #define IW_SCAN_MAX_DATA 4096 /* In bytes */ | 506 | #define IW_SCAN_MAX_DATA 4096 /* In bytes */ |
437 | 507 | ||
438 | /* Max number of char in custom event - use multiple of them if needed */ | 508 | /* Max number of char in custom event - use multiple of them if needed */ |
439 | #define IW_CUSTOM_MAX 256 /* In bytes */ | 509 | #define IW_CUSTOM_MAX 256 /* In bytes */ |
440 | 510 | ||
511 | /* Generic information element */ | ||
512 | #define IW_GENERIC_IE_MAX 1024 | ||
513 | |||
514 | /* MLME requests (SIOCSIWMLME / struct iw_mlme) */ | ||
515 | #define IW_MLME_DEAUTH 0 | ||
516 | #define IW_MLME_DISASSOC 1 | ||
517 | |||
518 | /* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ | ||
519 | #define IW_AUTH_INDEX 0x0FFF | ||
520 | #define IW_AUTH_FLAGS 0xF000 | ||
521 | /* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) | ||
522 | * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the | ||
523 | * parameter that is being set/get to; value will be read/written to | ||
524 | * struct iw_param value field) */ | ||
525 | #define IW_AUTH_WPA_VERSION 0 | ||
526 | #define IW_AUTH_CIPHER_PAIRWISE 1 | ||
527 | #define IW_AUTH_CIPHER_GROUP 2 | ||
528 | #define IW_AUTH_KEY_MGMT 3 | ||
529 | #define IW_AUTH_TKIP_COUNTERMEASURES 4 | ||
530 | #define IW_AUTH_DROP_UNENCRYPTED 5 | ||
531 | #define IW_AUTH_80211_AUTH_ALG 6 | ||
532 | #define IW_AUTH_WPA_ENABLED 7 | ||
533 | #define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 | ||
534 | #define IW_AUTH_ROAMING_CONTROL 9 | ||
535 | #define IW_AUTH_PRIVACY_INVOKED 10 | ||
536 | |||
537 | /* IW_AUTH_WPA_VERSION values (bit field) */ | ||
538 | #define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 | ||
539 | #define IW_AUTH_WPA_VERSION_WPA 0x00000002 | ||
540 | #define IW_AUTH_WPA_VERSION_WPA2 0x00000004 | ||
541 | |||
542 | /* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */ | ||
543 | #define IW_AUTH_CIPHER_NONE 0x00000001 | ||
544 | #define IW_AUTH_CIPHER_WEP40 0x00000002 | ||
545 | #define IW_AUTH_CIPHER_TKIP 0x00000004 | ||
546 | #define IW_AUTH_CIPHER_CCMP 0x00000008 | ||
547 | #define IW_AUTH_CIPHER_WEP104 0x00000010 | ||
548 | |||
549 | /* IW_AUTH_KEY_MGMT values (bit field) */ | ||
550 | #define IW_AUTH_KEY_MGMT_802_1X 1 | ||
551 | #define IW_AUTH_KEY_MGMT_PSK 2 | ||
552 | |||
553 | /* IW_AUTH_80211_AUTH_ALG values (bit field) */ | ||
554 | #define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 | ||
555 | #define IW_AUTH_ALG_SHARED_KEY 0x00000002 | ||
556 | #define IW_AUTH_ALG_LEAP 0x00000004 | ||
557 | |||
558 | /* IW_AUTH_ROAMING_CONTROL values */ | ||
559 | #define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */ | ||
560 | #define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming | ||
561 | * control */ | ||
562 | |||
563 | /* SIOCSIWENCODEEXT definitions */ | ||
564 | #define IW_ENCODE_SEQ_MAX_SIZE 8 | ||
565 | /* struct iw_encode_ext ->alg */ | ||
566 | #define IW_ENCODE_ALG_NONE 0 | ||
567 | #define IW_ENCODE_ALG_WEP 1 | ||
568 | #define IW_ENCODE_ALG_TKIP 2 | ||
569 | #define IW_ENCODE_ALG_CCMP 3 | ||
570 | /* struct iw_encode_ext ->ext_flags */ | ||
571 | #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 | ||
572 | #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 | ||
573 | #define IW_ENCODE_EXT_GROUP_KEY 0x00000004 | ||
574 | #define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 | ||
575 | |||
576 | /* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */ | ||
577 | #define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */ | ||
578 | #define IW_MICFAILURE_GROUP 0x00000004 | ||
579 | #define IW_MICFAILURE_PAIRWISE 0x00000008 | ||
580 | #define IW_MICFAILURE_STAKEY 0x00000010 | ||
581 | #define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported) | ||
582 | */ | ||
583 | |||
584 | /* Bit field values for enc_capa in struct iw_range */ | ||
585 | #define IW_ENC_CAPA_WPA 0x00000001 | ||
586 | #define IW_ENC_CAPA_WPA2 0x00000002 | ||
587 | #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 | ||
588 | #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 | ||
589 | |||
441 | /* Event capability macros - in (struct iw_range *)->event_capa | 590 | /* Event capability macros - in (struct iw_range *)->event_capa |
442 | * Because we have more than 32 possible events, we use an array of | 591 | * Because we have more than 32 possible events, we use an array of |
443 | * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ | 592 | * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ |
@@ -546,6 +695,132 @@ struct iw_thrspy | |||
546 | struct iw_quality high; /* High threshold */ | 695 | struct iw_quality high; /* High threshold */ |
547 | }; | 696 | }; |
548 | 697 | ||
698 | /* | ||
699 | * Optional data for scan request | ||
700 | * | ||
701 | * Note: these optional parameters are controlling parameters for the | ||
702 | * scanning behavior, these do not apply to getting scan results | ||
703 | * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and | ||
704 | * provide a merged results with all BSSes even if the previous scan | ||
705 | * request limited scanning to a subset, e.g., by specifying an SSID. | ||
706 | * Especially, scan results are required to include an entry for the | ||
707 | * current BSS if the driver is in Managed mode and associated with an AP. | ||
708 | */ | ||
709 | struct iw_scan_req | ||
710 | { | ||
711 | __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */ | ||
712 | __u8 essid_len; | ||
713 | __u8 num_channels; /* num entries in channel_list; | ||
714 | * 0 = scan all allowed channels */ | ||
715 | __u8 flags; /* reserved as padding; use zero, this may | ||
716 | * be used in the future for adding flags | ||
717 | * to request different scan behavior */ | ||
718 | struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or | ||
719 | * individual address of a specific BSS */ | ||
720 | |||
721 | /* | ||
722 | * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using | ||
723 | * the current ESSID. This allows scan requests for specific ESSID | ||
724 | * without having to change the current ESSID and potentially breaking | ||
725 | * the current association. | ||
726 | */ | ||
727 | __u8 essid[IW_ESSID_MAX_SIZE]; | ||
728 | |||
729 | /* | ||
730 | * Optional parameters for changing the default scanning behavior. | ||
731 | * These are based on the MLME-SCAN.request from IEEE Std 802.11. | ||
732 | * TU is 1.024 ms. If these are set to 0, driver is expected to use | ||
733 | * reasonable default values. min_channel_time defines the time that | ||
734 | * will be used to wait for the first reply on each channel. If no | ||
735 | * replies are received, next channel will be scanned after this. If | ||
736 | * replies are received, total time waited on the channel is defined by | ||
737 | * max_channel_time. | ||
738 | */ | ||
739 | __u32 min_channel_time; /* in TU */ | ||
740 | __u32 max_channel_time; /* in TU */ | ||
741 | |||
742 | struct iw_freq channel_list[IW_MAX_FREQUENCIES]; | ||
743 | }; | ||
744 | |||
745 | /* ------------------------- WPA SUPPORT ------------------------- */ | ||
746 | |||
747 | /* | ||
748 | * Extended data structure for get/set encoding (this is used with | ||
749 | * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_* | ||
750 | * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and | ||
751 | * only the data contents changes (key data -> this structure, including | ||
752 | * key data). | ||
753 | * | ||
754 | * If the new key is the first group key, it will be set as the default | ||
755 | * TX key. Otherwise, default TX key index is only changed if | ||
756 | * IW_ENCODE_EXT_SET_TX_KEY flag is set. | ||
757 | * | ||
758 | * Key will be changed with SIOCSIWENCODEEXT in all cases except for | ||
759 | * special "change TX key index" operation which is indicated by setting | ||
760 | * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY. | ||
761 | * | ||
762 | * tx_seq/rx_seq are only used when respective | ||
763 | * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal | ||
764 | * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start | ||
765 | * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally | ||
766 | * used only by an Authenticator (AP or an IBSS station) to get the | ||
767 | * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and | ||
768 | * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for | ||
769 | * debugging/testing. | ||
770 | */ | ||
771 | struct iw_encode_ext | ||
772 | { | ||
773 | __u32 ext_flags; /* IW_ENCODE_EXT_* */ | ||
774 | __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ | ||
775 | __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ | ||
776 | struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast | ||
777 | * (group) keys or unicast address for | ||
778 | * individual keys */ | ||
779 | __u16 alg; /* IW_ENCODE_ALG_* */ | ||
780 | __u16 key_len; | ||
781 | __u8 key[0]; | ||
782 | }; | ||
783 | |||
784 | /* SIOCSIWMLME data */ | ||
785 | struct iw_mlme | ||
786 | { | ||
787 | __u16 cmd; /* IW_MLME_* */ | ||
788 | __u16 reason_code; | ||
789 | struct sockaddr addr; | ||
790 | }; | ||
791 | |||
792 | /* SIOCSIWPMKSA data */ | ||
793 | #define IW_PMKSA_ADD 1 | ||
794 | #define IW_PMKSA_REMOVE 2 | ||
795 | #define IW_PMKSA_FLUSH 3 | ||
796 | |||
797 | #define IW_PMKID_LEN 16 | ||
798 | |||
799 | struct iw_pmksa | ||
800 | { | ||
801 | __u32 cmd; /* IW_PMKSA_* */ | ||
802 | struct sockaddr bssid; | ||
803 | __u8 pmkid[IW_PMKID_LEN]; | ||
804 | }; | ||
805 | |||
806 | /* IWEVMICHAELMICFAILURE data */ | ||
807 | struct iw_michaelmicfailure | ||
808 | { | ||
809 | __u32 flags; | ||
810 | struct sockaddr src_addr; | ||
811 | __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ | ||
812 | }; | ||
813 | |||
814 | /* IWEVPMKIDCAND data */ | ||
815 | #define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */ | ||
816 | struct iw_pmkid_cand | ||
817 | { | ||
818 | __u32 flags; /* IW_PMKID_CAND_* */ | ||
819 | __u32 index; /* the smaller the index, the higher the | ||
820 | * priority */ | ||
821 | struct sockaddr bssid; | ||
822 | }; | ||
823 | |||
549 | /* ------------------------ WIRELESS STATS ------------------------ */ | 824 | /* ------------------------ WIRELESS STATS ------------------------ */ |
550 | /* | 825 | /* |
551 | * Wireless statistics (used for /proc/net/wireless) | 826 | * Wireless statistics (used for /proc/net/wireless) |
@@ -725,6 +1000,8 @@ struct iw_range | |||
725 | struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ | 1000 | struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ |
726 | /* Note : this frequency list doesn't need to fit channel numbers, | 1001 | /* Note : this frequency list doesn't need to fit channel numbers, |
727 | * because each entry contain its channel index */ | 1002 | * because each entry contain its channel index */ |
1003 | |||
1004 | __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ | ||
728 | }; | 1005 | }; |
729 | 1006 | ||
730 | /* | 1007 | /* |
diff --git a/include/linux/x25.h b/include/linux/x25.h index 7531cfed5885..16d44931afa0 100644 --- a/include/linux/x25.h +++ b/include/linux/x25.h | |||
@@ -4,6 +4,8 @@ | |||
4 | * History | 4 | * History |
5 | * mar/20/00 Daniela Squassoni Disabling/enabling of facilities | 5 | * mar/20/00 Daniela Squassoni Disabling/enabling of facilities |
6 | * negotiation. | 6 | * negotiation. |
7 | * apr/02/05 Shaun Pereira Selective sub address matching with | ||
8 | * call user data | ||
7 | */ | 9 | */ |
8 | 10 | ||
9 | #ifndef X25_KERNEL_H | 11 | #ifndef X25_KERNEL_H |
@@ -16,6 +18,9 @@ | |||
16 | #define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) | 18 | #define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) |
17 | #define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) | 19 | #define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) |
18 | #define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6) | 20 | #define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6) |
21 | #define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7) | ||
22 | #define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8) | ||
23 | #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) | ||
19 | 24 | ||
20 | /* | 25 | /* |
21 | * Values for {get,set}sockopt. | 26 | * Values for {get,set}sockopt. |
@@ -109,4 +114,11 @@ struct x25_causediag { | |||
109 | unsigned char diagnostic; | 114 | unsigned char diagnostic; |
110 | }; | 115 | }; |
111 | 116 | ||
117 | /* | ||
118 | * Further optional call user data match length selection | ||
119 | */ | ||
120 | struct x25_subaddr { | ||
121 | unsigned int cudmatchlength; | ||
122 | }; | ||
123 | |||
112 | #endif | 124 | #endif |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index fd2ef742a9fd..f0d423300d84 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -174,6 +174,8 @@ enum xfrm_attr_type_t { | |||
174 | XFRMA_ALG_COMP, /* struct xfrm_algo */ | 174 | XFRMA_ALG_COMP, /* struct xfrm_algo */ |
175 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ | 175 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ |
176 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ | 176 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ |
177 | XFRMA_SA, | ||
178 | XFRMA_POLICY, | ||
177 | __XFRMA_MAX | 179 | __XFRMA_MAX |
178 | 180 | ||
179 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 181 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
@@ -194,6 +196,7 @@ struct xfrm_usersa_info { | |||
194 | __u8 flags; | 196 | __u8 flags; |
195 | #define XFRM_STATE_NOECN 1 | 197 | #define XFRM_STATE_NOECN 1 |
196 | #define XFRM_STATE_DECAP_DSCP 2 | 198 | #define XFRM_STATE_DECAP_DSCP 2 |
199 | #define XFRM_STATE_NOPMTUDISC 4 | ||
197 | }; | 200 | }; |
198 | 201 | ||
199 | struct xfrm_usersa_id { | 202 | struct xfrm_usersa_id { |
@@ -257,5 +260,7 @@ struct xfrm_usersa_flush { | |||
257 | 260 | ||
258 | #define XFRMGRP_ACQUIRE 1 | 261 | #define XFRMGRP_ACQUIRE 1 |
259 | #define XFRMGRP_EXPIRE 2 | 262 | #define XFRMGRP_EXPIRE 2 |
263 | #define XFRMGRP_SA 4 | ||
264 | #define XFRMGRP_POLICY 8 | ||
260 | 265 | ||
261 | #endif /* _LINUX_XFRM_H */ | 266 | #endif /* _LINUX_XFRM_H */ |
diff --git a/include/media/audiochip.h b/include/media/audiochip.h index d3e9e30608dc..f345a61c3bdb 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: audiochip.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | #ifndef AUDIOCHIP_H | 5 | #ifndef AUDIOCHIP_H |
2 | #define AUDIOCHIP_H | 6 | #define AUDIOCHIP_H |
3 | 7 | ||
diff --git a/include/media/id.h b/include/media/id.h index 1b0320dc8f73..a39a6423914b 100644 --- a/include/media/id.h +++ b/include/media/id.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: id.h,v 1.4 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ | 5 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ |
2 | 6 | ||
3 | /* drivers */ | 7 | /* drivers */ |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 62c963a52d86..698670547f16 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-common.h,v 1.8 2005/02/22 12:28:40 kraxel Exp $ | 2 | * $Id: ir-common.h,v 1.9 2005/05/15 19:01:26 mchehab Exp $ |
3 | * | 3 | * |
4 | * some common structs and functions to handle infrared remotes via | 4 | * some common structs and functions to handle infrared remotes via |
5 | * input layer ... | 5 | * input layer ... |
@@ -50,6 +50,7 @@ extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; | |||
50 | extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; | 50 | extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; |
51 | extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; | 51 | extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; |
52 | extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; | 52 | extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; |
53 | extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; | ||
53 | 54 | ||
54 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | 55 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, |
55 | int ir_type, IR_KEYTAB_TYPE *ir_codes); | 56 | int ir_type, IR_KEYTAB_TYPE *ir_codes); |
diff --git a/include/media/tuner.h b/include/media/tuner.h index 156a9c51ffec..2dd8310901e8 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #include "id.h" | 26 | #include "id.h" |
27 | 27 | ||
28 | #define ADDR_UNSET (255) | ||
29 | |||
28 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ | 30 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ |
29 | #define TUNER_PHILIPS_PAL_I 1 | 31 | #define TUNER_PHILIPS_PAL_I 1 |
30 | #define TUNER_PHILIPS_NTSC 2 | 32 | #define TUNER_PHILIPS_NTSC 2 |
@@ -98,12 +100,23 @@ | |||
98 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ | 100 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ |
99 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ | 101 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ |
100 | 102 | ||
103 | #define TUNER_YMEC_TVF_8531MF 58 | ||
104 | #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ | ||
105 | #define TUNER_THOMSON_DTT7611 60 | ||
106 | #define TUNER_TENA_9533_DI 61 | ||
107 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ | ||
108 | |||
109 | #define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio" | ||
110 | |||
111 | #define TUNER_THOMSON_DTT7611 60 | ||
112 | |||
101 | #define NOTUNER 0 | 113 | #define NOTUNER 0 |
102 | #define PAL 1 /* PAL_BG */ | 114 | #define PAL 1 /* PAL_BG */ |
103 | #define PAL_I 2 | 115 | #define PAL_I 2 |
104 | #define NTSC 3 | 116 | #define NTSC 3 |
105 | #define SECAM 4 | 117 | #define SECAM 4 |
106 | #define ATSC 5 | 118 | #define ATSC 5 |
119 | #define RADIO 6 | ||
107 | 120 | ||
108 | #define NoTuner 0 | 121 | #define NoTuner 0 |
109 | #define Philips 1 | 122 | #define Philips 1 |
@@ -119,10 +132,20 @@ | |||
119 | #define TCL 11 | 132 | #define TCL 11 |
120 | #define THOMSON 12 | 133 | #define THOMSON 12 |
121 | 134 | ||
135 | enum v4l_radio_tuner { | ||
136 | TEA5767_LOW_LO_32768 = 0, | ||
137 | TEA5767_HIGH_LO_32768 = 1, | ||
138 | TEA5767_LOW_LO_13MHz = 2, | ||
139 | TEA5767_HIGH_LO_13MHz = 3, | ||
140 | }; | ||
141 | |||
142 | |||
122 | #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ | 143 | #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ |
123 | #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ | 144 | #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ |
145 | #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) /* set tuner type and I2C addr */ | ||
124 | 146 | ||
125 | #define TDA9887_SET_CONFIG _IOW('t',5,int) | 147 | #define TDA9887_SET_CONFIG _IOW('t',5,int) |
148 | |||
126 | /* tv card specific */ | 149 | /* tv card specific */ |
127 | # define TDA9887_PRESENT (1<<0) | 150 | # define TDA9887_PRESENT (1<<0) |
128 | # define TDA9887_PORT1_INACTIVE (1<<1) | 151 | # define TDA9887_PORT1_INACTIVE (1<<1) |
@@ -143,6 +166,12 @@ | |||
143 | #define I2C_ADDR_TDA8290 0x4b | 166 | #define I2C_ADDR_TDA8290 0x4b |
144 | #define I2C_ADDR_TDA8275 0x61 | 167 | #define I2C_ADDR_TDA8275 0x61 |
145 | 168 | ||
169 | struct tuner_addr { | ||
170 | enum v4l2_tuner_type v4l2_tuner; | ||
171 | unsigned int type; | ||
172 | unsigned short addr; | ||
173 | }; | ||
174 | |||
146 | struct tuner { | 175 | struct tuner { |
147 | /* device */ | 176 | /* device */ |
148 | struct i2c_client i2c; | 177 | struct i2c_client i2c; |
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h index 627603e561a6..5c4fe30e8d1d 100644 --- a/include/media/tveeprom.h +++ b/include/media/tveeprom.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: tveeprom.h,v 1.2 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | struct tveeprom { | 5 | struct tveeprom { |
2 | u32 has_radio; | 6 | u32 has_radio; |
3 | 7 | ||
diff --git a/include/net/ax25.h b/include/net/ax25.h index 9e6368a54547..828a3a93dda1 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -220,7 +220,7 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25) | |||
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | static inline unsigned short ax25_type_trans(struct sk_buff *skb, struct net_device *dev) | 223 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) |
224 | { | 224 | { |
225 | skb->dev = dev; | 225 | skb->dev = dev; |
226 | skb->pkt_type = PACKET_HOST; | 226 | skb->pkt_type = PACKET_HOST; |
diff --git a/include/net/ip.h b/include/net/ip.h index 3f63992eb712..32360bbe143f 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -163,6 +163,7 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics); | |||
163 | 163 | ||
164 | extern int sysctl_local_port_range[2]; | 164 | extern int sysctl_local_port_range[2]; |
165 | extern int sysctl_ip_default_ttl; | 165 | extern int sysctl_ip_default_ttl; |
166 | extern int sysctl_ip_nonlocal_bind; | ||
166 | 167 | ||
167 | #ifdef CONFIG_INET | 168 | #ifdef CONFIG_INET |
168 | /* The function in 2.2 was invalid, producing wrong result for | 169 | /* The function in 2.2 was invalid, producing wrong result for |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 319904518194..a66e9de16a6c 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -167,14 +167,17 @@ extern int fib6_walk_continue(struct fib6_walker_t *w); | |||
167 | extern int fib6_add(struct fib6_node *root, | 167 | extern int fib6_add(struct fib6_node *root, |
168 | struct rt6_info *rt, | 168 | struct rt6_info *rt, |
169 | struct nlmsghdr *nlh, | 169 | struct nlmsghdr *nlh, |
170 | void *rtattr); | 170 | void *rtattr, |
171 | struct netlink_skb_parms *req); | ||
171 | 172 | ||
172 | extern int fib6_del(struct rt6_info *rt, | 173 | extern int fib6_del(struct rt6_info *rt, |
173 | struct nlmsghdr *nlh, | 174 | struct nlmsghdr *nlh, |
174 | void *rtattr); | 175 | void *rtattr, |
176 | struct netlink_skb_parms *req); | ||
175 | 177 | ||
176 | extern void inet6_rt_notify(int event, struct rt6_info *rt, | 178 | extern void inet6_rt_notify(int event, struct rt6_info *rt, |
177 | struct nlmsghdr *nlh); | 179 | struct nlmsghdr *nlh, |
180 | struct netlink_skb_parms *req); | ||
178 | 181 | ||
179 | extern void fib6_run_gc(unsigned long dummy); | 182 | extern void fib6_run_gc(unsigned long dummy); |
180 | 183 | ||
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index d5d1dd10cdb8..f920706d526b 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -41,13 +41,16 @@ extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); | |||
41 | 41 | ||
42 | extern int ip6_route_add(struct in6_rtmsg *rtmsg, | 42 | extern int ip6_route_add(struct in6_rtmsg *rtmsg, |
43 | struct nlmsghdr *, | 43 | struct nlmsghdr *, |
44 | void *rtattr); | 44 | void *rtattr, |
45 | struct netlink_skb_parms *req); | ||
45 | extern int ip6_ins_rt(struct rt6_info *, | 46 | extern int ip6_ins_rt(struct rt6_info *, |
46 | struct nlmsghdr *, | 47 | struct nlmsghdr *, |
47 | void *rtattr); | 48 | void *rtattr, |
49 | struct netlink_skb_parms *req); | ||
48 | extern int ip6_del_rt(struct rt6_info *, | 50 | extern int ip6_del_rt(struct rt6_info *, |
49 | struct nlmsghdr *, | 51 | struct nlmsghdr *, |
50 | void *rtattr); | 52 | void *rtattr, |
53 | struct netlink_skb_parms *req); | ||
51 | 54 | ||
52 | extern int ip6_rt_addr_add(struct in6_addr *addr, | 55 | extern int ip6_rt_addr_add(struct in6_addr *addr, |
53 | struct net_device *dev, | 56 | struct net_device *dev, |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index e5a5f6b62f88..a4208a336ac0 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -109,6 +109,20 @@ struct fib_result { | |||
109 | #endif | 109 | #endif |
110 | }; | 110 | }; |
111 | 111 | ||
112 | struct fib_result_nl { | ||
113 | u32 fl_addr; /* To be looked up*/ | ||
114 | u32 fl_fwmark; | ||
115 | unsigned char fl_tos; | ||
116 | unsigned char fl_scope; | ||
117 | unsigned char tb_id_in; | ||
118 | |||
119 | unsigned char tb_id; /* Results */ | ||
120 | unsigned char prefixlen; | ||
121 | unsigned char nh_sel; | ||
122 | unsigned char type; | ||
123 | unsigned char scope; | ||
124 | int err; | ||
125 | }; | ||
112 | 126 | ||
113 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 127 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
114 | 128 | ||
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 4f33bbc21e7f..89809891e5ab 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -65,11 +65,10 @@ struct neighbour; | |||
65 | 65 | ||
66 | struct neigh_parms | 66 | struct neigh_parms |
67 | { | 67 | { |
68 | struct net_device *dev; | ||
68 | struct neigh_parms *next; | 69 | struct neigh_parms *next; |
69 | int (*neigh_setup)(struct neighbour *); | 70 | int (*neigh_setup)(struct neighbour *); |
70 | struct neigh_table *tbl; | 71 | struct neigh_table *tbl; |
71 | int entries; | ||
72 | void *priv; | ||
73 | 72 | ||
74 | void *sysctl_table; | 73 | void *sysctl_table; |
75 | 74 | ||
@@ -192,7 +191,6 @@ struct neigh_table | |||
192 | atomic_t entries; | 191 | atomic_t entries; |
193 | rwlock_t lock; | 192 | rwlock_t lock; |
194 | unsigned long last_rand; | 193 | unsigned long last_rand; |
195 | struct neigh_parms *parms_list; | ||
196 | kmem_cache_t *kmem_cachep; | 194 | kmem_cache_t *kmem_cachep; |
197 | struct neigh_statistics *stats; | 195 | struct neigh_statistics *stats; |
198 | struct neighbour **hash_buckets; | 196 | struct neighbour **hash_buckets; |
@@ -252,6 +250,9 @@ extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | |||
252 | extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | 250 | extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); |
253 | extern void neigh_app_ns(struct neighbour *n); | 251 | extern void neigh_app_ns(struct neighbour *n); |
254 | 252 | ||
253 | extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb); | ||
254 | extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
255 | |||
255 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); | 256 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); |
256 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); | 257 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); |
257 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); | 258 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h new file mode 100644 index 000000000000..72fd6f5e86b1 --- /dev/null +++ b/include/net/request_sock.h | |||
@@ -0,0 +1,255 @@ | |||
1 | /* | ||
2 | * NET Generic infrastructure for Network protocols. | ||
3 | * | ||
4 | * Definitions for request_sock | ||
5 | * | ||
6 | * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br> | ||
7 | * | ||
8 | * From code originally in include/net/tcp.h | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | */ | ||
15 | #ifndef _REQUEST_SOCK_H | ||
16 | #define _REQUEST_SOCK_H | ||
17 | |||
18 | #include <linux/slab.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/types.h> | ||
21 | |||
22 | #include <net/sock.h> | ||
23 | |||
24 | struct request_sock; | ||
25 | struct sk_buff; | ||
26 | struct dst_entry; | ||
27 | struct proto; | ||
28 | |||
29 | struct request_sock_ops { | ||
30 | int family; | ||
31 | kmem_cache_t *slab; | ||
32 | int obj_size; | ||
33 | int (*rtx_syn_ack)(struct sock *sk, | ||
34 | struct request_sock *req, | ||
35 | struct dst_entry *dst); | ||
36 | void (*send_ack)(struct sk_buff *skb, | ||
37 | struct request_sock *req); | ||
38 | void (*send_reset)(struct sk_buff *skb); | ||
39 | void (*destructor)(struct request_sock *req); | ||
40 | }; | ||
41 | |||
42 | /* struct request_sock - mini sock to represent a connection request | ||
43 | */ | ||
44 | struct request_sock { | ||
45 | struct request_sock *dl_next; /* Must be first member! */ | ||
46 | u16 mss; | ||
47 | u8 retrans; | ||
48 | u8 __pad; | ||
49 | /* The following two fields can be easily recomputed I think -AK */ | ||
50 | u32 window_clamp; /* window clamp at creation time */ | ||
51 | u32 rcv_wnd; /* rcv_wnd offered first time */ | ||
52 | u32 ts_recent; | ||
53 | unsigned long expires; | ||
54 | struct request_sock_ops *rsk_ops; | ||
55 | struct sock *sk; | ||
56 | }; | ||
57 | |||
58 | static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) | ||
59 | { | ||
60 | struct request_sock *req = kmem_cache_alloc(ops->slab, SLAB_ATOMIC); | ||
61 | |||
62 | if (req != NULL) | ||
63 | req->rsk_ops = ops; | ||
64 | |||
65 | return req; | ||
66 | } | ||
67 | |||
68 | static inline void __reqsk_free(struct request_sock *req) | ||
69 | { | ||
70 | kmem_cache_free(req->rsk_ops->slab, req); | ||
71 | } | ||
72 | |||
73 | static inline void reqsk_free(struct request_sock *req) | ||
74 | { | ||
75 | req->rsk_ops->destructor(req); | ||
76 | __reqsk_free(req); | ||
77 | } | ||
78 | |||
79 | extern int sysctl_max_syn_backlog; | ||
80 | |||
81 | /** struct listen_sock - listen state | ||
82 | * | ||
83 | * @max_qlen_log - log_2 of maximal queued SYNs/REQUESTs | ||
84 | */ | ||
85 | struct listen_sock { | ||
86 | u8 max_qlen_log; | ||
87 | /* 3 bytes hole, try to use */ | ||
88 | int qlen; | ||
89 | int qlen_young; | ||
90 | int clock_hand; | ||
91 | u32 hash_rnd; | ||
92 | struct request_sock *syn_table[0]; | ||
93 | }; | ||
94 | |||
95 | /** struct request_sock_queue - queue of request_socks | ||
96 | * | ||
97 | * @rskq_accept_head - FIFO head of established children | ||
98 | * @rskq_accept_tail - FIFO tail of established children | ||
99 | * @syn_wait_lock - serializer | ||
100 | * | ||
101 | * %syn_wait_lock is necessary only to avoid proc interface having to grab the main | ||
102 | * lock sock while browsing the listening hash (otherwise it's deadlock prone). | ||
103 | * | ||
104 | * This lock is acquired in read mode only from listening_get_next() seq_file | ||
105 | * op and it's acquired in write mode _only_ from code that is actively | ||
106 | * changing rskq_accept_head. All readers that are holding the master sock lock | ||
107 | * don't need to grab this lock in read mode too as rskq_accept_head. writes | ||
108 | * are always protected from the main sock lock. | ||
109 | */ | ||
110 | struct request_sock_queue { | ||
111 | struct request_sock *rskq_accept_head; | ||
112 | struct request_sock *rskq_accept_tail; | ||
113 | rwlock_t syn_wait_lock; | ||
114 | struct listen_sock *listen_opt; | ||
115 | }; | ||
116 | |||
117 | extern int reqsk_queue_alloc(struct request_sock_queue *queue, | ||
118 | const int nr_table_entries); | ||
119 | |||
120 | static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue) | ||
121 | { | ||
122 | struct listen_sock *lopt; | ||
123 | |||
124 | write_lock_bh(&queue->syn_wait_lock); | ||
125 | lopt = queue->listen_opt; | ||
126 | queue->listen_opt = NULL; | ||
127 | write_unlock_bh(&queue->syn_wait_lock); | ||
128 | |||
129 | return lopt; | ||
130 | } | ||
131 | |||
132 | static inline void reqsk_queue_destroy(struct request_sock_queue *queue) | ||
133 | { | ||
134 | kfree(reqsk_queue_yank_listen_sk(queue)); | ||
135 | } | ||
136 | |||
137 | static inline struct request_sock * | ||
138 | reqsk_queue_yank_acceptq(struct request_sock_queue *queue) | ||
139 | { | ||
140 | struct request_sock *req = queue->rskq_accept_head; | ||
141 | |||
142 | queue->rskq_accept_head = queue->rskq_accept_head = NULL; | ||
143 | return req; | ||
144 | } | ||
145 | |||
146 | static inline int reqsk_queue_empty(struct request_sock_queue *queue) | ||
147 | { | ||
148 | return queue->rskq_accept_head == NULL; | ||
149 | } | ||
150 | |||
151 | static inline void reqsk_queue_unlink(struct request_sock_queue *queue, | ||
152 | struct request_sock *req, | ||
153 | struct request_sock **prev_req) | ||
154 | { | ||
155 | write_lock(&queue->syn_wait_lock); | ||
156 | *prev_req = req->dl_next; | ||
157 | write_unlock(&queue->syn_wait_lock); | ||
158 | } | ||
159 | |||
160 | static inline void reqsk_queue_add(struct request_sock_queue *queue, | ||
161 | struct request_sock *req, | ||
162 | struct sock *parent, | ||
163 | struct sock *child) | ||
164 | { | ||
165 | req->sk = child; | ||
166 | sk_acceptq_added(parent); | ||
167 | |||
168 | if (queue->rskq_accept_head == NULL) | ||
169 | queue->rskq_accept_head = req; | ||
170 | else | ||
171 | queue->rskq_accept_tail->dl_next = req; | ||
172 | |||
173 | queue->rskq_accept_tail = req; | ||
174 | req->dl_next = NULL; | ||
175 | } | ||
176 | |||
177 | static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue) | ||
178 | { | ||
179 | struct request_sock *req = queue->rskq_accept_head; | ||
180 | |||
181 | BUG_TRAP(req != NULL); | ||
182 | |||
183 | queue->rskq_accept_head = req->dl_next; | ||
184 | if (queue->rskq_accept_head == NULL) | ||
185 | queue->rskq_accept_tail = NULL; | ||
186 | |||
187 | return req; | ||
188 | } | ||
189 | |||
190 | static inline struct sock *reqsk_queue_get_child(struct request_sock_queue *queue, | ||
191 | struct sock *parent) | ||
192 | { | ||
193 | struct request_sock *req = reqsk_queue_remove(queue); | ||
194 | struct sock *child = req->sk; | ||
195 | |||
196 | BUG_TRAP(child != NULL); | ||
197 | |||
198 | sk_acceptq_removed(parent); | ||
199 | __reqsk_free(req); | ||
200 | return child; | ||
201 | } | ||
202 | |||
203 | static inline int reqsk_queue_removed(struct request_sock_queue *queue, | ||
204 | struct request_sock *req) | ||
205 | { | ||
206 | struct listen_sock *lopt = queue->listen_opt; | ||
207 | |||
208 | if (req->retrans == 0) | ||
209 | --lopt->qlen_young; | ||
210 | |||
211 | return --lopt->qlen; | ||
212 | } | ||
213 | |||
214 | static inline int reqsk_queue_added(struct request_sock_queue *queue) | ||
215 | { | ||
216 | struct listen_sock *lopt = queue->listen_opt; | ||
217 | const int prev_qlen = lopt->qlen; | ||
218 | |||
219 | lopt->qlen_young++; | ||
220 | lopt->qlen++; | ||
221 | return prev_qlen; | ||
222 | } | ||
223 | |||
224 | static inline int reqsk_queue_len(struct request_sock_queue *queue) | ||
225 | { | ||
226 | return queue->listen_opt != NULL ? queue->listen_opt->qlen : 0; | ||
227 | } | ||
228 | |||
229 | static inline int reqsk_queue_len_young(struct request_sock_queue *queue) | ||
230 | { | ||
231 | return queue->listen_opt->qlen_young; | ||
232 | } | ||
233 | |||
234 | static inline int reqsk_queue_is_full(struct request_sock_queue *queue) | ||
235 | { | ||
236 | return queue->listen_opt->qlen >> queue->listen_opt->max_qlen_log; | ||
237 | } | ||
238 | |||
239 | static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, | ||
240 | u32 hash, struct request_sock *req, | ||
241 | unsigned timeout) | ||
242 | { | ||
243 | struct listen_sock *lopt = queue->listen_opt; | ||
244 | |||
245 | req->expires = jiffies + timeout; | ||
246 | req->retrans = 0; | ||
247 | req->sk = NULL; | ||
248 | req->dl_next = lopt->syn_table[hash]; | ||
249 | |||
250 | write_lock(&queue->syn_wait_lock); | ||
251 | lopt->syn_table[hash] = req; | ||
252 | write_unlock(&queue->syn_wait_lock); | ||
253 | } | ||
254 | |||
255 | #endif /* _REQUEST_SOCK_H */ | ||
diff --git a/include/net/route.h b/include/net/route.h index efe92b239ef1..c3cd069a9aca 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -107,7 +107,7 @@ struct rt_cache_stat | |||
107 | 107 | ||
108 | extern struct rt_cache_stat *rt_cache_stat; | 108 | extern struct rt_cache_stat *rt_cache_stat; |
109 | #define RT_CACHE_STAT_INC(field) \ | 109 | #define RT_CACHE_STAT_INC(field) \ |
110 | (per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++) | 110 | (per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++) |
111 | 111 | ||
112 | extern struct ip_rt_acct *ip_rt_acct; | 112 | extern struct ip_rt_acct *ip_rt_acct; |
113 | 113 | ||
@@ -181,9 +181,6 @@ static inline int ip_route_newports(struct rtable **rp, u16 sport, u16 dport, | |||
181 | memcpy(&fl, &(*rp)->fl, sizeof(fl)); | 181 | memcpy(&fl, &(*rp)->fl, sizeof(fl)); |
182 | fl.fl_ip_sport = sport; | 182 | fl.fl_ip_sport = sport; |
183 | fl.fl_ip_dport = dport; | 183 | fl.fl_ip_dport = dport; |
184 | #if defined(CONFIG_IP_ROUTE_MULTIPATH_CACHED) | ||
185 | fl.flags |= FLOWI_FLAG_MULTIPATHOLDROUTE; | ||
186 | #endif | ||
187 | ip_rt_put(*rp); | 184 | ip_rt_put(*rp); |
188 | *rp = NULL; | 185 | *rp = NULL; |
189 | return ip_route_output_flow(rp, &fl, sk, 0); | 186 | return ip_route_output_flow(rp, &fl, sk, 0); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index c57504b3b518..7b97405e2dbf 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -172,4 +172,126 @@ tcf_destroy(struct tcf_proto *tp) | |||
172 | kfree(tp); | 172 | kfree(tp); |
173 | } | 173 | } |
174 | 174 | ||
175 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | ||
176 | struct sk_buff_head *list) | ||
177 | { | ||
178 | __skb_queue_tail(list, skb); | ||
179 | sch->qstats.backlog += skb->len; | ||
180 | sch->bstats.bytes += skb->len; | ||
181 | sch->bstats.packets++; | ||
182 | |||
183 | return NET_XMIT_SUCCESS; | ||
184 | } | ||
185 | |||
186 | static inline int qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch) | ||
187 | { | ||
188 | return __qdisc_enqueue_tail(skb, sch, &sch->q); | ||
189 | } | ||
190 | |||
191 | static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch, | ||
192 | struct sk_buff_head *list) | ||
193 | { | ||
194 | struct sk_buff *skb = __skb_dequeue(list); | ||
195 | |||
196 | if (likely(skb != NULL)) | ||
197 | sch->qstats.backlog -= skb->len; | ||
198 | |||
199 | return skb; | ||
200 | } | ||
201 | |||
202 | static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch) | ||
203 | { | ||
204 | return __qdisc_dequeue_head(sch, &sch->q); | ||
205 | } | ||
206 | |||
207 | static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, | ||
208 | struct sk_buff_head *list) | ||
209 | { | ||
210 | struct sk_buff *skb = __skb_dequeue_tail(list); | ||
211 | |||
212 | if (likely(skb != NULL)) | ||
213 | sch->qstats.backlog -= skb->len; | ||
214 | |||
215 | return skb; | ||
216 | } | ||
217 | |||
218 | static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch) | ||
219 | { | ||
220 | return __qdisc_dequeue_tail(sch, &sch->q); | ||
221 | } | ||
222 | |||
223 | static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, | ||
224 | struct sk_buff_head *list) | ||
225 | { | ||
226 | __skb_queue_head(list, skb); | ||
227 | sch->qstats.backlog += skb->len; | ||
228 | sch->qstats.requeues++; | ||
229 | |||
230 | return NET_XMIT_SUCCESS; | ||
231 | } | ||
232 | |||
233 | static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch) | ||
234 | { | ||
235 | return __qdisc_requeue(skb, sch, &sch->q); | ||
236 | } | ||
237 | |||
238 | static inline void __qdisc_reset_queue(struct Qdisc *sch, | ||
239 | struct sk_buff_head *list) | ||
240 | { | ||
241 | /* | ||
242 | * We do not know the backlog in bytes of this list, it | ||
243 | * is up to the caller to correct it | ||
244 | */ | ||
245 | skb_queue_purge(list); | ||
246 | } | ||
247 | |||
248 | static inline void qdisc_reset_queue(struct Qdisc *sch) | ||
249 | { | ||
250 | __qdisc_reset_queue(sch, &sch->q); | ||
251 | sch->qstats.backlog = 0; | ||
252 | } | ||
253 | |||
254 | static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch, | ||
255 | struct sk_buff_head *list) | ||
256 | { | ||
257 | struct sk_buff *skb = __qdisc_dequeue_tail(sch, list); | ||
258 | |||
259 | if (likely(skb != NULL)) { | ||
260 | unsigned int len = skb->len; | ||
261 | kfree_skb(skb); | ||
262 | return len; | ||
263 | } | ||
264 | |||
265 | return 0; | ||
266 | } | ||
267 | |||
268 | static inline unsigned int qdisc_queue_drop(struct Qdisc *sch) | ||
269 | { | ||
270 | return __qdisc_queue_drop(sch, &sch->q); | ||
271 | } | ||
272 | |||
273 | static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch) | ||
274 | { | ||
275 | kfree_skb(skb); | ||
276 | sch->qstats.drops++; | ||
277 | |||
278 | return NET_XMIT_DROP; | ||
279 | } | ||
280 | |||
281 | static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch) | ||
282 | { | ||
283 | sch->qstats.drops++; | ||
284 | |||
285 | #ifdef CONFIG_NET_CLS_POLICE | ||
286 | if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch)) | ||
287 | goto drop; | ||
288 | |||
289 | return NET_XMIT_SUCCESS; | ||
290 | |||
291 | drop: | ||
292 | #endif | ||
293 | kfree_skb(skb); | ||
294 | return NET_XMIT_DROP; | ||
295 | } | ||
296 | |||
175 | #endif | 297 | #endif |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index ebc5282e6d58..dc107ffad483 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
@@ -65,9 +65,11 @@ typedef enum { | |||
65 | SCTP_CMD_TIMER_START, /* Start a timer. */ | 65 | SCTP_CMD_TIMER_START, /* Start a timer. */ |
66 | SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ | 66 | SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ |
67 | SCTP_CMD_TIMER_STOP, /* Stop a timer. */ | 67 | SCTP_CMD_TIMER_STOP, /* Stop a timer. */ |
68 | SCTP_CMD_COUNTER_RESET, /* Reset a counter. */ | 68 | SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */ |
69 | SCTP_CMD_COUNTER_INC, /* Increment a counter. */ | 69 | SCTP_CMD_INIT_COUNTER_RESET, /* Reset init counter. */ |
70 | SCTP_CMD_INIT_COUNTER_INC, /* Increment init counter. */ | ||
70 | SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */ | 71 | SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */ |
72 | SCTP_CMD_COOKIEECHO_RESTART, /* High level, do cookie-echo timer work. */ | ||
71 | SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ | 73 | SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ |
72 | SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ | 74 | SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ |
73 | SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ | 75 | SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ |
@@ -118,7 +120,6 @@ typedef union { | |||
118 | int error; | 120 | int error; |
119 | sctp_state_t state; | 121 | sctp_state_t state; |
120 | sctp_event_timeout_t to; | 122 | sctp_event_timeout_t to; |
121 | sctp_counter_t counter; | ||
122 | void *ptr; | 123 | void *ptr; |
123 | struct sctp_chunk *chunk; | 124 | struct sctp_chunk *chunk; |
124 | struct sctp_association *asoc; | 125 | struct sctp_association *asoc; |
@@ -165,7 +166,6 @@ SCTP_ARG_CONSTRUCTOR(U16, __u16, u16) | |||
165 | SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) | 166 | SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) |
166 | SCTP_ARG_CONSTRUCTOR(ERROR, int, error) | 167 | SCTP_ARG_CONSTRUCTOR(ERROR, int, error) |
167 | SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) | 168 | SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) |
168 | SCTP_ARG_CONSTRUCTOR(COUNTER, sctp_counter_t, counter) | ||
169 | SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) | 169 | SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) |
170 | SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) | 170 | SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) |
171 | SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) | 171 | SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 2b76c0f4babc..4868c7f7749d 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -263,13 +263,6 @@ enum { SCTP_MIN_PMTU = 576 }; | |||
263 | enum { SCTP_MAX_DUP_TSNS = 16 }; | 263 | enum { SCTP_MAX_DUP_TSNS = 16 }; |
264 | enum { SCTP_MAX_GABS = 16 }; | 264 | enum { SCTP_MAX_GABS = 16 }; |
265 | 265 | ||
266 | typedef enum { | ||
267 | SCTP_COUNTER_INIT_ERROR, | ||
268 | } sctp_counter_t; | ||
269 | |||
270 | /* How many counters does an association need? */ | ||
271 | #define SCTP_NUMBER_COUNTERS 5 | ||
272 | |||
273 | /* Here we define the default timers. */ | 266 | /* Here we define the default timers. */ |
274 | 267 | ||
275 | /* cookie timer def = ? seconds */ | 268 | /* cookie timer def = ? seconds */ |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 960abfa48d68..ef2738159ab3 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -223,6 +223,22 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); | |||
223 | extern int sctp_debug_flag; | 223 | extern int sctp_debug_flag; |
224 | #define SCTP_DEBUG_PRINTK(whatever...) \ | 224 | #define SCTP_DEBUG_PRINTK(whatever...) \ |
225 | ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) | 225 | ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) |
226 | #define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \ | ||
227 | if (sctp_debug_flag) { \ | ||
228 | if (saddr->sa.sa_family == AF_INET6) { \ | ||
229 | printk(KERN_DEBUG \ | ||
230 | lead "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" trail, \ | ||
231 | leadparm, \ | ||
232 | NIP6(saddr->v6.sin6_addr), \ | ||
233 | otherparms); \ | ||
234 | } else { \ | ||
235 | printk(KERN_DEBUG \ | ||
236 | lead "%u.%u.%u.%u" trail, \ | ||
237 | leadparm, \ | ||
238 | NIPQUAD(saddr->v4.sin_addr.s_addr), \ | ||
239 | otherparms); \ | ||
240 | } \ | ||
241 | } | ||
226 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } | 242 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } |
227 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } | 243 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } |
228 | 244 | ||
@@ -236,6 +252,7 @@ extern int sctp_debug_flag; | |||
236 | #else /* SCTP_DEBUG */ | 252 | #else /* SCTP_DEBUG */ |
237 | 253 | ||
238 | #define SCTP_DEBUG_PRINTK(whatever...) | 254 | #define SCTP_DEBUG_PRINTK(whatever...) |
255 | #define SCTP_DEBUG_PRINTK_IPADDR(whatever...) | ||
239 | #define SCTP_ENABLE_DEBUG | 256 | #define SCTP_ENABLE_DEBUG |
240 | #define SCTP_DISABLE_DEBUG | 257 | #define SCTP_DISABLE_DEBUG |
241 | #define SCTP_ASSERT(expr, str, func) | 258 | #define SCTP_ASSERT(expr, str, func) |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index f4fcee104707..88d9fe5975d5 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -116,7 +116,8 @@ sctp_state_fn_t sctp_sf_eat_data_fast_4_4; | |||
116 | sctp_state_fn_t sctp_sf_eat_sack_6_2; | 116 | sctp_state_fn_t sctp_sf_eat_sack_6_2; |
117 | sctp_state_fn_t sctp_sf_tabort_8_4_8; | 117 | sctp_state_fn_t sctp_sf_tabort_8_4_8; |
118 | sctp_state_fn_t sctp_sf_operr_notify; | 118 | sctp_state_fn_t sctp_sf_operr_notify; |
119 | sctp_state_fn_t sctp_sf_t1_timer_expire; | 119 | sctp_state_fn_t sctp_sf_t1_init_timer_expire; |
120 | sctp_state_fn_t sctp_sf_t1_cookie_timer_expire; | ||
120 | sctp_state_fn_t sctp_sf_t2_timer_expire; | 121 | sctp_state_fn_t sctp_sf_t2_timer_expire; |
121 | sctp_state_fn_t sctp_sf_t4_timer_expire; | 122 | sctp_state_fn_t sctp_sf_t4_timer_expire; |
122 | sctp_state_fn_t sctp_sf_t5_timer_expire; | 123 | sctp_state_fn_t sctp_sf_t5_timer_expire; |
@@ -130,7 +131,6 @@ sctp_state_fn_t sctp_sf_do_ecne; | |||
130 | sctp_state_fn_t sctp_sf_ootb; | 131 | sctp_state_fn_t sctp_sf_ootb; |
131 | sctp_state_fn_t sctp_sf_pdiscard; | 132 | sctp_state_fn_t sctp_sf_pdiscard; |
132 | sctp_state_fn_t sctp_sf_violation; | 133 | sctp_state_fn_t sctp_sf_violation; |
133 | sctp_state_fn_t sctp_sf_violation_chunklen; | ||
134 | sctp_state_fn_t sctp_sf_discard_chunk; | 134 | sctp_state_fn_t sctp_sf_discard_chunk; |
135 | sctp_state_fn_t sctp_sf_do_5_2_1_siminit; | 135 | sctp_state_fn_t sctp_sf_do_5_2_1_siminit; |
136 | sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; | 136 | sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; |
@@ -258,8 +258,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, | |||
258 | void sctp_chunk_assign_tsn(struct sctp_chunk *); | 258 | void sctp_chunk_assign_tsn(struct sctp_chunk *); |
259 | void sctp_chunk_assign_ssn(struct sctp_chunk *); | 259 | void sctp_chunk_assign_ssn(struct sctp_chunk *); |
260 | 260 | ||
261 | void sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, __u16 error); | ||
262 | |||
263 | /* Prototypes for statetable processing. */ | 261 | /* Prototypes for statetable processing. */ |
264 | 262 | ||
265 | int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, | 263 | int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 6c24d9cd3d66..dfad4d3c581c 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -867,10 +867,13 @@ struct sctp_transport { | |||
867 | */ | 867 | */ |
868 | unsigned long last_time_ecne_reduced; | 868 | unsigned long last_time_ecne_reduced; |
869 | 869 | ||
870 | /* active : The current active state of this destination, | 870 | /* The number of times INIT has been sent on this transport. */ |
871 | * : i.e. DOWN, UP, etc. | 871 | int init_sent_count; |
872 | |||
873 | /* state : The current state of this destination, | ||
874 | * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN. | ||
872 | */ | 875 | */ |
873 | int active; | 876 | int state; |
874 | 877 | ||
875 | /* hb_allowed : The current heartbeat state of this destination, | 878 | /* hb_allowed : The current heartbeat state of this destination, |
876 | * : i.e. ALLOW-HB, NO-HEARTBEAT, etc. | 879 | * : i.e. ALLOW-HB, NO-HEARTBEAT, etc. |
@@ -1222,9 +1225,6 @@ struct sctp_endpoint { | |||
1222 | 1225 | ||
1223 | /* sendbuf acct. policy. */ | 1226 | /* sendbuf acct. policy. */ |
1224 | __u32 sndbuf_policy; | 1227 | __u32 sndbuf_policy; |
1225 | |||
1226 | /* Name for debugging output... */ | ||
1227 | char *debug_name; | ||
1228 | }; | 1228 | }; |
1229 | 1229 | ||
1230 | /* Recover the outter endpoint structure. */ | 1230 | /* Recover the outter endpoint structure. */ |
@@ -1314,11 +1314,23 @@ struct sctp_association { | |||
1314 | * : association. Normally this information is | 1314 | * : association. Normally this information is |
1315 | * : hashed or keyed for quick lookup and access | 1315 | * : hashed or keyed for quick lookup and access |
1316 | * : of the TCB. | 1316 | * : of the TCB. |
1317 | * : The list is also initialized with the list | ||
1318 | * : of addresses passed with the sctp_connectx() | ||
1319 | * : call. | ||
1317 | * | 1320 | * |
1318 | * It is a list of SCTP_transport's. | 1321 | * It is a list of SCTP_transport's. |
1319 | */ | 1322 | */ |
1320 | struct list_head transport_addr_list; | 1323 | struct list_head transport_addr_list; |
1321 | 1324 | ||
1325 | /* transport_count | ||
1326 | * | ||
1327 | * Peer : A count of the number of peer addresses | ||
1328 | * Transport : in the Peer Transport Address List. | ||
1329 | * Address : | ||
1330 | * Count : | ||
1331 | */ | ||
1332 | __u16 transport_count; | ||
1333 | |||
1322 | /* port | 1334 | /* port |
1323 | * The transport layer port number. | 1335 | * The transport layer port number. |
1324 | */ | 1336 | */ |
@@ -1486,6 +1498,9 @@ struct sctp_association { | |||
1486 | /* Transport to which SHUTDOWN chunk was last sent. */ | 1498 | /* Transport to which SHUTDOWN chunk was last sent. */ |
1487 | struct sctp_transport *shutdown_last_sent_to; | 1499 | struct sctp_transport *shutdown_last_sent_to; |
1488 | 1500 | ||
1501 | /* Transport to which INIT chunk was last sent. */ | ||
1502 | struct sctp_transport *init_last_sent_to; | ||
1503 | |||
1489 | /* Next TSN : The next TSN number to be assigned to a new | 1504 | /* Next TSN : The next TSN number to be assigned to a new |
1490 | * : DATA chunk. This is sent in the INIT or INIT | 1505 | * : DATA chunk. This is sent in the INIT or INIT |
1491 | * : ACK chunk to the peer and incremented each | 1506 | * : ACK chunk to the peer and incremented each |
@@ -1549,8 +1564,11 @@ struct sctp_association { | |||
1549 | /* The message size at which SCTP fragmentation will occur. */ | 1564 | /* The message size at which SCTP fragmentation will occur. */ |
1550 | __u32 frag_point; | 1565 | __u32 frag_point; |
1551 | 1566 | ||
1552 | /* Currently only one counter is used to count INIT errors. */ | 1567 | /* Counter used to count INIT errors. */ |
1553 | int counters[SCTP_NUMBER_COUNTERS]; | 1568 | int init_err_counter; |
1569 | |||
1570 | /* Count the number of INIT cycles (for doubling timeout). */ | ||
1571 | int init_cycle; | ||
1554 | 1572 | ||
1555 | /* Default send parameters. */ | 1573 | /* Default send parameters. */ |
1556 | __u16 default_stream; | 1574 | __u16 default_stream; |
@@ -1708,6 +1726,8 @@ void sctp_association_free(struct sctp_association *); | |||
1708 | void sctp_association_put(struct sctp_association *); | 1726 | void sctp_association_put(struct sctp_association *); |
1709 | void sctp_association_hold(struct sctp_association *); | 1727 | void sctp_association_hold(struct sctp_association *); |
1710 | 1728 | ||
1729 | struct sctp_transport *sctp_assoc_choose_init_transport( | ||
1730 | struct sctp_association *); | ||
1711 | struct sctp_transport *sctp_assoc_choose_shutdown_transport( | 1731 | struct sctp_transport *sctp_assoc_choose_shutdown_transport( |
1712 | struct sctp_association *); | 1732 | struct sctp_association *); |
1713 | void sctp_assoc_update_retran_path(struct sctp_association *); | 1733 | void sctp_assoc_update_retran_path(struct sctp_association *); |
@@ -1717,9 +1737,12 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc, | |||
1717 | const union sctp_addr *laddr); | 1737 | const union sctp_addr *laddr); |
1718 | struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, | 1738 | struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, |
1719 | const union sctp_addr *address, | 1739 | const union sctp_addr *address, |
1720 | const int gfp); | 1740 | const int gfp, |
1741 | const int peer_state); | ||
1721 | void sctp_assoc_del_peer(struct sctp_association *asoc, | 1742 | void sctp_assoc_del_peer(struct sctp_association *asoc, |
1722 | const union sctp_addr *addr); | 1743 | const union sctp_addr *addr); |
1744 | void sctp_assoc_rm_peer(struct sctp_association *asoc, | ||
1745 | struct sctp_transport *peer); | ||
1723 | void sctp_assoc_control_transport(struct sctp_association *, | 1746 | void sctp_assoc_control_transport(struct sctp_association *, |
1724 | struct sctp_transport *, | 1747 | struct sctp_transport *, |
1725 | sctp_transport_cmd_t, sctp_sn_error_t); | 1748 | sctp_transport_cmd_t, sctp_sn_error_t); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 2758e8ce4f25..f6328aeddcce 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -111,6 +111,8 @@ enum sctp_optname { | |||
111 | #define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM | 111 | #define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM |
112 | SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ | 112 | SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ |
113 | #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS | 113 | #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS |
114 | SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ | ||
115 | #define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX | ||
114 | }; | 116 | }; |
115 | 117 | ||
116 | /* | 118 | /* |
@@ -527,6 +529,7 @@ struct sctp_paddrinfo { | |||
527 | enum sctp_spinfo_state { | 529 | enum sctp_spinfo_state { |
528 | SCTP_INACTIVE, | 530 | SCTP_INACTIVE, |
529 | SCTP_ACTIVE, | 531 | SCTP_ACTIVE, |
532 | SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ | ||
530 | }; | 533 | }; |
531 | 534 | ||
532 | /* | 535 | /* |
diff --git a/include/net/snmp.h b/include/net/snmp.h index a15ab256276e..a36bed8ea210 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -128,18 +128,18 @@ struct linux_mib { | |||
128 | #define SNMP_STAT_USRPTR(name) (name[1]) | 128 | #define SNMP_STAT_USRPTR(name) (name[1]) |
129 | 129 | ||
130 | #define SNMP_INC_STATS_BH(mib, field) \ | 130 | #define SNMP_INC_STATS_BH(mib, field) \ |
131 | (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field]++) | 131 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) |
132 | #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ | 132 | #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ |
133 | (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field + (offset)]++) | 133 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field + (offset)]++) |
134 | #define SNMP_INC_STATS_USER(mib, field) \ | 134 | #define SNMP_INC_STATS_USER(mib, field) \ |
135 | (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field]++) | 135 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++) |
136 | #define SNMP_INC_STATS(mib, field) \ | 136 | #define SNMP_INC_STATS(mib, field) \ |
137 | (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]++) | 137 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++) |
138 | #define SNMP_DEC_STATS(mib, field) \ | 138 | #define SNMP_DEC_STATS(mib, field) \ |
139 | (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]--) | 139 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--) |
140 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 140 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
141 | (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field] += addend) | 141 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) |
142 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 142 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
143 | (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field] += addend) | 143 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend) |
144 | 144 | ||
145 | #endif | 145 | #endif |
diff --git a/include/net/sock.h b/include/net/sock.h index a9ef3a6a13f3..e593af5b1ecc 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -484,6 +484,8 @@ extern void sk_stream_kill_queues(struct sock *sk); | |||
484 | 484 | ||
485 | extern int sk_wait_data(struct sock *sk, long *timeo); | 485 | extern int sk_wait_data(struct sock *sk, long *timeo); |
486 | 486 | ||
487 | struct request_sock_ops; | ||
488 | |||
487 | /* Networking protocol blocks we attach to sockets. | 489 | /* Networking protocol blocks we attach to sockets. |
488 | * socket layer -> transport layer interface | 490 | * socket layer -> transport layer interface |
489 | * transport -> network interface is defined by struct inet_proto | 491 | * transport -> network interface is defined by struct inet_proto |
@@ -547,6 +549,8 @@ struct proto { | |||
547 | kmem_cache_t *slab; | 549 | kmem_cache_t *slab; |
548 | unsigned int obj_size; | 550 | unsigned int obj_size; |
549 | 551 | ||
552 | struct request_sock_ops *rsk_prot; | ||
553 | |||
550 | struct module *owner; | 554 | struct module *owner; |
551 | 555 | ||
552 | char name[32]; | 556 | char name[32]; |
diff --git a/include/net/tcp.h b/include/net/tcp.h index e71f8ba3e101..ec9e20c27179 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/cache.h> | 31 | #include <linux/cache.h> |
32 | #include <linux/percpu.h> | 32 | #include <linux/percpu.h> |
33 | #include <net/checksum.h> | 33 | #include <net/checksum.h> |
34 | #include <net/request_sock.h> | ||
34 | #include <net/sock.h> | 35 | #include <net/sock.h> |
35 | #include <net/snmp.h> | 36 | #include <net/snmp.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -504,25 +505,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk) | |||
504 | #else | 505 | #else |
505 | # define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) | 506 | # define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) |
506 | #endif | 507 | #endif |
507 | |||
508 | #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation | ||
509 | * max_cwnd = snd_cwnd * beta | ||
510 | */ | ||
511 | #define BICTCP_MAX_INCREMENT 32 /* | ||
512 | * Limit on the amount of | ||
513 | * increment allowed during | ||
514 | * binary search. | ||
515 | */ | ||
516 | #define BICTCP_FUNC_OF_MIN_INCR 11 /* | ||
517 | * log(B/Smin)/log(B/(B-1))+1, | ||
518 | * Smin:min increment | ||
519 | * B:log factor | ||
520 | */ | ||
521 | #define BICTCP_B 4 /* | ||
522 | * In binary search, | ||
523 | * go to point (max+min)/N | ||
524 | */ | ||
525 | |||
526 | /* | 508 | /* |
527 | * TCP option | 509 | * TCP option |
528 | */ | 510 | */ |
@@ -563,7 +545,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk) | |||
563 | #define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */ | 545 | #define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */ |
564 | 546 | ||
565 | /* sysctl variables for tcp */ | 547 | /* sysctl variables for tcp */ |
566 | extern int sysctl_max_syn_backlog; | ||
567 | extern int sysctl_tcp_timestamps; | 548 | extern int sysctl_tcp_timestamps; |
568 | extern int sysctl_tcp_window_scaling; | 549 | extern int sysctl_tcp_window_scaling; |
569 | extern int sysctl_tcp_sack; | 550 | extern int sysctl_tcp_sack; |
@@ -596,16 +577,7 @@ extern int sysctl_tcp_adv_win_scale; | |||
596 | extern int sysctl_tcp_tw_reuse; | 577 | extern int sysctl_tcp_tw_reuse; |
597 | extern int sysctl_tcp_frto; | 578 | extern int sysctl_tcp_frto; |
598 | extern int sysctl_tcp_low_latency; | 579 | extern int sysctl_tcp_low_latency; |
599 | extern int sysctl_tcp_westwood; | ||
600 | extern int sysctl_tcp_vegas_cong_avoid; | ||
601 | extern int sysctl_tcp_vegas_alpha; | ||
602 | extern int sysctl_tcp_vegas_beta; | ||
603 | extern int sysctl_tcp_vegas_gamma; | ||
604 | extern int sysctl_tcp_nometrics_save; | 580 | extern int sysctl_tcp_nometrics_save; |
605 | extern int sysctl_tcp_bic; | ||
606 | extern int sysctl_tcp_bic_fast_convergence; | ||
607 | extern int sysctl_tcp_bic_low_window; | ||
608 | extern int sysctl_tcp_bic_beta; | ||
609 | extern int sysctl_tcp_moderate_rcvbuf; | 581 | extern int sysctl_tcp_moderate_rcvbuf; |
610 | extern int sysctl_tcp_tso_win_divisor; | 582 | extern int sysctl_tcp_tso_win_divisor; |
611 | 583 | ||
@@ -613,74 +585,6 @@ extern atomic_t tcp_memory_allocated; | |||
613 | extern atomic_t tcp_sockets_allocated; | 585 | extern atomic_t tcp_sockets_allocated; |
614 | extern int tcp_memory_pressure; | 586 | extern int tcp_memory_pressure; |
615 | 587 | ||
616 | struct open_request; | ||
617 | |||
618 | struct or_calltable { | ||
619 | int family; | ||
620 | int (*rtx_syn_ack) (struct sock *sk, struct open_request *req, struct dst_entry*); | ||
621 | void (*send_ack) (struct sk_buff *skb, struct open_request *req); | ||
622 | void (*destructor) (struct open_request *req); | ||
623 | void (*send_reset) (struct sk_buff *skb); | ||
624 | }; | ||
625 | |||
626 | struct tcp_v4_open_req { | ||
627 | __u32 loc_addr; | ||
628 | __u32 rmt_addr; | ||
629 | struct ip_options *opt; | ||
630 | }; | ||
631 | |||
632 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | ||
633 | struct tcp_v6_open_req { | ||
634 | struct in6_addr loc_addr; | ||
635 | struct in6_addr rmt_addr; | ||
636 | struct sk_buff *pktopts; | ||
637 | int iif; | ||
638 | }; | ||
639 | #endif | ||
640 | |||
641 | /* this structure is too big */ | ||
642 | struct open_request { | ||
643 | struct open_request *dl_next; /* Must be first member! */ | ||
644 | __u32 rcv_isn; | ||
645 | __u32 snt_isn; | ||
646 | __u16 rmt_port; | ||
647 | __u16 mss; | ||
648 | __u8 retrans; | ||
649 | __u8 __pad; | ||
650 | __u16 snd_wscale : 4, | ||
651 | rcv_wscale : 4, | ||
652 | tstamp_ok : 1, | ||
653 | sack_ok : 1, | ||
654 | wscale_ok : 1, | ||
655 | ecn_ok : 1, | ||
656 | acked : 1; | ||
657 | /* The following two fields can be easily recomputed I think -AK */ | ||
658 | __u32 window_clamp; /* window clamp at creation time */ | ||
659 | __u32 rcv_wnd; /* rcv_wnd offered first time */ | ||
660 | __u32 ts_recent; | ||
661 | unsigned long expires; | ||
662 | struct or_calltable *class; | ||
663 | struct sock *sk; | ||
664 | union { | ||
665 | struct tcp_v4_open_req v4_req; | ||
666 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | ||
667 | struct tcp_v6_open_req v6_req; | ||
668 | #endif | ||
669 | } af; | ||
670 | }; | ||
671 | |||
672 | /* SLAB cache for open requests. */ | ||
673 | extern kmem_cache_t *tcp_openreq_cachep; | ||
674 | |||
675 | #define tcp_openreq_alloc() kmem_cache_alloc(tcp_openreq_cachep, SLAB_ATOMIC) | ||
676 | #define tcp_openreq_fastfree(req) kmem_cache_free(tcp_openreq_cachep, req) | ||
677 | |||
678 | static inline void tcp_openreq_free(struct open_request *req) | ||
679 | { | ||
680 | req->class->destructor(req); | ||
681 | tcp_openreq_fastfree(req); | ||
682 | } | ||
683 | |||
684 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 588 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
685 | #define TCP_INET_FAMILY(fam) ((fam) == AF_INET) | 589 | #define TCP_INET_FAMILY(fam) ((fam) == AF_INET) |
686 | #else | 590 | #else |
@@ -708,7 +612,7 @@ struct tcp_func { | |||
708 | 612 | ||
709 | struct sock * (*syn_recv_sock) (struct sock *sk, | 613 | struct sock * (*syn_recv_sock) (struct sock *sk, |
710 | struct sk_buff *skb, | 614 | struct sk_buff *skb, |
711 | struct open_request *req, | 615 | struct request_sock *req, |
712 | struct dst_entry *dst); | 616 | struct dst_entry *dst); |
713 | 617 | ||
714 | int (*remember_stamp) (struct sock *sk); | 618 | int (*remember_stamp) (struct sock *sk); |
@@ -852,8 +756,8 @@ extern enum tcp_tw_status tcp_timewait_state_process(struct tcp_tw_bucket *tw, | |||
852 | unsigned len); | 756 | unsigned len); |
853 | 757 | ||
854 | extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | 758 | extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, |
855 | struct open_request *req, | 759 | struct request_sock *req, |
856 | struct open_request **prev); | 760 | struct request_sock **prev); |
857 | extern int tcp_child_process(struct sock *parent, | 761 | extern int tcp_child_process(struct sock *parent, |
858 | struct sock *child, | 762 | struct sock *child, |
859 | struct sk_buff *skb); | 763 | struct sk_buff *skb); |
@@ -903,12 +807,12 @@ extern int tcp_v4_conn_request(struct sock *sk, | |||
903 | struct sk_buff *skb); | 807 | struct sk_buff *skb); |
904 | 808 | ||
905 | extern struct sock * tcp_create_openreq_child(struct sock *sk, | 809 | extern struct sock * tcp_create_openreq_child(struct sock *sk, |
906 | struct open_request *req, | 810 | struct request_sock *req, |
907 | struct sk_buff *skb); | 811 | struct sk_buff *skb); |
908 | 812 | ||
909 | extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, | 813 | extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, |
910 | struct sk_buff *skb, | 814 | struct sk_buff *skb, |
911 | struct open_request *req, | 815 | struct request_sock *req, |
912 | struct dst_entry *dst); | 816 | struct dst_entry *dst); |
913 | 817 | ||
914 | extern int tcp_v4_do_rcv(struct sock *sk, | 818 | extern int tcp_v4_do_rcv(struct sock *sk, |
@@ -922,7 +826,7 @@ extern int tcp_connect(struct sock *sk); | |||
922 | 826 | ||
923 | extern struct sk_buff * tcp_make_synack(struct sock *sk, | 827 | extern struct sk_buff * tcp_make_synack(struct sock *sk, |
924 | struct dst_entry *dst, | 828 | struct dst_entry *dst, |
925 | struct open_request *req); | 829 | struct request_sock *req); |
926 | 830 | ||
927 | extern int tcp_disconnect(struct sock *sk, int flags); | 831 | extern int tcp_disconnect(struct sock *sk, int flags); |
928 | 832 | ||
@@ -1204,6 +1108,82 @@ static inline void tcp_packets_out_dec(struct tcp_sock *tp, | |||
1204 | tp->packets_out -= tcp_skb_pcount(skb); | 1108 | tp->packets_out -= tcp_skb_pcount(skb); |
1205 | } | 1109 | } |
1206 | 1110 | ||
1111 | /* Events passed to congestion control interface */ | ||
1112 | enum tcp_ca_event { | ||
1113 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ | ||
1114 | CA_EVENT_CWND_RESTART, /* congestion window restart */ | ||
1115 | CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ | ||
1116 | CA_EVENT_FRTO, /* fast recovery timeout */ | ||
1117 | CA_EVENT_LOSS, /* loss timeout */ | ||
1118 | CA_EVENT_FAST_ACK, /* in sequence ack */ | ||
1119 | CA_EVENT_SLOW_ACK, /* other ack */ | ||
1120 | }; | ||
1121 | |||
1122 | /* | ||
1123 | * Interface for adding new TCP congestion control handlers | ||
1124 | */ | ||
1125 | #define TCP_CA_NAME_MAX 16 | ||
1126 | struct tcp_congestion_ops { | ||
1127 | struct list_head list; | ||
1128 | |||
1129 | /* initialize private data (optional) */ | ||
1130 | void (*init)(struct tcp_sock *tp); | ||
1131 | /* cleanup private data (optional) */ | ||
1132 | void (*release)(struct tcp_sock *tp); | ||
1133 | |||
1134 | /* return slow start threshold (required) */ | ||
1135 | u32 (*ssthresh)(struct tcp_sock *tp); | ||
1136 | /* lower bound for congestion window (optional) */ | ||
1137 | u32 (*min_cwnd)(struct tcp_sock *tp); | ||
1138 | /* do new cwnd calculation (required) */ | ||
1139 | void (*cong_avoid)(struct tcp_sock *tp, u32 ack, | ||
1140 | u32 rtt, u32 in_flight, int good_ack); | ||
1141 | /* round trip time sample per acked packet (optional) */ | ||
1142 | void (*rtt_sample)(struct tcp_sock *tp, u32 usrtt); | ||
1143 | /* call before changing ca_state (optional) */ | ||
1144 | void (*set_state)(struct tcp_sock *tp, u8 new_state); | ||
1145 | /* call when cwnd event occurs (optional) */ | ||
1146 | void (*cwnd_event)(struct tcp_sock *tp, enum tcp_ca_event ev); | ||
1147 | /* new value of cwnd after loss (optional) */ | ||
1148 | u32 (*undo_cwnd)(struct tcp_sock *tp); | ||
1149 | /* hook for packet ack accounting (optional) */ | ||
1150 | void (*pkts_acked)(struct tcp_sock *tp, u32 num_acked); | ||
1151 | /* get info for tcp_diag (optional) */ | ||
1152 | void (*get_info)(struct tcp_sock *tp, u32 ext, struct sk_buff *skb); | ||
1153 | |||
1154 | char name[TCP_CA_NAME_MAX]; | ||
1155 | struct module *owner; | ||
1156 | }; | ||
1157 | |||
1158 | extern int tcp_register_congestion_control(struct tcp_congestion_ops *type); | ||
1159 | extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); | ||
1160 | |||
1161 | extern void tcp_init_congestion_control(struct tcp_sock *tp); | ||
1162 | extern void tcp_cleanup_congestion_control(struct tcp_sock *tp); | ||
1163 | extern int tcp_set_default_congestion_control(const char *name); | ||
1164 | extern void tcp_get_default_congestion_control(char *name); | ||
1165 | extern int tcp_set_congestion_control(struct tcp_sock *tp, const char *name); | ||
1166 | |||
1167 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | ||
1168 | extern u32 tcp_reno_ssthresh(struct tcp_sock *tp); | ||
1169 | extern void tcp_reno_cong_avoid(struct tcp_sock *tp, u32 ack, | ||
1170 | u32 rtt, u32 in_flight, int flag); | ||
1171 | extern u32 tcp_reno_min_cwnd(struct tcp_sock *tp); | ||
1172 | extern struct tcp_congestion_ops tcp_reno; | ||
1173 | |||
1174 | static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state) | ||
1175 | { | ||
1176 | if (tp->ca_ops->set_state) | ||
1177 | tp->ca_ops->set_state(tp, ca_state); | ||
1178 | tp->ca_state = ca_state; | ||
1179 | } | ||
1180 | |||
1181 | static inline void tcp_ca_event(struct tcp_sock *tp, enum tcp_ca_event event) | ||
1182 | { | ||
1183 | if (tp->ca_ops->cwnd_event) | ||
1184 | tp->ca_ops->cwnd_event(tp, event); | ||
1185 | } | ||
1186 | |||
1207 | /* This determines how many packets are "in the network" to the best | 1187 | /* This determines how many packets are "in the network" to the best |
1208 | * of our knowledge. In many cases it is conservative, but where | 1188 | * of our knowledge. In many cases it is conservative, but where |
1209 | * detailed information is available from the receiver (via SACK | 1189 | * detailed information is available from the receiver (via SACK |
@@ -1223,91 +1203,6 @@ static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) | |||
1223 | return (tp->packets_out - tp->left_out + tp->retrans_out); | 1203 | return (tp->packets_out - tp->left_out + tp->retrans_out); |
1224 | } | 1204 | } |
1225 | 1205 | ||
1226 | /* | ||
1227 | * Which congestion algorithim is in use on the connection. | ||
1228 | */ | ||
1229 | #define tcp_is_vegas(__tp) ((__tp)->adv_cong == TCP_VEGAS) | ||
1230 | #define tcp_is_westwood(__tp) ((__tp)->adv_cong == TCP_WESTWOOD) | ||
1231 | #define tcp_is_bic(__tp) ((__tp)->adv_cong == TCP_BIC) | ||
1232 | |||
1233 | /* Recalculate snd_ssthresh, we want to set it to: | ||
1234 | * | ||
1235 | * Reno: | ||
1236 | * one half the current congestion window, but no | ||
1237 | * less than two segments | ||
1238 | * | ||
1239 | * BIC: | ||
1240 | * behave like Reno until low_window is reached, | ||
1241 | * then increase congestion window slowly | ||
1242 | */ | ||
1243 | static inline __u32 tcp_recalc_ssthresh(struct tcp_sock *tp) | ||
1244 | { | ||
1245 | if (tcp_is_bic(tp)) { | ||
1246 | if (sysctl_tcp_bic_fast_convergence && | ||
1247 | tp->snd_cwnd < tp->bictcp.last_max_cwnd) | ||
1248 | tp->bictcp.last_max_cwnd = (tp->snd_cwnd * | ||
1249 | (BICTCP_BETA_SCALE | ||
1250 | + sysctl_tcp_bic_beta)) | ||
1251 | / (2 * BICTCP_BETA_SCALE); | ||
1252 | else | ||
1253 | tp->bictcp.last_max_cwnd = tp->snd_cwnd; | ||
1254 | |||
1255 | if (tp->snd_cwnd > sysctl_tcp_bic_low_window) | ||
1256 | return max((tp->snd_cwnd * sysctl_tcp_bic_beta) | ||
1257 | / BICTCP_BETA_SCALE, 2U); | ||
1258 | } | ||
1259 | |||
1260 | return max(tp->snd_cwnd >> 1U, 2U); | ||
1261 | } | ||
1262 | |||
1263 | /* Stop taking Vegas samples for now. */ | ||
1264 | #define tcp_vegas_disable(__tp) ((__tp)->vegas.doing_vegas_now = 0) | ||
1265 | |||
1266 | static inline void tcp_vegas_enable(struct tcp_sock *tp) | ||
1267 | { | ||
1268 | /* There are several situations when we must "re-start" Vegas: | ||
1269 | * | ||
1270 | * o when a connection is established | ||
1271 | * o after an RTO | ||
1272 | * o after fast recovery | ||
1273 | * o when we send a packet and there is no outstanding | ||
1274 | * unacknowledged data (restarting an idle connection) | ||
1275 | * | ||
1276 | * In these circumstances we cannot do a Vegas calculation at the | ||
1277 | * end of the first RTT, because any calculation we do is using | ||
1278 | * stale info -- both the saved cwnd and congestion feedback are | ||
1279 | * stale. | ||
1280 | * | ||
1281 | * Instead we must wait until the completion of an RTT during | ||
1282 | * which we actually receive ACKs. | ||
1283 | */ | ||
1284 | |||
1285 | /* Begin taking Vegas samples next time we send something. */ | ||
1286 | tp->vegas.doing_vegas_now = 1; | ||
1287 | |||
1288 | /* Set the beginning of the next send window. */ | ||
1289 | tp->vegas.beg_snd_nxt = tp->snd_nxt; | ||
1290 | |||
1291 | tp->vegas.cntRTT = 0; | ||
1292 | tp->vegas.minRTT = 0x7fffffff; | ||
1293 | } | ||
1294 | |||
1295 | /* Should we be taking Vegas samples right now? */ | ||
1296 | #define tcp_vegas_enabled(__tp) ((__tp)->vegas.doing_vegas_now) | ||
1297 | |||
1298 | extern void tcp_ca_init(struct tcp_sock *tp); | ||
1299 | |||
1300 | static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state) | ||
1301 | { | ||
1302 | if (tcp_is_vegas(tp)) { | ||
1303 | if (ca_state == TCP_CA_Open) | ||
1304 | tcp_vegas_enable(tp); | ||
1305 | else | ||
1306 | tcp_vegas_disable(tp); | ||
1307 | } | ||
1308 | tp->ca_state = ca_state; | ||
1309 | } | ||
1310 | |||
1311 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. | 1206 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. |
1312 | * The exception is rate halving phase, when cwnd is decreasing towards | 1207 | * The exception is rate halving phase, when cwnd is decreasing towards |
1313 | * ssthresh. | 1208 | * ssthresh. |
@@ -1356,7 +1251,7 @@ static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp) | |||
1356 | static inline void __tcp_enter_cwr(struct tcp_sock *tp) | 1251 | static inline void __tcp_enter_cwr(struct tcp_sock *tp) |
1357 | { | 1252 | { |
1358 | tp->undo_marker = 0; | 1253 | tp->undo_marker = 0; |
1359 | tp->snd_ssthresh = tcp_recalc_ssthresh(tp); | 1254 | tp->snd_ssthresh = tp->ca_ops->ssthresh(tp); |
1360 | tp->snd_cwnd = min(tp->snd_cwnd, | 1255 | tp->snd_cwnd = min(tp->snd_cwnd, |
1361 | tcp_packets_in_flight(tp) + 1U); | 1256 | tcp_packets_in_flight(tp) + 1U); |
1362 | tp->snd_cwnd_cnt = 0; | 1257 | tp->snd_cwnd_cnt = 0; |
@@ -1750,99 +1645,71 @@ static inline int tcp_full_space(const struct sock *sk) | |||
1750 | return tcp_win_from_space(sk->sk_rcvbuf); | 1645 | return tcp_win_from_space(sk->sk_rcvbuf); |
1751 | } | 1646 | } |
1752 | 1647 | ||
1753 | static inline void tcp_acceptq_queue(struct sock *sk, struct open_request *req, | 1648 | static inline void tcp_acceptq_queue(struct sock *sk, struct request_sock *req, |
1754 | struct sock *child) | 1649 | struct sock *child) |
1755 | { | 1650 | { |
1756 | struct tcp_sock *tp = tcp_sk(sk); | 1651 | reqsk_queue_add(&tcp_sk(sk)->accept_queue, req, sk, child); |
1757 | |||
1758 | req->sk = child; | ||
1759 | sk_acceptq_added(sk); | ||
1760 | |||
1761 | if (!tp->accept_queue_tail) { | ||
1762 | tp->accept_queue = req; | ||
1763 | } else { | ||
1764 | tp->accept_queue_tail->dl_next = req; | ||
1765 | } | ||
1766 | tp->accept_queue_tail = req; | ||
1767 | req->dl_next = NULL; | ||
1768 | } | 1652 | } |
1769 | 1653 | ||
1770 | struct tcp_listen_opt | ||
1771 | { | ||
1772 | u8 max_qlen_log; /* log_2 of maximal queued SYNs */ | ||
1773 | int qlen; | ||
1774 | int qlen_young; | ||
1775 | int clock_hand; | ||
1776 | u32 hash_rnd; | ||
1777 | struct open_request *syn_table[TCP_SYNQ_HSIZE]; | ||
1778 | }; | ||
1779 | |||
1780 | static inline void | 1654 | static inline void |
1781 | tcp_synq_removed(struct sock *sk, struct open_request *req) | 1655 | tcp_synq_removed(struct sock *sk, struct request_sock *req) |
1782 | { | 1656 | { |
1783 | struct tcp_listen_opt *lopt = tcp_sk(sk)->listen_opt; | 1657 | if (reqsk_queue_removed(&tcp_sk(sk)->accept_queue, req) == 0) |
1784 | |||
1785 | if (--lopt->qlen == 0) | ||
1786 | tcp_delete_keepalive_timer(sk); | 1658 | tcp_delete_keepalive_timer(sk); |
1787 | if (req->retrans == 0) | ||
1788 | lopt->qlen_young--; | ||
1789 | } | 1659 | } |
1790 | 1660 | ||
1791 | static inline void tcp_synq_added(struct sock *sk) | 1661 | static inline void tcp_synq_added(struct sock *sk) |
1792 | { | 1662 | { |
1793 | struct tcp_listen_opt *lopt = tcp_sk(sk)->listen_opt; | 1663 | if (reqsk_queue_added(&tcp_sk(sk)->accept_queue) == 0) |
1794 | |||
1795 | if (lopt->qlen++ == 0) | ||
1796 | tcp_reset_keepalive_timer(sk, TCP_TIMEOUT_INIT); | 1664 | tcp_reset_keepalive_timer(sk, TCP_TIMEOUT_INIT); |
1797 | lopt->qlen_young++; | ||
1798 | } | 1665 | } |
1799 | 1666 | ||
1800 | static inline int tcp_synq_len(struct sock *sk) | 1667 | static inline int tcp_synq_len(struct sock *sk) |
1801 | { | 1668 | { |
1802 | return tcp_sk(sk)->listen_opt->qlen; | 1669 | return reqsk_queue_len(&tcp_sk(sk)->accept_queue); |
1803 | } | 1670 | } |
1804 | 1671 | ||
1805 | static inline int tcp_synq_young(struct sock *sk) | 1672 | static inline int tcp_synq_young(struct sock *sk) |
1806 | { | 1673 | { |
1807 | return tcp_sk(sk)->listen_opt->qlen_young; | 1674 | return reqsk_queue_len_young(&tcp_sk(sk)->accept_queue); |
1808 | } | 1675 | } |
1809 | 1676 | ||
1810 | static inline int tcp_synq_is_full(struct sock *sk) | 1677 | static inline int tcp_synq_is_full(struct sock *sk) |
1811 | { | 1678 | { |
1812 | return tcp_synq_len(sk) >> tcp_sk(sk)->listen_opt->max_qlen_log; | 1679 | return reqsk_queue_is_full(&tcp_sk(sk)->accept_queue); |
1813 | } | 1680 | } |
1814 | 1681 | ||
1815 | static inline void tcp_synq_unlink(struct tcp_sock *tp, struct open_request *req, | 1682 | static inline void tcp_synq_unlink(struct tcp_sock *tp, struct request_sock *req, |
1816 | struct open_request **prev) | 1683 | struct request_sock **prev) |
1817 | { | 1684 | { |
1818 | write_lock(&tp->syn_wait_lock); | 1685 | reqsk_queue_unlink(&tp->accept_queue, req, prev); |
1819 | *prev = req->dl_next; | ||
1820 | write_unlock(&tp->syn_wait_lock); | ||
1821 | } | 1686 | } |
1822 | 1687 | ||
1823 | static inline void tcp_synq_drop(struct sock *sk, struct open_request *req, | 1688 | static inline void tcp_synq_drop(struct sock *sk, struct request_sock *req, |
1824 | struct open_request **prev) | 1689 | struct request_sock **prev) |
1825 | { | 1690 | { |
1826 | tcp_synq_unlink(tcp_sk(sk), req, prev); | 1691 | tcp_synq_unlink(tcp_sk(sk), req, prev); |
1827 | tcp_synq_removed(sk, req); | 1692 | tcp_synq_removed(sk, req); |
1828 | tcp_openreq_free(req); | 1693 | reqsk_free(req); |
1829 | } | 1694 | } |
1830 | 1695 | ||
1831 | static __inline__ void tcp_openreq_init(struct open_request *req, | 1696 | static __inline__ void tcp_openreq_init(struct request_sock *req, |
1832 | struct tcp_options_received *rx_opt, | 1697 | struct tcp_options_received *rx_opt, |
1833 | struct sk_buff *skb) | 1698 | struct sk_buff *skb) |
1834 | { | 1699 | { |
1700 | struct inet_request_sock *ireq = inet_rsk(req); | ||
1701 | |||
1835 | req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ | 1702 | req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ |
1836 | req->rcv_isn = TCP_SKB_CB(skb)->seq; | 1703 | tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; |
1837 | req->mss = rx_opt->mss_clamp; | 1704 | req->mss = rx_opt->mss_clamp; |
1838 | req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; | 1705 | req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; |
1839 | req->tstamp_ok = rx_opt->tstamp_ok; | 1706 | ireq->tstamp_ok = rx_opt->tstamp_ok; |
1840 | req->sack_ok = rx_opt->sack_ok; | 1707 | ireq->sack_ok = rx_opt->sack_ok; |
1841 | req->snd_wscale = rx_opt->snd_wscale; | 1708 | ireq->snd_wscale = rx_opt->snd_wscale; |
1842 | req->wscale_ok = rx_opt->wscale_ok; | 1709 | ireq->wscale_ok = rx_opt->wscale_ok; |
1843 | req->acked = 0; | 1710 | ireq->acked = 0; |
1844 | req->ecn_ok = 0; | 1711 | ireq->ecn_ok = 0; |
1845 | req->rmt_port = skb->h.th->source; | 1712 | ireq->rmt_port = skb->h.th->source; |
1846 | } | 1713 | } |
1847 | 1714 | ||
1848 | extern void tcp_enter_memory_pressure(void); | 1715 | extern void tcp_enter_memory_pressure(void); |
@@ -1972,52 +1839,4 @@ struct tcp_iter_state { | |||
1972 | extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); | 1839 | extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); |
1973 | extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); | 1840 | extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); |
1974 | 1841 | ||
1975 | /* TCP Westwood functions and constants */ | ||
1976 | |||
1977 | #define TCP_WESTWOOD_INIT_RTT (20*HZ) /* maybe too conservative?! */ | ||
1978 | #define TCP_WESTWOOD_RTT_MIN (HZ/20) /* 50ms */ | ||
1979 | |||
1980 | static inline void tcp_westwood_update_rtt(struct tcp_sock *tp, __u32 rtt_seq) | ||
1981 | { | ||
1982 | if (tcp_is_westwood(tp)) | ||
1983 | tp->westwood.rtt = rtt_seq; | ||
1984 | } | ||
1985 | |||
1986 | static inline __u32 __tcp_westwood_bw_rttmin(const struct tcp_sock *tp) | ||
1987 | { | ||
1988 | return max((tp->westwood.bw_est) * (tp->westwood.rtt_min) / | ||
1989 | (__u32) (tp->mss_cache_std), | ||
1990 | 2U); | ||
1991 | } | ||
1992 | |||
1993 | static inline __u32 tcp_westwood_bw_rttmin(const struct tcp_sock *tp) | ||
1994 | { | ||
1995 | return tcp_is_westwood(tp) ? __tcp_westwood_bw_rttmin(tp) : 0; | ||
1996 | } | ||
1997 | |||
1998 | static inline int tcp_westwood_ssthresh(struct tcp_sock *tp) | ||
1999 | { | ||
2000 | __u32 ssthresh = 0; | ||
2001 | |||
2002 | if (tcp_is_westwood(tp)) { | ||
2003 | ssthresh = __tcp_westwood_bw_rttmin(tp); | ||
2004 | if (ssthresh) | ||
2005 | tp->snd_ssthresh = ssthresh; | ||
2006 | } | ||
2007 | |||
2008 | return (ssthresh != 0); | ||
2009 | } | ||
2010 | |||
2011 | static inline int tcp_westwood_cwnd(struct tcp_sock *tp) | ||
2012 | { | ||
2013 | __u32 cwnd = 0; | ||
2014 | |||
2015 | if (tcp_is_westwood(tp)) { | ||
2016 | cwnd = __tcp_westwood_bw_rttmin(tp); | ||
2017 | if (cwnd) | ||
2018 | tp->snd_cwnd = cwnd; | ||
2019 | } | ||
2020 | |||
2021 | return (cwnd != 0); | ||
2022 | } | ||
2023 | #endif /* _TCP_H */ | 1842 | #endif /* _TCP_H */ |
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index dc1456389a97..64980ee8c92a 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _NET_TCP_ECN_H_ 1 | 2 | #define _NET_TCP_ECN_H_ 1 |
3 | 3 | ||
4 | #include <net/inet_ecn.h> | 4 | #include <net/inet_ecn.h> |
5 | #include <net/request_sock.h> | ||
5 | 6 | ||
6 | #define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)) | 7 | #define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)) |
7 | 8 | ||
@@ -38,9 +39,9 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, | |||
38 | } | 39 | } |
39 | 40 | ||
40 | static __inline__ void | 41 | static __inline__ void |
41 | TCP_ECN_make_synack(struct open_request *req, struct tcphdr *th) | 42 | TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th) |
42 | { | 43 | { |
43 | if (req->ecn_ok) | 44 | if (inet_rsk(req)->ecn_ok) |
44 | th->ece = 1; | 45 | th->ece = 1; |
45 | } | 46 | } |
46 | 47 | ||
@@ -111,16 +112,16 @@ static inline int TCP_ECN_rcv_ecn_echo(struct tcp_sock *tp, struct tcphdr *th) | |||
111 | } | 112 | } |
112 | 113 | ||
113 | static inline void TCP_ECN_openreq_child(struct tcp_sock *tp, | 114 | static inline void TCP_ECN_openreq_child(struct tcp_sock *tp, |
114 | struct open_request *req) | 115 | struct request_sock *req) |
115 | { | 116 | { |
116 | tp->ecn_flags = req->ecn_ok ? TCP_ECN_OK : 0; | 117 | tp->ecn_flags = inet_rsk(req)->ecn_ok ? TCP_ECN_OK : 0; |
117 | } | 118 | } |
118 | 119 | ||
119 | static __inline__ void | 120 | static __inline__ void |
120 | TCP_ECN_create_request(struct open_request *req, struct tcphdr *th) | 121 | TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th) |
121 | { | 122 | { |
122 | if (sysctl_tcp_ecn && th->ece && th->cwr) | 123 | if (sysctl_tcp_ecn && th->ece && th->cwr) |
123 | req->ecn_ok = 1; | 124 | inet_rsk(req)->ecn_ok = 1; |
124 | } | 125 | } |
125 | 126 | ||
126 | #endif | 127 | #endif |
diff --git a/include/net/x25.h b/include/net/x25.h index 7a1ba5bbb868..8b39b98876e8 100644 --- a/include/net/x25.h +++ b/include/net/x25.h | |||
@@ -79,6 +79,8 @@ enum { | |||
79 | #define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ | 79 | #define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ |
80 | #define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ | 80 | #define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ |
81 | #define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ | 81 | #define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ |
82 | #define X25_DENY_ACCPT_APPRV 0x01 /* Default value */ | ||
83 | #define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */ | ||
82 | 84 | ||
83 | #define X25_SMODULUS 8 | 85 | #define X25_SMODULUS 8 |
84 | #define X25_EMODULUS 128 | 86 | #define X25_EMODULUS 128 |
@@ -94,7 +96,7 @@ enum { | |||
94 | #define X25_FAC_CLASS_C 0x80 | 96 | #define X25_FAC_CLASS_C 0x80 |
95 | #define X25_FAC_CLASS_D 0xC0 | 97 | #define X25_FAC_CLASS_D 0xC0 |
96 | 98 | ||
97 | #define X25_FAC_REVERSE 0x01 | 99 | #define X25_FAC_REVERSE 0x01 /* also fast select */ |
98 | #define X25_FAC_THROUGHPUT 0x02 | 100 | #define X25_FAC_THROUGHPUT 0x02 |
99 | #define X25_FAC_PACKET_SIZE 0x42 | 101 | #define X25_FAC_PACKET_SIZE 0x42 |
100 | #define X25_FAC_WINDOW_SIZE 0x43 | 102 | #define X25_FAC_WINDOW_SIZE 0x43 |
@@ -134,8 +136,8 @@ struct x25_sock { | |||
134 | struct sock sk; | 136 | struct sock sk; |
135 | struct x25_address source_addr, dest_addr; | 137 | struct x25_address source_addr, dest_addr; |
136 | struct x25_neigh *neighbour; | 138 | struct x25_neigh *neighbour; |
137 | unsigned int lci; | 139 | unsigned int lci, cudmatchlength; |
138 | unsigned char state, condition, qbitincl, intflag; | 140 | unsigned char state, condition, qbitincl, intflag, accptapprv; |
139 | unsigned short vs, vr, va, vl; | 141 | unsigned short vs, vr, va, vl; |
140 | unsigned long t2, t21, t22, t23; | 142 | unsigned long t2, t21, t22, t23; |
141 | unsigned short fraglen; | 143 | unsigned short fraglen; |
@@ -242,7 +244,6 @@ extern int x25_validate_nr(struct sock *, unsigned short); | |||
242 | extern void x25_write_internal(struct sock *, int); | 244 | extern void x25_write_internal(struct sock *, int); |
243 | extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); | 245 | extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); |
244 | extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char); | 246 | extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char); |
245 | extern int x25_check_calluserdata(struct x25_calluserdata *,struct x25_calluserdata *); | ||
246 | 247 | ||
247 | /* x25_timer.c */ | 248 | /* x25_timer.c */ |
248 | extern void x25_start_heartbeat(struct sock *); | 249 | extern void x25_start_heartbeat(struct sock *); |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index e142a256d5dc..029522a4ceda 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -158,6 +158,20 @@ enum { | |||
158 | XFRM_STATE_DEAD | 158 | XFRM_STATE_DEAD |
159 | }; | 159 | }; |
160 | 160 | ||
161 | /* callback structure passed from either netlink or pfkey */ | ||
162 | struct km_event | ||
163 | { | ||
164 | union { | ||
165 | u32 hard; | ||
166 | u32 proto; | ||
167 | u32 byid; | ||
168 | } data; | ||
169 | |||
170 | u32 seq; | ||
171 | u32 pid; | ||
172 | u32 event; | ||
173 | }; | ||
174 | |||
161 | struct xfrm_type; | 175 | struct xfrm_type; |
162 | struct xfrm_dst; | 176 | struct xfrm_dst; |
163 | struct xfrm_policy_afinfo { | 177 | struct xfrm_policy_afinfo { |
@@ -179,6 +193,8 @@ struct xfrm_policy_afinfo { | |||
179 | 193 | ||
180 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); | 194 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); |
181 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); | 195 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); |
196 | extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); | ||
197 | extern void km_state_notify(struct xfrm_state *x, struct km_event *c); | ||
182 | 198 | ||
183 | #define XFRM_ACQ_EXPIRES 30 | 199 | #define XFRM_ACQ_EXPIRES 30 |
184 | 200 | ||
@@ -188,6 +204,7 @@ struct xfrm_state_afinfo { | |||
188 | rwlock_t lock; | 204 | rwlock_t lock; |
189 | struct list_head *state_bydst; | 205 | struct list_head *state_bydst; |
190 | struct list_head *state_byspi; | 206 | struct list_head *state_byspi; |
207 | int (*init_flags)(struct xfrm_state *x); | ||
191 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, | 208 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, |
192 | struct xfrm_tmpl *tmpl, | 209 | struct xfrm_tmpl *tmpl, |
193 | xfrm_address_t *daddr, xfrm_address_t *saddr); | 210 | xfrm_address_t *daddr, xfrm_address_t *saddr); |
@@ -209,7 +226,7 @@ struct xfrm_type | |||
209 | struct module *owner; | 226 | struct module *owner; |
210 | __u8 proto; | 227 | __u8 proto; |
211 | 228 | ||
212 | int (*init_state)(struct xfrm_state *x, void *args); | 229 | int (*init_state)(struct xfrm_state *x); |
213 | void (*destructor)(struct xfrm_state *); | 230 | void (*destructor)(struct xfrm_state *); |
214 | int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); | 231 | int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); |
215 | int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); | 232 | int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); |
@@ -290,11 +307,11 @@ struct xfrm_mgr | |||
290 | { | 307 | { |
291 | struct list_head list; | 308 | struct list_head list; |
292 | char *id; | 309 | char *id; |
293 | int (*notify)(struct xfrm_state *x, int event); | 310 | int (*notify)(struct xfrm_state *x, struct km_event *c); |
294 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); | 311 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); |
295 | struct xfrm_policy *(*compile_policy)(u16 family, int opt, u8 *data, int len, int *dir); | 312 | struct xfrm_policy *(*compile_policy)(u16 family, int opt, u8 *data, int len, int *dir); |
296 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); | 313 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); |
297 | int (*notify_policy)(struct xfrm_policy *x, int dir, int event); | 314 | int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); |
298 | }; | 315 | }; |
299 | 316 | ||
300 | extern int xfrm_register_km(struct xfrm_mgr *km); | 317 | extern int xfrm_register_km(struct xfrm_mgr *km); |
@@ -515,6 +532,8 @@ struct xfrm_dst | |||
515 | struct dst_entry *route; | 532 | struct dst_entry *route; |
516 | u32 route_mtu_cached; | 533 | u32 route_mtu_cached; |
517 | u32 child_mtu_cached; | 534 | u32 child_mtu_cached; |
535 | u32 route_cookie; | ||
536 | u32 path_cookie; | ||
518 | }; | 537 | }; |
519 | 538 | ||
520 | static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) | 539 | static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) |
@@ -654,7 +673,7 @@ static inline int xfrm_sk_clone_policy(struct sock *sk) | |||
654 | return 0; | 673 | return 0; |
655 | } | 674 | } |
656 | 675 | ||
657 | extern void xfrm_policy_delete(struct xfrm_policy *pol, int dir); | 676 | extern int xfrm_policy_delete(struct xfrm_policy *pol, int dir); |
658 | 677 | ||
659 | static inline void xfrm_sk_free_policy(struct sock *sk) | 678 | static inline void xfrm_sk_free_policy(struct sock *sk) |
660 | { | 679 | { |
@@ -815,12 +834,13 @@ extern int xfrm_state_add(struct xfrm_state *x); | |||
815 | extern int xfrm_state_update(struct xfrm_state *x); | 834 | extern int xfrm_state_update(struct xfrm_state *x); |
816 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); | 835 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); |
817 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 836 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); |
818 | extern void xfrm_state_delete(struct xfrm_state *x); | 837 | extern int xfrm_state_delete(struct xfrm_state *x); |
819 | extern void xfrm_state_flush(u8 proto); | 838 | extern void xfrm_state_flush(u8 proto); |
820 | extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); | 839 | extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); |
821 | extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); | 840 | extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); |
822 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); | 841 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); |
823 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 842 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); |
843 | extern int xfrm_init_state(struct xfrm_state *x); | ||
824 | extern int xfrm4_rcv(struct sk_buff *skb); | 844 | extern int xfrm4_rcv(struct sk_buff *skb); |
825 | extern int xfrm4_output(struct sk_buff *skb); | 845 | extern int xfrm4_output(struct sk_buff *skb); |
826 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); | 846 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); |
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 6d3413a56708..67b867f31fe4 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h | |||
@@ -77,6 +77,11 @@ extern socket_state_t dead_socket; | |||
77 | /* Use this just for bridge windows */ | 77 | /* Use this just for bridge windows */ |
78 | #define MAP_IOSPACE 0x20 | 78 | #define MAP_IOSPACE 0x20 |
79 | 79 | ||
80 | /* power hook operations */ | ||
81 | #define HOOK_POWER_PRE 0x01 | ||
82 | #define HOOK_POWER_POST 0x02 | ||
83 | |||
84 | |||
80 | typedef struct pccard_io_map { | 85 | typedef struct pccard_io_map { |
81 | u_char map; | 86 | u_char map; |
82 | u_char flags; | 87 | u_char flags; |
@@ -222,6 +227,9 @@ struct pcmcia_socket { | |||
222 | /* Zoom video behaviour is so chip specific its not worth adding | 227 | /* Zoom video behaviour is so chip specific its not worth adding |
223 | this to _ops */ | 228 | this to _ops */ |
224 | void (*zoom_video)(struct pcmcia_socket *, int); | 229 | void (*zoom_video)(struct pcmcia_socket *, int); |
230 | |||
231 | /* so is power hook */ | ||
232 | int (*power_hook)(struct pcmcia_socket *sock, int operation); | ||
225 | 233 | ||
226 | /* state thread */ | 234 | /* state thread */ |
227 | struct semaphore skt_sem; /* protects socket h/w state */ | 235 | struct semaphore skt_sem; /* protects socket h/w state */ |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 659ecf48fb4a..1fb233741513 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -41,6 +41,7 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; | |||
41 | #define FORMAT_UNIT 0x04 | 41 | #define FORMAT_UNIT 0x04 |
42 | #define READ_BLOCK_LIMITS 0x05 | 42 | #define READ_BLOCK_LIMITS 0x05 |
43 | #define REASSIGN_BLOCKS 0x07 | 43 | #define REASSIGN_BLOCKS 0x07 |
44 | #define INITIALIZE_ELEMENT_STATUS 0x07 | ||
44 | #define READ_6 0x08 | 45 | #define READ_6 0x08 |
45 | #define WRITE_6 0x0a | 46 | #define WRITE_6 0x0a |
46 | #define SEEK_6 0x0b | 47 | #define SEEK_6 0x0b |
@@ -65,6 +66,7 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; | |||
65 | #define READ_10 0x28 | 66 | #define READ_10 0x28 |
66 | #define WRITE_10 0x2a | 67 | #define WRITE_10 0x2a |
67 | #define SEEK_10 0x2b | 68 | #define SEEK_10 0x2b |
69 | #define POSITION_TO_ELEMENT 0x2b | ||
68 | #define WRITE_VERIFY 0x2e | 70 | #define WRITE_VERIFY 0x2e |
69 | #define VERIFY 0x2f | 71 | #define VERIFY 0x2f |
70 | #define SEARCH_HIGH 0x30 | 72 | #define SEARCH_HIGH 0x30 |
@@ -97,6 +99,7 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; | |||
97 | #define PERSISTENT_RESERVE_OUT 0x5f | 99 | #define PERSISTENT_RESERVE_OUT 0x5f |
98 | #define REPORT_LUNS 0xa0 | 100 | #define REPORT_LUNS 0xa0 |
99 | #define MOVE_MEDIUM 0xa5 | 101 | #define MOVE_MEDIUM 0xa5 |
102 | #define EXCHANGE_MEDIUM 0xa6 | ||
100 | #define READ_12 0xa8 | 103 | #define READ_12 0xa8 |
101 | #define WRITE_12 0xaa | 104 | #define WRITE_12 0xaa |
102 | #define WRITE_VERIFY_12 0xae | 105 | #define WRITE_VERIFY_12 0xae |
@@ -210,6 +213,7 @@ static inline int scsi_status_is_good(int status) | |||
210 | #define TYPE_COMM 0x09 /* Communications device */ | 213 | #define TYPE_COMM 0x09 /* Communications device */ |
211 | #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ | 214 | #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ |
212 | #define TYPE_RAID 0x0c | 215 | #define TYPE_RAID 0x0c |
216 | #define TYPE_RBC 0x0e | ||
213 | #define TYPE_NO_LUN 0x7f | 217 | #define TYPE_NO_LUN 0x7f |
214 | 218 | ||
215 | /* | 219 | /* |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index c018020d9160..63c91dd85ca1 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -154,7 +154,9 @@ struct scsi_target { | |||
154 | unsigned int id; /* target id ... replace | 154 | unsigned int id; /* target id ... replace |
155 | * scsi_device.id eventually */ | 155 | * scsi_device.id eventually */ |
156 | unsigned long create:1; /* signal that it needs to be added */ | 156 | unsigned long create:1; /* signal that it needs to be added */ |
157 | unsigned long starget_data[0]; | 157 | void *hostdata; /* available to low-level driver */ |
158 | unsigned long starget_data[0]; /* for the transport */ | ||
159 | /* starget_data must be the last element!!!! */ | ||
158 | } __attribute__((aligned(sizeof(unsigned long)))); | 160 | } __attribute__((aligned(sizeof(unsigned long)))); |
159 | 161 | ||
160 | #define to_scsi_target(d) container_of(d, struct scsi_target, dev) | 162 | #define to_scsi_target(d) container_of(d, struct scsi_target, dev) |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 1cee1e100943..db9914adeac9 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -10,6 +10,7 @@ struct block_device; | |||
10 | struct module; | 10 | struct module; |
11 | struct scsi_cmnd; | 11 | struct scsi_cmnd; |
12 | struct scsi_device; | 12 | struct scsi_device; |
13 | struct scsi_target; | ||
13 | struct Scsi_Host; | 14 | struct Scsi_Host; |
14 | struct scsi_host_cmd_pool; | 15 | struct scsi_host_cmd_pool; |
15 | struct scsi_transport_template; | 16 | struct scsi_transport_template; |
@@ -228,6 +229,30 @@ struct scsi_host_template { | |||
228 | void (* slave_destroy)(struct scsi_device *); | 229 | void (* slave_destroy)(struct scsi_device *); |
229 | 230 | ||
230 | /* | 231 | /* |
232 | * Before the mid layer attempts to scan for a new device attached | ||
233 | * to a target where no target currently exists, it will call this | ||
234 | * entry in your driver. Should your driver need to allocate any | ||
235 | * structs or perform any other init items in order to send commands | ||
236 | * to a currently unused target, then this is where you can perform | ||
237 | * those allocations. | ||
238 | * | ||
239 | * Return values: 0 on success, non-0 on failure | ||
240 | * | ||
241 | * Status: OPTIONAL | ||
242 | */ | ||
243 | int (* target_alloc)(struct scsi_target *); | ||
244 | |||
245 | /* | ||
246 | * Immediately prior to deallocating the target structure, and | ||
247 | * after all activity to attached scsi devices has ceased, the | ||
248 | * midlayer calls this point so that the driver may deallocate | ||
249 | * and terminate any references to the target. | ||
250 | * | ||
251 | * Status: OPTIONAL | ||
252 | */ | ||
253 | void (* target_destroy)(struct scsi_target *); | ||
254 | |||
255 | /* | ||
231 | * fill in this function to allow the queue depth of this host | 256 | * fill in this function to allow the queue depth of this host |
232 | * to be changeable (on a per device basis). returns either | 257 | * to be changeable (on a per device basis). returns either |
233 | * the current queue depth setting (may be different from what | 258 | * the current queue depth setting (may be different from what |
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h index 2dcee7a84752..a4f1837a33b1 100644 --- a/include/scsi/scsi_transport.h +++ b/include/scsi/scsi_transport.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define SCSI_TRANSPORT_H | 21 | #define SCSI_TRANSPORT_H |
22 | 22 | ||
23 | #include <linux/transport_class.h> | 23 | #include <linux/transport_class.h> |
24 | #include <scsi/scsi_host.h> | ||
24 | 25 | ||
25 | struct scsi_transport_template { | 26 | struct scsi_transport_template { |
26 | /* the attribute containers */ | 27 | /* the attribute containers */ |
@@ -32,8 +33,11 @@ struct scsi_transport_template { | |||
32 | * space of this size will be left at the end of the | 33 | * space of this size will be left at the end of the |
33 | * scsi_* structure */ | 34 | * scsi_* structure */ |
34 | int device_size; | 35 | int device_size; |
36 | int device_private_offset; | ||
35 | int target_size; | 37 | int target_size; |
38 | int target_private_offset; | ||
36 | int host_size; | 39 | int host_size; |
40 | /* no private offset for the host; there's an alternative mechanism */ | ||
37 | 41 | ||
38 | /* | 42 | /* |
39 | * True if the transport wants to use a host-based work-queue | 43 | * True if the transport wants to use a host-based work-queue |
@@ -45,4 +49,38 @@ struct scsi_transport_template { | |||
45 | dev_to_shost((tc)->dev) | 49 | dev_to_shost((tc)->dev) |
46 | 50 | ||
47 | 51 | ||
52 | /* Private area maintenance. The driver requested allocations come | ||
53 | * directly after the transport class allocations (if any). The idea | ||
54 | * is that you *must* call these only once. The code assumes that the | ||
55 | * initial values are the ones the transport specific code requires */ | ||
56 | static inline void | ||
57 | scsi_transport_reserve_target(struct scsi_transport_template * t, int space) | ||
58 | { | ||
59 | BUG_ON(t->target_private_offset != 0); | ||
60 | t->target_private_offset = ALIGN(t->target_size, sizeof(void *)); | ||
61 | t->target_size = t->target_private_offset + space; | ||
62 | } | ||
63 | static inline void | ||
64 | scsi_transport_reserve_device(struct scsi_transport_template * t, int space) | ||
65 | { | ||
66 | BUG_ON(t->device_private_offset != 0); | ||
67 | t->device_private_offset = ALIGN(t->device_size, sizeof(void *)); | ||
68 | t->device_size = t->device_private_offset + space; | ||
69 | } | ||
70 | static inline void * | ||
71 | scsi_transport_target_data(struct scsi_target *starget) | ||
72 | { | ||
73 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | ||
74 | return (u8 *)starget->starget_data | ||
75 | + shost->transportt->target_private_offset; | ||
76 | |||
77 | } | ||
78 | static inline void * | ||
79 | scsi_transport_device_data(struct scsi_device *sdev) | ||
80 | { | ||
81 | struct Scsi_Host *shost = sdev->host; | ||
82 | return (u8 *)sdev->sdev_data | ||
83 | + shost->transportt->device_private_offset; | ||
84 | } | ||
85 | |||
48 | #endif /* SCSI_TRANSPORT_H */ | 86 | #endif /* SCSI_TRANSPORT_H */ |
diff --git a/include/scsi/sg_request.h b/include/scsi/sg_request.h new file mode 100644 index 000000000000..57ff525bdd3b --- /dev/null +++ b/include/scsi/sg_request.h | |||
@@ -0,0 +1,26 @@ | |||
1 | typedef struct scsi_request Scsi_Request; | ||
2 | |||
3 | static Scsi_Request *dummy_cmdp; /* only used for sizeof */ | ||
4 | |||
5 | typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ | ||
6 | unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */ | ||
7 | unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */ | ||
8 | unsigned bufflen; /* Size of (aggregate) data buffer */ | ||
9 | unsigned b_malloc_len; /* actual len malloc'ed in buffer */ | ||
10 | void *buffer; /* Data buffer or scatter list (k_use_sg>0) */ | ||
11 | char dio_in_use; /* 0->indirect IO (or mmap), 1->dio */ | ||
12 | unsigned char cmd_opcode; /* first byte of command */ | ||
13 | } Sg_scatter_hold; | ||
14 | |||
15 | typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */ | ||
16 | Scsi_Request *my_cmdp; /* != 0 when request with lower levels */ | ||
17 | struct sg_request *nextrp; /* NULL -> tail request (slist) */ | ||
18 | struct sg_fd *parentfp; /* NULL -> not in use */ | ||
19 | Sg_scatter_hold data; /* hold buffer, perhaps scatter list */ | ||
20 | sg_io_hdr_t header; /* scsi command+info, see <scsi/sg.h> */ | ||
21 | unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)]; | ||
22 | char res_used; /* 1 -> using reserve buffer, 0 -> not ... */ | ||
23 | char orphan; /* 1 -> drop on sight, 0 -> normal */ | ||
24 | char sg_io_owned; /* 1 -> packet belongs to SG_IO */ | ||
25 | volatile char done; /* 0->before bh, 1->before read, 2->read */ | ||
26 | } Sg_request; | ||
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 2433e279e071..1309c12b8f71 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
@@ -437,6 +437,7 @@ struct snd_ac97_build_ops { | |||
437 | void (*suspend) (ac97_t *ac97); | 437 | void (*suspend) (ac97_t *ac97); |
438 | void (*resume) (ac97_t *ac97); | 438 | void (*resume) (ac97_t *ac97); |
439 | #endif | 439 | #endif |
440 | void (*update_jacks) (ac97_t *ac97); /* for jack-sharing */ | ||
440 | }; | 441 | }; |
441 | 442 | ||
442 | struct _snd_ac97_bus_ops { | 443 | struct _snd_ac97_bus_ops { |
@@ -516,6 +517,9 @@ struct _snd_ac97 { | |||
516 | } ad18xx; | 517 | } ad18xx; |
517 | unsigned int dev_flags; /* device specific */ | 518 | unsigned int dev_flags; /* device specific */ |
518 | } spec; | 519 | } spec; |
520 | /* jack-sharing info */ | ||
521 | unsigned char indep_surround; | ||
522 | unsigned char channel_mode; | ||
519 | }; | 523 | }; |
520 | 524 | ||
521 | /* conditions */ | 525 | /* conditions */ |
@@ -569,8 +573,8 @@ enum { | |||
569 | }; | 573 | }; |
570 | 574 | ||
571 | struct ac97_quirk { | 575 | struct ac97_quirk { |
572 | unsigned short vendor; /* PCI vendor id */ | 576 | unsigned short subvendor; /* PCI subsystem vendor id */ |
573 | unsigned short device; /* PCI device id */ | 577 | unsigned short subdevice; /* PCI sybsystem device id */ |
574 | unsigned short mask; /* device id bit mask, 0 = accept all */ | 578 | unsigned short mask; /* device id bit mask, 0 = accept all */ |
575 | unsigned int codec_id; /* codec id (if any), 0 = accept all */ | 579 | unsigned int codec_id; /* codec id (if any), 0 = accept all */ |
576 | const char *name; /* name shown as info */ | 580 | const char *name; /* name shown as info */ |
diff --git a/include/sound/asound.h b/include/sound/asound.h index a4d149f34541..9974f83cca44 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h | |||
@@ -113,9 +113,10 @@ enum sndrv_hwdep_iface { | |||
113 | SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ | 113 | SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ |
114 | SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ | 114 | SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ |
115 | SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ | 115 | SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ |
116 | SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ | ||
116 | 117 | ||
117 | /* Don't forget to change the following: */ | 118 | /* Don't forget to change the following: */ |
118 | SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_PCXHR | 119 | SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC |
119 | }; | 120 | }; |
120 | 121 | ||
121 | struct sndrv_hwdep_info { | 122 | struct sndrv_hwdep_info { |
@@ -344,7 +345,7 @@ enum sndrv_pcm_hw_param { | |||
344 | SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME | 345 | SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME |
345 | }; | 346 | }; |
346 | 347 | ||
347 | #define SNDRV_PCM_HW_PARAMS_RUNTIME (1<<0) | 348 | #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ |
348 | 349 | ||
349 | struct sndrv_interval { | 350 | struct sndrv_interval { |
350 | unsigned int min, max; | 351 | unsigned int min, max; |
@@ -559,7 +560,7 @@ enum { | |||
559 | * Timer section - /dev/snd/timer | 560 | * Timer section - /dev/snd/timer |
560 | */ | 561 | */ |
561 | 562 | ||
562 | #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2) | 563 | #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4) |
563 | 564 | ||
564 | enum sndrv_timer_class { | 565 | enum sndrv_timer_class { |
565 | SNDRV_TIMER_CLASS_NONE = -1, | 566 | SNDRV_TIMER_CLASS_NONE = -1, |
@@ -672,10 +673,11 @@ enum { | |||
672 | SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), | 673 | SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), |
673 | SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), | 674 | SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), |
674 | SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), | 675 | SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), |
675 | SNDRV_TIMER_IOCTL_START = _IO('T', 0x20), | 676 | /* The following four ioctls are changed since 1.0.9 due to confliction */ |
676 | SNDRV_TIMER_IOCTL_STOP = _IO('T', 0x21), | 677 | SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), |
677 | SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0x22), | 678 | SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), |
678 | SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0x23), | 679 | SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2), |
680 | SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3), | ||
679 | }; | 681 | }; |
680 | 682 | ||
681 | struct sndrv_timer_read { | 683 | struct sndrv_timer_read { |
diff --git a/include/sound/control.h b/include/sound/control.h index 7b9444cd02f4..ef7903c7a327 100644 --- a/include/sound/control.h +++ b/include/sound/control.h | |||
@@ -106,7 +106,7 @@ typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card, | |||
106 | void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id); | 106 | void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id); |
107 | 107 | ||
108 | snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access); | 108 | snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access); |
109 | snd_kcontrol_t *snd_ctl_new1(snd_kcontrol_new_t * kcontrolnew, void * private_data); | 109 | snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * kcontrolnew, void * private_data); |
110 | void snd_ctl_free_one(snd_kcontrol_t * kcontrol); | 110 | void snd_ctl_free_one(snd_kcontrol_t * kcontrol); |
111 | int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol); | 111 | int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol); |
112 | int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol); | 112 | int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol); |
diff --git a/include/sound/core.h b/include/sound/core.h index 9117c23e3a01..f8c4ef0aa352 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -292,6 +292,7 @@ void *snd_hidden_kcalloc(size_t n, size_t size, int flags); | |||
292 | void snd_hidden_kfree(const void *obj); | 292 | void snd_hidden_kfree(const void *obj); |
293 | void *snd_hidden_vmalloc(unsigned long size); | 293 | void *snd_hidden_vmalloc(unsigned long size); |
294 | void snd_hidden_vfree(void *obj); | 294 | void snd_hidden_vfree(void *obj); |
295 | char *snd_hidden_kstrdup(const char *s, int flags); | ||
295 | #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) | 296 | #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) |
296 | #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) | 297 | #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) |
297 | #define kfree(obj) snd_hidden_kfree(obj) | 298 | #define kfree(obj) snd_hidden_kfree(obj) |
@@ -301,6 +302,7 @@ void snd_hidden_vfree(void *obj); | |||
301 | #define vmalloc_nocheck(size) snd_wrapper_vmalloc(size) | 302 | #define vmalloc_nocheck(size) snd_wrapper_vmalloc(size) |
302 | #define kfree_nocheck(obj) snd_wrapper_kfree(obj) | 303 | #define kfree_nocheck(obj) snd_wrapper_kfree(obj) |
303 | #define vfree_nocheck(obj) snd_wrapper_vfree(obj) | 304 | #define vfree_nocheck(obj) snd_wrapper_vfree(obj) |
305 | #define kstrdup(s, flags) snd_hidden_kstrdup(s, flags) | ||
304 | #else | 306 | #else |
305 | #define snd_memory_init() /*NOP*/ | 307 | #define snd_memory_init() /*NOP*/ |
306 | #define snd_memory_done() /*NOP*/ | 308 | #define snd_memory_done() /*NOP*/ |
@@ -311,7 +313,6 @@ void snd_hidden_vfree(void *obj); | |||
311 | #define kfree_nocheck(obj) kfree(obj) | 313 | #define kfree_nocheck(obj) kfree(obj) |
312 | #define vfree_nocheck(obj) vfree(obj) | 314 | #define vfree_nocheck(obj) vfree(obj) |
313 | #endif | 315 | #endif |
314 | char *snd_kmalloc_strdup(const char *string, int flags); | ||
315 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); | 316 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); |
316 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); | 317 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); |
317 | 318 | ||
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 43b6786abae5..c50b91958ff9 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h | |||
@@ -83,7 +83,8 @@ | |||
83 | #define IPR 0x08 /* Global interrupt pending register */ | 83 | #define IPR 0x08 /* Global interrupt pending register */ |
84 | /* Clear pending interrupts by writing a 1 to */ | 84 | /* Clear pending interrupts by writing a 1 to */ |
85 | /* the relevant bits and zero to the other bits */ | 85 | /* the relevant bits and zero to the other bits */ |
86 | 86 | #define IPR_P16V 0x80000000 /* Bit set when the CA0151 P16V chip wishes | |
87 | to interrupt */ | ||
87 | #define IPR_GPIOMSG 0x20000000 /* GPIO message interrupt (RE'd, still not sure | 88 | #define IPR_GPIOMSG 0x20000000 /* GPIO message interrupt (RE'd, still not sure |
88 | which INTE bits enable it) */ | 89 | which INTE bits enable it) */ |
89 | 90 | ||
@@ -746,6 +747,7 @@ | |||
746 | /* Assumes sample lock */ | 747 | /* Assumes sample lock */ |
747 | 748 | ||
748 | /* These three bitfields apply to CDSRCS, GPSRCS, and (except as noted) ZVSRCS. */ | 749 | /* These three bitfields apply to CDSRCS, GPSRCS, and (except as noted) ZVSRCS. */ |
750 | #define SRCS_SPDIFVALID 0x04000000 /* SPDIF stream valid */ | ||
749 | #define SRCS_SPDIFLOCKED 0x02000000 /* SPDIF stream locked */ | 751 | #define SRCS_SPDIFLOCKED 0x02000000 /* SPDIF stream locked */ |
750 | #define SRCS_RATELOCKED 0x01000000 /* Sample rate locked */ | 752 | #define SRCS_RATELOCKED 0x01000000 /* Sample rate locked */ |
751 | #define SRCS_ESTSAMPLERATE 0x0007ffff /* Do not modify this field. */ | 753 | #define SRCS_ESTSAMPLERATE 0x0007ffff /* Do not modify this field. */ |
@@ -803,10 +805,26 @@ | |||
803 | #define A_FXWC2 0x75 /* Selects 0x9f-0x80 for FX recording */ | 805 | #define A_FXWC2 0x75 /* Selects 0x9f-0x80 for FX recording */ |
804 | 806 | ||
805 | #define A_SPDIF_SAMPLERATE 0x76 /* Set the sample rate of SPDIF output */ | 807 | #define A_SPDIF_SAMPLERATE 0x76 /* Set the sample rate of SPDIF output */ |
806 | #define A_SPDIF_RATE_MASK 0x000000c0 | 808 | #define A_SAMPLE_RATE 0x76 /* Various sample rate settings. */ |
809 | #define A_SAMPLE_RATE_NOT_USED 0x0ffc111e /* Bits that are not used and cannot be set. */ | ||
810 | #define A_SAMPLE_RATE_UNKNOWN 0xf0030001 /* Bits that can be set, but have unknown use. */ | ||
811 | #define A_SPDIF_RATE_MASK 0x000000e0 /* Any other values for rates, just use 48000 */ | ||
807 | #define A_SPDIF_48000 0x00000000 | 812 | #define A_SPDIF_48000 0x00000000 |
808 | #define A_SPDIF_44100 0x00000080 | 813 | #define A_SPDIF_192000 0x00000020 |
809 | #define A_SPDIF_96000 0x00000040 | 814 | #define A_SPDIF_96000 0x00000040 |
815 | #define A_SPDIF_44100 0x00000080 | ||
816 | |||
817 | #define A_I2S_CAPTURE_RATE_MASK 0x00000e00 /* This sets the capture PCM rate, but it is */ | ||
818 | #define A_I2S_CAPTURE_48000 0x00000000 /* unclear if this sets the ADC rate as well. */ | ||
819 | #define A_I2S_CAPTURE_192000 0x00000200 | ||
820 | #define A_I2S_CAPTURE_96000 0x00000400 | ||
821 | #define A_I2S_CAPTURE_44100 0x00000800 | ||
822 | |||
823 | #define A_PCM_RATE_MASK 0x0000e000 /* This sets the playback PCM rate on the P16V */ | ||
824 | #define A_PCM_48000 0x00000000 | ||
825 | #define A_PCM_192000 0x00002000 | ||
826 | #define A_PCM_96000 0x00004000 | ||
827 | #define A_PCM_44100 0x00008000 | ||
810 | 828 | ||
811 | /* 0x77,0x78,0x79 "something i2s-related" - default to 0x01080000 on my audigy 2 ZS --rlrevell */ | 829 | /* 0x77,0x78,0x79 "something i2s-related" - default to 0x01080000 on my audigy 2 ZS --rlrevell */ |
812 | /* 0x7a, 0x7b - lookup tables */ | 830 | /* 0x7a, 0x7b - lookup tables */ |
@@ -1039,28 +1057,28 @@ typedef struct { | |||
1039 | u32 vendor; | 1057 | u32 vendor; |
1040 | u32 device; | 1058 | u32 device; |
1041 | u32 subsystem; | 1059 | u32 subsystem; |
1060 | unsigned char revision; | ||
1042 | unsigned char emu10k1_chip; /* Original SB Live. Not SB Live 24bit. */ | 1061 | unsigned char emu10k1_chip; /* Original SB Live. Not SB Live 24bit. */ |
1043 | unsigned char emu10k2_chip; /* Audigy 1 or Audigy 2. */ | 1062 | unsigned char emu10k2_chip; /* Audigy 1 or Audigy 2. */ |
1044 | unsigned char ca0102_chip; /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */ | 1063 | unsigned char ca0102_chip; /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */ |
1045 | unsigned char ca0108_chip; /* Audigy 2 Value */ | 1064 | unsigned char ca0108_chip; /* Audigy 2 Value */ |
1046 | unsigned char ca0151_chip; /* P16V */ | 1065 | unsigned char ca0151_chip; /* P16V */ |
1047 | unsigned char spk71; /* Has 7.1 speakers */ | 1066 | unsigned char spk71; /* Has 7.1 speakers */ |
1067 | unsigned char sblive51; /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */ | ||
1048 | unsigned char spdif_bug; /* Has Spdif phasing bug */ | 1068 | unsigned char spdif_bug; /* Has Spdif phasing bug */ |
1049 | unsigned char ac97_chip; /* Has an AC97 chip */ | 1069 | unsigned char ac97_chip; /* Has an AC97 chip */ |
1050 | unsigned char ecard; /* APS EEPROM */ | 1070 | unsigned char ecard; /* APS EEPROM */ |
1051 | char * driver; | 1071 | const char *driver; |
1052 | char * name; | 1072 | const char *name; |
1073 | const char *id; /* for backward compatibility - can be NULL if not needed */ | ||
1053 | } emu_chip_details_t; | 1074 | } emu_chip_details_t; |
1054 | 1075 | ||
1055 | struct _snd_emu10k1 { | 1076 | struct _snd_emu10k1 { |
1056 | int irq; | 1077 | int irq; |
1057 | 1078 | ||
1058 | unsigned long port; /* I/O port number */ | 1079 | unsigned long port; /* I/O port number */ |
1059 | unsigned int APS: 1, /* APS flag */ | 1080 | unsigned int tos_link: 1, /* tos link detected */ |
1060 | no_ac97: 1, /* no AC'97 */ | 1081 | rear_ac97: 1; /* rear channels are on AC'97 */ |
1061 | tos_link: 1, /* tos link detected */ | ||
1062 | rear_ac97: 1, /* rear channels are on AC'97 */ | ||
1063 | spk71:1; /* 7.1 configuration (Audigy 2 ZS) */ | ||
1064 | const emu_chip_details_t *card_capabilities; /* Contains profile of card capabilities */ | 1082 | const emu_chip_details_t *card_capabilities; /* Contains profile of card capabilities */ |
1065 | unsigned int audigy; /* is Audigy? */ | 1083 | unsigned int audigy; /* is Audigy? */ |
1066 | unsigned int revision; /* chip revision */ | 1084 | unsigned int revision; /* chip revision */ |
@@ -1109,7 +1127,10 @@ struct _snd_emu10k1 { | |||
1109 | 1127 | ||
1110 | emu10k1_voice_t voices[NUM_G]; | 1128 | emu10k1_voice_t voices[NUM_G]; |
1111 | emu10k1_voice_t p16v_voices[4]; | 1129 | emu10k1_voice_t p16v_voices[4]; |
1130 | emu10k1_voice_t p16v_capture_voice; | ||
1112 | int p16v_device_offset; | 1131 | int p16v_device_offset; |
1132 | u32 p16v_capture_source; | ||
1133 | u32 p16v_capture_channel; | ||
1113 | emu10k1_pcm_mixer_t pcm_mixer[32]; | 1134 | emu10k1_pcm_mixer_t pcm_mixer[32]; |
1114 | emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK]; | 1135 | emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK]; |
1115 | snd_kcontrol_t *ctl_send_routing; | 1136 | snd_kcontrol_t *ctl_send_routing; |
@@ -1453,7 +1474,6 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, | |||
1453 | #endif | 1474 | #endif |
1454 | 1475 | ||
1455 | typedef struct { | 1476 | typedef struct { |
1456 | unsigned int card; /* card type */ | ||
1457 | unsigned int internal_tram_size; /* in samples */ | 1477 | unsigned int internal_tram_size; /* in samples */ |
1458 | unsigned int external_tram_size; /* in samples */ | 1478 | unsigned int external_tram_size; /* in samples */ |
1459 | char fxbus_names[16][32]; /* names of FXBUSes */ | 1479 | char fxbus_names[16][32]; /* names of FXBUSes */ |
diff --git a/include/sound/gus.h b/include/sound/gus.h index 8b6287a6fff5..b4b461ca173d 100644 --- a/include/sound/gus.h +++ b/include/sound/gus.h | |||
@@ -526,9 +526,6 @@ extern void snd_gf1_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigne | |||
526 | extern void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr); | 526 | extern void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr); |
527 | extern void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data); | 527 | extern void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data); |
528 | extern unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr); | 528 | extern unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr); |
529 | extern void snd_gf1_pokew(snd_gus_card_t * gus, unsigned int addr, unsigned short data); | ||
530 | extern unsigned short snd_gf1_peekw(snd_gus_card_t * gus, unsigned int addr); | ||
531 | extern void snd_gf1_dram_setmem(snd_gus_card_t * gus, unsigned int addr, unsigned short value, unsigned int count); | ||
532 | extern void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit); | 529 | extern void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit); |
533 | extern unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit); | 530 | extern unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit); |
534 | extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); | 531 | extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); |
@@ -544,9 +541,6 @@ extern inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned cha | |||
544 | { | 541 | { |
545 | return snd_gf1_i_look16(gus, reg | 0x80); | 542 | return snd_gf1_i_look16(gus, reg | 0x80); |
546 | } | 543 | } |
547 | extern void snd_gf1_i_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigned char data); | ||
548 | extern void snd_gf1_i_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit); | ||
549 | extern unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit); | ||
550 | 544 | ||
551 | extern void snd_gf1_select_active_voices(snd_gus_card_t * gus); | 545 | extern void snd_gf1_select_active_voices(snd_gus_card_t * gus); |
552 | 546 | ||
@@ -580,10 +574,6 @@ extern void snd_gf1_lfo_command(snd_gus_card_t * gus, int voice, unsigned char * | |||
580 | 574 | ||
581 | void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup); | 575 | void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup); |
582 | int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block); | 576 | int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block); |
583 | snd_gf1_mem_block_t *snd_gf1_mem_look(snd_gf1_mem_t * alloc, | ||
584 | unsigned int address); | ||
585 | snd_gf1_mem_block_t *snd_gf1_mem_share(snd_gf1_mem_t * alloc, | ||
586 | unsigned int *share_id); | ||
587 | snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, | 577 | snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, |
588 | char *name, int size, int w_16, | 578 | char *name, int size, int w_16, |
589 | int align, unsigned int *share_id); | 579 | int align, unsigned int *share_id); |
@@ -608,23 +598,13 @@ int snd_gf1_dma_transfer_block(snd_gus_card_t * gus, | |||
608 | /* gus_volume.c */ | 598 | /* gus_volume.c */ |
609 | 599 | ||
610 | unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol); | 600 | unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol); |
611 | unsigned int snd_gf1_gvol_to_lvol_raw(unsigned short gf1_vol); | ||
612 | unsigned int snd_gf1_calc_ramp_rate(snd_gus_card_t * gus, | ||
613 | unsigned short start, | ||
614 | unsigned short end, | ||
615 | unsigned int us); | ||
616 | unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq2); | 601 | unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq2); |
617 | unsigned short snd_gf1_compute_pitchbend(unsigned short pitchbend, unsigned short sens); | ||
618 | unsigned short snd_gf1_compute_freq(unsigned int freq, | ||
619 | unsigned int rate, | ||
620 | unsigned short mix_rate); | ||
621 | 602 | ||
622 | /* gus_reset.c */ | 603 | /* gus_reset.c */ |
623 | 604 | ||
624 | void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what); | 605 | void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what); |
625 | void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice); | 606 | void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice); |
626 | void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice); | 607 | void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice); |
627 | void snd_gf1_clear_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max); | ||
628 | void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max); | 608 | void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max); |
629 | snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port); | 609 | snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port); |
630 | void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice); | 610 | void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice); |
@@ -641,9 +621,6 @@ int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pc | |||
641 | 621 | ||
642 | #ifdef CONFIG_SND_DEBUG | 622 | #ifdef CONFIG_SND_DEBUG |
643 | extern void snd_gf1_print_voice_registers(snd_gus_card_t * gus); | 623 | extern void snd_gf1_print_voice_registers(snd_gus_card_t * gus); |
644 | extern void snd_gf1_print_global_registers(snd_gus_card_t * gus); | ||
645 | extern void snd_gf1_print_setup_registers(snd_gus_card_t * gus); | ||
646 | extern void snd_gf1_peek_print_block(snd_gus_card_t * gus, unsigned int addr, int count, int w_16bit); | ||
647 | #endif | 624 | #endif |
648 | 625 | ||
649 | /* gus.c */ | 626 | /* gus.c */ |
diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h new file mode 100644 index 000000000000..c34427ccd0b3 --- /dev/null +++ b/include/sound/hdspm.h | |||
@@ -0,0 +1,131 @@ | |||
1 | #ifndef __SOUND_HDSPM_H /* -*- linux-c -*- */ | ||
2 | #define __SOUND_HDSPM_H | ||
3 | /* | ||
4 | * Copyright (C) 2003 Winfried Ritsch (IEM) | ||
5 | * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) | ||
6 | * | ||
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 as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ | ||
24 | #define HDSPM_MAX_CHANNELS 64 | ||
25 | |||
26 | /* -------------------- IOCTL Peak/RMS Meters -------------------- */ | ||
27 | |||
28 | typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t; | ||
29 | |||
30 | /* peam rms level structure like we get from hardware | ||
31 | |||
32 | maybe in future we can memory map it so I just copy it | ||
33 | to user on ioctl call now an dont change anything | ||
34 | rms are made out of low and high values | ||
35 | where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24) | ||
36 | (i asume so from the code) | ||
37 | */ | ||
38 | |||
39 | struct _snd_hdspm_peak_rms { | ||
40 | |||
41 | unsigned int level_offset[1024]; | ||
42 | |||
43 | unsigned int input_peak[64]; | ||
44 | unsigned int playback_peak[64]; | ||
45 | unsigned int output_peak[64]; | ||
46 | unsigned int xxx_peak[64]; /* not used */ | ||
47 | |||
48 | unsigned int reserved[256]; /* not used */ | ||
49 | |||
50 | unsigned int input_rms_l[64]; | ||
51 | unsigned int playback_rms_l[64]; | ||
52 | unsigned int output_rms_l[64]; | ||
53 | unsigned int xxx_rms_l[64]; /* not used */ | ||
54 | |||
55 | unsigned int input_rms_h[64]; | ||
56 | unsigned int playback_rms_h[64]; | ||
57 | unsigned int output_rms_h[64]; | ||
58 | unsigned int xxx_rms_h[64]; /* not used */ | ||
59 | }; | ||
60 | |||
61 | struct sndrv_hdspm_peak_rms_ioctl { | ||
62 | hdspm_peak_rms_t *peak; | ||
63 | }; | ||
64 | |||
65 | /* use indirect access due to the limit of ioctl bit size */ | ||
66 | #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct sndrv_hdspm_peak_rms_ioctl) | ||
67 | |||
68 | /* ------------ CONFIG block IOCTL ---------------------- */ | ||
69 | |||
70 | typedef struct _snd_hdspm_config_info hdspm_config_info_t; | ||
71 | |||
72 | struct _snd_hdspm_config_info { | ||
73 | unsigned char pref_sync_ref; | ||
74 | unsigned char wordclock_sync_check; | ||
75 | unsigned char madi_sync_check; | ||
76 | unsigned int system_sample_rate; | ||
77 | unsigned int autosync_sample_rate; | ||
78 | unsigned char system_clock_mode; | ||
79 | unsigned char clock_source; | ||
80 | unsigned char autosync_ref; | ||
81 | unsigned char line_out; | ||
82 | unsigned int passthru; | ||
83 | unsigned int analog_out; | ||
84 | }; | ||
85 | |||
86 | #define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdspm_config_info_t) | ||
87 | |||
88 | |||
89 | /* get Soundcard Version */ | ||
90 | |||
91 | typedef struct _snd_hdspm_version hdspm_version_t; | ||
92 | |||
93 | struct _snd_hdspm_version { | ||
94 | unsigned short firmware_rev; | ||
95 | }; | ||
96 | |||
97 | #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, hdspm_version_t) | ||
98 | |||
99 | |||
100 | /* ------------- get Matrix Mixer IOCTL --------------- */ | ||
101 | |||
102 | /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = 32768 Bytes */ | ||
103 | |||
104 | /* organisation is 64 channelfader in a continous memory block */ | ||
105 | /* equivalent to hardware definition, maybe for future feature of mmap of them */ | ||
106 | /* each of 64 outputs has 64 infader and 64 outfader: | ||
107 | Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ | ||
108 | |||
109 | #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS | ||
110 | |||
111 | typedef struct _snd_hdspm_channelfader snd_hdspm_channelfader_t; | ||
112 | |||
113 | struct _snd_hdspm_channelfader { | ||
114 | unsigned int in[HDSPM_MIXER_CHANNELS]; | ||
115 | unsigned int pb[HDSPM_MIXER_CHANNELS]; | ||
116 | }; | ||
117 | |||
118 | typedef struct _snd_hdspm_mixer hdspm_mixer_t; | ||
119 | |||
120 | struct _snd_hdspm_mixer { | ||
121 | snd_hdspm_channelfader_t ch[HDSPM_MIXER_CHANNELS]; | ||
122 | }; | ||
123 | |||
124 | struct sndrv_hdspm_mixer_ioctl { | ||
125 | hdspm_mixer_t *mixer; | ||
126 | }; | ||
127 | |||
128 | /* use indirect access due to the limit of ioctl bit size */ | ||
129 | #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct sndrv_hdspm_mixer_ioctl) | ||
130 | |||
131 | #endif /* __SOUND_HDSPM_H */ | ||
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 53fc04d75bad..d935417575b5 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -848,23 +848,6 @@ int snd_interval_ratnum(snd_interval_t *i, | |||
848 | 848 | ||
849 | void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params); | 849 | void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params); |
850 | void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); | 850 | void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); |
851 | int snd_pcm_hw_param_min(snd_pcm_substream_t *substream, | ||
852 | snd_pcm_hw_params_t *params, | ||
853 | snd_pcm_hw_param_t var, | ||
854 | unsigned int val, int *dir); | ||
855 | int snd_pcm_hw_param_max(snd_pcm_substream_t *substream, | ||
856 | snd_pcm_hw_params_t *params, | ||
857 | snd_pcm_hw_param_t var, | ||
858 | unsigned int val, int *dir); | ||
859 | int snd_pcm_hw_param_setinteger(snd_pcm_substream_t *substream, | ||
860 | snd_pcm_hw_params_t *params, | ||
861 | snd_pcm_hw_param_t var); | ||
862 | int snd_pcm_hw_param_first(snd_pcm_substream_t *substream, | ||
863 | snd_pcm_hw_params_t *params, | ||
864 | snd_pcm_hw_param_t var, int *dir); | ||
865 | int snd_pcm_hw_param_last(snd_pcm_substream_t *substream, | ||
866 | snd_pcm_hw_params_t *params, | ||
867 | snd_pcm_hw_param_t var, int *dir); | ||
868 | int snd_pcm_hw_param_near(snd_pcm_substream_t *substream, | 851 | int snd_pcm_hw_param_near(snd_pcm_substream_t *substream, |
869 | snd_pcm_hw_params_t *params, | 852 | snd_pcm_hw_params_t *params, |
870 | snd_pcm_hw_param_t var, | 853 | snd_pcm_hw_param_t var, |
@@ -876,7 +859,6 @@ int snd_pcm_hw_param_set(snd_pcm_substream_t *pcm, | |||
876 | int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); | 859 | int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); |
877 | 860 | ||
878 | int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); | 861 | int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); |
879 | int snd_pcm_hw_params(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); | ||
880 | 862 | ||
881 | int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); | 863 | int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); |
882 | int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); | 864 | int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); |
@@ -922,8 +904,22 @@ int snd_pcm_format_unsigned(snd_pcm_format_t format); | |||
922 | int snd_pcm_format_linear(snd_pcm_format_t format); | 904 | int snd_pcm_format_linear(snd_pcm_format_t format); |
923 | int snd_pcm_format_little_endian(snd_pcm_format_t format); | 905 | int snd_pcm_format_little_endian(snd_pcm_format_t format); |
924 | int snd_pcm_format_big_endian(snd_pcm_format_t format); | 906 | int snd_pcm_format_big_endian(snd_pcm_format_t format); |
907 | /** | ||
908 | * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian | ||
909 | * @format: the format to check | ||
910 | * | ||
911 | * Returns 1 if the given PCM format is CPU-endian, 0 if | ||
912 | * opposite, or a negative error code if endian not specified. | ||
913 | */ | ||
914 | /* int snd_pcm_format_cpu_endian(snd_pcm_format_t format); */ | ||
915 | #ifdef SNDRV_LITTLE_ENDIAN | ||
916 | #define snd_pcm_format_cpu_endian snd_pcm_format_little_endian | ||
917 | #else | ||
918 | #define snd_pcm_format_cpu_endian snd_pcm_format_big_endian | ||
919 | #endif | ||
925 | int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ | 920 | int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ |
926 | int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ | 921 | int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ |
922 | ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); | ||
927 | const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); | 923 | const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); |
928 | int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); | 924 | int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); |
929 | snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); | 925 | snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); |
diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h index 4357cac07500..8857e2bd31a5 100644 --- a/include/sound/seq_midi_event.h +++ b/include/sound/seq_midi_event.h | |||
@@ -41,9 +41,7 @@ struct snd_midi_event_t { | |||
41 | }; | 41 | }; |
42 | 42 | ||
43 | int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); | 43 | int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); |
44 | int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize); | ||
45 | void snd_midi_event_free(snd_midi_event_t *dev); | 44 | void snd_midi_event_free(snd_midi_event_t *dev); |
46 | void snd_midi_event_init(snd_midi_event_t *dev); | ||
47 | void snd_midi_event_reset_encode(snd_midi_event_t *dev); | 45 | void snd_midi_event_reset_encode(snd_midi_event_t *dev); |
48 | void snd_midi_event_reset_decode(snd_midi_event_t *dev); | 46 | void snd_midi_event_reset_decode(snd_midi_event_t *dev); |
49 | void snd_midi_event_no_status(snd_midi_event_t *dev, int on); | 47 | void snd_midi_event_no_status(snd_midi_event_t *dev, int on); |
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h index cf4e2388103f..1ad27e859af3 100644 --- a/include/sound/seq_virmidi.h +++ b/include/sound/seq_virmidi.h | |||
@@ -79,6 +79,5 @@ struct _snd_virmidi_dev { | |||
79 | #define SNDRV_VIRMIDI_SEQ_DISPATCH 2 | 79 | #define SNDRV_VIRMIDI_SEQ_DISPATCH 2 |
80 | 80 | ||
81 | int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); | 81 | int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); |
82 | int snd_virmidi_receive(snd_rawmidi_t *rmidi, snd_seq_event_t *ev); | ||
83 | 82 | ||
84 | #endif /* __SOUND_SEQ_VIRMIDI */ | 83 | #endif /* __SOUND_SEQ_VIRMIDI */ |
diff --git a/include/sound/timer.h b/include/sound/timer.h index 57fde990606e..1898511a0f38 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h | |||
@@ -152,6 +152,4 @@ extern int snd_timer_pause(snd_timer_instance_t * timeri); | |||
152 | 152 | ||
153 | extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); | 153 | extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); |
154 | 154 | ||
155 | extern unsigned int snd_timer_system_resolution(void); | ||
156 | |||
157 | #endif /* __SOUND_TIMER_H */ | 155 | #endif /* __SOUND_TIMER_H */ |
diff --git a/include/sound/version.h b/include/sound/version.h index 98b4230778ed..46acfa8c9988 100644 --- a/include/sound/version.h +++ b/include/sound/version.h | |||
@@ -1,3 +1,3 @@ | |||
1 | /* include/version.h. Generated by configure. */ | 1 | /* include/version.h. Generated by configure. */ |
2 | #define CONFIG_SND_VERSION "1.0.9rc2" | 2 | #define CONFIG_SND_VERSION "1.0.9" |
3 | #define CONFIG_SND_DATE " (Thu Mar 24 10:33:39 2005 UTC)" | 3 | #define CONFIG_SND_DATE " (Sun May 29 07:31:02 2005 UTC)" |