1 /* $Id: sparc_ksyms.c,v 1.107 2001/07/17 16:17:33 anton Exp $
2  * arch/sparc/kernel/ksyms.c: Sparc specific ksyms support.
3  *
4  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5  * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6  */
7 
8 /* Tell string.h we don't want memcpy etc. as cpp defines */
9 #define EXPORT_SYMTAB_STROPS
10 #define PROMLIB_INTERNAL
11 
12 #include <linux/config.h>
13 #include <linux/module.h>
14 #include <linux/smp.h>
15 #include <linux/types.h>
16 #include <linux/string.h>
17 #include <linux/sched.h>
18 #include <linux/interrupt.h>
19 #include <linux/in6.h>
20 #include <linux/spinlock.h>
21 #include <linux/mm.h>
22 #ifdef CONFIG_PCI
23 #include <linux/pci.h>
24 #endif
25 #include <linux/pm.h>
26 
27 #include <asm/oplib.h>
28 #include <asm/delay.h>
29 #include <asm/system.h>
30 #include <asm/auxio.h>
31 #include <asm/pgtable.h>
32 #include <asm/io.h>
33 #include <asm/irq.h>
34 #include <asm/idprom.h>
35 #include <asm/svr4.h>
36 #include <asm/head.h>
37 #include <asm/smp.h>
38 #include <asm/mostek.h>
39 #include <asm/ptrace.h>
40 #include <asm/softirq.h>
41 #include <asm/hardirq.h>
42 #include <asm/user.h>
43 #include <asm/uaccess.h>
44 #include <asm/checksum.h>
45 #ifdef CONFIG_SBUS
46 #include <asm/sbus.h>
47 #include <asm/dma.h>
48 #endif
49 #ifdef CONFIG_HIGHMEM
50 #include <linux/highmem.h>
51 #endif
52 #include <asm/a.out.h>
53 #include <asm/io-unit.h>
54 
55 struct poll {
56 	int fd;
57 	short events;
58 	short revents;
59 };
60 
61 extern int svr4_getcontext (svr4_ucontext_t *, struct pt_regs *);
62 extern int svr4_setcontext (svr4_ucontext_t *, struct pt_regs *);
63 void _sigpause_common (unsigned int set, struct pt_regs *);
64 extern void (*__copy_1page)(void *, const void *);
65 extern void __memmove(void *, const void *, __kernel_size_t);
66 extern void (*bzero_1page)(void *);
67 extern void *__bzero(void *, size_t);
68 extern void *__memscan_zero(void *, size_t);
69 extern void *__memscan_generic(void *, int, size_t);
70 extern int __memcmp(const void *, const void *, __kernel_size_t);
71 extern int __strncmp(const char *, const char *, __kernel_size_t);
72 extern char saved_command_line[];
73 
74 extern void bcopy (const char *, char *, int);
75 extern int __ashrdi3(int, int);
76 extern int __ashldi3(int, int);
77 extern int __lshrdi3(int, int);
78 extern int __muldi3(int, int);
79 extern int __divdi3(int, int);
80 
81 extern void dump_thread(struct pt_regs *, struct user *);
82 
83 #ifdef CONFIG_SMP
84 extern spinlock_t kernel_flag;
85 #endif
86 
87 /* One thing to note is that the way the symbols of the mul/div
88  * support routines are named is a mess, they all start with
89  * a '.' which makes it a bitch to export, here is the trick:
90  */
91 
92 #define EXPORT_SYMBOL_DOT(sym)					\
93 extern int __sparc_dot_ ## sym (int) __asm__("." #sym);		\
94 __EXPORT_SYMBOL(__sparc_dot_ ## sym, "." #sym)
95 
96 #define EXPORT_SYMBOL_PRIVATE(sym)				\
97 extern int __sparc_priv_ ## sym (int) __asm__("__" #sym);	\
98 const struct module_symbol __export_priv_##sym			\
99 __attribute__((section("__ksymtab"))) =				\
100 { (unsigned long) &__sparc_priv_ ## sym, "__" #sym }
101 
102 /* used by various drivers */
103 EXPORT_SYMBOL(sparc_cpu_model);
104 EXPORT_SYMBOL(kernel_thread);
105 #ifdef SPIN_LOCK_DEBUG
106 EXPORT_SYMBOL(_do_spin_lock);
107 EXPORT_SYMBOL(_do_spin_unlock);
108 EXPORT_SYMBOL(_spin_trylock);
109 EXPORT_SYMBOL(_do_read_lock);
110 EXPORT_SYMBOL(_do_read_unlock);
111 EXPORT_SYMBOL(_do_write_lock);
112 EXPORT_SYMBOL(_do_write_unlock);
113 #else
114 EXPORT_SYMBOL_PRIVATE(_rw_read_enter);
115 EXPORT_SYMBOL_PRIVATE(_rw_read_exit);
116 EXPORT_SYMBOL_PRIVATE(_rw_write_enter);
117 #endif
118 /* semaphores */
119 EXPORT_SYMBOL(__up);
120 EXPORT_SYMBOL(__down);
121 EXPORT_SYMBOL(__down_trylock);
122 EXPORT_SYMBOL(__down_interruptible);
123 
124 EXPORT_SYMBOL(sparc_valid_addr_bitmap);
125 EXPORT_SYMBOL(phys_base);
126 
127 /* Atomic operations. */
128 EXPORT_SYMBOL_PRIVATE(_atomic_add);
129 EXPORT_SYMBOL_PRIVATE(_atomic_sub);
130 
131 /* Bit operations. */
132 EXPORT_SYMBOL_PRIVATE(_set_bit);
133 EXPORT_SYMBOL_PRIVATE(_clear_bit);
134 EXPORT_SYMBOL_PRIVATE(_change_bit);
135 
136 #ifdef CONFIG_SMP
137 /* Kernel wide locking */
138 EXPORT_SYMBOL(kernel_flag);
139 
140 /* IRQ implementation. */
141 EXPORT_SYMBOL(global_irq_holder);
142 EXPORT_SYMBOL(synchronize_irq);
143 EXPORT_SYMBOL(__global_cli);
144 EXPORT_SYMBOL(__global_sti);
145 EXPORT_SYMBOL(__global_save_flags);
146 EXPORT_SYMBOL(__global_restore_flags);
147 
148 /* Misc SMP information */
149 EXPORT_SYMBOL(smp_num_cpus);
150 EXPORT_SYMBOL(__cpu_number_map);
151 EXPORT_SYMBOL(__cpu_logical_map);
152 #endif
153 
154 EXPORT_SYMBOL(udelay);
155 EXPORT_SYMBOL(ndelay);
156 EXPORT_SYMBOL(mostek_lock);
157 EXPORT_SYMBOL(mstk48t02_regs);
158 #if CONFIG_SUN_AUXIO
159 EXPORT_SYMBOL(set_auxio);
160 EXPORT_SYMBOL(get_auxio);
161 #endif
162 EXPORT_SYMBOL(request_fast_irq);
163 EXPORT_SYMBOL(io_remap_page_range);
164   /* P3: iounit_xxx may be needed, sun4d users */
165 /* EXPORT_SYMBOL(iounit_map_dma_init); */
166 /* EXPORT_SYMBOL(iounit_map_dma_page); */
167 
168 /* Btfixup stuff cannot have versions, it would be complicated too much */
169 #ifndef CONFIG_SMP
170 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(___xchg32));
171 #else
172 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(__smp_processor_id));
173 #endif
174 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(enable_irq));
175 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(disable_irq));
176 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(__irq_itoa));
177 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(mmu_unlockarea));
178 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(mmu_lockarea));
179 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(mmu_get_scsi_sgl));
180 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(mmu_get_scsi_one));
181 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(mmu_release_scsi_sgl));
182 EXPORT_SYMBOL_NOVERS(BTFIXUP_CALL(mmu_release_scsi_one));
183 
184 #if CONFIG_SBUS
185 EXPORT_SYMBOL(sbus_root);
186 EXPORT_SYMBOL(dma_chain);
187 EXPORT_SYMBOL(sbus_set_sbus64);
188 EXPORT_SYMBOL(sbus_alloc_consistent);
189 EXPORT_SYMBOL(sbus_free_consistent);
190 EXPORT_SYMBOL(sbus_map_single);
191 EXPORT_SYMBOL(sbus_unmap_single);
192 EXPORT_SYMBOL(sbus_map_sg);
193 EXPORT_SYMBOL(sbus_unmap_sg);
194 EXPORT_SYMBOL(sbus_dma_sync_single);
195 EXPORT_SYMBOL(sbus_dma_sync_sg);
196 EXPORT_SYMBOL(sbus_iounmap);
197 EXPORT_SYMBOL(sbus_ioremap);
198 #endif
199 #if CONFIG_PCI
200 /* Actually, ioremap/iounmap are not PCI specific. But it is ok for drivers. */
201 EXPORT_SYMBOL(ioremap);
202 EXPORT_SYMBOL(iounmap);
203 
204 EXPORT_SYMBOL(insl);
205 EXPORT_SYMBOL(outsl);
206 EXPORT_SYMBOL(pci_alloc_consistent);
207 EXPORT_SYMBOL(pci_free_consistent);
208 EXPORT_SYMBOL(pci_map_single);
209 EXPORT_SYMBOL(pci_unmap_single);
210 EXPORT_SYMBOL(pci_dma_sync_single);
211 #endif
212 
213 /* in arch/sparc/mm/highmem.c */
214 #ifdef CONFIG_HIGHMEM
215 EXPORT_SYMBOL(kmap_atomic);
216 EXPORT_SYMBOL(kunmap_atomic);
217 #endif
218 
219 /* Solaris/SunOS binary compatibility */
220 EXPORT_SYMBOL(svr4_setcontext);
221 EXPORT_SYMBOL(svr4_getcontext);
222 EXPORT_SYMBOL(_sigpause_common);
223 
224 /* Should really be in linux/kernel/ksyms.c */
225 EXPORT_SYMBOL(dump_thread);
226 
227 /* prom symbols */
228 EXPORT_SYMBOL(idprom);
229 EXPORT_SYMBOL(prom_root_node);
230 EXPORT_SYMBOL(prom_getchild);
231 EXPORT_SYMBOL(prom_getsibling);
232 EXPORT_SYMBOL(prom_searchsiblings);
233 EXPORT_SYMBOL(prom_firstprop);
234 EXPORT_SYMBOL(prom_nextprop);
235 EXPORT_SYMBOL(prom_getproplen);
236 EXPORT_SYMBOL(prom_getproperty);
237 EXPORT_SYMBOL(prom_node_has_property);
238 EXPORT_SYMBOL(prom_setprop);
239 EXPORT_SYMBOL(saved_command_line);
240 EXPORT_SYMBOL(prom_apply_obio_ranges);
241 EXPORT_SYMBOL(prom_getname);
242 EXPORT_SYMBOL(prom_feval);
243 EXPORT_SYMBOL(prom_getbool);
244 EXPORT_SYMBOL(prom_getstring);
245 EXPORT_SYMBOL(prom_getint);
246 EXPORT_SYMBOL(prom_getintdefault);
247 EXPORT_SYMBOL(prom_finddevice);
248 EXPORT_SYMBOL(romvec);
249 EXPORT_SYMBOL(__prom_getchild);
250 EXPORT_SYMBOL(__prom_getsibling);
251 
252 /* sparc library symbols */
253 EXPORT_SYMBOL(bcopy);
254 EXPORT_SYMBOL_NOVERS(memscan);
255 EXPORT_SYMBOL_NOVERS(strlen);
256 EXPORT_SYMBOL(strnlen);
257 EXPORT_SYMBOL(strcpy);
258 EXPORT_SYMBOL(strncpy);
259 EXPORT_SYMBOL(strcat);
260 EXPORT_SYMBOL(strncat);
261 EXPORT_SYMBOL(strcmp);
262 EXPORT_SYMBOL_NOVERS(strncmp);
263 EXPORT_SYMBOL(strchr);
264 EXPORT_SYMBOL(strrchr);
265 EXPORT_SYMBOL(strpbrk);
266 EXPORT_SYMBOL(strtok);
267 EXPORT_SYMBOL(strstr);
268 EXPORT_SYMBOL(page_kernel);
269 
270 /* Special internal versions of library functions. */
271 EXPORT_SYMBOL(__copy_1page);
272 EXPORT_SYMBOL(__memcpy);
273 EXPORT_SYMBOL(__memset);
274 EXPORT_SYMBOL(bzero_1page);
275 EXPORT_SYMBOL(__bzero);
276 EXPORT_SYMBOL(__memscan_zero);
277 EXPORT_SYMBOL(__memscan_generic);
278 EXPORT_SYMBOL(__memcmp);
279 EXPORT_SYMBOL(__strncmp);
280 EXPORT_SYMBOL(__memmove);
281 
282 /* Moving data to/from userspace. */
283 EXPORT_SYMBOL(__copy_user);
284 EXPORT_SYMBOL(__strncpy_from_user);
285 
286 /* Networking helper routines. */
287 /* XXX This is NOVERS because C_LABEL_STR doesn't get the version number. -DaveM */
288 EXPORT_SYMBOL_NOVERS(__csum_partial_copy_sparc_generic);
289 
290 /* No version information on this, heavily used in inline asm,
291  * and will always be 'void __ret_efault(void)'.
292  */
293 EXPORT_SYMBOL_NOVERS(__ret_efault);
294 
295 /* No version information on these, as gcc produces such symbols. */
296 EXPORT_SYMBOL_NOVERS(memcmp);
297 EXPORT_SYMBOL_NOVERS(memcpy);
298 EXPORT_SYMBOL_NOVERS(memset);
299 EXPORT_SYMBOL_NOVERS(memmove);
300 EXPORT_SYMBOL_NOVERS(memchr);
301 EXPORT_SYMBOL_NOVERS(__ashrdi3);
302 EXPORT_SYMBOL_NOVERS(__ashldi3);
303 EXPORT_SYMBOL_NOVERS(__lshrdi3);
304 EXPORT_SYMBOL_NOVERS(__muldi3);
305 EXPORT_SYMBOL_NOVERS(__divdi3);
306 
307 EXPORT_SYMBOL_DOT(rem);
308 EXPORT_SYMBOL_DOT(urem);
309 EXPORT_SYMBOL_DOT(mul);
310 EXPORT_SYMBOL_DOT(umul);
311 EXPORT_SYMBOL_DOT(div);
312 EXPORT_SYMBOL_DOT(udiv);
313 
314 /* Sun Power Management Idle Handler */
315 EXPORT_SYMBOL(pm_idle);
316