diff options
Diffstat (limited to 'include/asm-m68k')
-rw-r--r-- | include/asm-m68k/amigaints.h | 96 | ||||
-rw-r--r-- | include/asm-m68k/apollohw.h | 4 | ||||
-rw-r--r-- | include/asm-m68k/atari_stdma.h | 2 | ||||
-rw-r--r-- | include/asm-m68k/atariints.h | 11 | ||||
-rw-r--r-- | include/asm-m68k/bvme6000hw.h | 30 | ||||
-rw-r--r-- | include/asm-m68k/cacheflush.h | 40 | ||||
-rw-r--r-- | include/asm-m68k/dma-mapping.h | 90 | ||||
-rw-r--r-- | include/asm-m68k/floppy.h | 4 | ||||
-rw-r--r-- | include/asm-m68k/irq.h | 112 | ||||
-rw-r--r-- | include/asm-m68k/mac_oss.h | 10 | ||||
-rw-r--r-- | include/asm-m68k/machdep.h | 6 | ||||
-rw-r--r-- | include/asm-m68k/macintosh.h | 10 | ||||
-rw-r--r-- | include/asm-m68k/macints.h | 14 | ||||
-rw-r--r-- | include/asm-m68k/mvme147hw.h | 44 | ||||
-rw-r--r-- | include/asm-m68k/mvme16xhw.h | 40 | ||||
-rw-r--r-- | include/asm-m68k/processor.h | 8 | ||||
-rw-r--r-- | include/asm-m68k/scatterlist.h | 9 | ||||
-rw-r--r-- | include/asm-m68k/signal.h | 21 | ||||
-rw-r--r-- | include/asm-m68k/socket.h | 1 | ||||
-rw-r--r-- | include/asm-m68k/sun3ints.h | 22 | ||||
-rw-r--r-- | include/asm-m68k/sun3xflop.h | 3 | ||||
-rw-r--r-- | include/asm-m68k/traps.h | 7 | ||||
-rw-r--r-- | include/asm-m68k/uaccess.h | 1100 | ||||
-rw-r--r-- | include/asm-m68k/unistd.h | 39 |
24 files changed, 590 insertions, 1133 deletions
diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h index aa968d014bb6..7c8713468fd2 100644 --- a/include/asm-m68k/amigaints.h +++ b/include/asm-m68k/amigaints.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef _ASMm68k_AMIGAINTS_H_ | 13 | #ifndef _ASMm68k_AMIGAINTS_H_ |
14 | #define _ASMm68k_AMIGAINTS_H_ | 14 | #define _ASMm68k_AMIGAINTS_H_ |
15 | 15 | ||
16 | #include <asm/irq.h> | ||
17 | |||
16 | /* | 18 | /* |
17 | ** Amiga Interrupt sources. | 19 | ** Amiga Interrupt sources. |
18 | ** | 20 | ** |
@@ -23,72 +25,52 @@ | |||
23 | #define CIA_IRQS (5) | 25 | #define CIA_IRQS (5) |
24 | #define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */ | 26 | #define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */ |
25 | 27 | ||
26 | /* vertical blanking interrupt */ | 28 | /* builtin serial port interrupts */ |
27 | #define IRQ_AMIGA_VERTB 0 | 29 | #define IRQ_AMIGA_TBE (IRQ_USER+0) |
30 | #define IRQ_AMIGA_RBF (IRQ_USER+11) | ||
28 | 31 | ||
29 | /* copper interrupt */ | 32 | /* floppy disk interrupts */ |
30 | #define IRQ_AMIGA_COPPER 1 | 33 | #define IRQ_AMIGA_DSKBLK (IRQ_USER+1) |
34 | #define IRQ_AMIGA_DSKSYN (IRQ_USER+12) | ||
31 | 35 | ||
32 | /* Audio interrupts */ | 36 | /* software interrupts */ |
33 | #define IRQ_AMIGA_AUD0 2 | 37 | #define IRQ_AMIGA_SOFT (IRQ_USER+2) |
34 | #define IRQ_AMIGA_AUD1 3 | ||
35 | #define IRQ_AMIGA_AUD2 4 | ||
36 | #define IRQ_AMIGA_AUD3 5 | ||
37 | 38 | ||
38 | /* Blitter done interrupt */ | 39 | /* interrupts from external hardware */ |
39 | #define IRQ_AMIGA_BLIT 6 | 40 | #define IRQ_AMIGA_PORTS IRQ_AUTO_2 |
41 | #define IRQ_AMIGA_EXTER IRQ_AUTO_6 | ||
40 | 42 | ||
41 | /* floppy disk interrupts */ | 43 | /* copper interrupt */ |
42 | #define IRQ_AMIGA_DSKSYN 7 | 44 | #define IRQ_AMIGA_COPPER (IRQ_USER+4) |
43 | #define IRQ_AMIGA_DSKBLK 8 | ||
44 | 45 | ||
45 | /* builtin serial port interrupts */ | 46 | /* vertical blanking interrupt */ |
46 | #define IRQ_AMIGA_RBF 9 | 47 | #define IRQ_AMIGA_VERTB (IRQ_USER+5) |
47 | #define IRQ_AMIGA_TBE 10 | ||
48 | 48 | ||
49 | /* software interrupts */ | 49 | /* Blitter done interrupt */ |
50 | #define IRQ_AMIGA_SOFT 11 | 50 | #define IRQ_AMIGA_BLIT (IRQ_USER+6) |
51 | 51 | ||
52 | /* interrupts from external hardware */ | 52 | /* Audio interrupts */ |
53 | #define IRQ_AMIGA_PORTS 12 | 53 | #define IRQ_AMIGA_AUD0 (IRQ_USER+7) |
54 | #define IRQ_AMIGA_EXTER 13 | 54 | #define IRQ_AMIGA_AUD1 (IRQ_USER+8) |
55 | #define IRQ_AMIGA_AUD2 (IRQ_USER+9) | ||
56 | #define IRQ_AMIGA_AUD3 (IRQ_USER+10) | ||
55 | 57 | ||
56 | /* CIA interrupt sources */ | 58 | /* CIA interrupt sources */ |
57 | #define IRQ_AMIGA_CIAA 14 | 59 | #define IRQ_AMIGA_CIAA (IRQ_USER+14) |
58 | #define IRQ_AMIGA_CIAA_TA 14 | 60 | #define IRQ_AMIGA_CIAA_TA (IRQ_USER+14) |
59 | #define IRQ_AMIGA_CIAA_TB 15 | 61 | #define IRQ_AMIGA_CIAA_TB (IRQ_USER+15) |
60 | #define IRQ_AMIGA_CIAA_ALRM 16 | 62 | #define IRQ_AMIGA_CIAA_ALRM (IRQ_USER+16) |
61 | #define IRQ_AMIGA_CIAA_SP 17 | 63 | #define IRQ_AMIGA_CIAA_SP (IRQ_USER+17) |
62 | #define IRQ_AMIGA_CIAA_FLG 18 | 64 | #define IRQ_AMIGA_CIAA_FLG (IRQ_USER+18) |
63 | #define IRQ_AMIGA_CIAB 19 | 65 | #define IRQ_AMIGA_CIAB (IRQ_USER+19) |
64 | #define IRQ_AMIGA_CIAB_TA 19 | 66 | #define IRQ_AMIGA_CIAB_TA (IRQ_USER+19) |
65 | #define IRQ_AMIGA_CIAB_TB 20 | 67 | #define IRQ_AMIGA_CIAB_TB (IRQ_USER+20) |
66 | #define IRQ_AMIGA_CIAB_ALRM 21 | 68 | #define IRQ_AMIGA_CIAB_ALRM (IRQ_USER+21) |
67 | #define IRQ_AMIGA_CIAB_SP 22 | 69 | #define IRQ_AMIGA_CIAB_SP (IRQ_USER+22) |
68 | #define IRQ_AMIGA_CIAB_FLG 23 | 70 | #define IRQ_AMIGA_CIAB_FLG (IRQ_USER+23) |
69 | |||
70 | /* auto-vector interrupts */ | ||
71 | #define IRQ_AMIGA_AUTO 24 | ||
72 | #define IRQ_AMIGA_AUTO_0 24 /* This is just a dummy */ | ||
73 | #define IRQ_AMIGA_AUTO_1 25 | ||
74 | #define IRQ_AMIGA_AUTO_2 26 | ||
75 | #define IRQ_AMIGA_AUTO_3 27 | ||
76 | #define IRQ_AMIGA_AUTO_4 28 | ||
77 | #define IRQ_AMIGA_AUTO_5 29 | ||
78 | #define IRQ_AMIGA_AUTO_6 30 | ||
79 | #define IRQ_AMIGA_AUTO_7 31 | ||
80 | |||
81 | #define IRQ_FLOPPY IRQ_AMIGA_DSKBLK | ||
82 | 71 | ||
83 | /* INTREQR masks */ | ||
84 | #define IRQ1_MASK 0x0007 /* INTREQR mask for IRQ 1 */ | ||
85 | #define IRQ2_MASK 0x0008 /* INTREQR mask for IRQ 2 */ | ||
86 | #define IRQ3_MASK 0x0070 /* INTREQR mask for IRQ 3 */ | ||
87 | #define IRQ4_MASK 0x0780 /* INTREQR mask for IRQ 4 */ | ||
88 | #define IRQ5_MASK 0x1800 /* INTREQR mask for IRQ 5 */ | ||
89 | #define IRQ6_MASK 0x2000 /* INTREQR mask for IRQ 6 */ | ||
90 | #define IRQ7_MASK 0x4000 /* INTREQR mask for IRQ 7 */ | ||
91 | 72 | ||
73 | /* INTREQR masks */ | ||
92 | #define IF_SETCLR 0x8000 /* set/clr bit */ | 74 | #define IF_SETCLR 0x8000 /* set/clr bit */ |
93 | #define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */ | 75 | #define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */ |
94 | #define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */ | 76 | #define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */ |
@@ -106,9 +88,6 @@ | |||
106 | #define IF_DSKBLK 0x0002 /* diskblock DMA finished */ | 88 | #define IF_DSKBLK 0x0002 /* diskblock DMA finished */ |
107 | #define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */ | 89 | #define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */ |
108 | 90 | ||
109 | extern void amiga_do_irq(int irq, struct pt_regs *fp); | ||
110 | extern void amiga_do_irq_list(int irq, struct pt_regs *fp); | ||
111 | |||
112 | /* CIA interrupt control register bits */ | 91 | /* CIA interrupt control register bits */ |
113 | 92 | ||
114 | #define CIA_ICR_TA 0x01 | 93 | #define CIA_ICR_TA 0x01 |
@@ -125,6 +104,7 @@ extern void amiga_do_irq_list(int irq, struct pt_regs *fp); | |||
125 | 104 | ||
126 | extern struct ciabase ciaa_base, ciab_base; | 105 | extern struct ciabase ciaa_base, ciab_base; |
127 | 106 | ||
107 | extern void cia_init_IRQ(struct ciabase *base); | ||
128 | extern unsigned char cia_set_irq(struct ciabase *base, unsigned char mask); | 108 | extern unsigned char cia_set_irq(struct ciabase *base, unsigned char mask); |
129 | extern unsigned char cia_able_irq(struct ciabase *base, unsigned char mask); | 109 | extern unsigned char cia_able_irq(struct ciabase *base, unsigned char mask); |
130 | 110 | ||
diff --git a/include/asm-m68k/apollohw.h b/include/asm-m68k/apollohw.h index 4304e1c33e17..a1373b9aa281 100644 --- a/include/asm-m68k/apollohw.h +++ b/include/asm-m68k/apollohw.h | |||
@@ -3,6 +3,8 @@ | |||
3 | #ifndef _ASMm68k_APOLLOHW_H_ | 3 | #ifndef _ASMm68k_APOLLOHW_H_ |
4 | #define _ASMm68k_APOLLOHW_H_ | 4 | #define _ASMm68k_APOLLOHW_H_ |
5 | 5 | ||
6 | #include <linux/types.h> | ||
7 | |||
6 | /* | 8 | /* |
7 | apollo models | 9 | apollo models |
8 | */ | 10 | */ |
@@ -101,4 +103,6 @@ extern u_long timer_physaddr; | |||
101 | 103 | ||
102 | #define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) | 104 | #define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) |
103 | 105 | ||
106 | #define IRQ_APOLLO IRQ_USER | ||
107 | |||
104 | #endif | 108 | #endif |
diff --git a/include/asm-m68k/atari_stdma.h b/include/asm-m68k/atari_stdma.h index 64f92880ce43..b4eadf852738 100644 --- a/include/asm-m68k/atari_stdma.h +++ b/include/asm-m68k/atari_stdma.h | |||
@@ -3,7 +3,7 @@ | |||
3 | #define _atari_stdma_h | 3 | #define _atari_stdma_h |
4 | 4 | ||
5 | 5 | ||
6 | #include <asm/irq.h> | 6 | #include <linux/interrupt.h> |
7 | 7 | ||
8 | 8 | ||
9 | /***************************** Prototypes *****************************/ | 9 | /***************************** Prototypes *****************************/ |
diff --git a/include/asm-m68k/atariints.h b/include/asm-m68k/atariints.h index 42952c890593..0ed454fc24bb 100644 --- a/include/asm-m68k/atariints.h +++ b/include/asm-m68k/atariints.h | |||
@@ -45,17 +45,6 @@ | |||
45 | #define IRQ_TYPE_FAST 1 | 45 | #define IRQ_TYPE_FAST 1 |
46 | #define IRQ_TYPE_PRIO 2 | 46 | #define IRQ_TYPE_PRIO 2 |
47 | 47 | ||
48 | #define IRQ_SPURIOUS (0) | ||
49 | |||
50 | /* auto-vector interrupts */ | ||
51 | #define IRQ_AUTO_1 (1) | ||
52 | #define IRQ_AUTO_2 (2) | ||
53 | #define IRQ_AUTO_3 (3) | ||
54 | #define IRQ_AUTO_4 (4) | ||
55 | #define IRQ_AUTO_5 (5) | ||
56 | #define IRQ_AUTO_6 (6) | ||
57 | #define IRQ_AUTO_7 (7) | ||
58 | |||
59 | /* ST-MFP interrupts */ | 48 | /* ST-MFP interrupts */ |
60 | #define IRQ_MFP_BUSY (8) | 49 | #define IRQ_MFP_BUSY (8) |
61 | #define IRQ_MFP_DCD (9) | 50 | #define IRQ_MFP_DCD (9) |
diff --git a/include/asm-m68k/bvme6000hw.h b/include/asm-m68k/bvme6000hw.h index 28a859b03959..f40d2f8510ee 100644 --- a/include/asm-m68k/bvme6000hw.h +++ b/include/asm-m68k/bvme6000hw.h | |||
@@ -109,23 +109,23 @@ typedef struct { | |||
109 | 109 | ||
110 | #define BVME_IRQ_TYPE_PRIO 0 | 110 | #define BVME_IRQ_TYPE_PRIO 0 |
111 | 111 | ||
112 | #define BVME_IRQ_PRN 0x54 | 112 | #define BVME_IRQ_PRN (IRQ_USER+20) |
113 | #define BVME_IRQ_I596 0x1a | 113 | #define BVME_IRQ_TIMER (IRQ_USER+25) |
114 | #define BVME_IRQ_SCSI 0x1b | 114 | #define BVME_IRQ_I596 IRQ_AUTO_2 |
115 | #define BVME_IRQ_TIMER 0x59 | 115 | #define BVME_IRQ_SCSI IRQ_AUTO_3 |
116 | #define BVME_IRQ_RTC 0x1e | 116 | #define BVME_IRQ_RTC IRQ_AUTO_6 |
117 | #define BVME_IRQ_ABORT 0x1f | 117 | #define BVME_IRQ_ABORT IRQ_AUTO_7 |
118 | 118 | ||
119 | /* SCC interrupts */ | 119 | /* SCC interrupts */ |
120 | #define BVME_IRQ_SCC_BASE 0x40 | 120 | #define BVME_IRQ_SCC_BASE IRQ_USER |
121 | #define BVME_IRQ_SCCB_TX 0x40 | 121 | #define BVME_IRQ_SCCB_TX IRQ_USER |
122 | #define BVME_IRQ_SCCB_STAT 0x42 | 122 | #define BVME_IRQ_SCCB_STAT (IRQ_USER+2) |
123 | #define BVME_IRQ_SCCB_RX 0x44 | 123 | #define BVME_IRQ_SCCB_RX (IRQ_USER+4) |
124 | #define BVME_IRQ_SCCB_SPCOND 0x46 | 124 | #define BVME_IRQ_SCCB_SPCOND (IRQ_USER+6) |
125 | #define BVME_IRQ_SCCA_TX 0x48 | 125 | #define BVME_IRQ_SCCA_TX (IRQ_USER+8) |
126 | #define BVME_IRQ_SCCA_STAT 0x4a | 126 | #define BVME_IRQ_SCCA_STAT (IRQ_USER+10) |
127 | #define BVME_IRQ_SCCA_RX 0x4c | 127 | #define BVME_IRQ_SCCA_RX (IRQ_USER+12) |
128 | #define BVME_IRQ_SCCA_SPCOND 0x4e | 128 | #define BVME_IRQ_SCCA_SPCOND (IRQ_USER+14) |
129 | 129 | ||
130 | /* Address control registers */ | 130 | /* Address control registers */ |
131 | 131 | ||
diff --git a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h index 8aba971b1368..24d3ff449135 100644 --- a/include/asm-m68k/cacheflush.h +++ b/include/asm-m68k/cacheflush.h | |||
@@ -3,26 +3,30 @@ | |||
3 | 3 | ||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | 5 | ||
6 | /* cache code */ | ||
7 | #define FLUSH_I_AND_D (0x00000808) | ||
8 | #define FLUSH_I (0x00000008) | ||
9 | |||
6 | /* | 10 | /* |
7 | * Cache handling functions | 11 | * Cache handling functions |
8 | */ | 12 | */ |
9 | 13 | ||
10 | #define flush_icache() \ | 14 | static inline void flush_icache(void) |
11 | ({ \ | 15 | { |
12 | if (CPU_IS_040_OR_060) \ | 16 | if (CPU_IS_040_OR_060) |
13 | __asm__ __volatile__("nop\n\t" \ | 17 | asm volatile ( "nop\n" |
14 | ".chip 68040\n\t" \ | 18 | " .chip 68040\n" |
15 | "cinva %%ic\n\t" \ | 19 | " cpusha %bc\n" |
16 | ".chip 68k" : ); \ | 20 | " .chip 68k"); |
17 | else { \ | 21 | else { |
18 | unsigned long _tmp; \ | 22 | unsigned long tmp; |
19 | __asm__ __volatile__("movec %%cacr,%0\n\t" \ | 23 | asm volatile ( "movec %%cacr,%0\n" |
20 | "orw %1,%0\n\t" \ | 24 | " or.w %1,%0\n" |
21 | "movec %0,%%cacr" \ | 25 | " movec %0,%%cacr" |
22 | : "=&d" (_tmp) \ | 26 | : "=&d" (tmp) |
23 | : "id" (FLUSH_I)); \ | 27 | : "id" (FLUSH_I)); |
24 | } \ | 28 | } |
25 | }) | 29 | } |
26 | 30 | ||
27 | /* | 31 | /* |
28 | * invalidate the cache for the specified memory range. | 32 | * invalidate the cache for the specified memory range. |
@@ -43,10 +47,6 @@ extern void cache_push(unsigned long paddr, int len); | |||
43 | */ | 47 | */ |
44 | extern void cache_push_v(unsigned long vaddr, int len); | 48 | extern void cache_push_v(unsigned long vaddr, int len); |
45 | 49 | ||
46 | /* cache code */ | ||
47 | #define FLUSH_I_AND_D (0x00000808) | ||
48 | #define FLUSH_I (0x00000008) | ||
49 | |||
50 | /* This is needed whenever the virtual mapping of the current | 50 | /* This is needed whenever the virtual mapping of the current |
51 | process changes. */ | 51 | process changes. */ |
52 | #define __flush_cache_all() \ | 52 | #define __flush_cache_all() \ |
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h index dffd59cf1364..cebbb03370ec 100644 --- a/include/asm-m68k/dma-mapping.h +++ b/include/asm-m68k/dma-mapping.h | |||
@@ -1,11 +1,91 @@ | |||
1 | #ifndef _M68K_DMA_MAPPING_H | 1 | #ifndef _M68K_DMA_MAPPING_H |
2 | #define _M68K_DMA_MAPPING_H | 2 | #define _M68K_DMA_MAPPING_H |
3 | 3 | ||
4 | #include <asm/cache.h> | ||
4 | 5 | ||
5 | #ifdef CONFIG_PCI | 6 | struct scatterlist; |
6 | #include <asm-generic/dma-mapping.h> | 7 | |
7 | #else | 8 | static inline int dma_supported(struct device *dev, u64 mask) |
8 | #include <asm-generic/dma-mapping-broken.h> | 9 | { |
9 | #endif | 10 | return 1; |
11 | } | ||
12 | |||
13 | static inline int dma_set_mask(struct device *dev, u64 mask) | ||
14 | { | ||
15 | return 0; | ||
16 | } | ||
17 | |||
18 | static inline int dma_get_cache_alignment(void) | ||
19 | { | ||
20 | return 1 << L1_CACHE_SHIFT; | ||
21 | } | ||
22 | |||
23 | static inline int dma_is_consistent(dma_addr_t dma_addr) | ||
24 | { | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | extern void *dma_alloc_coherent(struct device *, size_t, | ||
29 | dma_addr_t *, int); | ||
30 | extern void dma_free_coherent(struct device *, size_t, | ||
31 | void *, dma_addr_t); | ||
32 | |||
33 | static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, | ||
34 | dma_addr_t *handle, int flag) | ||
35 | { | ||
36 | return dma_alloc_coherent(dev, size, handle, flag); | ||
37 | } | ||
38 | static inline void dma_free_noncoherent(struct device *dev, size_t size, | ||
39 | void *addr, dma_addr_t handle) | ||
40 | { | ||
41 | dma_free_coherent(dev, size, addr, handle); | ||
42 | } | ||
43 | static inline void dma_cache_sync(void *vaddr, size_t size, | ||
44 | enum dma_data_direction dir) | ||
45 | { | ||
46 | /* we use coherent allocation, so not much to do here. */ | ||
47 | } | ||
48 | |||
49 | extern dma_addr_t dma_map_single(struct device *, void *, size_t, | ||
50 | enum dma_data_direction); | ||
51 | static inline void dma_unmap_single(struct device *dev, dma_addr_t addr, | ||
52 | size_t size, enum dma_data_direction dir) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | extern dma_addr_t dma_map_page(struct device *, struct page *, | ||
57 | unsigned long, size_t size, | ||
58 | enum dma_data_direction); | ||
59 | static inline void dma_unmap_page(struct device *dev, dma_addr_t address, | ||
60 | size_t size, enum dma_data_direction dir) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | extern int dma_map_sg(struct device *, struct scatterlist *, int, | ||
65 | enum dma_data_direction); | ||
66 | static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
67 | int nhwentries, enum dma_data_direction dir) | ||
68 | { | ||
69 | } | ||
70 | |||
71 | extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t, | ||
72 | enum dma_data_direction); | ||
73 | extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, | ||
74 | enum dma_data_direction); | ||
75 | |||
76 | static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, | ||
77 | size_t size, enum dma_data_direction dir) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | ||
82 | int nents, enum dma_data_direction dir) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | static inline int dma_mapping_error(dma_addr_t handle) | ||
87 | { | ||
88 | return 0; | ||
89 | } | ||
10 | 90 | ||
11 | #endif /* _M68K_DMA_MAPPING_H */ | 91 | #endif /* _M68K_DMA_MAPPING_H */ |
diff --git a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h index 63a05ed95c17..57f4fdda65ab 100644 --- a/include/asm-m68k/floppy.h +++ b/include/asm-m68k/floppy.h | |||
@@ -88,8 +88,8 @@ static __inline__ void fd_outb(unsigned char value, int port) | |||
88 | static int fd_request_irq(void) | 88 | static int fd_request_irq(void) |
89 | { | 89 | { |
90 | if(MACH_IS_Q40) | 90 | if(MACH_IS_Q40) |
91 | return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, | 91 | return request_irq(FLOPPY_IRQ, floppy_hardint, |
92 | "floppy", floppy_hardint); | 92 | IRQF_DISABLED, "floppy", floppy_hardint); |
93 | else if(MACH_IS_SUN3X) | 93 | else if(MACH_IS_SUN3X) |
94 | return sun3xflop_request_irq(); | 94 | return sun3xflop_request_irq(); |
95 | return -ENXIO; | 95 | return -ENXIO; |
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h index b4f48b2a6a57..3257f9881002 100644 --- a/include/asm-m68k/irq.h +++ b/include/asm-m68k/irq.h | |||
@@ -1,13 +1,9 @@ | |||
1 | #ifndef _M68K_IRQ_H_ | 1 | #ifndef _M68K_IRQ_H_ |
2 | #define _M68K_IRQ_H_ | 2 | #define _M68K_IRQ_H_ |
3 | 3 | ||
4 | #include <linux/interrupt.h> | 4 | #include <linux/linkage.h> |
5 | 5 | #include <linux/hardirq.h> | |
6 | /* | 6 | #include <linux/spinlock_types.h> |
7 | * # of m68k interrupts | ||
8 | */ | ||
9 | |||
10 | #define SYS_IRQS 8 | ||
11 | 7 | ||
12 | /* | 8 | /* |
13 | * This should be the same as the max(NUM_X_SOURCES) for all the | 9 | * This should be the same as the max(NUM_X_SOURCES) for all the |
@@ -15,10 +11,20 @@ | |||
15 | * Currently the Atari has 72 and the Amiga 24, but if both are | 11 | * Currently the Atari has 72 and the Amiga 24, but if both are |
16 | * supported in the kernel it is better to make room for 72. | 12 | * supported in the kernel it is better to make room for 72. |
17 | */ | 13 | */ |
18 | #if defined(CONFIG_ATARI) || defined(CONFIG_MAC) | 14 | #if defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) |
19 | #define NR_IRQS (72+SYS_IRQS) | 15 | #define NR_IRQS 200 |
16 | #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) | ||
17 | #define NR_IRQS 72 | ||
18 | #elif defined(CONFIG_Q40) | ||
19 | #define NR_IRQS 43 | ||
20 | #elif defined(CONFIG_AMIGA) | ||
21 | #define NR_IRQS 32 | ||
22 | #elif defined(CONFIG_APOLLO) | ||
23 | #define NR_IRQS 24 | ||
24 | #elif defined(CONFIG_HP300) | ||
25 | #define NR_IRQS 8 | ||
20 | #else | 26 | #else |
21 | #define NR_IRQS (24+SYS_IRQS) | 27 | #error unknown nr of irqs |
22 | #endif | 28 | #endif |
23 | 29 | ||
24 | /* | 30 | /* |
@@ -40,57 +46,29 @@ | |||
40 | * that routine requires service. | 46 | * that routine requires service. |
41 | */ | 47 | */ |
42 | 48 | ||
43 | #define IRQ1 (1) /* level 1 interrupt */ | 49 | #define IRQ_SPURIOUS 0 |
44 | #define IRQ2 (2) /* level 2 interrupt */ | ||
45 | #define IRQ3 (3) /* level 3 interrupt */ | ||
46 | #define IRQ4 (4) /* level 4 interrupt */ | ||
47 | #define IRQ5 (5) /* level 5 interrupt */ | ||
48 | #define IRQ6 (6) /* level 6 interrupt */ | ||
49 | #define IRQ7 (7) /* level 7 interrupt (non-maskable) */ | ||
50 | 50 | ||
51 | /* | 51 | #define IRQ_AUTO_1 1 /* level 1 interrupt */ |
52 | * "Generic" interrupt sources | 52 | #define IRQ_AUTO_2 2 /* level 2 interrupt */ |
53 | */ | 53 | #define IRQ_AUTO_3 3 /* level 3 interrupt */ |
54 | 54 | #define IRQ_AUTO_4 4 /* level 4 interrupt */ | |
55 | #define IRQ_SCHED_TIMER (8) /* interrupt source for scheduling timer */ | 55 | #define IRQ_AUTO_5 5 /* level 5 interrupt */ |
56 | #define IRQ_AUTO_6 6 /* level 6 interrupt */ | ||
57 | #define IRQ_AUTO_7 7 /* level 7 interrupt (non-maskable) */ | ||
56 | 58 | ||
57 | static __inline__ int irq_canonicalize(int irq) | 59 | #define IRQ_USER 8 |
58 | { | ||
59 | return irq; | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Machine specific interrupt sources. | ||
64 | * | ||
65 | * Adding an interrupt service routine for a source with this bit | ||
66 | * set indicates a special machine specific interrupt source. | ||
67 | * The machine specific files define these sources. | ||
68 | * | ||
69 | * The IRQ_MACHSPEC bit is now gone - the only thing it did was to | ||
70 | * introduce unnecessary overhead. | ||
71 | * | ||
72 | * All interrupt handling is actually machine specific so it is better | ||
73 | * to use function pointers, as used by the Sparc port, and select the | ||
74 | * interrupt handling functions when initializing the kernel. This way | ||
75 | * we save some unnecessary overhead at run-time. | ||
76 | * 01/11/97 - Jes | ||
77 | */ | ||
78 | 60 | ||
79 | extern void (*enable_irq)(unsigned int); | 61 | extern unsigned int irq_canonicalize(unsigned int irq); |
80 | extern void (*disable_irq)(unsigned int); | 62 | extern void enable_irq(unsigned int); |
63 | extern void disable_irq(unsigned int); | ||
81 | #define disable_irq_nosync disable_irq | 64 | #define disable_irq_nosync disable_irq |
82 | 65 | ||
83 | struct pt_regs; | 66 | struct pt_regs; |
84 | 67 | ||
85 | extern int cpu_request_irq(unsigned int, | ||
86 | irqreturn_t (*)(int, void *, struct pt_regs *), | ||
87 | unsigned long, const char *, void *); | ||
88 | extern void cpu_free_irq(unsigned int, void *); | ||
89 | |||
90 | /* | 68 | /* |
91 | * various flags for request_irq() - the Amiga now uses the standard | 69 | * various flags for request_irq() - the Amiga now uses the standard |
92 | * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ | 70 | * mechanism like all other architectures - IRQF_DISABLED and |
93 | * are your friends. | 71 | * IRQF_SHARED are your friends. |
94 | */ | 72 | */ |
95 | #ifndef MACH_AMIGA_ONLY | 73 | #ifndef MACH_AMIGA_ONLY |
96 | #define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */ | 74 | #define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */ |
@@ -105,33 +83,45 @@ extern void cpu_free_irq(unsigned int, void *); | |||
105 | * interrupt source (if it supports chaining). | 83 | * interrupt source (if it supports chaining). |
106 | */ | 84 | */ |
107 | typedef struct irq_node { | 85 | typedef struct irq_node { |
108 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | 86 | int (*handler)(int, void *, struct pt_regs *); |
109 | unsigned long flags; | ||
110 | void *dev_id; | 87 | void *dev_id; |
111 | const char *devname; | ||
112 | struct irq_node *next; | 88 | struct irq_node *next; |
89 | unsigned long flags; | ||
90 | const char *devname; | ||
113 | } irq_node_t; | 91 | } irq_node_t; |
114 | 92 | ||
115 | /* | 93 | /* |
116 | * This structure has only 4 elements for speed reasons | 94 | * This structure has only 4 elements for speed reasons |
117 | */ | 95 | */ |
118 | typedef struct irq_handler { | 96 | typedef struct irq_handler { |
119 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | 97 | int (*handler)(int, void *, struct pt_regs *); |
120 | unsigned long flags; | 98 | unsigned long flags; |
121 | void *dev_id; | 99 | void *dev_id; |
122 | const char *devname; | 100 | const char *devname; |
123 | } irq_handler_t; | 101 | } irq_handler_t; |
124 | 102 | ||
125 | /* count of spurious interrupts */ | 103 | struct irq_controller { |
126 | extern volatile unsigned int num_spurious; | 104 | const char *name; |
105 | spinlock_t lock; | ||
106 | int (*startup)(unsigned int irq); | ||
107 | void (*shutdown)(unsigned int irq); | ||
108 | void (*enable)(unsigned int irq); | ||
109 | void (*disable)(unsigned int irq); | ||
110 | }; | ||
111 | |||
112 | extern int m68k_irq_startup(unsigned int); | ||
113 | extern void m68k_irq_shutdown(unsigned int); | ||
127 | 114 | ||
128 | /* | 115 | /* |
129 | * This function returns a new irq_node_t | 116 | * This function returns a new irq_node_t |
130 | */ | 117 | */ |
131 | extern irq_node_t *new_irq_node(void); | 118 | extern irq_node_t *new_irq_node(void); |
132 | 119 | ||
133 | struct irqaction; | 120 | extern void m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *)); |
134 | struct pt_regs; | 121 | extern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt, |
135 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | 122 | void (*handler)(unsigned int, struct pt_regs *)); |
123 | extern void m68k_setup_irq_controller(struct irq_controller *, unsigned int, unsigned int); | ||
124 | |||
125 | asmlinkage void m68k_handle_int(unsigned int, struct pt_regs *); | ||
136 | 126 | ||
137 | #endif /* _M68K_IRQ_H_ */ | 127 | #endif /* _M68K_IRQ_H_ */ |
diff --git a/include/asm-m68k/mac_oss.h b/include/asm-m68k/mac_oss.h index 7644a639cd6c..7221f7251934 100644 --- a/include/asm-m68k/mac_oss.h +++ b/include/asm-m68k/mac_oss.h | |||
@@ -69,12 +69,12 @@ | |||
69 | 69 | ||
70 | #define OSS_IRQLEV_DISABLED 0 | 70 | #define OSS_IRQLEV_DISABLED 0 |
71 | #define OSS_IRQLEV_IOPISM 1 /* ADB? */ | 71 | #define OSS_IRQLEV_IOPISM 1 /* ADB? */ |
72 | #define OSS_IRQLEV_SCSI 2 | 72 | #define OSS_IRQLEV_SCSI IRQ_AUTO_2 |
73 | #define OSS_IRQLEV_NUBUS 3 /* keep this on its own level */ | 73 | #define OSS_IRQLEV_NUBUS IRQ_AUTO_3 /* keep this on its own level */ |
74 | #define OSS_IRQLEV_IOPSCC 4 /* matches VIA alternate mapping */ | 74 | #define OSS_IRQLEV_IOPSCC IRQ_AUTO_4 /* matches VIA alternate mapping */ |
75 | #define OSS_IRQLEV_SOUND 5 /* matches VIA alternate mapping */ | 75 | #define OSS_IRQLEV_SOUND IRQ_AUTO_5 /* matches VIA alternate mapping */ |
76 | #define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */ | 76 | #define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */ |
77 | #define OSS_IRQLEV_VIA1 6 /* matches VIA alternate mapping */ | 77 | #define OSS_IRQLEV_VIA1 IRQ_AUTO_6 /* matches VIA alternate mapping */ |
78 | #define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */ | 78 | #define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */ |
79 | 79 | ||
80 | #ifndef __ASSEMBLY__ | 80 | #ifndef __ASSEMBLY__ |
diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h index 7d3fee342369..df898f27e434 100644 --- a/include/asm-m68k/machdep.h +++ b/include/asm-m68k/machdep.h | |||
@@ -13,14 +13,8 @@ struct buffer_head; | |||
13 | extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)); | 13 | extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)); |
14 | /* machine dependent irq functions */ | 14 | /* machine dependent irq functions */ |
15 | extern void (*mach_init_IRQ) (void); | 15 | extern void (*mach_init_IRQ) (void); |
16 | extern irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); | ||
17 | extern int (*mach_request_irq) (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
18 | unsigned long flags, const char *devname, void *dev_id); | ||
19 | extern void (*mach_free_irq) (unsigned int irq, void *dev_id); | ||
20 | extern void (*mach_get_model) (char *model); | 16 | extern void (*mach_get_model) (char *model); |
21 | extern int (*mach_get_hardware_list) (char *buffer); | 17 | extern int (*mach_get_hardware_list) (char *buffer); |
22 | extern int (*mach_get_irq_list) (struct seq_file *p, void *v); | ||
23 | extern irqreturn_t (*mach_process_int) (int irq, struct pt_regs *fp); | ||
24 | /* machine dependent timer functions */ | 18 | /* machine dependent timer functions */ |
25 | extern unsigned long (*mach_gettimeoffset)(void); | 19 | extern unsigned long (*mach_gettimeoffset)(void); |
26 | extern int (*mach_hwclk)(int, struct rtc_time*); | 20 | extern int (*mach_hwclk)(int, struct rtc_time*); |
diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h index 6fc3d19512d1..27d11da2b479 100644 --- a/include/asm-m68k/macintosh.h +++ b/include/asm-m68k/macintosh.h | |||
@@ -11,17 +11,7 @@ | |||
11 | extern void mac_reset(void); | 11 | extern void mac_reset(void); |
12 | extern void mac_poweroff(void); | 12 | extern void mac_poweroff(void); |
13 | extern void mac_init_IRQ(void); | 13 | extern void mac_init_IRQ(void); |
14 | extern int mac_request_irq (unsigned int, irqreturn_t (*)(int, void *, | ||
15 | struct pt_regs *), | ||
16 | unsigned long, const char *, void *); | ||
17 | extern void mac_free_irq(unsigned int, void *); | ||
18 | extern void mac_enable_irq(unsigned int); | ||
19 | extern void mac_disable_irq(unsigned int); | ||
20 | extern int mac_irq_pending(unsigned int); | 14 | extern int mac_irq_pending(unsigned int); |
21 | extern int show_mac_interrupts(struct seq_file *, void *); | ||
22 | #if 0 | ||
23 | extern void mac_default_handler(int irq); | ||
24 | #endif | ||
25 | extern void mac_identify(void); | 15 | extern void mac_identify(void); |
26 | extern void mac_report_hardware(void); | 16 | extern void mac_report_hardware(void); |
27 | extern void mac_debugging_penguin(int); | 17 | extern void mac_debugging_penguin(int); |
diff --git a/include/asm-m68k/macints.h b/include/asm-m68k/macints.h index fd8c3a9fea4d..679c48ab4407 100644 --- a/include/asm-m68k/macints.h +++ b/include/asm-m68k/macints.h | |||
@@ -59,17 +59,6 @@ | |||
59 | #define IRQ_SRC(irq) (irq >> 3) | 59 | #define IRQ_SRC(irq) (irq >> 3) |
60 | #define IRQ_IDX(irq) (irq & 7) | 60 | #define IRQ_IDX(irq) (irq & 7) |
61 | 61 | ||
62 | #define IRQ_SPURIOUS (0) | ||
63 | |||
64 | /* auto-vector interrupts */ | ||
65 | #define IRQ_AUTO_1 (1) | ||
66 | #define IRQ_AUTO_2 (2) | ||
67 | #define IRQ_AUTO_3 (3) | ||
68 | #define IRQ_AUTO_4 (4) | ||
69 | #define IRQ_AUTO_5 (5) | ||
70 | #define IRQ_AUTO_6 (6) | ||
71 | #define IRQ_AUTO_7 (7) | ||
72 | |||
73 | /* VIA1 interrupts */ | 62 | /* VIA1 interrupts */ |
74 | #define IRQ_VIA1_0 (8) /* one second int. */ | 63 | #define IRQ_VIA1_0 (8) /* one second int. */ |
75 | #define IRQ_VIA1_1 (9) /* VBlank int. */ | 64 | #define IRQ_VIA1_1 (9) /* VBlank int. */ |
@@ -163,7 +152,4 @@ | |||
163 | #define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */ | 152 | #define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */ |
164 | #define INT_TICKS 246 /* to make sched_time = 99.902... HZ */ | 153 | #define INT_TICKS 246 /* to make sched_time = 99.902... HZ */ |
165 | 154 | ||
166 | extern irq_node_t *mac_irq_list[NUM_MAC_SOURCES]; | ||
167 | extern void mac_do_irq_list(int irq, struct pt_regs *); | ||
168 | |||
169 | #endif /* asm/macints.h */ | 155 | #endif /* asm/macints.h */ |
diff --git a/include/asm-m68k/mvme147hw.h b/include/asm-m68k/mvme147hw.h index f245139f3671..b81043108472 100644 --- a/include/asm-m68k/mvme147hw.h +++ b/include/asm-m68k/mvme147hw.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _MVME147HW_H_ | 1 | #ifndef _MVME147HW_H_ |
2 | #define _MVME147HW_H_ | 2 | #define _MVME147HW_H_ |
3 | 3 | ||
4 | #include <asm/irq.h> | ||
5 | |||
4 | typedef struct { | 6 | typedef struct { |
5 | unsigned char | 7 | unsigned char |
6 | ctrl, | 8 | ctrl, |
@@ -72,39 +74,39 @@ struct pcc_regs { | |||
72 | #define PCC_LEVEL_SCSI_PORT 0x04 | 74 | #define PCC_LEVEL_SCSI_PORT 0x04 |
73 | #define PCC_LEVEL_SCSI_DMA 0x04 | 75 | #define PCC_LEVEL_SCSI_DMA 0x04 |
74 | 76 | ||
75 | #define PCC_IRQ_AC_FAIL 0x40 | 77 | #define PCC_IRQ_AC_FAIL (IRQ_USER+0) |
76 | #define PCC_IRQ_BERR 0x41 | 78 | #define PCC_IRQ_BERR (IRQ_USER+1) |
77 | #define PCC_IRQ_ABORT 0x42 | 79 | #define PCC_IRQ_ABORT (IRQ_USER+2) |
78 | /* #define PCC_IRQ_SERIAL 0x43 */ | 80 | /* #define PCC_IRQ_SERIAL (IRQ_USER+3) */ |
79 | #define PCC_IRQ_PRINTER 0x47 | 81 | #define PCC_IRQ_PRINTER (IRQ_USER+7) |
80 | #define PCC_IRQ_TIMER1 0x48 | 82 | #define PCC_IRQ_TIMER1 (IRQ_USER+8) |
81 | #define PCC_IRQ_TIMER2 0x49 | 83 | #define PCC_IRQ_TIMER2 (IRQ_USER+9) |
82 | #define PCC_IRQ_SOFTWARE1 0x4a | 84 | #define PCC_IRQ_SOFTWARE1 (IRQ_USER+10) |
83 | #define PCC_IRQ_SOFTWARE2 0x4b | 85 | #define PCC_IRQ_SOFTWARE2 (IRQ_USER+11) |
84 | 86 | ||
85 | 87 | ||
86 | #define M147_SCC_A_ADDR 0xfffe3002 | 88 | #define M147_SCC_A_ADDR 0xfffe3002 |
87 | #define M147_SCC_B_ADDR 0xfffe3000 | 89 | #define M147_SCC_B_ADDR 0xfffe3000 |
88 | #define M147_SCC_PCLK 5000000 | 90 | #define M147_SCC_PCLK 5000000 |
89 | 91 | ||
90 | #define MVME147_IRQ_SCSI_PORT 0x45 | 92 | #define MVME147_IRQ_SCSI_PORT (IRQ_USER+0x45) |
91 | #define MVME147_IRQ_SCSI_DMA 0x46 | 93 | #define MVME147_IRQ_SCSI_DMA (IRQ_USER+0x46) |
92 | 94 | ||
93 | /* SCC interrupts, for MVME147 */ | 95 | /* SCC interrupts, for MVME147 */ |
94 | 96 | ||
95 | #define MVME147_IRQ_TYPE_PRIO 0 | 97 | #define MVME147_IRQ_TYPE_PRIO 0 |
96 | #define MVME147_IRQ_SCC_BASE 0x60 | 98 | #define MVME147_IRQ_SCC_BASE (IRQ_USER+32) |
97 | #define MVME147_IRQ_SCCB_TX 0x60 | 99 | #define MVME147_IRQ_SCCB_TX (IRQ_USER+32) |
98 | #define MVME147_IRQ_SCCB_STAT 0x62 | 100 | #define MVME147_IRQ_SCCB_STAT (IRQ_USER+34) |
99 | #define MVME147_IRQ_SCCB_RX 0x64 | 101 | #define MVME147_IRQ_SCCB_RX (IRQ_USER+36) |
100 | #define MVME147_IRQ_SCCB_SPCOND 0x66 | 102 | #define MVME147_IRQ_SCCB_SPCOND (IRQ_USER+38) |
101 | #define MVME147_IRQ_SCCA_TX 0x68 | 103 | #define MVME147_IRQ_SCCA_TX (IRQ_USER+40) |
102 | #define MVME147_IRQ_SCCA_STAT 0x6a | 104 | #define MVME147_IRQ_SCCA_STAT (IRQ_USER+42) |
103 | #define MVME147_IRQ_SCCA_RX 0x6c | 105 | #define MVME147_IRQ_SCCA_RX (IRQ_USER+44) |
104 | #define MVME147_IRQ_SCCA_SPCOND 0x6e | 106 | #define MVME147_IRQ_SCCA_SPCOND (IRQ_USER+46) |
105 | 107 | ||
106 | #define MVME147_LANCE_BASE 0xfffe1800 | 108 | #define MVME147_LANCE_BASE 0xfffe1800 |
107 | #define MVME147_LANCE_IRQ 0x44 | 109 | #define MVME147_LANCE_IRQ (IRQ_USER+4) |
108 | 110 | ||
109 | #define ETHERNET_ADDRESS 0xfffe0778 | 111 | #define ETHERNET_ADDRESS 0xfffe0778 |
110 | 112 | ||
diff --git a/include/asm-m68k/mvme16xhw.h b/include/asm-m68k/mvme16xhw.h index 5d07231d2426..6117f56653d2 100644 --- a/include/asm-m68k/mvme16xhw.h +++ b/include/asm-m68k/mvme16xhw.h | |||
@@ -66,28 +66,28 @@ typedef struct { | |||
66 | 66 | ||
67 | #define MVME162_IRQ_TYPE_PRIO 0 | 67 | #define MVME162_IRQ_TYPE_PRIO 0 |
68 | 68 | ||
69 | #define MVME167_IRQ_PRN 0x54 | 69 | #define MVME167_IRQ_PRN (IRQ_USER+20) |
70 | #define MVME16x_IRQ_I596 0x57 | 70 | #define MVME16x_IRQ_I596 (IRQ_USER+23) |
71 | #define MVME16x_IRQ_SCSI 0x55 | 71 | #define MVME16x_IRQ_SCSI (IRQ_USER+21) |
72 | #define MVME16x_IRQ_FLY 0x7f | 72 | #define MVME16x_IRQ_FLY (IRQ_USER+63) |
73 | #define MVME167_IRQ_SER_ERR 0x5c | 73 | #define MVME167_IRQ_SER_ERR (IRQ_USER+28) |
74 | #define MVME167_IRQ_SER_MODEM 0x5d | 74 | #define MVME167_IRQ_SER_MODEM (IRQ_USER+29) |
75 | #define MVME167_IRQ_SER_TX 0x5e | 75 | #define MVME167_IRQ_SER_TX (IRQ_USER+30) |
76 | #define MVME167_IRQ_SER_RX 0x5f | 76 | #define MVME167_IRQ_SER_RX (IRQ_USER+31) |
77 | #define MVME16x_IRQ_TIMER 0x59 | 77 | #define MVME16x_IRQ_TIMER (IRQ_USER+25) |
78 | #define MVME167_IRQ_ABORT 0x6e | 78 | #define MVME167_IRQ_ABORT (IRQ_USER+46) |
79 | #define MVME162_IRQ_ABORT 0x5e | 79 | #define MVME162_IRQ_ABORT (IRQ_USER+30) |
80 | 80 | ||
81 | /* SCC interrupts, for MVME162 */ | 81 | /* SCC interrupts, for MVME162 */ |
82 | #define MVME162_IRQ_SCC_BASE 0x40 | 82 | #define MVME162_IRQ_SCC_BASE (IRQ_USER+0) |
83 | #define MVME162_IRQ_SCCB_TX 0x40 | 83 | #define MVME162_IRQ_SCCB_TX (IRQ_USER+0) |
84 | #define MVME162_IRQ_SCCB_STAT 0x42 | 84 | #define MVME162_IRQ_SCCB_STAT (IRQ_USER+2) |
85 | #define MVME162_IRQ_SCCB_RX 0x44 | 85 | #define MVME162_IRQ_SCCB_RX (IRQ_USER+4) |
86 | #define MVME162_IRQ_SCCB_SPCOND 0x46 | 86 | #define MVME162_IRQ_SCCB_SPCOND (IRQ_USER+6) |
87 | #define MVME162_IRQ_SCCA_TX 0x48 | 87 | #define MVME162_IRQ_SCCA_TX (IRQ_USER+8) |
88 | #define MVME162_IRQ_SCCA_STAT 0x4a | 88 | #define MVME162_IRQ_SCCA_STAT (IRQ_USER+10) |
89 | #define MVME162_IRQ_SCCA_RX 0x4c | 89 | #define MVME162_IRQ_SCCA_RX (IRQ_USER+12) |
90 | #define MVME162_IRQ_SCCA_SPCOND 0x4e | 90 | #define MVME162_IRQ_SCCA_SPCOND (IRQ_USER+14) |
91 | 91 | ||
92 | /* MVME162 version register */ | 92 | /* MVME162 version register */ |
93 | 93 | ||
diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 352799e71f08..8455f778b601 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h | |||
@@ -71,10 +71,10 @@ struct thread_struct { | |||
71 | }; | 71 | }; |
72 | 72 | ||
73 | #define INIT_THREAD { \ | 73 | #define INIT_THREAD { \ |
74 | ksp: sizeof(init_stack) + (unsigned long) init_stack, \ | 74 | .ksp = sizeof(init_stack) + (unsigned long) init_stack, \ |
75 | sr: PS_S, \ | 75 | .sr = PS_S, \ |
76 | fs: __KERNEL_DS, \ | 76 | .fs = __KERNEL_DS, \ |
77 | info: INIT_THREAD_INFO(init_task) \ | 77 | .info = INIT_THREAD_INFO(init_task), \ |
78 | } | 78 | } |
79 | 79 | ||
80 | /* | 80 | /* |
diff --git a/include/asm-m68k/scatterlist.h b/include/asm-m68k/scatterlist.h index d7c9b5c5e6c7..8e612266da51 100644 --- a/include/asm-m68k/scatterlist.h +++ b/include/asm-m68k/scatterlist.h | |||
@@ -2,18 +2,17 @@ | |||
2 | #define _M68K_SCATTERLIST_H | 2 | #define _M68K_SCATTERLIST_H |
3 | 3 | ||
4 | struct scatterlist { | 4 | struct scatterlist { |
5 | /* These two are only valid if ADDRESS member of this | ||
6 | * struct is NULL. | ||
7 | */ | ||
8 | struct page *page; | 5 | struct page *page; |
9 | unsigned int offset; | 6 | unsigned int offset; |
10 | |||
11 | unsigned int length; | 7 | unsigned int length; |
12 | 8 | ||
13 | __u32 dvma_address; /* A place to hang host-specific addresses at. */ | 9 | __u32 dma_address; /* A place to hang host-specific addresses at. */ |
14 | }; | 10 | }; |
15 | 11 | ||
16 | /* This is bogus and should go away. */ | 12 | /* This is bogus and should go away. */ |
17 | #define ISA_DMA_THRESHOLD (0x00ffffff) | 13 | #define ISA_DMA_THRESHOLD (0x00ffffff) |
18 | 14 | ||
15 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
16 | #define sg_dma_len(sg) ((sg)->length) | ||
17 | |||
19 | #endif /* !(_M68K_SCATTERLIST_H) */ | 18 | #endif /* !(_M68K_SCATTERLIST_H) */ |
diff --git a/include/asm-m68k/signal.h b/include/asm-m68k/signal.h index b7b7ea20caab..de1ba6ead3b4 100644 --- a/include/asm-m68k/signal.h +++ b/include/asm-m68k/signal.h | |||
@@ -74,7 +74,6 @@ typedef unsigned long sigset_t; | |||
74 | * SA_FLAGS values: | 74 | * SA_FLAGS values: |
75 | * | 75 | * |
76 | * SA_ONSTACK indicates that a registered stack_t will be used. | 76 | * SA_ONSTACK indicates that a registered stack_t will be used. |
77 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
78 | * SA_RESTART flag to get restarting signals (which were the default long ago) | 77 | * SA_RESTART flag to get restarting signals (which were the default long ago) |
79 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | 78 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. |
80 | * SA_RESETHAND clears the handler when the signal is delivered. | 79 | * SA_RESETHAND clears the handler when the signal is delivered. |
@@ -94,7 +93,6 @@ typedef unsigned long sigset_t; | |||
94 | 93 | ||
95 | #define SA_NOMASK SA_NODEFER | 94 | #define SA_NOMASK SA_NODEFER |
96 | #define SA_ONESHOT SA_RESETHAND | 95 | #define SA_ONESHOT SA_RESETHAND |
97 | #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ | ||
98 | 96 | ||
99 | /* | 97 | /* |
100 | * sigaltstack controls | 98 | * sigaltstack controls |
@@ -156,13 +154,17 @@ typedef struct sigaltstack { | |||
156 | 154 | ||
157 | static inline void sigaddset(sigset_t *set, int _sig) | 155 | static inline void sigaddset(sigset_t *set, int _sig) |
158 | { | 156 | { |
159 | __asm__("bfset %0{%1,#1}" : "=m" (*set) : "id" ((_sig - 1) ^ 31) | 157 | asm ("bfset %0{%1,#1}" |
158 | : "+od" (*set) | ||
159 | : "id" ((_sig - 1) ^ 31) | ||
160 | : "cc"); | 160 | : "cc"); |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline void sigdelset(sigset_t *set, int _sig) | 163 | static inline void sigdelset(sigset_t *set, int _sig) |
164 | { | 164 | { |
165 | __asm__("bfclr %0{%1,#1}" : "=m"(*set) : "id"((_sig - 1) ^ 31) | 165 | asm ("bfclr %0{%1,#1}" |
166 | : "+od" (*set) | ||
167 | : "id" ((_sig - 1) ^ 31) | ||
166 | : "cc"); | 168 | : "cc"); |
167 | } | 169 | } |
168 | 170 | ||
@@ -175,8 +177,10 @@ static inline int __const_sigismember(sigset_t *set, int _sig) | |||
175 | static inline int __gen_sigismember(sigset_t *set, int _sig) | 177 | static inline int __gen_sigismember(sigset_t *set, int _sig) |
176 | { | 178 | { |
177 | int ret; | 179 | int ret; |
178 | __asm__("bfextu %1{%2,#1},%0" | 180 | asm ("bfextu %1{%2,#1},%0" |
179 | : "=d"(ret) : "m"(*set), "id"((_sig-1) ^ 31)); | 181 | : "=d" (ret) |
182 | : "od" (*set), "id" ((_sig-1) ^ 31) | ||
183 | : "cc"); | ||
180 | return ret; | 184 | return ret; |
181 | } | 185 | } |
182 | 186 | ||
@@ -187,7 +191,10 @@ static inline int __gen_sigismember(sigset_t *set, int _sig) | |||
187 | 191 | ||
188 | static inline int sigfindinword(unsigned long word) | 192 | static inline int sigfindinword(unsigned long word) |
189 | { | 193 | { |
190 | __asm__("bfffo %1{#0,#0},%0" : "=d"(word) : "d"(word & -word) : "cc"); | 194 | asm ("bfffo %1{#0,#0},%0" |
195 | : "=d" (word) | ||
196 | : "d" (word & -word) | ||
197 | : "cc"); | ||
191 | return word ^ 31; | 198 | return word ^ 31; |
192 | } | 199 | } |
193 | 200 | ||
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h index f578ca4b776a..a5966ec005ae 100644 --- a/include/asm-m68k/socket.h +++ b/include/asm-m68k/socket.h | |||
@@ -48,5 +48,6 @@ | |||
48 | #define SO_ACCEPTCONN 30 | 48 | #define SO_ACCEPTCONN 30 |
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | ||
51 | 52 | ||
52 | #endif /* _ASM_SOCKET_H */ | 53 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h index bd038fccb64b..de91fa071b99 100644 --- a/include/asm-m68k/sun3ints.h +++ b/include/asm-m68k/sun3ints.h | |||
@@ -12,37 +12,25 @@ | |||
12 | #define SUN3INTS_H | 12 | #define SUN3INTS_H |
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/kernel.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/kernel_stat.h> | ||
18 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
19 | #include <linux/seq_file.h> | ||
20 | #include <asm/segment.h> | ||
21 | #include <asm/intersil.h> | 16 | #include <asm/intersil.h> |
22 | #include <asm/oplib.h> | 17 | #include <asm/oplib.h> |
18 | #include <asm/traps.h> | ||
23 | 19 | ||
24 | #define SUN3_INT_VECS 192 | 20 | #define SUN3_INT_VECS 192 |
25 | 21 | ||
26 | void sun3_enable_irq(unsigned int irq); | 22 | void sun3_enable_irq(unsigned int irq); |
27 | void sun3_disable_irq(unsigned int irq); | 23 | void sun3_disable_irq(unsigned int irq); |
28 | int sun3_request_irq(unsigned int irq, | ||
29 | irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
30 | unsigned long flags, const char *devname, void *dev_id | ||
31 | ); | ||
32 | extern void sun3_init_IRQ (void); | 24 | extern void sun3_init_IRQ (void); |
33 | extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *); | ||
34 | extern void sun3_free_irq (unsigned int irq, void *dev_id); | ||
35 | extern void sun3_enable_interrupts (void); | 25 | extern void sun3_enable_interrupts (void); |
36 | extern void sun3_disable_interrupts (void); | 26 | extern void sun3_disable_interrupts (void); |
37 | extern int show_sun3_interrupts(struct seq_file *, void *); | ||
38 | extern irqreturn_t sun3_process_int(int, struct pt_regs *); | ||
39 | extern volatile unsigned char* sun3_intreg; | 27 | extern volatile unsigned char* sun3_intreg; |
40 | 28 | ||
41 | /* master list of VME vectors -- don't fuck with this */ | 29 | /* master list of VME vectors -- don't fuck with this */ |
42 | #define SUN3_VEC_FLOPPY 0x40 | 30 | #define SUN3_VEC_FLOPPY (IRQ_USER+0) |
43 | #define SUN3_VEC_VMESCSI0 0x40 | 31 | #define SUN3_VEC_VMESCSI0 (IRQ_USER+0) |
44 | #define SUN3_VEC_VMESCSI1 0x41 | 32 | #define SUN3_VEC_VMESCSI1 (IRQ_USER+1) |
45 | #define SUN3_VEC_CG 0xA8 | 33 | #define SUN3_VEC_CG (IRQ_USER+104) |
46 | 34 | ||
47 | 35 | ||
48 | #endif /* SUN3INTS_H */ | 36 | #endif /* SUN3INTS_H */ |
diff --git a/include/asm-m68k/sun3xflop.h b/include/asm-m68k/sun3xflop.h index 98a9f79dab29..ca8cc4113843 100644 --- a/include/asm-m68k/sun3xflop.h +++ b/include/asm-m68k/sun3xflop.h | |||
@@ -208,7 +208,8 @@ static int sun3xflop_request_irq(void) | |||
208 | 208 | ||
209 | if(!once) { | 209 | if(!once) { |
210 | once = 1; | 210 | once = 1; |
211 | error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, SA_INTERRUPT, "floppy", NULL); | 211 | error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, |
212 | IRQF_DISABLED, "floppy", NULL); | ||
212 | return ((error == 0) ? 0 : -1); | 213 | return ((error == 0) ? 0 : -1); |
213 | } else return 0; | 214 | } else return 0; |
214 | } | 215 | } |
diff --git a/include/asm-m68k/traps.h b/include/asm-m68k/traps.h index 475056191252..8caef25624c7 100644 --- a/include/asm-m68k/traps.h +++ b/include/asm-m68k/traps.h | |||
@@ -13,8 +13,15 @@ | |||
13 | 13 | ||
14 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
15 | 15 | ||
16 | #include <linux/linkage.h> | ||
17 | #include <asm/ptrace.h> | ||
18 | |||
16 | typedef void (*e_vector)(void); | 19 | typedef void (*e_vector)(void); |
17 | 20 | ||
21 | asmlinkage void auto_inthandler(void); | ||
22 | asmlinkage void user_inthandler(void); | ||
23 | asmlinkage void bad_inthandler(void); | ||
24 | |||
18 | extern e_vector vectors[]; | 25 | extern e_vector vectors[]; |
19 | 26 | ||
20 | #endif | 27 | #endif |
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h index 2ffd87b0a769..88b1f47400e1 100644 --- a/include/asm-m68k/uaccess.h +++ b/include/asm-m68k/uaccess.h | |||
@@ -4,8 +4,9 @@ | |||
4 | /* | 4 | /* |
5 | * User space memory access functions | 5 | * User space memory access functions |
6 | */ | 6 | */ |
7 | #include <linux/compiler.h> | ||
7 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
8 | #include <linux/sched.h> | 9 | #include <linux/types.h> |
9 | #include <asm/segment.h> | 10 | #include <asm/segment.h> |
10 | 11 | ||
11 | #define VERIFY_READ 0 | 12 | #define VERIFY_READ 0 |
@@ -32,858 +33,335 @@ struct exception_table_entry | |||
32 | unsigned long insn, fixup; | 33 | unsigned long insn, fixup; |
33 | }; | 34 | }; |
34 | 35 | ||
36 | extern int __put_user_bad(void); | ||
37 | extern int __get_user_bad(void); | ||
38 | |||
39 | #define __put_user_asm(res, x, ptr, bwl, reg, err) \ | ||
40 | asm volatile ("\n" \ | ||
41 | "1: moves."#bwl" %2,%1\n" \ | ||
42 | "2:\n" \ | ||
43 | " .section .fixup,\"ax\"\n" \ | ||
44 | " .even\n" \ | ||
45 | "10: moveq.l %3,%0\n" \ | ||
46 | " jra 2b\n" \ | ||
47 | " .previous\n" \ | ||
48 | "\n" \ | ||
49 | " .section __ex_table,\"a\"\n" \ | ||
50 | " .align 4\n" \ | ||
51 | " .long 1b,10b\n" \ | ||
52 | " .long 2b,10b\n" \ | ||
53 | " .previous" \ | ||
54 | : "+d" (res), "=m" (*(ptr)) \ | ||
55 | : #reg (x), "i" (err)) | ||
35 | 56 | ||
36 | /* | 57 | /* |
37 | * These are the main single-value transfer routines. They automatically | 58 | * These are the main single-value transfer routines. They automatically |
38 | * use the right size if we just have the right pointer type. | 59 | * use the right size if we just have the right pointer type. |
39 | */ | 60 | */ |
40 | 61 | ||
41 | #define put_user(x, ptr) \ | 62 | #define __put_user(x, ptr) \ |
42 | ({ \ | 63 | ({ \ |
43 | int __pu_err; \ | 64 | typeof(*(ptr)) __pu_val = (x); \ |
44 | typeof(*(ptr)) __pu_val = (x); \ | 65 | int __pu_err = 0; \ |
45 | __chk_user_ptr(ptr); \ | 66 | __chk_user_ptr(ptr); \ |
46 | switch (sizeof (*(ptr))) { \ | 67 | switch (sizeof (*(ptr))) { \ |
47 | case 1: \ | 68 | case 1: \ |
48 | __put_user_asm(__pu_err, __pu_val, ptr, b); \ | 69 | __put_user_asm(__pu_err, __pu_val, ptr, b, d, -EFAULT); \ |
49 | break; \ | 70 | break; \ |
50 | case 2: \ | 71 | case 2: \ |
51 | __put_user_asm(__pu_err, __pu_val, ptr, w); \ | 72 | __put_user_asm(__pu_err, __pu_val, ptr, w, d, -EFAULT); \ |
52 | break; \ | 73 | break; \ |
53 | case 4: \ | 74 | case 4: \ |
54 | __put_user_asm(__pu_err, __pu_val, ptr, l); \ | 75 | __put_user_asm(__pu_err, __pu_val, ptr, l, r, -EFAULT); \ |
55 | break; \ | 76 | break; \ |
56 | case 8: \ | 77 | case 8: \ |
57 | __pu_err = __constant_copy_to_user(ptr, &__pu_val, 8); \ | 78 | { \ |
58 | break; \ | 79 | const void *__pu_ptr = (ptr); \ |
59 | default: \ | 80 | asm volatile ("\n" \ |
60 | __pu_err = __put_user_bad(); \ | 81 | "1: moves.l %2,(%1)+\n" \ |
61 | break; \ | 82 | "2: moves.l %R2,(%1)\n" \ |
62 | } \ | 83 | "3:\n" \ |
63 | __pu_err; \ | 84 | " .section .fixup,\"ax\"\n" \ |
85 | " .even\n" \ | ||
86 | "10: movel %3,%0\n" \ | ||
87 | " jra 3b\n" \ | ||
88 | " .previous\n" \ | ||
89 | "\n" \ | ||
90 | " .section __ex_table,\"a\"\n" \ | ||
91 | " .align 4\n" \ | ||
92 | " .long 1b,10b\n" \ | ||
93 | " .long 2b,10b\n" \ | ||
94 | " .long 3b,10b\n" \ | ||
95 | " .previous" \ | ||
96 | : "+d" (__pu_err), "+a" (__pu_ptr) \ | ||
97 | : "r" (__pu_val), "i" (-EFAULT) \ | ||
98 | : "memory"); \ | ||
99 | break; \ | ||
100 | } \ | ||
101 | default: \ | ||
102 | __pu_err = __put_user_bad(); \ | ||
103 | break; \ | ||
104 | } \ | ||
105 | __pu_err; \ | ||
64 | }) | 106 | }) |
65 | #define __put_user(x, ptr) put_user(x, ptr) | 107 | #define put_user(x, ptr) __put_user(x, ptr) |
66 | |||
67 | extern int __put_user_bad(void); | ||
68 | 108 | ||
69 | /* | ||
70 | * Tell gcc we read from memory instead of writing: this is because | ||
71 | * we do not write to any memory gcc knows about, so there are no | ||
72 | * aliasing issues. | ||
73 | */ | ||
74 | #define __put_user_asm(err,x,ptr,bwl) \ | ||
75 | __asm__ __volatile__ \ | ||
76 | ("21:moves" #bwl " %2,%1\n" \ | ||
77 | "1:\n" \ | ||
78 | ".section .fixup,\"ax\"\n" \ | ||
79 | " .even\n" \ | ||
80 | "2: movel %3,%0\n" \ | ||
81 | " jra 1b\n" \ | ||
82 | ".previous\n" \ | ||
83 | ".section __ex_table,\"a\"\n" \ | ||
84 | " .align 4\n" \ | ||
85 | " .long 21b,2b\n" \ | ||
86 | " .long 1b,2b\n" \ | ||
87 | ".previous" \ | ||
88 | : "=d"(err) \ | ||
89 | : "m"(*(ptr)), "r"(x), "i"(-EFAULT), "0"(0)) | ||
90 | 109 | ||
91 | #define get_user(x, ptr) \ | 110 | #define __get_user_asm(res, x, ptr, type, bwl, reg, err) ({ \ |
92 | ({ \ | 111 | type __gu_val; \ |
93 | int __gu_err; \ | 112 | asm volatile ("\n" \ |
94 | typeof(*(ptr)) __gu_val; \ | 113 | "1: moves."#bwl" %2,%1\n" \ |
95 | __chk_user_ptr(ptr); \ | 114 | "2:\n" \ |
96 | switch (sizeof(*(ptr))) { \ | 115 | " .section .fixup,\"ax\"\n" \ |
97 | case 1: \ | 116 | " .even\n" \ |
98 | __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \ | 117 | "10: move.l %3,%0\n" \ |
99 | break; \ | 118 | " sub."#bwl" %1,%1\n" \ |
100 | case 2: \ | 119 | " jra 2b\n" \ |
101 | __get_user_asm(__gu_err, __gu_val, ptr, w, "=r"); \ | 120 | " .previous\n" \ |
102 | break; \ | 121 | "\n" \ |
103 | case 4: \ | 122 | " .section __ex_table,\"a\"\n" \ |
104 | __get_user_asm(__gu_err, __gu_val, ptr, l, "=r"); \ | 123 | " .align 4\n" \ |
105 | break; \ | 124 | " .long 1b,10b\n" \ |
106 | case 8: \ | 125 | " .previous" \ |
107 | __gu_err = __constant_copy_from_user(&__gu_val, ptr, 8); \ | 126 | : "+d" (res), "=&" #reg (__gu_val) \ |
108 | break; \ | 127 | : "m" (*(ptr)), "i" (err)); \ |
109 | default: \ | 128 | (x) = (typeof(*(ptr)))(long)__gu_val; \ |
110 | __gu_val = (typeof(*(ptr)))0; \ | ||
111 | __gu_err = __get_user_bad(); \ | ||
112 | break; \ | ||
113 | } \ | ||
114 | (x) = __gu_val; \ | ||
115 | __gu_err; \ | ||
116 | }) | 129 | }) |
117 | #define __get_user(x, ptr) get_user(x, ptr) | ||
118 | |||
119 | extern int __get_user_bad(void); | ||
120 | |||
121 | #define __get_user_asm(err,x,ptr,bwl,reg) \ | ||
122 | __asm__ __volatile__ \ | ||
123 | ("1: moves" #bwl " %2,%1\n" \ | ||
124 | "2:\n" \ | ||
125 | ".section .fixup,\"ax\"\n" \ | ||
126 | " .even\n" \ | ||
127 | "3: movel %3,%0\n" \ | ||
128 | " sub" #bwl " %1,%1\n" \ | ||
129 | " jra 2b\n" \ | ||
130 | ".previous\n" \ | ||
131 | ".section __ex_table,\"a\"\n" \ | ||
132 | " .align 4\n" \ | ||
133 | " .long 1b,3b\n" \ | ||
134 | ".previous" \ | ||
135 | : "=d"(err), reg(x) \ | ||
136 | : "m"(*(ptr)), "i" (-EFAULT), "0"(0)) | ||
137 | 130 | ||
138 | static inline unsigned long | 131 | #define __get_user(x, ptr) \ |
139 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) | 132 | ({ \ |
140 | { | 133 | int __gu_err = 0; \ |
141 | unsigned long tmp; | 134 | __chk_user_ptr(ptr); \ |
142 | __asm__ __volatile__ | 135 | switch (sizeof(*(ptr))) { \ |
143 | (" tstl %2\n" | 136 | case 1: \ |
144 | " jeq 2f\n" | 137 | __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \ |
145 | "1: movesl (%1)+,%3\n" | 138 | break; \ |
146 | " movel %3,(%0)+\n" | 139 | case 2: \ |
147 | " subql #1,%2\n" | 140 | __get_user_asm(__gu_err, x, ptr, u16, w, d, -EFAULT); \ |
148 | " jne 1b\n" | 141 | break; \ |
149 | "2: movel %4,%2\n" | 142 | case 4: \ |
150 | " bclr #1,%2\n" | 143 | __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \ |
151 | " jeq 4f\n" | 144 | break; \ |
152 | "3: movesw (%1)+,%3\n" | 145 | /* case 8: disabled because gcc-4.1 has a broken typeof \ |
153 | " movew %3,(%0)+\n" | 146 | { \ |
154 | "4: bclr #0,%2\n" | 147 | const void *__gu_ptr = (ptr); \ |
155 | " jeq 6f\n" | 148 | u64 __gu_val; \ |
156 | "5: movesb (%1)+,%3\n" | 149 | asm volatile ("\n" \ |
157 | " moveb %3,(%0)+\n" | 150 | "1: moves.l (%2)+,%1\n" \ |
158 | "6:\n" | 151 | "2: moves.l (%2),%R1\n" \ |
159 | ".section .fixup,\"ax\"\n" | 152 | "3:\n" \ |
160 | " .even\n" | 153 | " .section .fixup,\"ax\"\n" \ |
161 | "7: movel %2,%%d0\n" | 154 | " .even\n" \ |
162 | "71:clrl (%0)+\n" | 155 | "10: move.l %3,%0\n" \ |
163 | " subql #1,%%d0\n" | 156 | " sub.l %1,%1\n" \ |
164 | " jne 71b\n" | 157 | " sub.l %R1,%R1\n" \ |
165 | " lsll #2,%2\n" | 158 | " jra 3b\n" \ |
166 | " addl %4,%2\n" | 159 | " .previous\n" \ |
167 | " btst #1,%4\n" | 160 | "\n" \ |
168 | " jne 81f\n" | 161 | " .section __ex_table,\"a\"\n" \ |
169 | " btst #0,%4\n" | 162 | " .align 4\n" \ |
170 | " jne 91f\n" | 163 | " .long 1b,10b\n" \ |
171 | " jra 6b\n" | 164 | " .long 2b,10b\n" \ |
172 | "8: addql #2,%2\n" | 165 | " .previous" \ |
173 | "81:clrw (%0)+\n" | 166 | : "+d" (__gu_err), "=&r" (__gu_val), \ |
174 | " btst #0,%4\n" | 167 | "+a" (__gu_ptr) \ |
175 | " jne 91f\n" | 168 | : "i" (-EFAULT) \ |
176 | " jra 6b\n" | 169 | : "memory"); \ |
177 | "9: addql #1,%2\n" | 170 | (x) = (typeof(*(ptr)))__gu_val; \ |
178 | "91:clrb (%0)+\n" | 171 | break; \ |
179 | " jra 6b\n" | 172 | } */ \ |
180 | ".previous\n" | 173 | default: \ |
181 | ".section __ex_table,\"a\"\n" | 174 | __gu_err = __get_user_bad(); \ |
182 | " .align 4\n" | 175 | break; \ |
183 | " .long 1b,7b\n" | 176 | } \ |
184 | " .long 3b,8b\n" | 177 | __gu_err; \ |
185 | " .long 5b,9b\n" | 178 | }) |
186 | ".previous" | 179 | #define get_user(x, ptr) __get_user(x, ptr) |
187 | : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) | ||
188 | : "d"(n & 3), "0"(to), "1"(from), "2"(n/4) | ||
189 | : "d0", "memory"); | ||
190 | return n; | ||
191 | } | ||
192 | 180 | ||
193 | static inline unsigned long | 181 | unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n); |
194 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) | 182 | unsigned long __generic_copy_to_user(void __user *to, const void *from, unsigned long n); |
195 | { | ||
196 | unsigned long tmp; | ||
197 | __asm__ __volatile__ | ||
198 | (" tstl %2\n" | ||
199 | " jeq 3f\n" | ||
200 | "1: movel (%1)+,%3\n" | ||
201 | "22:movesl %3,(%0)+\n" | ||
202 | "2: subql #1,%2\n" | ||
203 | " jne 1b\n" | ||
204 | "3: movel %4,%2\n" | ||
205 | " bclr #1,%2\n" | ||
206 | " jeq 4f\n" | ||
207 | " movew (%1)+,%3\n" | ||
208 | "24:movesw %3,(%0)+\n" | ||
209 | "4: bclr #0,%2\n" | ||
210 | " jeq 5f\n" | ||
211 | " moveb (%1)+,%3\n" | ||
212 | "25:movesb %3,(%0)+\n" | ||
213 | "5:\n" | ||
214 | ".section .fixup,\"ax\"\n" | ||
215 | " .even\n" | ||
216 | "60:addql #1,%2\n" | ||
217 | "6: lsll #2,%2\n" | ||
218 | " addl %4,%2\n" | ||
219 | " jra 5b\n" | ||
220 | "7: addql #2,%2\n" | ||
221 | " jra 5b\n" | ||
222 | "8: addql #1,%2\n" | ||
223 | " jra 5b\n" | ||
224 | ".previous\n" | ||
225 | ".section __ex_table,\"a\"\n" | ||
226 | " .align 4\n" | ||
227 | " .long 1b,60b\n" | ||
228 | " .long 22b,6b\n" | ||
229 | " .long 2b,6b\n" | ||
230 | " .long 24b,7b\n" | ||
231 | " .long 3b,60b\n" | ||
232 | " .long 4b,7b\n" | ||
233 | " .long 25b,8b\n" | ||
234 | " .long 5b,8b\n" | ||
235 | ".previous" | ||
236 | : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) | ||
237 | : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4) | ||
238 | : "memory"); | ||
239 | return n; | ||
240 | } | ||
241 | 183 | ||
242 | #define __copy_from_user_big(to, from, n, fixup, copy) \ | 184 | #define __constant_copy_from_user_asm(res, to, from, tmp, n, s1, s2, s3)\ |
243 | __asm__ __volatile__ \ | 185 | asm volatile ("\n" \ |
244 | ("10: movesl (%1)+,%%d0\n" \ | 186 | "1: moves."#s1" (%2)+,%3\n" \ |
245 | " movel %%d0,(%0)+\n" \ | 187 | " move."#s1" %3,(%1)+\n" \ |
246 | " subql #1,%2\n" \ | 188 | "2: moves."#s2" (%2)+,%3\n" \ |
247 | " jne 10b\n" \ | 189 | " move."#s2" %3,(%1)+\n" \ |
248 | ".section .fixup,\"ax\"\n" \ | 190 | " .ifnc \""#s3"\",\"\"\n" \ |
249 | " .even\n" \ | 191 | "3: moves."#s3" (%2)+,%3\n" \ |
250 | "11: movel %2,%%d0\n" \ | 192 | " move."#s3" %3,(%1)+\n" \ |
251 | "13: clrl (%0)+\n" \ | 193 | " .endif\n" \ |
252 | " subql #1,%%d0\n" \ | 194 | "4:\n" \ |
253 | " jne 13b\n" \ | 195 | " .section __ex_table,\"a\"\n" \ |
254 | " lsll #2,%2\n" \ | 196 | " .align 4\n" \ |
255 | fixup "\n" \ | 197 | " .long 1b,10f\n" \ |
256 | " jra 12f\n" \ | 198 | " .long 2b,20f\n" \ |
257 | ".previous\n" \ | 199 | " .ifnc \""#s3"\",\"\"\n" \ |
258 | ".section __ex_table,\"a\"\n" \ | 200 | " .long 3b,30f\n" \ |
259 | " .align 4\n" \ | 201 | " .endif\n" \ |
260 | " .long 10b,11b\n" \ | 202 | " .previous\n" \ |
261 | ".previous\n" \ | 203 | "\n" \ |
262 | copy "\n" \ | 204 | " .section .fixup,\"ax\"\n" \ |
263 | "12:" \ | 205 | " .even\n" \ |
264 | : "=a"(to), "=a"(from), "=d"(n) \ | 206 | "10: clr."#s1" (%1)+\n" \ |
265 | : "0"(to), "1"(from), "2"(n/4) \ | 207 | "20: clr."#s2" (%1)+\n" \ |
266 | : "d0", "memory") | 208 | " .ifnc \""#s3"\",\"\"\n" \ |
209 | "30: clr."#s3" (%1)+\n" \ | ||
210 | " .endif\n" \ | ||
211 | " moveq.l #"#n",%0\n" \ | ||
212 | " jra 4b\n" \ | ||
213 | " .previous\n" \ | ||
214 | : "+d" (res), "+&a" (to), "+a" (from), "=&d" (tmp) \ | ||
215 | : : "memory") | ||
267 | 216 | ||
268 | static inline unsigned long | 217 | static __always_inline unsigned long |
269 | __constant_copy_from_user(void *to, const void __user *from, unsigned long n) | 218 | __constant_copy_from_user(void *to, const void __user *from, unsigned long n) |
270 | { | 219 | { |
271 | switch (n) { | 220 | unsigned long res = 0, tmp; |
272 | case 0: | 221 | |
273 | break; | 222 | switch (n) { |
274 | case 1: | ||
275 | __asm__ __volatile__ | ||
276 | ("1: movesb (%1)+,%%d0\n" | ||
277 | " moveb %%d0,(%0)+\n" | ||
278 | "2:\n" | ||
279 | ".section .fixup,\"ax\"\n" | ||
280 | " .even\n" | ||
281 | "3: addql #1,%2\n" | ||
282 | " clrb (%0)+\n" | ||
283 | " jra 2b\n" | ||
284 | ".previous\n" | ||
285 | ".section __ex_table,\"a\"\n" | ||
286 | " .align 4\n" | ||
287 | " .long 1b,3b\n" | ||
288 | ".previous" | ||
289 | : "=a"(to), "=a"(from), "=d"(n) | ||
290 | : "0"(to), "1"(from), "2"(0) | ||
291 | : "d0", "memory"); | ||
292 | break; | ||
293 | case 2: | ||
294 | __asm__ __volatile__ | ||
295 | ("1: movesw (%1)+,%%d0\n" | ||
296 | " movew %%d0,(%0)+\n" | ||
297 | "2:\n" | ||
298 | ".section .fixup,\"ax\"\n" | ||
299 | " .even\n" | ||
300 | "3: addql #2,%2\n" | ||
301 | " clrw (%0)+\n" | ||
302 | " jra 2b\n" | ||
303 | ".previous\n" | ||
304 | ".section __ex_table,\"a\"\n" | ||
305 | " .align 4\n" | ||
306 | " .long 1b,3b\n" | ||
307 | ".previous" | ||
308 | : "=a"(to), "=a"(from), "=d"(n) | ||
309 | : "0"(to), "1"(from), "2"(0) | ||
310 | : "d0", "memory"); | ||
311 | break; | ||
312 | case 3: | ||
313 | __asm__ __volatile__ | ||
314 | ("1: movesw (%1)+,%%d0\n" | ||
315 | " movew %%d0,(%0)+\n" | ||
316 | "2: movesb (%1)+,%%d0\n" | ||
317 | " moveb %%d0,(%0)+\n" | ||
318 | "3:" | ||
319 | ".section .fixup,\"ax\"\n" | ||
320 | " .even\n" | ||
321 | "4: addql #2,%2\n" | ||
322 | " clrw (%0)+\n" | ||
323 | "5: addql #1,%2\n" | ||
324 | " clrb (%0)+\n" | ||
325 | " jra 3b\n" | ||
326 | ".previous\n" | ||
327 | ".section __ex_table,\"a\"\n" | ||
328 | " .align 4\n" | ||
329 | " .long 1b,4b\n" | ||
330 | " .long 2b,5b\n" | ||
331 | ".previous" | ||
332 | : "=a"(to), "=a"(from), "=d"(n) | ||
333 | : "0"(to), "1"(from), "2"(0) | ||
334 | : "d0", "memory"); | ||
335 | break; | ||
336 | case 4: | ||
337 | __asm__ __volatile__ | ||
338 | ("1: movesl (%1)+,%%d0\n" | ||
339 | " movel %%d0,(%0)+\n" | ||
340 | "2:" | ||
341 | ".section .fixup,\"ax\"\n" | ||
342 | " .even\n" | ||
343 | "3: addql #4,%2\n" | ||
344 | " clrl (%0)+\n" | ||
345 | " jra 2b\n" | ||
346 | ".previous\n" | ||
347 | ".section __ex_table,\"a\"\n" | ||
348 | " .align 4\n" | ||
349 | " .long 1b,3b\n" | ||
350 | ".previous" | ||
351 | : "=a"(to), "=a"(from), "=d"(n) | ||
352 | : "0"(to), "1"(from), "2"(0) | ||
353 | : "d0", "memory"); | ||
354 | break; | ||
355 | case 8: | ||
356 | __asm__ __volatile__ | ||
357 | ("1: movesl (%1)+,%%d0\n" | ||
358 | " movel %%d0,(%0)+\n" | ||
359 | "2: movesl (%1)+,%%d0\n" | ||
360 | " movel %%d0,(%0)+\n" | ||
361 | "3:" | ||
362 | ".section .fixup,\"ax\"\n" | ||
363 | " .even\n" | ||
364 | "4: addql #4,%2\n" | ||
365 | " clrl (%0)+\n" | ||
366 | "5: addql #4,%2\n" | ||
367 | " clrl (%0)+\n" | ||
368 | " jra 3b\n" | ||
369 | ".previous\n" | ||
370 | ".section __ex_table,\"a\"\n" | ||
371 | " .align 4\n" | ||
372 | " .long 1b,4b\n" | ||
373 | " .long 2b,5b\n" | ||
374 | ".previous" | ||
375 | : "=a"(to), "=a"(from), "=d"(n) | ||
376 | : "0"(to), "1"(from), "2"(0) | ||
377 | : "d0", "memory"); | ||
378 | break; | ||
379 | case 12: | ||
380 | __asm__ __volatile__ | ||
381 | ("1: movesl (%1)+,%%d0\n" | ||
382 | " movel %%d0,(%0)+\n" | ||
383 | "2: movesl (%1)+,%%d0\n" | ||
384 | " movel %%d0,(%0)+\n" | ||
385 | "3: movesl (%1)+,%%d0\n" | ||
386 | " movel %%d0,(%0)+\n" | ||
387 | "4:" | ||
388 | ".section .fixup,\"ax\"\n" | ||
389 | " .even\n" | ||
390 | "5: addql #4,%2\n" | ||
391 | " clrl (%0)+\n" | ||
392 | "6: addql #4,%2\n" | ||
393 | " clrl (%0)+\n" | ||
394 | "7: addql #4,%2\n" | ||
395 | " clrl (%0)+\n" | ||
396 | " jra 4b\n" | ||
397 | ".previous\n" | ||
398 | ".section __ex_table,\"a\"\n" | ||
399 | " .align 4\n" | ||
400 | " .long 1b,5b\n" | ||
401 | " .long 2b,6b\n" | ||
402 | " .long 3b,7b\n" | ||
403 | ".previous" | ||
404 | : "=a"(to), "=a"(from), "=d"(n) | ||
405 | : "0"(to), "1"(from), "2"(0) | ||
406 | : "d0", "memory"); | ||
407 | break; | ||
408 | case 16: | ||
409 | __asm__ __volatile__ | ||
410 | ("1: movesl (%1)+,%%d0\n" | ||
411 | " movel %%d0,(%0)+\n" | ||
412 | "2: movesl (%1)+,%%d0\n" | ||
413 | " movel %%d0,(%0)+\n" | ||
414 | "3: movesl (%1)+,%%d0\n" | ||
415 | " movel %%d0,(%0)+\n" | ||
416 | "4: movesl (%1)+,%%d0\n" | ||
417 | " movel %%d0,(%0)+\n" | ||
418 | "5:" | ||
419 | ".section .fixup,\"ax\"\n" | ||
420 | " .even\n" | ||
421 | "6: addql #4,%2\n" | ||
422 | " clrl (%0)+\n" | ||
423 | "7: addql #4,%2\n" | ||
424 | " clrl (%0)+\n" | ||
425 | "8: addql #4,%2\n" | ||
426 | " clrl (%0)+\n" | ||
427 | "9: addql #4,%2\n" | ||
428 | " clrl (%0)+\n" | ||
429 | " jra 5b\n" | ||
430 | ".previous\n" | ||
431 | ".section __ex_table,\"a\"\n" | ||
432 | " .align 4\n" | ||
433 | " .long 1b,6b\n" | ||
434 | " .long 2b,7b\n" | ||
435 | " .long 3b,8b\n" | ||
436 | " .long 4b,9b\n" | ||
437 | ".previous" | ||
438 | : "=a"(to), "=a"(from), "=d"(n) | ||
439 | : "0"(to), "1"(from), "2"(0) | ||
440 | : "d0", "memory"); | ||
441 | break; | ||
442 | default: | ||
443 | switch (n & 3) { | ||
444 | case 0: | ||
445 | __copy_from_user_big(to, from, n, "", ""); | ||
446 | break; | ||
447 | case 1: | 223 | case 1: |
448 | __copy_from_user_big(to, from, n, | 224 | __get_user_asm(res, *(u8 *)to, (u8 *)from, u8, b, d, 1); |
449 | /* fixup */ | 225 | break; |
450 | "1: addql #1,%2\n" | ||
451 | " clrb (%0)+", | ||
452 | /* copy */ | ||
453 | "2: movesb (%1)+,%%d0\n" | ||
454 | " moveb %%d0,(%0)+\n" | ||
455 | ".section __ex_table,\"a\"\n" | ||
456 | " .long 2b,1b\n" | ||
457 | ".previous"); | ||
458 | break; | ||
459 | case 2: | 226 | case 2: |
460 | __copy_from_user_big(to, from, n, | 227 | __get_user_asm(res, *(u16 *)to, (u16 *)from, u16, w, d, 2); |
461 | /* fixup */ | 228 | break; |
462 | "1: addql #2,%2\n" | ||
463 | " clrw (%0)+", | ||
464 | /* copy */ | ||
465 | "2: movesw (%1)+,%%d0\n" | ||
466 | " movew %%d0,(%0)+\n" | ||
467 | ".section __ex_table,\"a\"\n" | ||
468 | " .long 2b,1b\n" | ||
469 | ".previous"); | ||
470 | break; | ||
471 | case 3: | 229 | case 3: |
472 | __copy_from_user_big(to, from, n, | 230 | __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,); |
473 | /* fixup */ | 231 | break; |
474 | "1: addql #2,%2\n" | 232 | case 4: |
475 | " clrw (%0)+\n" | 233 | __get_user_asm(res, *(u32 *)to, (u32 *)from, u32, l, r, 4); |
476 | "2: addql #1,%2\n" | 234 | break; |
477 | " clrb (%0)+", | 235 | case 5: |
478 | /* copy */ | 236 | __constant_copy_from_user_asm(res, to, from, tmp, 5, l, b,); |
479 | "3: movesw (%1)+,%%d0\n" | 237 | break; |
480 | " movew %%d0,(%0)+\n" | 238 | case 6: |
481 | "4: movesb (%1)+,%%d0\n" | 239 | __constant_copy_from_user_asm(res, to, from, tmp, 6, l, w,); |
482 | " moveb %%d0,(%0)+\n" | 240 | break; |
483 | ".section __ex_table,\"a\"\n" | 241 | case 7: |
484 | " .long 3b,1b\n" | 242 | __constant_copy_from_user_asm(res, to, from, tmp, 7, l, w, b); |
485 | " .long 4b,2b\n" | 243 | break; |
486 | ".previous"); | 244 | case 8: |
487 | break; | 245 | __constant_copy_from_user_asm(res, to, from, tmp, 8, l, l,); |
246 | break; | ||
247 | case 9: | ||
248 | __constant_copy_from_user_asm(res, to, from, tmp, 9, l, l, b); | ||
249 | break; | ||
250 | case 10: | ||
251 | __constant_copy_from_user_asm(res, to, from, tmp, 10, l, l, w); | ||
252 | break; | ||
253 | case 12: | ||
254 | __constant_copy_from_user_asm(res, to, from, tmp, 12, l, l, l); | ||
255 | break; | ||
256 | default: | ||
257 | /* we limit the inlined version to 3 moves */ | ||
258 | return __generic_copy_from_user(to, from, n); | ||
488 | } | 259 | } |
489 | break; | ||
490 | } | ||
491 | return n; | ||
492 | } | ||
493 | 260 | ||
494 | #define __copy_to_user_big(to, from, n, fixup, copy) \ | 261 | return res; |
495 | __asm__ __volatile__ \ | 262 | } |
496 | ("10: movel (%1)+,%%d0\n" \ | ||
497 | "31: movesl %%d0,(%0)+\n" \ | ||
498 | "11: subql #1,%2\n" \ | ||
499 | " jne 10b\n" \ | ||
500 | "41:\n" \ | ||
501 | ".section .fixup,\"ax\"\n" \ | ||
502 | " .even\n" \ | ||
503 | "22: addql #1,%2\n" \ | ||
504 | "12: lsll #2,%2\n" \ | ||
505 | fixup "\n" \ | ||
506 | " jra 13f\n" \ | ||
507 | ".previous\n" \ | ||
508 | ".section __ex_table,\"a\"\n" \ | ||
509 | " .align 4\n" \ | ||
510 | " .long 10b,22b\n" \ | ||
511 | " .long 31b,12b\n" \ | ||
512 | " .long 11b,12b\n" \ | ||
513 | " .long 41b,22b\n" \ | ||
514 | ".previous\n" \ | ||
515 | copy "\n" \ | ||
516 | "13:" \ | ||
517 | : "=a"(to), "=a"(from), "=d"(n) \ | ||
518 | : "0"(to), "1"(from), "2"(n/4) \ | ||
519 | : "d0", "memory") | ||
520 | 263 | ||
521 | #define __copy_to_user_inatomic __copy_to_user | 264 | #define __constant_copy_to_user_asm(res, to, from, tmp, n, s1, s2, s3) \ |
522 | #define __copy_from_user_inatomic __copy_from_user | 265 | asm volatile ("\n" \ |
266 | " move."#s1" (%2)+,%3\n" \ | ||
267 | "11: moves."#s1" %3,(%1)+\n" \ | ||
268 | "12: move."#s2" (%2)+,%3\n" \ | ||
269 | "21: moves."#s2" %3,(%1)+\n" \ | ||
270 | "22:\n" \ | ||
271 | " .ifnc \""#s3"\",\"\"\n" \ | ||
272 | " move."#s3" (%2)+,%3\n" \ | ||
273 | "31: moves."#s3" %3,(%1)+\n" \ | ||
274 | "32:\n" \ | ||
275 | " .endif\n" \ | ||
276 | "4:\n" \ | ||
277 | "\n" \ | ||
278 | " .section __ex_table,\"a\"\n" \ | ||
279 | " .align 4\n" \ | ||
280 | " .long 11b,5f\n" \ | ||
281 | " .long 12b,5f\n" \ | ||
282 | " .long 21b,5f\n" \ | ||
283 | " .long 22b,5f\n" \ | ||
284 | " .ifnc \""#s3"\",\"\"\n" \ | ||
285 | " .long 31b,5f\n" \ | ||
286 | " .long 32b,5f\n" \ | ||
287 | " .endif\n" \ | ||
288 | " .previous\n" \ | ||
289 | "\n" \ | ||
290 | " .section .fixup,\"ax\"\n" \ | ||
291 | " .even\n" \ | ||
292 | "5: moveq.l #"#n",%0\n" \ | ||
293 | " jra 4b\n" \ | ||
294 | " .previous\n" \ | ||
295 | : "+d" (res), "+a" (to), "+a" (from), "=&d" (tmp) \ | ||
296 | : : "memory") | ||
523 | 297 | ||
524 | static inline unsigned long | 298 | static __always_inline unsigned long |
525 | __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | 299 | __constant_copy_to_user(void __user *to, const void *from, unsigned long n) |
526 | { | 300 | { |
527 | switch (n) { | 301 | unsigned long res = 0, tmp; |
528 | case 0: | 302 | |
529 | break; | 303 | switch (n) { |
530 | case 1: | ||
531 | __asm__ __volatile__ | ||
532 | (" moveb (%1)+,%%d0\n" | ||
533 | "21:movesb %%d0,(%0)+\n" | ||
534 | "1:\n" | ||
535 | ".section .fixup,\"ax\"\n" | ||
536 | " .even\n" | ||
537 | "2: addql #1,%2\n" | ||
538 | " jra 1b\n" | ||
539 | ".previous\n" | ||
540 | ".section __ex_table,\"a\"\n" | ||
541 | " .align 4\n " | ||
542 | " .long 21b,2b\n" | ||
543 | " .long 1b,2b\n" | ||
544 | ".previous" | ||
545 | : "=a"(to), "=a"(from), "=d"(n) | ||
546 | : "0"(to), "1"(from), "2"(0) | ||
547 | : "d0", "memory"); | ||
548 | break; | ||
549 | case 2: | ||
550 | __asm__ __volatile__ | ||
551 | (" movew (%1)+,%%d0\n" | ||
552 | "21:movesw %%d0,(%0)+\n" | ||
553 | "1:\n" | ||
554 | ".section .fixup,\"ax\"\n" | ||
555 | " .even\n" | ||
556 | "2: addql #2,%2\n" | ||
557 | " jra 1b\n" | ||
558 | ".previous\n" | ||
559 | ".section __ex_table,\"a\"\n" | ||
560 | " .align 4\n" | ||
561 | " .long 21b,2b\n" | ||
562 | " .long 1b,2b\n" | ||
563 | ".previous" | ||
564 | : "=a"(to), "=a"(from), "=d"(n) | ||
565 | : "0"(to), "1"(from), "2"(0) | ||
566 | : "d0", "memory"); | ||
567 | break; | ||
568 | case 3: | ||
569 | __asm__ __volatile__ | ||
570 | (" movew (%1)+,%%d0\n" | ||
571 | "21:movesw %%d0,(%0)+\n" | ||
572 | "1: moveb (%1)+,%%d0\n" | ||
573 | "22:movesb %%d0,(%0)+\n" | ||
574 | "2:\n" | ||
575 | ".section .fixup,\"ax\"\n" | ||
576 | " .even\n" | ||
577 | "3: addql #2,%2\n" | ||
578 | "4: addql #1,%2\n" | ||
579 | " jra 2b\n" | ||
580 | ".previous\n" | ||
581 | ".section __ex_table,\"a\"\n" | ||
582 | " .align 4\n" | ||
583 | " .long 21b,3b\n" | ||
584 | " .long 1b,3b\n" | ||
585 | " .long 22b,4b\n" | ||
586 | " .long 2b,4b\n" | ||
587 | ".previous" | ||
588 | : "=a"(to), "=a"(from), "=d"(n) | ||
589 | : "0"(to), "1"(from), "2"(0) | ||
590 | : "d0", "memory"); | ||
591 | break; | ||
592 | case 4: | ||
593 | __asm__ __volatile__ | ||
594 | (" movel (%1)+,%%d0\n" | ||
595 | "21:movesl %%d0,(%0)+\n" | ||
596 | "1:\n" | ||
597 | ".section .fixup,\"ax\"\n" | ||
598 | " .even\n" | ||
599 | "2: addql #4,%2\n" | ||
600 | " jra 1b\n" | ||
601 | ".previous\n" | ||
602 | ".section __ex_table,\"a\"\n" | ||
603 | " .align 4\n" | ||
604 | " .long 21b,2b\n" | ||
605 | " .long 1b,2b\n" | ||
606 | ".previous" | ||
607 | : "=a"(to), "=a"(from), "=d"(n) | ||
608 | : "0"(to), "1"(from), "2"(0) | ||
609 | : "d0", "memory"); | ||
610 | break; | ||
611 | case 8: | ||
612 | __asm__ __volatile__ | ||
613 | (" movel (%1)+,%%d0\n" | ||
614 | "21:movesl %%d0,(%0)+\n" | ||
615 | "1: movel (%1)+,%%d0\n" | ||
616 | "22:movesl %%d0,(%0)+\n" | ||
617 | "2:\n" | ||
618 | ".section .fixup,\"ax\"\n" | ||
619 | " .even\n" | ||
620 | "3: addql #4,%2\n" | ||
621 | "4: addql #4,%2\n" | ||
622 | " jra 2b\n" | ||
623 | ".previous\n" | ||
624 | ".section __ex_table,\"a\"\n" | ||
625 | " .align 4\n" | ||
626 | " .long 21b,3b\n" | ||
627 | " .long 1b,3b\n" | ||
628 | " .long 22b,4b\n" | ||
629 | " .long 2b,4b\n" | ||
630 | ".previous" | ||
631 | : "=a"(to), "=a"(from), "=d"(n) | ||
632 | : "0"(to), "1"(from), "2"(0) | ||
633 | : "d0", "memory"); | ||
634 | break; | ||
635 | case 12: | ||
636 | __asm__ __volatile__ | ||
637 | (" movel (%1)+,%%d0\n" | ||
638 | "21:movesl %%d0,(%0)+\n" | ||
639 | "1: movel (%1)+,%%d0\n" | ||
640 | "22:movesl %%d0,(%0)+\n" | ||
641 | "2: movel (%1)+,%%d0\n" | ||
642 | "23:movesl %%d0,(%0)+\n" | ||
643 | "3:\n" | ||
644 | ".section .fixup,\"ax\"\n" | ||
645 | " .even\n" | ||
646 | "4: addql #4,%2\n" | ||
647 | "5: addql #4,%2\n" | ||
648 | "6: addql #4,%2\n" | ||
649 | " jra 3b\n" | ||
650 | ".previous\n" | ||
651 | ".section __ex_table,\"a\"\n" | ||
652 | " .align 4\n" | ||
653 | " .long 21b,4b\n" | ||
654 | " .long 1b,4b\n" | ||
655 | " .long 22b,5b\n" | ||
656 | " .long 2b,5b\n" | ||
657 | " .long 23b,6b\n" | ||
658 | " .long 3b,6b\n" | ||
659 | ".previous" | ||
660 | : "=a"(to), "=a"(from), "=d"(n) | ||
661 | : "0"(to), "1"(from), "2"(0) | ||
662 | : "d0", "memory"); | ||
663 | break; | ||
664 | case 16: | ||
665 | __asm__ __volatile__ | ||
666 | (" movel (%1)+,%%d0\n" | ||
667 | "21:movesl %%d0,(%0)+\n" | ||
668 | "1: movel (%1)+,%%d0\n" | ||
669 | "22:movesl %%d0,(%0)+\n" | ||
670 | "2: movel (%1)+,%%d0\n" | ||
671 | "23:movesl %%d0,(%0)+\n" | ||
672 | "3: movel (%1)+,%%d0\n" | ||
673 | "24:movesl %%d0,(%0)+\n" | ||
674 | "4:" | ||
675 | ".section .fixup,\"ax\"\n" | ||
676 | " .even\n" | ||
677 | "5: addql #4,%2\n" | ||
678 | "6: addql #4,%2\n" | ||
679 | "7: addql #4,%2\n" | ||
680 | "8: addql #4,%2\n" | ||
681 | " jra 4b\n" | ||
682 | ".previous\n" | ||
683 | ".section __ex_table,\"a\"\n" | ||
684 | " .align 4\n" | ||
685 | " .long 21b,5b\n" | ||
686 | " .long 1b,5b\n" | ||
687 | " .long 22b,6b\n" | ||
688 | " .long 2b,6b\n" | ||
689 | " .long 23b,7b\n" | ||
690 | " .long 3b,7b\n" | ||
691 | " .long 24b,8b\n" | ||
692 | " .long 4b,8b\n" | ||
693 | ".previous" | ||
694 | : "=a"(to), "=a"(from), "=d"(n) | ||
695 | : "0"(to), "1"(from), "2"(0) | ||
696 | : "d0", "memory"); | ||
697 | break; | ||
698 | default: | ||
699 | switch (n & 3) { | ||
700 | case 0: | ||
701 | __copy_to_user_big(to, from, n, "", ""); | ||
702 | break; | ||
703 | case 1: | 304 | case 1: |
704 | __copy_to_user_big(to, from, n, | 305 | __put_user_asm(res, *(u8 *)from, (u8 *)to, b, d, 1); |
705 | /* fixup */ | 306 | break; |
706 | "1: addql #1,%2", | ||
707 | /* copy */ | ||
708 | " moveb (%1)+,%%d0\n" | ||
709 | "22:movesb %%d0,(%0)+\n" | ||
710 | "2:" | ||
711 | ".section __ex_table,\"a\"\n" | ||
712 | " .long 22b,1b\n" | ||
713 | " .long 2b,1b\n" | ||
714 | ".previous"); | ||
715 | break; | ||
716 | case 2: | 307 | case 2: |
717 | __copy_to_user_big(to, from, n, | 308 | __put_user_asm(res, *(u16 *)from, (u16 *)to, w, d, 2); |
718 | /* fixup */ | 309 | break; |
719 | "1: addql #2,%2", | ||
720 | /* copy */ | ||
721 | " movew (%1)+,%%d0\n" | ||
722 | "22:movesw %%d0,(%0)+\n" | ||
723 | "2:" | ||
724 | ".section __ex_table,\"a\"\n" | ||
725 | " .long 22b,1b\n" | ||
726 | " .long 2b,1b\n" | ||
727 | ".previous"); | ||
728 | break; | ||
729 | case 3: | 310 | case 3: |
730 | __copy_to_user_big(to, from, n, | 311 | __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,); |
731 | /* fixup */ | 312 | break; |
732 | "1: addql #2,%2\n" | 313 | case 4: |
733 | "2: addql #1,%2", | 314 | __put_user_asm(res, *(u32 *)from, (u32 *)to, l, r, 4); |
734 | /* copy */ | 315 | break; |
735 | " movew (%1)+,%%d0\n" | 316 | case 5: |
736 | "23:movesw %%d0,(%0)+\n" | 317 | __constant_copy_to_user_asm(res, to, from, tmp, 5, l, b,); |
737 | "3: moveb (%1)+,%%d0\n" | 318 | break; |
738 | "24:movesb %%d0,(%0)+\n" | 319 | case 6: |
739 | "4:" | 320 | __constant_copy_to_user_asm(res, to, from, tmp, 6, l, w,); |
740 | ".section __ex_table,\"a\"\n" | 321 | break; |
741 | " .long 23b,1b\n" | 322 | case 7: |
742 | " .long 3b,1b\n" | 323 | __constant_copy_to_user_asm(res, to, from, tmp, 7, l, w, b); |
743 | " .long 24b,2b\n" | 324 | break; |
744 | " .long 4b,2b\n" | 325 | case 8: |
745 | ".previous"); | 326 | __constant_copy_to_user_asm(res, to, from, tmp, 8, l, l,); |
746 | break; | 327 | break; |
328 | case 9: | ||
329 | __constant_copy_to_user_asm(res, to, from, tmp, 9, l, l, b); | ||
330 | break; | ||
331 | case 10: | ||
332 | __constant_copy_to_user_asm(res, to, from, tmp, 10, l, l, w); | ||
333 | break; | ||
334 | case 12: | ||
335 | __constant_copy_to_user_asm(res, to, from, tmp, 12, l, l, l); | ||
336 | break; | ||
337 | default: | ||
338 | /* limit the inlined version to 3 moves */ | ||
339 | return __generic_copy_to_user(to, from, n); | ||
747 | } | 340 | } |
748 | break; | 341 | |
749 | } | 342 | return res; |
750 | return n; | ||
751 | } | 343 | } |
752 | 344 | ||
753 | #define copy_from_user(to, from, n) \ | 345 | #define __copy_from_user(to, from, n) \ |
754 | (__builtin_constant_p(n) ? \ | 346 | (__builtin_constant_p(n) ? \ |
755 | __constant_copy_from_user(to, from, n) : \ | 347 | __constant_copy_from_user(to, from, n) : \ |
756 | __generic_copy_from_user(to, from, n)) | 348 | __generic_copy_from_user(to, from, n)) |
757 | 349 | ||
758 | #define copy_to_user(to, from, n) \ | 350 | #define __copy_to_user(to, from, n) \ |
759 | (__builtin_constant_p(n) ? \ | 351 | (__builtin_constant_p(n) ? \ |
760 | __constant_copy_to_user(to, from, n) : \ | 352 | __constant_copy_to_user(to, from, n) : \ |
761 | __generic_copy_to_user(to, from, n)) | 353 | __generic_copy_to_user(to, from, n)) |
762 | 354 | ||
763 | #define __copy_from_user(to, from, n) copy_from_user(to, from, n) | 355 | #define __copy_to_user_inatomic __copy_to_user |
764 | #define __copy_to_user(to, from, n) copy_to_user(to, from, n) | 356 | #define __copy_from_user_inatomic __copy_from_user |
765 | |||
766 | /* | ||
767 | * Copy a null terminated string from userspace. | ||
768 | */ | ||
769 | |||
770 | static inline long | ||
771 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
772 | { | ||
773 | long res; | ||
774 | if (count == 0) return count; | ||
775 | __asm__ __volatile__ | ||
776 | ("1: movesb (%2)+,%%d0\n" | ||
777 | "12:moveb %%d0,(%1)+\n" | ||
778 | " jeq 2f\n" | ||
779 | " subql #1,%3\n" | ||
780 | " jne 1b\n" | ||
781 | "2: subl %3,%0\n" | ||
782 | "3:\n" | ||
783 | ".section .fixup,\"ax\"\n" | ||
784 | " .even\n" | ||
785 | "4: movel %4,%0\n" | ||
786 | " jra 3b\n" | ||
787 | ".previous\n" | ||
788 | ".section __ex_table,\"a\"\n" | ||
789 | " .align 4\n" | ||
790 | " .long 1b,4b\n" | ||
791 | " .long 12b,4b\n" | ||
792 | ".previous" | ||
793 | : "=d"(res), "=a"(dst), "=a"(src), "=d"(count) | ||
794 | : "i"(-EFAULT), "0"(count), "1"(dst), "2"(src), "3"(count) | ||
795 | : "d0", "memory"); | ||
796 | return res; | ||
797 | } | ||
798 | 357 | ||
799 | /* | 358 | #define copy_from_user(to, from, n) __copy_from_user(to, from, n) |
800 | * Return the size of a string (including the ending 0) | 359 | #define copy_to_user(to, from, n) __copy_to_user(to, from, n) |
801 | * | ||
802 | * Return 0 on exception, a value greater than N if too long | ||
803 | */ | ||
804 | static inline long strnlen_user(const char __user *src, long n) | ||
805 | { | ||
806 | long res; | ||
807 | 360 | ||
808 | res = -(unsigned long)src; | 361 | long strncpy_from_user(char *dst, const char __user *src, long count); |
809 | __asm__ __volatile__ | 362 | long strnlen_user(const char __user *src, long n); |
810 | ("1:\n" | 363 | unsigned long clear_user(void __user *to, unsigned long n); |
811 | " tstl %2\n" | ||
812 | " jeq 3f\n" | ||
813 | "2: movesb (%1)+,%%d0\n" | ||
814 | "22:\n" | ||
815 | " subql #1,%2\n" | ||
816 | " tstb %%d0\n" | ||
817 | " jne 1b\n" | ||
818 | " jra 4f\n" | ||
819 | "3:\n" | ||
820 | " addql #1,%0\n" | ||
821 | "4:\n" | ||
822 | " addl %1,%0\n" | ||
823 | "5:\n" | ||
824 | ".section .fixup,\"ax\"\n" | ||
825 | " .even\n" | ||
826 | "6: moveq %3,%0\n" | ||
827 | " jra 5b\n" | ||
828 | ".previous\n" | ||
829 | ".section __ex_table,\"a\"\n" | ||
830 | " .align 4\n" | ||
831 | " .long 2b,6b\n" | ||
832 | " .long 22b,6b\n" | ||
833 | ".previous" | ||
834 | : "=d"(res), "=a"(src), "=d"(n) | ||
835 | : "i"(0), "0"(res), "1"(src), "2"(n) | ||
836 | : "d0"); | ||
837 | return res; | ||
838 | } | ||
839 | 364 | ||
840 | #define strlen_user(str) strnlen_user(str, 32767) | 365 | #define strlen_user(str) strnlen_user(str, 32767) |
841 | 366 | ||
842 | /* | ||
843 | * Zero Userspace | ||
844 | */ | ||
845 | |||
846 | static inline unsigned long | ||
847 | clear_user(void __user *to, unsigned long n) | ||
848 | { | ||
849 | __asm__ __volatile__ | ||
850 | (" tstl %1\n" | ||
851 | " jeq 3f\n" | ||
852 | "1: movesl %3,(%0)+\n" | ||
853 | "2: subql #1,%1\n" | ||
854 | " jne 1b\n" | ||
855 | "3: movel %2,%1\n" | ||
856 | " bclr #1,%1\n" | ||
857 | " jeq 4f\n" | ||
858 | "24:movesw %3,(%0)+\n" | ||
859 | "4: bclr #0,%1\n" | ||
860 | " jeq 5f\n" | ||
861 | "25:movesb %3,(%0)+\n" | ||
862 | "5:\n" | ||
863 | ".section .fixup,\"ax\"\n" | ||
864 | " .even\n" | ||
865 | "61:addql #1,%1\n" | ||
866 | "6: lsll #2,%1\n" | ||
867 | " addl %2,%1\n" | ||
868 | " jra 5b\n" | ||
869 | "7: addql #2,%1\n" | ||
870 | " jra 5b\n" | ||
871 | "8: addql #1,%1\n" | ||
872 | " jra 5b\n" | ||
873 | ".previous\n" | ||
874 | ".section __ex_table,\"a\"\n" | ||
875 | " .align 4\n" | ||
876 | " .long 1b,61b\n" | ||
877 | " .long 2b,6b\n" | ||
878 | " .long 3b,61b\n" | ||
879 | " .long 24b,7b\n" | ||
880 | " .long 4b,7b\n" | ||
881 | " .long 25b,8b\n" | ||
882 | " .long 5b,8b\n" | ||
883 | ".previous" | ||
884 | : "=a"(to), "=d"(n) | ||
885 | : "r"(n & 3), "r"(0), "0"(to), "1"(n/4)); | ||
886 | return n; | ||
887 | } | ||
888 | |||
889 | #endif /* _M68K_UACCESS_H */ | 367 | #endif /* _M68K_UACCESS_H */ |
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index f236fe92156f..7c0b6296b45c 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h | |||
@@ -410,46 +410,7 @@ __syscall_return(type,__res); \ | |||
410 | 410 | ||
411 | #ifdef __KERNEL_SYSCALLS__ | 411 | #ifdef __KERNEL_SYSCALLS__ |
412 | 412 | ||
413 | #include <linux/compiler.h> | ||
414 | #include <linux/interrupt.h> | ||
415 | #include <linux/types.h> | ||
416 | |||
417 | /* | ||
418 | * we need this inline - forking from kernel space will result | ||
419 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
420 | * is no problem, but for the stack. This is handled by not letting | ||
421 | * main() use the stack at all after fork(). Thus, no function | ||
422 | * calls - which means inline code for fork too, as otherwise we | ||
423 | * would use the stack upon exit from 'fork()'. | ||
424 | * | ||
425 | * Actually only pause and fork are needed inline, so that there | ||
426 | * won't be any messing with the stack from main(), but we define | ||
427 | * some others too. | ||
428 | */ | ||
429 | #define __NR__exit __NR_exit | ||
430 | static inline _syscall0(pid_t,setsid) | ||
431 | static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) | ||
432 | static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) | ||
433 | static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) | ||
434 | static inline _syscall1(int,dup,int,fd) | ||
435 | static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) | 413 | static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) |
436 | static inline _syscall3(int,open,const char *,file,int,flag,int,mode) | ||
437 | static inline _syscall1(int,close,int,fd) | ||
438 | static inline _syscall1(int,_exit,int,exitcode) | ||
439 | static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) | ||
440 | |||
441 | asmlinkage long sys_mmap2( | ||
442 | unsigned long addr, unsigned long len, | ||
443 | unsigned long prot, unsigned long flags, | ||
444 | unsigned long fd, unsigned long pgoff); | ||
445 | asmlinkage int sys_execve(char *name, char **argv, char **envp); | ||
446 | asmlinkage int sys_pipe(unsigned long *fildes); | ||
447 | struct pt_regs; | ||
448 | struct sigaction; | ||
449 | asmlinkage long sys_rt_sigaction(int sig, | ||
450 | const struct sigaction __user *act, | ||
451 | struct sigaction __user *oact, | ||
452 | size_t sigsetsize); | ||
453 | 414 | ||
454 | #endif /* __KERNEL_SYSCALLS__ */ | 415 | #endif /* __KERNEL_SYSCALLS__ */ |
455 | 416 | ||