diff options
Diffstat (limited to 'include/asm-sparc')
152 files changed, 16150 insertions, 0 deletions
diff --git a/include/asm-sparc/a.out.h b/include/asm-sparc/a.out.h new file mode 100644 index 000000000000..e4e83eb0161e --- /dev/null +++ b/include/asm-sparc/a.out.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* $Id: a.out.h,v 1.13 2000/01/09 10:46:53 anton Exp $ */ | ||
2 | #ifndef __SPARC_A_OUT_H__ | ||
3 | #define __SPARC_A_OUT_H__ | ||
4 | |||
5 | #define SPARC_PGSIZE 0x2000 /* Thanks to the sun4 architecture... */ | ||
6 | #define SEGMENT_SIZE SPARC_PGSIZE /* whee... */ | ||
7 | |||
8 | struct exec { | ||
9 | unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */ | ||
10 | unsigned char a_toolversion:7; | ||
11 | unsigned char a_machtype; | ||
12 | unsigned short a_info; | ||
13 | unsigned long a_text; /* length of text, in bytes */ | ||
14 | unsigned long a_data; /* length of data, in bytes */ | ||
15 | unsigned long a_bss; /* length of bss, in bytes */ | ||
16 | unsigned long a_syms; /* length of symbol table, in bytes */ | ||
17 | unsigned long a_entry; /* where program begins */ | ||
18 | unsigned long a_trsize; | ||
19 | unsigned long a_drsize; | ||
20 | }; | ||
21 | |||
22 | /* Where in the file does the text information begin? */ | ||
23 | #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec)) | ||
24 | |||
25 | /* Where do the Symbols start? */ | ||
26 | #define N_SYMOFF(x) (N_TXTOFF(x) + (x).a_text + \ | ||
27 | (x).a_data + (x).a_trsize + \ | ||
28 | (x).a_drsize) | ||
29 | |||
30 | /* Where does text segment go in memory after being loaded? */ | ||
31 | #define N_TXTADDR(x) (((N_MAGIC(x) == ZMAGIC) && \ | ||
32 | ((x).a_entry < SPARC_PGSIZE)) ? \ | ||
33 | 0 : SPARC_PGSIZE) | ||
34 | |||
35 | /* And same for the data segment.. */ | ||
36 | #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \ | ||
37 | (N_TXTADDR(x) + (x).a_text) \ | ||
38 | : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) | ||
39 | |||
40 | #define N_TRSIZE(a) ((a).a_trsize) | ||
41 | #define N_DRSIZE(a) ((a).a_drsize) | ||
42 | #define N_SYMSIZE(a) ((a).a_syms) | ||
43 | |||
44 | /* | ||
45 | * Sparc relocation types | ||
46 | */ | ||
47 | enum reloc_type | ||
48 | { | ||
49 | RELOC_8, | ||
50 | RELOC_16, | ||
51 | RELOC_32, /* simplest relocs */ | ||
52 | RELOC_DISP8, | ||
53 | RELOC_DISP16, | ||
54 | RELOC_DISP32, /* Disp's (pc-rel) */ | ||
55 | RELOC_WDISP30, | ||
56 | RELOC_WDISP22, /* SR word disp's */ | ||
57 | RELOC_HI22, | ||
58 | RELOC_22, /* SR 22-bit relocs */ | ||
59 | RELOC_13, | ||
60 | RELOC_LO10, /* SR 13&10-bit relocs */ | ||
61 | RELOC_SFA_BASE, | ||
62 | RELOC_SFA_OFF13, /* SR S.F.A. relocs */ | ||
63 | RELOC_BASE10, | ||
64 | RELOC_BASE13, | ||
65 | RELOC_BASE22, /* base_relative pic */ | ||
66 | RELOC_PC10, | ||
67 | RELOC_PC22, /* special pc-rel pic */ | ||
68 | RELOC_JMP_TBL, /* jmp_tbl_rel in pic */ | ||
69 | RELOC_SEGOFF16, /* ShLib offset-in-seg */ | ||
70 | RELOC_GLOB_DAT, | ||
71 | RELOC_JMP_SLOT, | ||
72 | RELOC_RELATIVE /* rtld relocs */ | ||
73 | }; | ||
74 | |||
75 | /* | ||
76 | * Format of a relocation datum. | ||
77 | */ | ||
78 | struct relocation_info /* used when header.a_machtype == M_SPARC */ | ||
79 | { | ||
80 | unsigned long r_address; /* relocation addr */ | ||
81 | unsigned int r_index:24; /* segment index or symbol index */ | ||
82 | unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ | ||
83 | int r_pad:2; /* <unused> */ | ||
84 | enum reloc_type r_type:5; /* type of relocation to perform */ | ||
85 | long r_addend; /* addend for relocation value */ | ||
86 | }; | ||
87 | |||
88 | #define N_RELOCATION_INFO_DECLARED 1 | ||
89 | |||
90 | #ifdef __KERNEL__ | ||
91 | |||
92 | #include <asm/page.h> | ||
93 | |||
94 | #define STACK_TOP (PAGE_OFFSET - PAGE_SIZE) | ||
95 | |||
96 | #endif /* __KERNEL__ */ | ||
97 | |||
98 | #endif /* __SPARC_A_OUT_H__ */ | ||
diff --git a/include/asm-sparc/apc.h b/include/asm-sparc/apc.h new file mode 100644 index 000000000000..24e9a7d4d97e --- /dev/null +++ b/include/asm-sparc/apc.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* apc - Driver definitions for power management functions | ||
2 | * of Aurora Personality Chip (APC) on SPARCstation-4/5 and | ||
3 | * derivatives | ||
4 | * | ||
5 | * Copyright (c) 2001 Eric Brower (ebrower@usa.net) | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef _SPARC_APC_H | ||
10 | #define _SPARC_APC_H | ||
11 | |||
12 | #include <linux/ioctl.h> | ||
13 | |||
14 | #define APC_IOC 'A' | ||
15 | |||
16 | #define APCIOCGFANCTL _IOR(APC_IOC, 0x00, int) /* Get fan speed */ | ||
17 | #define APCIOCSFANCTL _IOW(APC_IOC, 0x01, int) /* Set fan speed */ | ||
18 | |||
19 | #define APCIOCGCPWR _IOR(APC_IOC, 0x02, int) /* Get CPOWER state */ | ||
20 | #define APCIOCSCPWR _IOW(APC_IOC, 0x03, int) /* Set CPOWER state */ | ||
21 | |||
22 | #define APCIOCGBPORT _IOR(APC_IOC, 0x04, int) /* Get BPORT state */ | ||
23 | #define APCIOCSBPORT _IOW(APC_IOC, 0x05, int) /* Set BPORT state */ | ||
24 | |||
25 | /* | ||
26 | * Register offsets | ||
27 | */ | ||
28 | #define APC_IDLE_REG 0x00 | ||
29 | #define APC_FANCTL_REG 0x20 | ||
30 | #define APC_CPOWER_REG 0x24 | ||
31 | #define APC_BPORT_REG 0x30 | ||
32 | |||
33 | #define APC_REGMASK 0x01 | ||
34 | #define APC_BPMASK 0x03 | ||
35 | |||
36 | /* | ||
37 | * IDLE - CPU standby values (set to initiate standby) | ||
38 | */ | ||
39 | #define APC_IDLE_ON 0x01 | ||
40 | |||
41 | /* | ||
42 | * FANCTL - Fan speed control state values | ||
43 | */ | ||
44 | #define APC_FANCTL_HI 0x00 /* Fan speed high */ | ||
45 | #define APC_FANCTL_LO 0x01 /* Fan speed low */ | ||
46 | |||
47 | /* | ||
48 | * CPWR - Convenience power outlet state values | ||
49 | */ | ||
50 | #define APC_CPOWER_ON 0x00 /* Conv power on */ | ||
51 | #define APC_CPOWER_OFF 0x01 /* Conv power off */ | ||
52 | |||
53 | /* | ||
54 | * BPA/BPB - Read-Write "Bit Ports" state values (reset to 0 at power-on) | ||
55 | * | ||
56 | * WARNING: Internal usage of bit ports is platform dependent-- | ||
57 | * don't modify BPORT settings unless you know what you are doing. | ||
58 | * | ||
59 | * On SS5 BPA seems to toggle onboard ethernet loopback... -E | ||
60 | */ | ||
61 | #define APC_BPORT_A 0x01 /* Bit Port A */ | ||
62 | #define APC_BPORT_B 0x02 /* Bit Port B */ | ||
63 | |||
64 | #endif /* !(_SPARC_APC_H) */ | ||
diff --git a/include/asm-sparc/asi.h b/include/asm-sparc/asi.h new file mode 100644 index 000000000000..58c3754da926 --- /dev/null +++ b/include/asm-sparc/asi.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* $Id: asi.h,v 1.18 1998/03/09 14:04:46 jj Exp $ */ | ||
2 | #ifndef _SPARC_ASI_H | ||
3 | #define _SPARC_ASI_H | ||
4 | |||
5 | /* asi.h: Address Space Identifier values for the sparc. | ||
6 | * | ||
7 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
8 | * | ||
9 | * Pioneer work for sun4m: Paul Hatchman (paul@sfe.com.au) | ||
10 | * Joint edition for sun4c+sun4m: Pete A. Zaitcev <zaitcev@ipmce.su> | ||
11 | */ | ||
12 | |||
13 | /* The first batch are for the sun4c. */ | ||
14 | |||
15 | #define ASI_NULL1 0x00 | ||
16 | #define ASI_NULL2 0x01 | ||
17 | |||
18 | /* sun4c and sun4 control registers and mmu/vac ops */ | ||
19 | #define ASI_CONTROL 0x02 | ||
20 | #define ASI_SEGMAP 0x03 | ||
21 | #define ASI_PTE 0x04 | ||
22 | #define ASI_HWFLUSHSEG 0x05 | ||
23 | #define ASI_HWFLUSHPAGE 0x06 | ||
24 | #define ASI_REGMAP 0x06 | ||
25 | #define ASI_HWFLUSHCONTEXT 0x07 | ||
26 | |||
27 | #define ASI_USERTXT 0x08 | ||
28 | #define ASI_KERNELTXT 0x09 | ||
29 | #define ASI_USERDATA 0x0a | ||
30 | #define ASI_KERNELDATA 0x0b | ||
31 | |||
32 | /* VAC Cache flushing on sun4c and sun4 */ | ||
33 | #define ASI_FLUSHSEG 0x0c | ||
34 | #define ASI_FLUSHPG 0x0d | ||
35 | #define ASI_FLUSHCTX 0x0e | ||
36 | |||
37 | /* SPARCstation-5: only 6 bits are decoded. */ | ||
38 | /* wo = Write Only, rw = Read Write; */ | ||
39 | /* ss = Single Size, as = All Sizes; */ | ||
40 | #define ASI_M_RES00 0x00 /* Don't touch... */ | ||
41 | #define ASI_M_UNA01 0x01 /* Same here... */ | ||
42 | #define ASI_M_MXCC 0x02 /* Access to TI VIKING MXCC registers */ | ||
43 | #define ASI_M_FLUSH_PROBE 0x03 /* Reference MMU Flush/Probe; rw, ss */ | ||
44 | #define ASI_M_MMUREGS 0x04 /* MMU Registers; rw, ss */ | ||
45 | #define ASI_M_TLBDIAG 0x05 /* MMU TLB only Diagnostics */ | ||
46 | #define ASI_M_DIAGS 0x06 /* Reference MMU Diagnostics */ | ||
47 | #define ASI_M_IODIAG 0x07 /* MMU I/O TLB only Diagnostics */ | ||
48 | #define ASI_M_USERTXT 0x08 /* Same as ASI_USERTXT; rw, as */ | ||
49 | #define ASI_M_KERNELTXT 0x09 /* Same as ASI_KERNELTXT; rw, as */ | ||
50 | #define ASI_M_USERDATA 0x0A /* Same as ASI_USERDATA; rw, as */ | ||
51 | #define ASI_M_KERNELDATA 0x0B /* Same as ASI_KERNELDATA; rw, as */ | ||
52 | #define ASI_M_TXTC_TAG 0x0C /* Instruction Cache Tag; rw, ss */ | ||
53 | #define ASI_M_TXTC_DATA 0x0D /* Instruction Cache Data; rw, ss */ | ||
54 | #define ASI_M_DATAC_TAG 0x0E /* Data Cache Tag; rw, ss */ | ||
55 | #define ASI_M_DATAC_DATA 0x0F /* Data Cache Data; rw, ss */ | ||
56 | |||
57 | /* The following cache flushing ASIs work only with the 'sta' | ||
58 | * instruction. Results are unpredictable for 'swap' and 'ldstuba', | ||
59 | * so don't do it. | ||
60 | */ | ||
61 | |||
62 | /* These ASI flushes affect external caches too. */ | ||
63 | #define ASI_M_FLUSH_PAGE 0x10 /* Flush I&D Cache Line (page); wo, ss */ | ||
64 | #define ASI_M_FLUSH_SEG 0x11 /* Flush I&D Cache Line (seg); wo, ss */ | ||
65 | #define ASI_M_FLUSH_REGION 0x12 /* Flush I&D Cache Line (region); wo, ss */ | ||
66 | #define ASI_M_FLUSH_CTX 0x13 /* Flush I&D Cache Line (context); wo, ss */ | ||
67 | #define ASI_M_FLUSH_USER 0x14 /* Flush I&D Cache Line (user); wo, ss */ | ||
68 | |||
69 | /* Block-copy operations are available only on certain V8 cpus. */ | ||
70 | #define ASI_M_BCOPY 0x17 /* Block copy */ | ||
71 | |||
72 | /* These affect only the ICACHE and are Ross HyperSparc and TurboSparc specific. */ | ||
73 | #define ASI_M_IFLUSH_PAGE 0x18 /* Flush I Cache Line (page); wo, ss */ | ||
74 | #define ASI_M_IFLUSH_SEG 0x19 /* Flush I Cache Line (seg); wo, ss */ | ||
75 | #define ASI_M_IFLUSH_REGION 0x1A /* Flush I Cache Line (region); wo, ss */ | ||
76 | #define ASI_M_IFLUSH_CTX 0x1B /* Flush I Cache Line (context); wo, ss */ | ||
77 | #define ASI_M_IFLUSH_USER 0x1C /* Flush I Cache Line (user); wo, ss */ | ||
78 | |||
79 | /* Block-fill operations are available on certain V8 cpus */ | ||
80 | #define ASI_M_BFILL 0x1F | ||
81 | |||
82 | /* This allows direct access to main memory, actually 0x20 to 0x2f are | ||
83 | * the available ASI's for physical ram pass-through, but I don't have | ||
84 | * any idea what the other ones do.... | ||
85 | */ | ||
86 | |||
87 | #define ASI_M_BYPASS 0x20 /* Reference MMU bypass; rw, as */ | ||
88 | #define ASI_M_FBMEM 0x29 /* Graphics card frame buffer access */ | ||
89 | #define ASI_M_VMEUS 0x2A /* VME user 16-bit access */ | ||
90 | #define ASI_M_VMEPS 0x2B /* VME priv 16-bit access */ | ||
91 | #define ASI_M_VMEUT 0x2C /* VME user 32-bit access */ | ||
92 | #define ASI_M_VMEPT 0x2D /* VME priv 32-bit access */ | ||
93 | #define ASI_M_SBUS 0x2E /* Direct SBus access */ | ||
94 | #define ASI_M_CTL 0x2F /* Control Space (ECC and MXCC are here) */ | ||
95 | |||
96 | |||
97 | /* This is ROSS HyperSparc only. */ | ||
98 | #define ASI_M_FLUSH_IWHOLE 0x31 /* Flush entire ICACHE; wo, ss */ | ||
99 | |||
100 | /* Tsunami/Viking/TurboSparc i/d cache flash clear. */ | ||
101 | #define ASI_M_IC_FLCLEAR 0x36 | ||
102 | #define ASI_M_DC_FLCLEAR 0x37 | ||
103 | |||
104 | #define ASI_M_DCDR 0x39 /* Data Cache Diagnostics Register rw, ss */ | ||
105 | |||
106 | #define ASI_M_VIKING_TMP1 0x40 /* Emulation temporary 1 on Viking */ | ||
107 | /* only available on SuperSparc I */ | ||
108 | /* #define ASI_M_VIKING_TMP2 0x41 */ /* Emulation temporary 2 on Viking */ | ||
109 | |||
110 | #define ASI_M_ACTION 0x4c /* Breakpoint Action Register (GNU/Viking) */ | ||
111 | |||
112 | #endif /* _SPARC_ASI_H */ | ||
diff --git a/include/asm-sparc/asmmacro.h b/include/asm-sparc/asmmacro.h new file mode 100644 index 000000000000..0d4b65bd252b --- /dev/null +++ b/include/asm-sparc/asmmacro.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* asmmacro.h: Assembler macros. | ||
2 | * | ||
3 | * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu) | ||
4 | */ | ||
5 | |||
6 | #ifndef _SPARC_ASMMACRO_H | ||
7 | #define _SPARC_ASMMACRO_H | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <asm/btfixup.h> | ||
11 | #include <asm/asi.h> | ||
12 | |||
13 | #define GET_PROCESSOR4M_ID(reg) \ | ||
14 | rd %tbr, %reg; \ | ||
15 | srl %reg, 12, %reg; \ | ||
16 | and %reg, 3, %reg; | ||
17 | |||
18 | #define GET_PROCESSOR4D_ID(reg) \ | ||
19 | lda [%g0] ASI_M_VIKING_TMP1, %reg; | ||
20 | |||
21 | /* All trap entry points _must_ begin with this macro or else you | ||
22 | * lose. It makes sure the kernel has a proper window so that | ||
23 | * c-code can be called. | ||
24 | */ | ||
25 | #define SAVE_ALL_HEAD \ | ||
26 | sethi %hi(trap_setup), %l4; \ | ||
27 | jmpl %l4 + %lo(trap_setup), %l6; | ||
28 | #define SAVE_ALL \ | ||
29 | SAVE_ALL_HEAD \ | ||
30 | nop; | ||
31 | |||
32 | /* All traps low-level code here must end with this macro. */ | ||
33 | #define RESTORE_ALL b ret_trap_entry; clr %l6; | ||
34 | |||
35 | /* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+ | ||
36 | likes byte accesses. These are to avoid ifdef mania. */ | ||
37 | |||
38 | #ifdef CONFIG_SUN4 | ||
39 | #define lduXa lduha | ||
40 | #define stXa stha | ||
41 | #else | ||
42 | #define lduXa lduba | ||
43 | #define stXa stba | ||
44 | #endif | ||
45 | |||
46 | #endif /* !(_SPARC_ASMMACRO_H) */ | ||
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h new file mode 100644 index 000000000000..37f6ab601c3d --- /dev/null +++ b/include/asm-sparc/atomic.h | |||
@@ -0,0 +1,158 @@ | |||
1 | /* atomic.h: These still suck, but the I-cache hit rate is higher. | ||
2 | * | ||
3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
4 | * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au) | ||
5 | * | ||
6 | * Additions by Keith M Wesolowski (wesolows@foobazco.org) based | ||
7 | * on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>. | ||
8 | */ | ||
9 | |||
10 | #ifndef __ARCH_SPARC_ATOMIC__ | ||
11 | #define __ARCH_SPARC_ATOMIC__ | ||
12 | |||
13 | #include <linux/config.h> | ||
14 | |||
15 | typedef struct { volatile int counter; } atomic_t; | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | |||
19 | #define ATOMIC_INIT(i) { (i) } | ||
20 | |||
21 | extern int __atomic_add_return(int, atomic_t *); | ||
22 | extern void atomic_set(atomic_t *, int); | ||
23 | |||
24 | #define atomic_read(v) ((v)->counter) | ||
25 | |||
26 | #define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v))) | ||
27 | #define atomic_sub(i, v) ((void)__atomic_add_return(-(int)(i), (v))) | ||
28 | #define atomic_inc(v) ((void)__atomic_add_return( 1, (v))) | ||
29 | #define atomic_dec(v) ((void)__atomic_add_return( -1, (v))) | ||
30 | |||
31 | #define atomic_add_return(i, v) (__atomic_add_return( (int)(i), (v))) | ||
32 | #define atomic_sub_return(i, v) (__atomic_add_return(-(int)(i), (v))) | ||
33 | #define atomic_inc_return(v) (__atomic_add_return( 1, (v))) | ||
34 | #define atomic_dec_return(v) (__atomic_add_return( -1, (v))) | ||
35 | |||
36 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | ||
37 | |||
38 | /* | ||
39 | * atomic_inc_and_test - increment and test | ||
40 | * @v: pointer of type atomic_t | ||
41 | * | ||
42 | * Atomically increments @v by 1 | ||
43 | * and returns true if the result is zero, or false for all | ||
44 | * other cases. | ||
45 | */ | ||
46 | #define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) | ||
47 | |||
48 | #define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) | ||
49 | #define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) | ||
50 | |||
51 | /* This is the old 24-bit implementation. It's still used internally | ||
52 | * by some sparc-specific code, notably the semaphore implementation. | ||
53 | */ | ||
54 | typedef struct { volatile int counter; } atomic24_t; | ||
55 | |||
56 | #ifndef CONFIG_SMP | ||
57 | |||
58 | #define ATOMIC24_INIT(i) { (i) } | ||
59 | #define atomic24_read(v) ((v)->counter) | ||
60 | #define atomic24_set(v, i) (((v)->counter) = i) | ||
61 | |||
62 | #else | ||
63 | /* We do the bulk of the actual work out of line in two common | ||
64 | * routines in assembler, see arch/sparc/lib/atomic.S for the | ||
65 | * "fun" details. | ||
66 | * | ||
67 | * For SMP the trick is you embed the spin lock byte within | ||
68 | * the word, use the low byte so signedness is easily retained | ||
69 | * via a quick arithmetic shift. It looks like this: | ||
70 | * | ||
71 | * ---------------------------------------- | ||
72 | * | signed 24-bit counter value | lock | atomic_t | ||
73 | * ---------------------------------------- | ||
74 | * 31 8 7 0 | ||
75 | */ | ||
76 | |||
77 | #define ATOMIC24_INIT(i) { ((i) << 8) } | ||
78 | |||
79 | static inline int atomic24_read(const atomic24_t *v) | ||
80 | { | ||
81 | int ret = v->counter; | ||
82 | |||
83 | while(ret & 0xff) | ||
84 | ret = v->counter; | ||
85 | |||
86 | return ret >> 8; | ||
87 | } | ||
88 | |||
89 | #define atomic24_set(v, i) (((v)->counter) = ((i) << 8)) | ||
90 | #endif | ||
91 | |||
92 | static inline int __atomic24_add(int i, atomic24_t *v) | ||
93 | { | ||
94 | register volatile int *ptr asm("g1"); | ||
95 | register int increment asm("g2"); | ||
96 | register int tmp1 asm("g3"); | ||
97 | register int tmp2 asm("g4"); | ||
98 | register int tmp3 asm("g7"); | ||
99 | |||
100 | ptr = &v->counter; | ||
101 | increment = i; | ||
102 | |||
103 | __asm__ __volatile__( | ||
104 | "mov %%o7, %%g4\n\t" | ||
105 | "call ___atomic24_add\n\t" | ||
106 | " add %%o7, 8, %%o7\n" | ||
107 | : "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3) | ||
108 | : "0" (increment), "r" (ptr) | ||
109 | : "memory", "cc"); | ||
110 | |||
111 | return increment; | ||
112 | } | ||
113 | |||
114 | static inline int __atomic24_sub(int i, atomic24_t *v) | ||
115 | { | ||
116 | register volatile int *ptr asm("g1"); | ||
117 | register int increment asm("g2"); | ||
118 | register int tmp1 asm("g3"); | ||
119 | register int tmp2 asm("g4"); | ||
120 | register int tmp3 asm("g7"); | ||
121 | |||
122 | ptr = &v->counter; | ||
123 | increment = i; | ||
124 | |||
125 | __asm__ __volatile__( | ||
126 | "mov %%o7, %%g4\n\t" | ||
127 | "call ___atomic24_sub\n\t" | ||
128 | " add %%o7, 8, %%o7\n" | ||
129 | : "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3) | ||
130 | : "0" (increment), "r" (ptr) | ||
131 | : "memory", "cc"); | ||
132 | |||
133 | return increment; | ||
134 | } | ||
135 | |||
136 | #define atomic24_add(i, v) ((void)__atomic24_add((i), (v))) | ||
137 | #define atomic24_sub(i, v) ((void)__atomic24_sub((i), (v))) | ||
138 | |||
139 | #define atomic24_dec_return(v) __atomic24_sub(1, (v)) | ||
140 | #define atomic24_inc_return(v) __atomic24_add(1, (v)) | ||
141 | |||
142 | #define atomic24_sub_and_test(i, v) (__atomic24_sub((i), (v)) == 0) | ||
143 | #define atomic24_dec_and_test(v) (__atomic24_sub(1, (v)) == 0) | ||
144 | |||
145 | #define atomic24_inc(v) ((void)__atomic24_add(1, (v))) | ||
146 | #define atomic24_dec(v) ((void)__atomic24_sub(1, (v))) | ||
147 | |||
148 | #define atomic24_add_negative(i, v) (__atomic24_add((i), (v)) < 0) | ||
149 | |||
150 | /* Atomic operations are already serializing */ | ||
151 | #define smp_mb__before_atomic_dec() barrier() | ||
152 | #define smp_mb__after_atomic_dec() barrier() | ||
153 | #define smp_mb__before_atomic_inc() barrier() | ||
154 | #define smp_mb__after_atomic_inc() barrier() | ||
155 | |||
156 | #endif /* !(__KERNEL__) */ | ||
157 | |||
158 | #endif /* !(__ARCH_SPARC_ATOMIC__) */ | ||
diff --git a/include/asm-sparc/audioio.h b/include/asm-sparc/audioio.h new file mode 100644 index 000000000000..cf16173f521b --- /dev/null +++ b/include/asm-sparc/audioio.h | |||
@@ -0,0 +1,234 @@ | |||
1 | /* | ||
2 | * include/asm-sparc/audioio.h | ||
3 | * | ||
4 | * Sparc Audio Midlayer | ||
5 | * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _AUDIOIO_H_ | ||
9 | #define _AUDIOIO_H_ | ||
10 | |||
11 | /* | ||
12 | * SunOS/Solaris /dev/audio interface | ||
13 | */ | ||
14 | |||
15 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/time.h> | ||
18 | #include <linux/ioctl.h> | ||
19 | #endif | ||
20 | |||
21 | /* | ||
22 | * This structure contains state information for audio device IO streams. | ||
23 | */ | ||
24 | typedef struct audio_prinfo { | ||
25 | /* | ||
26 | * The following values describe the audio data encoding. | ||
27 | */ | ||
28 | unsigned int sample_rate; /* samples per second */ | ||
29 | unsigned int channels; /* number of interleaved channels */ | ||
30 | unsigned int precision; /* bit-width of each sample */ | ||
31 | unsigned int encoding; /* data encoding method */ | ||
32 | |||
33 | /* | ||
34 | * The following values control audio device configuration | ||
35 | */ | ||
36 | unsigned int gain; /* gain level: 0 - 255 */ | ||
37 | unsigned int port; /* selected I/O port (see below) */ | ||
38 | unsigned int avail_ports; /* available I/O ports (see below) */ | ||
39 | unsigned int _xxx[2]; /* Reserved for future use */ | ||
40 | |||
41 | unsigned int buffer_size; /* I/O buffer size */ | ||
42 | |||
43 | /* | ||
44 | * The following values describe driver state | ||
45 | */ | ||
46 | unsigned int samples; /* number of samples converted */ | ||
47 | unsigned int eof; /* End Of File counter (play only) */ | ||
48 | |||
49 | unsigned char pause; /* non-zero for pause, zero to resume */ | ||
50 | unsigned char error; /* non-zero if overflow/underflow */ | ||
51 | unsigned char waiting; /* non-zero if a process wants access */ | ||
52 | unsigned char balance; /* stereo channel balance */ | ||
53 | |||
54 | unsigned short minordev; | ||
55 | |||
56 | /* | ||
57 | * The following values are read-only state flags | ||
58 | */ | ||
59 | unsigned char open; /* non-zero if open access permitted */ | ||
60 | unsigned char active; /* non-zero if I/O is active */ | ||
61 | } audio_prinfo_t; | ||
62 | |||
63 | |||
64 | /* | ||
65 | * This structure describes the current state of the audio device. | ||
66 | */ | ||
67 | typedef struct audio_info { | ||
68 | /* | ||
69 | * Per-stream information | ||
70 | */ | ||
71 | audio_prinfo_t play; /* output status information */ | ||
72 | audio_prinfo_t record; /* input status information */ | ||
73 | |||
74 | /* | ||
75 | * Per-unit/channel information | ||
76 | */ | ||
77 | unsigned int monitor_gain; /* input to output mix: 0 - 255 */ | ||
78 | unsigned char output_muted; /* non-zero if output is muted */ | ||
79 | unsigned char _xxx[3]; /* Reserved for future use */ | ||
80 | unsigned int _yyy[3]; /* Reserved for future use */ | ||
81 | } audio_info_t; | ||
82 | |||
83 | |||
84 | /* | ||
85 | * Audio encoding types | ||
86 | */ | ||
87 | #define AUDIO_ENCODING_NONE (0) /* no encoding assigned */ | ||
88 | #define AUDIO_ENCODING_ULAW (1) /* u-law encoding */ | ||
89 | #define AUDIO_ENCODING_ALAW (2) /* A-law encoding */ | ||
90 | #define AUDIO_ENCODING_LINEAR (3) /* Linear PCM encoding */ | ||
91 | #define AUDIO_ENCODING_FLOAT (4) /* IEEE float (-1. <-> +1.) */ | ||
92 | #define AUDIO_ENCODING_DVI (104) /* DVI ADPCM */ | ||
93 | #define AUDIO_ENCODING_LINEAR8 (105) /* 8 bit UNSIGNED */ | ||
94 | #define AUDIO_ENCODING_LINEARLE (106) /* Linear PCM LE encoding */ | ||
95 | |||
96 | /* | ||
97 | * These ranges apply to record, play, and monitor gain values | ||
98 | */ | ||
99 | #define AUDIO_MIN_GAIN (0) /* minimum gain value */ | ||
100 | #define AUDIO_MAX_GAIN (255) /* maximum gain value */ | ||
101 | |||
102 | /* | ||
103 | * These values apply to the balance field to adjust channel gain values | ||
104 | */ | ||
105 | #define AUDIO_LEFT_BALANCE (0) /* left channel only */ | ||
106 | #define AUDIO_MID_BALANCE (32) /* equal left/right channel */ | ||
107 | #define AUDIO_RIGHT_BALANCE (64) /* right channel only */ | ||
108 | #define AUDIO_BALANCE_SHIFT (3) | ||
109 | |||
110 | /* | ||
111 | * Generic minimum/maximum limits for number of channels, both modes | ||
112 | */ | ||
113 | #define AUDIO_MIN_PLAY_CHANNELS (1) | ||
114 | #define AUDIO_MAX_PLAY_CHANNELS (4) | ||
115 | #define AUDIO_MIN_REC_CHANNELS (1) | ||
116 | #define AUDIO_MAX_REC_CHANNELS (4) | ||
117 | |||
118 | /* | ||
119 | * Generic minimum/maximum limits for sample precision | ||
120 | */ | ||
121 | #define AUDIO_MIN_PLAY_PRECISION (8) | ||
122 | #define AUDIO_MAX_PLAY_PRECISION (32) | ||
123 | #define AUDIO_MIN_REC_PRECISION (8) | ||
124 | #define AUDIO_MAX_REC_PRECISION (32) | ||
125 | |||
126 | /* | ||
127 | * Define some convenient names for typical audio ports | ||
128 | */ | ||
129 | /* | ||
130 | * output ports (several may be enabled simultaneously) | ||
131 | */ | ||
132 | #define AUDIO_SPEAKER 0x01 /* output to built-in speaker */ | ||
133 | #define AUDIO_HEADPHONE 0x02 /* output to headphone jack */ | ||
134 | #define AUDIO_LINE_OUT 0x04 /* output to line out */ | ||
135 | |||
136 | /* | ||
137 | * input ports (usually only one at a time) | ||
138 | */ | ||
139 | #define AUDIO_MICROPHONE 0x01 /* input from microphone */ | ||
140 | #define AUDIO_LINE_IN 0x02 /* input from line in */ | ||
141 | #define AUDIO_CD 0x04 /* input from on-board CD inputs */ | ||
142 | #define AUDIO_INTERNAL_CD_IN AUDIO_CD /* input from internal CDROM */ | ||
143 | #define AUDIO_ANALOG_LOOPBACK 0x40 /* input from output */ | ||
144 | |||
145 | |||
146 | /* | ||
147 | * This macro initializes an audio_info structure to 'harmless' values. | ||
148 | * Note that (~0) might not be a harmless value for a flag that was | ||
149 | * a signed int. | ||
150 | */ | ||
151 | #define AUDIO_INITINFO(i) { \ | ||
152 | unsigned int *__x__; \ | ||
153 | for (__x__ = (unsigned int *)(i); \ | ||
154 | (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t)); \ | ||
155 | *__x__++ = ~0); \ | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * These allow testing for what the user wants to set | ||
160 | */ | ||
161 | #define AUD_INITVALUE (~0) | ||
162 | #define Modify(X) ((unsigned int)(X) != AUD_INITVALUE) | ||
163 | #define Modifys(X) ((X) != (unsigned short)AUD_INITVALUE) | ||
164 | #define Modifyc(X) ((X) != (unsigned char)AUD_INITVALUE) | ||
165 | |||
166 | /* | ||
167 | * Parameter for the AUDIO_GETDEV ioctl to determine current | ||
168 | * audio devices. | ||
169 | */ | ||
170 | #define MAX_AUDIO_DEV_LEN (16) | ||
171 | typedef struct audio_device { | ||
172 | char name[MAX_AUDIO_DEV_LEN]; | ||
173 | char version[MAX_AUDIO_DEV_LEN]; | ||
174 | char config[MAX_AUDIO_DEV_LEN]; | ||
175 | } audio_device_t; | ||
176 | |||
177 | |||
178 | /* | ||
179 | * Ioctl calls for the audio device. | ||
180 | */ | ||
181 | |||
182 | /* | ||
183 | * AUDIO_GETINFO retrieves the current state of the audio device. | ||
184 | * | ||
185 | * AUDIO_SETINFO copies all fields of the audio_info structure whose | ||
186 | * values are not set to the initialized value (-1) to the device state. | ||
187 | * It performs an implicit AUDIO_GETINFO to return the new state of the | ||
188 | * device. Note that the record.samples and play.samples fields are set | ||
189 | * to the last value before the AUDIO_SETINFO took effect. This allows | ||
190 | * an application to reset the counters while atomically retrieving the | ||
191 | * last value. | ||
192 | * | ||
193 | * AUDIO_DRAIN suspends the calling process until the write buffers are | ||
194 | * empty. | ||
195 | * | ||
196 | * AUDIO_GETDEV returns a structure of type audio_device_t which contains | ||
197 | * three strings. The string "name" is a short identifying string (for | ||
198 | * example, the SBus Fcode name string), the string "version" identifies | ||
199 | * the current version of the device, and the "config" string identifies | ||
200 | * the specific configuration of the audio stream. All fields are | ||
201 | * device-dependent -- see the device specific manual pages for details. | ||
202 | * | ||
203 | * AUDIO_GETDEV_SUNOS returns a number which is an audio device defined | ||
204 | * herein (making it not too portable) | ||
205 | * | ||
206 | * AUDIO_FLUSH stops all playback and recording, clears all queued buffers, | ||
207 | * resets error counters, and restarts recording and playback as appropriate | ||
208 | * for the current sampling mode. | ||
209 | */ | ||
210 | #define AUDIO_GETINFO _IOR('A', 1, audio_info_t) | ||
211 | #define AUDIO_SETINFO _IOWR('A', 2, audio_info_t) | ||
212 | #define AUDIO_DRAIN _IO('A', 3) | ||
213 | #define AUDIO_GETDEV _IOR('A', 4, audio_device_t) | ||
214 | #define AUDIO_GETDEV_SUNOS _IOR('A', 4, int) | ||
215 | #define AUDIO_FLUSH _IO('A', 5) | ||
216 | |||
217 | /* Define possible audio hardware configurations for | ||
218 | * old SunOS-style AUDIO_GETDEV ioctl */ | ||
219 | #define AUDIO_DEV_UNKNOWN (0) /* not defined */ | ||
220 | #define AUDIO_DEV_AMD (1) /* audioamd device */ | ||
221 | #define AUDIO_DEV_SPEAKERBOX (2) /* dbri device with speakerbox */ | ||
222 | #define AUDIO_DEV_CODEC (3) /* dbri device (internal speaker) */ | ||
223 | #define AUDIO_DEV_CS4231 (5) /* cs4231 device */ | ||
224 | |||
225 | /* | ||
226 | * The following ioctl sets the audio device into an internal loopback mode, | ||
227 | * if the hardware supports this. The argument is TRUE to set loopback, | ||
228 | * FALSE to reset to normal operation. If the hardware does not support | ||
229 | * internal loopback, the ioctl should fail with EINVAL. | ||
230 | * Causes ADC data to be digitally mixed in and sent to the DAC. | ||
231 | */ | ||
232 | #define AUDIO_DIAG_LOOPBACK _IOW('A', 101, int) | ||
233 | |||
234 | #endif /* _AUDIOIO_H_ */ | ||
diff --git a/include/asm-sparc/auxio.h b/include/asm-sparc/auxio.h new file mode 100644 index 000000000000..ee83aefb20dc --- /dev/null +++ b/include/asm-sparc/auxio.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* $Id: auxio.h,v 1.18 1997/11/07 15:01:45 jj Exp $ | ||
2 | * auxio.h: Definitions and code for the Auxiliary I/O register. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | #ifndef _SPARC_AUXIO_H | ||
7 | #define _SPARC_AUXIO_H | ||
8 | |||
9 | #include <asm/system.h> | ||
10 | #include <asm/vaddrs.h> | ||
11 | |||
12 | /* This register is an unsigned char in IO space. It does two things. | ||
13 | * First, it is used to control the front panel LED light on machines | ||
14 | * that have it (good for testing entry points to trap handlers and irq's) | ||
15 | * Secondly, it controls various floppy drive parameters. | ||
16 | */ | ||
17 | #define AUXIO_ORMEIN 0xf0 /* All writes must set these bits. */ | ||
18 | #define AUXIO_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */ | ||
19 | #define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */ | ||
20 | #define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */ | ||
21 | #define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */ | ||
22 | #define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */ | ||
23 | #define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */ | ||
24 | |||
25 | /* Set the following to one, then zero, after doing a pseudo DMA transfer. */ | ||
26 | #define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */ | ||
27 | |||
28 | /* Set the following to zero to eject the floppy. */ | ||
29 | #define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */ | ||
30 | #define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */ | ||
31 | |||
32 | #ifndef __ASSEMBLY__ | ||
33 | |||
34 | /* | ||
35 | * NOTE: these routines are implementation dependent-- | ||
36 | * understand the hardware you are querying! | ||
37 | */ | ||
38 | extern void set_auxio(unsigned char bits_on, unsigned char bits_off); | ||
39 | extern unsigned char get_auxio(void); /* .../asm-sparc/floppy.h */ | ||
40 | |||
41 | /* | ||
42 | * The following routines are provided for driver-compatibility | ||
43 | * with sparc64 (primarily sunlance.c) | ||
44 | */ | ||
45 | |||
46 | #define AUXIO_LTE_ON 1 | ||
47 | #define AUXIO_LTE_OFF 0 | ||
48 | |||
49 | /* auxio_set_lte - Set Link Test Enable (TPE Link Detect) | ||
50 | * | ||
51 | * on - AUXIO_LTE_ON or AUXIO_LTE_OFF | ||
52 | */ | ||
53 | #define auxio_set_lte(on) \ | ||
54 | do { \ | ||
55 | if(on) { \ | ||
56 | set_auxio(AUXIO_LINK_TEST, 0); \ | ||
57 | } else { \ | ||
58 | set_auxio(0, AUXIO_LINK_TEST); \ | ||
59 | } \ | ||
60 | } while (0) | ||
61 | |||
62 | #define AUXIO_LED_ON 1 | ||
63 | #define AUXIO_LED_OFF 0 | ||
64 | |||
65 | /* auxio_set_led - Set system front panel LED | ||
66 | * | ||
67 | * on - AUXIO_LED_ON or AUXIO_LED_OFF | ||
68 | */ | ||
69 | #define auxio_set_led(on) \ | ||
70 | do { \ | ||
71 | if(on) { \ | ||
72 | set_auxio(AUXIO_LED, 0); \ | ||
73 | } else { \ | ||
74 | set_auxio(0, AUXIO_LED); \ | ||
75 | } \ | ||
76 | } while (0) | ||
77 | |||
78 | #endif /* !(__ASSEMBLY__) */ | ||
79 | |||
80 | |||
81 | /* AUXIO2 (Power Off Control) */ | ||
82 | extern __volatile__ unsigned char * auxio_power_register; | ||
83 | |||
84 | #define AUXIO_POWER_DETECT_FAILURE 32 | ||
85 | #define AUXIO_POWER_CLEAR_FAILURE 2 | ||
86 | #define AUXIO_POWER_OFF 1 | ||
87 | |||
88 | |||
89 | #endif /* !(_SPARC_AUXIO_H) */ | ||
diff --git a/include/asm-sparc/bitext.h b/include/asm-sparc/bitext.h new file mode 100644 index 000000000000..297b2f2fcb49 --- /dev/null +++ b/include/asm-sparc/bitext.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * bitext.h: Bit string operations on the sparc, specific to architecture. | ||
3 | * | ||
4 | * Copyright 2002 Pete Zaitcev <zaitcev@yahoo.com> | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_BITEXT_H | ||
8 | #define _SPARC_BITEXT_H | ||
9 | |||
10 | #include <linux/spinlock.h> | ||
11 | |||
12 | struct bit_map { | ||
13 | spinlock_t lock; | ||
14 | unsigned long *map; | ||
15 | int size; | ||
16 | int used; | ||
17 | int last_off; | ||
18 | int last_size; | ||
19 | int first_free; | ||
20 | int num_colors; | ||
21 | }; | ||
22 | |||
23 | extern int bit_map_string_get(struct bit_map *t, int len, int align); | ||
24 | extern void bit_map_clear(struct bit_map *t, int offset, int len); | ||
25 | extern void bit_map_init(struct bit_map *t, unsigned long *map, int size); | ||
26 | |||
27 | #endif /* defined(_SPARC_BITEXT_H) */ | ||
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h new file mode 100644 index 000000000000..bfbd795a0a80 --- /dev/null +++ b/include/asm-sparc/bitops.h | |||
@@ -0,0 +1,537 @@ | |||
1 | /* $Id: bitops.h,v 1.67 2001/11/19 18:36:34 davem Exp $ | ||
2 | * bitops.h: Bit string operations on the Sparc. | ||
3 | * | ||
4 | * Copyright 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | * Copyright 1996 Eddie C. Dost (ecd@skynet.be) | ||
6 | * Copyright 2001 Anton Blanchard (anton@samba.org) | ||
7 | */ | ||
8 | |||
9 | #ifndef _SPARC_BITOPS_H | ||
10 | #define _SPARC_BITOPS_H | ||
11 | |||
12 | #include <linux/compiler.h> | ||
13 | #include <asm/byteorder.h> | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | /* | ||
18 | * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0' | ||
19 | * is in the highest of the four bytes and bit '31' is the high bit | ||
20 | * within the first byte. Sparc is BIG-Endian. Unless noted otherwise | ||
21 | * all bit-ops return 0 if bit was previously clear and != 0 otherwise. | ||
22 | */ | ||
23 | static inline int test_and_set_bit(unsigned long nr, volatile unsigned long *addr) | ||
24 | { | ||
25 | register unsigned long mask asm("g2"); | ||
26 | register unsigned long *ADDR asm("g1"); | ||
27 | register int tmp1 asm("g3"); | ||
28 | register int tmp2 asm("g4"); | ||
29 | register int tmp3 asm("g5"); | ||
30 | register int tmp4 asm("g7"); | ||
31 | |||
32 | ADDR = ((unsigned long *) addr) + (nr >> 5); | ||
33 | mask = 1 << (nr & 31); | ||
34 | |||
35 | __asm__ __volatile__( | ||
36 | "mov %%o7, %%g4\n\t" | ||
37 | "call ___set_bit\n\t" | ||
38 | " add %%o7, 8, %%o7\n" | ||
39 | : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4) | ||
40 | : "0" (mask), "r" (ADDR) | ||
41 | : "memory", "cc"); | ||
42 | |||
43 | return mask != 0; | ||
44 | } | ||
45 | |||
46 | static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | ||
47 | { | ||
48 | register unsigned long mask asm("g2"); | ||
49 | register unsigned long *ADDR asm("g1"); | ||
50 | register int tmp1 asm("g3"); | ||
51 | register int tmp2 asm("g4"); | ||
52 | register int tmp3 asm("g5"); | ||
53 | register int tmp4 asm("g7"); | ||
54 | |||
55 | ADDR = ((unsigned long *) addr) + (nr >> 5); | ||
56 | mask = 1 << (nr & 31); | ||
57 | |||
58 | __asm__ __volatile__( | ||
59 | "mov %%o7, %%g4\n\t" | ||
60 | "call ___set_bit\n\t" | ||
61 | " add %%o7, 8, %%o7\n" | ||
62 | : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4) | ||
63 | : "0" (mask), "r" (ADDR) | ||
64 | : "memory", "cc"); | ||
65 | } | ||
66 | |||
67 | static inline int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr) | ||
68 | { | ||
69 | register unsigned long mask asm("g2"); | ||
70 | register unsigned long *ADDR asm("g1"); | ||
71 | register int tmp1 asm("g3"); | ||
72 | register int tmp2 asm("g4"); | ||
73 | register int tmp3 asm("g5"); | ||
74 | register int tmp4 asm("g7"); | ||
75 | |||
76 | ADDR = ((unsigned long *) addr) + (nr >> 5); | ||
77 | mask = 1 << (nr & 31); | ||
78 | |||
79 | __asm__ __volatile__( | ||
80 | "mov %%o7, %%g4\n\t" | ||
81 | "call ___clear_bit\n\t" | ||
82 | " add %%o7, 8, %%o7\n" | ||
83 | : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4) | ||
84 | : "0" (mask), "r" (ADDR) | ||
85 | : "memory", "cc"); | ||
86 | |||
87 | return mask != 0; | ||
88 | } | ||
89 | |||
90 | static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | ||
91 | { | ||
92 | register unsigned long mask asm("g2"); | ||
93 | register unsigned long *ADDR asm("g1"); | ||
94 | register int tmp1 asm("g3"); | ||
95 | register int tmp2 asm("g4"); | ||
96 | register int tmp3 asm("g5"); | ||
97 | register int tmp4 asm("g7"); | ||
98 | |||
99 | ADDR = ((unsigned long *) addr) + (nr >> 5); | ||
100 | mask = 1 << (nr & 31); | ||
101 | |||
102 | __asm__ __volatile__( | ||
103 | "mov %%o7, %%g4\n\t" | ||
104 | "call ___clear_bit\n\t" | ||
105 | " add %%o7, 8, %%o7\n" | ||
106 | : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4) | ||
107 | : "0" (mask), "r" (ADDR) | ||
108 | : "memory", "cc"); | ||
109 | } | ||
110 | |||
111 | static inline int test_and_change_bit(unsigned long nr, volatile unsigned long *addr) | ||
112 | { | ||
113 | register unsigned long mask asm("g2"); | ||
114 | register unsigned long *ADDR asm("g1"); | ||
115 | register int tmp1 asm("g3"); | ||
116 | register int tmp2 asm("g4"); | ||
117 | register int tmp3 asm("g5"); | ||
118 | register int tmp4 asm("g7"); | ||
119 | |||
120 | ADDR = ((unsigned long *) addr) + (nr >> 5); | ||
121 | mask = 1 << (nr & 31); | ||
122 | |||
123 | __asm__ __volatile__( | ||
124 | "mov %%o7, %%g4\n\t" | ||
125 | "call ___change_bit\n\t" | ||
126 | " add %%o7, 8, %%o7\n" | ||
127 | : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4) | ||
128 | : "0" (mask), "r" (ADDR) | ||
129 | : "memory", "cc"); | ||
130 | |||
131 | return mask != 0; | ||
132 | } | ||
133 | |||
134 | static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | ||
135 | { | ||
136 | register unsigned long mask asm("g2"); | ||
137 | register unsigned long *ADDR asm("g1"); | ||
138 | register int tmp1 asm("g3"); | ||
139 | register int tmp2 asm("g4"); | ||
140 | register int tmp3 asm("g5"); | ||
141 | register int tmp4 asm("g7"); | ||
142 | |||
143 | ADDR = ((unsigned long *) addr) + (nr >> 5); | ||
144 | mask = 1 << (nr & 31); | ||
145 | |||
146 | __asm__ __volatile__( | ||
147 | "mov %%o7, %%g4\n\t" | ||
148 | "call ___change_bit\n\t" | ||
149 | " add %%o7, 8, %%o7\n" | ||
150 | : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4) | ||
151 | : "0" (mask), "r" (ADDR) | ||
152 | : "memory", "cc"); | ||
153 | } | ||
154 | |||
155 | /* | ||
156 | * non-atomic versions | ||
157 | */ | ||
158 | static inline void __set_bit(int nr, volatile unsigned long *addr) | ||
159 | { | ||
160 | unsigned long mask = 1UL << (nr & 0x1f); | ||
161 | unsigned long *p = ((unsigned long *)addr) + (nr >> 5); | ||
162 | |||
163 | *p |= mask; | ||
164 | } | ||
165 | |||
166 | static inline void __clear_bit(int nr, volatile unsigned long *addr) | ||
167 | { | ||
168 | unsigned long mask = 1UL << (nr & 0x1f); | ||
169 | unsigned long *p = ((unsigned long *)addr) + (nr >> 5); | ||
170 | |||
171 | *p &= ~mask; | ||
172 | } | ||
173 | |||
174 | static inline void __change_bit(int nr, volatile unsigned long *addr) | ||
175 | { | ||
176 | unsigned long mask = 1UL << (nr & 0x1f); | ||
177 | unsigned long *p = ((unsigned long *)addr) + (nr >> 5); | ||
178 | |||
179 | *p ^= mask; | ||
180 | } | ||
181 | |||
182 | static inline int __test_and_set_bit(int nr, volatile unsigned long *addr) | ||
183 | { | ||
184 | unsigned long mask = 1UL << (nr & 0x1f); | ||
185 | unsigned long *p = ((unsigned long *)addr) + (nr >> 5); | ||
186 | unsigned long old = *p; | ||
187 | |||
188 | *p = old | mask; | ||
189 | return (old & mask) != 0; | ||
190 | } | ||
191 | |||
192 | static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) | ||
193 | { | ||
194 | unsigned long mask = 1UL << (nr & 0x1f); | ||
195 | unsigned long *p = ((unsigned long *)addr) + (nr >> 5); | ||
196 | unsigned long old = *p; | ||
197 | |||
198 | *p = old & ~mask; | ||
199 | return (old & mask) != 0; | ||
200 | } | ||
201 | |||
202 | static inline int __test_and_change_bit(int nr, volatile unsigned long *addr) | ||
203 | { | ||
204 | unsigned long mask = 1UL << (nr & 0x1f); | ||
205 | unsigned long *p = ((unsigned long *)addr) + (nr >> 5); | ||
206 | unsigned long old = *p; | ||
207 | |||
208 | *p = old ^ mask; | ||
209 | return (old & mask) != 0; | ||
210 | } | ||
211 | |||
212 | #define smp_mb__before_clear_bit() do { } while(0) | ||
213 | #define smp_mb__after_clear_bit() do { } while(0) | ||
214 | |||
215 | /* The following routine need not be atomic. */ | ||
216 | static inline int test_bit(int nr, __const__ volatile unsigned long *addr) | ||
217 | { | ||
218 | return (1UL & (((unsigned long *)addr)[nr >> 5] >> (nr & 31))) != 0UL; | ||
219 | } | ||
220 | |||
221 | /* The easy/cheese version for now. */ | ||
222 | static inline unsigned long ffz(unsigned long word) | ||
223 | { | ||
224 | unsigned long result = 0; | ||
225 | |||
226 | while(word & 1) { | ||
227 | result++; | ||
228 | word >>= 1; | ||
229 | } | ||
230 | return result; | ||
231 | } | ||
232 | |||
233 | /** | ||
234 | * __ffs - find first bit in word. | ||
235 | * @word: The word to search | ||
236 | * | ||
237 | * Undefined if no bit exists, so code should check against 0 first. | ||
238 | */ | ||
239 | static inline int __ffs(unsigned long word) | ||
240 | { | ||
241 | int num = 0; | ||
242 | |||
243 | if ((word & 0xffff) == 0) { | ||
244 | num += 16; | ||
245 | word >>= 16; | ||
246 | } | ||
247 | if ((word & 0xff) == 0) { | ||
248 | num += 8; | ||
249 | word >>= 8; | ||
250 | } | ||
251 | if ((word & 0xf) == 0) { | ||
252 | num += 4; | ||
253 | word >>= 4; | ||
254 | } | ||
255 | if ((word & 0x3) == 0) { | ||
256 | num += 2; | ||
257 | word >>= 2; | ||
258 | } | ||
259 | if ((word & 0x1) == 0) | ||
260 | num += 1; | ||
261 | return num; | ||
262 | } | ||
263 | |||
264 | /* | ||
265 | * Every architecture must define this function. It's the fastest | ||
266 | * way of searching a 140-bit bitmap where the first 100 bits are | ||
267 | * unlikely to be set. It's guaranteed that at least one of the 140 | ||
268 | * bits is cleared. | ||
269 | */ | ||
270 | static inline int sched_find_first_bit(unsigned long *b) | ||
271 | { | ||
272 | |||
273 | if (unlikely(b[0])) | ||
274 | return __ffs(b[0]); | ||
275 | if (unlikely(b[1])) | ||
276 | return __ffs(b[1]) + 32; | ||
277 | if (unlikely(b[2])) | ||
278 | return __ffs(b[2]) + 64; | ||
279 | if (b[3]) | ||
280 | return __ffs(b[3]) + 96; | ||
281 | return __ffs(b[4]) + 128; | ||
282 | } | ||
283 | |||
284 | /* | ||
285 | * ffs: find first bit set. This is defined the same way as | ||
286 | * the libc and compiler builtin ffs routines, therefore | ||
287 | * differs in spirit from the above ffz (man ffs). | ||
288 | */ | ||
289 | static inline int ffs(int x) | ||
290 | { | ||
291 | if (!x) | ||
292 | return 0; | ||
293 | return __ffs((unsigned long)x) + 1; | ||
294 | } | ||
295 | |||
296 | /* | ||
297 | * fls: find last (most-significant) bit set. | ||
298 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. | ||
299 | */ | ||
300 | #define fls(x) generic_fls(x) | ||
301 | |||
302 | /* | ||
303 | * hweightN: returns the hamming weight (i.e. the number | ||
304 | * of bits set) of a N-bit word | ||
305 | */ | ||
306 | #define hweight32(x) generic_hweight32(x) | ||
307 | #define hweight16(x) generic_hweight16(x) | ||
308 | #define hweight8(x) generic_hweight8(x) | ||
309 | |||
310 | /* | ||
311 | * find_next_zero_bit() finds the first zero bit in a bit string of length | ||
312 | * 'size' bits, starting the search at bit 'offset'. This is largely based | ||
313 | * on Linus's ALPHA routines, which are pretty portable BTW. | ||
314 | */ | ||
315 | static inline unsigned long find_next_zero_bit(const unsigned long *addr, | ||
316 | unsigned long size, unsigned long offset) | ||
317 | { | ||
318 | const unsigned long *p = addr + (offset >> 5); | ||
319 | unsigned long result = offset & ~31UL; | ||
320 | unsigned long tmp; | ||
321 | |||
322 | if (offset >= size) | ||
323 | return size; | ||
324 | size -= result; | ||
325 | offset &= 31UL; | ||
326 | if (offset) { | ||
327 | tmp = *(p++); | ||
328 | tmp |= ~0UL >> (32-offset); | ||
329 | if (size < 32) | ||
330 | goto found_first; | ||
331 | if (~tmp) | ||
332 | goto found_middle; | ||
333 | size -= 32; | ||
334 | result += 32; | ||
335 | } | ||
336 | while (size & ~31UL) { | ||
337 | if (~(tmp = *(p++))) | ||
338 | goto found_middle; | ||
339 | result += 32; | ||
340 | size -= 32; | ||
341 | } | ||
342 | if (!size) | ||
343 | return result; | ||
344 | tmp = *p; | ||
345 | |||
346 | found_first: | ||
347 | tmp |= ~0UL << size; | ||
348 | if (tmp == ~0UL) /* Are any bits zero? */ | ||
349 | return result + size; /* Nope. */ | ||
350 | found_middle: | ||
351 | return result + ffz(tmp); | ||
352 | } | ||
353 | |||
354 | /* | ||
355 | * Linus sez that gcc can optimize the following correctly, we'll see if this | ||
356 | * holds on the Sparc as it does for the ALPHA. | ||
357 | */ | ||
358 | #define find_first_zero_bit(addr, size) \ | ||
359 | find_next_zero_bit((addr), (size), 0) | ||
360 | |||
361 | /** | ||
362 | * find_next_bit - find the first set bit in a memory region | ||
363 | * @addr: The address to base the search on | ||
364 | * @offset: The bitnumber to start searching at | ||
365 | * @size: The maximum size to search | ||
366 | * | ||
367 | * Scheduler induced bitop, do not use. | ||
368 | */ | ||
369 | static inline int find_next_bit(const unsigned long *addr, int size, int offset) | ||
370 | { | ||
371 | const unsigned long *p = addr + (offset >> 5); | ||
372 | int num = offset & ~0x1f; | ||
373 | unsigned long word; | ||
374 | |||
375 | word = *p++; | ||
376 | word &= ~((1 << (offset & 0x1f)) - 1); | ||
377 | while (num < size) { | ||
378 | if (word != 0) { | ||
379 | return __ffs(word) + num; | ||
380 | } | ||
381 | word = *p++; | ||
382 | num += 0x20; | ||
383 | } | ||
384 | return num; | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * find_first_bit - find the first set bit in a memory region | ||
389 | * @addr: The address to start the search at | ||
390 | * @size: The maximum size to search | ||
391 | * | ||
392 | * Returns the bit-number of the first set bit, not the number of the byte | ||
393 | * containing a bit. | ||
394 | */ | ||
395 | #define find_first_bit(addr, size) \ | ||
396 | find_next_bit((addr), (size), 0) | ||
397 | |||
398 | /* | ||
399 | */ | ||
400 | static inline int test_le_bit(int nr, __const__ unsigned long * addr) | ||
401 | { | ||
402 | __const__ unsigned char *ADDR = (__const__ unsigned char *) addr; | ||
403 | return (ADDR[nr >> 3] >> (nr & 7)) & 1; | ||
404 | } | ||
405 | |||
406 | /* | ||
407 | * non-atomic versions | ||
408 | */ | ||
409 | static inline void __set_le_bit(int nr, unsigned long *addr) | ||
410 | { | ||
411 | unsigned char *ADDR = (unsigned char *)addr; | ||
412 | |||
413 | ADDR += nr >> 3; | ||
414 | *ADDR |= 1 << (nr & 0x07); | ||
415 | } | ||
416 | |||
417 | static inline void __clear_le_bit(int nr, unsigned long *addr) | ||
418 | { | ||
419 | unsigned char *ADDR = (unsigned char *)addr; | ||
420 | |||
421 | ADDR += nr >> 3; | ||
422 | *ADDR &= ~(1 << (nr & 0x07)); | ||
423 | } | ||
424 | |||
425 | static inline int __test_and_set_le_bit(int nr, unsigned long *addr) | ||
426 | { | ||
427 | int mask, retval; | ||
428 | unsigned char *ADDR = (unsigned char *)addr; | ||
429 | |||
430 | ADDR += nr >> 3; | ||
431 | mask = 1 << (nr & 0x07); | ||
432 | retval = (mask & *ADDR) != 0; | ||
433 | *ADDR |= mask; | ||
434 | return retval; | ||
435 | } | ||
436 | |||
437 | static inline int __test_and_clear_le_bit(int nr, unsigned long *addr) | ||
438 | { | ||
439 | int mask, retval; | ||
440 | unsigned char *ADDR = (unsigned char *)addr; | ||
441 | |||
442 | ADDR += nr >> 3; | ||
443 | mask = 1 << (nr & 0x07); | ||
444 | retval = (mask & *ADDR) != 0; | ||
445 | *ADDR &= ~mask; | ||
446 | return retval; | ||
447 | } | ||
448 | |||
449 | static inline unsigned long find_next_zero_le_bit(const unsigned long *addr, | ||
450 | unsigned long size, unsigned long offset) | ||
451 | { | ||
452 | const unsigned long *p = addr + (offset >> 5); | ||
453 | unsigned long result = offset & ~31UL; | ||
454 | unsigned long tmp; | ||
455 | |||
456 | if (offset >= size) | ||
457 | return size; | ||
458 | size -= result; | ||
459 | offset &= 31UL; | ||
460 | if(offset) { | ||
461 | tmp = *(p++); | ||
462 | tmp |= __swab32(~0UL >> (32-offset)); | ||
463 | if(size < 32) | ||
464 | goto found_first; | ||
465 | if(~tmp) | ||
466 | goto found_middle; | ||
467 | size -= 32; | ||
468 | result += 32; | ||
469 | } | ||
470 | while(size & ~31UL) { | ||
471 | if(~(tmp = *(p++))) | ||
472 | goto found_middle; | ||
473 | result += 32; | ||
474 | size -= 32; | ||
475 | } | ||
476 | if(!size) | ||
477 | return result; | ||
478 | tmp = *p; | ||
479 | |||
480 | found_first: | ||
481 | tmp = __swab32(tmp) | (~0UL << size); | ||
482 | if (tmp == ~0UL) /* Are any bits zero? */ | ||
483 | return result + size; /* Nope. */ | ||
484 | return result + ffz(tmp); | ||
485 | |||
486 | found_middle: | ||
487 | return result + ffz(__swab32(tmp)); | ||
488 | } | ||
489 | |||
490 | #define find_first_zero_le_bit(addr, size) \ | ||
491 | find_next_zero_le_bit((addr), (size), 0) | ||
492 | |||
493 | #define ext2_set_bit(nr,addr) \ | ||
494 | __test_and_set_le_bit((nr),(unsigned long *)(addr)) | ||
495 | #define ext2_clear_bit(nr,addr) \ | ||
496 | __test_and_clear_le_bit((nr),(unsigned long *)(addr)) | ||
497 | |||
498 | #define ext2_set_bit_atomic(lock, nr, addr) \ | ||
499 | ({ \ | ||
500 | int ret; \ | ||
501 | spin_lock(lock); \ | ||
502 | ret = ext2_set_bit((nr), (unsigned long *)(addr)); \ | ||
503 | spin_unlock(lock); \ | ||
504 | ret; \ | ||
505 | }) | ||
506 | |||
507 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | ||
508 | ({ \ | ||
509 | int ret; \ | ||
510 | spin_lock(lock); \ | ||
511 | ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \ | ||
512 | spin_unlock(lock); \ | ||
513 | ret; \ | ||
514 | }) | ||
515 | |||
516 | #define ext2_test_bit(nr,addr) \ | ||
517 | test_le_bit((nr),(unsigned long *)(addr)) | ||
518 | #define ext2_find_first_zero_bit(addr, size) \ | ||
519 | find_first_zero_le_bit((unsigned long *)(addr), (size)) | ||
520 | #define ext2_find_next_zero_bit(addr, size, off) \ | ||
521 | find_next_zero_le_bit((unsigned long *)(addr), (size), (off)) | ||
522 | |||
523 | /* Bitmap functions for the minix filesystem. */ | ||
524 | #define minix_test_and_set_bit(nr,addr) \ | ||
525 | test_and_set_bit((nr),(unsigned long *)(addr)) | ||
526 | #define minix_set_bit(nr,addr) \ | ||
527 | set_bit((nr),(unsigned long *)(addr)) | ||
528 | #define minix_test_and_clear_bit(nr,addr) \ | ||
529 | test_and_clear_bit((nr),(unsigned long *)(addr)) | ||
530 | #define minix_test_bit(nr,addr) \ | ||
531 | test_bit((nr),(unsigned long *)(addr)) | ||
532 | #define minix_find_first_zero_bit(addr,size) \ | ||
533 | find_first_zero_bit((unsigned long *)(addr),(size)) | ||
534 | |||
535 | #endif /* __KERNEL__ */ | ||
536 | |||
537 | #endif /* defined(_SPARC_BITOPS_H) */ | ||
diff --git a/include/asm-sparc/bpp.h b/include/asm-sparc/bpp.h new file mode 100644 index 000000000000..3578ac113cf0 --- /dev/null +++ b/include/asm-sparc/bpp.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #ifndef _SPARC_BPP_H | ||
2 | #define _SPARC_BPP_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (c) 1995 Picture Elements | ||
6 | * Stephen Williams | ||
7 | * Gus Baldauf | ||
8 | * | ||
9 | * Linux/SPARC port by Peter Zaitcev. | ||
10 | * Integration into SPARC tree by Tom Dyas. | ||
11 | */ | ||
12 | |||
13 | #include <linux/ioctl.h> | ||
14 | |||
15 | /* | ||
16 | * This is a driver that supports IEEE Std 1284-1994 communications | ||
17 | * with compliant or compatible devices. It will use whatever features | ||
18 | * the device supports, prefering those that are typically faster. | ||
19 | * | ||
20 | * When the device is opened, it is left in COMPATABILITY mode, and | ||
21 | * writes work like any printer device. The driver only attempt to | ||
22 | * negotiate 1284 modes when needed so that plugs can be pulled, | ||
23 | * switch boxes switched, etc., without disrupting things. It will | ||
24 | * also leave the device in compatibility mode when closed. | ||
25 | */ | ||
26 | |||
27 | |||
28 | |||
29 | /* | ||
30 | * This driver also supplies ioctls to manually manipulate the | ||
31 | * pins. This is great for testing devices, or writing code to deal | ||
32 | * with bizzarro-mode of the ACME Special TurboThingy Plus. | ||
33 | * | ||
34 | * NOTE: These ioctl currently do not interact well with | ||
35 | * read/write. Caveat emptor. | ||
36 | * | ||
37 | * PUT_PINS allows us to assign the sense of all the pins, including | ||
38 | * the data pins if being driven by the host. The GET_PINS returns the | ||
39 | * pins that the peripheral drives, including data if appropriate. | ||
40 | */ | ||
41 | |||
42 | # define BPP_PUT_PINS _IOW('B', 1, int) | ||
43 | # define BPP_GET_PINS _IOR('B', 2, char) /* that's bogus - should've been _IO */ | ||
44 | # define BPP_PUT_DATA _IOW('B', 3, int) | ||
45 | # define BPP_GET_DATA _IOR('B', 4, char) /* ditto */ | ||
46 | |||
47 | /* | ||
48 | * Set the data bus to input mode. Disengage the data bin driver and | ||
49 | * be prepared to read values from the peripheral. If the arg is 0, | ||
50 | * then revert the bus to output mode. | ||
51 | */ | ||
52 | # define BPP_SET_INPUT _IOW('B', 5, int) | ||
53 | |||
54 | /* | ||
55 | * These bits apply to the PUT operation... | ||
56 | */ | ||
57 | # define BPP_PP_nStrobe 0x0001 | ||
58 | # define BPP_PP_nAutoFd 0x0002 | ||
59 | # define BPP_PP_nInit 0x0004 | ||
60 | # define BPP_PP_nSelectIn 0x0008 | ||
61 | |||
62 | /* | ||
63 | * These apply to the GET operation, which also reads the current value | ||
64 | * of the previously put values. A bit mask of these will be returned | ||
65 | * as a bit mask in the return code of the ioctl(). | ||
66 | */ | ||
67 | # define BPP_GP_nAck 0x0100 | ||
68 | # define BPP_GP_Busy 0x0200 | ||
69 | # define BPP_GP_PError 0x0400 | ||
70 | # define BPP_GP_Select 0x0800 | ||
71 | # define BPP_GP_nFault 0x1000 | ||
72 | |||
73 | #endif | ||
diff --git a/include/asm-sparc/bsderrno.h b/include/asm-sparc/bsderrno.h new file mode 100644 index 000000000000..54a75be43abb --- /dev/null +++ b/include/asm-sparc/bsderrno.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* $Id: bsderrno.h,v 1.3 1996/04/25 06:12:47 davem Exp $ | ||
2 | * bsderrno.h: Error numbers for NetBSD binary compatibility | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_BSDERRNO_H | ||
8 | #define _SPARC_BSDERRNO_H | ||
9 | |||
10 | #define BSD_EPERM 1 /* Operation not permitted */ | ||
11 | #define BSD_ENOENT 2 /* No such file or directory */ | ||
12 | #define BSD_ESRCH 3 /* No such process */ | ||
13 | #define BSD_EINTR 4 /* Interrupted system call */ | ||
14 | #define BSD_EIO 5 /* Input/output error */ | ||
15 | #define BSD_ENXIO 6 /* Device not configured */ | ||
16 | #define BSD_E2BIG 7 /* Argument list too long */ | ||
17 | #define BSD_ENOEXEC 8 /* Exec format error */ | ||
18 | #define BSD_EBADF 9 /* Bad file descriptor */ | ||
19 | #define BSD_ECHILD 10 /* No child processes */ | ||
20 | #define BSD_EDEADLK 11 /* Resource deadlock avoided */ | ||
21 | #define BSD_ENOMEM 12 /* Cannot allocate memory */ | ||
22 | #define BSD_EACCES 13 /* Permission denied */ | ||
23 | #define BSD_EFAULT 14 /* Bad address */ | ||
24 | #define BSD_ENOTBLK 15 /* Block device required */ | ||
25 | #define BSD_EBUSY 16 /* Device busy */ | ||
26 | #define BSD_EEXIST 17 /* File exists */ | ||
27 | #define BSD_EXDEV 18 /* Cross-device link */ | ||
28 | #define BSD_ENODEV 19 /* Operation not supported by device */ | ||
29 | #define BSD_ENOTDIR 20 /* Not a directory */ | ||
30 | #define BSD_EISDIR 21 /* Is a directory */ | ||
31 | #define BSD_EINVAL 22 /* Invalid argument */ | ||
32 | #define BSD_ENFILE 23 /* Too many open files in system */ | ||
33 | #define BSD_EMFILE 24 /* Too many open files */ | ||
34 | #define BSD_ENOTTY 25 /* Inappropriate ioctl for device */ | ||
35 | #define BSD_ETXTBSY 26 /* Text file busy */ | ||
36 | #define BSD_EFBIG 27 /* File too large */ | ||
37 | #define BSD_ENOSPC 28 /* No space left on device */ | ||
38 | #define BSD_ESPIPE 29 /* Illegal seek */ | ||
39 | #define BSD_EROFS 30 /* Read-only file system */ | ||
40 | #define BSD_EMLINK 31 /* Too many links */ | ||
41 | #define BSD_EPIPE 32 /* Broken pipe */ | ||
42 | #define BSD_EDOM 33 /* Numerical argument out of domain */ | ||
43 | #define BSD_ERANGE 34 /* Result too large */ | ||
44 | #define BSD_EAGAIN 35 /* Resource temporarily unavailable */ | ||
45 | #define BSD_EWOULDBLOCK EAGAIN /* Operation would block */ | ||
46 | #define BSD_EINPROGRESS 36 /* Operation now in progress */ | ||
47 | #define BSD_EALREADY 37 /* Operation already in progress */ | ||
48 | #define BSD_ENOTSOCK 38 /* Socket operation on non-socket */ | ||
49 | #define BSD_EDESTADDRREQ 39 /* Destination address required */ | ||
50 | #define BSD_EMSGSIZE 40 /* Message too long */ | ||
51 | #define BSD_EPROTOTYPE 41 /* Protocol wrong type for socket */ | ||
52 | #define BSD_ENOPROTOOPT 42 /* Protocol not available */ | ||
53 | #define BSD_EPROTONOSUPPORT 43 /* Protocol not supported */ | ||
54 | #define BSD_ESOCKTNOSUPPORT 44 /* Socket type not supported */ | ||
55 | #define BSD_EOPNOTSUPP 45 /* Operation not supported */ | ||
56 | #define BSD_EPFNOSUPPORT 46 /* Protocol family not supported */ | ||
57 | #define BSD_EAFNOSUPPORT 47 /* Address family not supported by protocol family */ | ||
58 | #define BSD_EADDRINUSE 48 /* Address already in use */ | ||
59 | #define BSD_EADDRNOTAVAIL 49 /* Can't assign requested address */ | ||
60 | #define BSD_ENETDOWN 50 /* Network is down */ | ||
61 | #define BSD_ENETUNREACH 51 /* Network is unreachable */ | ||
62 | #define BSD_ENETRESET 52 /* Network dropped connection on reset */ | ||
63 | #define BSD_ECONNABORTED 53 /* Software caused connection abort */ | ||
64 | #define BSD_ECONNRESET 54 /* Connection reset by peer */ | ||
65 | #define BSD_ENOBUFS 55 /* No buffer space available */ | ||
66 | #define BSD_EISCONN 56 /* Socket is already connected */ | ||
67 | #define BSD_ENOTCONN 57 /* Socket is not connected */ | ||
68 | #define BSD_ESHUTDOWN 58 /* Can't send after socket shutdown */ | ||
69 | #define BSD_ETOOMANYREFS 59 /* Too many references: can't splice */ | ||
70 | #define BSD_ETIMEDOUT 60 /* Operation timed out */ | ||
71 | #define BSD_ECONNREFUSED 61 /* Connection refused */ | ||
72 | #define BSD_ELOOP 62 /* Too many levels of symbolic links */ | ||
73 | #define BSD_ENAMETOOLONG 63 /* File name too long */ | ||
74 | #define BSD_EHOSTDOWN 64 /* Host is down */ | ||
75 | #define BSD_EHOSTUNREACH 65 /* No route to host */ | ||
76 | #define BSD_ENOTEMPTY 66 /* Directory not empty */ | ||
77 | #define BSD_EPROCLIM 67 /* Too many processes */ | ||
78 | #define BSD_EUSERS 68 /* Too many users */ | ||
79 | #define BSD_EDQUOT 69 /* Disc quota exceeded */ | ||
80 | #define BSD_ESTALE 70 /* Stale NFS file handle */ | ||
81 | #define BSD_EREMOTE 71 /* Too many levels of remote in path */ | ||
82 | #define BSD_EBADRPC 72 /* RPC struct is bad */ | ||
83 | #define BSD_ERPCMISMATCH 73 /* RPC version wrong */ | ||
84 | #define BSD_EPROGUNAVAIL 74 /* RPC prog. not avail */ | ||
85 | #define BSD_EPROGMISMATCH 75 /* Program version wrong */ | ||
86 | #define BSD_EPROCUNAVAIL 76 /* Bad procedure for program */ | ||
87 | #define BSD_ENOLCK 77 /* No locks available */ | ||
88 | #define BSD_ENOSYS 78 /* Function not implemented */ | ||
89 | #define BSD_EFTYPE 79 /* Inappropriate file type or format */ | ||
90 | #define BSD_EAUTH 80 /* Authentication error */ | ||
91 | #define BSD_ENEEDAUTH 81 /* Need authenticator */ | ||
92 | #define BSD_ELAST 81 /* Must be equal largest errno */ | ||
93 | |||
94 | #endif /* !(_SPARC_BSDERRNO_H) */ | ||
diff --git a/include/asm-sparc/btfixup.h b/include/asm-sparc/btfixup.h new file mode 100644 index 000000000000..b84c96c89581 --- /dev/null +++ b/include/asm-sparc/btfixup.h | |||
@@ -0,0 +1,208 @@ | |||
1 | /* $Id: btfixup.h,v 1.4 1998/03/09 14:04:43 jj Exp $ | ||
2 | * asm-sparc/btfixup.h: Macros for boot time linking. | ||
3 | * | ||
4 | * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_BTFIXUP_H | ||
8 | #define _SPARC_BTFIXUP_H | ||
9 | |||
10 | #include <linux/init.h> | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | #ifdef MODULE | ||
15 | extern unsigned int ___illegal_use_of_BTFIXUP_SIMM13_in_module(void); | ||
16 | extern unsigned int ___illegal_use_of_BTFIXUP_SETHI_in_module(void); | ||
17 | extern unsigned int ___illegal_use_of_BTFIXUP_HALF_in_module(void); | ||
18 | extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void); | ||
19 | |||
20 | #define BTFIXUP_SIMM13(__name) ___illegal_use_of_BTFIXUP_SIMM13_in_module() | ||
21 | #define BTFIXUP_HALF(__name) ___illegal_use_of_BTFIXUP_HALF_in_module() | ||
22 | #define BTFIXUP_SETHI(__name) ___illegal_use_of_BTFIXUP_SETHI_in_module() | ||
23 | #define BTFIXUP_INT(__name) ___illegal_use_of_BTFIXUP_INT_in_module() | ||
24 | #define BTFIXUP_BLACKBOX(__name) ___illegal_use_of_BTFIXUP_BLACKBOX_in_module | ||
25 | |||
26 | #else | ||
27 | |||
28 | #define BTFIXUP_SIMM13(__name) ___sf_##__name() | ||
29 | #define BTFIXUP_HALF(__name) ___af_##__name() | ||
30 | #define BTFIXUP_SETHI(__name) ___hf_##__name() | ||
31 | #define BTFIXUP_INT(__name) ((unsigned int)&___i_##__name) | ||
32 | /* This must be written in assembly and present in a sethi */ | ||
33 | #define BTFIXUP_BLACKBOX(__name) ___b_##__name | ||
34 | #endif /* MODULE */ | ||
35 | |||
36 | /* Fixup call xx */ | ||
37 | |||
38 | #define BTFIXUPDEF_CALL(__type, __name, __args...) \ | ||
39 | extern __type ___f_##__name(__args); \ | ||
40 | extern unsigned ___fs_##__name[3]; | ||
41 | #define BTFIXUPDEF_CALL_CONST(__type, __name, __args...) \ | ||
42 | extern __type ___f_##__name(__args) __attribute_const__; \ | ||
43 | extern unsigned ___fs_##__name[3]; | ||
44 | #define BTFIXUP_CALL(__name) ___f_##__name | ||
45 | |||
46 | #define BTFIXUPDEF_BLACKBOX(__name) \ | ||
47 | extern unsigned ___bs_##__name[2]; | ||
48 | |||
49 | /* Put bottom 13bits into some register variable */ | ||
50 | |||
51 | #define BTFIXUPDEF_SIMM13(__name) \ | ||
52 | extern unsigned int ___sf_##__name(void) __attribute_const__; \ | ||
53 | extern unsigned ___ss_##__name[2]; \ | ||
54 | extern __inline__ unsigned int ___sf_##__name(void) { \ | ||
55 | unsigned int ret; \ | ||
56 | __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \ | ||
57 | return ret; \ | ||
58 | } | ||
59 | #define BTFIXUPDEF_SIMM13_INIT(__name,__val) \ | ||
60 | extern unsigned int ___sf_##__name(void) __attribute_const__; \ | ||
61 | extern unsigned ___ss_##__name[2]; \ | ||
62 | extern __inline__ unsigned int ___sf_##__name(void) { \ | ||
63 | unsigned int ret; \ | ||
64 | __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ | ||
65 | return ret; \ | ||
66 | } | ||
67 | |||
68 | /* Put either bottom 13 bits, or upper 22 bits into some register variable | ||
69 | * (depending on the value, this will lead into sethi FIX, reg; or | ||
70 | * mov FIX, reg; ) | ||
71 | */ | ||
72 | |||
73 | #define BTFIXUPDEF_HALF(__name) \ | ||
74 | extern unsigned int ___af_##__name(void) __attribute_const__; \ | ||
75 | extern unsigned ___as_##__name[2]; \ | ||
76 | extern __inline__ unsigned int ___af_##__name(void) { \ | ||
77 | unsigned int ret; \ | ||
78 | __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \ | ||
79 | return ret; \ | ||
80 | } | ||
81 | #define BTFIXUPDEF_HALF_INIT(__name,__val) \ | ||
82 | extern unsigned int ___af_##__name(void) __attribute_const__; \ | ||
83 | extern unsigned ___as_##__name[2]; \ | ||
84 | extern __inline__ unsigned int ___af_##__name(void) { \ | ||
85 | unsigned int ret; \ | ||
86 | __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ | ||
87 | return ret; \ | ||
88 | } | ||
89 | |||
90 | /* Put upper 22 bits into some register variable */ | ||
91 | |||
92 | #define BTFIXUPDEF_SETHI(__name) \ | ||
93 | extern unsigned int ___hf_##__name(void) __attribute_const__; \ | ||
94 | extern unsigned ___hs_##__name[2]; \ | ||
95 | extern __inline__ unsigned int ___hf_##__name(void) { \ | ||
96 | unsigned int ret; \ | ||
97 | __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \ | ||
98 | return ret; \ | ||
99 | } | ||
100 | #define BTFIXUPDEF_SETHI_INIT(__name,__val) \ | ||
101 | extern unsigned int ___hf_##__name(void) __attribute_const__; \ | ||
102 | extern unsigned ___hs_##__name[2]; \ | ||
103 | extern __inline__ unsigned int ___hf_##__name(void) { \ | ||
104 | unsigned int ret; \ | ||
105 | __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \ | ||
106 | "=r"(ret)); \ | ||
107 | return ret; \ | ||
108 | } | ||
109 | |||
110 | /* Put a full 32bit integer into some register variable */ | ||
111 | |||
112 | #define BTFIXUPDEF_INT(__name) \ | ||
113 | extern unsigned char ___i_##__name; \ | ||
114 | extern unsigned ___is_##__name[2]; | ||
115 | |||
116 | #define BTFIXUPCALL_NORM 0x00000000 /* Always call */ | ||
117 | #define BTFIXUPCALL_NOP 0x01000000 /* Possibly optimize to nop */ | ||
118 | #define BTFIXUPCALL_RETINT(i) (0x90102000|((i) & 0x1fff)) /* Possibly optimize to mov i, %o0 */ | ||
119 | #define BTFIXUPCALL_ORINT(i) (0x90122000|((i) & 0x1fff)) /* Possibly optimize to or %o0, i, %o0 */ | ||
120 | #define BTFIXUPCALL_RETO0 0x01000000 /* Return first parameter, actually a nop */ | ||
121 | #define BTFIXUPCALL_ANDNINT(i) (0x902a2000|((i) & 0x1fff)) /* Possibly optimize to andn %o0, i, %o0 */ | ||
122 | #define BTFIXUPCALL_SWAPO0O1 0xd27a0000 /* Possibly optimize to swap [%o0],%o1 */ | ||
123 | #define BTFIXUPCALL_SWAPO0G0 0xc07a0000 /* Possibly optimize to swap [%o0],%g0 */ | ||
124 | #define BTFIXUPCALL_SWAPG1G2 0xc4784000 /* Possibly optimize to swap [%g1],%g2 */ | ||
125 | #define BTFIXUPCALL_STG0O0 0xc0220000 /* Possibly optimize to st %g0,[%o0] */ | ||
126 | #define BTFIXUPCALL_STO1O0 0xd2220000 /* Possibly optimize to st %o1,[%o0] */ | ||
127 | |||
128 | #define BTFIXUPSET_CALL(__name, __addr, __insn) \ | ||
129 | do { \ | ||
130 | ___fs_##__name[0] |= 1; \ | ||
131 | ___fs_##__name[1] = (unsigned long)__addr; \ | ||
132 | ___fs_##__name[2] = __insn; \ | ||
133 | } while (0) | ||
134 | |||
135 | #define BTFIXUPSET_BLACKBOX(__name, __func) \ | ||
136 | do { \ | ||
137 | ___bs_##__name[0] |= 1; \ | ||
138 | ___bs_##__name[1] = (unsigned long)__func; \ | ||
139 | } while (0) | ||
140 | |||
141 | #define BTFIXUPCOPY_CALL(__name, __from) \ | ||
142 | do { \ | ||
143 | ___fs_##__name[0] |= 1; \ | ||
144 | ___fs_##__name[1] = ___fs_##__from[1]; \ | ||
145 | ___fs_##__name[2] = ___fs_##__from[2]; \ | ||
146 | } while (0) | ||
147 | |||
148 | #define BTFIXUPSET_SIMM13(__name, __val) \ | ||
149 | do { \ | ||
150 | ___ss_##__name[0] |= 1; \ | ||
151 | ___ss_##__name[1] = (unsigned)__val; \ | ||
152 | } while (0) | ||
153 | |||
154 | #define BTFIXUPCOPY_SIMM13(__name, __from) \ | ||
155 | do { \ | ||
156 | ___ss_##__name[0] |= 1; \ | ||
157 | ___ss_##__name[1] = ___ss_##__from[1]; \ | ||
158 | } while (0) | ||
159 | |||
160 | #define BTFIXUPSET_HALF(__name, __val) \ | ||
161 | do { \ | ||
162 | ___as_##__name[0] |= 1; \ | ||
163 | ___as_##__name[1] = (unsigned)__val; \ | ||
164 | } while (0) | ||
165 | |||
166 | #define BTFIXUPCOPY_HALF(__name, __from) \ | ||
167 | do { \ | ||
168 | ___as_##__name[0] |= 1; \ | ||
169 | ___as_##__name[1] = ___as_##__from[1]; \ | ||
170 | } while (0) | ||
171 | |||
172 | #define BTFIXUPSET_SETHI(__name, __val) \ | ||
173 | do { \ | ||
174 | ___hs_##__name[0] |= 1; \ | ||
175 | ___hs_##__name[1] = (unsigned)__val; \ | ||
176 | } while (0) | ||
177 | |||
178 | #define BTFIXUPCOPY_SETHI(__name, __from) \ | ||
179 | do { \ | ||
180 | ___hs_##__name[0] |= 1; \ | ||
181 | ___hs_##__name[1] = ___hs_##__from[1]; \ | ||
182 | } while (0) | ||
183 | |||
184 | #define BTFIXUPSET_INT(__name, __val) \ | ||
185 | do { \ | ||
186 | ___is_##__name[0] |= 1; \ | ||
187 | ___is_##__name[1] = (unsigned)__val; \ | ||
188 | } while (0) | ||
189 | |||
190 | #define BTFIXUPCOPY_INT(__name, __from) \ | ||
191 | do { \ | ||
192 | ___is_##__name[0] |= 1; \ | ||
193 | ___is_##__name[1] = ___is_##__from[1]; \ | ||
194 | } while (0) | ||
195 | |||
196 | #define BTFIXUPVAL_CALL(__name) \ | ||
197 | ((unsigned long)___fs_##__name[1]) | ||
198 | |||
199 | extern void btfixup(void); | ||
200 | |||
201 | #else /* __ASSEMBLY__ */ | ||
202 | |||
203 | #define BTFIXUP_SETHI(__name) %hi(___h_ ## __name) | ||
204 | #define BTFIXUP_SETHI_INIT(__name,__val) %hi(___h_ ## __name ## __btset_ ## __val) | ||
205 | |||
206 | #endif /* __ASSEMBLY__ */ | ||
207 | |||
208 | #endif /* !(_SPARC_BTFIXUP_H) */ | ||
diff --git a/include/asm-sparc/bug.h b/include/asm-sparc/bug.h new file mode 100644 index 000000000000..0d30a67d87a3 --- /dev/null +++ b/include/asm-sparc/bug.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _SPARC_BUG_H | ||
2 | #define _SPARC_BUG_H | ||
3 | |||
4 | /* Only use the inline asm until a gcc release that can handle __builtin_trap | ||
5 | * -rob 2003-06-25 | ||
6 | * | ||
7 | * gcc-3.3.1 and later will be OK -DaveM | ||
8 | */ | ||
9 | #if (__GNUC__ > 3) || \ | ||
10 | (__GNUC__ == 3 && __GNUC_MINOR__ > 3) || \ | ||
11 | (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4) | ||
12 | #define __bug_trap() __builtin_trap() | ||
13 | #else | ||
14 | #define __bug_trap() \ | ||
15 | __asm__ __volatile__ ("t 0x5\n\t" : : ) | ||
16 | #endif | ||
17 | |||
18 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
19 | extern void do_BUG(const char *file, int line); | ||
20 | #define BUG() do { \ | ||
21 | do_BUG(__FILE__, __LINE__); \ | ||
22 | __bug_trap(); \ | ||
23 | } while (0) | ||
24 | #else | ||
25 | #define BUG() __bug_trap() | ||
26 | #endif | ||
27 | |||
28 | #define HAVE_ARCH_BUG | ||
29 | #include <asm-generic/bug.h> | ||
30 | |||
31 | #endif | ||
diff --git a/include/asm-sparc/bugs.h b/include/asm-sparc/bugs.h new file mode 100644 index 000000000000..e652f89e0eff --- /dev/null +++ b/include/asm-sparc/bugs.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* $Id: bugs.h,v 1.1 1996/12/26 13:25:20 davem Exp $ | ||
2 | * include/asm-sparc/bugs.h: Sparc probes for various bugs. | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #include <asm/cpudata.h> | ||
8 | #include <linux/config.h> | ||
9 | |||
10 | extern unsigned long loops_per_jiffy; | ||
11 | |||
12 | static void check_bugs(void) | ||
13 | { | ||
14 | #ifndef CONFIG_SMP | ||
15 | cpu_data(0).udelay_val = loops_per_jiffy; | ||
16 | #endif | ||
17 | } | ||
diff --git a/include/asm-sparc/byteorder.h b/include/asm-sparc/byteorder.h new file mode 100644 index 000000000000..a2949aea48ef --- /dev/null +++ b/include/asm-sparc/byteorder.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* $Id: byteorder.h,v 1.15 1997/12/16 19:20:44 davem Exp $ */ | ||
2 | #ifndef _SPARC_BYTEORDER_H | ||
3 | #define _SPARC_BYTEORDER_H | ||
4 | |||
5 | #include <asm/types.h> | ||
6 | |||
7 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
8 | # define __BYTEORDER_HAS_U64__ | ||
9 | # define __SWAB_64_THRU_32__ | ||
10 | #endif | ||
11 | |||
12 | #include <linux/byteorder/big_endian.h> | ||
13 | |||
14 | #endif /* _SPARC_BYTEORDER_H */ | ||
diff --git a/include/asm-sparc/cache.h b/include/asm-sparc/cache.h new file mode 100644 index 000000000000..e6316fd7e1a4 --- /dev/null +++ b/include/asm-sparc/cache.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* $Id: cache.h,v 1.9 1999/08/14 03:51:58 anton Exp $ | ||
2 | * cache.h: Cache specific code for the Sparc. These include flushing | ||
3 | * and direct tag/data line access. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_CACHE_H | ||
9 | #define _SPARC_CACHE_H | ||
10 | |||
11 | #include <asm/asi.h> | ||
12 | |||
13 | #define L1_CACHE_SHIFT 5 | ||
14 | #define L1_CACHE_BYTES 32 | ||
15 | #define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))) | ||
16 | #define L1_CACHE_SHIFT_MAX 5 /* largest L1 which this arch supports */ | ||
17 | |||
18 | #define SMP_CACHE_BYTES 32 | ||
19 | |||
20 | /* Direct access to the instruction cache is provided through and | ||
21 | * alternate address space. The IDC bit must be off in the ICCR on | ||
22 | * HyperSparcs for these accesses to work. The code below does not do | ||
23 | * any checking, the caller must do so. These routines are for | ||
24 | * diagnostics only, but could end up being useful. Use with care. | ||
25 | * Also, you are asking for trouble if you execute these in one of the | ||
26 | * three instructions following a %asr/%psr access or modification. | ||
27 | */ | ||
28 | |||
29 | /* First, cache-tag access. */ | ||
30 | extern __inline__ unsigned int get_icache_tag(int setnum, int tagnum) | ||
31 | { | ||
32 | unsigned int vaddr, retval; | ||
33 | |||
34 | vaddr = ((setnum&1) << 12) | ((tagnum&0x7f) << 5); | ||
35 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
36 | "=r" (retval) : | ||
37 | "r" (vaddr), "i" (ASI_M_TXTC_TAG)); | ||
38 | return retval; | ||
39 | } | ||
40 | |||
41 | extern __inline__ void put_icache_tag(int setnum, int tagnum, unsigned int entry) | ||
42 | { | ||
43 | unsigned int vaddr; | ||
44 | |||
45 | vaddr = ((setnum&1) << 12) | ((tagnum&0x7f) << 5); | ||
46 | __asm__ __volatile__("sta %0, [%1] %2\n\t" : : | ||
47 | "r" (entry), "r" (vaddr), "i" (ASI_M_TXTC_TAG) : | ||
48 | "memory"); | ||
49 | } | ||
50 | |||
51 | /* Second cache-data access. The data is returned two-32bit quantities | ||
52 | * at a time. | ||
53 | */ | ||
54 | extern __inline__ void get_icache_data(int setnum, int tagnum, int subblock, | ||
55 | unsigned int *data) | ||
56 | { | ||
57 | unsigned int value1, value2, vaddr; | ||
58 | |||
59 | vaddr = ((setnum&0x1) << 12) | ((tagnum&0x7f) << 5) | | ||
60 | ((subblock&0x3) << 3); | ||
61 | __asm__ __volatile__("ldda [%2] %3, %%g2\n\t" | ||
62 | "or %%g0, %%g2, %0\n\t" | ||
63 | "or %%g0, %%g3, %1\n\t" : | ||
64 | "=r" (value1), "=r" (value2) : | ||
65 | "r" (vaddr), "i" (ASI_M_TXTC_DATA) : | ||
66 | "g2", "g3"); | ||
67 | data[0] = value1; data[1] = value2; | ||
68 | } | ||
69 | |||
70 | extern __inline__ void put_icache_data(int setnum, int tagnum, int subblock, | ||
71 | unsigned int *data) | ||
72 | { | ||
73 | unsigned int value1, value2, vaddr; | ||
74 | |||
75 | vaddr = ((setnum&0x1) << 12) | ((tagnum&0x7f) << 5) | | ||
76 | ((subblock&0x3) << 3); | ||
77 | value1 = data[0]; value2 = data[1]; | ||
78 | __asm__ __volatile__("or %%g0, %0, %%g2\n\t" | ||
79 | "or %%g0, %1, %%g3\n\t" | ||
80 | "stda %%g2, [%2] %3\n\t" : : | ||
81 | "r" (value1), "r" (value2), | ||
82 | "r" (vaddr), "i" (ASI_M_TXTC_DATA) : | ||
83 | "g2", "g3", "memory" /* no joke */); | ||
84 | } | ||
85 | |||
86 | /* Different types of flushes with the ICACHE. Some of the flushes | ||
87 | * affect both the ICACHE and the external cache. Others only clear | ||
88 | * the ICACHE entries on the cpu itself. V8's (most) allow | ||
89 | * granularity of flushes on the packet (element in line), whole line, | ||
90 | * and entire cache (ie. all lines) level. The ICACHE only flushes are | ||
91 | * ROSS HyperSparc specific and are in ross.h | ||
92 | */ | ||
93 | |||
94 | /* Flushes which clear out both the on-chip and external caches */ | ||
95 | extern __inline__ void flush_ei_page(unsigned int addr) | ||
96 | { | ||
97 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
98 | "r" (addr), "i" (ASI_M_FLUSH_PAGE) : | ||
99 | "memory"); | ||
100 | } | ||
101 | |||
102 | extern __inline__ void flush_ei_seg(unsigned int addr) | ||
103 | { | ||
104 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
105 | "r" (addr), "i" (ASI_M_FLUSH_SEG) : | ||
106 | "memory"); | ||
107 | } | ||
108 | |||
109 | extern __inline__ void flush_ei_region(unsigned int addr) | ||
110 | { | ||
111 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
112 | "r" (addr), "i" (ASI_M_FLUSH_REGION) : | ||
113 | "memory"); | ||
114 | } | ||
115 | |||
116 | extern __inline__ void flush_ei_ctx(unsigned int addr) | ||
117 | { | ||
118 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
119 | "r" (addr), "i" (ASI_M_FLUSH_CTX) : | ||
120 | "memory"); | ||
121 | } | ||
122 | |||
123 | extern __inline__ void flush_ei_user(unsigned int addr) | ||
124 | { | ||
125 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
126 | "r" (addr), "i" (ASI_M_FLUSH_USER) : | ||
127 | "memory"); | ||
128 | } | ||
129 | |||
130 | #endif /* !(_SPARC_CACHE_H) */ | ||
diff --git a/include/asm-sparc/cacheflush.h b/include/asm-sparc/cacheflush.h new file mode 100644 index 000000000000..4901217008c0 --- /dev/null +++ b/include/asm-sparc/cacheflush.h | |||
@@ -0,0 +1,85 @@ | |||
1 | #ifndef _SPARC_CACHEFLUSH_H | ||
2 | #define _SPARC_CACHEFLUSH_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <linux/mm.h> /* Common for other includes */ | ||
6 | // #include <linux/kernel.h> from pgalloc.h | ||
7 | // #include <linux/sched.h> from pgalloc.h | ||
8 | |||
9 | // #include <asm/page.h> | ||
10 | #include <asm/btfixup.h> | ||
11 | |||
12 | /* | ||
13 | * Fine grained cache flushing. | ||
14 | */ | ||
15 | #ifdef CONFIG_SMP | ||
16 | |||
17 | BTFIXUPDEF_CALL(void, local_flush_cache_all, void) | ||
18 | BTFIXUPDEF_CALL(void, local_flush_cache_mm, struct mm_struct *) | ||
19 | BTFIXUPDEF_CALL(void, local_flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long) | ||
20 | BTFIXUPDEF_CALL(void, local_flush_cache_page, struct vm_area_struct *, unsigned long) | ||
21 | |||
22 | #define local_flush_cache_all() BTFIXUP_CALL(local_flush_cache_all)() | ||
23 | #define local_flush_cache_mm(mm) BTFIXUP_CALL(local_flush_cache_mm)(mm) | ||
24 | #define local_flush_cache_range(vma,start,end) BTFIXUP_CALL(local_flush_cache_range)(vma,start,end) | ||
25 | #define local_flush_cache_page(vma,addr) BTFIXUP_CALL(local_flush_cache_page)(vma,addr) | ||
26 | |||
27 | BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long) | ||
28 | BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long) | ||
29 | |||
30 | #define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr) | ||
31 | #define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr) | ||
32 | |||
33 | extern void smp_flush_cache_all(void); | ||
34 | extern void smp_flush_cache_mm(struct mm_struct *mm); | ||
35 | extern void smp_flush_cache_range(struct vm_area_struct *vma, | ||
36 | unsigned long start, | ||
37 | unsigned long end); | ||
38 | extern void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page); | ||
39 | |||
40 | extern void smp_flush_page_to_ram(unsigned long page); | ||
41 | extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr); | ||
42 | |||
43 | #endif /* CONFIG_SMP */ | ||
44 | |||
45 | BTFIXUPDEF_CALL(void, flush_cache_all, void) | ||
46 | BTFIXUPDEF_CALL(void, flush_cache_mm, struct mm_struct *) | ||
47 | BTFIXUPDEF_CALL(void, flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long) | ||
48 | BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long) | ||
49 | |||
50 | #define flush_cache_all() BTFIXUP_CALL(flush_cache_all)() | ||
51 | #define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm) | ||
52 | #define flush_cache_range(vma,start,end) BTFIXUP_CALL(flush_cache_range)(vma,start,end) | ||
53 | #define flush_cache_page(vma,addr,pfn) BTFIXUP_CALL(flush_cache_page)(vma,addr) | ||
54 | #define flush_icache_range(start, end) do { } while (0) | ||
55 | #define flush_icache_page(vma, pg) do { } while (0) | ||
56 | |||
57 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | ||
58 | |||
59 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
60 | do { \ | ||
61 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
62 | memcpy(dst, src, len); \ | ||
63 | } while (0) | ||
64 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
65 | do { \ | ||
66 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
67 | memcpy(dst, src, len); \ | ||
68 | } while (0) | ||
69 | |||
70 | BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long) | ||
71 | BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) | ||
72 | |||
73 | #define __flush_page_to_ram(addr) BTFIXUP_CALL(__flush_page_to_ram)(addr) | ||
74 | #define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr) | ||
75 | |||
76 | extern void sparc_flush_page_to_ram(struct page *page); | ||
77 | |||
78 | #define flush_dcache_page(page) sparc_flush_page_to_ram(page) | ||
79 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
80 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
81 | |||
82 | #define flush_cache_vmap(start, end) flush_cache_all() | ||
83 | #define flush_cache_vunmap(start, end) flush_cache_all() | ||
84 | |||
85 | #endif /* _SPARC_CACHEFLUSH_H */ | ||
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h new file mode 100644 index 000000000000..286158108974 --- /dev/null +++ b/include/asm-sparc/checksum.h | |||
@@ -0,0 +1,253 @@ | |||
1 | /* $Id: checksum.h,v 1.33 2002/02/01 22:01:05 davem Exp $ */ | ||
2 | #ifndef __SPARC_CHECKSUM_H | ||
3 | #define __SPARC_CHECKSUM_H | ||
4 | |||
5 | /* checksum.h: IP/UDP/TCP checksum routines on the Sparc. | ||
6 | * | ||
7 | * Copyright(C) 1995 Linus Torvalds | ||
8 | * Copyright(C) 1995 Miguel de Icaza | ||
9 | * Copyright(C) 1996 David S. Miller | ||
10 | * Copyright(C) 1996 Eddie C. Dost | ||
11 | * Copyright(C) 1997 Jakub Jelinek | ||
12 | * | ||
13 | * derived from: | ||
14 | * Alpha checksum c-code | ||
15 | * ix86 inline assembly | ||
16 | * RFC1071 Computing the Internet Checksum | ||
17 | */ | ||
18 | |||
19 | #include <linux/in6.h> | ||
20 | #include <asm/uaccess.h> | ||
21 | |||
22 | /* computes the checksum of a memory block at buff, length len, | ||
23 | * and adds in "sum" (32-bit) | ||
24 | * | ||
25 | * returns a 32-bit number suitable for feeding into itself | ||
26 | * or csum_tcpudp_magic | ||
27 | * | ||
28 | * this function must be called with even lengths, except | ||
29 | * for the last fragment, which may be odd | ||
30 | * | ||
31 | * it's best to have buff aligned on a 32-bit boundary | ||
32 | */ | ||
33 | extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); | ||
34 | |||
35 | /* the same as csum_partial, but copies from fs:src while it | ||
36 | * checksums | ||
37 | * | ||
38 | * here even more important to align src and dst on a 32-bit (or even | ||
39 | * better 64-bit) boundary | ||
40 | */ | ||
41 | |||
42 | extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); | ||
43 | |||
44 | static inline unsigned int | ||
45 | csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len, | ||
46 | unsigned int sum) | ||
47 | { | ||
48 | register unsigned int ret asm("o0") = (unsigned int)src; | ||
49 | register char *d asm("o1") = dst; | ||
50 | register int l asm("g1") = len; | ||
51 | |||
52 | __asm__ __volatile__ ( | ||
53 | "call __csum_partial_copy_sparc_generic\n\t" | ||
54 | " mov %6, %%g7\n" | ||
55 | : "=&r" (ret), "=&r" (d), "=&r" (l) | ||
56 | : "0" (ret), "1" (d), "2" (l), "r" (sum) | ||
57 | : "o2", "o3", "o4", "o5", "o7", | ||
58 | "g2", "g3", "g4", "g5", "g7", | ||
59 | "memory", "cc"); | ||
60 | return ret; | ||
61 | } | ||
62 | |||
63 | static inline unsigned int | ||
64 | csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, int len, | ||
65 | unsigned int sum, int *err) | ||
66 | { | ||
67 | if (!access_ok (VERIFY_READ, src, len)) { | ||
68 | *err = -EFAULT; | ||
69 | memset (dst, 0, len); | ||
70 | return sum; | ||
71 | } else { | ||
72 | register unsigned long ret asm("o0") = (unsigned long)src; | ||
73 | register char *d asm("o1") = dst; | ||
74 | register int l asm("g1") = len; | ||
75 | register unsigned int s asm("g7") = sum; | ||
76 | |||
77 | __asm__ __volatile__ ( | ||
78 | ".section __ex_table,#alloc\n\t" | ||
79 | ".align 4\n\t" | ||
80 | ".word 1f,2\n\t" | ||
81 | ".previous\n" | ||
82 | "1:\n\t" | ||
83 | "call __csum_partial_copy_sparc_generic\n\t" | ||
84 | " st %8, [%%sp + 64]\n" | ||
85 | : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s) | ||
86 | : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err) | ||
87 | : "o2", "o3", "o4", "o5", "o7", "g2", "g3", "g4", "g5", | ||
88 | "cc", "memory"); | ||
89 | return ret; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | static inline unsigned int | ||
94 | csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, int len, | ||
95 | unsigned int sum, int *err) | ||
96 | { | ||
97 | if (!access_ok (VERIFY_WRITE, dst, len)) { | ||
98 | *err = -EFAULT; | ||
99 | return sum; | ||
100 | } else { | ||
101 | register unsigned long ret asm("o0") = (unsigned long)src; | ||
102 | register char __user *d asm("o1") = dst; | ||
103 | register int l asm("g1") = len; | ||
104 | register unsigned int s asm("g7") = sum; | ||
105 | |||
106 | __asm__ __volatile__ ( | ||
107 | ".section __ex_table,#alloc\n\t" | ||
108 | ".align 4\n\t" | ||
109 | ".word 1f,1\n\t" | ||
110 | ".previous\n" | ||
111 | "1:\n\t" | ||
112 | "call __csum_partial_copy_sparc_generic\n\t" | ||
113 | " st %8, [%%sp + 64]\n" | ||
114 | : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s) | ||
115 | : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err) | ||
116 | : "o2", "o3", "o4", "o5", "o7", | ||
117 | "g2", "g3", "g4", "g5", | ||
118 | "cc", "memory"); | ||
119 | return ret; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | #define HAVE_CSUM_COPY_USER | ||
124 | #define csum_and_copy_to_user csum_partial_copy_to_user | ||
125 | |||
126 | /* ihl is always 5 or greater, almost always is 5, and iph is word aligned | ||
127 | * the majority of the time. | ||
128 | */ | ||
129 | static inline unsigned short ip_fast_csum(const unsigned char *iph, | ||
130 | unsigned int ihl) | ||
131 | { | ||
132 | unsigned short sum; | ||
133 | |||
134 | /* Note: We must read %2 before we touch %0 for the first time, | ||
135 | * because GCC can legitimately use the same register for | ||
136 | * both operands. | ||
137 | */ | ||
138 | __asm__ __volatile__("sub\t%2, 4, %%g4\n\t" | ||
139 | "ld\t[%1 + 0x00], %0\n\t" | ||
140 | "ld\t[%1 + 0x04], %%g2\n\t" | ||
141 | "ld\t[%1 + 0x08], %%g3\n\t" | ||
142 | "addcc\t%%g2, %0, %0\n\t" | ||
143 | "addxcc\t%%g3, %0, %0\n\t" | ||
144 | "ld\t[%1 + 0x0c], %%g2\n\t" | ||
145 | "ld\t[%1 + 0x10], %%g3\n\t" | ||
146 | "addxcc\t%%g2, %0, %0\n\t" | ||
147 | "addx\t%0, %%g0, %0\n" | ||
148 | "1:\taddcc\t%%g3, %0, %0\n\t" | ||
149 | "add\t%1, 4, %1\n\t" | ||
150 | "addxcc\t%0, %%g0, %0\n\t" | ||
151 | "subcc\t%%g4, 1, %%g4\n\t" | ||
152 | "be,a\t2f\n\t" | ||
153 | "sll\t%0, 16, %%g2\n\t" | ||
154 | "b\t1b\n\t" | ||
155 | "ld\t[%1 + 0x10], %%g3\n" | ||
156 | "2:\taddcc\t%0, %%g2, %%g2\n\t" | ||
157 | "srl\t%%g2, 16, %0\n\t" | ||
158 | "addx\t%0, %%g0, %0\n\t" | ||
159 | "xnor\t%%g0, %0, %0" | ||
160 | : "=r" (sum), "=&r" (iph) | ||
161 | : "r" (ihl), "1" (iph) | ||
162 | : "g2", "g3", "g4", "cc"); | ||
163 | return sum; | ||
164 | } | ||
165 | |||
166 | /* Fold a partial checksum without adding pseudo headers. */ | ||
167 | static inline unsigned int csum_fold(unsigned int sum) | ||
168 | { | ||
169 | unsigned int tmp; | ||
170 | |||
171 | __asm__ __volatile__("addcc\t%0, %1, %1\n\t" | ||
172 | "srl\t%1, 16, %1\n\t" | ||
173 | "addx\t%1, %%g0, %1\n\t" | ||
174 | "xnor\t%%g0, %1, %0" | ||
175 | : "=&r" (sum), "=r" (tmp) | ||
176 | : "0" (sum), "1" (sum<<16) | ||
177 | : "cc"); | ||
178 | return sum; | ||
179 | } | ||
180 | |||
181 | static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, | ||
182 | unsigned long daddr, | ||
183 | unsigned int len, | ||
184 | unsigned short proto, | ||
185 | unsigned int sum) | ||
186 | { | ||
187 | __asm__ __volatile__("addcc\t%1, %0, %0\n\t" | ||
188 | "addxcc\t%2, %0, %0\n\t" | ||
189 | "addxcc\t%3, %0, %0\n\t" | ||
190 | "addx\t%0, %%g0, %0\n\t" | ||
191 | : "=r" (sum), "=r" (saddr) | ||
192 | : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), | ||
193 | "1" (saddr) | ||
194 | : "cc"); | ||
195 | return sum; | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | * computes the checksum of the TCP/UDP pseudo-header | ||
200 | * returns a 16-bit checksum, already complemented | ||
201 | */ | ||
202 | static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, | ||
203 | unsigned long daddr, | ||
204 | unsigned short len, | ||
205 | unsigned short proto, | ||
206 | unsigned int sum) | ||
207 | { | ||
208 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
209 | } | ||
210 | |||
211 | #define _HAVE_ARCH_IPV6_CSUM | ||
212 | |||
213 | static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, | ||
214 | struct in6_addr *daddr, | ||
215 | __u32 len, | ||
216 | unsigned short proto, | ||
217 | unsigned int sum) | ||
218 | { | ||
219 | __asm__ __volatile__ ( | ||
220 | "addcc %3, %4, %%g4\n\t" | ||
221 | "addxcc %5, %%g4, %%g4\n\t" | ||
222 | "ld [%2 + 0x0c], %%g2\n\t" | ||
223 | "ld [%2 + 0x08], %%g3\n\t" | ||
224 | "addxcc %%g2, %%g4, %%g4\n\t" | ||
225 | "ld [%2 + 0x04], %%g2\n\t" | ||
226 | "addxcc %%g3, %%g4, %%g4\n\t" | ||
227 | "ld [%2 + 0x00], %%g3\n\t" | ||
228 | "addxcc %%g2, %%g4, %%g4\n\t" | ||
229 | "ld [%1 + 0x0c], %%g2\n\t" | ||
230 | "addxcc %%g3, %%g4, %%g4\n\t" | ||
231 | "ld [%1 + 0x08], %%g3\n\t" | ||
232 | "addxcc %%g2, %%g4, %%g4\n\t" | ||
233 | "ld [%1 + 0x04], %%g2\n\t" | ||
234 | "addxcc %%g3, %%g4, %%g4\n\t" | ||
235 | "ld [%1 + 0x00], %%g3\n\t" | ||
236 | "addxcc %%g2, %%g4, %%g4\n\t" | ||
237 | "addxcc %%g3, %%g4, %0\n\t" | ||
238 | "addx 0, %0, %0\n" | ||
239 | : "=&r" (sum) | ||
240 | : "r" (saddr), "r" (daddr), | ||
241 | "r"(htonl(len)), "r"(htonl(proto)), "r"(sum) | ||
242 | : "g2", "g3", "g4", "cc"); | ||
243 | |||
244 | return csum_fold(sum); | ||
245 | } | ||
246 | |||
247 | /* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ | ||
248 | static inline unsigned short ip_compute_csum(unsigned char * buff, int len) | ||
249 | { | ||
250 | return csum_fold(csum_partial(buff, len, 0)); | ||
251 | } | ||
252 | |||
253 | #endif /* !(__SPARC_CHECKSUM_H) */ | ||
diff --git a/include/asm-sparc/clock.h b/include/asm-sparc/clock.h new file mode 100644 index 000000000000..e708e6b50d2b --- /dev/null +++ b/include/asm-sparc/clock.h | |||
@@ -0,0 +1,11 @@ | |||
1 | /* $Id: clock.h,v 1.3 1995/11/25 02:31:25 davem Exp $ | ||
2 | * clock.h: Definitions for clock operations on the Sparc. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | #ifndef _SPARC_CLOCK_H | ||
7 | #define _SPARC_CLOCK_H | ||
8 | |||
9 | /* Foo for now. */ | ||
10 | |||
11 | #endif /* !(_SPARC_CLOCK_H) */ | ||
diff --git a/include/asm-sparc/contregs.h b/include/asm-sparc/contregs.h new file mode 100644 index 000000000000..0e05afe02d44 --- /dev/null +++ b/include/asm-sparc/contregs.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* $Id: contregs.h,v 1.8 2000/12/28 22:49:11 davem Exp $ */ | ||
2 | #ifndef _SPARC_CONTREGS_H | ||
3 | #define _SPARC_CONTREGS_H | ||
4 | |||
5 | /* contregs.h: Addresses of registers in the ASI_CONTROL alternate address | ||
6 | * space. These are for the mmu's context register, etc. | ||
7 | * | ||
8 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
9 | */ | ||
10 | |||
11 | /* 3=sun3 | ||
12 | 4=sun4 (as in sun4 sysmaint student book) | ||
13 | c=sun4c (according to davem) */ | ||
14 | |||
15 | #define AC_IDPROM 0x00000000 /* 34 ID PROM, R/O, byte, 32 bytes */ | ||
16 | #define AC_PAGEMAP 0x10000000 /* 3 Pagemap R/W, long */ | ||
17 | #define AC_SEGMAP 0x20000000 /* 3 Segment map, byte */ | ||
18 | #define AC_CONTEXT 0x30000000 /* 34c current mmu-context */ | ||
19 | #define AC_SENABLE 0x40000000 /* 34c system dvma/cache/reset enable reg*/ | ||
20 | #define AC_UDVMA_ENB 0x50000000 /* 34 Not used on Sun boards, byte */ | ||
21 | #define AC_BUS_ERROR 0x60000000 /* 34 Not cleared on read, byte. */ | ||
22 | #define AC_SYNC_ERR 0x60000000 /* c fault type */ | ||
23 | #define AC_SYNC_VA 0x60000004 /* c fault virtual address */ | ||
24 | #define AC_ASYNC_ERR 0x60000008 /* c asynchronous fault type */ | ||
25 | #define AC_ASYNC_VA 0x6000000c /* c async fault virtual address */ | ||
26 | #define AC_LEDS 0x70000000 /* 34 Zero turns on LEDs, byte */ | ||
27 | #define AC_CACHETAGS 0x80000000 /* 34c direct access to the VAC tags */ | ||
28 | #define AC_CACHEDDATA 0x90000000 /* 3 c direct access to the VAC data */ | ||
29 | #define AC_UDVMA_MAP 0xD0000000 /* 4 Not used on Sun boards, byte */ | ||
30 | #define AC_VME_VECTOR 0xE0000000 /* 4 For non-Autovector VME, byte */ | ||
31 | #define AC_BOOT_SCC 0xF0000000 /* 34 bypass to access Zilog 8530. byte.*/ | ||
32 | |||
33 | /* s=Swift, h=Ross_HyperSPARC, v=TI_Viking, t=Tsunami, r=Ross_Cypress */ | ||
34 | #define AC_M_PCR 0x0000 /* shv Processor Control Reg */ | ||
35 | #define AC_M_CTPR 0x0100 /* shv Context Table Pointer Reg */ | ||
36 | #define AC_M_CXR 0x0200 /* shv Context Register */ | ||
37 | #define AC_M_SFSR 0x0300 /* shv Synchronous Fault Status Reg */ | ||
38 | #define AC_M_SFAR 0x0400 /* shv Synchronous Fault Address Reg */ | ||
39 | #define AC_M_AFSR 0x0500 /* hv Asynchronous Fault Status Reg */ | ||
40 | #define AC_M_AFAR 0x0600 /* hv Asynchronous Fault Address Reg */ | ||
41 | #define AC_M_RESET 0x0700 /* hv Reset Reg */ | ||
42 | #define AC_M_RPR 0x1000 /* hv Root Pointer Reg */ | ||
43 | #define AC_M_TSUTRCR 0x1000 /* s TLB Replacement Ctrl Reg */ | ||
44 | #define AC_M_IAPTP 0x1100 /* hv Instruction Access PTP */ | ||
45 | #define AC_M_DAPTP 0x1200 /* hv Data Access PTP */ | ||
46 | #define AC_M_ITR 0x1300 /* hv Index Tag Register */ | ||
47 | #define AC_M_TRCR 0x1400 /* hv TLB Replacement Control Reg */ | ||
48 | #define AC_M_SFSRX 0x1300 /* s Synch Fault Status Reg prim */ | ||
49 | #define AC_M_SFARX 0x1400 /* s Synch Fault Address Reg prim */ | ||
50 | #define AC_M_RPR1 0x1500 /* h Root Pointer Reg (entry 2) */ | ||
51 | #define AC_M_IAPTP1 0x1600 /* h Instruction Access PTP (entry 2) */ | ||
52 | #define AC_M_DAPTP1 0x1700 /* h Data Access PTP (entry 2) */ | ||
53 | |||
54 | #endif /* _SPARC_CONTREGS_H */ | ||
diff --git a/include/asm-sparc/cpudata.h b/include/asm-sparc/cpudata.h new file mode 100644 index 000000000000..ec0d9ef90a3b --- /dev/null +++ b/include/asm-sparc/cpudata.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* cpudata.h: Per-cpu parameters. | ||
2 | * | ||
3 | * Copyright (C) 2004 Keith M Wesolowski (wesolows@foobazco.org) | ||
4 | * | ||
5 | * Based on include/asm-sparc64/cpudata.h and Linux 2.4 smp.h | ||
6 | * both (C) David S. Miller. | ||
7 | */ | ||
8 | |||
9 | #ifndef _SPARC_CPUDATA_H | ||
10 | #define _SPARC_CPUDATA_H | ||
11 | |||
12 | #include <linux/percpu.h> | ||
13 | |||
14 | typedef struct { | ||
15 | unsigned long udelay_val; | ||
16 | unsigned long clock_tick; | ||
17 | unsigned int multiplier; | ||
18 | unsigned int counter; | ||
19 | int prom_node; | ||
20 | int mid; | ||
21 | } cpuinfo_sparc; | ||
22 | |||
23 | DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); | ||
24 | #define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu)) | ||
25 | |||
26 | #endif /* _SPARC_CPUDATA_H */ | ||
diff --git a/include/asm-sparc/cputime.h b/include/asm-sparc/cputime.h new file mode 100644 index 000000000000..1a642b81e019 --- /dev/null +++ b/include/asm-sparc/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __SPARC_CPUTIME_H | ||
2 | #define __SPARC_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __SPARC_CPUTIME_H */ | ||
diff --git a/include/asm-sparc/current.h b/include/asm-sparc/current.h new file mode 100644 index 000000000000..8fe7c82a5e21 --- /dev/null +++ b/include/asm-sparc/current.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * include/asm-sparc/current.h | ||
3 | * | ||
4 | * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
5 | * Copyright (C) 2002 Pete Zaitcev (zaitcev@yahoo.com) | ||
6 | * | ||
7 | * Derived from "include/asm-s390/current.h" by | ||
8 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | ||
9 | * Derived from "include/asm-i386/current.h" | ||
10 | */ | ||
11 | #ifndef _ASM_CURRENT_H | ||
12 | #define _ASM_CURRENT_H | ||
13 | |||
14 | /* | ||
15 | * At the sparc64 DaveM keeps current_thread_info in %g4. | ||
16 | * We might want to consider doing the same to shave a few cycles. | ||
17 | */ | ||
18 | |||
19 | #include <linux/thread_info.h> | ||
20 | |||
21 | struct task_struct; | ||
22 | |||
23 | /* Two stage process (inline + #define) for type-checking. */ | ||
24 | /* We also obfuscate get_current() to check if anyone used that by mistake. */ | ||
25 | static inline struct task_struct *__get_current(void) | ||
26 | { | ||
27 | return current_thread_info()->task; | ||
28 | } | ||
29 | #define current __get_current() | ||
30 | |||
31 | #endif /* !(_ASM_CURRENT_H) */ | ||
diff --git a/include/asm-sparc/cypress.h b/include/asm-sparc/cypress.h new file mode 100644 index 000000000000..fc92fc839c3f --- /dev/null +++ b/include/asm-sparc/cypress.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* $Id: cypress.h,v 1.6 1996/08/29 09:48:09 davem Exp $ | ||
2 | * cypress.h: Cypress module specific definitions and defines. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_CYPRESS_H | ||
8 | #define _SPARC_CYPRESS_H | ||
9 | |||
10 | /* Cypress chips have %psr 'impl' of '0001' and 'vers' of '0001'. */ | ||
11 | |||
12 | /* The MMU control register fields on the Sparc Cypress 604/605 MMU's. | ||
13 | * | ||
14 | * --------------------------------------------------------------- | ||
15 | * |implvers| MCA | MCM |MV| MID |BM| C|RSV|MR|CM|CL|CE|RSV|NF|ME| | ||
16 | * --------------------------------------------------------------- | ||
17 | * 31 24 23-22 21-20 19 18-15 14 13 12 11 10 9 8 7-2 1 0 | ||
18 | * | ||
19 | * MCA: MultiChip Access -- Used for configuration of multiple | ||
20 | * CY7C604/605 cache units. | ||
21 | * MCM: MultiChip Mask -- Again, for multiple cache unit config. | ||
22 | * MV: MultiChip Valid -- Indicates MCM and MCA have valid settings. | ||
23 | * MID: ModuleID -- Unique processor ID for MBus transactions. (605 only) | ||
24 | * BM: Boot Mode -- 0 = not in boot mode, 1 = in boot mode | ||
25 | * C: Cacheable -- Indicates whether accesses are cacheable while | ||
26 | * the MMU is off. 0=no 1=yes | ||
27 | * MR: MemoryReflection -- Indicates whether the bus attached to the | ||
28 | * MBus supports memory reflection. 0=no 1=yes (605 only) | ||
29 | * CM: CacheMode -- Indicates whether the cache is operating in write | ||
30 | * through or copy-back mode. 0=write-through 1=copy-back | ||
31 | * CL: CacheLock -- Indicates if the entire cache is locked or not. | ||
32 | * 0=not-locked 1=locked (604 only) | ||
33 | * CE: CacheEnable -- Is the virtual cache on? 0=no 1=yes | ||
34 | * NF: NoFault -- Do faults generate traps? 0=yes 1=no | ||
35 | * ME: MmuEnable -- Is the MMU doing translations? 0=no 1=yes | ||
36 | */ | ||
37 | |||
38 | #define CYPRESS_MCA 0x00c00000 | ||
39 | #define CYPRESS_MCM 0x00300000 | ||
40 | #define CYPRESS_MVALID 0x00080000 | ||
41 | #define CYPRESS_MIDMASK 0x00078000 /* Only on 605 */ | ||
42 | #define CYPRESS_BMODE 0x00004000 | ||
43 | #define CYPRESS_ACENABLE 0x00002000 | ||
44 | #define CYPRESS_MRFLCT 0x00000800 /* Only on 605 */ | ||
45 | #define CYPRESS_CMODE 0x00000400 | ||
46 | #define CYPRESS_CLOCK 0x00000200 /* Only on 604 */ | ||
47 | #define CYPRESS_CENABLE 0x00000100 | ||
48 | #define CYPRESS_NFAULT 0x00000002 | ||
49 | #define CYPRESS_MENABLE 0x00000001 | ||
50 | |||
51 | extern __inline__ void cypress_flush_page(unsigned long page) | ||
52 | { | ||
53 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
54 | "r" (page), "i" (ASI_M_FLUSH_PAGE)); | ||
55 | } | ||
56 | |||
57 | extern __inline__ void cypress_flush_segment(unsigned long addr) | ||
58 | { | ||
59 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
60 | "r" (addr), "i" (ASI_M_FLUSH_SEG)); | ||
61 | } | ||
62 | |||
63 | extern __inline__ void cypress_flush_region(unsigned long addr) | ||
64 | { | ||
65 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : : | ||
66 | "r" (addr), "i" (ASI_M_FLUSH_REGION)); | ||
67 | } | ||
68 | |||
69 | extern __inline__ void cypress_flush_context(void) | ||
70 | { | ||
71 | __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : : | ||
72 | "i" (ASI_M_FLUSH_CTX)); | ||
73 | } | ||
74 | |||
75 | /* XXX Displacement flushes for buggy chips and initial testing | ||
76 | * XXX go here. | ||
77 | */ | ||
78 | |||
79 | #endif /* !(_SPARC_CYPRESS_H) */ | ||
diff --git a/include/asm-sparc/delay.h b/include/asm-sparc/delay.h new file mode 100644 index 000000000000..6edf2cbb246b --- /dev/null +++ b/include/asm-sparc/delay.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* $Id: delay.h,v 1.11 2001/01/01 01:46:15 davem Exp $ | ||
2 | * delay.h: Linux delay routines on the Sparc. | ||
3 | * | ||
4 | * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu). | ||
5 | */ | ||
6 | |||
7 | #ifndef __SPARC_DELAY_H | ||
8 | #define __SPARC_DELAY_H | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <asm/cpudata.h> | ||
12 | |||
13 | extern __inline__ void __delay(unsigned long loops) | ||
14 | { | ||
15 | __asm__ __volatile__("cmp %0, 0\n\t" | ||
16 | "1: bne 1b\n\t" | ||
17 | "subcc %0, 1, %0\n" : | ||
18 | "=&r" (loops) : | ||
19 | "0" (loops) : | ||
20 | "cc"); | ||
21 | } | ||
22 | |||
23 | /* This is too messy with inline asm on the Sparc. */ | ||
24 | extern void __udelay(unsigned long usecs, unsigned long lpj); | ||
25 | extern void __ndelay(unsigned long nsecs, unsigned long lpj); | ||
26 | |||
27 | #ifdef CONFIG_SMP | ||
28 | #define __udelay_val cpu_data(smp_processor_id()).udelay_val | ||
29 | #else /* SMP */ | ||
30 | #define __udelay_val loops_per_jiffy | ||
31 | #endif /* SMP */ | ||
32 | #define udelay(__usecs) __udelay(__usecs, __udelay_val) | ||
33 | #define ndelay(__nsecs) __ndelay(__nsecs, __udelay_val) | ||
34 | |||
35 | #endif /* defined(__SPARC_DELAY_H) */ | ||
diff --git a/include/asm-sparc/div64.h b/include/asm-sparc/div64.h new file mode 100644 index 000000000000..6cd978cefb28 --- /dev/null +++ b/include/asm-sparc/div64.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/div64.h> | |||
diff --git a/include/asm-sparc/dma-mapping.h b/include/asm-sparc/dma-mapping.h new file mode 100644 index 000000000000..2dc5bb8effa6 --- /dev/null +++ b/include/asm-sparc/dma-mapping.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _ASM_SPARC_DMA_MAPPING_H | ||
2 | #define _ASM_SPARC_DMA_MAPPING_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | #ifdef CONFIG_PCI | ||
7 | #include <asm-generic/dma-mapping.h> | ||
8 | #else | ||
9 | |||
10 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | ||
11 | dma_addr_t *dma_handle, int flag) | ||
12 | { | ||
13 | BUG(); | ||
14 | return NULL; | ||
15 | } | ||
16 | |||
17 | static inline void dma_free_coherent(struct device *dev, size_t size, | ||
18 | void *vaddr, dma_addr_t dma_handle) | ||
19 | { | ||
20 | BUG(); | ||
21 | } | ||
22 | |||
23 | #endif /* PCI */ | ||
24 | |||
25 | #endif /* _ASM_SPARC_DMA_MAPPING_H */ | ||
diff --git a/include/asm-sparc/dma.h b/include/asm-sparc/dma.h new file mode 100644 index 000000000000..07e6368a2521 --- /dev/null +++ b/include/asm-sparc/dma.h | |||
@@ -0,0 +1,290 @@ | |||
1 | /* $Id: dma.h,v 1.35 1999/12/27 06:37:09 anton Exp $ | ||
2 | * include/asm-sparc/dma.h | ||
3 | * | ||
4 | * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASM_SPARC_DMA_H | ||
8 | #define _ASM_SPARC_DMA_H | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | |||
14 | #include <asm/vac-ops.h> /* for invalidate's, etc. */ | ||
15 | #include <asm/sbus.h> | ||
16 | #include <asm/delay.h> | ||
17 | #include <asm/oplib.h> | ||
18 | #include <asm/system.h> | ||
19 | #include <asm/io.h> | ||
20 | #include <linux/spinlock.h> | ||
21 | |||
22 | struct page; | ||
23 | extern spinlock_t dma_spin_lock; | ||
24 | |||
25 | static __inline__ unsigned long claim_dma_lock(void) | ||
26 | { | ||
27 | unsigned long flags; | ||
28 | spin_lock_irqsave(&dma_spin_lock, flags); | ||
29 | return flags; | ||
30 | } | ||
31 | |||
32 | static __inline__ void release_dma_lock(unsigned long flags) | ||
33 | { | ||
34 | spin_unlock_irqrestore(&dma_spin_lock, flags); | ||
35 | } | ||
36 | |||
37 | /* These are irrelevant for Sparc DMA, but we leave it in so that | ||
38 | * things can compile. | ||
39 | */ | ||
40 | #define MAX_DMA_CHANNELS 8 | ||
41 | #define MAX_DMA_ADDRESS (~0UL) | ||
42 | #define DMA_MODE_READ 1 | ||
43 | #define DMA_MODE_WRITE 2 | ||
44 | |||
45 | /* Useful constants */ | ||
46 | #define SIZE_16MB (16*1024*1024) | ||
47 | #define SIZE_64K (64*1024) | ||
48 | |||
49 | /* SBUS DMA controller reg offsets */ | ||
50 | #define DMA_CSR 0x00UL /* rw DMA control/status register 0x00 */ | ||
51 | #define DMA_ADDR 0x04UL /* rw DMA transfer address register 0x04 */ | ||
52 | #define DMA_COUNT 0x08UL /* rw DMA transfer count register 0x08 */ | ||
53 | #define DMA_TEST 0x0cUL /* rw DMA test/debug register 0x0c */ | ||
54 | |||
55 | /* DVMA chip revisions */ | ||
56 | enum dvma_rev { | ||
57 | dvmarev0, | ||
58 | dvmaesc1, | ||
59 | dvmarev1, | ||
60 | dvmarev2, | ||
61 | dvmarev3, | ||
62 | dvmarevplus, | ||
63 | dvmahme | ||
64 | }; | ||
65 | |||
66 | #define DMA_HASCOUNT(rev) ((rev)==dvmaesc1) | ||
67 | |||
68 | /* Linux DMA information structure, filled during probe. */ | ||
69 | struct sbus_dma { | ||
70 | struct sbus_dma *next; | ||
71 | struct sbus_dev *sdev; | ||
72 | void __iomem *regs; | ||
73 | |||
74 | /* Status, misc info */ | ||
75 | int node; /* Prom node for this DMA device */ | ||
76 | int running; /* Are we doing DMA now? */ | ||
77 | int allocated; /* Are we "owned" by anyone yet? */ | ||
78 | |||
79 | /* Transfer information. */ | ||
80 | unsigned long addr; /* Start address of current transfer */ | ||
81 | int nbytes; /* Size of current transfer */ | ||
82 | int realbytes; /* For splitting up large transfers, etc. */ | ||
83 | |||
84 | /* DMA revision */ | ||
85 | enum dvma_rev revision; | ||
86 | }; | ||
87 | |||
88 | extern struct sbus_dma *dma_chain; | ||
89 | |||
90 | /* Broken hardware... */ | ||
91 | #ifdef CONFIG_SUN4 | ||
92 | /* Have to sort this out. Does rev0 work fine on sun4[cmd] without isbroken? | ||
93 | * Or is rev0 present only on sun4 boxes? -jj */ | ||
94 | #define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev0 || (dma)->revision == dvmarev1) | ||
95 | #else | ||
96 | #define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1) | ||
97 | #endif | ||
98 | #define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1) | ||
99 | |||
100 | /* Main routines in dma.c */ | ||
101 | extern void dvma_init(struct sbus_bus *); | ||
102 | |||
103 | /* Fields in the cond_reg register */ | ||
104 | /* First, the version identification bits */ | ||
105 | #define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */ | ||
106 | #define DMA_VERS0 0x00000000 /* Sunray DMA version */ | ||
107 | #define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */ | ||
108 | #define DMA_VERS1 0x80000000 /* DMA rev 1 */ | ||
109 | #define DMA_VERS2 0xa0000000 /* DMA rev 2 */ | ||
110 | #define DMA_VERHME 0xb0000000 /* DMA hme gate array */ | ||
111 | #define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */ | ||
112 | |||
113 | #define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */ | ||
114 | #define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */ | ||
115 | #define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */ | ||
116 | #define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */ | ||
117 | #define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */ | ||
118 | #define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */ | ||
119 | #define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */ | ||
120 | #define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */ | ||
121 | #define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */ | ||
122 | #define DMA_RST_BPP DMA_RST_SCSI /* Reset the BPP controller */ | ||
123 | #define DMA_ST_WRITE 0x00000100 /* write from device to memory */ | ||
124 | #define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */ | ||
125 | #define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */ | ||
126 | #define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */ | ||
127 | #define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */ | ||
128 | #define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */ | ||
129 | #define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */ | ||
130 | #define DMA_TERM_CNTR 0x00004000 /* Terminal counter */ | ||
131 | #define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */ | ||
132 | #define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */ | ||
133 | #define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */ | ||
134 | #define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */ | ||
135 | #define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */ | ||
136 | #define DMA_E_BURSTS 0x000c0000 /* ENET: SBUS r/w burst mask */ | ||
137 | #define DMA_E_BURST32 0x00040000 /* ENET: SBUS 32 byte r/w burst */ | ||
138 | #define DMA_E_BURST16 0x00000000 /* ENET: SBUS 16 byte r/w burst */ | ||
139 | #define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */ | ||
140 | #define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */ | ||
141 | #define DMA_BRST32 0x00040000 /* SCSI/BPP: 32byte bursts */ | ||
142 | #define DMA_BRST16 0x00000000 /* SCSI/BPP: 16byte bursts */ | ||
143 | #define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */ | ||
144 | #define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */ | ||
145 | #define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */ | ||
146 | #define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */ | ||
147 | #define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */ | ||
148 | #define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */ | ||
149 | #define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */ | ||
150 | #define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */ | ||
151 | #define DMA_BPP_ON DMA_SCSI_ON /* Enable BPP dma */ | ||
152 | #define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */ | ||
153 | #define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */ | ||
154 | #define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */ | ||
155 | #define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */ | ||
156 | |||
157 | /* Values describing the burst-size property from the PROM */ | ||
158 | #define DMA_BURST1 0x01 | ||
159 | #define DMA_BURST2 0x02 | ||
160 | #define DMA_BURST4 0x04 | ||
161 | #define DMA_BURST8 0x08 | ||
162 | #define DMA_BURST16 0x10 | ||
163 | #define DMA_BURST32 0x20 | ||
164 | #define DMA_BURST64 0x40 | ||
165 | #define DMA_BURSTBITS 0x7f | ||
166 | |||
167 | /* Determine highest possible final transfer address given a base */ | ||
168 | #define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL)) | ||
169 | |||
170 | /* Yes, I hack a lot of elisp in my spare time... */ | ||
171 | #define DMA_ERROR_P(regs) ((((regs)->cond_reg) & DMA_HNDL_ERROR)) | ||
172 | #define DMA_IRQ_P(regs) ((((regs)->cond_reg) & (DMA_HNDL_INTR | DMA_HNDL_ERROR))) | ||
173 | #define DMA_WRITE_P(regs) ((((regs)->cond_reg) & DMA_ST_WRITE)) | ||
174 | #define DMA_OFF(regs) ((((regs)->cond_reg) &= (~DMA_ENABLE))) | ||
175 | #define DMA_INTSOFF(regs) ((((regs)->cond_reg) &= (~DMA_INT_ENAB))) | ||
176 | #define DMA_INTSON(regs) ((((regs)->cond_reg) |= (DMA_INT_ENAB))) | ||
177 | #define DMA_PUNTFIFO(regs) ((((regs)->cond_reg) |= DMA_FIFO_INV)) | ||
178 | #define DMA_SETSTART(regs, addr) ((((regs)->st_addr) = (char *) addr)) | ||
179 | #define DMA_BEGINDMA_W(regs) \ | ||
180 | ((((regs)->cond_reg |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB)))) | ||
181 | #define DMA_BEGINDMA_R(regs) \ | ||
182 | ((((regs)->cond_reg |= ((DMA_ENABLE|DMA_INT_ENAB)&(~DMA_ST_WRITE))))) | ||
183 | |||
184 | /* For certain DMA chips, we need to disable ints upon irq entry | ||
185 | * and turn them back on when we are done. So in any ESP interrupt | ||
186 | * handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT | ||
187 | * when leaving the handler. You have been warned... | ||
188 | */ | ||
189 | #define DMA_IRQ_ENTRY(dma, dregs) do { \ | ||
190 | if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \ | ||
191 | } while (0) | ||
192 | |||
193 | #define DMA_IRQ_EXIT(dma, dregs) do { \ | ||
194 | if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \ | ||
195 | } while(0) | ||
196 | |||
197 | #if 0 /* P3 this stuff is inline in ledma.c:init_restart_ledma() */ | ||
198 | /* Pause until counter runs out or BIT isn't set in the DMA condition | ||
199 | * register. | ||
200 | */ | ||
201 | extern __inline__ void sparc_dma_pause(struct sparc_dma_registers *regs, | ||
202 | unsigned long bit) | ||
203 | { | ||
204 | int ctr = 50000; /* Let's find some bugs ;) */ | ||
205 | |||
206 | /* Busy wait until the bit is not set any more */ | ||
207 | while((regs->cond_reg&bit) && (ctr>0)) { | ||
208 | ctr--; | ||
209 | __delay(5); | ||
210 | } | ||
211 | |||
212 | /* Check for bogus outcome. */ | ||
213 | if(!ctr) | ||
214 | panic("DMA timeout"); | ||
215 | } | ||
216 | |||
217 | /* Reset the friggin' thing... */ | ||
218 | #define DMA_RESET(dma) do { \ | ||
219 | struct sparc_dma_registers *regs = dma->regs; \ | ||
220 | /* Let the current FIFO drain itself */ \ | ||
221 | sparc_dma_pause(regs, (DMA_FIFO_ISDRAIN)); \ | ||
222 | /* Reset the logic */ \ | ||
223 | regs->cond_reg |= (DMA_RST_SCSI); /* assert */ \ | ||
224 | __delay(400); /* let the bits set ;) */ \ | ||
225 | regs->cond_reg &= ~(DMA_RST_SCSI); /* de-assert */ \ | ||
226 | sparc_dma_enable_interrupts(regs); /* Re-enable interrupts */ \ | ||
227 | /* Enable FAST transfers if available */ \ | ||
228 | if(dma->revision>dvmarev1) regs->cond_reg |= DMA_3CLKS; \ | ||
229 | dma->running = 0; \ | ||
230 | } while(0) | ||
231 | #endif | ||
232 | |||
233 | #define for_each_dvma(dma) \ | ||
234 | for((dma) = dma_chain; (dma); (dma) = (dma)->next) | ||
235 | |||
236 | extern int get_dma_list(char *); | ||
237 | extern int request_dma(unsigned int, __const__ char *); | ||
238 | extern void free_dma(unsigned int); | ||
239 | |||
240 | /* From PCI */ | ||
241 | |||
242 | #ifdef CONFIG_PCI | ||
243 | extern int isa_dma_bridge_buggy; | ||
244 | #else | ||
245 | #define isa_dma_bridge_buggy (0) | ||
246 | #endif | ||
247 | |||
248 | /* Routines for data transfer buffers. */ | ||
249 | BTFIXUPDEF_CALL(char *, mmu_lockarea, char *, unsigned long) | ||
250 | BTFIXUPDEF_CALL(void, mmu_unlockarea, char *, unsigned long) | ||
251 | |||
252 | #define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len) | ||
253 | #define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len) | ||
254 | |||
255 | /* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */ | ||
256 | BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, char *, unsigned long, struct sbus_bus *sbus) | ||
257 | BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus) | ||
258 | BTFIXUPDEF_CALL(void, mmu_release_scsi_one, __u32, unsigned long, struct sbus_bus *sbus) | ||
259 | BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus) | ||
260 | |||
261 | #define mmu_get_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_get_scsi_one)(vaddr,len,sbus) | ||
262 | #define mmu_get_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_get_scsi_sgl)(sg,sz,sbus) | ||
263 | #define mmu_release_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_release_scsi_one)(vaddr,len,sbus) | ||
264 | #define mmu_release_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_release_scsi_sgl)(sg,sz,sbus) | ||
265 | |||
266 | /* | ||
267 | * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep. | ||
268 | * | ||
269 | * The mmu_map_dma_area establishes two mappings in one go. | ||
270 | * These mappings point to pages normally mapped at 'va' (linear address). | ||
271 | * First mapping is for CPU visible address at 'a', uncached. | ||
272 | * This is an alias, but it works because it is an uncached mapping. | ||
273 | * Second mapping is for device visible address, or "bus" address. | ||
274 | * The bus address is returned at '*pba'. | ||
275 | * | ||
276 | * These functions seem distinct, but are hard to split. On sun4c, | ||
277 | * at least for now, 'a' is equal to bus address, and retured in *pba. | ||
278 | * On sun4m, page attributes depend on the CPU type, so we have to | ||
279 | * know if we are mapping RAM or I/O, so it has to be an additional argument | ||
280 | * to a separate mapping function for CPU visible mappings. | ||
281 | */ | ||
282 | BTFIXUPDEF_CALL(int, mmu_map_dma_area, dma_addr_t *, unsigned long, unsigned long, int len) | ||
283 | BTFIXUPDEF_CALL(struct page *, mmu_translate_dvma, unsigned long busa) | ||
284 | BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, unsigned long busa, int len) | ||
285 | |||
286 | #define mmu_map_dma_area(pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(pba,va,a,len) | ||
287 | #define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len) | ||
288 | #define mmu_translate_dvma(ba) BTFIXUP_CALL(mmu_translate_dvma)(ba) | ||
289 | |||
290 | #endif /* !(_ASM_SPARC_DMA_H) */ | ||
diff --git a/include/asm-sparc/ebus.h b/include/asm-sparc/ebus.h new file mode 100644 index 000000000000..2d6a997c5b0c --- /dev/null +++ b/include/asm-sparc/ebus.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* $Id: ebus.h,v 1.2 1999/09/11 23:05:55 zaitcev Exp $ | ||
2 | * ebus.h: PCI to Ebus pseudo driver software state. | ||
3 | * | ||
4 | * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) | ||
5 | * | ||
6 | * Adopted for sparc by V. Roganov and G. Raiko. | ||
7 | */ | ||
8 | |||
9 | #ifndef __SPARC_EBUS_H | ||
10 | #define __SPARC_EBUS_H | ||
11 | |||
12 | #ifndef _LINUX_IOPORT_H | ||
13 | #include <linux/ioport.h> | ||
14 | #endif | ||
15 | #include <asm/oplib.h> | ||
16 | |||
17 | struct linux_ebus_child { | ||
18 | struct linux_ebus_child *next; | ||
19 | struct linux_ebus_device *parent; | ||
20 | struct linux_ebus *bus; | ||
21 | int prom_node; | ||
22 | char prom_name[64]; | ||
23 | struct resource resource[PROMREG_MAX]; | ||
24 | int num_addrs; | ||
25 | unsigned int irqs[PROMINTR_MAX]; | ||
26 | int num_irqs; | ||
27 | }; | ||
28 | |||
29 | struct linux_ebus_device { | ||
30 | struct linux_ebus_device *next; | ||
31 | struct linux_ebus_child *children; | ||
32 | struct linux_ebus *bus; | ||
33 | int prom_node; | ||
34 | char prom_name[64]; | ||
35 | struct resource resource[PROMREG_MAX]; | ||
36 | int num_addrs; | ||
37 | unsigned int irqs[PROMINTR_MAX]; | ||
38 | int num_irqs; | ||
39 | }; | ||
40 | |||
41 | struct linux_ebus { | ||
42 | struct linux_ebus *next; | ||
43 | struct linux_ebus_device *devices; | ||
44 | struct linux_pbm_info *parent; | ||
45 | struct pci_dev *self; | ||
46 | int prom_node; | ||
47 | char prom_name[64]; | ||
48 | struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX]; | ||
49 | int num_ebus_ranges; | ||
50 | }; | ||
51 | |||
52 | struct linux_ebus_dma { | ||
53 | unsigned int dcsr; | ||
54 | unsigned int dacr; | ||
55 | unsigned int dbcr; | ||
56 | }; | ||
57 | |||
58 | #define EBUS_DCSR_INT_PEND 0x00000001 | ||
59 | #define EBUS_DCSR_ERR_PEND 0x00000002 | ||
60 | #define EBUS_DCSR_DRAIN 0x00000004 | ||
61 | #define EBUS_DCSR_INT_EN 0x00000010 | ||
62 | #define EBUS_DCSR_RESET 0x00000080 | ||
63 | #define EBUS_DCSR_WRITE 0x00000100 | ||
64 | #define EBUS_DCSR_EN_DMA 0x00000200 | ||
65 | #define EBUS_DCSR_CYC_PEND 0x00000400 | ||
66 | #define EBUS_DCSR_DIAG_RD_DONE 0x00000800 | ||
67 | #define EBUS_DCSR_DIAG_WR_DONE 0x00001000 | ||
68 | #define EBUS_DCSR_EN_CNT 0x00002000 | ||
69 | #define EBUS_DCSR_TC 0x00004000 | ||
70 | #define EBUS_DCSR_DIS_CSR_DRN 0x00010000 | ||
71 | #define EBUS_DCSR_BURST_SZ_MASK 0x000c0000 | ||
72 | #define EBUS_DCSR_BURST_SZ_1 0x00080000 | ||
73 | #define EBUS_DCSR_BURST_SZ_4 0x00000000 | ||
74 | #define EBUS_DCSR_BURST_SZ_8 0x00040000 | ||
75 | #define EBUS_DCSR_BURST_SZ_16 0x000c0000 | ||
76 | #define EBUS_DCSR_DIAG_EN 0x00100000 | ||
77 | #define EBUS_DCSR_DIS_ERR_PEND 0x00400000 | ||
78 | #define EBUS_DCSR_TCI_DIS 0x00800000 | ||
79 | #define EBUS_DCSR_EN_NEXT 0x01000000 | ||
80 | #define EBUS_DCSR_DMA_ON 0x02000000 | ||
81 | #define EBUS_DCSR_A_LOADED 0x04000000 | ||
82 | #define EBUS_DCSR_NA_LOADED 0x08000000 | ||
83 | #define EBUS_DCSR_DEV_ID_MASK 0xf0000000 | ||
84 | |||
85 | extern struct linux_ebus *ebus_chain; | ||
86 | |||
87 | extern void ebus_init(void); | ||
88 | |||
89 | #define for_each_ebus(bus) \ | ||
90 | for((bus) = ebus_chain; (bus); (bus) = (bus)->next) | ||
91 | |||
92 | #define for_each_ebusdev(dev, bus) \ | ||
93 | for((dev) = (bus)->devices; (dev); (dev) = (dev)->next) | ||
94 | |||
95 | #define for_each_edevchild(dev, child) \ | ||
96 | for((child) = (dev)->children; (child); (child) = (child)->next) | ||
97 | |||
98 | #endif /* !(__SPARC_EBUS_H) */ | ||
diff --git a/include/asm-sparc/ecc.h b/include/asm-sparc/ecc.h new file mode 100644 index 000000000000..8e27ceccb76d --- /dev/null +++ b/include/asm-sparc/ecc.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* $Id: ecc.h,v 1.3 1996/04/25 06:12:57 davem Exp $ | ||
2 | * ecc.h: Definitions and defines for the external cache/memory | ||
3 | * controller on the sun4m. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_ECC_H | ||
9 | #define _SPARC_ECC_H | ||
10 | |||
11 | /* These registers are accessed through the SRMMU passthrough ASI 0x20 */ | ||
12 | #define ECC_ENABLE 0x00000000 /* ECC enable register */ | ||
13 | #define ECC_FSTATUS 0x00000008 /* ECC fault status register */ | ||
14 | #define ECC_FADDR 0x00000010 /* ECC fault address register */ | ||
15 | #define ECC_DIGNOSTIC 0x00000018 /* ECC diagnostics register */ | ||
16 | #define ECC_MBAENAB 0x00000020 /* MBus arbiter enable register */ | ||
17 | #define ECC_DMESG 0x00001000 /* Diagnostic message passing area */ | ||
18 | |||
19 | /* ECC MBus Arbiter Enable register: | ||
20 | * | ||
21 | * ---------------------------------------- | ||
22 | * | |SBUS|MOD3|MOD2|MOD1|RSV| | ||
23 | * ---------------------------------------- | ||
24 | * 31 5 4 3 2 1 0 | ||
25 | * | ||
26 | * SBUS: Enable MBus Arbiter on the SBus 0=off 1=on | ||
27 | * MOD3: Enable MBus Arbiter on MBus module 3 0=off 1=on | ||
28 | * MOD2: Enable MBus Arbiter on MBus module 2 0=off 1=on | ||
29 | * MOD1: Enable MBus Arbiter on MBus module 1 0=off 1=on | ||
30 | */ | ||
31 | |||
32 | #define ECC_MBAE_SBUS 0x00000010 | ||
33 | #define ECC_MBAE_MOD3 0x00000008 | ||
34 | #define ECC_MBAE_MOD2 0x00000004 | ||
35 | #define ECC_MBAE_MOD1 0x00000002 | ||
36 | |||
37 | /* ECC Fault Control Register layout: | ||
38 | * | ||
39 | * ----------------------------- | ||
40 | * | RESV | ECHECK | EINT | | ||
41 | * ----------------------------- | ||
42 | * 31 2 1 0 | ||
43 | * | ||
44 | * ECHECK: Enable ECC checking. 0=off 1=on | ||
45 | * EINT: Enable Interrupts for correctable errors. 0=off 1=on | ||
46 | */ | ||
47 | #define ECC_FCR_CHECK 0x00000002 | ||
48 | #define ECC_FCR_INTENAB 0x00000001 | ||
49 | |||
50 | /* ECC Fault Address Register Zero layout: | ||
51 | * | ||
52 | * ----------------------------------------------------- | ||
53 | * | MID | S | RSV | VA | BM |AT| C| SZ |TYP| PADDR | | ||
54 | * ----------------------------------------------------- | ||
55 | * 31-28 27 26-22 21-14 13 12 11 10-8 7-4 3-0 | ||
56 | * | ||
57 | * MID: ModuleID of the faulting processor. ie. who did it? | ||
58 | * S: Supervisor/Privileged access? 0=no 1=yes | ||
59 | * VA: Bits 19-12 of the virtual faulting address, these are the | ||
60 | * superset bits in the virtual cache and can be used for | ||
61 | * a flush operation if necessary. | ||
62 | * BM: Boot mode? 0=no 1=yes This is just like the SRMMU boot | ||
63 | * mode bit. | ||
64 | * AT: Did this fault happen during an atomic instruction? 0=no | ||
65 | * 1=yes. This means either an 'ldstub' or 'swap' instruction | ||
66 | * was in progress (but not finished) when this fault happened. | ||
67 | * This indicated whether the bus was locked when the fault | ||
68 | * occurred. | ||
69 | * C: Did the pte for this access indicate that it was cacheable? | ||
70 | * 0=no 1=yes | ||
71 | * SZ: The size of the transaction. | ||
72 | * TYP: The transaction type. | ||
73 | * PADDR: Bits 35-32 of the physical address for the fault. | ||
74 | */ | ||
75 | #define ECC_FADDR0_MIDMASK 0xf0000000 | ||
76 | #define ECC_FADDR0_S 0x08000000 | ||
77 | #define ECC_FADDR0_VADDR 0x003fc000 | ||
78 | #define ECC_FADDR0_BMODE 0x00002000 | ||
79 | #define ECC_FADDR0_ATOMIC 0x00001000 | ||
80 | #define ECC_FADDR0_CACHE 0x00000800 | ||
81 | #define ECC_FADDR0_SIZE 0x00000700 | ||
82 | #define ECC_FADDR0_TYPE 0x000000f0 | ||
83 | #define ECC_FADDR0_PADDR 0x0000000f | ||
84 | |||
85 | /* ECC Fault Address Register One layout: | ||
86 | * | ||
87 | * ------------------------------------- | ||
88 | * | Physical Address 31-0 | | ||
89 | * ------------------------------------- | ||
90 | * 31 0 | ||
91 | * | ||
92 | * You get the upper 4 bits of the physical address from the | ||
93 | * PADDR field in ECC Fault Address Zero register. | ||
94 | */ | ||
95 | |||
96 | /* ECC Fault Status Register layout: | ||
97 | * | ||
98 | * ---------------------------------------------- | ||
99 | * | RESV|C2E|MULT|SYNDROME|DWORD|UNC|TIMEO|BS|C| | ||
100 | * ---------------------------------------------- | ||
101 | * 31-18 17 16 15-8 7-4 3 2 1 0 | ||
102 | * | ||
103 | * C2E: A C2 graphics error occurred. 0=no 1=yes (SS10 only) | ||
104 | * MULT: Multiple errors occurred ;-O 0=no 1=prom_panic(yes) | ||
105 | * SYNDROME: Controller is mentally unstable. | ||
106 | * DWORD: | ||
107 | * UNC: Uncorrectable error. 0=no 1=yes | ||
108 | * TIMEO: Timeout occurred. 0=no 1=yes | ||
109 | * BS: C2 graphics bad slot access. 0=no 1=yes (SS10 only) | ||
110 | * C: Correctable error? 0=no 1=yes | ||
111 | */ | ||
112 | |||
113 | #define ECC_FSR_C2ERR 0x00020000 | ||
114 | #define ECC_FSR_MULT 0x00010000 | ||
115 | #define ECC_FSR_SYND 0x0000ff00 | ||
116 | #define ECC_FSR_DWORD 0x000000f0 | ||
117 | #define ECC_FSR_UNC 0x00000008 | ||
118 | #define ECC_FSR_TIMEO 0x00000004 | ||
119 | #define ECC_FSR_BADSLOT 0x00000002 | ||
120 | #define ECC_FSR_C 0x00000001 | ||
121 | |||
122 | #endif /* !(_SPARC_ECC_H) */ | ||
diff --git a/include/asm-sparc/eeprom.h b/include/asm-sparc/eeprom.h new file mode 100644 index 000000000000..a8ff7496ddf5 --- /dev/null +++ b/include/asm-sparc/eeprom.h | |||
@@ -0,0 +1,9 @@ | |||
1 | /* $Id: eeprom.h,v 1.3 1995/11/25 02:31:38 davem Exp $ | ||
2 | * eeprom.h: Definitions for the Sun eeprom. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | /* The EEPROM and the Mostek Mk48t02 use the same IO address space | ||
8 | * for their registers/data areas. The IDPROM lives here too. | ||
9 | */ | ||
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h new file mode 100644 index 000000000000..4a71d7c1eace --- /dev/null +++ b/include/asm-sparc/elf.h | |||
@@ -0,0 +1,173 @@ | |||
1 | /* $Id: elf.h,v 1.22 2000/07/12 01:27:08 davem Exp $ */ | ||
2 | #ifndef __ASMSPARC_ELF_H | ||
3 | #define __ASMSPARC_ELF_H | ||
4 | |||
5 | /* | ||
6 | * ELF register definitions.. | ||
7 | */ | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <asm/ptrace.h> | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | #include <asm/mbus.h> | ||
14 | #include <asm/uaccess.h> | ||
15 | #endif | ||
16 | |||
17 | /* | ||
18 | * Sparc section types | ||
19 | */ | ||
20 | #define STT_REGISTER 13 | ||
21 | |||
22 | /* | ||
23 | * Sparc ELF relocation types | ||
24 | */ | ||
25 | #define R_SPARC_NONE 0 | ||
26 | #define R_SPARC_8 1 | ||
27 | #define R_SPARC_16 2 | ||
28 | #define R_SPARC_32 3 | ||
29 | #define R_SPARC_DISP8 4 | ||
30 | #define R_SPARC_DISP16 5 | ||
31 | #define R_SPARC_DISP32 6 | ||
32 | #define R_SPARC_WDISP30 7 | ||
33 | #define R_SPARC_WDISP22 8 | ||
34 | #define R_SPARC_HI22 9 | ||
35 | #define R_SPARC_22 10 | ||
36 | #define R_SPARC_13 11 | ||
37 | #define R_SPARC_LO10 12 | ||
38 | #define R_SPARC_GOT10 13 | ||
39 | #define R_SPARC_GOT13 14 | ||
40 | #define R_SPARC_GOT22 15 | ||
41 | #define R_SPARC_PC10 16 | ||
42 | #define R_SPARC_PC22 17 | ||
43 | #define R_SPARC_WPLT30 18 | ||
44 | #define R_SPARC_COPY 19 | ||
45 | #define R_SPARC_GLOB_DAT 20 | ||
46 | #define R_SPARC_JMP_SLOT 21 | ||
47 | #define R_SPARC_RELATIVE 22 | ||
48 | #define R_SPARC_UA32 23 | ||
49 | #define R_SPARC_PLT32 24 | ||
50 | #define R_SPARC_HIPLT22 25 | ||
51 | #define R_SPARC_LOPLT10 26 | ||
52 | #define R_SPARC_PCPLT32 27 | ||
53 | #define R_SPARC_PCPLT22 28 | ||
54 | #define R_SPARC_PCPLT10 29 | ||
55 | #define R_SPARC_10 30 | ||
56 | #define R_SPARC_11 31 | ||
57 | #define R_SPARC_64 32 | ||
58 | #define R_SPARC_OLO10 33 | ||
59 | #define R_SPARC_WDISP16 40 | ||
60 | #define R_SPARC_WDISP19 41 | ||
61 | #define R_SPARC_7 43 | ||
62 | #define R_SPARC_5 44 | ||
63 | #define R_SPARC_6 45 | ||
64 | |||
65 | /* Bits present in AT_HWCAP, primarily for Sparc32. */ | ||
66 | |||
67 | #define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */ | ||
68 | #define HWCAP_SPARC_STBAR 2 | ||
69 | #define HWCAP_SPARC_SWAP 4 | ||
70 | #define HWCAP_SPARC_MULDIV 8 | ||
71 | #define HWCAP_SPARC_V9 16 | ||
72 | #define HWCAP_SPARC_ULTRA3 32 | ||
73 | |||
74 | /* For the most part we present code dumps in the format | ||
75 | * Solaris does. | ||
76 | */ | ||
77 | typedef unsigned long elf_greg_t; | ||
78 | #define ELF_NGREG 38 | ||
79 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
80 | |||
81 | /* Format is: | ||
82 | * G0 --> G7 | ||
83 | * O0 --> O7 | ||
84 | * L0 --> L7 | ||
85 | * I0 --> I7 | ||
86 | * PSR, PC, nPC, Y, WIM, TBR | ||
87 | */ | ||
88 | #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \ | ||
89 | do { unsigned long *dest = &(__elf_regs[0]); \ | ||
90 | struct pt_regs *src = (__pt_regs); \ | ||
91 | unsigned long __user *sp; \ | ||
92 | memcpy(&dest[0], &src->u_regs[0], \ | ||
93 | sizeof(unsigned long) * 16); \ | ||
94 | /* Don't try this at home kids... */ \ | ||
95 | sp = (unsigned long __user *) src->u_regs[14]; \ | ||
96 | copy_from_user(&dest[16], sp, \ | ||
97 | sizeof(unsigned long) * 16); \ | ||
98 | dest[32] = src->psr; \ | ||
99 | dest[33] = src->pc; \ | ||
100 | dest[34] = src->npc; \ | ||
101 | dest[35] = src->y; \ | ||
102 | dest[36] = dest[37] = 0; /* XXX */ \ | ||
103 | } while(0); /* Janitors: Don't touch this colon. */ | ||
104 | |||
105 | typedef struct { | ||
106 | union { | ||
107 | unsigned long pr_regs[32]; | ||
108 | double pr_dregs[16]; | ||
109 | } pr_fr; | ||
110 | unsigned long __unused; | ||
111 | unsigned long pr_fsr; | ||
112 | unsigned char pr_qcnt; | ||
113 | unsigned char pr_q_entrysize; | ||
114 | unsigned char pr_en; | ||
115 | unsigned int pr_q[64]; | ||
116 | } elf_fpregset_t; | ||
117 | |||
118 | #define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ | ||
119 | ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; }) | ||
120 | |||
121 | /* | ||
122 | * This is used to ensure we don't load something for the wrong architecture. | ||
123 | */ | ||
124 | #define elf_check_arch(x) ((x)->e_machine == EM_SPARC) | ||
125 | |||
126 | /* | ||
127 | * These are used to set parameters in the core dumps. | ||
128 | */ | ||
129 | #define ELF_ARCH EM_SPARC | ||
130 | #define ELF_CLASS ELFCLASS32 | ||
131 | #define ELF_DATA ELFDATA2MSB | ||
132 | |||
133 | #define USE_ELF_CORE_DUMP | ||
134 | #ifndef CONFIG_SUN4 | ||
135 | #define ELF_EXEC_PAGESIZE 4096 | ||
136 | #else | ||
137 | #define ELF_EXEC_PAGESIZE 8192 | ||
138 | #endif | ||
139 | |||
140 | |||
141 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
142 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
143 | the loader. We need to make sure that it is out of the way of the program | ||
144 | that it will "exec", and that there is sufficient room for the brk. */ | ||
145 | |||
146 | #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE) | ||
147 | |||
148 | /* This yields a mask that user programs can use to figure out what | ||
149 | instruction set this cpu supports. This can NOT be done in userspace | ||
150 | on Sparc. */ | ||
151 | |||
152 | /* Sun4c has none of the capabilities, most sun4m's have them all. | ||
153 | * XXX This is gross, set some global variable at boot time. -DaveM | ||
154 | */ | ||
155 | #define ELF_HWCAP ((ARCH_SUN4C_SUN4) ? 0 : \ | ||
156 | (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ | ||
157 | HWCAP_SPARC_SWAP | \ | ||
158 | ((srmmu_modtype != Cypress && \ | ||
159 | srmmu_modtype != Cypress_vE && \ | ||
160 | srmmu_modtype != Cypress_vD) ? \ | ||
161 | HWCAP_SPARC_MULDIV : 0))) | ||
162 | |||
163 | /* This yields a string that ld.so will use to load implementation | ||
164 | specific libraries for optimization. This is more specific in | ||
165 | intent than poking at uname or /proc/cpuinfo. */ | ||
166 | |||
167 | #define ELF_PLATFORM (NULL) | ||
168 | |||
169 | #ifdef __KERNEL__ | ||
170 | #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) | ||
171 | #endif | ||
172 | |||
173 | #endif /* !(__ASMSPARC_ELF_H) */ | ||
diff --git a/include/asm-sparc/errno.h b/include/asm-sparc/errno.h new file mode 100644 index 000000000000..8c01c5f3b06d --- /dev/null +++ b/include/asm-sparc/errno.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* $Id: errno.h,v 1.6 1997/04/15 09:03:38 davem Exp $ */ | ||
2 | #ifndef _SPARC_ERRNO_H | ||
3 | #define _SPARC_ERRNO_H | ||
4 | |||
5 | /* These match the SunOS error numbering scheme. */ | ||
6 | |||
7 | #include <asm-generic/errno-base.h> | ||
8 | |||
9 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
10 | #define EINPROGRESS 36 /* Operation now in progress */ | ||
11 | #define EALREADY 37 /* Operation already in progress */ | ||
12 | #define ENOTSOCK 38 /* Socket operation on non-socket */ | ||
13 | #define EDESTADDRREQ 39 /* Destination address required */ | ||
14 | #define EMSGSIZE 40 /* Message too long */ | ||
15 | #define EPROTOTYPE 41 /* Protocol wrong type for socket */ | ||
16 | #define ENOPROTOOPT 42 /* Protocol not available */ | ||
17 | #define EPROTONOSUPPORT 43 /* Protocol not supported */ | ||
18 | #define ESOCKTNOSUPPORT 44 /* Socket type not supported */ | ||
19 | #define EOPNOTSUPP 45 /* Op not supported on transport endpoint */ | ||
20 | #define EPFNOSUPPORT 46 /* Protocol family not supported */ | ||
21 | #define EAFNOSUPPORT 47 /* Address family not supported by protocol */ | ||
22 | #define EADDRINUSE 48 /* Address already in use */ | ||
23 | #define EADDRNOTAVAIL 49 /* Cannot assign requested address */ | ||
24 | #define ENETDOWN 50 /* Network is down */ | ||
25 | #define ENETUNREACH 51 /* Network is unreachable */ | ||
26 | #define ENETRESET 52 /* Net dropped connection because of reset */ | ||
27 | #define ECONNABORTED 53 /* Software caused connection abort */ | ||
28 | #define ECONNRESET 54 /* Connection reset by peer */ | ||
29 | #define ENOBUFS 55 /* No buffer space available */ | ||
30 | #define EISCONN 56 /* Transport endpoint is already connected */ | ||
31 | #define ENOTCONN 57 /* Transport endpoint is not connected */ | ||
32 | #define ESHUTDOWN 58 /* No send after transport endpoint shutdown */ | ||
33 | #define ETOOMANYREFS 59 /* Too many references: cannot splice */ | ||
34 | #define ETIMEDOUT 60 /* Connection timed out */ | ||
35 | #define ECONNREFUSED 61 /* Connection refused */ | ||
36 | #define ELOOP 62 /* Too many symbolic links encountered */ | ||
37 | #define ENAMETOOLONG 63 /* File name too long */ | ||
38 | #define EHOSTDOWN 64 /* Host is down */ | ||
39 | #define EHOSTUNREACH 65 /* No route to host */ | ||
40 | #define ENOTEMPTY 66 /* Directory not empty */ | ||
41 | #define EPROCLIM 67 /* SUNOS: Too many processes */ | ||
42 | #define EUSERS 68 /* Too many users */ | ||
43 | #define EDQUOT 69 /* Quota exceeded */ | ||
44 | #define ESTALE 70 /* Stale NFS file handle */ | ||
45 | #define EREMOTE 71 /* Object is remote */ | ||
46 | #define ENOSTR 72 /* Device not a stream */ | ||
47 | #define ETIME 73 /* Timer expired */ | ||
48 | #define ENOSR 74 /* Out of streams resources */ | ||
49 | #define ENOMSG 75 /* No message of desired type */ | ||
50 | #define EBADMSG 76 /* Not a data message */ | ||
51 | #define EIDRM 77 /* Identifier removed */ | ||
52 | #define EDEADLK 78 /* Resource deadlock would occur */ | ||
53 | #define ENOLCK 79 /* No record locks available */ | ||
54 | #define ENONET 80 /* Machine is not on the network */ | ||
55 | #define ERREMOTE 81 /* SunOS: Too many lvls of remote in path */ | ||
56 | #define ENOLINK 82 /* Link has been severed */ | ||
57 | #define EADV 83 /* Advertise error */ | ||
58 | #define ESRMNT 84 /* Srmount error */ | ||
59 | #define ECOMM 85 /* Communication error on send */ | ||
60 | #define EPROTO 86 /* Protocol error */ | ||
61 | #define EMULTIHOP 87 /* Multihop attempted */ | ||
62 | #define EDOTDOT 88 /* RFS specific error */ | ||
63 | #define EREMCHG 89 /* Remote address changed */ | ||
64 | #define ENOSYS 90 /* Function not implemented */ | ||
65 | |||
66 | /* The rest have no SunOS equivalent. */ | ||
67 | #define ESTRPIPE 91 /* Streams pipe error */ | ||
68 | #define EOVERFLOW 92 /* Value too large for defined data type */ | ||
69 | #define EBADFD 93 /* File descriptor in bad state */ | ||
70 | #define ECHRNG 94 /* Channel number out of range */ | ||
71 | #define EL2NSYNC 95 /* Level 2 not synchronized */ | ||
72 | #define EL3HLT 96 /* Level 3 halted */ | ||
73 | #define EL3RST 97 /* Level 3 reset */ | ||
74 | #define ELNRNG 98 /* Link number out of range */ | ||
75 | #define EUNATCH 99 /* Protocol driver not attached */ | ||
76 | #define ENOCSI 100 /* No CSI structure available */ | ||
77 | #define EL2HLT 101 /* Level 2 halted */ | ||
78 | #define EBADE 102 /* Invalid exchange */ | ||
79 | #define EBADR 103 /* Invalid request descriptor */ | ||
80 | #define EXFULL 104 /* Exchange full */ | ||
81 | #define ENOANO 105 /* No anode */ | ||
82 | #define EBADRQC 106 /* Invalid request code */ | ||
83 | #define EBADSLT 107 /* Invalid slot */ | ||
84 | #define EDEADLOCK 108 /* File locking deadlock error */ | ||
85 | #define EBFONT 109 /* Bad font file format */ | ||
86 | #define ELIBEXEC 110 /* Cannot exec a shared library directly */ | ||
87 | #define ENODATA 111 /* No data available */ | ||
88 | #define ELIBBAD 112 /* Accessing a corrupted shared library */ | ||
89 | #define ENOPKG 113 /* Package not installed */ | ||
90 | #define ELIBACC 114 /* Can not access a needed shared library */ | ||
91 | #define ENOTUNIQ 115 /* Name not unique on network */ | ||
92 | #define ERESTART 116 /* Interrupted syscall should be restarted */ | ||
93 | #define EUCLEAN 117 /* Structure needs cleaning */ | ||
94 | #define ENOTNAM 118 /* Not a XENIX named type file */ | ||
95 | #define ENAVAIL 119 /* No XENIX semaphores available */ | ||
96 | #define EISNAM 120 /* Is a named type file */ | ||
97 | #define EREMOTEIO 121 /* Remote I/O error */ | ||
98 | #define EILSEQ 122 /* Illegal byte sequence */ | ||
99 | #define ELIBMAX 123 /* Atmpt to link in too many shared libs */ | ||
100 | #define ELIBSCN 124 /* .lib section in a.out corrupted */ | ||
101 | |||
102 | #define ENOMEDIUM 125 /* No medium found */ | ||
103 | #define EMEDIUMTYPE 126 /* Wrong medium type */ | ||
104 | #define ECANCELED 127 /* Operation Cancelled */ | ||
105 | #define ENOKEY 128 /* Required key not available */ | ||
106 | #define EKEYEXPIRED 129 /* Key has expired */ | ||
107 | #define EKEYREVOKED 130 /* Key has been revoked */ | ||
108 | #define EKEYREJECTED 131 /* Key was rejected by service */ | ||
109 | |||
110 | #endif | ||
diff --git a/include/asm-sparc/fbio.h b/include/asm-sparc/fbio.h new file mode 100644 index 000000000000..c2b27e7a7cad --- /dev/null +++ b/include/asm-sparc/fbio.h | |||
@@ -0,0 +1,297 @@ | |||
1 | #ifndef __LINUX_FBIO_H | ||
2 | #define __LINUX_FBIO_H | ||
3 | |||
4 | /* Constants used for fbio SunOS compatibility */ | ||
5 | /* (C) 1996 Miguel de Icaza */ | ||
6 | |||
7 | /* Frame buffer types */ | ||
8 | #define FBTYPE_NOTYPE -1 | ||
9 | #define FBTYPE_SUN1BW 0 /* mono */ | ||
10 | #define FBTYPE_SUN1COLOR 1 | ||
11 | #define FBTYPE_SUN2BW 2 | ||
12 | #define FBTYPE_SUN2COLOR 3 | ||
13 | #define FBTYPE_SUN2GP 4 | ||
14 | #define FBTYPE_SUN5COLOR 5 | ||
15 | #define FBTYPE_SUN3COLOR 6 | ||
16 | #define FBTYPE_MEMCOLOR 7 | ||
17 | #define FBTYPE_SUN4COLOR 8 | ||
18 | |||
19 | #define FBTYPE_NOTSUN1 9 | ||
20 | #define FBTYPE_NOTSUN2 10 | ||
21 | #define FBTYPE_NOTSUN3 11 | ||
22 | |||
23 | #define FBTYPE_SUNFAST_COLOR 12 /* cg6 */ | ||
24 | #define FBTYPE_SUNROP_COLOR 13 | ||
25 | #define FBTYPE_SUNFB_VIDEO 14 | ||
26 | #define FBTYPE_SUNGIFB 15 | ||
27 | #define FBTYPE_SUNGPLAS 16 | ||
28 | #define FBTYPE_SUNGP3 17 | ||
29 | #define FBTYPE_SUNGT 18 | ||
30 | #define FBTYPE_SUNLEO 19 /* zx Leo card */ | ||
31 | #define FBTYPE_MDICOLOR 20 /* cg14 */ | ||
32 | #define FBTYPE_TCXCOLOR 21 /* SUNW,tcx card */ | ||
33 | |||
34 | #define FBTYPE_LASTPLUSONE 21 /* This is not last + 1 in fact... */ | ||
35 | |||
36 | /* Does not seem to be listed in the Sun file either */ | ||
37 | #define FBTYPE_CREATOR 22 | ||
38 | #define FBTYPE_PCI_IGA1682 23 | ||
39 | #define FBTYPE_P9100COLOR 24 | ||
40 | |||
41 | /* fbio ioctls */ | ||
42 | /* Returned by FBIOGTYPE */ | ||
43 | struct fbtype { | ||
44 | int fb_type; /* fb type, see above */ | ||
45 | int fb_height; /* pixels */ | ||
46 | int fb_width; /* pixels */ | ||
47 | int fb_depth; | ||
48 | int fb_cmsize; /* color map entries */ | ||
49 | int fb_size; /* fb size in bytes */ | ||
50 | }; | ||
51 | #define FBIOGTYPE _IOR('F', 0, struct fbtype) | ||
52 | |||
53 | struct fbcmap { | ||
54 | int index; /* first element (0 origin) */ | ||
55 | int count; | ||
56 | unsigned char __user *red; | ||
57 | unsigned char __user *green; | ||
58 | unsigned char __user *blue; | ||
59 | }; | ||
60 | |||
61 | #ifdef __KERNEL__ | ||
62 | #define FBIOPUTCMAP_SPARC _IOW('F', 3, struct fbcmap) | ||
63 | #define FBIOGETCMAP_SPARC _IOW('F', 4, struct fbcmap) | ||
64 | #else | ||
65 | #define FBIOPUTCMAP _IOW('F', 3, struct fbcmap) | ||
66 | #define FBIOGETCMAP _IOW('F', 4, struct fbcmap) | ||
67 | #endif | ||
68 | |||
69 | /* # of device specific values */ | ||
70 | #define FB_ATTR_NDEVSPECIFIC 8 | ||
71 | /* # of possible emulations */ | ||
72 | #define FB_ATTR_NEMUTYPES 4 | ||
73 | |||
74 | struct fbsattr { | ||
75 | int flags; | ||
76 | int emu_type; /* -1 if none */ | ||
77 | int dev_specific[FB_ATTR_NDEVSPECIFIC]; | ||
78 | }; | ||
79 | |||
80 | struct fbgattr { | ||
81 | int real_type; /* real frame buffer type */ | ||
82 | int owner; /* unknown */ | ||
83 | struct fbtype fbtype; /* real frame buffer fbtype */ | ||
84 | struct fbsattr sattr; | ||
85 | int emu_types[FB_ATTR_NEMUTYPES]; /* supported emulations */ | ||
86 | }; | ||
87 | #define FBIOSATTR _IOW('F', 5, struct fbgattr) /* Unsupported: */ | ||
88 | #define FBIOGATTR _IOR('F', 6, struct fbgattr) /* supported */ | ||
89 | |||
90 | #define FBIOSVIDEO _IOW('F', 7, int) | ||
91 | #define FBIOGVIDEO _IOR('F', 8, int) | ||
92 | |||
93 | struct fbcursor { | ||
94 | short set; /* what to set, choose from the list above */ | ||
95 | short enable; /* cursor on/off */ | ||
96 | struct fbcurpos pos; /* cursor position */ | ||
97 | struct fbcurpos hot; /* cursor hot spot */ | ||
98 | struct fbcmap cmap; /* color map info */ | ||
99 | struct fbcurpos size; /* cursor bit map size */ | ||
100 | char *image; /* cursor image bits */ | ||
101 | char *mask; /* cursor mask bits */ | ||
102 | }; | ||
103 | |||
104 | /* set/get cursor attributes/shape */ | ||
105 | #define FBIOSCURSOR _IOW('F', 24, struct fbcursor) | ||
106 | #define FBIOGCURSOR _IOWR('F', 25, struct fbcursor) | ||
107 | |||
108 | /* set/get cursor position */ | ||
109 | #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos) | ||
110 | #define FBIOGCURPOS _IOW('F', 27, struct fbcurpos) | ||
111 | |||
112 | /* get max cursor size */ | ||
113 | #define FBIOGCURMAX _IOR('F', 28, struct fbcurpos) | ||
114 | |||
115 | /* wid manipulation */ | ||
116 | struct fb_wid_alloc { | ||
117 | #define FB_WID_SHARED_8 0 | ||
118 | #define FB_WID_SHARED_24 1 | ||
119 | #define FB_WID_DBL_8 2 | ||
120 | #define FB_WID_DBL_24 3 | ||
121 | __u32 wa_type; | ||
122 | __s32 wa_index; /* Set on return */ | ||
123 | __u32 wa_count; | ||
124 | }; | ||
125 | struct fb_wid_item { | ||
126 | __u32 wi_type; | ||
127 | __s32 wi_index; | ||
128 | __u32 wi_attrs; | ||
129 | __u32 wi_values[32]; | ||
130 | }; | ||
131 | struct fb_wid_list { | ||
132 | __u32 wl_flags; | ||
133 | __u32 wl_count; | ||
134 | struct fb_wid_item *wl_list; | ||
135 | }; | ||
136 | |||
137 | #define FBIO_WID_ALLOC _IOWR('F', 30, struct fb_wid_alloc) | ||
138 | #define FBIO_WID_FREE _IOW('F', 31, struct fb_wid_alloc) | ||
139 | #define FBIO_WID_PUT _IOW('F', 32, struct fb_wid_list) | ||
140 | #define FBIO_WID_GET _IOWR('F', 33, struct fb_wid_list) | ||
141 | |||
142 | /* Creator ioctls */ | ||
143 | #define FFB_IOCTL ('F'<<8) | ||
144 | #define FFB_SYS_INFO (FFB_IOCTL|80) | ||
145 | #define FFB_CLUTREAD (FFB_IOCTL|81) | ||
146 | #define FFB_CLUTPOST (FFB_IOCTL|82) | ||
147 | #define FFB_SETDIAGMODE (FFB_IOCTL|83) | ||
148 | #define FFB_GETMONITORID (FFB_IOCTL|84) | ||
149 | #define FFB_GETVIDEOMODE (FFB_IOCTL|85) | ||
150 | #define FFB_SETVIDEOMODE (FFB_IOCTL|86) | ||
151 | #define FFB_SETSERVER (FFB_IOCTL|87) | ||
152 | #define FFB_SETOVCTL (FFB_IOCTL|88) | ||
153 | #define FFB_GETOVCTL (FFB_IOCTL|89) | ||
154 | #define FFB_GETSAXNUM (FFB_IOCTL|90) | ||
155 | #define FFB_FBDEBUG (FFB_IOCTL|91) | ||
156 | |||
157 | /* Cg14 ioctls */ | ||
158 | #define MDI_IOCTL ('M'<<8) | ||
159 | #define MDI_RESET (MDI_IOCTL|1) | ||
160 | #define MDI_GET_CFGINFO (MDI_IOCTL|2) | ||
161 | #define MDI_SET_PIXELMODE (MDI_IOCTL|3) | ||
162 | # define MDI_32_PIX 32 | ||
163 | # define MDI_16_PIX 16 | ||
164 | # define MDI_8_PIX 8 | ||
165 | |||
166 | struct mdi_cfginfo { | ||
167 | int mdi_ncluts; /* Number of implemented CLUTs in this MDI */ | ||
168 | int mdi_type; /* FBTYPE name */ | ||
169 | int mdi_height; /* height */ | ||
170 | int mdi_width; /* widht */ | ||
171 | int mdi_size; /* available ram */ | ||
172 | int mdi_mode; /* 8bpp, 16bpp or 32bpp */ | ||
173 | int mdi_pixfreq; /* pixel clock (from PROM) */ | ||
174 | }; | ||
175 | |||
176 | /* SparcLinux specific ioctl for the MDI, should be replaced for | ||
177 | * the SET_XLUT/SET_CLUTn ioctls instead | ||
178 | */ | ||
179 | #define MDI_CLEAR_XLUT (MDI_IOCTL|9) | ||
180 | |||
181 | /* leo & ffb ioctls */ | ||
182 | struct fb_clut_alloc { | ||
183 | __u32 clutid; /* Set on return */ | ||
184 | __u32 flag; | ||
185 | __u32 index; | ||
186 | }; | ||
187 | |||
188 | struct fb_clut { | ||
189 | #define FB_CLUT_WAIT 0x00000001 /* Not yet implemented */ | ||
190 | __u32 flag; | ||
191 | __u32 clutid; | ||
192 | __u32 offset; | ||
193 | __u32 count; | ||
194 | char * red; | ||
195 | char * green; | ||
196 | char * blue; | ||
197 | }; | ||
198 | |||
199 | struct fb_clut32 { | ||
200 | __u32 flag; | ||
201 | __u32 clutid; | ||
202 | __u32 offset; | ||
203 | __u32 count; | ||
204 | __u32 red; | ||
205 | __u32 green; | ||
206 | __u32 blue; | ||
207 | }; | ||
208 | |||
209 | #define LEO_CLUTALLOC _IOWR('L', 53, struct fb_clut_alloc) | ||
210 | #define LEO_CLUTFREE _IOW('L', 54, struct fb_clut_alloc) | ||
211 | #define LEO_CLUTREAD _IOW('L', 55, struct fb_clut) | ||
212 | #define LEO_CLUTPOST _IOW('L', 56, struct fb_clut) | ||
213 | #define LEO_SETGAMMA _IOW('L', 68, int) /* Not yet implemented */ | ||
214 | #define LEO_GETGAMMA _IOR('L', 69, int) /* Not yet implemented */ | ||
215 | |||
216 | #ifdef __KERNEL__ | ||
217 | /* Addresses on the fd of a cgsix that are mappable */ | ||
218 | #define CG6_FBC 0x70000000 | ||
219 | #define CG6_TEC 0x70001000 | ||
220 | #define CG6_BTREGS 0x70002000 | ||
221 | #define CG6_FHC 0x70004000 | ||
222 | #define CG6_THC 0x70005000 | ||
223 | #define CG6_ROM 0x70006000 | ||
224 | #define CG6_RAM 0x70016000 | ||
225 | #define CG6_DHC 0x80000000 | ||
226 | |||
227 | #define CG3_MMAP_OFFSET 0x4000000 | ||
228 | |||
229 | /* Addresses on the fd of a tcx that are mappable */ | ||
230 | #define TCX_RAM8BIT 0x00000000 | ||
231 | #define TCX_RAM24BIT 0x01000000 | ||
232 | #define TCX_UNK3 0x10000000 | ||
233 | #define TCX_UNK4 0x20000000 | ||
234 | #define TCX_CONTROLPLANE 0x28000000 | ||
235 | #define TCX_UNK6 0x30000000 | ||
236 | #define TCX_UNK7 0x38000000 | ||
237 | #define TCX_TEC 0x70000000 | ||
238 | #define TCX_BTREGS 0x70002000 | ||
239 | #define TCX_THC 0x70004000 | ||
240 | #define TCX_DHC 0x70008000 | ||
241 | #define TCX_ALT 0x7000a000 | ||
242 | #define TCX_SYNC 0x7000e000 | ||
243 | #define TCX_UNK2 0x70010000 | ||
244 | |||
245 | /* CG14 definitions */ | ||
246 | |||
247 | /* Offsets into the OBIO space: */ | ||
248 | #define CG14_REGS 0 /* registers */ | ||
249 | #define CG14_CURSORREGS 0x1000 /* cursor registers */ | ||
250 | #define CG14_DACREGS 0x2000 /* DAC registers */ | ||
251 | #define CG14_XLUT 0x3000 /* X Look Up Table -- ??? */ | ||
252 | #define CG14_CLUT1 0x4000 /* Color Look Up Table */ | ||
253 | #define CG14_CLUT2 0x5000 /* Color Look Up Table */ | ||
254 | #define CG14_CLUT3 0x6000 /* Color Look Up Table */ | ||
255 | #define CG14_AUTO 0xf000 | ||
256 | |||
257 | #endif /* KERNEL */ | ||
258 | |||
259 | /* These are exported to userland for applications to use */ | ||
260 | /* Mappable offsets for the cg14: control registers */ | ||
261 | #define MDI_DIRECT_MAP 0x10000000 | ||
262 | #define MDI_CTLREG_MAP 0x20000000 | ||
263 | #define MDI_CURSOR_MAP 0x30000000 | ||
264 | #define MDI_SHDW_VRT_MAP 0x40000000 | ||
265 | |||
266 | /* Mappable offsets for the cg14: frame buffer resolutions */ | ||
267 | /* 32 bits */ | ||
268 | #define MDI_CHUNKY_XBGR_MAP 0x50000000 | ||
269 | #define MDI_CHUNKY_BGR_MAP 0x60000000 | ||
270 | |||
271 | /* 16 bits */ | ||
272 | #define MDI_PLANAR_X16_MAP 0x70000000 | ||
273 | #define MDI_PLANAR_C16_MAP 0x80000000 | ||
274 | |||
275 | /* 8 bit is done as CG3 MMAP offset */ | ||
276 | /* 32 bits, planar */ | ||
277 | #define MDI_PLANAR_X32_MAP 0x90000000 | ||
278 | #define MDI_PLANAR_B32_MAP 0xa0000000 | ||
279 | #define MDI_PLANAR_G32_MAP 0xb0000000 | ||
280 | #define MDI_PLANAR_R32_MAP 0xc0000000 | ||
281 | |||
282 | /* Mappable offsets on leo */ | ||
283 | #define LEO_SS0_MAP 0x00000000 | ||
284 | #define LEO_LC_SS0_USR_MAP 0x00800000 | ||
285 | #define LEO_LD_SS0_MAP 0x00801000 | ||
286 | #define LEO_LX_CURSOR_MAP 0x00802000 | ||
287 | #define LEO_SS1_MAP 0x00803000 | ||
288 | #define LEO_LC_SS1_USR_MAP 0x01003000 | ||
289 | #define LEO_LD_SS1_MAP 0x01004000 | ||
290 | #define LEO_UNK_MAP 0x01005000 | ||
291 | #define LEO_LX_KRN_MAP 0x01006000 | ||
292 | #define LEO_LC_SS0_KRN_MAP 0x01007000 | ||
293 | #define LEO_LC_SS1_KRN_MAP 0x01008000 | ||
294 | #define LEO_LD_GBL_MAP 0x01009000 | ||
295 | #define LEO_UNK2_MAP 0x0100a000 | ||
296 | |||
297 | #endif /* __LINUX_FBIO_H */ | ||
diff --git a/include/asm-sparc/fcntl.h b/include/asm-sparc/fcntl.h new file mode 100644 index 000000000000..df9c75d41d68 --- /dev/null +++ b/include/asm-sparc/fcntl.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* $Id: fcntl.h,v 1.16 2001/09/20 00:35:33 davem Exp $ */ | ||
2 | #ifndef _SPARC_FCNTL_H | ||
3 | #define _SPARC_FCNTL_H | ||
4 | |||
5 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
6 | located on an ext2 file system */ | ||
7 | #define O_RDONLY 0x0000 | ||
8 | #define O_WRONLY 0x0001 | ||
9 | #define O_RDWR 0x0002 | ||
10 | #define O_ACCMODE 0x0003 | ||
11 | #define O_APPEND 0x0008 | ||
12 | #define FASYNC 0x0040 /* fcntl, for BSD compatibility */ | ||
13 | #define O_CREAT 0x0200 /* not fcntl */ | ||
14 | #define O_TRUNC 0x0400 /* not fcntl */ | ||
15 | #define O_EXCL 0x0800 /* not fcntl */ | ||
16 | #define O_SYNC 0x2000 | ||
17 | #define O_NONBLOCK 0x4000 | ||
18 | #define O_NDELAY (0x0004 | O_NONBLOCK) | ||
19 | #define O_NOCTTY 0x8000 /* not fcntl */ | ||
20 | #define O_DIRECTORY 0x10000 /* must be a directory */ | ||
21 | #define O_NOFOLLOW 0x20000 /* don't follow links */ | ||
22 | #define O_LARGEFILE 0x40000 | ||
23 | #define O_DIRECT 0x100000 /* direct disk access hint */ | ||
24 | #define O_NOATIME 0x200000 | ||
25 | |||
26 | #define F_DUPFD 0 /* dup */ | ||
27 | #define F_GETFD 1 /* get close_on_exec */ | ||
28 | #define F_SETFD 2 /* set/clear close_on_exec */ | ||
29 | #define F_GETFL 3 /* get file->f_flags */ | ||
30 | #define F_SETFL 4 /* set file->f_flags */ | ||
31 | #define F_GETOWN 5 /* for sockets. */ | ||
32 | #define F_SETOWN 6 /* for sockets. */ | ||
33 | #define F_GETLK 7 | ||
34 | #define F_SETLK 8 | ||
35 | #define F_SETLKW 9 | ||
36 | #define F_SETSIG 10 /* for sockets. */ | ||
37 | #define F_GETSIG 11 /* for sockets. */ | ||
38 | |||
39 | #define F_GETLK64 12 /* using 'struct flock64' */ | ||
40 | #define F_SETLK64 13 | ||
41 | #define F_SETLKW64 14 | ||
42 | |||
43 | /* for F_[GET|SET]FL */ | ||
44 | #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ | ||
45 | |||
46 | /* for posix fcntl() and lockf() */ | ||
47 | #define F_RDLCK 1 | ||
48 | #define F_WRLCK 2 | ||
49 | #define F_UNLCK 3 | ||
50 | |||
51 | /* for old implementation of bsd flock () */ | ||
52 | #define F_EXLCK 4 /* or 3 */ | ||
53 | #define F_SHLCK 8 /* or 4 */ | ||
54 | |||
55 | /* for leases */ | ||
56 | #define F_INPROGRESS 16 | ||
57 | |||
58 | /* operations for bsd flock(), also used by the kernel implementation */ | ||
59 | #define LOCK_SH 1 /* shared lock */ | ||
60 | #define LOCK_EX 2 /* exclusive lock */ | ||
61 | #define LOCK_NB 4 /* or'd with one of the above to prevent | ||
62 | blocking */ | ||
63 | #define LOCK_UN 8 /* remove lock */ | ||
64 | |||
65 | #define LOCK_MAND 32 /* This is a mandatory flock */ | ||
66 | #define LOCK_READ 64 /* ... Which allows concurrent read operations */ | ||
67 | #define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ | ||
68 | #define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ | ||
69 | |||
70 | struct flock { | ||
71 | short l_type; | ||
72 | short l_whence; | ||
73 | off_t l_start; | ||
74 | off_t l_len; | ||
75 | pid_t l_pid; | ||
76 | short __unused; | ||
77 | }; | ||
78 | |||
79 | struct flock64 { | ||
80 | short l_type; | ||
81 | short l_whence; | ||
82 | loff_t l_start; | ||
83 | loff_t l_len; | ||
84 | pid_t l_pid; | ||
85 | short __unused; | ||
86 | }; | ||
87 | |||
88 | #define F_LINUX_SPECIFIC_BASE 1024 | ||
89 | #endif | ||
diff --git a/include/asm-sparc/fixmap.h b/include/asm-sparc/fixmap.h new file mode 100644 index 000000000000..9de52b4d2cfb --- /dev/null +++ b/include/asm-sparc/fixmap.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * fixmap.h: compile-time virtual memory allocation | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 1998 Ingo Molnar | ||
9 | * | ||
10 | * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_FIXMAP_H | ||
14 | #define _ASM_FIXMAP_H | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <asm/page.h> | ||
19 | #ifdef CONFIG_HIGHMEM | ||
20 | #include <linux/threads.h> | ||
21 | #include <asm/kmap_types.h> | ||
22 | #endif | ||
23 | |||
24 | /* | ||
25 | * Here we define all the compile-time 'special' virtual | ||
26 | * addresses. The point is to have a constant address at | ||
27 | * compile time, but to set the physical address only | ||
28 | * in the boot process. We allocate these special addresses | ||
29 | * from the top of unused virtual memory (0xfd000000 - 1 page) backwards. | ||
30 | * Also this lets us do fail-safe vmalloc(), we | ||
31 | * can guarantee that these special addresses and | ||
32 | * vmalloc()-ed addresses never overlap. | ||
33 | * | ||
34 | * these 'compile-time allocated' memory buffers are | ||
35 | * fixed-size 4k pages. (or larger if used with an increment | ||
36 | * highger than 1) use fixmap_set(idx,phys) to associate | ||
37 | * physical memory with fixmap indices. | ||
38 | * | ||
39 | * TLB entries of such buffers will not be flushed across | ||
40 | * task switches. | ||
41 | */ | ||
42 | |||
43 | /* | ||
44 | * on UP currently we will have no trace of the fixmap mechanism, | ||
45 | * no page table allocations, etc. This might change in the | ||
46 | * future, say framebuffers for the console driver(s) could be | ||
47 | * fix-mapped? | ||
48 | */ | ||
49 | enum fixed_addresses { | ||
50 | FIX_HOLE, | ||
51 | #ifdef CONFIG_HIGHMEM | ||
52 | FIX_KMAP_BEGIN, | ||
53 | FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, | ||
54 | #endif | ||
55 | __end_of_fixed_addresses | ||
56 | }; | ||
57 | |||
58 | extern void __set_fixmap (enum fixed_addresses idx, | ||
59 | unsigned long phys, pgprot_t flags); | ||
60 | |||
61 | #define set_fixmap(idx, phys) \ | ||
62 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
63 | /* | ||
64 | * Some hardware wants to get fixmapped without caching. | ||
65 | */ | ||
66 | #define set_fixmap_nocache(idx, phys) \ | ||
67 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
68 | /* | ||
69 | * used by vmalloc.c. | ||
70 | * | ||
71 | * Leave one empty page between IO pages at 0xfd000000 and | ||
72 | * the start of the fixmap. | ||
73 | */ | ||
74 | #define FIXADDR_TOP (0xfcfff000UL) | ||
75 | #define FIXADDR_SIZE ((__end_of_fixed_addresses) << PAGE_SHIFT) | ||
76 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
77 | |||
78 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
79 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
80 | |||
81 | extern void __this_fixmap_does_not_exist(void); | ||
82 | |||
83 | /* | ||
84 | * 'index to address' translation. If anyone tries to use the idx | ||
85 | * directly without tranlation, we catch the bug with a NULL-deference | ||
86 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
87 | */ | ||
88 | static inline unsigned long fix_to_virt(const unsigned int idx) | ||
89 | { | ||
90 | /* | ||
91 | * this branch gets completely eliminated after inlining, | ||
92 | * except when someone tries to use fixaddr indices in an | ||
93 | * illegal way. (such as mixing up address types or using | ||
94 | * out-of-range indices). | ||
95 | * | ||
96 | * If it doesn't get removed, the linker will complain | ||
97 | * loudly with a reasonably clear error message.. | ||
98 | */ | ||
99 | if (idx >= __end_of_fixed_addresses) | ||
100 | __this_fixmap_does_not_exist(); | ||
101 | |||
102 | return __fix_to_virt(idx); | ||
103 | } | ||
104 | |||
105 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
106 | { | ||
107 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
108 | return __virt_to_fix(vaddr); | ||
109 | } | ||
110 | |||
111 | #endif | ||
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h new file mode 100644 index 000000000000..780ee7ff9dc3 --- /dev/null +++ b/include/asm-sparc/floppy.h | |||
@@ -0,0 +1,369 @@ | |||
1 | /* asm-sparc/floppy.h: Sparc specific parts of the Floppy driver. | ||
2 | * | ||
3 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
4 | */ | ||
5 | |||
6 | #ifndef __ASM_SPARC_FLOPPY_H | ||
7 | #define __ASM_SPARC_FLOPPY_H | ||
8 | |||
9 | #include <asm/page.h> | ||
10 | #include <asm/pgtable.h> | ||
11 | #include <asm/system.h> | ||
12 | #include <asm/idprom.h> | ||
13 | #include <asm/machines.h> | ||
14 | #include <asm/oplib.h> | ||
15 | #include <asm/auxio.h> | ||
16 | #include <asm/irq.h> | ||
17 | |||
18 | /* We don't need no stinkin' I/O port allocation crap. */ | ||
19 | #undef release_region | ||
20 | #undef check_region | ||
21 | #undef request_region | ||
22 | #define release_region(X, Y) do { } while(0) | ||
23 | #define check_region(X, Y) (0) | ||
24 | #define request_region(X, Y, Z) (1) | ||
25 | |||
26 | /* References: | ||
27 | * 1) Netbsd Sun floppy driver. | ||
28 | * 2) NCR 82077 controller manual | ||
29 | * 3) Intel 82077 controller manual | ||
30 | */ | ||
31 | struct sun_flpy_controller { | ||
32 | volatile unsigned char status_82072; /* Main Status reg. */ | ||
33 | #define dcr_82072 status_82072 /* Digital Control reg. */ | ||
34 | #define status1_82077 status_82072 /* Auxiliary Status reg. 1 */ | ||
35 | |||
36 | volatile unsigned char data_82072; /* Data fifo. */ | ||
37 | #define status2_82077 data_82072 /* Auxiliary Status reg. 2 */ | ||
38 | |||
39 | volatile unsigned char dor_82077; /* Digital Output reg. */ | ||
40 | volatile unsigned char tapectl_82077; /* What the? Tape control reg? */ | ||
41 | |||
42 | volatile unsigned char status_82077; /* Main Status Register. */ | ||
43 | #define drs_82077 status_82077 /* Digital Rate Select reg. */ | ||
44 | |||
45 | volatile unsigned char data_82077; /* Data fifo. */ | ||
46 | volatile unsigned char ___unused; | ||
47 | volatile unsigned char dir_82077; /* Digital Input reg. */ | ||
48 | #define dcr_82077 dir_82077 /* Config Control reg. */ | ||
49 | }; | ||
50 | |||
51 | /* You'll only ever find one controller on a SparcStation anyways. */ | ||
52 | static struct sun_flpy_controller *sun_fdc = NULL; | ||
53 | volatile unsigned char *fdc_status; | ||
54 | |||
55 | struct sun_floppy_ops { | ||
56 | unsigned char (*fd_inb)(int port); | ||
57 | void (*fd_outb)(unsigned char value, int port); | ||
58 | }; | ||
59 | |||
60 | static struct sun_floppy_ops sun_fdops; | ||
61 | |||
62 | #define fd_inb(port) sun_fdops.fd_inb(port) | ||
63 | #define fd_outb(value,port) sun_fdops.fd_outb(value,port) | ||
64 | #define fd_enable_dma() sun_fd_enable_dma() | ||
65 | #define fd_disable_dma() sun_fd_disable_dma() | ||
66 | #define fd_request_dma() (0) /* nothing... */ | ||
67 | #define fd_free_dma() /* nothing... */ | ||
68 | #define fd_clear_dma_ff() /* nothing... */ | ||
69 | #define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode) | ||
70 | #define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr) | ||
71 | #define fd_set_dma_count(count) sun_fd_set_dma_count(count) | ||
72 | #define fd_enable_irq() /* nothing... */ | ||
73 | #define fd_disable_irq() /* nothing... */ | ||
74 | #define fd_cacheflush(addr, size) /* nothing... */ | ||
75 | #define fd_request_irq() sun_fd_request_irq() | ||
76 | #define fd_free_irq() /* nothing... */ | ||
77 | #if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */ | ||
78 | #define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size)) | ||
79 | #define fd_dma_mem_free(addr,size) (vfree((void *)(addr))) | ||
80 | #endif | ||
81 | |||
82 | #define FLOPPY_MOTOR_MASK 0x10 | ||
83 | |||
84 | /* XXX This isn't really correct. XXX */ | ||
85 | #define get_dma_residue(x) (0) | ||
86 | |||
87 | #define FLOPPY0_TYPE 4 | ||
88 | #define FLOPPY1_TYPE 0 | ||
89 | |||
90 | /* Super paranoid... */ | ||
91 | #undef HAVE_DISABLE_HLT | ||
92 | |||
93 | /* Here is where we catch the floppy driver trying to initialize, | ||
94 | * therefore this is where we call the PROM device tree probing | ||
95 | * routine etc. on the Sparc. | ||
96 | */ | ||
97 | #define FDC1 sun_floppy_init() | ||
98 | |||
99 | #define N_FDC 1 | ||
100 | #define N_DRIVE 8 | ||
101 | |||
102 | /* No 64k boundary crossing problems on the Sparc. */ | ||
103 | #define CROSS_64KB(a,s) (0) | ||
104 | |||
105 | /* Routines unique to each controller type on a Sun. */ | ||
106 | static unsigned char sun_82072_fd_inb(int port) | ||
107 | { | ||
108 | udelay(5); | ||
109 | switch(port & 7) { | ||
110 | default: | ||
111 | printk("floppy: Asked to read unknown port %d\n", port); | ||
112 | panic("floppy: Port bolixed."); | ||
113 | case 4: /* FD_STATUS */ | ||
114 | return sun_fdc->status_82072 & ~STATUS_DMA; | ||
115 | case 5: /* FD_DATA */ | ||
116 | return sun_fdc->data_82072; | ||
117 | case 7: /* FD_DIR */ | ||
118 | return (get_auxio() & AUXIO_FLPY_DCHG)? 0x80: 0; | ||
119 | }; | ||
120 | panic("sun_82072_fd_inb: How did I get here?"); | ||
121 | } | ||
122 | |||
123 | static void sun_82072_fd_outb(unsigned char value, int port) | ||
124 | { | ||
125 | udelay(5); | ||
126 | switch(port & 7) { | ||
127 | default: | ||
128 | printk("floppy: Asked to write to unknown port %d\n", port); | ||
129 | panic("floppy: Port bolixed."); | ||
130 | case 2: /* FD_DOR */ | ||
131 | /* Oh geese, 82072 on the Sun has no DOR register, | ||
132 | * the functionality is implemented via the AUXIO | ||
133 | * I/O register. So we must emulate the behavior. | ||
134 | * | ||
135 | * ASSUMPTIONS: There will only ever be one floppy | ||
136 | * drive attached to a Sun controller | ||
137 | * and it will be at drive zero. | ||
138 | */ | ||
139 | { | ||
140 | unsigned bits = 0; | ||
141 | if (value & 0x10) bits |= AUXIO_FLPY_DSEL; | ||
142 | if ((value & 0x80) == 0) bits |= AUXIO_FLPY_EJCT; | ||
143 | set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT)); | ||
144 | } | ||
145 | break; | ||
146 | case 5: /* FD_DATA */ | ||
147 | sun_fdc->data_82072 = value; | ||
148 | break; | ||
149 | case 7: /* FD_DCR */ | ||
150 | sun_fdc->dcr_82072 = value; | ||
151 | break; | ||
152 | case 4: /* FD_STATUS */ | ||
153 | sun_fdc->status_82072 = value; | ||
154 | break; | ||
155 | }; | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | static unsigned char sun_82077_fd_inb(int port) | ||
160 | { | ||
161 | udelay(5); | ||
162 | switch(port & 7) { | ||
163 | default: | ||
164 | printk("floppy: Asked to read unknown port %d\n", port); | ||
165 | panic("floppy: Port bolixed."); | ||
166 | case 4: /* FD_STATUS */ | ||
167 | return sun_fdc->status_82077 & ~STATUS_DMA; | ||
168 | case 5: /* FD_DATA */ | ||
169 | return sun_fdc->data_82077; | ||
170 | case 7: /* FD_DIR */ | ||
171 | /* XXX: Is DCL on 0x80 in sun4m? */ | ||
172 | return sun_fdc->dir_82077; | ||
173 | }; | ||
174 | panic("sun_82072_fd_inb: How did I get here?"); | ||
175 | } | ||
176 | |||
177 | static void sun_82077_fd_outb(unsigned char value, int port) | ||
178 | { | ||
179 | udelay(5); | ||
180 | switch(port & 7) { | ||
181 | default: | ||
182 | printk("floppy: Asked to write to unknown port %d\n", port); | ||
183 | panic("floppy: Port bolixed."); | ||
184 | case 2: /* FD_DOR */ | ||
185 | /* Happily, the 82077 has a real DOR register. */ | ||
186 | sun_fdc->dor_82077 = value; | ||
187 | break; | ||
188 | case 5: /* FD_DATA */ | ||
189 | sun_fdc->data_82077 = value; | ||
190 | break; | ||
191 | case 7: /* FD_DCR */ | ||
192 | sun_fdc->dcr_82077 = value; | ||
193 | break; | ||
194 | case 4: /* FD_STATUS */ | ||
195 | sun_fdc->status_82077 = value; | ||
196 | break; | ||
197 | }; | ||
198 | return; | ||
199 | } | ||
200 | |||
201 | /* For pseudo-dma (Sun floppy drives have no real DMA available to | ||
202 | * them so we must eat the data fifo bytes directly ourselves) we have | ||
203 | * three state variables. doing_pdma tells our inline low-level | ||
204 | * assembly floppy interrupt entry point whether it should sit and eat | ||
205 | * bytes from the fifo or just transfer control up to the higher level | ||
206 | * floppy interrupt c-code. I tried very hard but I could not get the | ||
207 | * pseudo-dma to work in c-code without getting many overruns and | ||
208 | * underruns. If non-zero, doing_pdma encodes the direction of | ||
209 | * the transfer for debugging. 1=read 2=write | ||
210 | */ | ||
211 | char *pdma_vaddr; | ||
212 | unsigned long pdma_size; | ||
213 | volatile int doing_pdma = 0; | ||
214 | |||
215 | /* This is software state */ | ||
216 | char *pdma_base = NULL; | ||
217 | unsigned long pdma_areasize; | ||
218 | |||
219 | /* Common routines to all controller types on the Sparc. */ | ||
220 | static __inline__ void virtual_dma_init(void) | ||
221 | { | ||
222 | /* nothing... */ | ||
223 | } | ||
224 | |||
225 | static __inline__ void sun_fd_disable_dma(void) | ||
226 | { | ||
227 | doing_pdma = 0; | ||
228 | if (pdma_base) { | ||
229 | mmu_unlockarea(pdma_base, pdma_areasize); | ||
230 | pdma_base = 0; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | static __inline__ void sun_fd_set_dma_mode(int mode) | ||
235 | { | ||
236 | switch(mode) { | ||
237 | case DMA_MODE_READ: | ||
238 | doing_pdma = 1; | ||
239 | break; | ||
240 | case DMA_MODE_WRITE: | ||
241 | doing_pdma = 2; | ||
242 | break; | ||
243 | default: | ||
244 | printk("Unknown dma mode %d\n", mode); | ||
245 | panic("floppy: Giving up..."); | ||
246 | } | ||
247 | } | ||
248 | |||
249 | static __inline__ void sun_fd_set_dma_addr(char *buffer) | ||
250 | { | ||
251 | pdma_vaddr = buffer; | ||
252 | } | ||
253 | |||
254 | static __inline__ void sun_fd_set_dma_count(int length) | ||
255 | { | ||
256 | pdma_size = length; | ||
257 | } | ||
258 | |||
259 | static __inline__ void sun_fd_enable_dma(void) | ||
260 | { | ||
261 | pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size); | ||
262 | pdma_base = pdma_vaddr; | ||
263 | pdma_areasize = pdma_size; | ||
264 | } | ||
265 | |||
266 | /* Our low-level entry point in arch/sparc/kernel/entry.S */ | ||
267 | irqreturn_t floppy_hardint(int irq, void *unused, struct pt_regs *regs); | ||
268 | |||
269 | static int sun_fd_request_irq(void) | ||
270 | { | ||
271 | static int once = 0; | ||
272 | int error; | ||
273 | |||
274 | if(!once) { | ||
275 | once = 1; | ||
276 | error = request_fast_irq(FLOPPY_IRQ, floppy_hardint, SA_INTERRUPT, "floppy"); | ||
277 | return ((error == 0) ? 0 : -1); | ||
278 | } else return 0; | ||
279 | } | ||
280 | |||
281 | static struct linux_prom_registers fd_regs[2]; | ||
282 | |||
283 | static int sun_floppy_init(void) | ||
284 | { | ||
285 | char state[128]; | ||
286 | int tnode, fd_node, num_regs; | ||
287 | struct resource r; | ||
288 | |||
289 | use_virtual_dma = 1; | ||
290 | |||
291 | FLOPPY_IRQ = 11; | ||
292 | /* Forget it if we aren't on a machine that could possibly | ||
293 | * ever have a floppy drive. | ||
294 | */ | ||
295 | if((sparc_cpu_model != sun4c && sparc_cpu_model != sun4m) || | ||
296 | ((idprom->id_machtype == (SM_SUN4C | SM_4C_SLC)) || | ||
297 | (idprom->id_machtype == (SM_SUN4C | SM_4C_ELC)))) { | ||
298 | /* We certainly don't have a floppy controller. */ | ||
299 | goto no_sun_fdc; | ||
300 | } | ||
301 | /* Well, try to find one. */ | ||
302 | tnode = prom_getchild(prom_root_node); | ||
303 | fd_node = prom_searchsiblings(tnode, "obio"); | ||
304 | if(fd_node != 0) { | ||
305 | tnode = prom_getchild(fd_node); | ||
306 | fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo"); | ||
307 | } else { | ||
308 | fd_node = prom_searchsiblings(tnode, "fd"); | ||
309 | } | ||
310 | if(fd_node == 0) { | ||
311 | goto no_sun_fdc; | ||
312 | } | ||
313 | |||
314 | /* The sun4m lets us know if the controller is actually usable. */ | ||
315 | if(sparc_cpu_model == sun4m && | ||
316 | prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) { | ||
317 | if(!strcmp(state, "disabled")) { | ||
318 | goto no_sun_fdc; | ||
319 | } | ||
320 | } | ||
321 | num_regs = prom_getproperty(fd_node, "reg", (char *) fd_regs, sizeof(fd_regs)); | ||
322 | num_regs = (num_regs / sizeof(fd_regs[0])); | ||
323 | prom_apply_obio_ranges(fd_regs, num_regs); | ||
324 | memset(&r, 0, sizeof(r)); | ||
325 | r.flags = fd_regs[0].which_io; | ||
326 | r.start = fd_regs[0].phys_addr; | ||
327 | sun_fdc = (struct sun_flpy_controller *) | ||
328 | sbus_ioremap(&r, 0, fd_regs[0].reg_size, "floppy"); | ||
329 | |||
330 | /* Last minute sanity check... */ | ||
331 | if(sun_fdc->status_82072 == 0xff) { | ||
332 | sun_fdc = NULL; | ||
333 | goto no_sun_fdc; | ||
334 | } | ||
335 | |||
336 | if(sparc_cpu_model == sun4c) { | ||
337 | sun_fdops.fd_inb = sun_82072_fd_inb; | ||
338 | sun_fdops.fd_outb = sun_82072_fd_outb; | ||
339 | fdc_status = &sun_fdc->status_82072; | ||
340 | /* printk("AUXIO @0x%lx\n", auxio_register); */ /* P3 */ | ||
341 | } else { | ||
342 | sun_fdops.fd_inb = sun_82077_fd_inb; | ||
343 | sun_fdops.fd_outb = sun_82077_fd_outb; | ||
344 | fdc_status = &sun_fdc->status_82077; | ||
345 | /* printk("DOR @0x%p\n", &sun_fdc->dor_82077); */ /* P3 */ | ||
346 | } | ||
347 | |||
348 | /* Success... */ | ||
349 | allowed_drive_mask = 0x01; | ||
350 | return (int) sun_fdc; | ||
351 | |||
352 | no_sun_fdc: | ||
353 | return -1; | ||
354 | } | ||
355 | |||
356 | static int sparc_eject(void) | ||
357 | { | ||
358 | set_dor(0x00, 0xff, 0x90); | ||
359 | udelay(500); | ||
360 | set_dor(0x00, 0x6f, 0x00); | ||
361 | udelay(500); | ||
362 | return 0; | ||
363 | } | ||
364 | |||
365 | #define fd_eject(drive) sparc_eject() | ||
366 | |||
367 | #define EXTRA_FLOPPY_PARAMS | ||
368 | |||
369 | #endif /* !(__ASM_SPARC_FLOPPY_H) */ | ||
diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h new file mode 100644 index 000000000000..2a668c479f68 --- /dev/null +++ b/include/asm-sparc/hardirq.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* hardirq.h: 32-bit Sparc hard IRQ support. | ||
2 | * | ||
3 | * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) | ||
4 | * Copyright (C) 1998-2000 Anton Blanchard (anton@samba.org) | ||
5 | */ | ||
6 | |||
7 | #ifndef __SPARC_HARDIRQ_H | ||
8 | #define __SPARC_HARDIRQ_H | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <linux/threads.h> | ||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/cache.h> | ||
14 | |||
15 | /* entry.S is sensitive to the offsets of these fields */ /* XXX P3 Is it? */ | ||
16 | typedef struct { | ||
17 | unsigned int __softirq_pending; | ||
18 | } ____cacheline_aligned irq_cpustat_t; | ||
19 | |||
20 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
21 | |||
22 | #define HARDIRQ_BITS 8 | ||
23 | |||
24 | #endif /* __SPARC_HARDIRQ_H */ | ||
diff --git a/include/asm-sparc/hdreg.h b/include/asm-sparc/hdreg.h new file mode 100644 index 000000000000..7f7fd1af0af3 --- /dev/null +++ b/include/asm-sparc/hdreg.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/hdreg.h> | |||
diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h new file mode 100644 index 000000000000..1a03c28da92d --- /dev/null +++ b/include/asm-sparc/head.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* $Id: head.h,v 1.39 2000/05/26 22:18:45 ecd Exp $ */ | ||
2 | #ifndef __SPARC_HEAD_H | ||
3 | #define __SPARC_HEAD_H | ||
4 | |||
5 | #define KERNBASE 0xf0000000 /* First address the kernel will eventually be */ | ||
6 | #define LOAD_ADDR 0x4000 /* prom jumps to us here unless this is elf /boot */ | ||
7 | #define SUN4C_SEGSZ (1 << 18) | ||
8 | #define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2) /* Used in boot remapping. */ | ||
9 | #define INTS_ENAB 0x01 /* entry.S uses this. */ | ||
10 | |||
11 | #define SUN4_PROM_VECTOR 0xFFE81000 /* SUN4 PROM needs to be hardwired */ | ||
12 | |||
13 | #define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */ | ||
14 | #define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */ | ||
15 | |||
16 | /* Here are some trap goodies */ | ||
17 | |||
18 | /* Generic trap entry. */ | ||
19 | #define TRAP_ENTRY(type, label) \ | ||
20 | rd %psr, %l0; b label; rd %wim, %l3; nop; | ||
21 | |||
22 | /* Data/text faults. Defaults to sun4c version at boot time. */ | ||
23 | #define SPARC_TFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 1, %l7; | ||
24 | #define SPARC_DFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 0, %l7; | ||
25 | #define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7; | ||
26 | #define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7; | ||
27 | |||
28 | /* This is for traps we should NEVER get. */ | ||
29 | #define BAD_TRAP(num) \ | ||
30 | rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3; | ||
31 | |||
32 | /* This is for traps when we want just skip the instruction which caused it */ | ||
33 | #define SKIP_TRAP(type, name) \ | ||
34 | jmpl %l2, %g0; rett %l2 + 4; nop; nop; | ||
35 | |||
36 | /* Notice that for the system calls we pull a trick. We load up a | ||
37 | * different pointer to the system call vector table in %l7, but call | ||
38 | * the same generic system call low-level entry point. The trap table | ||
39 | * entry sequences are also HyperSparc pipeline friendly ;-) | ||
40 | */ | ||
41 | |||
42 | /* Software trap for Linux system calls. */ | ||
43 | #define LINUX_SYSCALL_TRAP \ | ||
44 | sethi %hi(sys_call_table), %l7; \ | ||
45 | or %l7, %lo(sys_call_table), %l7; \ | ||
46 | b linux_sparc_syscall; \ | ||
47 | rd %psr, %l0; | ||
48 | |||
49 | /* Software trap for SunOS4.1.x system calls. */ | ||
50 | #define SUNOS_SYSCALL_TRAP \ | ||
51 | rd %psr, %l0; \ | ||
52 | sethi %hi(sunos_sys_table), %l7; \ | ||
53 | b linux_sparc_syscall; \ | ||
54 | or %l7, %lo(sunos_sys_table), %l7; | ||
55 | |||
56 | #define SUNOS_NO_SYSCALL_TRAP \ | ||
57 | b sunos_syscall; \ | ||
58 | rd %psr, %l0; \ | ||
59 | nop; \ | ||
60 | nop; | ||
61 | |||
62 | /* Software trap for Slowaris system calls. */ | ||
63 | #define SOLARIS_SYSCALL_TRAP \ | ||
64 | b solaris_syscall; \ | ||
65 | rd %psr, %l0; \ | ||
66 | nop; \ | ||
67 | nop; | ||
68 | |||
69 | #define INDIRECT_SOLARIS_SYSCALL(x) \ | ||
70 | mov x, %g1; \ | ||
71 | b solaris_syscall; \ | ||
72 | rd %psr, %l0; \ | ||
73 | nop; | ||
74 | |||
75 | #define BREAKPOINT_TRAP \ | ||
76 | b breakpoint_trap; \ | ||
77 | rd %psr,%l0; \ | ||
78 | nop; \ | ||
79 | nop; | ||
80 | |||
81 | /* Software trap for Sparc-netbsd system calls. */ | ||
82 | #define NETBSD_SYSCALL_TRAP \ | ||
83 | sethi %hi(sys_call_table), %l7; \ | ||
84 | or %l7, %lo(sys_call_table), %l7; \ | ||
85 | b bsd_syscall; \ | ||
86 | rd %psr, %l0; | ||
87 | |||
88 | /* The Get Condition Codes software trap for userland. */ | ||
89 | #define GETCC_TRAP \ | ||
90 | b getcc_trap_handler; mov %psr, %l0; nop; nop; | ||
91 | |||
92 | /* The Set Condition Codes software trap for userland. */ | ||
93 | #define SETCC_TRAP \ | ||
94 | b setcc_trap_handler; mov %psr, %l0; nop; nop; | ||
95 | |||
96 | /* The Get PSR software trap for userland. */ | ||
97 | #define GETPSR_TRAP \ | ||
98 | mov %psr, %i0; jmp %l2; rett %l2 + 4; nop; | ||
99 | |||
100 | /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and | ||
101 | * gets handled with another macro. | ||
102 | */ | ||
103 | #define TRAP_ENTRY_INTERRUPT(int_level) \ | ||
104 | mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3; | ||
105 | |||
106 | /* NMI's (Non Maskable Interrupts) are special, you can't keep them | ||
107 | * from coming in, and basically if you get one, the shows over. ;( | ||
108 | * On the sun4c they are usually asynchronous memory errors, on the | ||
109 | * the sun4m they could be either due to mem errors or a software | ||
110 | * initiated interrupt from the prom/kern on an SMP box saying "I | ||
111 | * command you to do CPU tricks, read your mailbox for more info." | ||
112 | */ | ||
113 | #define NMI_TRAP \ | ||
114 | rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop; | ||
115 | |||
116 | /* Window overflows/underflows are special and we need to try to be as | ||
117 | * efficient as possible here.... | ||
118 | */ | ||
119 | #define WINDOW_SPILL \ | ||
120 | rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0; | ||
121 | |||
122 | #define WINDOW_FILL \ | ||
123 | rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0; | ||
124 | |||
125 | #endif /* __SPARC_HEAD_H */ | ||
diff --git a/include/asm-sparc/highmem.h b/include/asm-sparc/highmem.h new file mode 100644 index 000000000000..3de42e776274 --- /dev/null +++ b/include/asm-sparc/highmem.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * highmem.h: virtual kernel memory mappings for high memory | ||
3 | * | ||
4 | * Used in CONFIG_HIGHMEM systems for memory pages which | ||
5 | * are not addressable by direct kernel virtual addresses. | ||
6 | * | ||
7 | * Copyright (C) 1999 Gerhard Wichert, Siemens AG | ||
8 | * Gerhard.Wichert@pdb.siemens.de | ||
9 | * | ||
10 | * | ||
11 | * Redesigned the x86 32-bit VM architecture to deal with | ||
12 | * up to 16 Terrabyte physical memory. With current x86 CPUs | ||
13 | * we now support up to 64 Gigabytes physical RAM. | ||
14 | * | ||
15 | * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> | ||
16 | */ | ||
17 | |||
18 | #ifndef _ASM_HIGHMEM_H | ||
19 | #define _ASM_HIGHMEM_H | ||
20 | |||
21 | #ifdef __KERNEL__ | ||
22 | |||
23 | #include <linux/interrupt.h> | ||
24 | #include <asm/fixmap.h> | ||
25 | #include <asm/vaddrs.h> | ||
26 | #include <asm/kmap_types.h> | ||
27 | #include <asm/pgtable.h> | ||
28 | |||
29 | /* declarations for highmem.c */ | ||
30 | extern unsigned long highstart_pfn, highend_pfn; | ||
31 | |||
32 | extern pte_t *kmap_pte; | ||
33 | extern pgprot_t kmap_prot; | ||
34 | extern pte_t *pkmap_page_table; | ||
35 | |||
36 | extern void kmap_init(void) __init; | ||
37 | |||
38 | /* | ||
39 | * Right now we initialize only a single pte table. It can be extended | ||
40 | * easily, subsequent pte tables have to be allocated in one physical | ||
41 | * chunk of RAM. Currently the simplest way to do this is to align the | ||
42 | * pkmap region on a pagetable boundary (4MB). | ||
43 | */ | ||
44 | #define LAST_PKMAP 1024 | ||
45 | #define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT) | ||
46 | #define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT)) | ||
47 | |||
48 | #define LAST_PKMAP_MASK (LAST_PKMAP - 1) | ||
49 | #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT) | ||
50 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) | ||
51 | |||
52 | #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP)) | ||
53 | |||
54 | extern void *kmap_high(struct page *page); | ||
55 | extern void kunmap_high(struct page *page); | ||
56 | |||
57 | static inline void *kmap(struct page *page) | ||
58 | { | ||
59 | BUG_ON(in_interrupt()); | ||
60 | if (!PageHighMem(page)) | ||
61 | return page_address(page); | ||
62 | return kmap_high(page); | ||
63 | } | ||
64 | |||
65 | static inline void kunmap(struct page *page) | ||
66 | { | ||
67 | BUG_ON(in_interrupt()); | ||
68 | if (!PageHighMem(page)) | ||
69 | return; | ||
70 | kunmap_high(page); | ||
71 | } | ||
72 | |||
73 | extern void *kmap_atomic(struct page *page, enum km_type type); | ||
74 | extern void kunmap_atomic(void *kvaddr, enum km_type type); | ||
75 | extern struct page *kmap_atomic_to_page(void *vaddr); | ||
76 | |||
77 | #define flush_cache_kmaps() flush_cache_all() | ||
78 | |||
79 | #endif /* __KERNEL__ */ | ||
80 | |||
81 | #endif /* _ASM_HIGHMEM_H */ | ||
diff --git a/include/asm-sparc/hw_irq.h b/include/asm-sparc/hw_irq.h new file mode 100644 index 000000000000..8d30a7694be2 --- /dev/null +++ b/include/asm-sparc/hw_irq.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_SPARC_HW_IRQ_H | ||
2 | #define __ASM_SPARC_HW_IRQ_H | ||
3 | |||
4 | /* Dummy include. */ | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h new file mode 100644 index 000000000000..64d810385ea4 --- /dev/null +++ b/include/asm-sparc/ide.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /* $Id: ide.h,v 1.7 2002/01/16 20:58:40 davem Exp $ | ||
2 | * ide.h: SPARC PCI specific IDE glue. | ||
3 | * | ||
4 | * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) | ||
5 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) | ||
6 | * Adaptation from sparc64 version to sparc by Pete Zaitcev. | ||
7 | */ | ||
8 | |||
9 | #ifndef _SPARC_IDE_H | ||
10 | #define _SPARC_IDE_H | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <asm/pgtable.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/psr.h> | ||
18 | |||
19 | #undef MAX_HWIFS | ||
20 | #define MAX_HWIFS 2 | ||
21 | |||
22 | #define IDE_ARCH_OBSOLETE_INIT | ||
23 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
24 | |||
25 | #define __ide_insl(data_reg, buffer, wcount) \ | ||
26 | __ide_insw(data_reg, buffer, (wcount)<<1) | ||
27 | #define __ide_outsl(data_reg, buffer, wcount) \ | ||
28 | __ide_outsw(data_reg, buffer, (wcount)<<1) | ||
29 | |||
30 | /* On sparc, I/O ports and MMIO registers are accessed identically. */ | ||
31 | #define __ide_mm_insw __ide_insw | ||
32 | #define __ide_mm_insl __ide_insl | ||
33 | #define __ide_mm_outsw __ide_outsw | ||
34 | #define __ide_mm_outsl __ide_outsl | ||
35 | |||
36 | static __inline__ void __ide_insw(unsigned long port, | ||
37 | void *dst, | ||
38 | unsigned long count) | ||
39 | { | ||
40 | volatile unsigned short *data_port; | ||
41 | /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */ | ||
42 | u16 *ps = dst; | ||
43 | u32 *pi; | ||
44 | |||
45 | data_port = (volatile unsigned short *)port; | ||
46 | |||
47 | if(((unsigned long)ps) & 0x2) { | ||
48 | *ps++ = *data_port; | ||
49 | count--; | ||
50 | } | ||
51 | pi = (u32 *)ps; | ||
52 | while(count >= 2) { | ||
53 | u32 w; | ||
54 | |||
55 | w = (*data_port) << 16; | ||
56 | w |= (*data_port); | ||
57 | *pi++ = w; | ||
58 | count -= 2; | ||
59 | } | ||
60 | ps = (u16 *)pi; | ||
61 | if(count) | ||
62 | *ps++ = *data_port; | ||
63 | |||
64 | /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */ | ||
65 | } | ||
66 | |||
67 | static __inline__ void __ide_outsw(unsigned long port, | ||
68 | const void *src, | ||
69 | unsigned long count) | ||
70 | { | ||
71 | volatile unsigned short *data_port; | ||
72 | /* unsigned long end = (unsigned long)src + (count << 1); */ | ||
73 | const u16 *ps = src; | ||
74 | const u32 *pi; | ||
75 | |||
76 | data_port = (volatile unsigned short *)port; | ||
77 | |||
78 | if(((unsigned long)src) & 0x2) { | ||
79 | *data_port = *ps++; | ||
80 | count--; | ||
81 | } | ||
82 | pi = (const u32 *)ps; | ||
83 | while(count >= 2) { | ||
84 | u32 w; | ||
85 | |||
86 | w = *pi++; | ||
87 | *data_port = (w >> 16); | ||
88 | *data_port = w; | ||
89 | count -= 2; | ||
90 | } | ||
91 | ps = (const u16 *)pi; | ||
92 | if(count) | ||
93 | *data_port = *ps; | ||
94 | |||
95 | /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */ | ||
96 | } | ||
97 | |||
98 | #endif /* __KERNEL__ */ | ||
99 | |||
100 | #endif /* _SPARC_IDE_H */ | ||
diff --git a/include/asm-sparc/idprom.h b/include/asm-sparc/idprom.h new file mode 100644 index 000000000000..d856e640acd3 --- /dev/null +++ b/include/asm-sparc/idprom.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* $Id: idprom.h,v 1.6 1996/08/04 10:35:07 ecd Exp $ | ||
2 | * idprom.h: Macros and defines for idprom routines | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_IDPROM_H | ||
8 | #define _SPARC_IDPROM_H | ||
9 | |||
10 | /* Offset into the EEPROM where the id PROM is located on the 4c */ | ||
11 | #define IDPROM_OFFSET 0x7d8 | ||
12 | |||
13 | /* On sun4m; physical. */ | ||
14 | /* MicroSPARC(-II) does not decode 31rd bit, but it works. */ | ||
15 | #define IDPROM_OFFSET_M 0xfd8 | ||
16 | |||
17 | struct idprom | ||
18 | { | ||
19 | unsigned char id_format; /* Format identifier (always 0x01) */ | ||
20 | unsigned char id_machtype; /* Machine type */ | ||
21 | unsigned char id_ethaddr[6]; /* Hardware ethernet address */ | ||
22 | long id_date; /* Date of manufacture */ | ||
23 | unsigned int id_sernum:24; /* Unique serial number */ | ||
24 | unsigned char id_cksum; /* Checksum - xor of the data bytes */ | ||
25 | unsigned char reserved[16]; | ||
26 | }; | ||
27 | |||
28 | extern struct idprom *idprom; | ||
29 | extern void idprom_init(void); | ||
30 | |||
31 | #define IDPROM_SIZE (sizeof(struct idprom)) | ||
32 | |||
33 | #endif /* !(_SPARC_IDPROM_H) */ | ||
diff --git a/include/asm-sparc/io-unit.h b/include/asm-sparc/io-unit.h new file mode 100644 index 000000000000..96823b47fd45 --- /dev/null +++ b/include/asm-sparc/io-unit.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* io-unit.h: Definitions for the sun4d IO-UNIT. | ||
2 | * | ||
3 | * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
4 | */ | ||
5 | #ifndef _SPARC_IO_UNIT_H | ||
6 | #define _SPARC_IO_UNIT_H | ||
7 | |||
8 | #include <linux/spinlock.h> | ||
9 | #include <asm/page.h> | ||
10 | #include <asm/pgtable.h> | ||
11 | |||
12 | /* The io-unit handles all virtual to physical address translations | ||
13 | * that occur between the SBUS and physical memory. Access by | ||
14 | * the cpu to IO registers and similar go over the xdbus so are | ||
15 | * translated by the on chip SRMMU. The io-unit and the srmmu do | ||
16 | * not need to have the same translations at all, in fact most | ||
17 | * of the time the translations they handle are a disjunct set. | ||
18 | * Basically the io-unit handles all dvma sbus activity. | ||
19 | */ | ||
20 | |||
21 | /* AIEEE, unlike the nice sun4m, these monsters have | ||
22 | fixed DMA range 64M */ | ||
23 | |||
24 | #define IOUNIT_DMA_BASE 0xfc000000 /* TOP - 64M */ | ||
25 | #define IOUNIT_DMA_SIZE 0x04000000 /* 64M */ | ||
26 | /* We use last 1M for sparc_dvma_malloc */ | ||
27 | #define IOUNIT_DVMA_SIZE 0x00100000 /* 1M */ | ||
28 | |||
29 | /* The format of an iopte in the external page tables */ | ||
30 | #define IOUPTE_PAGE 0xffffff00 /* Physical page number (PA[35:12]) */ | ||
31 | #define IOUPTE_CACHE 0x00000080 /* Cached (in Viking/MXCC) */ | ||
32 | /* XXX Jakub, find out how to program SBUS streaming cache on XDBUS/sun4d. | ||
33 | * XXX Actually, all you should need to do is find out where the registers | ||
34 | * XXX are and copy over the sparc64 implementation I wrote. There may be | ||
35 | * XXX some horrible hwbugs though, so be careful. -DaveM | ||
36 | */ | ||
37 | #define IOUPTE_STREAM 0x00000040 /* Translation can use streaming cache */ | ||
38 | #define IOUPTE_INTRA 0x00000008 /* SBUS direct slot->slot transfer */ | ||
39 | #define IOUPTE_WRITE 0x00000004 /* Writeable */ | ||
40 | #define IOUPTE_VALID 0x00000002 /* IOPTE is valid */ | ||
41 | #define IOUPTE_PARITY 0x00000001 /* Parity is checked during DVMA */ | ||
42 | |||
43 | struct iounit_struct { | ||
44 | unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; | ||
45 | spinlock_t lock; | ||
46 | iopte_t *page_table; | ||
47 | unsigned long rotor[3]; | ||
48 | unsigned long limit[4]; | ||
49 | }; | ||
50 | |||
51 | #define IOUNIT_BMAP1_START 0x00000000 | ||
52 | #define IOUNIT_BMAP1_END (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 1)) | ||
53 | #define IOUNIT_BMAP2_START IOUNIT_BMAP1_END | ||
54 | #define IOUNIT_BMAP2_END IOUNIT_BMAP2_START + (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 2)) | ||
55 | #define IOUNIT_BMAPM_START IOUNIT_BMAP2_END | ||
56 | #define IOUNIT_BMAPM_END ((IOUNIT_DMA_SIZE - IOUNIT_DVMA_SIZE) >> PAGE_SHIFT) | ||
57 | |||
58 | extern __u32 iounit_map_dma_init(struct sbus_bus *, int); | ||
59 | #define iounit_map_dma_finish(sbus, addr, len) mmu_release_scsi_one(addr, len, sbus) | ||
60 | extern __u32 iounit_map_dma_page(__u32, void *, struct sbus_bus *); | ||
61 | |||
62 | #endif /* !(_SPARC_IO_UNIT_H) */ | ||
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h new file mode 100644 index 000000000000..a42df208d590 --- /dev/null +++ b/include/asm-sparc/io.h | |||
@@ -0,0 +1,290 @@ | |||
1 | /* | ||
2 | * $Id: io.h,v 1.30 2001/12/21 01:23:21 davem Exp $ | ||
3 | */ | ||
4 | #ifndef __SPARC_IO_H | ||
5 | #define __SPARC_IO_H | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/types.h> | ||
9 | #include <linux/ioport.h> /* struct resource */ | ||
10 | |||
11 | #include <asm/page.h> /* IO address mapping routines need this */ | ||
12 | #include <asm/system.h> | ||
13 | |||
14 | #define page_to_phys(page) (((page) - mem_map) << PAGE_SHIFT) | ||
15 | |||
16 | static inline u32 flip_dword (u32 l) | ||
17 | { | ||
18 | return ((l&0xff)<<24) | (((l>>8)&0xff)<<16) | (((l>>16)&0xff)<<8)| ((l>>24)&0xff); | ||
19 | } | ||
20 | |||
21 | static inline u16 flip_word (u16 w) | ||
22 | { | ||
23 | return ((w&0xff) << 8) | ((w>>8)&0xff); | ||
24 | } | ||
25 | |||
26 | #define mmiowb() | ||
27 | |||
28 | /* | ||
29 | * Memory mapped I/O to PCI | ||
30 | */ | ||
31 | |||
32 | static inline u8 __raw_readb(const volatile void __iomem *addr) | ||
33 | { | ||
34 | return *(__force volatile u8 *)addr; | ||
35 | } | ||
36 | |||
37 | static inline u16 __raw_readw(const volatile void __iomem *addr) | ||
38 | { | ||
39 | return *(__force volatile u16 *)addr; | ||
40 | } | ||
41 | |||
42 | static inline u32 __raw_readl(const volatile void __iomem *addr) | ||
43 | { | ||
44 | return *(__force volatile u32 *)addr; | ||
45 | } | ||
46 | |||
47 | static inline void __raw_writeb(u8 b, volatile void __iomem *addr) | ||
48 | { | ||
49 | *(__force volatile u8 *)addr = b; | ||
50 | } | ||
51 | |||
52 | static inline void __raw_writew(u16 w, volatile void __iomem *addr) | ||
53 | { | ||
54 | *(__force volatile u16 *)addr = w; | ||
55 | } | ||
56 | |||
57 | static inline void __raw_writel(u32 l, volatile void __iomem *addr) | ||
58 | { | ||
59 | *(__force volatile u32 *)addr = l; | ||
60 | } | ||
61 | |||
62 | static inline u8 __readb(const volatile void __iomem *addr) | ||
63 | { | ||
64 | return *(__force volatile u8 *)addr; | ||
65 | } | ||
66 | |||
67 | static inline u16 __readw(const volatile void __iomem *addr) | ||
68 | { | ||
69 | return flip_word(*(__force volatile u16 *)addr); | ||
70 | } | ||
71 | |||
72 | static inline u32 __readl(const volatile void __iomem *addr) | ||
73 | { | ||
74 | return flip_dword(*(__force volatile u32 *)addr); | ||
75 | } | ||
76 | |||
77 | static inline void __writeb(u8 b, volatile void __iomem *addr) | ||
78 | { | ||
79 | *(__force volatile u8 *)addr = b; | ||
80 | } | ||
81 | |||
82 | static inline void __writew(u16 w, volatile void __iomem *addr) | ||
83 | { | ||
84 | *(__force volatile u16 *)addr = flip_word(w); | ||
85 | } | ||
86 | |||
87 | static inline void __writel(u32 l, volatile void __iomem *addr) | ||
88 | { | ||
89 | *(__force volatile u32 *)addr = flip_dword(l); | ||
90 | } | ||
91 | |||
92 | #define readb(__addr) __readb(__addr) | ||
93 | #define readw(__addr) __readw(__addr) | ||
94 | #define readl(__addr) __readl(__addr) | ||
95 | #define readb_relaxed(__addr) readb(__addr) | ||
96 | #define readw_relaxed(__addr) readw(__addr) | ||
97 | #define readl_relaxed(__addr) readl(__addr) | ||
98 | |||
99 | #define writeb(__b, __addr) __writeb((__b),(__addr)) | ||
100 | #define writew(__w, __addr) __writew((__w),(__addr)) | ||
101 | #define writel(__l, __addr) __writel((__l),(__addr)) | ||
102 | |||
103 | /* | ||
104 | * I/O space operations | ||
105 | * | ||
106 | * Arrangement on a Sun is somewhat complicated. | ||
107 | * | ||
108 | * First of all, we want to use standard Linux drivers | ||
109 | * for keyboard, PC serial, etc. These drivers think | ||
110 | * they access I/O space and use inb/outb. | ||
111 | * On the other hand, EBus bridge accepts PCI *memory* | ||
112 | * cycles and converts them into ISA *I/O* cycles. | ||
113 | * Ergo, we want inb & outb to generate PCI memory cycles. | ||
114 | * | ||
115 | * If we want to issue PCI *I/O* cycles, we do this | ||
116 | * with a low 64K fixed window in PCIC. This window gets | ||
117 | * mapped somewhere into virtual kernel space and we | ||
118 | * can use inb/outb again. | ||
119 | */ | ||
120 | #define inb_local(__addr) __readb((void __iomem *)(unsigned long)(__addr)) | ||
121 | #define inb(__addr) __readb((void __iomem *)(unsigned long)(__addr)) | ||
122 | #define inw(__addr) __readw((void __iomem *)(unsigned long)(__addr)) | ||
123 | #define inl(__addr) __readl((void __iomem *)(unsigned long)(__addr)) | ||
124 | |||
125 | #define outb_local(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr)) | ||
126 | #define outb(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr)) | ||
127 | #define outw(__w, __addr) __writew(__w, (void __iomem *)(unsigned long)(__addr)) | ||
128 | #define outl(__l, __addr) __writel(__l, (void __iomem *)(unsigned long)(__addr)) | ||
129 | |||
130 | #define inb_p(__addr) inb(__addr) | ||
131 | #define outb_p(__b, __addr) outb(__b, __addr) | ||
132 | #define inw_p(__addr) inw(__addr) | ||
133 | #define outw_p(__w, __addr) outw(__w, __addr) | ||
134 | #define inl_p(__addr) inl(__addr) | ||
135 | #define outl_p(__l, __addr) outl(__l, __addr) | ||
136 | |||
137 | void outsb(unsigned long addr, const void *src, unsigned long cnt); | ||
138 | void outsw(unsigned long addr, const void *src, unsigned long cnt); | ||
139 | void outsl(unsigned long addr, const void *src, unsigned long cnt); | ||
140 | void insb(unsigned long addr, void *dst, unsigned long count); | ||
141 | void insw(unsigned long addr, void *dst, unsigned long count); | ||
142 | void insl(unsigned long addr, void *dst, unsigned long count); | ||
143 | |||
144 | #define IO_SPACE_LIMIT 0xffffffff | ||
145 | |||
146 | /* | ||
147 | * SBus accessors. | ||
148 | * | ||
149 | * SBus has only one, memory mapped, I/O space. | ||
150 | * We do not need to flip bytes for SBus of course. | ||
151 | */ | ||
152 | static inline u8 _sbus_readb(const volatile void __iomem *addr) | ||
153 | { | ||
154 | return *(__force volatile u8 *)addr; | ||
155 | } | ||
156 | |||
157 | static inline u16 _sbus_readw(const volatile void __iomem *addr) | ||
158 | { | ||
159 | return *(__force volatile u16 *)addr; | ||
160 | } | ||
161 | |||
162 | static inline u32 _sbus_readl(const volatile void __iomem *addr) | ||
163 | { | ||
164 | return *(__force volatile u32 *)addr; | ||
165 | } | ||
166 | |||
167 | static inline void _sbus_writeb(u8 b, volatile void __iomem *addr) | ||
168 | { | ||
169 | *(__force volatile u8 *)addr = b; | ||
170 | } | ||
171 | |||
172 | static inline void _sbus_writew(u16 w, volatile void __iomem *addr) | ||
173 | { | ||
174 | *(__force volatile u16 *)addr = w; | ||
175 | } | ||
176 | |||
177 | static inline void _sbus_writel(u32 l, volatile void __iomem *addr) | ||
178 | { | ||
179 | *(__force volatile u32 *)addr = l; | ||
180 | } | ||
181 | |||
182 | /* | ||
183 | * The only reason for #define's is to hide casts to unsigned long. | ||
184 | */ | ||
185 | #define sbus_readb(__addr) _sbus_readb(__addr) | ||
186 | #define sbus_readw(__addr) _sbus_readw(__addr) | ||
187 | #define sbus_readl(__addr) _sbus_readl(__addr) | ||
188 | #define sbus_writeb(__b, __addr) _sbus_writeb(__b, __addr) | ||
189 | #define sbus_writew(__w, __addr) _sbus_writew(__w, __addr) | ||
190 | #define sbus_writel(__l, __addr) _sbus_writel(__l, __addr) | ||
191 | |||
192 | static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_size_t n) | ||
193 | { | ||
194 | while(n--) { | ||
195 | sbus_writeb(c, __dst); | ||
196 | __dst++; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | static inline void | ||
201 | _memset_io(volatile void __iomem *dst, int c, __kernel_size_t n) | ||
202 | { | ||
203 | volatile void __iomem *d = dst; | ||
204 | |||
205 | while (n--) { | ||
206 | writeb(c, d); | ||
207 | d++; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | #define memset_io(d,c,sz) _memset_io(d,c,sz) | ||
212 | |||
213 | static inline void | ||
214 | _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n) | ||
215 | { | ||
216 | char *d = dst; | ||
217 | |||
218 | while (n--) { | ||
219 | char tmp = readb(src); | ||
220 | *d++ = tmp; | ||
221 | src++; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | #define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) | ||
226 | |||
227 | static inline void | ||
228 | _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n) | ||
229 | { | ||
230 | const char *s = src; | ||
231 | volatile void __iomem *d = dst; | ||
232 | |||
233 | while (n--) { | ||
234 | char tmp = *s++; | ||
235 | writeb(tmp, d); | ||
236 | d++; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | #define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) | ||
241 | |||
242 | #ifdef __KERNEL__ | ||
243 | |||
244 | /* | ||
245 | * Bus number may be embedded in the higher bits of the physical address. | ||
246 | * This is why we have no bus number argument to ioremap(). | ||
247 | */ | ||
248 | extern void __iomem *ioremap(unsigned long offset, unsigned long size); | ||
249 | #define ioremap_nocache(X,Y) ioremap((X),(Y)) | ||
250 | extern void iounmap(volatile void __iomem *addr); | ||
251 | |||
252 | /* | ||
253 | * Bus number may be in res->flags... somewhere. | ||
254 | */ | ||
255 | extern void __iomem *sbus_ioremap(struct resource *res, unsigned long offset, | ||
256 | unsigned long size, char *name); | ||
257 | extern void sbus_iounmap(volatile void __iomem *vaddr, unsigned long size); | ||
258 | |||
259 | |||
260 | /* | ||
261 | * At the moment, we do not use CMOS_READ anywhere outside of rtc.c, | ||
262 | * so rtc_port is static in it. This should not change unless a new | ||
263 | * hardware pops up. | ||
264 | */ | ||
265 | #define RTC_PORT(x) (rtc_port + (x)) | ||
266 | #define RTC_ALWAYS_BCD 0 | ||
267 | |||
268 | /* Nothing to do */ | ||
269 | /* P3: Only IDE DMA may need these. XXX Verify that it still does... */ | ||
270 | |||
271 | #define dma_cache_inv(_start,_size) do { } while (0) | ||
272 | #define dma_cache_wback(_start,_size) do { } while (0) | ||
273 | #define dma_cache_wback_inv(_start,_size) do { } while (0) | ||
274 | |||
275 | #endif | ||
276 | |||
277 | #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 | ||
278 | |||
279 | /* | ||
280 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
281 | * access | ||
282 | */ | ||
283 | #define xlate_dev_mem_ptr(p) __va(p) | ||
284 | |||
285 | /* | ||
286 | * Convert a virtual cached pointer to an uncached pointer | ||
287 | */ | ||
288 | #define xlate_dev_kmem_ptr(p) p | ||
289 | |||
290 | #endif /* !(__SPARC_IO_H) */ | ||
diff --git a/include/asm-sparc/ioctl.h b/include/asm-sparc/ioctl.h new file mode 100644 index 000000000000..e6fc4de19940 --- /dev/null +++ b/include/asm-sparc/ioctl.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* $Id: ioctl.h,v 1.6 1999/12/01 23:58:36 davem Exp $ */ | ||
2 | #ifndef _SPARC_IOCTL_H | ||
3 | #define _SPARC_IOCTL_H | ||
4 | |||
5 | /* | ||
6 | * Our DIR and SIZE overlap in order to simulteneously provide | ||
7 | * a non-zero _IOC_NONE (for binary compatibility) and | ||
8 | * 14 bits of size as on i386. Here's the layout: | ||
9 | * | ||
10 | * 0xE0000000 DIR | ||
11 | * 0x80000000 DIR = WRITE | ||
12 | * 0x40000000 DIR = READ | ||
13 | * 0x20000000 DIR = NONE | ||
14 | * 0x3FFF0000 SIZE (overlaps NONE bit) | ||
15 | * 0x0000FF00 TYPE | ||
16 | * 0x000000FF NR (CMD) | ||
17 | */ | ||
18 | |||
19 | #define _IOC_NRBITS 8 | ||
20 | #define _IOC_TYPEBITS 8 | ||
21 | #define _IOC_SIZEBITS 13 /* Actually 14, see below. */ | ||
22 | #define _IOC_DIRBITS 3 | ||
23 | |||
24 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
25 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
26 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
27 | #define _IOC_XSIZEMASK ((1 << (_IOC_SIZEBITS+1))-1) | ||
28 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
29 | |||
30 | #define _IOC_NRSHIFT 0 | ||
31 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS) | ||
32 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS) | ||
33 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS) | ||
34 | |||
35 | #define _IOC_NONE 1U | ||
36 | #define _IOC_READ 2U | ||
37 | #define _IOC_WRITE 4U | ||
38 | |||
39 | #define _IOC(dir,type,nr,size) \ | ||
40 | (((dir) << _IOC_DIRSHIFT) | \ | ||
41 | ((type) << _IOC_TYPESHIFT) | \ | ||
42 | ((nr) << _IOC_NRSHIFT) | \ | ||
43 | ((size) << _IOC_SIZESHIFT)) | ||
44 | |||
45 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
46 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
47 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
48 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
49 | |||
50 | /* Used to decode ioctl numbers in drivers despite the leading underscore... */ | ||
51 | #define _IOC_DIR(nr) \ | ||
52 | ( (((((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) & (_IOC_WRITE|_IOC_READ)) != 0)? \ | ||
53 | (((nr) >> _IOC_DIRSHIFT) & (_IOC_WRITE|_IOC_READ)): \ | ||
54 | (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) ) | ||
55 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
56 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
57 | #define _IOC_SIZE(nr) \ | ||
58 | ((((((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) & (_IOC_WRITE|_IOC_READ)) == 0)? \ | ||
59 | 0: (((nr) >> _IOC_SIZESHIFT) & _IOC_XSIZEMASK)) | ||
60 | |||
61 | /* ...and for the PCMCIA and sound. */ | ||
62 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
63 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
64 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
65 | #define IOCSIZE_MASK (_IOC_XSIZEMASK << _IOC_SIZESHIFT) | ||
66 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
67 | |||
68 | #endif /* !(_SPARC_IOCTL_H) */ | ||
diff --git a/include/asm-sparc/ioctls.h b/include/asm-sparc/ioctls.h new file mode 100644 index 000000000000..bdf77b0dfd8e --- /dev/null +++ b/include/asm-sparc/ioctls.h | |||
@@ -0,0 +1,134 @@ | |||
1 | #ifndef _ASM_SPARC_IOCTLS_H | ||
2 | #define _ASM_SPARC_IOCTLS_H | ||
3 | |||
4 | #include <asm/ioctl.h> | ||
5 | |||
6 | /* Big T */ | ||
7 | #define TCGETA _IOR('T', 1, struct termio) | ||
8 | #define TCSETA _IOW('T', 2, struct termio) | ||
9 | #define TCSETAW _IOW('T', 3, struct termio) | ||
10 | #define TCSETAF _IOW('T', 4, struct termio) | ||
11 | #define TCSBRK _IO('T', 5) | ||
12 | #define TCXONC _IO('T', 6) | ||
13 | #define TCFLSH _IO('T', 7) | ||
14 | #define TCGETS _IOR('T', 8, struct termios) | ||
15 | #define TCSETS _IOW('T', 9, struct termios) | ||
16 | #define TCSETSW _IOW('T', 10, struct termios) | ||
17 | #define TCSETSF _IOW('T', 11, struct termios) | ||
18 | |||
19 | /* Note that all the ioctls that are not available in Linux have a | ||
20 | * double underscore on the front to: a) avoid some programs to | ||
21 | * thing we support some ioctls under Linux (autoconfiguration stuff) | ||
22 | */ | ||
23 | /* Little t */ | ||
24 | #define TIOCGETD _IOR('t', 0, int) | ||
25 | #define TIOCSETD _IOW('t', 1, int) | ||
26 | #define __TIOCHPCL _IO('t', 2) /* SunOS Specific */ | ||
27 | #define __TIOCMODG _IOR('t', 3, int) /* SunOS Specific */ | ||
28 | #define __TIOCMODS _IOW('t', 4, int) /* SunOS Specific */ | ||
29 | #define __TIOCGETP _IOR('t', 8, struct sgttyb) /* SunOS Specific */ | ||
30 | #define __TIOCSETP _IOW('t', 9, struct sgttyb) /* SunOS Specific */ | ||
31 | #define __TIOCSETN _IOW('t', 10, struct sgttyb) /* SunOS Specific */ | ||
32 | #define TIOCEXCL _IO('t', 13) | ||
33 | #define TIOCNXCL _IO('t', 14) | ||
34 | #define __TIOCFLUSH _IOW('t', 16, int) /* SunOS Specific */ | ||
35 | #define __TIOCSETC _IOW('t', 17, struct tchars) /* SunOS Specific */ | ||
36 | #define __TIOCGETC _IOR('t', 18, struct tchars) /* SunOS Specific */ | ||
37 | #define __TIOCTCNTL _IOW('t', 32, int) /* SunOS Specific */ | ||
38 | #define __TIOCSIGNAL _IOW('t', 33, int) /* SunOS Specific */ | ||
39 | #define __TIOCSETX _IOW('t', 34, int) /* SunOS Specific */ | ||
40 | #define __TIOCGETX _IOR('t', 35, int) /* SunOS Specific */ | ||
41 | #define TIOCCONS _IO('t', 36) | ||
42 | #define __TIOCSSIZE _IOW('t', 37, struct sunos_ttysize) /* SunOS Specific */ | ||
43 | #define __TIOCGSIZE _IOR('t', 38, struct sunos_ttysize) /* SunOS Specific */ | ||
44 | #define TIOCGSOFTCAR _IOR('t', 100, int) | ||
45 | #define TIOCSSOFTCAR _IOW('t', 101, int) | ||
46 | #define __TIOCUCNTL _IOW('t', 102, int) /* SunOS Specific */ | ||
47 | #define TIOCSWINSZ _IOW('t', 103, struct winsize) | ||
48 | #define TIOCGWINSZ _IOR('t', 104, struct winsize) | ||
49 | #define __TIOCREMOTE _IOW('t', 105, int) /* SunOS Specific */ | ||
50 | #define TIOCMGET _IOR('t', 106, int) | ||
51 | #define TIOCMBIC _IOW('t', 107, int) | ||
52 | #define TIOCMBIS _IOW('t', 108, int) | ||
53 | #define TIOCMSET _IOW('t', 109, int) | ||
54 | #define TIOCSTART _IO('t', 110) | ||
55 | #define TIOCSTOP _IO('t', 111) | ||
56 | #define TIOCPKT _IOW('t', 112, int) | ||
57 | #define TIOCNOTTY _IO('t', 113) | ||
58 | #define TIOCSTI _IOW('t', 114, char) | ||
59 | #define TIOCOUTQ _IOR('t', 115, int) | ||
60 | #define __TIOCGLTC _IOR('t', 116, struct ltchars) /* SunOS Specific */ | ||
61 | #define __TIOCSLTC _IOW('t', 117, struct ltchars) /* SunOS Specific */ | ||
62 | /* 118 is the non-posix setpgrp tty ioctl */ | ||
63 | /* 119 is the non-posix getpgrp tty ioctl */ | ||
64 | #define __TIOCCDTR _IO('t', 120) /* SunOS Specific */ | ||
65 | #define __TIOCSDTR _IO('t', 121) /* SunOS Specific */ | ||
66 | #define TIOCCBRK _IO('t', 122) | ||
67 | #define TIOCSBRK _IO('t', 123) | ||
68 | #define __TIOCLGET _IOW('t', 124, int) /* SunOS Specific */ | ||
69 | #define __TIOCLSET _IOW('t', 125, int) /* SunOS Specific */ | ||
70 | #define __TIOCLBIC _IOW('t', 126, int) /* SunOS Specific */ | ||
71 | #define __TIOCLBIS _IOW('t', 127, int) /* SunOS Specific */ | ||
72 | #define __TIOCISPACE _IOR('t', 128, int) /* SunOS Specific */ | ||
73 | #define __TIOCISIZE _IOR('t', 129, int) /* SunOS Specific */ | ||
74 | #define TIOCSPGRP _IOW('t', 130, int) | ||
75 | #define TIOCGPGRP _IOR('t', 131, int) | ||
76 | #define TIOCSCTTY _IO('t', 132) | ||
77 | #define TIOCGSID _IOR('t', 133, int) | ||
78 | /* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ | ||
79 | #define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ | ||
80 | #define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ | ||
81 | |||
82 | /* Little f */ | ||
83 | #define FIOCLEX _IO('f', 1) | ||
84 | #define FIONCLEX _IO('f', 2) | ||
85 | #define FIOASYNC _IOW('f', 125, int) | ||
86 | #define FIONBIO _IOW('f', 126, int) | ||
87 | #define FIONREAD _IOR('f', 127, int) | ||
88 | #define TIOCINQ FIONREAD | ||
89 | #define FIOQSIZE _IOR('f', 128, loff_t) | ||
90 | |||
91 | /* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it | ||
92 | * someday. This is completely bogus, I know... | ||
93 | */ | ||
94 | #define __TCGETSTAT _IO('T', 200) /* Rutgers specific */ | ||
95 | #define __TCSETSTAT _IO('T', 201) /* Rutgers specific */ | ||
96 | |||
97 | /* Linux specific, no SunOS equivalent. */ | ||
98 | #define TIOCLINUX 0x541C | ||
99 | #define TIOCGSERIAL 0x541E | ||
100 | #define TIOCSSERIAL 0x541F | ||
101 | #define TCSBRKP 0x5425 | ||
102 | #define TIOCSERCONFIG 0x5453 | ||
103 | #define TIOCSERGWILD 0x5454 | ||
104 | #define TIOCSERSWILD 0x5455 | ||
105 | #define TIOCGLCKTRMIOS 0x5456 | ||
106 | #define TIOCSLCKTRMIOS 0x5457 | ||
107 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
108 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
109 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
110 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
111 | #define TIOCMIWAIT 0x545C /* Wait input */ | ||
112 | #define TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */ | ||
113 | |||
114 | /* Kernel definitions */ | ||
115 | #ifdef __KERNEL__ | ||
116 | #define TIOCGETC __TIOCGETC | ||
117 | #define TIOCGETP __TIOCGETP | ||
118 | #define TIOCGLTC __TIOCGLTC | ||
119 | #define TIOCSLTC __TIOCSLTC | ||
120 | #define TIOCSETP __TIOCSETP | ||
121 | #define TIOCSETN __TIOCSETN | ||
122 | #define TIOCSETC __TIOCSETC | ||
123 | #endif | ||
124 | |||
125 | /* Used for packet mode */ | ||
126 | #define TIOCPKT_DATA 0 | ||
127 | #define TIOCPKT_FLUSHREAD 1 | ||
128 | #define TIOCPKT_FLUSHWRITE 2 | ||
129 | #define TIOCPKT_STOP 4 | ||
130 | #define TIOCPKT_START 8 | ||
131 | #define TIOCPKT_NOSTOP 16 | ||
132 | #define TIOCPKT_DOSTOP 32 | ||
133 | |||
134 | #endif /* !(_ASM_SPARC_IOCTLS_H) */ | ||
diff --git a/include/asm-sparc/iommu.h b/include/asm-sparc/iommu.h new file mode 100644 index 000000000000..8171362d56b9 --- /dev/null +++ b/include/asm-sparc/iommu.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* iommu.h: Definitions for the sun4m IOMMU. | ||
2 | * | ||
3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
4 | */ | ||
5 | #ifndef _SPARC_IOMMU_H | ||
6 | #define _SPARC_IOMMU_H | ||
7 | |||
8 | #include <asm/page.h> | ||
9 | #include <asm/bitext.h> | ||
10 | |||
11 | /* The iommu handles all virtual to physical address translations | ||
12 | * that occur between the SBUS and physical memory. Access by | ||
13 | * the cpu to IO registers and similar go over the mbus so are | ||
14 | * translated by the on chip SRMMU. The iommu and the srmmu do | ||
15 | * not need to have the same translations at all, in fact most | ||
16 | * of the time the translations they handle are a disjunct set. | ||
17 | * Basically the iommu handles all dvma sbus activity. | ||
18 | */ | ||
19 | |||
20 | /* The IOMMU registers occupy three pages in IO space. */ | ||
21 | struct iommu_regs { | ||
22 | /* First page */ | ||
23 | volatile unsigned long control; /* IOMMU control */ | ||
24 | volatile unsigned long base; /* Physical base of iopte page table */ | ||
25 | volatile unsigned long _unused1[3]; | ||
26 | volatile unsigned long tlbflush; /* write only */ | ||
27 | volatile unsigned long pageflush; /* write only */ | ||
28 | volatile unsigned long _unused2[1017]; | ||
29 | /* Second page */ | ||
30 | volatile unsigned long afsr; /* Async-fault status register */ | ||
31 | volatile unsigned long afar; /* Async-fault physical address */ | ||
32 | volatile unsigned long _unused3[2]; | ||
33 | volatile unsigned long sbuscfg0; /* SBUS configuration registers, per-slot */ | ||
34 | volatile unsigned long sbuscfg1; | ||
35 | volatile unsigned long sbuscfg2; | ||
36 | volatile unsigned long sbuscfg3; | ||
37 | volatile unsigned long mfsr; /* Memory-fault status register */ | ||
38 | volatile unsigned long mfar; /* Memory-fault physical address */ | ||
39 | volatile unsigned long _unused4[1014]; | ||
40 | /* Third page */ | ||
41 | volatile unsigned long mid; /* IOMMU module-id */ | ||
42 | }; | ||
43 | |||
44 | #define IOMMU_CTRL_IMPL 0xf0000000 /* Implementation */ | ||
45 | #define IOMMU_CTRL_VERS 0x0f000000 /* Version */ | ||
46 | #define IOMMU_CTRL_RNGE 0x0000001c /* Mapping RANGE */ | ||
47 | #define IOMMU_RNGE_16MB 0x00000000 /* 0xff000000 -> 0xffffffff */ | ||
48 | #define IOMMU_RNGE_32MB 0x00000004 /* 0xfe000000 -> 0xffffffff */ | ||
49 | #define IOMMU_RNGE_64MB 0x00000008 /* 0xfc000000 -> 0xffffffff */ | ||
50 | #define IOMMU_RNGE_128MB 0x0000000c /* 0xf8000000 -> 0xffffffff */ | ||
51 | #define IOMMU_RNGE_256MB 0x00000010 /* 0xf0000000 -> 0xffffffff */ | ||
52 | #define IOMMU_RNGE_512MB 0x00000014 /* 0xe0000000 -> 0xffffffff */ | ||
53 | #define IOMMU_RNGE_1GB 0x00000018 /* 0xc0000000 -> 0xffffffff */ | ||
54 | #define IOMMU_RNGE_2GB 0x0000001c /* 0x80000000 -> 0xffffffff */ | ||
55 | #define IOMMU_CTRL_ENAB 0x00000001 /* IOMMU Enable */ | ||
56 | |||
57 | #define IOMMU_AFSR_ERR 0x80000000 /* LE, TO, or BE asserted */ | ||
58 | #define IOMMU_AFSR_LE 0x40000000 /* SBUS reports error after transaction */ | ||
59 | #define IOMMU_AFSR_TO 0x20000000 /* Write access took more than 12.8 us. */ | ||
60 | #define IOMMU_AFSR_BE 0x10000000 /* Write access received error acknowledge */ | ||
61 | #define IOMMU_AFSR_SIZE 0x0e000000 /* Size of transaction causing error */ | ||
62 | #define IOMMU_AFSR_S 0x01000000 /* Sparc was in supervisor mode */ | ||
63 | #define IOMMU_AFSR_RESV 0x00f00000 /* Reserver, forced to 0x8 by hardware */ | ||
64 | #define IOMMU_AFSR_ME 0x00080000 /* Multiple errors occurred */ | ||
65 | #define IOMMU_AFSR_RD 0x00040000 /* A read operation was in progress */ | ||
66 | #define IOMMU_AFSR_FAV 0x00020000 /* IOMMU afar has valid contents */ | ||
67 | |||
68 | #define IOMMU_SBCFG_SAB30 0x00010000 /* Phys-address bit 30 when bypass enabled */ | ||
69 | #define IOMMU_SBCFG_BA16 0x00000004 /* Slave supports 16 byte bursts */ | ||
70 | #define IOMMU_SBCFG_BA8 0x00000002 /* Slave supports 8 byte bursts */ | ||
71 | #define IOMMU_SBCFG_BYPASS 0x00000001 /* Bypass IOMMU, treat all addresses | ||
72 | produced by this device as pure | ||
73 | physical. */ | ||
74 | |||
75 | #define IOMMU_MFSR_ERR 0x80000000 /* One or more of PERR1 or PERR0 */ | ||
76 | #define IOMMU_MFSR_S 0x01000000 /* Sparc was in supervisor mode */ | ||
77 | #define IOMMU_MFSR_CPU 0x00800000 /* CPU transaction caused parity error */ | ||
78 | #define IOMMU_MFSR_ME 0x00080000 /* Multiple parity errors occurred */ | ||
79 | #define IOMMU_MFSR_PERR 0x00006000 /* high bit indicates parity error occurred | ||
80 | on the even word of the access, low bit | ||
81 | indicated odd word caused the parity error */ | ||
82 | #define IOMMU_MFSR_BM 0x00001000 /* Error occurred while in boot mode */ | ||
83 | #define IOMMU_MFSR_C 0x00000800 /* Address causing error was marked cacheable */ | ||
84 | #define IOMMU_MFSR_RTYP 0x000000f0 /* Memory request transaction type */ | ||
85 | |||
86 | #define IOMMU_MID_SBAE 0x001f0000 /* SBus arbitration enable */ | ||
87 | #define IOMMU_MID_SE 0x00100000 /* Enables SCSI/ETHERNET arbitration */ | ||
88 | #define IOMMU_MID_SB3 0x00080000 /* Enable SBUS device 3 arbitration */ | ||
89 | #define IOMMU_MID_SB2 0x00040000 /* Enable SBUS device 2 arbitration */ | ||
90 | #define IOMMU_MID_SB1 0x00020000 /* Enable SBUS device 1 arbitration */ | ||
91 | #define IOMMU_MID_SB0 0x00010000 /* Enable SBUS device 0 arbitration */ | ||
92 | #define IOMMU_MID_MID 0x0000000f /* Module-id, hardcoded to 0x8 */ | ||
93 | |||
94 | /* The format of an iopte in the page tables */ | ||
95 | #define IOPTE_PAGE 0x07ffff00 /* Physical page number (PA[30:12]) */ | ||
96 | #define IOPTE_CACHE 0x00000080 /* Cached (in vme IOCACHE or Viking/MXCC) */ | ||
97 | #define IOPTE_WRITE 0x00000004 /* Writeable */ | ||
98 | #define IOPTE_VALID 0x00000002 /* IOPTE is valid */ | ||
99 | #define IOPTE_WAZ 0x00000001 /* Write as zeros */ | ||
100 | |||
101 | struct iommu_struct { | ||
102 | struct iommu_regs *regs; | ||
103 | iopte_t *page_table; | ||
104 | /* For convenience */ | ||
105 | unsigned long start; /* First managed virtual address */ | ||
106 | unsigned long end; /* Last managed virtual address */ | ||
107 | |||
108 | struct bit_map usemap; | ||
109 | }; | ||
110 | |||
111 | extern __inline__ void iommu_invalidate(struct iommu_regs *regs) | ||
112 | { | ||
113 | regs->tlbflush = 0; | ||
114 | } | ||
115 | |||
116 | extern __inline__ void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) | ||
117 | { | ||
118 | regs->pageflush = (ba & PAGE_MASK); | ||
119 | } | ||
120 | |||
121 | #endif /* !(_SPARC_IOMMU_H) */ | ||
diff --git a/include/asm-sparc/ipc.h b/include/asm-sparc/ipc.h new file mode 100644 index 000000000000..a46e3d9c2a3f --- /dev/null +++ b/include/asm-sparc/ipc.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/ipc.h> | |||
diff --git a/include/asm-sparc/ipcbuf.h b/include/asm-sparc/ipcbuf.h new file mode 100644 index 000000000000..9bef02d04e4b --- /dev/null +++ b/include/asm-sparc/ipcbuf.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _SPARC_IPCBUF_H | ||
2 | #define _SPARC_IPCBUF_H | ||
3 | |||
4 | /* | ||
5 | * The ipc64_perm structure for sparc architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 32-bit mode | ||
11 | * - 32-bit seq | ||
12 | * - 2 miscellaneous 64-bit values (so that this structure matches | ||
13 | * sparc64 ipc64_perm) | ||
14 | */ | ||
15 | |||
16 | struct ipc64_perm | ||
17 | { | ||
18 | __kernel_key_t key; | ||
19 | __kernel_uid32_t uid; | ||
20 | __kernel_gid32_t gid; | ||
21 | __kernel_uid32_t cuid; | ||
22 | __kernel_gid32_t cgid; | ||
23 | unsigned short __pad1; | ||
24 | __kernel_mode_t mode; | ||
25 | unsigned short __pad2; | ||
26 | unsigned short seq; | ||
27 | unsigned long long __unused1; | ||
28 | unsigned long long __unused2; | ||
29 | }; | ||
30 | |||
31 | #endif /* _SPARC_IPCBUF_H */ | ||
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h new file mode 100644 index 000000000000..cee356b0dae3 --- /dev/null +++ b/include/asm-sparc/irq.h | |||
@@ -0,0 +1,191 @@ | |||
1 | /* $Id: irq.h,v 1.32 2000/08/26 02:42:28 anton Exp $ | ||
2 | * irq.h: IRQ registers on the Sparc. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_IRQ_H | ||
8 | #define _SPARC_IRQ_H | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <linux/linkage.h> | ||
12 | #include <linux/threads.h> /* For NR_CPUS */ | ||
13 | #include <linux/interrupt.h> | ||
14 | |||
15 | #include <asm/system.h> /* For SUN4M_NCPUS */ | ||
16 | #include <asm/btfixup.h> | ||
17 | |||
18 | #define __irq_ino(irq) irq | ||
19 | #define __irq_pil(irq) irq | ||
20 | BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int) | ||
21 | #define __irq_itoa(irq) BTFIXUP_CALL(__irq_itoa)(irq) | ||
22 | |||
23 | #define NR_IRQS 16 | ||
24 | |||
25 | #define irq_canonicalize(irq) (irq) | ||
26 | |||
27 | /* Dave Redman (djhr@tadpole.co.uk) | ||
28 | * changed these to function pointers.. it saves cycles and will allow | ||
29 | * the irq dependencies to be split into different files at a later date | ||
30 | * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size. | ||
31 | * Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
32 | * Changed these to btfixup entities... It saves cycles :) | ||
33 | */ | ||
34 | BTFIXUPDEF_CALL(void, disable_irq, unsigned int) | ||
35 | BTFIXUPDEF_CALL(void, enable_irq, unsigned int) | ||
36 | BTFIXUPDEF_CALL(void, disable_pil_irq, unsigned int) | ||
37 | BTFIXUPDEF_CALL(void, enable_pil_irq, unsigned int) | ||
38 | BTFIXUPDEF_CALL(void, clear_clock_irq, void) | ||
39 | BTFIXUPDEF_CALL(void, clear_profile_irq, int) | ||
40 | BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int) | ||
41 | |||
42 | static inline void disable_irq_nosync(unsigned int irq) | ||
43 | { | ||
44 | BTFIXUP_CALL(disable_irq)(irq); | ||
45 | } | ||
46 | |||
47 | static inline void disable_irq(unsigned int irq) | ||
48 | { | ||
49 | BTFIXUP_CALL(disable_irq)(irq); | ||
50 | } | ||
51 | |||
52 | static inline void enable_irq(unsigned int irq) | ||
53 | { | ||
54 | BTFIXUP_CALL(enable_irq)(irq); | ||
55 | } | ||
56 | |||
57 | static inline void disable_pil_irq(unsigned int irq) | ||
58 | { | ||
59 | BTFIXUP_CALL(disable_pil_irq)(irq); | ||
60 | } | ||
61 | |||
62 | static inline void enable_pil_irq(unsigned int irq) | ||
63 | { | ||
64 | BTFIXUP_CALL(enable_pil_irq)(irq); | ||
65 | } | ||
66 | |||
67 | static inline void clear_clock_irq(void) | ||
68 | { | ||
69 | BTFIXUP_CALL(clear_clock_irq)(); | ||
70 | } | ||
71 | |||
72 | static inline void clear_profile_irq(int irq) | ||
73 | { | ||
74 | BTFIXUP_CALL(clear_profile_irq)(irq); | ||
75 | } | ||
76 | |||
77 | static inline void load_profile_irq(int cpu, int limit) | ||
78 | { | ||
79 | BTFIXUP_CALL(load_profile_irq)(cpu, limit); | ||
80 | } | ||
81 | |||
82 | extern void (*sparc_init_timers)(irqreturn_t (*lvl10_irq)(int, void *, struct pt_regs *)); | ||
83 | extern void claim_ticker14(irqreturn_t (*irq_handler)(int, void *, struct pt_regs *), | ||
84 | int irq, | ||
85 | unsigned int timeout); | ||
86 | |||
87 | #ifdef CONFIG_SMP | ||
88 | BTFIXUPDEF_CALL(void, set_cpu_int, int, int) | ||
89 | BTFIXUPDEF_CALL(void, clear_cpu_int, int, int) | ||
90 | BTFIXUPDEF_CALL(void, set_irq_udt, int) | ||
91 | |||
92 | #define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level) | ||
93 | #define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level) | ||
94 | #define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu) | ||
95 | #endif | ||
96 | |||
97 | extern int request_fast_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, __const__ char *devname); | ||
98 | |||
99 | /* On the sun4m, just like the timers, we have both per-cpu and master | ||
100 | * interrupt registers. | ||
101 | */ | ||
102 | |||
103 | /* These registers are used for sending/receiving irqs from/to | ||
104 | * different cpu's. | ||
105 | */ | ||
106 | struct sun4m_intreg_percpu { | ||
107 | unsigned int tbt; /* Interrupts still pending for this cpu. */ | ||
108 | |||
109 | /* These next two registers are WRITE-ONLY and are only | ||
110 | * "on bit" sensitive, "off bits" written have NO affect. | ||
111 | */ | ||
112 | unsigned int clear; /* Clear this cpus irqs here. */ | ||
113 | unsigned int set; /* Set this cpus irqs here. */ | ||
114 | unsigned char space[PAGE_SIZE - 12]; | ||
115 | }; | ||
116 | |||
117 | /* | ||
118 | * djhr | ||
119 | * Actually the clear and set fields in this struct are misleading.. | ||
120 | * according to the SLAVIO manual (and the same applies for the SEC) | ||
121 | * the clear field clears bits in the mask which will ENABLE that IRQ | ||
122 | * the set field sets bits in the mask to DISABLE the IRQ. | ||
123 | * | ||
124 | * Also the undirected_xx address in the SLAVIO is defined as | ||
125 | * RESERVED and write only.. | ||
126 | * | ||
127 | * DAVEM_NOTE: The SLAVIO only specifies behavior on uniprocessor | ||
128 | * sun4m machines, for MP the layout makes more sense. | ||
129 | */ | ||
130 | struct sun4m_intregs { | ||
131 | struct sun4m_intreg_percpu cpu_intregs[SUN4M_NCPUS]; | ||
132 | unsigned int tbt; /* IRQ's that are still pending. */ | ||
133 | unsigned int irqs; /* Master IRQ bits. */ | ||
134 | |||
135 | /* Again, like the above, two these registers are WRITE-ONLY. */ | ||
136 | unsigned int clear; /* Clear master IRQ's by setting bits here. */ | ||
137 | unsigned int set; /* Set master IRQ's by setting bits here. */ | ||
138 | |||
139 | /* This register is both READ and WRITE. */ | ||
140 | unsigned int undirected_target; /* Which cpu gets undirected irqs. */ | ||
141 | }; | ||
142 | |||
143 | extern struct sun4m_intregs *sun4m_interrupts; | ||
144 | |||
145 | /* | ||
146 | * Bit field defines for the interrupt registers on various | ||
147 | * Sparc machines. | ||
148 | */ | ||
149 | |||
150 | /* The sun4c interrupt register. */ | ||
151 | #define SUN4C_INT_ENABLE 0x01 /* Allow interrupts. */ | ||
152 | #define SUN4C_INT_E14 0x80 /* Enable level 14 IRQ. */ | ||
153 | #define SUN4C_INT_E10 0x20 /* Enable level 10 IRQ. */ | ||
154 | #define SUN4C_INT_E8 0x10 /* Enable level 8 IRQ. */ | ||
155 | #define SUN4C_INT_E6 0x08 /* Enable level 6 IRQ. */ | ||
156 | #define SUN4C_INT_E4 0x04 /* Enable level 4 IRQ. */ | ||
157 | #define SUN4C_INT_E1 0x02 /* Enable level 1 IRQ. */ | ||
158 | |||
159 | /* Dave Redman (djhr@tadpole.co.uk) | ||
160 | * The sun4m interrupt registers. | ||
161 | */ | ||
162 | #define SUN4M_INT_ENABLE 0x80000000 | ||
163 | #define SUN4M_INT_E14 0x00000080 | ||
164 | #define SUN4M_INT_E10 0x00080000 | ||
165 | |||
166 | #define SUN4M_HARD_INT(x) (0x000000001 << (x)) | ||
167 | #define SUN4M_SOFT_INT(x) (0x000010000 << (x)) | ||
168 | |||
169 | #define SUN4M_INT_MASKALL 0x80000000 /* mask all interrupts */ | ||
170 | #define SUN4M_INT_MODULE_ERR 0x40000000 /* module error */ | ||
171 | #define SUN4M_INT_M2S_WRITE 0x20000000 /* write buffer error */ | ||
172 | #define SUN4M_INT_ECC 0x10000000 /* ecc memory error */ | ||
173 | #define SUN4M_INT_FLOPPY 0x00400000 /* floppy disk */ | ||
174 | #define SUN4M_INT_MODULE 0x00200000 /* module interrupt */ | ||
175 | #define SUN4M_INT_VIDEO 0x00100000 /* onboard video */ | ||
176 | #define SUN4M_INT_REALTIME 0x00080000 /* system timer */ | ||
177 | #define SUN4M_INT_SCSI 0x00040000 /* onboard scsi */ | ||
178 | #define SUN4M_INT_AUDIO 0x00020000 /* audio/isdn */ | ||
179 | #define SUN4M_INT_ETHERNET 0x00010000 /* onboard ethernet */ | ||
180 | #define SUN4M_INT_SERIAL 0x00008000 /* serial ports */ | ||
181 | #define SUN4M_INT_KBDMS 0x00004000 /* keyboard/mouse */ | ||
182 | #define SUN4M_INT_SBUSBITS 0x00003F80 /* sbus int bits */ | ||
183 | |||
184 | #define SUN4M_INT_SBUS(x) (1 << (x+7)) | ||
185 | #define SUN4M_INT_VME(x) (1 << (x)) | ||
186 | |||
187 | struct irqaction; | ||
188 | struct pt_regs; | ||
189 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | ||
190 | |||
191 | #endif | ||
diff --git a/include/asm-sparc/jsflash.h b/include/asm-sparc/jsflash.h new file mode 100644 index 000000000000..3457f29bd73b --- /dev/null +++ b/include/asm-sparc/jsflash.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * jsflash.h: OS Flash SIMM support for JavaStations. | ||
3 | * | ||
4 | * Copyright (C) 1999 Pete Zaitcev | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_JSFLASH_H | ||
8 | #define _SPARC_JSFLASH_H | ||
9 | |||
10 | #ifndef _SPARC_TYPES_H | ||
11 | #include <asm/types.h> | ||
12 | #endif | ||
13 | |||
14 | /* | ||
15 | * Semantics of the offset is a full address. | ||
16 | * Hardcode it or get it from probe ioctl. | ||
17 | * | ||
18 | * We use full bus address, so that we would be | ||
19 | * automatically compatible with possible future systems. | ||
20 | */ | ||
21 | |||
22 | #define JSFLASH_IDENT (('F'<<8)|54) | ||
23 | struct jsflash_ident_arg { | ||
24 | __u64 off; /* 0x20000000 is included */ | ||
25 | __u32 size; | ||
26 | char name[32]; /* With trailing zero */ | ||
27 | }; | ||
28 | |||
29 | #define JSFLASH_ERASE (('F'<<8)|55) | ||
30 | /* Put 0 as argument, may be flags or sector number... */ | ||
31 | |||
32 | #define JSFLASH_PROGRAM (('F'<<8)|56) | ||
33 | struct jsflash_program_arg { | ||
34 | __u64 data; /* char* for sparc and sparc64 */ | ||
35 | __u64 off; | ||
36 | __u32 size; | ||
37 | }; | ||
38 | |||
39 | #endif /* _SPARC_JSFLASH_H */ | ||
diff --git a/include/asm-sparc/kbio.h b/include/asm-sparc/kbio.h new file mode 100644 index 000000000000..3cf496bdf399 --- /dev/null +++ b/include/asm-sparc/kbio.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef __LINUX_KBIO_H | ||
2 | #define __LINUX_KBIO_H | ||
3 | |||
4 | /* Return keyboard type */ | ||
5 | #define KIOCTYPE _IOR('k', 9, int) | ||
6 | /* Return Keyboard layout */ | ||
7 | #define KIOCLAYOUT _IOR('k', 20, int) | ||
8 | |||
9 | enum { | ||
10 | TR_NONE, | ||
11 | TR_ASCII, /* keyboard is in regular state */ | ||
12 | TR_EVENT, /* keystrokes sent as firm events */ | ||
13 | TR_UNTRANS_EVENT /* EVENT+up and down+no translation */ | ||
14 | }; | ||
15 | |||
16 | /* Return the current keyboard translation */ | ||
17 | #define KIOCGTRANS _IOR('k', 5, int) | ||
18 | /* Set the keyboard translation */ | ||
19 | #define KIOCTRANS _IOW('k', 0, int) | ||
20 | |||
21 | /* Send a keyboard command */ | ||
22 | #define KIOCCMD _IOW('k', 8, int) | ||
23 | |||
24 | /* Return if keystrokes are being sent to /dev/kbd */ | ||
25 | |||
26 | /* Set routing of keystrokes to /dev/kbd */ | ||
27 | #define KIOCSDIRECT _IOW('k', 10, int) | ||
28 | |||
29 | /* Set keyboard leds */ | ||
30 | #define KIOCSLED _IOW('k', 14, unsigned char) | ||
31 | |||
32 | /* Get keyboard leds */ | ||
33 | #define KIOCGLED _IOR('k', 15, unsigned char) | ||
34 | |||
35 | /* Used by KIOC[GS]RATE */ | ||
36 | struct kbd_rate { | ||
37 | unsigned char delay; /* Delay in Hz before first repeat. */ | ||
38 | unsigned char rate; /* In characters per second (0..50). */ | ||
39 | }; | ||
40 | |||
41 | /* Set keyboard rate */ | ||
42 | #define KIOCSRATE _IOW('k', 40, struct kbd_rate) | ||
43 | |||
44 | /* Get keyboard rate */ | ||
45 | #define KIOCGRATE _IOW('k', 41, struct kbd_rate) | ||
46 | |||
47 | /* Top bit records if the key is up or down */ | ||
48 | #define KBD_UP 0x80 | ||
49 | |||
50 | /* Usable information */ | ||
51 | #define KBD_KEYMASK 0x7f | ||
52 | |||
53 | /* All keys up */ | ||
54 | #define KBD_IDLE 0x75 | ||
55 | |||
56 | #endif /* __LINUX_KBIO_H */ | ||
diff --git a/include/asm-sparc/kdebug.h b/include/asm-sparc/kdebug.h new file mode 100644 index 000000000000..3ea4916635ee --- /dev/null +++ b/include/asm-sparc/kdebug.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* $Id: kdebug.h,v 1.11 2000/06/04 06:23:53 anton Exp $ | ||
2 | * kdebug.h: Defines and definitions for debugging the Linux kernel | ||
3 | * under various kernel debuggers. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | #ifndef _SPARC_KDEBUG_H | ||
8 | #define _SPARC_KDEBUG_H | ||
9 | |||
10 | #include <asm/openprom.h> | ||
11 | #include <asm/vaddrs.h> | ||
12 | |||
13 | /* Breakpoints are enter through trap table entry 126. So in sparc assembly | ||
14 | * if you want to drop into the debugger you do: | ||
15 | * | ||
16 | * t DEBUG_BP_TRAP | ||
17 | */ | ||
18 | |||
19 | #define DEBUG_BP_TRAP 126 | ||
20 | |||
21 | #ifndef __ASSEMBLY__ | ||
22 | /* The debug vector is passed in %o1 at boot time. It is a pointer to | ||
23 | * a structure in the debuggers address space. Here is its format. | ||
24 | */ | ||
25 | |||
26 | typedef unsigned int (*debugger_funct)(void); | ||
27 | |||
28 | struct kernel_debug { | ||
29 | /* First the entry point into the debugger. You jump here | ||
30 | * to give control over to the debugger. | ||
31 | */ | ||
32 | unsigned long kdebug_entry; | ||
33 | unsigned long kdebug_trapme; /* Figure out later... */ | ||
34 | /* The following is the number of pages that the debugger has | ||
35 | * taken from to total pool. | ||
36 | */ | ||
37 | unsigned long *kdebug_stolen_pages; | ||
38 | /* Ok, after you remap yourself and/or change the trap table | ||
39 | * from what you were left with at boot time you have to call | ||
40 | * this synchronization function so the debugger can check out | ||
41 | * what you have done. | ||
42 | */ | ||
43 | debugger_funct teach_debugger; | ||
44 | }; /* I think that is it... */ | ||
45 | |||
46 | extern struct kernel_debug *linux_dbvec; | ||
47 | |||
48 | /* Use this macro in C-code to enter the debugger. */ | ||
49 | extern __inline__ void sp_enter_debugger(void) | ||
50 | { | ||
51 | __asm__ __volatile__("jmpl %0, %%o7\n\t" | ||
52 | "nop\n\t" : : | ||
53 | "r" (linux_dbvec) : "o7", "memory"); | ||
54 | } | ||
55 | |||
56 | #define SP_ENTER_DEBUGGER do { \ | ||
57 | if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \ | ||
58 | sp_enter_debugger(); \ | ||
59 | } while(0) | ||
60 | |||
61 | #endif /* !(__ASSEMBLY__) */ | ||
62 | |||
63 | /* Some nice offset defines for assembler code. */ | ||
64 | #define KDEBUG_ENTRY_OFF 0x0 | ||
65 | #define KDEBUG_DUNNO_OFF 0x4 | ||
66 | #define KDEBUG_DUNNO2_OFF 0x8 | ||
67 | #define KDEBUG_TEACH_OFF 0xc | ||
68 | |||
69 | #endif /* !(_SPARC_KDEBUG_H) */ | ||
diff --git a/include/asm-sparc/kgdb.h b/include/asm-sparc/kgdb.h new file mode 100644 index 000000000000..d120adfb429f --- /dev/null +++ b/include/asm-sparc/kgdb.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* $Id: kgdb.h,v 1.8 1998/01/07 06:33:44 baccala Exp $ | ||
2 | * kgdb.h: Defines and declarations for serial line source level | ||
3 | * remote debugging of the Linux kernel using gdb. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | #ifndef _SPARC_KGDB_H | ||
8 | #define _SPARC_KGDB_H | ||
9 | |||
10 | #ifndef __ASSEMBLY__ | ||
11 | /* To init the kgdb engine. */ | ||
12 | extern void set_debug_traps(void); | ||
13 | |||
14 | /* To enter the debugger explicitly. */ | ||
15 | extern void breakpoint(void); | ||
16 | |||
17 | /* For convenience we define the format of a kgdb trap breakpoint | ||
18 | * frame here also. | ||
19 | */ | ||
20 | struct kgdb_frame { | ||
21 | unsigned long globals[8]; | ||
22 | unsigned long outs[8]; | ||
23 | unsigned long locals[8]; | ||
24 | unsigned long ins[8]; | ||
25 | unsigned long fpregs[32]; | ||
26 | unsigned long y; | ||
27 | unsigned long psr; | ||
28 | unsigned long wim; | ||
29 | unsigned long tbr; | ||
30 | unsigned long pc; | ||
31 | unsigned long npc; | ||
32 | unsigned long fpsr; | ||
33 | unsigned long cpsr; | ||
34 | }; | ||
35 | #endif /* !(__ASSEMBLY__) */ | ||
36 | |||
37 | /* Macros for assembly usage of the kgdb breakpoint frame. */ | ||
38 | #define KGDB_G0 0x000 | ||
39 | #define KGDB_G1 0x004 | ||
40 | #define KGDB_G2 0x008 | ||
41 | #define KGDB_G4 0x010 | ||
42 | #define KGDB_G6 0x018 | ||
43 | #define KGDB_I0 0x020 | ||
44 | #define KGDB_I2 0x028 | ||
45 | #define KGDB_I4 0x030 | ||
46 | #define KGDB_I6 0x038 | ||
47 | #define KGDB_Y 0x100 | ||
48 | #define KGDB_PSR 0x104 | ||
49 | #define KGDB_WIM 0x108 | ||
50 | #define KGDB_TBR 0x10c | ||
51 | #define KGDB_PC 0x110 | ||
52 | #define KGDB_NPC 0x114 | ||
53 | |||
54 | #define SAVE_KGDB_GLOBALS(reg) \ | ||
55 | std %g0, [%reg + STACKFRAME_SZ + KGDB_G0]; \ | ||
56 | std %g2, [%reg + STACKFRAME_SZ + KGDB_G2]; \ | ||
57 | std %g4, [%reg + STACKFRAME_SZ + KGDB_G4]; \ | ||
58 | std %g6, [%reg + STACKFRAME_SZ + KGDB_G6]; | ||
59 | |||
60 | #define SAVE_KGDB_INS(reg) \ | ||
61 | std %i0, [%reg + STACKFRAME_SZ + KGDB_I0]; \ | ||
62 | std %i2, [%reg + STACKFRAME_SZ + KGDB_I2]; \ | ||
63 | std %i4, [%reg + STACKFRAME_SZ + KGDB_I4]; \ | ||
64 | std %i6, [%reg + STACKFRAME_SZ + KGDB_I6]; | ||
65 | |||
66 | #define SAVE_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \ | ||
67 | st %reg_y, [%reg + STACKFRAME_SZ + KGDB_Y]; \ | ||
68 | st %reg_psr, [%reg + STACKFRAME_SZ + KGDB_PSR]; \ | ||
69 | st %reg_wim, [%reg + STACKFRAME_SZ + KGDB_WIM]; \ | ||
70 | st %reg_tbr, [%reg + STACKFRAME_SZ + KGDB_TBR]; \ | ||
71 | st %reg_pc, [%reg + STACKFRAME_SZ + KGDB_PC]; \ | ||
72 | st %reg_npc, [%reg + STACKFRAME_SZ + KGDB_NPC]; | ||
73 | |||
74 | #define LOAD_KGDB_GLOBALS(reg) \ | ||
75 | ld [%reg + STACKFRAME_SZ + KGDB_G1], %g1; \ | ||
76 | ldd [%reg + STACKFRAME_SZ + KGDB_G2], %g2; \ | ||
77 | ldd [%reg + STACKFRAME_SZ + KGDB_G4], %g4; \ | ||
78 | ldd [%reg + STACKFRAME_SZ + KGDB_G6], %g6; | ||
79 | |||
80 | #define LOAD_KGDB_INS(reg) \ | ||
81 | ldd [%reg + STACKFRAME_SZ + KGDB_I0], %i0; \ | ||
82 | ldd [%reg + STACKFRAME_SZ + KGDB_I2], %i2; \ | ||
83 | ldd [%reg + STACKFRAME_SZ + KGDB_I4], %i4; \ | ||
84 | ldd [%reg + STACKFRAME_SZ + KGDB_I6], %i6; | ||
85 | |||
86 | #define LOAD_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \ | ||
87 | ld [%reg + STACKFRAME_SZ + KGDB_Y], %reg_y; \ | ||
88 | ld [%reg + STACKFRAME_SZ + KGDB_PSR], %reg_psr; \ | ||
89 | ld [%reg + STACKFRAME_SZ + KGDB_WIM], %reg_wim; \ | ||
90 | ld [%reg + STACKFRAME_SZ + KGDB_TBR], %reg_tbr; \ | ||
91 | ld [%reg + STACKFRAME_SZ + KGDB_PC], %reg_pc; \ | ||
92 | ld [%reg + STACKFRAME_SZ + KGDB_NPC], %reg_npc; | ||
93 | |||
94 | #endif /* !(_SPARC_KGDB_H) */ | ||
diff --git a/include/asm-sparc/kmap_types.h b/include/asm-sparc/kmap_types.h new file mode 100644 index 000000000000..e215f7104974 --- /dev/null +++ b/include/asm-sparc/kmap_types.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_KMAP_TYPES_H | ||
2 | #define _ASM_KMAP_TYPES_H | ||
3 | |||
4 | enum km_type { | ||
5 | KM_BOUNCE_READ, | ||
6 | KM_SKB_SUNRPC_DATA, | ||
7 | KM_SKB_DATA_SOFTIRQ, | ||
8 | KM_USER0, | ||
9 | KM_USER1, | ||
10 | KM_BIO_SRC_IRQ, | ||
11 | KM_BIO_DST_IRQ, | ||
12 | KM_PTE0, | ||
13 | KM_PTE1, | ||
14 | KM_IRQ0, | ||
15 | KM_IRQ1, | ||
16 | KM_SOFTIRQ0, | ||
17 | KM_SOFTIRQ1, | ||
18 | KM_TYPE_NR | ||
19 | }; | ||
20 | |||
21 | #endif | ||
diff --git a/include/asm-sparc/linkage.h b/include/asm-sparc/linkage.h new file mode 100644 index 000000000000..291c2d01c44f --- /dev/null +++ b/include/asm-sparc/linkage.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | ||
2 | #define __ASM_LINKAGE_H | ||
3 | |||
4 | /* Nothing to see here... */ | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-sparc/local.h b/include/asm-sparc/local.h new file mode 100644 index 000000000000..bc80815a435c --- /dev/null +++ b/include/asm-sparc/local.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _SPARC_LOCAL_H | ||
2 | #define _SPARC_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-sparc/machines.h b/include/asm-sparc/machines.h new file mode 100644 index 000000000000..d831350f5428 --- /dev/null +++ b/include/asm-sparc/machines.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* $Id: machines.h,v 1.4 1995/11/25 02:31:58 davem Exp $ | ||
2 | * machines.h: Defines for taking apart the machine type value in the | ||
3 | * idprom and determining the kind of machine we are on. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | #ifndef _SPARC_MACHINES_H | ||
8 | #define _SPARC_MACHINES_H | ||
9 | |||
10 | struct Sun_Machine_Models { | ||
11 | char *name; | ||
12 | unsigned char id_machtype; | ||
13 | }; | ||
14 | |||
15 | /* Current number of machines we know about that has an IDPROM | ||
16 | * machtype entry including one entry for the 0x80 OBP machines. | ||
17 | */ | ||
18 | #define NUM_SUN_MACHINES 15 | ||
19 | |||
20 | extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES]; | ||
21 | |||
22 | /* The machine type in the idprom area looks like this: | ||
23 | * | ||
24 | * --------------- | ||
25 | * | ARCH | MACH | | ||
26 | * --------------- | ||
27 | * 7 4 3 0 | ||
28 | * | ||
29 | * The ARCH field determines the architecture line (sun4, sun4c, etc). | ||
30 | * The MACH field determines the machine make within that architecture. | ||
31 | */ | ||
32 | |||
33 | #define SM_ARCH_MASK 0xf0 | ||
34 | #define SM_SUN4 0x20 | ||
35 | #define SM_SUN4C 0x50 | ||
36 | #define SM_SUN4M 0x70 | ||
37 | #define SM_SUN4M_OBP 0x80 | ||
38 | |||
39 | #define SM_TYP_MASK 0x0f | ||
40 | /* Sun4 machines */ | ||
41 | #define SM_4_260 0x01 /* Sun 4/200 series */ | ||
42 | #define SM_4_110 0x02 /* Sun 4/100 series */ | ||
43 | #define SM_4_330 0x03 /* Sun 4/300 series */ | ||
44 | #define SM_4_470 0x04 /* Sun 4/400 series */ | ||
45 | |||
46 | /* Sun4c machines Full Name - PROM NAME */ | ||
47 | #define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */ | ||
48 | #define SM_4C_IPC 0x02 /* Sun4c SparcStation IPC - Sun 4/40 */ | ||
49 | #define SM_4C_SS1PLUS 0x03 /* Sun4c SparcStation 1+ - Sun 4/65 */ | ||
50 | #define SM_4C_SLC 0x04 /* Sun4c SparcStation SLC - Sun 4/20 */ | ||
51 | #define SM_4C_SS2 0x05 /* Sun4c SparcStation 2 - Sun 4/75 */ | ||
52 | #define SM_4C_ELC 0x06 /* Sun4c SparcStation ELC - Sun 4/25 */ | ||
53 | #define SM_4C_IPX 0x07 /* Sun4c SparcStation IPX - Sun 4/50 */ | ||
54 | |||
55 | /* Sun4m machines, these predate the OpenBoot. These values only mean | ||
56 | * something if the value in the ARCH field is SM_SUN4M, if it is | ||
57 | * SM_SUN4M_OBP then you have the following situation: | ||
58 | * 1) You either have a sun4d, a sun4e, or a recently made sun4m. | ||
59 | * 2) You have to consult OpenBoot to determine which machine this is. | ||
60 | */ | ||
61 | #define SM_4M_SS60 0x01 /* Sun4m SparcSystem 600 */ | ||
62 | #define SM_4M_SS50 0x02 /* Sun4m SparcStation 10 */ | ||
63 | #define SM_4M_SS40 0x03 /* Sun4m SparcStation 5 */ | ||
64 | |||
65 | /* Sun4d machines -- N/A */ | ||
66 | /* Sun4e machines -- N/A */ | ||
67 | /* Sun4u machines -- N/A */ | ||
68 | |||
69 | #endif /* !(_SPARC_MACHINES_H) */ | ||
diff --git a/include/asm-sparc/mbus.h b/include/asm-sparc/mbus.h new file mode 100644 index 000000000000..5f2749015342 --- /dev/null +++ b/include/asm-sparc/mbus.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* $Id: mbus.h,v 1.9 1997/06/24 15:48:12 jj Exp $ | ||
2 | * mbus.h: Various defines for MBUS modules. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_MBUS_H | ||
8 | #define _SPARC_MBUS_H | ||
9 | |||
10 | #include <asm/ross.h> /* HyperSparc stuff */ | ||
11 | #include <asm/cypress.h> /* Cypress Chips */ | ||
12 | #include <asm/viking.h> /* Ugh, bug city... */ | ||
13 | |||
14 | enum mbus_module { | ||
15 | HyperSparc = 0, | ||
16 | Cypress = 1, | ||
17 | Cypress_vE = 2, | ||
18 | Cypress_vD = 3, | ||
19 | Swift_ok = 4, | ||
20 | Swift_bad_c = 5, | ||
21 | Swift_lots_o_bugs = 6, | ||
22 | Tsunami = 7, | ||
23 | Viking_12 = 8, | ||
24 | Viking_2x = 9, | ||
25 | Viking_30 = 10, | ||
26 | Viking_35 = 11, | ||
27 | Viking_new = 12, | ||
28 | TurboSparc = 13, | ||
29 | SRMMU_INVAL_MOD = 14, | ||
30 | }; | ||
31 | |||
32 | extern enum mbus_module srmmu_modtype; | ||
33 | extern unsigned int viking_rev, swift_rev, cypress_rev; | ||
34 | |||
35 | /* HW Mbus module bugs we have to deal with */ | ||
36 | #define HWBUG_COPYBACK_BROKEN 0x00000001 | ||
37 | #define HWBUG_ASIFLUSH_BROKEN 0x00000002 | ||
38 | #define HWBUG_VACFLUSH_BITROT 0x00000004 | ||
39 | #define HWBUG_KERN_ACCBROKEN 0x00000008 | ||
40 | #define HWBUG_KERN_CBITBROKEN 0x00000010 | ||
41 | #define HWBUG_MODIFIED_BITROT 0x00000020 | ||
42 | #define HWBUG_PC_BADFAULT_ADDR 0x00000040 | ||
43 | #define HWBUG_SUPERSCALAR_BAD 0x00000080 | ||
44 | #define HWBUG_PACINIT_BITROT 0x00000100 | ||
45 | |||
46 | extern unsigned int hwbug_bitmask; | ||
47 | |||
48 | /* First the module type values. To find out which you have, just load | ||
49 | * the mmu control register from ASI_M_MMUREG alternate address space and | ||
50 | * shift the value right 28 bits. | ||
51 | */ | ||
52 | /* IMPL field means the company which produced the chip. */ | ||
53 | #define MBUS_VIKING 0x4 /* bleech, Texas Instruments Module */ | ||
54 | #define MBUS_LSI 0x3 /* LSI Logics */ | ||
55 | #define MBUS_ROSS 0x1 /* Ross is nice */ | ||
56 | #define MBUS_FMI 0x0 /* Fujitsu Microelectronics/Swift */ | ||
57 | |||
58 | /* Ross Module versions */ | ||
59 | #define ROSS_604_REV_CDE 0x0 /* revisions c, d, and e */ | ||
60 | #define ROSS_604_REV_F 0x1 /* revision f */ | ||
61 | #define ROSS_605 0xf /* revision a, a.1, and a.2 */ | ||
62 | #define ROSS_605_REV_B 0xe /* revision b */ | ||
63 | |||
64 | /* TI Viking Module versions */ | ||
65 | #define VIKING_REV_12 0x1 /* Version 1.2 or SPARCclassic's CPU */ | ||
66 | #define VIKING_REV_2 0x2 /* Version 2.1, 2.2, 2.3, and 2.4 */ | ||
67 | #define VIKING_REV_30 0x3 /* Version 3.0 */ | ||
68 | #define VIKING_REV_35 0x4 /* Version 3.5 */ | ||
69 | |||
70 | /* LSI Logics. */ | ||
71 | #define LSI_L64815 0x0 | ||
72 | |||
73 | /* Fujitsu */ | ||
74 | #define FMI_AURORA 0x4 /* MB8690x, a Swift module... */ | ||
75 | #define FMI_TURBO 0x5 /* MB86907, a TurboSparc module... */ | ||
76 | |||
77 | /* For multiprocessor support we need to be able to obtain the CPU id and | ||
78 | * the MBUS Module id. | ||
79 | */ | ||
80 | |||
81 | /* The CPU ID is encoded in the trap base register, 20 bits to the left of | ||
82 | * bit zero, with 2 bits being significant. | ||
83 | */ | ||
84 | #define TBR_ID_SHIFT 20 | ||
85 | |||
86 | extern __inline__ int get_cpuid(void) | ||
87 | { | ||
88 | register int retval; | ||
89 | __asm__ __volatile__("rd %%tbr, %0\n\t" | ||
90 | "srl %0, %1, %0\n\t" : | ||
91 | "=r" (retval) : | ||
92 | "i" (TBR_ID_SHIFT)); | ||
93 | return (retval & 3); | ||
94 | } | ||
95 | |||
96 | extern __inline__ int get_modid(void) | ||
97 | { | ||
98 | return (get_cpuid() | 0x8); | ||
99 | } | ||
100 | |||
101 | |||
102 | #endif /* !(_SPARC_MBUS_H) */ | ||
diff --git a/include/asm-sparc/mc146818rtc.h b/include/asm-sparc/mc146818rtc.h new file mode 100644 index 000000000000..fa7eac926582 --- /dev/null +++ b/include/asm-sparc/mc146818rtc.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Machine dependent access functions for RTC registers. | ||
3 | */ | ||
4 | #ifndef __ASM_SPARC_MC146818RTC_H | ||
5 | #define __ASM_SPARC_MC146818RTC_H | ||
6 | |||
7 | #include <asm/io.h> | ||
8 | |||
9 | #ifndef RTC_PORT | ||
10 | #define RTC_PORT(x) (0x70 + (x)) | ||
11 | #define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ | ||
12 | #endif | ||
13 | |||
14 | /* | ||
15 | * The yet supported machines all access the RTC index register via | ||
16 | * an ISA port access but the way to access the date register differs ... | ||
17 | */ | ||
18 | #define CMOS_READ(addr) ({ \ | ||
19 | outb_p((addr),RTC_PORT(0)); \ | ||
20 | inb_p(RTC_PORT(1)); \ | ||
21 | }) | ||
22 | #define CMOS_WRITE(val, addr) ({ \ | ||
23 | outb_p((addr),RTC_PORT(0)); \ | ||
24 | outb_p((val),RTC_PORT(1)); \ | ||
25 | }) | ||
26 | |||
27 | #define RTC_IRQ 8 | ||
28 | |||
29 | #endif /* __ASM_SPARC_MC146818RTC_H */ | ||
diff --git a/include/asm-sparc/memreg.h b/include/asm-sparc/memreg.h new file mode 100644 index 000000000000..c0498d3baf93 --- /dev/null +++ b/include/asm-sparc/memreg.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* $Id: memreg.h,v 1.8 1996/08/29 09:48:23 davem Exp $ */ | ||
2 | #ifndef _SPARC_MEMREG_H | ||
3 | #define _SPARC_MEMREG_H | ||
4 | /* memreg.h: Definitions of the values found in the synchronous | ||
5 | * and asynchronous memory error registers when a fault | ||
6 | * occurs on the sun4c. | ||
7 | * | ||
8 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
9 | */ | ||
10 | |||
11 | /* First the synchronous error codes, these are usually just | ||
12 | * normal page faults. | ||
13 | */ | ||
14 | |||
15 | #define SUN4C_SYNC_WDRESET 0x0001 /* watchdog reset */ | ||
16 | #define SUN4C_SYNC_SIZE 0x0002 /* bad access size? whuz this? */ | ||
17 | #define SUN4C_SYNC_PARITY 0x0008 /* bad ram chips caused a parity error */ | ||
18 | #define SUN4C_SYNC_SBUS 0x0010 /* the SBUS had some problems... */ | ||
19 | #define SUN4C_SYNC_NOMEM 0x0020 /* translation to non-existent ram */ | ||
20 | #define SUN4C_SYNC_PROT 0x0040 /* access violated pte protections */ | ||
21 | #define SUN4C_SYNC_NPRESENT 0x0080 /* pte said that page was not present */ | ||
22 | #define SUN4C_SYNC_BADWRITE 0x8000 /* while writing something went bogus */ | ||
23 | |||
24 | #define SUN4C_SYNC_BOLIXED \ | ||
25 | (SUN4C_SYNC_WDRESET | SUN4C_SYNC_SIZE | SUN4C_SYNC_SBUS | \ | ||
26 | SUN4C_SYNC_NOMEM | SUN4C_SYNC_PARITY) | ||
27 | |||
28 | /* Now the asynchronous error codes, these are almost always produced | ||
29 | * by the cache writing things back to memory and getting a bad translation. | ||
30 | * Bad DVMA transactions can cause these faults too. | ||
31 | */ | ||
32 | |||
33 | #define SUN4C_ASYNC_BADDVMA 0x0010 /* error during DVMA access */ | ||
34 | #define SUN4C_ASYNC_NOMEM 0x0020 /* write back pointed to bad phys addr */ | ||
35 | #define SUN4C_ASYNC_BADWB 0x0080 /* write back points to non-present page */ | ||
36 | |||
37 | /* Memory parity error register with associated bit constants. */ | ||
38 | #ifndef __ASSEMBLY__ | ||
39 | extern __volatile__ unsigned long *sun4c_memerr_reg; | ||
40 | #endif | ||
41 | |||
42 | #define SUN4C_MPE_ERROR 0x80 /* Parity error detected. (ro) */ | ||
43 | #define SUN4C_MPE_MULTI 0x40 /* Multiple parity errors detected. (ro) */ | ||
44 | #define SUN4C_MPE_TEST 0x20 /* Write inverse parity. (rw) */ | ||
45 | #define SUN4C_MPE_CHECK 0x10 /* Enable parity checking. (rw) */ | ||
46 | #define SUN4C_MPE_ERR00 0x08 /* Parity error in bits 0-7. (ro) */ | ||
47 | #define SUN4C_MPE_ERR08 0x04 /* Parity error in bits 8-15. (ro) */ | ||
48 | #define SUN4C_MPE_ERR16 0x02 /* Parity error in bits 16-23. (ro) */ | ||
49 | #define SUN4C_MPE_ERR24 0x01 /* Parity error in bits 24-31. (ro) */ | ||
50 | #define SUN4C_MPE_ERRS 0x0F /* Bit mask for the error bits. (ro) */ | ||
51 | |||
52 | #endif /* !(_SPARC_MEMREG_H) */ | ||
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h new file mode 100644 index 000000000000..138eb81dd70d --- /dev/null +++ b/include/asm-sparc/mman.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* $Id: mman.h,v 1.9 2000/03/15 02:44:23 davem Exp $ */ | ||
2 | #ifndef __SPARC_MMAN_H__ | ||
3 | #define __SPARC_MMAN_H__ | ||
4 | |||
5 | /* SunOS'ified... */ | ||
6 | |||
7 | #define PROT_READ 0x1 /* page can be read */ | ||
8 | #define PROT_WRITE 0x2 /* page can be written */ | ||
9 | #define PROT_EXEC 0x4 /* page can be executed */ | ||
10 | #define PROT_SEM 0x8 /* page may be used for atomic ops */ | ||
11 | #define PROT_NONE 0x0 /* page can not be accessed */ | ||
12 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ | ||
13 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ | ||
14 | |||
15 | #define MAP_SHARED 0x01 /* Share changes */ | ||
16 | #define MAP_PRIVATE 0x02 /* Changes are private */ | ||
17 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ | ||
18 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ | ||
19 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ | ||
20 | #define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ | ||
21 | #define MAP_NORESERVE 0x40 /* don't reserve swap pages */ | ||
22 | #define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */ | ||
23 | #define MAP_LOCKED 0x100 /* lock the mapping */ | ||
24 | #define _MAP_NEW 0x80000000 /* Binary compatibility is fun... */ | ||
25 | |||
26 | #define MAP_GROWSDOWN 0x0200 /* stack-like segment */ | ||
27 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
28 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
29 | |||
30 | #define MS_ASYNC 1 /* sync memory asynchronously */ | ||
31 | #define MS_INVALIDATE 2 /* invalidate the caches */ | ||
32 | #define MS_SYNC 4 /* synchronous memory sync */ | ||
33 | |||
34 | #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ | ||
35 | #define MCL_FUTURE 0x4000 /* lock all additions to address space */ | ||
36 | |||
37 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
38 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
39 | |||
40 | /* XXX Need to add flags to SunOS's mctl, mlockall, and madvise system | ||
41 | * XXX calls. | ||
42 | */ | ||
43 | |||
44 | /* SunOS sys_mctl() stuff... */ | ||
45 | #define MC_SYNC 1 /* Sync pages in memory with storage (usu. a file) */ | ||
46 | #define MC_LOCK 2 /* Lock pages into core ram, do not allow swapping of them */ | ||
47 | #define MC_UNLOCK 3 /* Unlock pages locked via previous mctl() with MC_LOCK arg */ | ||
48 | #define MC_LOCKAS 5 /* Lock an entire address space of the calling process */ | ||
49 | #define MC_UNLOCKAS 6 /* Unlock entire address space of calling process */ | ||
50 | |||
51 | #define MADV_NORMAL 0x0 /* default page-in behavior */ | ||
52 | #define MADV_RANDOM 0x1 /* page-in minimum required */ | ||
53 | #define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ | ||
54 | #define MADV_WILLNEED 0x3 /* pre-fault pages */ | ||
55 | #define MADV_DONTNEED 0x4 /* discard these pages */ | ||
56 | #define MADV_FREE 0x5 /* (Solaris) contents can be freed */ | ||
57 | |||
58 | /* compatibility flags */ | ||
59 | #define MAP_ANON MAP_ANONYMOUS | ||
60 | #define MAP_FILE 0 | ||
61 | |||
62 | #endif /* __SPARC_MMAN_H__ */ | ||
diff --git a/include/asm-sparc/mmu.h b/include/asm-sparc/mmu.h new file mode 100644 index 000000000000..ccd36d26615a --- /dev/null +++ b/include/asm-sparc/mmu.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __MMU_H | ||
2 | #define __MMU_H | ||
3 | |||
4 | /* Default "unsigned long" context */ | ||
5 | typedef unsigned long mm_context_t; | ||
6 | |||
7 | #endif | ||
diff --git a/include/asm-sparc/mmu_context.h b/include/asm-sparc/mmu_context.h new file mode 100644 index 000000000000..ed1e01d04d21 --- /dev/null +++ b/include/asm-sparc/mmu_context.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef __SPARC_MMU_CONTEXT_H | ||
2 | #define __SPARC_MMU_CONTEXT_H | ||
3 | |||
4 | #include <asm/btfixup.h> | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | ||
7 | |||
8 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
9 | { | ||
10 | } | ||
11 | |||
12 | /* | ||
13 | * Initialize a new mmu context. This is invoked when a new | ||
14 | * address space instance (unique or shared) is instantiated. | ||
15 | */ | ||
16 | #define init_new_context(tsk, mm) (((mm)->context = NO_CONTEXT), 0) | ||
17 | |||
18 | /* | ||
19 | * Destroy a dead context. This occurs when mmput drops the | ||
20 | * mm_users count to zero, the mmaps have been released, and | ||
21 | * all the page tables have been flushed. Our job is to destroy | ||
22 | * any remaining processor-specific state. | ||
23 | */ | ||
24 | BTFIXUPDEF_CALL(void, destroy_context, struct mm_struct *) | ||
25 | |||
26 | #define destroy_context(mm) BTFIXUP_CALL(destroy_context)(mm) | ||
27 | |||
28 | /* Switch the current MM context. */ | ||
29 | BTFIXUPDEF_CALL(void, switch_mm, struct mm_struct *, struct mm_struct *, struct task_struct *) | ||
30 | |||
31 | #define switch_mm(old_mm, mm, tsk) BTFIXUP_CALL(switch_mm)(old_mm, mm, tsk) | ||
32 | |||
33 | #define deactivate_mm(tsk,mm) do { } while (0) | ||
34 | |||
35 | /* Activate a new MM instance for the current task. */ | ||
36 | #define activate_mm(active_mm, mm) switch_mm((active_mm), (mm), NULL) | ||
37 | |||
38 | #endif /* !(__ASSEMBLY__) */ | ||
39 | |||
40 | #endif /* !(__SPARC_MMU_CONTEXT_H) */ | ||
diff --git a/include/asm-sparc/module.h b/include/asm-sparc/module.h new file mode 100644 index 000000000000..cbd9e67b0c0b --- /dev/null +++ b/include/asm-sparc/module.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_SPARC_MODULE_H | ||
2 | #define _ASM_SPARC_MODULE_H | ||
3 | struct mod_arch_specific { }; | ||
4 | #define Elf_Shdr Elf32_Shdr | ||
5 | #define Elf_Sym Elf32_Sym | ||
6 | #define Elf_Ehdr Elf32_Ehdr | ||
7 | #endif /* _ASM_SPARC_MODULE_H */ | ||
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h new file mode 100644 index 000000000000..59b86bc793bf --- /dev/null +++ b/include/asm-sparc/mostek.h | |||
@@ -0,0 +1,174 @@ | |||
1 | /* $Id: mostek.h,v 1.13 2001/01/11 15:07:09 davem Exp $ | ||
2 | * mostek.h: Describes the various Mostek time of day clock registers. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) | ||
6 | * Added intersil code 05/25/98 Chris Davis (cdavis@cois.on.ca) | ||
7 | */ | ||
8 | |||
9 | #ifndef _SPARC_MOSTEK_H | ||
10 | #define _SPARC_MOSTEK_H | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <asm/idprom.h> | ||
14 | #include <asm/io.h> | ||
15 | |||
16 | /* M48T02 Register Map (adapted from Sun NVRAM/Hostid FAQ) | ||
17 | * | ||
18 | * Data | ||
19 | * Address Function | ||
20 | * Bit 7 Bit 6 Bit 5 Bit 4Bit 3 Bit 2 Bit 1 Bit 0 | ||
21 | * 7ff - - - - - - - - Year 00-99 | ||
22 | * 7fe 0 0 0 - - - - - Month 01-12 | ||
23 | * 7fd 0 0 - - - - - - Date 01-31 | ||
24 | * 7fc 0 FT 0 0 0 - - - Day 01-07 | ||
25 | * 7fb KS 0 - - - - - - Hours 00-23 | ||
26 | * 7fa 0 - - - - - - - Minutes 00-59 | ||
27 | * 7f9 ST - - - - - - - Seconds 00-59 | ||
28 | * 7f8 W R S - - - - - Control | ||
29 | * | ||
30 | * * ST is STOP BIT | ||
31 | * * W is WRITE BIT | ||
32 | * * R is READ BIT | ||
33 | * * S is SIGN BIT | ||
34 | * * FT is FREQ TEST BIT | ||
35 | * * KS is KICK START BIT | ||
36 | */ | ||
37 | |||
38 | /* The Mostek 48t02 real time clock and NVRAM chip. The registers | ||
39 | * other than the control register are in binary coded decimal. Some | ||
40 | * control bits also live outside the control register. | ||
41 | */ | ||
42 | #define mostek_read(_addr) readb(_addr) | ||
43 | #define mostek_write(_addr,_val) writeb(_val, _addr) | ||
44 | #define MOSTEK_EEPROM 0x0000UL | ||
45 | #define MOSTEK_IDPROM 0x07d8UL | ||
46 | #define MOSTEK_CREG 0x07f8UL | ||
47 | #define MOSTEK_SEC 0x07f9UL | ||
48 | #define MOSTEK_MIN 0x07faUL | ||
49 | #define MOSTEK_HOUR 0x07fbUL | ||
50 | #define MOSTEK_DOW 0x07fcUL | ||
51 | #define MOSTEK_DOM 0x07fdUL | ||
52 | #define MOSTEK_MONTH 0x07feUL | ||
53 | #define MOSTEK_YEAR 0x07ffUL | ||
54 | |||
55 | struct mostek48t02 { | ||
56 | volatile char eeprom[2008]; /* This is the eeprom, don't touch! */ | ||
57 | struct idprom idprom; /* The idprom lives here. */ | ||
58 | volatile unsigned char creg; /* Control register */ | ||
59 | volatile unsigned char sec; /* Seconds (0-59) */ | ||
60 | volatile unsigned char min; /* Minutes (0-59) */ | ||
61 | volatile unsigned char hour; /* Hour (0-23) */ | ||
62 | volatile unsigned char dow; /* Day of the week (1-7) */ | ||
63 | volatile unsigned char dom; /* Day of the month (1-31) */ | ||
64 | volatile unsigned char month; /* Month of year (1-12) */ | ||
65 | volatile unsigned char year; /* Year (0-99) */ | ||
66 | }; | ||
67 | |||
68 | extern spinlock_t mostek_lock; | ||
69 | extern void __iomem *mstk48t02_regs; | ||
70 | |||
71 | /* Control register values. */ | ||
72 | #define MSTK_CREG_WRITE 0x80 /* Must set this before placing values. */ | ||
73 | #define MSTK_CREG_READ 0x40 /* Stop updates to allow a clean read. */ | ||
74 | #define MSTK_CREG_SIGN 0x20 /* Slow/speed clock in calibration mode. */ | ||
75 | |||
76 | /* Control bits that live in the other registers. */ | ||
77 | #define MSTK_STOP 0x80 /* Stop the clock oscillator. (sec) */ | ||
78 | #define MSTK_KICK_START 0x80 /* Kick start the clock chip. (hour) */ | ||
79 | #define MSTK_FREQ_TEST 0x40 /* Frequency test mode. (day) */ | ||
80 | |||
81 | #define MSTK_YEAR_ZERO 1968 /* If year reg has zero, it is 1968. */ | ||
82 | #define MSTK_CVT_YEAR(yr) ((yr) + MSTK_YEAR_ZERO) | ||
83 | |||
84 | /* Masks that define how much space each value takes up. */ | ||
85 | #define MSTK_SEC_MASK 0x7f | ||
86 | #define MSTK_MIN_MASK 0x7f | ||
87 | #define MSTK_HOUR_MASK 0x3f | ||
88 | #define MSTK_DOW_MASK 0x07 | ||
89 | #define MSTK_DOM_MASK 0x3f | ||
90 | #define MSTK_MONTH_MASK 0x1f | ||
91 | #define MSTK_YEAR_MASK 0xff | ||
92 | |||
93 | /* Binary coded decimal conversion macros. */ | ||
94 | #define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) | ||
95 | #define MSTK_DECIMAL_TO_REGVAL(x) ((((x) / 0x0A) << 0x04) + ((x) % 0x0A)) | ||
96 | |||
97 | /* Generic register set and get macros for internal use. */ | ||
98 | #define MSTK_GET(regs,var,mask) (MSTK_REGVAL_TO_DECIMAL(((struct mostek48t02 *)regs)->var & MSTK_ ## mask ## _MASK)) | ||
99 | #define MSTK_SET(regs,var,value,mask) do { ((struct mostek48t02 *)regs)->var &= ~(MSTK_ ## mask ## _MASK); ((struct mostek48t02 *)regs)->var |= MSTK_DECIMAL_TO_REGVAL(value) & (MSTK_ ## mask ## _MASK); } while (0) | ||
100 | |||
101 | /* Macros to make register access easier on our fingers. These give you | ||
102 | * the decimal value of the register requested if applicable. You pass | ||
103 | * the a pointer to a 'struct mostek48t02'. | ||
104 | */ | ||
105 | #define MSTK_REG_CREG(regs) (((struct mostek48t02 *)regs)->creg) | ||
106 | #define MSTK_REG_SEC(regs) MSTK_GET(regs,sec,SEC) | ||
107 | #define MSTK_REG_MIN(regs) MSTK_GET(regs,min,MIN) | ||
108 | #define MSTK_REG_HOUR(regs) MSTK_GET(regs,hour,HOUR) | ||
109 | #define MSTK_REG_DOW(regs) MSTK_GET(regs,dow,DOW) | ||
110 | #define MSTK_REG_DOM(regs) MSTK_GET(regs,dom,DOM) | ||
111 | #define MSTK_REG_MONTH(regs) MSTK_GET(regs,month,MONTH) | ||
112 | #define MSTK_REG_YEAR(regs) MSTK_GET(regs,year,YEAR) | ||
113 | |||
114 | #define MSTK_SET_REG_SEC(regs,value) MSTK_SET(regs,sec,value,SEC) | ||
115 | #define MSTK_SET_REG_MIN(regs,value) MSTK_SET(regs,min,value,MIN) | ||
116 | #define MSTK_SET_REG_HOUR(regs,value) MSTK_SET(regs,hour,value,HOUR) | ||
117 | #define MSTK_SET_REG_DOW(regs,value) MSTK_SET(regs,dow,value,DOW) | ||
118 | #define MSTK_SET_REG_DOM(regs,value) MSTK_SET(regs,dom,value,DOM) | ||
119 | #define MSTK_SET_REG_MONTH(regs,value) MSTK_SET(regs,month,value,MONTH) | ||
120 | #define MSTK_SET_REG_YEAR(regs,value) MSTK_SET(regs,year,value,YEAR) | ||
121 | |||
122 | |||
123 | /* The Mostek 48t08 clock chip. Found on Sun4m's I think. It has the | ||
124 | * same (basically) layout of the 48t02 chip except for the extra | ||
125 | * NVRAM on board (8 KB against the 48t02's 2 KB). | ||
126 | */ | ||
127 | struct mostek48t08 { | ||
128 | char offset[6*1024]; /* Magic things may be here, who knows? */ | ||
129 | struct mostek48t02 regs; /* Here is what we are interested in. */ | ||
130 | }; | ||
131 | |||
132 | extern enum sparc_clock_type sp_clock_typ; | ||
133 | |||
134 | #ifdef CONFIG_SUN4 | ||
135 | enum sparc_clock_type { MSTK48T02, MSTK48T08, \ | ||
136 | INTERSIL, MSTK_INVALID }; | ||
137 | #else | ||
138 | enum sparc_clock_type { MSTK48T02, MSTK48T08, \ | ||
139 | MSTK_INVALID }; | ||
140 | #endif | ||
141 | |||
142 | #ifdef CONFIG_SUN4 | ||
143 | /* intersil on a sun 4/260 code data from harris doc */ | ||
144 | struct intersil_dt { | ||
145 | volatile unsigned char int_csec; | ||
146 | volatile unsigned char int_hour; | ||
147 | volatile unsigned char int_min; | ||
148 | volatile unsigned char int_sec; | ||
149 | volatile unsigned char int_month; | ||
150 | volatile unsigned char int_day; | ||
151 | volatile unsigned char int_year; | ||
152 | volatile unsigned char int_dow; | ||
153 | }; | ||
154 | |||
155 | struct intersil { | ||
156 | struct intersil_dt clk; | ||
157 | struct intersil_dt cmp; | ||
158 | volatile unsigned char int_intr_reg; | ||
159 | volatile unsigned char int_cmd_reg; | ||
160 | }; | ||
161 | |||
162 | #define INTERSIL_STOP 0x0 | ||
163 | #define INTERSIL_START 0x8 | ||
164 | #define INTERSIL_INTR_DISABLE 0x0 | ||
165 | #define INTERSIL_INTR_ENABLE 0x10 | ||
166 | #define INTERSIL_32K 0x0 | ||
167 | #define INTERSIL_NORMAL 0x0 | ||
168 | #define INTERSIL_24H 0x4 | ||
169 | #define INTERSIL_INT_100HZ 0x2 | ||
170 | |||
171 | /* end of intersil info */ | ||
172 | #endif | ||
173 | |||
174 | #endif /* !(_SPARC_MOSTEK_H) */ | ||
diff --git a/include/asm-sparc/mpmbox.h b/include/asm-sparc/mpmbox.h new file mode 100644 index 000000000000..0e1bc5801d8a --- /dev/null +++ b/include/asm-sparc/mpmbox.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* $Id: mpmbox.h,v 1.4 1996/04/25 06:13:19 davem Exp $ | ||
2 | * mpmbox.h: Interface and defines for the OpenProm mailbox | ||
3 | * facilities for MP machines under Linux. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_MPMBOX_H | ||
9 | #define _SPARC_MPMBOX_H | ||
10 | |||
11 | /* The prom allocates, for each CPU on the machine an unsigned | ||
12 | * byte in physical ram. You probe the device tree prom nodes | ||
13 | * for these values. The purpose of this byte is to be able to | ||
14 | * pass messages from one cpu to another. | ||
15 | */ | ||
16 | |||
17 | /* These are the main message types we have to look for in our | ||
18 | * Cpu mailboxes, based upon these values we decide what course | ||
19 | * of action to take. | ||
20 | */ | ||
21 | |||
22 | /* The CPU is executing code in the kernel. */ | ||
23 | #define MAILBOX_ISRUNNING 0xf0 | ||
24 | |||
25 | /* Another CPU called romvec->pv_exit(), you should call | ||
26 | * prom_stopcpu() when you see this in your mailbox. | ||
27 | */ | ||
28 | #define MAILBOX_EXIT 0xfb | ||
29 | |||
30 | /* Another CPU called romvec->pv_enter(), you should call | ||
31 | * prom_cpuidle() when this is seen. | ||
32 | */ | ||
33 | #define MAILBOX_GOSPIN 0xfc | ||
34 | |||
35 | /* Another CPU has hit a breakpoint either into kadb or the prom | ||
36 | * itself. Just like MAILBOX_GOSPIN, you should call prom_cpuidle() | ||
37 | * at this point. | ||
38 | */ | ||
39 | #define MAILBOX_BPT_SPIN 0xfd | ||
40 | |||
41 | /* Oh geese, some other nitwit got a damn watchdog reset. The party's | ||
42 | * over so go call prom_stopcpu(). | ||
43 | */ | ||
44 | #define MAILBOX_WDOG_STOP 0xfe | ||
45 | |||
46 | #ifndef __ASSEMBLY__ | ||
47 | |||
48 | /* Handy macro's to determine a cpu's state. */ | ||
49 | |||
50 | /* Is the cpu still in Power On Self Test? */ | ||
51 | #define MBOX_POST_P(letter) ((letter) >= 0x00 && (letter) <= 0x7f) | ||
52 | |||
53 | /* Is the cpu at the 'ok' prompt of the PROM? */ | ||
54 | #define MBOX_PROMPROMPT_P(letter) ((letter) >= 0x80 && (letter) <= 0x8f) | ||
55 | |||
56 | /* Is the cpu spinning in the PROM? */ | ||
57 | #define MBOX_PROMSPIN_P(letter) ((letter) >= 0x90 && (letter) <= 0xef) | ||
58 | |||
59 | /* Sanity check... This is junk mail, throw it out. */ | ||
60 | #define MBOX_BOGON_P(letter) ((letter) >= 0xf1 && (letter) <= 0xfa) | ||
61 | |||
62 | /* Is the cpu actively running an application/kernel-code? */ | ||
63 | #define MBOX_RUNNING_P(letter) ((letter) == MAILBOX_ISRUNNING) | ||
64 | |||
65 | #endif /* !(__ASSEMBLY__) */ | ||
66 | |||
67 | #endif /* !(_SPARC_MPMBOX_H) */ | ||
diff --git a/include/asm-sparc/msgbuf.h b/include/asm-sparc/msgbuf.h new file mode 100644 index 000000000000..8cec9ad0b825 --- /dev/null +++ b/include/asm-sparc/msgbuf.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _SPARC64_MSGBUF_H | ||
2 | #define _SPARC64_MSGBUF_H | ||
3 | |||
4 | /* | ||
5 | * The msqid64_ds structure for sparc64 architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct msqid64_ds { | ||
15 | struct ipc64_perm msg_perm; | ||
16 | unsigned int __pad1; | ||
17 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
18 | unsigned int __pad2; | ||
19 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
20 | unsigned int __pad3; | ||
21 | __kernel_time_t msg_ctime; /* last change time */ | ||
22 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
23 | unsigned long msg_qnum; /* number of messages in queue */ | ||
24 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
25 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
26 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
27 | unsigned long __unused1; | ||
28 | unsigned long __unused2; | ||
29 | }; | ||
30 | |||
31 | #endif /* _SPARC64_MSGBUF_H */ | ||
diff --git a/include/asm-sparc/msi.h b/include/asm-sparc/msi.h new file mode 100644 index 000000000000..b69543dd3b46 --- /dev/null +++ b/include/asm-sparc/msi.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* $Id: msi.h,v 1.3 1996/08/29 09:48:25 davem Exp $ | ||
2 | * msi.h: Defines specific to the MBus - Sbus - Interface. | ||
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 | #ifndef _SPARC_MSI_H | ||
9 | #define _SPARC_MSI_H | ||
10 | |||
11 | /* | ||
12 | * Locations of MSI Registers. | ||
13 | */ | ||
14 | #define MSI_MBUS_ARBEN 0xe0001008 /* MBus Arbiter Enable register */ | ||
15 | |||
16 | /* | ||
17 | * Useful bits in the MSI Registers. | ||
18 | */ | ||
19 | #define MSI_ASYNC_MODE 0x80000000 /* Operate the MSI asynchronously */ | ||
20 | |||
21 | |||
22 | extern __inline__ void msi_set_sync(void) | ||
23 | { | ||
24 | __asm__ __volatile__ ("lda [%0] %1, %%g3\n\t" | ||
25 | "andn %%g3, %2, %%g3\n\t" | ||
26 | "sta %%g3, [%0] %1\n\t" : : | ||
27 | "r" (MSI_MBUS_ARBEN), | ||
28 | "i" (ASI_M_CTL), "r" (MSI_ASYNC_MODE) : "g3"); | ||
29 | } | ||
30 | |||
31 | #endif /* !(_SPARC_MSI_H) */ | ||
diff --git a/include/asm-sparc/mxcc.h b/include/asm-sparc/mxcc.h new file mode 100644 index 000000000000..efe4e843122d --- /dev/null +++ b/include/asm-sparc/mxcc.h | |||
@@ -0,0 +1,137 @@ | |||
1 | /* $Id: mxcc.h,v 1.7 1997/04/20 14:11:46 ecd Exp $ | ||
2 | * mxcc.h: Definitions of the Viking MXCC registers | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_MXCC_H | ||
8 | #define _SPARC_MXCC_H | ||
9 | |||
10 | /* These registers are accessed through ASI 0x2. */ | ||
11 | #define MXCC_DATSTREAM 0x1C00000 /* Data stream register */ | ||
12 | #define MXCC_SRCSTREAM 0x1C00100 /* Source stream register */ | ||
13 | #define MXCC_DESSTREAM 0x1C00200 /* Destination stream register */ | ||
14 | #define MXCC_RMCOUNT 0x1C00300 /* Count of references and misses */ | ||
15 | #define MXCC_STEST 0x1C00804 /* Internal self-test */ | ||
16 | #define MXCC_CREG 0x1C00A04 /* Control register */ | ||
17 | #define MXCC_SREG 0x1C00B00 /* Status register */ | ||
18 | #define MXCC_RREG 0x1C00C04 /* Reset register */ | ||
19 | #define MXCC_EREG 0x1C00E00 /* Error code register */ | ||
20 | #define MXCC_PREG 0x1C00F04 /* Address port register */ | ||
21 | |||
22 | /* Some MXCC constants. */ | ||
23 | #define MXCC_STREAM_SIZE 0x20 /* Size in bytes of one stream r/w */ | ||
24 | |||
25 | /* The MXCC Control Register: | ||
26 | * | ||
27 | * ---------------------------------------------------------------------- | ||
28 | * | | RRC | RSV |PRE|MCE|PARE|ECE|RSV| | ||
29 | * ---------------------------------------------------------------------- | ||
30 | * 31 10 9 8-6 5 4 3 2 1-0 | ||
31 | * | ||
32 | * RRC: Controls what you read from MXCC_RMCOUNT reg. | ||
33 | * 0=Misses 1=References | ||
34 | * PRE: Prefetch enable | ||
35 | * MCE: Multiple Command Enable | ||
36 | * PARE: Parity enable | ||
37 | * ECE: External cache enable | ||
38 | */ | ||
39 | |||
40 | #define MXCC_CTL_RRC 0x00000200 | ||
41 | #define MXCC_CTL_PRE 0x00000020 | ||
42 | #define MXCC_CTL_MCE 0x00000010 | ||
43 | #define MXCC_CTL_PARE 0x00000008 | ||
44 | #define MXCC_CTL_ECE 0x00000004 | ||
45 | |||
46 | /* The MXCC Error Register: | ||
47 | * | ||
48 | * -------------------------------------------------------- | ||
49 | * |ME| RSV|CE|PEW|PEE|ASE|EIV| MOPC|ECODE|PRIV|RSV|HPADDR| | ||
50 | * -------------------------------------------------------- | ||
51 | * 31 30 29 28 27 26 25 24-15 14-7 6 5-3 2-0 | ||
52 | * | ||
53 | * ME: Multiple Errors have occurred | ||
54 | * CE: Cache consistency Error | ||
55 | * PEW: Parity Error during a Write operation | ||
56 | * PEE: Parity Error involving the External cache | ||
57 | * ASE: ASynchronous Error | ||
58 | * EIV: This register is toast | ||
59 | * MOPC: MXCC Operation Code for instance causing error | ||
60 | * ECODE: The Error CODE | ||
61 | * PRIV: A privileged mode error? 0=no 1=yes | ||
62 | * HPADDR: High PhysicalADDRess bits (35-32) | ||
63 | */ | ||
64 | |||
65 | #define MXCC_ERR_ME 0x80000000 | ||
66 | #define MXCC_ERR_CE 0x20000000 | ||
67 | #define MXCC_ERR_PEW 0x10000000 | ||
68 | #define MXCC_ERR_PEE 0x08000000 | ||
69 | #define MXCC_ERR_ASE 0x04000000 | ||
70 | #define MXCC_ERR_EIV 0x02000000 | ||
71 | #define MXCC_ERR_MOPC 0x01FF8000 | ||
72 | #define MXCC_ERR_ECODE 0x00007F80 | ||
73 | #define MXCC_ERR_PRIV 0x00000040 | ||
74 | #define MXCC_ERR_HPADDR 0x0000000f | ||
75 | |||
76 | /* The MXCC Port register: | ||
77 | * | ||
78 | * ----------------------------------------------------- | ||
79 | * | | MID | | | ||
80 | * ----------------------------------------------------- | ||
81 | * 31 21 20-18 17 0 | ||
82 | * | ||
83 | * MID: The moduleID of the cpu your read this from. | ||
84 | */ | ||
85 | |||
86 | #ifndef __ASSEMBLY__ | ||
87 | |||
88 | extern __inline__ void mxcc_set_stream_src(unsigned long *paddr) | ||
89 | { | ||
90 | unsigned long data0 = paddr[0]; | ||
91 | unsigned long data1 = paddr[1]; | ||
92 | |||
93 | __asm__ __volatile__ ("or %%g0, %0, %%g2\n\t" | ||
94 | "or %%g0, %1, %%g3\n\t" | ||
95 | "stda %%g2, [%2] %3\n\t" : : | ||
96 | "r" (data0), "r" (data1), | ||
97 | "r" (MXCC_SRCSTREAM), | ||
98 | "i" (ASI_M_MXCC) : "g2", "g3"); | ||
99 | } | ||
100 | |||
101 | extern __inline__ void mxcc_set_stream_dst(unsigned long *paddr) | ||
102 | { | ||
103 | unsigned long data0 = paddr[0]; | ||
104 | unsigned long data1 = paddr[1]; | ||
105 | |||
106 | __asm__ __volatile__ ("or %%g0, %0, %%g2\n\t" | ||
107 | "or %%g0, %1, %%g3\n\t" | ||
108 | "stda %%g2, [%2] %3\n\t" : : | ||
109 | "r" (data0), "r" (data1), | ||
110 | "r" (MXCC_DESSTREAM), | ||
111 | "i" (ASI_M_MXCC) : "g2", "g3"); | ||
112 | } | ||
113 | |||
114 | extern __inline__ unsigned long mxcc_get_creg(void) | ||
115 | { | ||
116 | unsigned long mxcc_control; | ||
117 | |||
118 | __asm__ __volatile__("set -1, %%g2\n\t" | ||
119 | "set -1, %%g3\n\t" | ||
120 | "stda %%g2, [%1] %2\n\t" | ||
121 | "lda [%3] %2, %0\n\t" : | ||
122 | "=r" (mxcc_control) : | ||
123 | "r" (MXCC_EREG), "i" (ASI_M_MXCC), | ||
124 | "r" (MXCC_CREG) : "g2", "g3"); | ||
125 | return mxcc_control; | ||
126 | } | ||
127 | |||
128 | extern __inline__ void mxcc_set_creg(unsigned long mxcc_control) | ||
129 | { | ||
130 | __asm__ __volatile__("sta %0, [%1] %2\n\t" : : | ||
131 | "r" (mxcc_control), "r" (MXCC_CREG), | ||
132 | "i" (ASI_M_MXCC)); | ||
133 | } | ||
134 | |||
135 | #endif /* !__ASSEMBLY__ */ | ||
136 | |||
137 | #endif /* !(_SPARC_MXCC_H) */ | ||
diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h new file mode 100644 index 000000000000..f2461e8a11ac --- /dev/null +++ b/include/asm-sparc/namei.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* $Id: namei.h,v 1.16 2000/04/13 00:55:54 davem Exp $ | ||
2 | * linux/include/asm-sparc/namei.h | ||
3 | * | ||
4 | * Routines to handle famous /usr/gnemul/s*. | ||
5 | * Included from linux/fs/namei.c | ||
6 | */ | ||
7 | |||
8 | #ifndef __SPARC_NAMEI_H | ||
9 | #define __SPARC_NAMEI_H | ||
10 | |||
11 | #define SPARC_BSD_EMUL "/usr/gnemul/sunos/" | ||
12 | #define SPARC_SOL_EMUL "/usr/gnemul/solaris/" | ||
13 | |||
14 | static inline char * __emul_prefix(void) | ||
15 | { | ||
16 | switch (current->personality) { | ||
17 | case PER_SUNOS: | ||
18 | return SPARC_BSD_EMUL; | ||
19 | case PER_SVR4: | ||
20 | return SPARC_SOL_EMUL; | ||
21 | default: | ||
22 | return NULL; | ||
23 | } | ||
24 | } | ||
25 | |||
26 | #endif /* __SPARC_NAMEI_H */ | ||
diff --git a/include/asm-sparc/obio.h b/include/asm-sparc/obio.h new file mode 100644 index 000000000000..62e1d77965f3 --- /dev/null +++ b/include/asm-sparc/obio.h | |||
@@ -0,0 +1,249 @@ | |||
1 | /* $Id: obio.h,v 1.4 1998/03/09 14:04:55 jj Exp $ | ||
2 | * obio.h: Some useful locations in 0xFXXXXXXXX PA obio space on sun4d. | ||
3 | * | ||
4 | * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz> | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_OBIO_H | ||
8 | #define _SPARC_OBIO_H | ||
9 | |||
10 | #include <asm/asi.h> | ||
11 | |||
12 | /* This weird monster likes to use the very upper parts of | ||
13 | 36bit PA for these things :) */ | ||
14 | |||
15 | /* CSR space (for each XDBUS) | ||
16 | * ------------------------------------------------------------------------ | ||
17 | * | 0xFE | DEVID | | XDBUS ID | | | ||
18 | * ------------------------------------------------------------------------ | ||
19 | * 35 28 27 20 19 10 9 8 7 0 | ||
20 | */ | ||
21 | |||
22 | #define CSR_BASE_ADDR 0xe0000000 | ||
23 | #define CSR_CPU_SHIFT (32 - 4 - 5) | ||
24 | #define CSR_XDBUS_SHIFT 8 | ||
25 | |||
26 | #define CSR_BASE(cpu) (((CSR_BASE_ADDR >> CSR_CPU_SHIFT) + cpu) << CSR_CPU_SHIFT) | ||
27 | |||
28 | /* ECSR space (not for each XDBUS) | ||
29 | * ------------------------------------------------------------------------ | ||
30 | * | 0xF | DEVID[7:1] | | | ||
31 | * ------------------------------------------------------------------------ | ||
32 | * 35 32 31 25 24 0 | ||
33 | */ | ||
34 | |||
35 | #define ECSR_BASE_ADDR 0x00000000 | ||
36 | #define ECSR_CPU_SHIFT (32 - 5) | ||
37 | #define ECSR_DEV_SHIFT (32 - 8) | ||
38 | |||
39 | #define ECSR_BASE(cpu) ((cpu) << ECSR_CPU_SHIFT) | ||
40 | #define ECSR_DEV_BASE(devid) ((devid) << ECSR_DEV_SHIFT) | ||
41 | |||
42 | /* Bus Watcher */ | ||
43 | #define BW_LOCAL_BASE 0xfff00000 | ||
44 | |||
45 | #define BW_CID 0x00000000 | ||
46 | #define BW_DBUS_CTRL 0x00000008 | ||
47 | #define BW_DBUS_DATA 0x00000010 | ||
48 | #define BW_CTRL 0x00001000 | ||
49 | #define BW_INTR_TABLE 0x00001040 | ||
50 | #define BW_INTR_TABLE_CLEAR 0x00001080 | ||
51 | #define BW_PRESCALER 0x000010c0 | ||
52 | #define BW_PTIMER_LIMIT 0x00002000 | ||
53 | #define BW_PTIMER_COUNTER2 0x00002004 | ||
54 | #define BW_PTIMER_NDLIMIT 0x00002008 | ||
55 | #define BW_PTIMER_CTRL 0x0000200c | ||
56 | #define BW_PTIMER_COUNTER 0x00002010 | ||
57 | #define BW_TIMER_LIMIT 0x00003000 | ||
58 | #define BW_TIMER_COUNTER2 0x00003004 | ||
59 | #define BW_TIMER_NDLIMIT 0x00003008 | ||
60 | #define BW_TIMER_CTRL 0x0000300c | ||
61 | #define BW_TIMER_COUNTER 0x00003010 | ||
62 | |||
63 | /* BW Control */ | ||
64 | #define BW_CTRL_USER_TIMER 0x00000004 /* Is User Timer Free run enabled */ | ||
65 | |||
66 | /* Boot Bus */ | ||
67 | #define BB_LOCAL_BASE 0xf0000000 | ||
68 | |||
69 | #define BB_STAT1 0x00100000 | ||
70 | #define BB_STAT2 0x00120000 | ||
71 | #define BB_STAT3 0x00140000 | ||
72 | #define BB_LEDS 0x002e0000 | ||
73 | |||
74 | /* Bits in BB_STAT2 */ | ||
75 | #define BB_STAT2_AC_INTR 0x04 /* Aiee! 5ms and power is gone... */ | ||
76 | #define BB_STAT2_TMP_INTR 0x10 /* My Penguins are burning. Are you able to smell it? */ | ||
77 | #define BB_STAT2_FAN_INTR 0x20 /* My fan refuses to work */ | ||
78 | #define BB_STAT2_PWR_INTR 0x40 /* On SC2000, one of the two ACs died. Ok, we go on... */ | ||
79 | #define BB_STAT2_MASK (BB_STAT2_AC_INTR|BB_STAT2_TMP_INTR|BB_STAT2_FAN_INTR|BB_STAT2_PWR_INTR) | ||
80 | |||
81 | /* Cache Controller */ | ||
82 | #define CC_BASE 0x1F00000 | ||
83 | #define CC_DATSTREAM 0x1F00000 /* Data stream register */ | ||
84 | #define CC_DATSIZE 0x1F0003F /* Size */ | ||
85 | #define CC_SRCSTREAM 0x1F00100 /* Source stream register */ | ||
86 | #define CC_DESSTREAM 0x1F00200 /* Destination stream register */ | ||
87 | #define CC_RMCOUNT 0x1F00300 /* Count of references and misses */ | ||
88 | #define CC_IPEN 0x1F00406 /* Pending Interrupts */ | ||
89 | #define CC_IMSK 0x1F00506 /* Interrupt Mask */ | ||
90 | #define CC_ICLR 0x1F00606 /* Clear pending Interrupts */ | ||
91 | #define CC_IGEN 0x1F00704 /* Generate Interrupt register */ | ||
92 | #define CC_STEST 0x1F00804 /* Internal self-test */ | ||
93 | #define CC_CREG 0x1F00A04 /* Control register */ | ||
94 | #define CC_SREG 0x1F00B00 /* Status register */ | ||
95 | #define CC_RREG 0x1F00C04 /* Reset register */ | ||
96 | #define CC_EREG 0x1F00E00 /* Error code register */ | ||
97 | #define CC_CID 0x1F00F04 /* Component ID */ | ||
98 | |||
99 | #ifndef __ASSEMBLY__ | ||
100 | |||
101 | extern __inline__ int bw_get_intr_mask(int sbus_level) | ||
102 | { | ||
103 | int mask; | ||
104 | |||
105 | __asm__ __volatile__ ("lduha [%1] %2, %0" : | ||
106 | "=r" (mask) : | ||
107 | "r" (BW_LOCAL_BASE + BW_INTR_TABLE + (sbus_level << 3)), | ||
108 | "i" (ASI_M_CTL)); | ||
109 | return mask; | ||
110 | } | ||
111 | |||
112 | extern __inline__ void bw_clear_intr_mask(int sbus_level, int mask) | ||
113 | { | ||
114 | __asm__ __volatile__ ("stha %0, [%1] %2" : : | ||
115 | "r" (mask), | ||
116 | "r" (BW_LOCAL_BASE + BW_INTR_TABLE_CLEAR + (sbus_level << 3)), | ||
117 | "i" (ASI_M_CTL)); | ||
118 | } | ||
119 | |||
120 | extern __inline__ unsigned bw_get_prof_limit(int cpu) | ||
121 | { | ||
122 | unsigned limit; | ||
123 | |||
124 | __asm__ __volatile__ ("lda [%1] %2, %0" : | ||
125 | "=r" (limit) : | ||
126 | "r" (CSR_BASE(cpu) + BW_PTIMER_LIMIT), | ||
127 | "i" (ASI_M_CTL)); | ||
128 | return limit; | ||
129 | } | ||
130 | |||
131 | extern __inline__ void bw_set_prof_limit(int cpu, unsigned limit) | ||
132 | { | ||
133 | __asm__ __volatile__ ("sta %0, [%1] %2" : : | ||
134 | "r" (limit), | ||
135 | "r" (CSR_BASE(cpu) + BW_PTIMER_LIMIT), | ||
136 | "i" (ASI_M_CTL)); | ||
137 | } | ||
138 | |||
139 | extern __inline__ unsigned bw_get_ctrl(int cpu) | ||
140 | { | ||
141 | unsigned ctrl; | ||
142 | |||
143 | __asm__ __volatile__ ("lda [%1] %2, %0" : | ||
144 | "=r" (ctrl) : | ||
145 | "r" (CSR_BASE(cpu) + BW_CTRL), | ||
146 | "i" (ASI_M_CTL)); | ||
147 | return ctrl; | ||
148 | } | ||
149 | |||
150 | extern __inline__ void bw_set_ctrl(int cpu, unsigned ctrl) | ||
151 | { | ||
152 | __asm__ __volatile__ ("sta %0, [%1] %2" : : | ||
153 | "r" (ctrl), | ||
154 | "r" (CSR_BASE(cpu) + BW_CTRL), | ||
155 | "i" (ASI_M_CTL)); | ||
156 | } | ||
157 | |||
158 | extern unsigned char cpu_leds[32]; | ||
159 | |||
160 | extern __inline__ void show_leds(int cpuid) | ||
161 | { | ||
162 | cpuid &= 0x1e; | ||
163 | __asm__ __volatile__ ("stba %0, [%1] %2" : : | ||
164 | "r" ((cpu_leds[cpuid] << 4) | cpu_leds[cpuid+1]), | ||
165 | "r" (ECSR_BASE(cpuid) | BB_LEDS), | ||
166 | "i" (ASI_M_CTL)); | ||
167 | } | ||
168 | |||
169 | extern __inline__ unsigned cc_get_ipen(void) | ||
170 | { | ||
171 | unsigned pending; | ||
172 | |||
173 | __asm__ __volatile__ ("lduha [%1] %2, %0" : | ||
174 | "=r" (pending) : | ||
175 | "r" (CC_IPEN), | ||
176 | "i" (ASI_M_MXCC)); | ||
177 | return pending; | ||
178 | } | ||
179 | |||
180 | extern __inline__ void cc_set_iclr(unsigned clear) | ||
181 | { | ||
182 | __asm__ __volatile__ ("stha %0, [%1] %2" : : | ||
183 | "r" (clear), | ||
184 | "r" (CC_ICLR), | ||
185 | "i" (ASI_M_MXCC)); | ||
186 | } | ||
187 | |||
188 | extern __inline__ unsigned cc_get_imsk(void) | ||
189 | { | ||
190 | unsigned mask; | ||
191 | |||
192 | __asm__ __volatile__ ("lduha [%1] %2, %0" : | ||
193 | "=r" (mask) : | ||
194 | "r" (CC_IMSK), | ||
195 | "i" (ASI_M_MXCC)); | ||
196 | return mask; | ||
197 | } | ||
198 | |||
199 | extern __inline__ void cc_set_imsk(unsigned mask) | ||
200 | { | ||
201 | __asm__ __volatile__ ("stha %0, [%1] %2" : : | ||
202 | "r" (mask), | ||
203 | "r" (CC_IMSK), | ||
204 | "i" (ASI_M_MXCC)); | ||
205 | } | ||
206 | |||
207 | extern __inline__ unsigned cc_get_imsk_other(int cpuid) | ||
208 | { | ||
209 | unsigned mask; | ||
210 | |||
211 | __asm__ __volatile__ ("lduha [%1] %2, %0" : | ||
212 | "=r" (mask) : | ||
213 | "r" (ECSR_BASE(cpuid) | CC_IMSK), | ||
214 | "i" (ASI_M_CTL)); | ||
215 | return mask; | ||
216 | } | ||
217 | |||
218 | extern __inline__ void cc_set_imsk_other(int cpuid, unsigned mask) | ||
219 | { | ||
220 | __asm__ __volatile__ ("stha %0, [%1] %2" : : | ||
221 | "r" (mask), | ||
222 | "r" (ECSR_BASE(cpuid) | CC_IMSK), | ||
223 | "i" (ASI_M_CTL)); | ||
224 | } | ||
225 | |||
226 | extern __inline__ void cc_set_igen(unsigned gen) | ||
227 | { | ||
228 | __asm__ __volatile__ ("sta %0, [%1] %2" : : | ||
229 | "r" (gen), | ||
230 | "r" (CC_IGEN), | ||
231 | "i" (ASI_M_MXCC)); | ||
232 | } | ||
233 | |||
234 | /* +-------+-------------+-----------+------------------------------------+ | ||
235 | * | bcast | devid | sid | levels mask | | ||
236 | * +-------+-------------+-----------+------------------------------------+ | ||
237 | * 31 30 23 22 15 14 0 | ||
238 | */ | ||
239 | #define IGEN_MESSAGE(bcast, devid, sid, levels) \ | ||
240 | (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels)) | ||
241 | |||
242 | extern __inline__ void sun4d_send_ipi(int cpu, int level) | ||
243 | { | ||
244 | cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1))); | ||
245 | } | ||
246 | |||
247 | #endif /* !__ASSEMBLY__ */ | ||
248 | |||
249 | #endif /* !(_SPARC_OBIO_H) */ | ||
diff --git a/include/asm-sparc/openprom.h b/include/asm-sparc/openprom.h new file mode 100644 index 000000000000..12929a20f536 --- /dev/null +++ b/include/asm-sparc/openprom.h | |||
@@ -0,0 +1,258 @@ | |||
1 | /* $Id: openprom.h,v 1.24 2000/06/04 06:23:53 anton Exp $ */ | ||
2 | #ifndef __SPARC_OPENPROM_H | ||
3 | #define __SPARC_OPENPROM_H | ||
4 | |||
5 | /* openprom.h: Prom structures and defines for access to the OPENBOOT | ||
6 | * prom routines and data areas. | ||
7 | * | ||
8 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
9 | */ | ||
10 | |||
11 | #include <asm/vaddrs.h> | ||
12 | |||
13 | /* Empirical constants... */ | ||
14 | #define LINUX_OPPROM_MAGIC 0x10010407 | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | /* V0 prom device operations. */ | ||
18 | struct linux_dev_v0_funcs { | ||
19 | int (*v0_devopen)(char *device_str); | ||
20 | int (*v0_devclose)(int dev_desc); | ||
21 | int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf); | ||
22 | int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf); | ||
23 | int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf); | ||
24 | int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf); | ||
25 | int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf); | ||
26 | int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf); | ||
27 | int (*v0_seekdev)(int dev_desc, long logical_offst, int from); | ||
28 | }; | ||
29 | |||
30 | /* V2 and later prom device operations. */ | ||
31 | struct linux_dev_v2_funcs { | ||
32 | int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */ | ||
33 | char * (*v2_dumb_mem_alloc)(char *va, unsigned sz); | ||
34 | void (*v2_dumb_mem_free)(char *va, unsigned sz); | ||
35 | |||
36 | /* To map devices into virtual I/O space. */ | ||
37 | char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz); | ||
38 | void (*v2_dumb_munmap)(char *virta, unsigned size); | ||
39 | |||
40 | int (*v2_dev_open)(char *devpath); | ||
41 | void (*v2_dev_close)(int d); | ||
42 | int (*v2_dev_read)(int d, char *buf, int nbytes); | ||
43 | int (*v2_dev_write)(int d, char *buf, int nbytes); | ||
44 | int (*v2_dev_seek)(int d, int hi, int lo); | ||
45 | |||
46 | /* Never issued (multistage load support) */ | ||
47 | void (*v2_wheee2)(void); | ||
48 | void (*v2_wheee3)(void); | ||
49 | }; | ||
50 | |||
51 | struct linux_mlist_v0 { | ||
52 | struct linux_mlist_v0 *theres_more; | ||
53 | char *start_adr; | ||
54 | unsigned num_bytes; | ||
55 | }; | ||
56 | |||
57 | struct linux_mem_v0 { | ||
58 | struct linux_mlist_v0 **v0_totphys; | ||
59 | struct linux_mlist_v0 **v0_prommap; | ||
60 | struct linux_mlist_v0 **v0_available; /* What we can use */ | ||
61 | }; | ||
62 | |||
63 | /* Arguments sent to the kernel from the boot prompt. */ | ||
64 | struct linux_arguments_v0 { | ||
65 | char *argv[8]; | ||
66 | char args[100]; | ||
67 | char boot_dev[2]; | ||
68 | int boot_dev_ctrl; | ||
69 | int boot_dev_unit; | ||
70 | int dev_partition; | ||
71 | char *kernel_file_name; | ||
72 | void *aieee1; /* XXX */ | ||
73 | }; | ||
74 | |||
75 | /* V2 and up boot things. */ | ||
76 | struct linux_bootargs_v2 { | ||
77 | char **bootpath; | ||
78 | char **bootargs; | ||
79 | int *fd_stdin; | ||
80 | int *fd_stdout; | ||
81 | }; | ||
82 | |||
83 | /* The top level PROM vector. */ | ||
84 | struct linux_romvec { | ||
85 | /* Version numbers. */ | ||
86 | unsigned int pv_magic_cookie; | ||
87 | unsigned int pv_romvers; | ||
88 | unsigned int pv_plugin_revision; | ||
89 | unsigned int pv_printrev; | ||
90 | |||
91 | /* Version 0 memory descriptors. */ | ||
92 | struct linux_mem_v0 pv_v0mem; | ||
93 | |||
94 | /* Node operations. */ | ||
95 | struct linux_nodeops *pv_nodeops; | ||
96 | |||
97 | char **pv_bootstr; | ||
98 | struct linux_dev_v0_funcs pv_v0devops; | ||
99 | |||
100 | char *pv_stdin; | ||
101 | char *pv_stdout; | ||
102 | #define PROMDEV_KBD 0 /* input from keyboard */ | ||
103 | #define PROMDEV_SCREEN 0 /* output to screen */ | ||
104 | #define PROMDEV_TTYA 1 /* in/out to ttya */ | ||
105 | #define PROMDEV_TTYB 2 /* in/out to ttyb */ | ||
106 | |||
107 | /* Blocking getchar/putchar. NOT REENTRANT! (grr) */ | ||
108 | int (*pv_getchar)(void); | ||
109 | void (*pv_putchar)(int ch); | ||
110 | |||
111 | /* Non-blocking variants. */ | ||
112 | int (*pv_nbgetchar)(void); | ||
113 | int (*pv_nbputchar)(int ch); | ||
114 | |||
115 | void (*pv_putstr)(char *str, int len); | ||
116 | |||
117 | /* Miscellany. */ | ||
118 | void (*pv_reboot)(char *bootstr); | ||
119 | void (*pv_printf)(__const__ char *fmt, ...); | ||
120 | void (*pv_abort)(void); | ||
121 | __volatile__ int *pv_ticks; | ||
122 | void (*pv_halt)(void); | ||
123 | void (**pv_synchook)(void); | ||
124 | |||
125 | /* Evaluate a forth string, not different proto for V0 and V2->up. */ | ||
126 | union { | ||
127 | void (*v0_eval)(int len, char *str); | ||
128 | void (*v2_eval)(char *str); | ||
129 | } pv_fortheval; | ||
130 | |||
131 | struct linux_arguments_v0 **pv_v0bootargs; | ||
132 | |||
133 | /* Get ether address. */ | ||
134 | unsigned int (*pv_enaddr)(int d, char *enaddr); | ||
135 | |||
136 | struct linux_bootargs_v2 pv_v2bootargs; | ||
137 | struct linux_dev_v2_funcs pv_v2devops; | ||
138 | |||
139 | int filler[15]; | ||
140 | |||
141 | /* This one is sun4c/sun4 only. */ | ||
142 | void (*pv_setctxt)(int ctxt, char *va, int pmeg); | ||
143 | |||
144 | /* Prom version 3 Multiprocessor routines. This stuff is crazy. | ||
145 | * No joke. Calling these when there is only one cpu probably | ||
146 | * crashes the machine, have to test this. :-) | ||
147 | */ | ||
148 | |||
149 | /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context | ||
150 | * 'thiscontext' executing at address 'prog_counter' | ||
151 | */ | ||
152 | int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr, | ||
153 | int thiscontext, char *prog_counter); | ||
154 | |||
155 | /* v3_cpustop() will cause cpu 'whichcpu' to stop executing | ||
156 | * until a resume cpu call is made. | ||
157 | */ | ||
158 | int (*v3_cpustop)(unsigned int whichcpu); | ||
159 | |||
160 | /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or | ||
161 | * resume cpu call is made. | ||
162 | */ | ||
163 | int (*v3_cpuidle)(unsigned int whichcpu); | ||
164 | |||
165 | /* v3_cpuresume() will resume processor 'whichcpu' executing | ||
166 | * starting with whatever 'pc' and 'npc' were left at the | ||
167 | * last 'idle' or 'stop' call. | ||
168 | */ | ||
169 | int (*v3_cpuresume)(unsigned int whichcpu); | ||
170 | }; | ||
171 | |||
172 | /* Routines for traversing the prom device tree. */ | ||
173 | struct linux_nodeops { | ||
174 | int (*no_nextnode)(int node); | ||
175 | int (*no_child)(int node); | ||
176 | int (*no_proplen)(int node, char *name); | ||
177 | int (*no_getprop)(int node, char *name, char *val); | ||
178 | int (*no_setprop)(int node, char *name, char *val, int len); | ||
179 | char * (*no_nextprop)(int node, char *name); | ||
180 | }; | ||
181 | |||
182 | /* More fun PROM structures for device probing. */ | ||
183 | #define PROMREG_MAX 16 | ||
184 | #define PROMVADDR_MAX 16 | ||
185 | #define PROMINTR_MAX 15 | ||
186 | |||
187 | struct linux_prom_registers { | ||
188 | unsigned int which_io; /* is this in OBIO space? */ | ||
189 | unsigned int phys_addr; /* The physical address of this register */ | ||
190 | unsigned int reg_size; /* How many bytes does this register take up? */ | ||
191 | }; | ||
192 | |||
193 | struct linux_prom_irqs { | ||
194 | int pri; /* IRQ priority */ | ||
195 | int vector; /* This is foobar, what does it do? */ | ||
196 | }; | ||
197 | |||
198 | /* Element of the "ranges" vector */ | ||
199 | struct linux_prom_ranges { | ||
200 | unsigned int ot_child_space; | ||
201 | unsigned int ot_child_base; /* Bus feels this */ | ||
202 | unsigned int ot_parent_space; | ||
203 | unsigned int ot_parent_base; /* CPU looks from here */ | ||
204 | unsigned int or_size; | ||
205 | }; | ||
206 | |||
207 | /* Ranges and reg properties are a bit different for PCI. */ | ||
208 | struct linux_prom_pci_registers { | ||
209 | /* | ||
210 | * We don't know what information this field contain. | ||
211 | * We guess, PCI device function is in bits 15:8 | ||
212 | * So, ... | ||
213 | */ | ||
214 | unsigned int which_io; /* Let it be which_io */ | ||
215 | |||
216 | unsigned int phys_hi; | ||
217 | unsigned int phys_lo; | ||
218 | |||
219 | unsigned int size_hi; | ||
220 | unsigned int size_lo; | ||
221 | }; | ||
222 | |||
223 | struct linux_prom_pci_ranges { | ||
224 | unsigned int child_phys_hi; /* Only certain bits are encoded here. */ | ||
225 | unsigned int child_phys_mid; | ||
226 | unsigned int child_phys_lo; | ||
227 | |||
228 | unsigned int parent_phys_hi; | ||
229 | unsigned int parent_phys_lo; | ||
230 | |||
231 | unsigned int size_hi; | ||
232 | unsigned int size_lo; | ||
233 | }; | ||
234 | |||
235 | struct linux_prom_pci_assigned_addresses { | ||
236 | unsigned int which_io; | ||
237 | |||
238 | unsigned int phys_hi; | ||
239 | unsigned int phys_lo; | ||
240 | |||
241 | unsigned int size_hi; | ||
242 | unsigned int size_lo; | ||
243 | }; | ||
244 | |||
245 | struct linux_prom_ebus_ranges { | ||
246 | unsigned int child_phys_hi; | ||
247 | unsigned int child_phys_lo; | ||
248 | |||
249 | unsigned int parent_phys_hi; | ||
250 | unsigned int parent_phys_mid; | ||
251 | unsigned int parent_phys_lo; | ||
252 | |||
253 | unsigned int size; | ||
254 | }; | ||
255 | |||
256 | #endif /* !(__ASSEMBLY__) */ | ||
257 | |||
258 | #endif /* !(__SPARC_OPENPROM_H) */ | ||
diff --git a/include/asm-sparc/openpromio.h b/include/asm-sparc/openpromio.h new file mode 100644 index 000000000000..917fb8e9c633 --- /dev/null +++ b/include/asm-sparc/openpromio.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef _SPARC_OPENPROMIO_H | ||
2 | #define _SPARC_OPENPROMIO_H | ||
3 | |||
4 | #include <linux/compiler.h> | ||
5 | #include <linux/ioctl.h> | ||
6 | #include <linux/types.h> | ||
7 | |||
8 | /* | ||
9 | * SunOS and Solaris /dev/openprom definitions. The ioctl values | ||
10 | * were chosen to be exactly equal to the SunOS equivalents. | ||
11 | */ | ||
12 | |||
13 | struct openpromio | ||
14 | { | ||
15 | u_int oprom_size; /* Actual size of the oprom_array. */ | ||
16 | char oprom_array[1]; /* Holds property names and values. */ | ||
17 | }; | ||
18 | |||
19 | #define OPROMMAXPARAM 4096 /* Maximum size of oprom_array. */ | ||
20 | |||
21 | #define OPROMGETOPT 0x20004F01 | ||
22 | #define OPROMSETOPT 0x20004F02 | ||
23 | #define OPROMNXTOPT 0x20004F03 | ||
24 | #define OPROMSETOPT2 0x20004F04 | ||
25 | #define OPROMNEXT 0x20004F05 | ||
26 | #define OPROMCHILD 0x20004F06 | ||
27 | #define OPROMGETPROP 0x20004F07 | ||
28 | #define OPROMNXTPROP 0x20004F08 | ||
29 | #define OPROMU2P 0x20004F09 | ||
30 | #define OPROMGETCONS 0x20004F0A | ||
31 | #define OPROMGETFBNAME 0x20004F0B | ||
32 | #define OPROMGETBOOTARGS 0x20004F0C | ||
33 | /* Linux extensions */ /* Arguments in oprom_array: */ | ||
34 | #define OPROMSETCUR 0x20004FF0 /* int node - Sets current node */ | ||
35 | #define OPROMPCI2NODE 0x20004FF1 /* int pci_bus, pci_devfn - Sets current node to PCI device's node */ | ||
36 | #define OPROMPATH2NODE 0x20004FF2 /* char path[] - Set current node from fully qualified PROM path */ | ||
37 | |||
38 | /* | ||
39 | * Return values from OPROMGETCONS: | ||
40 | */ | ||
41 | |||
42 | #define OPROMCONS_NOT_WSCONS 0 | ||
43 | #define OPROMCONS_STDIN_IS_KBD 0x1 /* stdin device is kbd */ | ||
44 | #define OPROMCONS_STDOUT_IS_FB 0x2 /* stdout is a framebuffer */ | ||
45 | #define OPROMCONS_OPENPROM 0x4 /* supports openboot */ | ||
46 | |||
47 | |||
48 | /* | ||
49 | * NetBSD/OpenBSD /dev/openprom definitions. | ||
50 | */ | ||
51 | |||
52 | struct opiocdesc | ||
53 | { | ||
54 | int op_nodeid; /* PROM Node ID (value-result) */ | ||
55 | int op_namelen; /* Length of op_name. */ | ||
56 | char __user *op_name; /* Pointer to the property name. */ | ||
57 | int op_buflen; /* Length of op_buf (value-result) */ | ||
58 | char __user *op_buf; /* Pointer to buffer. */ | ||
59 | }; | ||
60 | |||
61 | #define OPIOCGET _IOWR('O', 1, struct opiocdesc) | ||
62 | #define OPIOCSET _IOW('O', 2, struct opiocdesc) | ||
63 | #define OPIOCNEXTPROP _IOWR('O', 3, struct opiocdesc) | ||
64 | #define OPIOCGETOPTNODE _IOR('O', 4, int) | ||
65 | #define OPIOCGETNEXT _IOWR('O', 5, int) | ||
66 | #define OPIOCGETCHILD _IOWR('O', 6, int) | ||
67 | |||
68 | #endif /* _SPARC_OPENPROMIO_H */ | ||
69 | |||
diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h new file mode 100644 index 000000000000..95944556d8b6 --- /dev/null +++ b/include/asm-sparc/oplib.h | |||
@@ -0,0 +1,317 @@ | |||
1 | /* $Id: oplib.h,v 1.23 2001/12/21 00:54:31 davem Exp $ | ||
2 | * oplib.h: Describes the interface and available routines in the | ||
3 | * Linux Prom library. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef __SPARC_OPLIB_H | ||
9 | #define __SPARC_OPLIB_H | ||
10 | |||
11 | #include <asm/openprom.h> | ||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/compiler.h> | ||
14 | |||
15 | /* The master romvec pointer... */ | ||
16 | extern struct linux_romvec *romvec; | ||
17 | |||
18 | /* Enumeration to describe the prom major version we have detected. */ | ||
19 | enum prom_major_version { | ||
20 | PROM_V0, /* Original sun4c V0 prom */ | ||
21 | PROM_V2, /* sun4c and early sun4m V2 prom */ | ||
22 | PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */ | ||
23 | PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */ | ||
24 | PROM_AP1000, /* actually no prom at all */ | ||
25 | PROM_SUN4, /* Old sun4 proms are totally different, but we'll shoehorn it to make it fit */ | ||
26 | }; | ||
27 | |||
28 | extern enum prom_major_version prom_vers; | ||
29 | /* Revision, and firmware revision. */ | ||
30 | extern unsigned int prom_rev, prom_prev; | ||
31 | |||
32 | /* Root node of the prom device tree, this stays constant after | ||
33 | * initialization is complete. | ||
34 | */ | ||
35 | extern int prom_root_node; | ||
36 | |||
37 | /* PROM stdin and stdout */ | ||
38 | extern int prom_stdin, prom_stdout; | ||
39 | |||
40 | /* Pointer to prom structure containing the device tree traversal | ||
41 | * and usage utility functions. Only prom-lib should use these, | ||
42 | * users use the interface defined by the library only! | ||
43 | */ | ||
44 | extern struct linux_nodeops *prom_nodeops; | ||
45 | |||
46 | /* The functions... */ | ||
47 | |||
48 | /* You must call prom_init() before using any of the library services, | ||
49 | * preferably as early as possible. Pass it the romvec pointer. | ||
50 | */ | ||
51 | extern void prom_init(struct linux_romvec *rom_ptr); | ||
52 | |||
53 | /* Boot argument acquisition, returns the boot command line string. */ | ||
54 | extern char *prom_getbootargs(void); | ||
55 | |||
56 | /* Device utilities. */ | ||
57 | |||
58 | /* Map and unmap devices in IO space at virtual addresses. Note that the | ||
59 | * virtual address you pass is a request and the prom may put your mappings | ||
60 | * somewhere else, so check your return value as that is where your new | ||
61 | * mappings really are! | ||
62 | * | ||
63 | * Another note, these are only available on V2 or higher proms! | ||
64 | */ | ||
65 | extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); | ||
66 | extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); | ||
67 | |||
68 | /* Device operations. */ | ||
69 | |||
70 | /* Open the device described by the passed string. Note, that the format | ||
71 | * of the string is different on V0 vs. V2->higher proms. The caller must | ||
72 | * know what he/she is doing! Returns the device descriptor, an int. | ||
73 | */ | ||
74 | extern int prom_devopen(char *device_string); | ||
75 | |||
76 | /* Close a previously opened device described by the passed integer | ||
77 | * descriptor. | ||
78 | */ | ||
79 | extern int prom_devclose(int device_handle); | ||
80 | |||
81 | /* Do a seek operation on the device described by the passed integer | ||
82 | * descriptor. | ||
83 | */ | ||
84 | extern void prom_seek(int device_handle, unsigned int seek_hival, | ||
85 | unsigned int seek_lowval); | ||
86 | |||
87 | /* Machine memory configuration routine. */ | ||
88 | |||
89 | /* This function returns a V0 format memory descriptor table, it has three | ||
90 | * entries. One for the total amount of physical ram on the machine, one | ||
91 | * for the amount of physical ram available, and one describing the virtual | ||
92 | * areas which are allocated by the prom. So, in a sense the physical | ||
93 | * available is a calculation of the total physical minus the physical mapped | ||
94 | * by the prom with virtual mappings. | ||
95 | * | ||
96 | * These lists are returned pre-sorted, this should make your life easier | ||
97 | * since the prom itself is way too lazy to do such nice things. | ||
98 | */ | ||
99 | extern struct linux_mem_v0 *prom_meminfo(void); | ||
100 | |||
101 | /* Miscellaneous routines, don't really fit in any category per se. */ | ||
102 | |||
103 | /* Reboot the machine with the command line passed. */ | ||
104 | extern void prom_reboot(char *boot_command); | ||
105 | |||
106 | /* Evaluate the forth string passed. */ | ||
107 | extern void prom_feval(char *forth_string); | ||
108 | |||
109 | /* Enter the prom, with possibility of continuation with the 'go' | ||
110 | * command in newer proms. | ||
111 | */ | ||
112 | extern void prom_cmdline(void); | ||
113 | |||
114 | /* Enter the prom, with no chance of continuation for the stand-alone | ||
115 | * which calls this. | ||
116 | */ | ||
117 | extern void prom_halt(void) __attribute__ ((noreturn)); | ||
118 | |||
119 | /* Set the PROM 'sync' callback function to the passed function pointer. | ||
120 | * When the user gives the 'sync' command at the prom prompt while the | ||
121 | * kernel is still active, the prom will call this routine. | ||
122 | * | ||
123 | * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX | ||
124 | */ | ||
125 | typedef void (*sync_func_t)(void); | ||
126 | extern void prom_setsync(sync_func_t func_ptr); | ||
127 | |||
128 | /* Acquire the IDPROM of the root node in the prom device tree. This | ||
129 | * gets passed a buffer where you would like it stuffed. The return value | ||
130 | * is the format type of this idprom or 0xff on error. | ||
131 | */ | ||
132 | extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); | ||
133 | |||
134 | /* Get the prom major version. */ | ||
135 | extern int prom_version(void); | ||
136 | |||
137 | /* Get the prom plugin revision. */ | ||
138 | extern int prom_getrev(void); | ||
139 | |||
140 | /* Get the prom firmware revision. */ | ||
141 | extern int prom_getprev(void); | ||
142 | |||
143 | /* Character operations to/from the console.... */ | ||
144 | |||
145 | /* Non-blocking get character from console. */ | ||
146 | extern int prom_nbgetchar(void); | ||
147 | |||
148 | /* Non-blocking put character to console. */ | ||
149 | extern int prom_nbputchar(char character); | ||
150 | |||
151 | /* Blocking get character from console. */ | ||
152 | extern char prom_getchar(void); | ||
153 | |||
154 | /* Blocking put character to console. */ | ||
155 | extern void prom_putchar(char character); | ||
156 | |||
157 | /* Prom's internal routines, don't use in kernel/boot code. */ | ||
158 | extern void prom_printf(char *fmt, ...); | ||
159 | extern void prom_write(const char *buf, unsigned int len); | ||
160 | |||
161 | /* Query for input device type */ | ||
162 | |||
163 | enum prom_input_device { | ||
164 | PROMDEV_IKBD, /* input from keyboard */ | ||
165 | PROMDEV_ITTYA, /* input from ttya */ | ||
166 | PROMDEV_ITTYB, /* input from ttyb */ | ||
167 | PROMDEV_I_UNK, | ||
168 | }; | ||
169 | |||
170 | extern enum prom_input_device prom_query_input_device(void); | ||
171 | |||
172 | /* Query for output device type */ | ||
173 | |||
174 | enum prom_output_device { | ||
175 | PROMDEV_OSCREEN, /* to screen */ | ||
176 | PROMDEV_OTTYA, /* to ttya */ | ||
177 | PROMDEV_OTTYB, /* to ttyb */ | ||
178 | PROMDEV_O_UNK, | ||
179 | }; | ||
180 | |||
181 | extern enum prom_output_device prom_query_output_device(void); | ||
182 | |||
183 | /* Multiprocessor operations... */ | ||
184 | |||
185 | /* Start the CPU with the given device tree node, context table, and context | ||
186 | * at the passed program counter. | ||
187 | */ | ||
188 | extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, | ||
189 | int context, char *program_counter); | ||
190 | |||
191 | /* Stop the CPU with the passed device tree node. */ | ||
192 | extern int prom_stopcpu(int cpunode); | ||
193 | |||
194 | /* Idle the CPU with the passed device tree node. */ | ||
195 | extern int prom_idlecpu(int cpunode); | ||
196 | |||
197 | /* Re-Start the CPU with the passed device tree node. */ | ||
198 | extern int prom_restartcpu(int cpunode); | ||
199 | |||
200 | /* PROM memory allocation facilities... */ | ||
201 | |||
202 | /* Allocated at possibly the given virtual address a chunk of the | ||
203 | * indicated size. | ||
204 | */ | ||
205 | extern char *prom_alloc(char *virt_hint, unsigned int size); | ||
206 | |||
207 | /* Free a previously allocated chunk. */ | ||
208 | extern void prom_free(char *virt_addr, unsigned int size); | ||
209 | |||
210 | /* Sun4/sun4c specific memory-management startup hook. */ | ||
211 | |||
212 | /* Map the passed segment in the given context at the passed | ||
213 | * virtual address. | ||
214 | */ | ||
215 | extern void prom_putsegment(int context, unsigned long virt_addr, | ||
216 | int physical_segment); | ||
217 | |||
218 | |||
219 | /* PROM device tree traversal functions... */ | ||
220 | |||
221 | #ifdef PROMLIB_INTERNAL | ||
222 | |||
223 | /* Internal version of prom_getchild. */ | ||
224 | extern int __prom_getchild(int parent_node); | ||
225 | |||
226 | /* Internal version of prom_getsibling. */ | ||
227 | extern int __prom_getsibling(int node); | ||
228 | |||
229 | #endif | ||
230 | |||
231 | |||
232 | /* Get the child node of the given node, or zero if no child exists. */ | ||
233 | extern int prom_getchild(int parent_node); | ||
234 | |||
235 | /* Get the next sibling node of the given node, or zero if no further | ||
236 | * siblings exist. | ||
237 | */ | ||
238 | extern int prom_getsibling(int node); | ||
239 | |||
240 | /* Get the length, at the passed node, of the given property type. | ||
241 | * Returns -1 on error (ie. no such property at this node). | ||
242 | */ | ||
243 | extern int prom_getproplen(int thisnode, char *property); | ||
244 | |||
245 | /* Fetch the requested property using the given buffer. Returns | ||
246 | * the number of bytes the prom put into your buffer or -1 on error. | ||
247 | */ | ||
248 | extern int __must_check prom_getproperty(int thisnode, char *property, | ||
249 | char *prop_buffer, int propbuf_size); | ||
250 | |||
251 | /* Acquire an integer property. */ | ||
252 | extern int prom_getint(int node, char *property); | ||
253 | |||
254 | /* Acquire an integer property, with a default value. */ | ||
255 | extern int prom_getintdefault(int node, char *property, int defval); | ||
256 | |||
257 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ | ||
258 | extern int prom_getbool(int node, char *prop); | ||
259 | |||
260 | /* Acquire a string property, null string on error. */ | ||
261 | extern void prom_getstring(int node, char *prop, char *buf, int bufsize); | ||
262 | |||
263 | /* Does the passed node have the given "name"? YES=1 NO=0 */ | ||
264 | extern int prom_nodematch(int thisnode, char *name); | ||
265 | |||
266 | /* Puts in buffer a prom name in the form name@x,y or name (x for which_io | ||
267 | * and y for first regs phys address | ||
268 | */ | ||
269 | extern int prom_getname(int node, char *buf, int buflen); | ||
270 | |||
271 | /* Search all siblings starting at the passed node for "name" matching | ||
272 | * the given string. Returns the node on success, zero on failure. | ||
273 | */ | ||
274 | extern int prom_searchsiblings(int node_start, char *name); | ||
275 | |||
276 | /* Return the first property type, as a string, for the given node. | ||
277 | * Returns a null string on error. | ||
278 | */ | ||
279 | extern char *prom_firstprop(int node, char *buffer); | ||
280 | |||
281 | /* Returns the next property after the passed property for the given | ||
282 | * node. Returns null string on failure. | ||
283 | */ | ||
284 | extern char *prom_nextprop(int node, char *prev_property, char *buffer); | ||
285 | |||
286 | /* Returns phandle of the path specified */ | ||
287 | extern int prom_finddevice(char *name); | ||
288 | |||
289 | /* Returns 1 if the specified node has given property. */ | ||
290 | extern int prom_node_has_property(int node, char *property); | ||
291 | |||
292 | /* Set the indicated property at the given node with the passed value. | ||
293 | * Returns the number of bytes of your value that the prom took. | ||
294 | */ | ||
295 | extern int prom_setprop(int node, char *prop_name, char *prop_value, | ||
296 | int value_size); | ||
297 | |||
298 | extern int prom_pathtoinode(char *path); | ||
299 | extern int prom_inst2pkg(int); | ||
300 | |||
301 | /* Dorking with Bus ranges... */ | ||
302 | |||
303 | /* Apply promlib probes OBIO ranges to registers. */ | ||
304 | extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); | ||
305 | |||
306 | /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ | ||
307 | extern void prom_apply_generic_ranges(int node, int parent, | ||
308 | struct linux_prom_registers *sbusregs, int nregs); | ||
309 | |||
310 | /* CPU probing helpers. */ | ||
311 | int cpu_find_by_instance(int instance, int *prom_node, int *mid); | ||
312 | int cpu_find_by_mid(int mid, int *prom_node); | ||
313 | int cpu_get_hwmid(int prom_node); | ||
314 | |||
315 | extern spinlock_t prom_lock; | ||
316 | |||
317 | #endif /* !(__SPARC_OPLIB_H) */ | ||
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h new file mode 100644 index 000000000000..383060e90d94 --- /dev/null +++ b/include/asm-sparc/page.h | |||
@@ -0,0 +1,181 @@ | |||
1 | /* $Id: page.h,v 1.55 2000/10/30 21:01:41 davem Exp $ | ||
2 | * page.h: Various defines and such for MMU operations on the Sparc for | ||
3 | * the Linux kernel. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_PAGE_H | ||
9 | #define _SPARC_PAGE_H | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #ifdef CONFIG_SUN4 | ||
13 | #define PAGE_SHIFT 13 | ||
14 | #else | ||
15 | #define PAGE_SHIFT 12 | ||
16 | #endif | ||
17 | #ifndef __ASSEMBLY__ | ||
18 | /* I have my suspicions... -DaveM */ | ||
19 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
20 | #else | ||
21 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
22 | #endif | ||
23 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
24 | |||
25 | #ifdef __KERNEL__ | ||
26 | |||
27 | #include <asm/btfixup.h> | ||
28 | |||
29 | #ifndef __ASSEMBLY__ | ||
30 | |||
31 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | ||
32 | #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) | ||
33 | #define clear_user_page(addr, vaddr, page) \ | ||
34 | do { clear_page(addr); \ | ||
35 | sparc_flush_page_to_ram(page); \ | ||
36 | } while (0) | ||
37 | #define copy_user_page(to, from, vaddr, page) \ | ||
38 | do { copy_page(to, from); \ | ||
39 | sparc_flush_page_to_ram(page); \ | ||
40 | } while (0) | ||
41 | |||
42 | /* The following structure is used to hold the physical | ||
43 | * memory configuration of the machine. This is filled in | ||
44 | * probe_memory() and is later used by mem_init() to set up | ||
45 | * mem_map[]. We statically allocate SPARC_PHYS_BANKS of | ||
46 | * these structs, this is arbitrary. The entry after the | ||
47 | * last valid one has num_bytes==0. | ||
48 | */ | ||
49 | |||
50 | struct sparc_phys_banks { | ||
51 | unsigned long base_addr; | ||
52 | unsigned long num_bytes; | ||
53 | }; | ||
54 | |||
55 | #define SPARC_PHYS_BANKS 32 | ||
56 | |||
57 | extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1]; | ||
58 | |||
59 | /* Cache alias structure. Entry is valid if context != -1. */ | ||
60 | struct cache_palias { | ||
61 | unsigned long vaddr; | ||
62 | int context; | ||
63 | }; | ||
64 | |||
65 | extern struct cache_palias *sparc_aliases; | ||
66 | |||
67 | /* passing structs on the Sparc slow us down tremendously... */ | ||
68 | |||
69 | /* #define STRICT_MM_TYPECHECKS */ | ||
70 | |||
71 | #ifdef STRICT_MM_TYPECHECKS | ||
72 | /* | ||
73 | * These are used to make use of C type-checking.. | ||
74 | */ | ||
75 | typedef struct { unsigned long pte; } pte_t; | ||
76 | typedef struct { unsigned long iopte; } iopte_t; | ||
77 | typedef struct { unsigned long pmdv[16]; } pmd_t; | ||
78 | typedef struct { unsigned long pgd; } pgd_t; | ||
79 | typedef struct { unsigned long ctxd; } ctxd_t; | ||
80 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
81 | typedef struct { unsigned long iopgprot; } iopgprot_t; | ||
82 | |||
83 | #define pte_val(x) ((x).pte) | ||
84 | #define iopte_val(x) ((x).iopte) | ||
85 | #define pmd_val(x) ((x).pmdv[0]) | ||
86 | #define pgd_val(x) ((x).pgd) | ||
87 | #define ctxd_val(x) ((x).ctxd) | ||
88 | #define pgprot_val(x) ((x).pgprot) | ||
89 | #define iopgprot_val(x) ((x).iopgprot) | ||
90 | |||
91 | #define __pte(x) ((pte_t) { (x) } ) | ||
92 | #define __iopte(x) ((iopte_t) { (x) } ) | ||
93 | /* #define __pmd(x) ((pmd_t) { (x) } ) */ /* XXX procedure with loop */ | ||
94 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
95 | #define __ctxd(x) ((ctxd_t) { (x) } ) | ||
96 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
97 | #define __iopgprot(x) ((iopgprot_t) { (x) } ) | ||
98 | |||
99 | #else | ||
100 | /* | ||
101 | * .. while these make it easier on the compiler | ||
102 | */ | ||
103 | typedef unsigned long pte_t; | ||
104 | typedef unsigned long iopte_t; | ||
105 | typedef struct { unsigned long pmdv[16]; } pmd_t; | ||
106 | typedef unsigned long pgd_t; | ||
107 | typedef unsigned long ctxd_t; | ||
108 | typedef unsigned long pgprot_t; | ||
109 | typedef unsigned long iopgprot_t; | ||
110 | |||
111 | #define pte_val(x) (x) | ||
112 | #define iopte_val(x) (x) | ||
113 | #define pmd_val(x) ((x).pmdv[0]) | ||
114 | #define pgd_val(x) (x) | ||
115 | #define ctxd_val(x) (x) | ||
116 | #define pgprot_val(x) (x) | ||
117 | #define iopgprot_val(x) (x) | ||
118 | |||
119 | #define __pte(x) (x) | ||
120 | #define __iopte(x) (x) | ||
121 | /* #define __pmd(x) (x) */ /* XXX later */ | ||
122 | #define __pgd(x) (x) | ||
123 | #define __ctxd(x) (x) | ||
124 | #define __pgprot(x) (x) | ||
125 | #define __iopgprot(x) (x) | ||
126 | |||
127 | #endif | ||
128 | |||
129 | extern unsigned long sparc_unmapped_base; | ||
130 | |||
131 | BTFIXUPDEF_SETHI(sparc_unmapped_base) | ||
132 | |||
133 | #define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) | ||
134 | |||
135 | /* Pure 2^n version of get_order */ | ||
136 | extern __inline__ int get_order(unsigned long size) | ||
137 | { | ||
138 | int order; | ||
139 | |||
140 | size = (size-1) >> (PAGE_SHIFT-1); | ||
141 | order = -1; | ||
142 | do { | ||
143 | size >>= 1; | ||
144 | order++; | ||
145 | } while (size); | ||
146 | return order; | ||
147 | } | ||
148 | |||
149 | #else /* !(__ASSEMBLY__) */ | ||
150 | |||
151 | #define __pgprot(x) (x) | ||
152 | |||
153 | #endif /* !(__ASSEMBLY__) */ | ||
154 | |||
155 | /* to align the pointer to the (next) page boundary */ | ||
156 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | ||
157 | |||
158 | #define PAGE_OFFSET 0xf0000000 | ||
159 | #ifndef __ASSEMBLY__ | ||
160 | extern unsigned long phys_base; | ||
161 | extern unsigned long pfn_base; | ||
162 | #endif | ||
163 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + phys_base) | ||
164 | #define __va(x) ((void *)((unsigned long) (x) - phys_base + PAGE_OFFSET)) | ||
165 | |||
166 | #define virt_to_phys __pa | ||
167 | #define phys_to_virt __va | ||
168 | |||
169 | #define pfn_to_page(pfn) (mem_map + ((pfn)-(pfn_base))) | ||
170 | #define page_to_pfn(page) ((unsigned long)(((page) - mem_map) + pfn_base)) | ||
171 | #define virt_to_page(kaddr) (mem_map + ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT))) | ||
172 | |||
173 | #define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr)) | ||
174 | #define virt_addr_valid(kaddr) ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr) | ||
175 | |||
176 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
177 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
178 | |||
179 | #endif /* __KERNEL__ */ | ||
180 | |||
181 | #endif /* _SPARC_PAGE_H */ | ||
diff --git a/include/asm-sparc/param.h b/include/asm-sparc/param.h new file mode 100644 index 000000000000..beaf02d364f2 --- /dev/null +++ b/include/asm-sparc/param.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* $Id: param.h,v 1.4 2000/10/30 21:01:41 davem Exp $ */ | ||
2 | #ifndef _ASMSPARC_PARAM_H | ||
3 | #define _ASMSPARC_PARAM_H | ||
4 | |||
5 | #ifdef __KERNEL__ | ||
6 | # define HZ 100 /* Internal kernel timer frequency */ | ||
7 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
8 | # define CLOCKS_PER_SEC (USER_HZ) | ||
9 | #endif | ||
10 | |||
11 | #ifndef HZ | ||
12 | #define HZ 100 | ||
13 | #endif | ||
14 | |||
15 | #define EXEC_PAGESIZE 8192 /* Thanks for sun4's we carry baggage... */ | ||
16 | |||
17 | #ifndef NOGROUP | ||
18 | #define NOGROUP (-1) | ||
19 | #endif | ||
20 | |||
21 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
22 | |||
23 | #endif | ||
diff --git a/include/asm-sparc/pbm.h b/include/asm-sparc/pbm.h new file mode 100644 index 000000000000..0aba3a82c2eb --- /dev/null +++ b/include/asm-sparc/pbm.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* $Id: pbm.h,v 1.3 1999/12/20 17:06:35 zaitcev Exp $ | ||
2 | * | ||
3 | * pbm.h: PCI bus module pseudo driver software state | ||
4 | * Adopted from sparc64 by V. Roganov and G. Raiko | ||
5 | * | ||
6 | * Original header: | ||
7 | * pbm.h: U2P PCI bus module pseudo driver software state. | ||
8 | * | ||
9 | * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) | ||
10 | * | ||
11 | * To put things into perspective, consider sparc64 with a few PCI controllers. | ||
12 | * Each type would have an own structure, with instances related one to one. | ||
13 | * We have only pcic on sparc, but we want to be compatible with sparc64 pbm.h. | ||
14 | * All three represent different abstractions. | ||
15 | * pci_bus - Linux PCI subsystem view of a PCI bus (including bridged buses) | ||
16 | * pbm - Arch-specific view of a PCI bus (sparc or sparc64) | ||
17 | * pcic - Chip-specific information for PCIC. | ||
18 | */ | ||
19 | |||
20 | #ifndef __SPARC_PBM_H | ||
21 | #define __SPARC_PBM_H | ||
22 | |||
23 | #include <linux/pci.h> | ||
24 | #include <asm/oplib.h> | ||
25 | |||
26 | struct linux_pbm_info { | ||
27 | int prom_node; | ||
28 | char prom_name[64]; | ||
29 | /* struct linux_prom_pci_ranges pbm_ranges[PROMREG_MAX]; */ | ||
30 | /* int num_pbm_ranges; */ | ||
31 | |||
32 | /* Now things for the actual PCI bus probes. */ | ||
33 | unsigned int pci_first_busno; /* Can it be nonzero? */ | ||
34 | struct pci_bus *pci_bus; /* Was inline, MJ allocs now */ | ||
35 | }; | ||
36 | |||
37 | /* PCI devices which are not bridges have this placed in their pci_dev | ||
38 | * sysdata member. This makes OBP aware PCI device drivers easier to | ||
39 | * code. | ||
40 | */ | ||
41 | struct pcidev_cookie { | ||
42 | struct linux_pbm_info *pbm; | ||
43 | int prom_node; | ||
44 | }; | ||
45 | |||
46 | #endif /* !(__SPARC_PBM_H) */ | ||
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h new file mode 100644 index 000000000000..d200a25a7373 --- /dev/null +++ b/include/asm-sparc/pci.h | |||
@@ -0,0 +1,163 @@ | |||
1 | #ifndef __SPARC_PCI_H | ||
2 | #define __SPARC_PCI_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | /* Can be used to override the logic in pci_scan_bus for skipping | ||
7 | * already-configured bus numbers - to be used for buggy BIOSes | ||
8 | * or architectures with incomplete PCI setup by the loader. | ||
9 | */ | ||
10 | #define pcibios_assign_all_busses() 0 | ||
11 | #define pcibios_scan_all_fns(a, b) 0 | ||
12 | |||
13 | #define PCIBIOS_MIN_IO 0UL | ||
14 | #define PCIBIOS_MIN_MEM 0UL | ||
15 | |||
16 | #define PCI_IRQ_NONE 0xffffffff | ||
17 | |||
18 | extern inline void pcibios_set_master(struct pci_dev *dev) | ||
19 | { | ||
20 | /* No special bus mastering setup handling */ | ||
21 | } | ||
22 | |||
23 | extern inline void pcibios_penalize_isa_irq(int irq) | ||
24 | { | ||
25 | /* We don't do dynamic PCI IRQ allocation */ | ||
26 | } | ||
27 | |||
28 | /* Dynamic DMA mapping stuff. | ||
29 | */ | ||
30 | #define PCI_DMA_BUS_IS_PHYS (0) | ||
31 | |||
32 | #include <asm/scatterlist.h> | ||
33 | |||
34 | struct pci_dev; | ||
35 | |||
36 | /* Allocate and map kernel buffer using consistent mode DMA for a device. | ||
37 | * hwdev should be valid struct pci_dev pointer for PCI devices. | ||
38 | */ | ||
39 | extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle); | ||
40 | |||
41 | /* Free and unmap a consistent DMA buffer. | ||
42 | * cpu_addr is what was returned from pci_alloc_consistent, | ||
43 | * size must be the same as what as passed into pci_alloc_consistent, | ||
44 | * and likewise dma_addr must be the same as what *dma_addrp was set to. | ||
45 | * | ||
46 | * References to the memory and mappings assosciated with cpu_addr/dma_addr | ||
47 | * past this call are illegal. | ||
48 | */ | ||
49 | extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); | ||
50 | |||
51 | /* Map a single buffer of the indicated size for DMA in streaming mode. | ||
52 | * The 32-bit bus address to use is returned. | ||
53 | * | ||
54 | * Once the device is given the dma address, the device owns this memory | ||
55 | * until either pci_unmap_single or pci_dma_sync_single_for_cpu is performed. | ||
56 | */ | ||
57 | extern dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction); | ||
58 | |||
59 | /* Unmap a single streaming mode DMA translation. The dma_addr and size | ||
60 | * must match what was provided for in a previous pci_map_single call. All | ||
61 | * other usages are undefined. | ||
62 | * | ||
63 | * After this call, reads by the cpu to the buffer are guaranteed to see | ||
64 | * whatever the device wrote there. | ||
65 | */ | ||
66 | extern void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction); | ||
67 | |||
68 | /* pci_unmap_{single,page} is not a nop, thus... */ | ||
69 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ | ||
70 | dma_addr_t ADDR_NAME; | ||
71 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ | ||
72 | __u32 LEN_NAME; | ||
73 | #define pci_unmap_addr(PTR, ADDR_NAME) \ | ||
74 | ((PTR)->ADDR_NAME) | ||
75 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \ | ||
76 | (((PTR)->ADDR_NAME) = (VAL)) | ||
77 | #define pci_unmap_len(PTR, LEN_NAME) \ | ||
78 | ((PTR)->LEN_NAME) | ||
79 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ | ||
80 | (((PTR)->LEN_NAME) = (VAL)) | ||
81 | |||
82 | /* | ||
83 | * Same as above, only with pages instead of mapped addresses. | ||
84 | */ | ||
85 | extern dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page, | ||
86 | unsigned long offset, size_t size, int direction); | ||
87 | extern void pci_unmap_page(struct pci_dev *hwdev, | ||
88 | dma_addr_t dma_address, size_t size, int direction); | ||
89 | |||
90 | /* Map a set of buffers described by scatterlist in streaming | ||
91 | * mode for DMA. This is the scather-gather version of the | ||
92 | * above pci_map_single interface. Here the scatter gather list | ||
93 | * elements are each tagged with the appropriate dma address | ||
94 | * and length. They are obtained via sg_dma_{address,length}(SG). | ||
95 | * | ||
96 | * NOTE: An implementation may be able to use a smaller number of | ||
97 | * DMA address/length pairs than there are SG table elements. | ||
98 | * (for example via virtual mapping capabilities) | ||
99 | * The routine returns the number of addr/length pairs actually | ||
100 | * used, at most nents. | ||
101 | * | ||
102 | * Device ownership issues as mentioned above for pci_map_single are | ||
103 | * the same here. | ||
104 | */ | ||
105 | extern int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction); | ||
106 | |||
107 | /* Unmap a set of streaming mode DMA translations. | ||
108 | * Again, cpu read rules concerning calls here are the same as for | ||
109 | * pci_unmap_single() above. | ||
110 | */ | ||
111 | extern void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nhwents, int direction); | ||
112 | |||
113 | /* Make physical memory consistent for a single | ||
114 | * streaming mode DMA translation after a transfer. | ||
115 | * | ||
116 | * If you perform a pci_map_single() but wish to interrogate the | ||
117 | * buffer using the cpu, yet do not wish to teardown the PCI dma | ||
118 | * mapping, you must call this function before doing so. At the | ||
119 | * next point you give the PCI dma address back to the card, you | ||
120 | * must first perform a pci_dma_sync_for_device, and then the device | ||
121 | * again owns the buffer. | ||
122 | */ | ||
123 | extern void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction); | ||
124 | extern void pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction); | ||
125 | |||
126 | /* Make physical memory consistent for a set of streaming | ||
127 | * mode DMA translations after a transfer. | ||
128 | * | ||
129 | * The same as pci_dma_sync_single_* but for a scatter-gather list, | ||
130 | * same rules and usage. | ||
131 | */ | ||
132 | extern void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction); | ||
133 | extern void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction); | ||
134 | |||
135 | /* Return whether the given PCI device DMA address mask can | ||
136 | * be supported properly. For example, if your device can | ||
137 | * only drive the low 24-bits during PCI bus mastering, then | ||
138 | * you would pass 0x00ffffff as the mask to this function. | ||
139 | */ | ||
140 | extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) | ||
141 | { | ||
142 | return 1; | ||
143 | } | ||
144 | |||
145 | #define pci_dac_dma_supported(dev, mask) (0) | ||
146 | |||
147 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | ||
148 | { | ||
149 | } | ||
150 | |||
151 | #define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0) | ||
152 | |||
153 | static inline int pci_dma_mapping_error(dma_addr_t dma_addr) | ||
154 | { | ||
155 | return (dma_addr == PCI_DMA_ERROR_CODE); | ||
156 | } | ||
157 | |||
158 | #endif /* __KERNEL__ */ | ||
159 | |||
160 | /* generic pci stuff */ | ||
161 | #include <asm-generic/pci.h> | ||
162 | |||
163 | #endif /* __SPARC_PCI_H */ | ||
diff --git a/include/asm-sparc/pcic.h b/include/asm-sparc/pcic.h new file mode 100644 index 000000000000..301ae8022ddd --- /dev/null +++ b/include/asm-sparc/pcic.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* $Id: pcic.h,v 1.4 1999/11/17 07:34:20 zaitcev Exp $ | ||
2 | * pcic.h: JavaEngine 1 specific PCI definitions. | ||
3 | * | ||
4 | * Copyright (C) 1998 V. Roganov and G. Raiko | ||
5 | */ | ||
6 | |||
7 | #ifndef __SPARC_PCIC_H | ||
8 | #define __SPARC_PCIC_H | ||
9 | |||
10 | #ifndef __ASSEMBLY__ | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/smp.h> | ||
14 | #include <linux/pci.h> | ||
15 | #include <linux/ioport.h> | ||
16 | #include <asm/pbm.h> | ||
17 | |||
18 | struct linux_pcic { | ||
19 | void * __iomem pcic_regs; | ||
20 | unsigned long pcic_io; | ||
21 | void * __iomem pcic_config_space_addr; | ||
22 | void * __iomem pcic_config_space_data; | ||
23 | struct resource pcic_res_regs; | ||
24 | struct resource pcic_res_io; | ||
25 | struct resource pcic_res_cfg_addr; | ||
26 | struct resource pcic_res_cfg_data; | ||
27 | struct linux_pbm_info pbm; | ||
28 | struct pcic_ca2irq *pcic_imap; | ||
29 | int pcic_imdim; | ||
30 | }; | ||
31 | |||
32 | extern int pcic_probe(void); | ||
33 | /* Erm... MJ redefined pcibios_present() so that it does not work early. */ | ||
34 | extern int pcic_present(void); | ||
35 | extern void sun4m_pci_init_IRQ(void); | ||
36 | |||
37 | #endif | ||
38 | |||
39 | /* Size of PCI I/O space which we relocate. */ | ||
40 | #define PCI_SPACE_SIZE 0x1000000 /* 16 MB */ | ||
41 | |||
42 | /* PCIC Register Set. */ | ||
43 | #define PCI_DIAGNOSTIC_0 0x40 /* 32 bits */ | ||
44 | #define PCI_SIZE_0 0x44 /* 32 bits */ | ||
45 | #define PCI_SIZE_1 0x48 /* 32 bits */ | ||
46 | #define PCI_SIZE_2 0x4c /* 32 bits */ | ||
47 | #define PCI_SIZE_3 0x50 /* 32 bits */ | ||
48 | #define PCI_SIZE_4 0x54 /* 32 bits */ | ||
49 | #define PCI_SIZE_5 0x58 /* 32 bits */ | ||
50 | #define PCI_PIO_CONTROL 0x60 /* 8 bits */ | ||
51 | #define PCI_DVMA_CONTROL 0x62 /* 8 bits */ | ||
52 | #define PCI_DVMA_CONTROL_INACTIVITY_REQ (1<<0) | ||
53 | #define PCI_DVMA_CONTROL_IOTLB_ENABLE (1<<0) | ||
54 | #define PCI_DVMA_CONTROL_IOTLB_DISABLE 0 | ||
55 | #define PCI_DVMA_CONTROL_INACTIVITY_ACK (1<<4) | ||
56 | #define PCI_INTERRUPT_CONTROL 0x63 /* 8 bits */ | ||
57 | #define PCI_CPU_INTERRUPT_PENDING 0x64 /* 32 bits */ | ||
58 | #define PCI_DIAGNOSTIC_1 0x68 /* 16 bits */ | ||
59 | #define PCI_SOFTWARE_INT_CLEAR 0x6a /* 16 bits */ | ||
60 | #define PCI_SOFTWARE_INT_SET 0x6e /* 16 bits */ | ||
61 | #define PCI_SYS_INT_PENDING 0x70 /* 32 bits */ | ||
62 | #define PCI_SYS_INT_PENDING_PIO 0x40000000 | ||
63 | #define PCI_SYS_INT_PENDING_DMA 0x20000000 | ||
64 | #define PCI_SYS_INT_PENDING_PCI 0x10000000 | ||
65 | #define PCI_SYS_INT_PENDING_APSR 0x08000000 | ||
66 | #define PCI_SYS_INT_TARGET_MASK 0x74 /* 32 bits */ | ||
67 | #define PCI_SYS_INT_TARGET_MASK_CLEAR 0x78 /* 32 bits */ | ||
68 | #define PCI_SYS_INT_TARGET_MASK_SET 0x7c /* 32 bits */ | ||
69 | #define PCI_SYS_INT_PENDING_CLEAR 0x83 /* 8 bits */ | ||
70 | #define PCI_SYS_INT_PENDING_CLEAR_ALL 0x80 | ||
71 | #define PCI_SYS_INT_PENDING_CLEAR_PIO 0x40 | ||
72 | #define PCI_SYS_INT_PENDING_CLEAR_DMA 0x20 | ||
73 | #define PCI_SYS_INT_PENDING_CLEAR_PCI 0x10 | ||
74 | #define PCI_IOTLB_CONTROL 0x84 /* 8 bits */ | ||
75 | #define PCI_INT_SELECT_LO 0x88 /* 16 bits */ | ||
76 | #define PCI_ARBITRATION_SELECT 0x8a /* 16 bits */ | ||
77 | #define PCI_INT_SELECT_HI 0x8c /* 16 bits */ | ||
78 | #define PCI_HW_INT_OUTPUT 0x8e /* 16 bits */ | ||
79 | #define PCI_IOTLB_RAM_INPUT 0x90 /* 32 bits */ | ||
80 | #define PCI_IOTLB_CAM_INPUT 0x94 /* 32 bits */ | ||
81 | #define PCI_IOTLB_RAM_OUTPUT 0x98 /* 32 bits */ | ||
82 | #define PCI_IOTLB_CAM_OUTPUT 0x9c /* 32 bits */ | ||
83 | #define PCI_SMBAR0 0xa0 /* 8 bits */ | ||
84 | #define PCI_MSIZE0 0xa1 /* 8 bits */ | ||
85 | #define PCI_PMBAR0 0xa2 /* 8 bits */ | ||
86 | #define PCI_SMBAR1 0xa4 /* 8 bits */ | ||
87 | #define PCI_MSIZE1 0xa5 /* 8 bits */ | ||
88 | #define PCI_PMBAR1 0xa6 /* 8 bits */ | ||
89 | #define PCI_SIBAR 0xa8 /* 8 bits */ | ||
90 | #define PCI_SIBAR_ADDRESS_MASK 0xf | ||
91 | #define PCI_ISIZE 0xa9 /* 8 bits */ | ||
92 | #define PCI_ISIZE_16M 0xf | ||
93 | #define PCI_ISIZE_32M 0xe | ||
94 | #define PCI_ISIZE_64M 0xc | ||
95 | #define PCI_ISIZE_128M 0x8 | ||
96 | #define PCI_ISIZE_256M 0x0 | ||
97 | #define PCI_PIBAR 0xaa /* 8 bits */ | ||
98 | #define PCI_CPU_COUNTER_LIMIT_HI 0xac /* 32 bits */ | ||
99 | #define PCI_CPU_COUNTER_LIMIT_LO 0xb0 /* 32 bits */ | ||
100 | #define PCI_CPU_COUNTER_LIMIT 0xb4 /* 32 bits */ | ||
101 | #define PCI_SYS_LIMIT 0xb8 /* 32 bits */ | ||
102 | #define PCI_SYS_COUNTER 0xbc /* 32 bits */ | ||
103 | #define PCI_SYS_COUNTER_OVERFLOW (1<<31) /* Limit reached */ | ||
104 | #define PCI_SYS_LIMIT_PSEUDO 0xc0 /* 32 bits */ | ||
105 | #define PCI_USER_TIMER_CONTROL 0xc4 /* 8 bits */ | ||
106 | #define PCI_USER_TIMER_CONFIG 0xc5 /* 8 bits */ | ||
107 | #define PCI_COUNTER_IRQ 0xc6 /* 8 bits */ | ||
108 | #define PCI_COUNTER_IRQ_SET(sys_irq, cpu_irq) ((((sys_irq) & 0xf) << 4) | \ | ||
109 | ((cpu_irq) & 0xf)) | ||
110 | #define PCI_COUNTER_IRQ_SYS(v) (((v) >> 4) & 0xf) | ||
111 | #define PCI_COUNTER_IRQ_CPU(v) ((v) & 0xf) | ||
112 | #define PCI_PIO_ERROR_COMMAND 0xc7 /* 8 bits */ | ||
113 | #define PCI_PIO_ERROR_ADDRESS 0xc8 /* 32 bits */ | ||
114 | #define PCI_IOTLB_ERROR_ADDRESS 0xcc /* 32 bits */ | ||
115 | #define PCI_SYS_STATUS 0xd0 /* 8 bits */ | ||
116 | #define PCI_SYS_STATUS_RESET_ENABLE (1<<0) | ||
117 | #define PCI_SYS_STATUS_RESET (1<<1) | ||
118 | #define PCI_SYS_STATUS_WATCHDOG_RESET (1<<4) | ||
119 | #define PCI_SYS_STATUS_PCI_RESET (1<<5) | ||
120 | #define PCI_SYS_STATUS_PCI_RESET_ENABLE (1<<6) | ||
121 | #define PCI_SYS_STATUS_PCI_SATTELITE_MODE (1<<7) | ||
122 | |||
123 | #endif /* !(__SPARC_PCIC_H) */ | ||
diff --git a/include/asm-sparc/pconf.h b/include/asm-sparc/pconf.h new file mode 100644 index 000000000000..d73c1f1c49dc --- /dev/null +++ b/include/asm-sparc/pconf.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* $Id: pconf.h,v 1.3 1996/04/25 06:13:25 davem Exp $ | ||
2 | * pconf.h: pathconf() and fpathconf() defines for SunOS | ||
3 | * system call compatibility. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_PCONF_H | ||
9 | #define _SPARC_PCONF_H | ||
10 | |||
11 | #include <linux/fs.h> | ||
12 | #include <linux/limits.h> | ||
13 | |||
14 | #define _PCONF_LINK 1 /* Max number of links to an object */ | ||
15 | #define _PCONF_CANON 2 /* TTY input buffer line size */ | ||
16 | #define _PCONF_INPUT 3 /* Biggest packet a tty can imbibe at once */ | ||
17 | #define _PCONF_NAME 4 /* Filename length max */ | ||
18 | #define _PCONF_PATH 5 /* Max size of a pathname */ | ||
19 | #define _PCONF_PIPE 6 /* Buffer size for a pipe */ | ||
20 | #define _PCONF_CHRESTRICT 7 /* Can only root chown files? */ | ||
21 | #define _PCONF_NOTRUNC 8 /* Are pathnames truncated if too big? */ | ||
22 | #define _PCONF_VDISABLE 9 /* Magic char to disable special tty chars */ | ||
23 | #define _PCONF_MAXPCONF 9 | ||
24 | |||
25 | #endif /* !(_SPARC_PCONF_H) */ | ||
diff --git a/include/asm-sparc/percpu.h b/include/asm-sparc/percpu.h new file mode 100644 index 000000000000..06066a7aaec3 --- /dev/null +++ b/include/asm-sparc/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ARCH_SPARC_PERCPU__ | ||
2 | #define __ARCH_SPARC_PERCPU__ | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* __ARCH_SPARC_PERCPU__ */ | ||
diff --git a/include/asm-sparc/perfctr.h b/include/asm-sparc/perfctr.h new file mode 100644 index 000000000000..836873002b75 --- /dev/null +++ b/include/asm-sparc/perfctr.h | |||
@@ -0,0 +1,173 @@ | |||
1 | /*---------------------------------------- | ||
2 | PERFORMANCE INSTRUMENTATION | ||
3 | Guillaume Thouvenin 08/10/98 | ||
4 | David S. Miller 10/06/98 | ||
5 | ---------------------------------------*/ | ||
6 | #ifndef PERF_COUNTER_API | ||
7 | #define PERF_COUNTER_API | ||
8 | |||
9 | /* sys_perfctr() interface. First arg is operation code | ||
10 | * from enumeration below. The meaning of further arguments | ||
11 | * are determined by the operation code. | ||
12 | * | ||
13 | * int sys_perfctr(int opcode, unsigned long arg0, | ||
14 | * unsigned long arg1, unsigned long arg2) | ||
15 | * | ||
16 | * Pointers which are passed by the user are pointers to 64-bit | ||
17 | * integers. | ||
18 | * | ||
19 | * Once enabled, performance counter state is retained until the | ||
20 | * process either exits or performs an exec. That is, performance | ||
21 | * counters remain enabled for fork/clone children. | ||
22 | */ | ||
23 | enum perfctr_opcode { | ||
24 | /* Enable UltraSparc performance counters, ARG0 is pointer | ||
25 | * to 64-bit accumulator for D0 counter in PIC, ARG1 is pointer | ||
26 | * to 64-bit accumulator for D1 counter. ARG2 is a pointer to | ||
27 | * the initial PCR register value to use. | ||
28 | */ | ||
29 | PERFCTR_ON, | ||
30 | |||
31 | /* Disable UltraSparc performance counters. The PCR is written | ||
32 | * with zero and the user counter accumulator pointers and | ||
33 | * working PCR register value are forgotten. | ||
34 | */ | ||
35 | PERFCTR_OFF, | ||
36 | |||
37 | /* Add current D0 and D1 PIC values into user pointers given | ||
38 | * in PERFCTR_ON operation. The PIC is cleared before returning. | ||
39 | */ | ||
40 | PERFCTR_READ, | ||
41 | |||
42 | /* Clear the PIC register. */ | ||
43 | PERFCTR_CLRPIC, | ||
44 | |||
45 | /* Begin using a new PCR value, the pointer to which is passed | ||
46 | * in ARG0. The PIC is also cleared after the new PCR value is | ||
47 | * written. | ||
48 | */ | ||
49 | PERFCTR_SETPCR, | ||
50 | |||
51 | /* Store in pointer given in ARG0 the current PCR register value | ||
52 | * being used. | ||
53 | */ | ||
54 | PERFCTR_GETPCR | ||
55 | }; | ||
56 | |||
57 | /* I don't want the kernel's namespace to be polluted with this | ||
58 | * stuff when this file is included. --DaveM | ||
59 | */ | ||
60 | #ifndef __KERNEL__ | ||
61 | |||
62 | #define PRIV 0x00000001 | ||
63 | #define SYS 0x00000002 | ||
64 | #define USR 0x00000004 | ||
65 | |||
66 | /* Pic.S0 Selection Bit Field Encoding, Ultra-I/II */ | ||
67 | #define CYCLE_CNT 0x00000000 | ||
68 | #define INSTR_CNT 0x00000010 | ||
69 | #define DISPATCH0_IC_MISS 0x00000020 | ||
70 | #define DISPATCH0_STOREBUF 0x00000030 | ||
71 | #define IC_REF 0x00000080 | ||
72 | #define DC_RD 0x00000090 | ||
73 | #define DC_WR 0x000000A0 | ||
74 | #define LOAD_USE 0x000000B0 | ||
75 | #define EC_REF 0x000000C0 | ||
76 | #define EC_WRITE_HIT_RDO 0x000000D0 | ||
77 | #define EC_SNOOP_INV 0x000000E0 | ||
78 | #define EC_RD_HIT 0x000000F0 | ||
79 | |||
80 | /* Pic.S0 Selection Bit Field Encoding, Ultra-III */ | ||
81 | #define US3_CYCLE_CNT 0x00000000 | ||
82 | #define US3_INSTR_CNT 0x00000010 | ||
83 | #define US3_DISPATCH0_IC_MISS 0x00000020 | ||
84 | #define US3_DISPATCH0_BR_TGT 0x00000030 | ||
85 | #define US3_DISPATCH0_2ND_BR 0x00000040 | ||
86 | #define US3_RSTALL_STOREQ 0x00000050 | ||
87 | #define US3_RSTALL_IU_USE 0x00000060 | ||
88 | #define US3_IC_REF 0x00000080 | ||
89 | #define US3_DC_RD 0x00000090 | ||
90 | #define US3_DC_WR 0x000000a0 | ||
91 | #define US3_EC_REF 0x000000c0 | ||
92 | #define US3_EC_WR_HIT_RTO 0x000000d0 | ||
93 | #define US3_EC_SNOOP_INV 0x000000e0 | ||
94 | #define US3_EC_RD_MISS 0x000000f0 | ||
95 | #define US3_PC_PORT0_RD 0x00000100 | ||
96 | #define US3_SI_SNOOP 0x00000110 | ||
97 | #define US3_SI_CIQ_FLOW 0x00000120 | ||
98 | #define US3_SI_OWNED 0x00000130 | ||
99 | #define US3_SW_COUNT_0 0x00000140 | ||
100 | #define US3_IU_BR_MISS_TAKEN 0x00000150 | ||
101 | #define US3_IU_BR_COUNT_TAKEN 0x00000160 | ||
102 | #define US3_DISP_RS_MISPRED 0x00000170 | ||
103 | #define US3_FA_PIPE_COMPL 0x00000180 | ||
104 | #define US3_MC_READS_0 0x00000200 | ||
105 | #define US3_MC_READS_1 0x00000210 | ||
106 | #define US3_MC_READS_2 0x00000220 | ||
107 | #define US3_MC_READS_3 0x00000230 | ||
108 | #define US3_MC_STALLS_0 0x00000240 | ||
109 | #define US3_MC_STALLS_2 0x00000250 | ||
110 | |||
111 | /* Pic.S1 Selection Bit Field Encoding, Ultra-I/II */ | ||
112 | #define CYCLE_CNT_D1 0x00000000 | ||
113 | #define INSTR_CNT_D1 0x00000800 | ||
114 | #define DISPATCH0_IC_MISPRED 0x00001000 | ||
115 | #define DISPATCH0_FP_USE 0x00001800 | ||
116 | #define IC_HIT 0x00004000 | ||
117 | #define DC_RD_HIT 0x00004800 | ||
118 | #define DC_WR_HIT 0x00005000 | ||
119 | #define LOAD_USE_RAW 0x00005800 | ||
120 | #define EC_HIT 0x00006000 | ||
121 | #define EC_WB 0x00006800 | ||
122 | #define EC_SNOOP_CB 0x00007000 | ||
123 | #define EC_IT_HIT 0x00007800 | ||
124 | |||
125 | /* Pic.S1 Selection Bit Field Encoding, Ultra-III */ | ||
126 | #define US3_CYCLE_CNT_D1 0x00000000 | ||
127 | #define US3_INSTR_CNT_D1 0x00000800 | ||
128 | #define US3_DISPATCH0_MISPRED 0x00001000 | ||
129 | #define US3_IC_MISS_CANCELLED 0x00001800 | ||
130 | #define US3_RE_ENDIAN_MISS 0x00002000 | ||
131 | #define US3_RE_FPU_BYPASS 0x00002800 | ||
132 | #define US3_RE_DC_MISS 0x00003000 | ||
133 | #define US3_RE_EC_MISS 0x00003800 | ||
134 | #define US3_IC_MISS 0x00004000 | ||
135 | #define US3_DC_RD_MISS 0x00004800 | ||
136 | #define US3_DC_WR_MISS 0x00005000 | ||
137 | #define US3_RSTALL_FP_USE 0x00005800 | ||
138 | #define US3_EC_MISSES 0x00006000 | ||
139 | #define US3_EC_WB 0x00006800 | ||
140 | #define US3_EC_SNOOP_CB 0x00007000 | ||
141 | #define US3_EC_IC_MISS 0x00007800 | ||
142 | #define US3_RE_PC_MISS 0x00008000 | ||
143 | #define US3_ITLB_MISS 0x00008800 | ||
144 | #define US3_DTLB_MISS 0x00009000 | ||
145 | #define US3_WC_MISS 0x00009800 | ||
146 | #define US3_WC_SNOOP_CB 0x0000a000 | ||
147 | #define US3_WC_SCRUBBED 0x0000a800 | ||
148 | #define US3_WC_WB_WO_READ 0x0000b000 | ||
149 | #define US3_PC_SOFT_HIT 0x0000c000 | ||
150 | #define US3_PC_SNOOP_INV 0x0000c800 | ||
151 | #define US3_PC_HARD_HIT 0x0000d000 | ||
152 | #define US3_PC_PORT1_RD 0x0000d800 | ||
153 | #define US3_SW_COUNT_1 0x0000e000 | ||
154 | #define US3_IU_STAT_BR_MIS_UNTAKEN 0x0000e800 | ||
155 | #define US3_IU_STAT_BR_COUNT_UNTAKEN 0x0000f000 | ||
156 | #define US3_PC_MS_MISSES 0x0000f800 | ||
157 | #define US3_MC_WRITES_0 0x00010800 | ||
158 | #define US3_MC_WRITES_1 0x00011000 | ||
159 | #define US3_MC_WRITES_2 0x00011800 | ||
160 | #define US3_MC_WRITES_3 0x00012000 | ||
161 | #define US3_MC_STALLS_1 0x00012800 | ||
162 | #define US3_MC_STALLS_3 0x00013000 | ||
163 | #define US3_RE_RAW_MISS 0x00013800 | ||
164 | #define US3_FM_PIPE_COMPLETION 0x00014000 | ||
165 | |||
166 | struct vcounter_struct { | ||
167 | unsigned long long vcnt0; | ||
168 | unsigned long long vcnt1; | ||
169 | }; | ||
170 | |||
171 | #endif /* !(__KERNEL__) */ | ||
172 | |||
173 | #endif /* !(PERF_COUNTER_API) */ | ||
diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h new file mode 100644 index 000000000000..126800acd10d --- /dev/null +++ b/include/asm-sparc/pgalloc.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* $Id: pgalloc.h,v 1.16 2001/12/21 04:56:17 davem Exp $ */ | ||
2 | #ifndef _SPARC_PGALLOC_H | ||
3 | #define _SPARC_PGALLOC_H | ||
4 | |||
5 | #include <linux/config.h> | ||
6 | #include <linux/kernel.h> | ||
7 | #include <linux/sched.h> | ||
8 | |||
9 | #include <asm/page.h> | ||
10 | #include <asm/btfixup.h> | ||
11 | |||
12 | struct page; | ||
13 | |||
14 | extern struct pgtable_cache_struct { | ||
15 | unsigned long *pgd_cache; | ||
16 | unsigned long *pte_cache; | ||
17 | unsigned long pgtable_cache_sz; | ||
18 | unsigned long pgd_cache_sz; | ||
19 | } pgt_quicklists; | ||
20 | #define pgd_quicklist (pgt_quicklists.pgd_cache) | ||
21 | #define pmd_quicklist ((unsigned long *)0) | ||
22 | #define pte_quicklist (pgt_quicklists.pte_cache) | ||
23 | #define pgtable_cache_size (pgt_quicklists.pgtable_cache_sz) | ||
24 | #define pgd_cache_size (pgt_quicklists.pgd_cache_sz) | ||
25 | |||
26 | extern void check_pgt_cache(void); | ||
27 | BTFIXUPDEF_CALL(void, do_check_pgt_cache, int, int) | ||
28 | #define do_check_pgt_cache(low,high) BTFIXUP_CALL(do_check_pgt_cache)(low,high) | ||
29 | |||
30 | BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void) | ||
31 | #define get_pgd_fast() BTFIXUP_CALL(get_pgd_fast)() | ||
32 | |||
33 | BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *) | ||
34 | #define free_pgd_fast(pgd) BTFIXUP_CALL(free_pgd_fast)(pgd) | ||
35 | |||
36 | #define pgd_free(pgd) free_pgd_fast(pgd) | ||
37 | #define pgd_alloc(mm) get_pgd_fast() | ||
38 | |||
39 | BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) | ||
40 | #define pgd_set(pgdp,pmdp) BTFIXUP_CALL(pgd_set)(pgdp,pmdp) | ||
41 | #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) | ||
42 | |||
43 | BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long) | ||
44 | #define pmd_alloc_one(mm, address) BTFIXUP_CALL(pmd_alloc_one)(mm, address) | ||
45 | |||
46 | BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *) | ||
47 | #define free_pmd_fast(pmd) BTFIXUP_CALL(free_pmd_fast)(pmd) | ||
48 | |||
49 | #define pmd_free(pmd) free_pmd_fast(pmd) | ||
50 | #define __pmd_free_tlb(tlb, pmd) pmd_free(pmd) | ||
51 | |||
52 | BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *) | ||
53 | #define pmd_populate(MM, PMD, PTE) BTFIXUP_CALL(pmd_populate)(PMD, PTE) | ||
54 | BTFIXUPDEF_CALL(void, pmd_set, pmd_t *, pte_t *) | ||
55 | #define pmd_populate_kernel(MM, PMD, PTE) BTFIXUP_CALL(pmd_set)(PMD, PTE) | ||
56 | |||
57 | BTFIXUPDEF_CALL(struct page *, pte_alloc_one, struct mm_struct *, unsigned long) | ||
58 | #define pte_alloc_one(mm, address) BTFIXUP_CALL(pte_alloc_one)(mm, address) | ||
59 | BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long) | ||
60 | #define pte_alloc_one_kernel(mm, addr) BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr) | ||
61 | |||
62 | BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *) | ||
63 | #define pte_free_kernel(pte) BTFIXUP_CALL(free_pte_fast)(pte) | ||
64 | |||
65 | BTFIXUPDEF_CALL(void, pte_free, struct page *) | ||
66 | #define pte_free(pte) BTFIXUP_CALL(pte_free)(pte) | ||
67 | #define __pte_free_tlb(tlb, pte) pte_free(pte) | ||
68 | |||
69 | #endif /* _SPARC_PGALLOC_H */ | ||
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h new file mode 100644 index 000000000000..373a6c327590 --- /dev/null +++ b/include/asm-sparc/pgtable.h | |||
@@ -0,0 +1,465 @@ | |||
1 | /* $Id: pgtable.h,v 1.110 2001/12/21 04:56:17 davem Exp $ */ | ||
2 | #ifndef _SPARC_PGTABLE_H | ||
3 | #define _SPARC_PGTABLE_H | ||
4 | |||
5 | /* asm-sparc/pgtable.h: Defines and functions used to work | ||
6 | * with Sparc page tables. | ||
7 | * | ||
8 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
9 | * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
10 | */ | ||
11 | |||
12 | #include <asm-generic/4level-fixup.h> | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/swap.h> | ||
17 | #include <asm/types.h> | ||
18 | #ifdef CONFIG_SUN4 | ||
19 | #include <asm/pgtsun4.h> | ||
20 | #else | ||
21 | #include <asm/pgtsun4c.h> | ||
22 | #endif | ||
23 | #include <asm/pgtsrmmu.h> | ||
24 | #include <asm/vac-ops.h> | ||
25 | #include <asm/oplib.h> | ||
26 | #include <asm/btfixup.h> | ||
27 | #include <asm/system.h> | ||
28 | |||
29 | #ifndef __ASSEMBLY__ | ||
30 | |||
31 | struct vm_area_struct; | ||
32 | struct page; | ||
33 | |||
34 | extern void load_mmu(void); | ||
35 | extern unsigned long calc_highpages(void); | ||
36 | |||
37 | BTFIXUPDEF_SIMM13(pgdir_shift) | ||
38 | BTFIXUPDEF_SETHI(pgdir_size) | ||
39 | BTFIXUPDEF_SETHI(pgdir_mask) | ||
40 | |||
41 | BTFIXUPDEF_SIMM13(ptrs_per_pmd) | ||
42 | BTFIXUPDEF_SIMM13(ptrs_per_pgd) | ||
43 | BTFIXUPDEF_SIMM13(user_ptrs_per_pgd) | ||
44 | |||
45 | #define pte_ERROR(e) __builtin_trap() | ||
46 | #define pmd_ERROR(e) __builtin_trap() | ||
47 | #define pgd_ERROR(e) __builtin_trap() | ||
48 | |||
49 | BTFIXUPDEF_INT(page_none) | ||
50 | BTFIXUPDEF_INT(page_shared) | ||
51 | BTFIXUPDEF_INT(page_copy) | ||
52 | BTFIXUPDEF_INT(page_readonly) | ||
53 | BTFIXUPDEF_INT(page_kernel) | ||
54 | |||
55 | #define PMD_SHIFT SUN4C_PMD_SHIFT | ||
56 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
57 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
58 | #define PMD_ALIGN(__addr) (((__addr) + ~PMD_MASK) & PMD_MASK) | ||
59 | #define PGDIR_SHIFT BTFIXUP_SIMM13(pgdir_shift) | ||
60 | #define PGDIR_SIZE BTFIXUP_SETHI(pgdir_size) | ||
61 | #define PGDIR_MASK BTFIXUP_SETHI(pgdir_mask) | ||
62 | #define PTRS_PER_PTE 1024 | ||
63 | #define PTRS_PER_PMD BTFIXUP_SIMM13(ptrs_per_pmd) | ||
64 | #define PTRS_PER_PGD BTFIXUP_SIMM13(ptrs_per_pgd) | ||
65 | #define USER_PTRS_PER_PGD BTFIXUP_SIMM13(user_ptrs_per_pgd) | ||
66 | #define FIRST_USER_PGD_NR 0 | ||
67 | #define PTE_SIZE (PTRS_PER_PTE*4) | ||
68 | |||
69 | #define PAGE_NONE __pgprot(BTFIXUP_INT(page_none)) | ||
70 | #define PAGE_SHARED __pgprot(BTFIXUP_INT(page_shared)) | ||
71 | #define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy)) | ||
72 | #define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly)) | ||
73 | |||
74 | extern unsigned long page_kernel; | ||
75 | |||
76 | #ifdef MODULE | ||
77 | #define PAGE_KERNEL page_kernel | ||
78 | #else | ||
79 | #define PAGE_KERNEL __pgprot(BTFIXUP_INT(page_kernel)) | ||
80 | #endif | ||
81 | |||
82 | /* Top-level page directory */ | ||
83 | extern pgd_t swapper_pg_dir[1024]; | ||
84 | |||
85 | /* Page table for 0-4MB for everybody, on the Sparc this | ||
86 | * holds the same as on the i386. | ||
87 | */ | ||
88 | extern pte_t pg0[1024]; | ||
89 | extern pte_t pg1[1024]; | ||
90 | extern pte_t pg2[1024]; | ||
91 | extern pte_t pg3[1024]; | ||
92 | |||
93 | extern unsigned long ptr_in_current_pgd; | ||
94 | |||
95 | /* Here is a trick, since mmap.c need the initializer elements for | ||
96 | * protection_map[] to be constant at compile time, I set the following | ||
97 | * to all zeros. I set it to the real values after I link in the | ||
98 | * appropriate MMU page table routines at boot time. | ||
99 | */ | ||
100 | #define __P000 __pgprot(0) | ||
101 | #define __P001 __pgprot(0) | ||
102 | #define __P010 __pgprot(0) | ||
103 | #define __P011 __pgprot(0) | ||
104 | #define __P100 __pgprot(0) | ||
105 | #define __P101 __pgprot(0) | ||
106 | #define __P110 __pgprot(0) | ||
107 | #define __P111 __pgprot(0) | ||
108 | |||
109 | #define __S000 __pgprot(0) | ||
110 | #define __S001 __pgprot(0) | ||
111 | #define __S010 __pgprot(0) | ||
112 | #define __S011 __pgprot(0) | ||
113 | #define __S100 __pgprot(0) | ||
114 | #define __S101 __pgprot(0) | ||
115 | #define __S110 __pgprot(0) | ||
116 | #define __S111 __pgprot(0) | ||
117 | |||
118 | extern int num_contexts; | ||
119 | |||
120 | /* First physical page can be anywhere, the following is needed so that | ||
121 | * va-->pa and vice versa conversions work properly without performance | ||
122 | * hit for all __pa()/__va() operations. | ||
123 | */ | ||
124 | extern unsigned long phys_base; | ||
125 | extern unsigned long pfn_base; | ||
126 | |||
127 | /* | ||
128 | * BAD_PAGETABLE is used when we need a bogus page-table, while | ||
129 | * BAD_PAGE is used for a bogus page. | ||
130 | * | ||
131 | * ZERO_PAGE is a global shared page that is always zero: used | ||
132 | * for zero-mapped memory areas etc.. | ||
133 | */ | ||
134 | extern pte_t * __bad_pagetable(void); | ||
135 | extern pte_t __bad_page(void); | ||
136 | extern unsigned long empty_zero_page; | ||
137 | |||
138 | #define BAD_PAGETABLE __bad_pagetable() | ||
139 | #define BAD_PAGE __bad_page() | ||
140 | #define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) | ||
141 | |||
142 | /* | ||
143 | */ | ||
144 | BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t) | ||
145 | BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page, pgd_t) | ||
146 | |||
147 | #define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) | ||
148 | #define pgd_page(pgd) BTFIXUP_CALL(pgd_page)(pgd) | ||
149 | |||
150 | BTFIXUPDEF_SETHI(none_mask) | ||
151 | BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) | ||
152 | BTFIXUPDEF_CALL(void, pte_clear, pte_t *) | ||
153 | BTFIXUPDEF_CALL(int, pte_read, pte_t) | ||
154 | |||
155 | extern __inline__ int pte_none(pte_t pte) | ||
156 | { | ||
157 | return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask)); | ||
158 | } | ||
159 | |||
160 | #define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) | ||
161 | #define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte) | ||
162 | #define pte_read(pte) BTFIXUP_CALL(pte_read)(pte) | ||
163 | |||
164 | BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) | ||
165 | BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) | ||
166 | BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *) | ||
167 | |||
168 | extern __inline__ int pmd_none(pmd_t pmd) | ||
169 | { | ||
170 | return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask)); | ||
171 | } | ||
172 | |||
173 | #define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd) | ||
174 | #define pmd_present(pmd) BTFIXUP_CALL(pmd_present)(pmd) | ||
175 | #define pmd_clear(pmd) BTFIXUP_CALL(pmd_clear)(pmd) | ||
176 | |||
177 | BTFIXUPDEF_CALL_CONST(int, pgd_none, pgd_t) | ||
178 | BTFIXUPDEF_CALL_CONST(int, pgd_bad, pgd_t) | ||
179 | BTFIXUPDEF_CALL_CONST(int, pgd_present, pgd_t) | ||
180 | BTFIXUPDEF_CALL(void, pgd_clear, pgd_t *) | ||
181 | |||
182 | #define pgd_none(pgd) BTFIXUP_CALL(pgd_none)(pgd) | ||
183 | #define pgd_bad(pgd) BTFIXUP_CALL(pgd_bad)(pgd) | ||
184 | #define pgd_present(pgd) BTFIXUP_CALL(pgd_present)(pgd) | ||
185 | #define pgd_clear(pgd) BTFIXUP_CALL(pgd_clear)(pgd) | ||
186 | |||
187 | /* | ||
188 | * The following only work if pte_present() is true. | ||
189 | * Undefined behaviour if not.. | ||
190 | */ | ||
191 | BTFIXUPDEF_HALF(pte_writei) | ||
192 | BTFIXUPDEF_HALF(pte_dirtyi) | ||
193 | BTFIXUPDEF_HALF(pte_youngi) | ||
194 | |||
195 | extern int pte_write(pte_t pte) __attribute_const__; | ||
196 | extern __inline__ int pte_write(pte_t pte) | ||
197 | { | ||
198 | return pte_val(pte) & BTFIXUP_HALF(pte_writei); | ||
199 | } | ||
200 | |||
201 | extern int pte_dirty(pte_t pte) __attribute_const__; | ||
202 | extern __inline__ int pte_dirty(pte_t pte) | ||
203 | { | ||
204 | return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi); | ||
205 | } | ||
206 | |||
207 | extern int pte_young(pte_t pte) __attribute_const__; | ||
208 | extern __inline__ int pte_young(pte_t pte) | ||
209 | { | ||
210 | return pte_val(pte) & BTFIXUP_HALF(pte_youngi); | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | * The following only work if pte_present() is not true. | ||
215 | */ | ||
216 | BTFIXUPDEF_HALF(pte_filei) | ||
217 | |||
218 | extern int pte_file(pte_t pte) __attribute_const__; | ||
219 | extern __inline__ int pte_file(pte_t pte) | ||
220 | { | ||
221 | return pte_val(pte) & BTFIXUP_HALF(pte_filei); | ||
222 | } | ||
223 | |||
224 | /* | ||
225 | */ | ||
226 | BTFIXUPDEF_HALF(pte_wrprotecti) | ||
227 | BTFIXUPDEF_HALF(pte_mkcleani) | ||
228 | BTFIXUPDEF_HALF(pte_mkoldi) | ||
229 | |||
230 | extern pte_t pte_wrprotect(pte_t pte) __attribute_const__; | ||
231 | extern __inline__ pte_t pte_wrprotect(pte_t pte) | ||
232 | { | ||
233 | return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti)); | ||
234 | } | ||
235 | |||
236 | extern pte_t pte_mkclean(pte_t pte) __attribute_const__; | ||
237 | extern __inline__ pte_t pte_mkclean(pte_t pte) | ||
238 | { | ||
239 | return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani)); | ||
240 | } | ||
241 | |||
242 | extern pte_t pte_mkold(pte_t pte) __attribute_const__; | ||
243 | extern __inline__ pte_t pte_mkold(pte_t pte) | ||
244 | { | ||
245 | return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi)); | ||
246 | } | ||
247 | |||
248 | BTFIXUPDEF_CALL_CONST(pte_t, pte_mkwrite, pte_t) | ||
249 | BTFIXUPDEF_CALL_CONST(pte_t, pte_mkdirty, pte_t) | ||
250 | BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t) | ||
251 | |||
252 | #define pte_mkwrite(pte) BTFIXUP_CALL(pte_mkwrite)(pte) | ||
253 | #define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte) | ||
254 | #define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte) | ||
255 | |||
256 | #define page_pte_prot(page, prot) mk_pte(page, prot) | ||
257 | #define page_pte(page) mk_pte(page, __pgprot(0)) | ||
258 | #define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot) | ||
259 | |||
260 | BTFIXUPDEF_CALL(unsigned long, pte_pfn, pte_t) | ||
261 | #define pte_pfn(pte) BTFIXUP_CALL(pte_pfn)(pte) | ||
262 | #define pte_page(pte) pfn_to_page(pte_pfn(pte)) | ||
263 | |||
264 | /* | ||
265 | * Conversion functions: convert a page and protection to a page entry, | ||
266 | * and a page entry and page directory to the page they refer to. | ||
267 | */ | ||
268 | BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, struct page *, pgprot_t) | ||
269 | |||
270 | BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t) | ||
271 | BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int) | ||
272 | |||
273 | #define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot) | ||
274 | #define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot) | ||
275 | #define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space) | ||
276 | |||
277 | BTFIXUPDEF_INT(pte_modify_mask) | ||
278 | |||
279 | extern pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__; | ||
280 | extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
281 | { | ||
282 | return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) | | ||
283 | pgprot_val(newprot)); | ||
284 | } | ||
285 | |||
286 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | ||
287 | |||
288 | /* to find an entry in a page-table-directory */ | ||
289 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | ||
290 | |||
291 | /* to find an entry in a kernel page-table-directory */ | ||
292 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
293 | |||
294 | /* Find an entry in the second-level page table.. */ | ||
295 | BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd_t *, unsigned long) | ||
296 | #define pmd_offset(dir,addr) BTFIXUP_CALL(pmd_offset)(dir,addr) | ||
297 | |||
298 | /* Find an entry in the third-level page table.. */ | ||
299 | BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long) | ||
300 | #define pte_offset_kernel(dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr) | ||
301 | |||
302 | /* | ||
303 | * This shortcut works on sun4m (and sun4d) because the nocache area is static, | ||
304 | * and sun4c is guaranteed to have no highmem anyway. | ||
305 | */ | ||
306 | #define pte_offset_map(d, a) pte_offset_kernel(d,a) | ||
307 | #define pte_offset_map_nested(d, a) pte_offset_kernel(d,a) | ||
308 | |||
309 | #define pte_unmap(pte) do{}while(0) | ||
310 | #define pte_unmap_nested(pte) do{}while(0) | ||
311 | |||
312 | /* The permissions for pgprot_val to make a page mapped on the obio space */ | ||
313 | extern unsigned int pg_iobits; | ||
314 | |||
315 | /* Certain architectures need to do special things when pte's | ||
316 | * within a page table are directly modified. Thus, the following | ||
317 | * hook is made available. | ||
318 | */ | ||
319 | |||
320 | BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t) | ||
321 | |||
322 | #define set_pte(ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval) | ||
323 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
324 | |||
325 | struct seq_file; | ||
326 | BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *) | ||
327 | |||
328 | #define mmu_info(p) BTFIXUP_CALL(mmu_info)(p) | ||
329 | |||
330 | /* Fault handler stuff... */ | ||
331 | #define FAULT_CODE_PROT 0x1 | ||
332 | #define FAULT_CODE_WRITE 0x2 | ||
333 | #define FAULT_CODE_USER 0x4 | ||
334 | |||
335 | BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t) | ||
336 | |||
337 | #define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte) | ||
338 | |||
339 | BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long, | ||
340 | unsigned long, unsigned int) | ||
341 | BTFIXUPDEF_CALL(void, sparc_unmapiorange, unsigned long, unsigned int) | ||
342 | #define sparc_mapiorange(bus,pa,va,len) BTFIXUP_CALL(sparc_mapiorange)(bus,pa,va,len) | ||
343 | #define sparc_unmapiorange(va,len) BTFIXUP_CALL(sparc_unmapiorange)(va,len) | ||
344 | |||
345 | extern int invalid_segment; | ||
346 | |||
347 | /* Encode and de-code a swap entry */ | ||
348 | BTFIXUPDEF_CALL(unsigned long, __swp_type, swp_entry_t) | ||
349 | BTFIXUPDEF_CALL(unsigned long, __swp_offset, swp_entry_t) | ||
350 | BTFIXUPDEF_CALL(swp_entry_t, __swp_entry, unsigned long, unsigned long) | ||
351 | |||
352 | #define __swp_type(__x) BTFIXUP_CALL(__swp_type)(__x) | ||
353 | #define __swp_offset(__x) BTFIXUP_CALL(__swp_offset)(__x) | ||
354 | #define __swp_entry(__type,__off) BTFIXUP_CALL(__swp_entry)(__type,__off) | ||
355 | |||
356 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
357 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
358 | |||
359 | /* file-offset-in-pte helpers */ | ||
360 | BTFIXUPDEF_CALL(unsigned long, pte_to_pgoff, pte_t pte); | ||
361 | BTFIXUPDEF_CALL(pte_t, pgoff_to_pte, unsigned long pgoff); | ||
362 | |||
363 | #define pte_to_pgoff(pte) BTFIXUP_CALL(pte_to_pgoff)(pte) | ||
364 | #define pgoff_to_pte(off) BTFIXUP_CALL(pgoff_to_pte)(off) | ||
365 | |||
366 | /* | ||
367 | * This is made a constant because mm/fremap.c required a constant. | ||
368 | * Note that layout of these bits is different between sun4c.c and srmmu.c. | ||
369 | */ | ||
370 | #define PTE_FILE_MAX_BITS 24 | ||
371 | |||
372 | /* | ||
373 | */ | ||
374 | struct ctx_list { | ||
375 | struct ctx_list *next; | ||
376 | struct ctx_list *prev; | ||
377 | unsigned int ctx_number; | ||
378 | struct mm_struct *ctx_mm; | ||
379 | }; | ||
380 | |||
381 | extern struct ctx_list *ctx_list_pool; /* Dynamically allocated */ | ||
382 | extern struct ctx_list ctx_free; /* Head of free list */ | ||
383 | extern struct ctx_list ctx_used; /* Head of used contexts list */ | ||
384 | |||
385 | #define NO_CONTEXT -1 | ||
386 | |||
387 | extern __inline__ void remove_from_ctx_list(struct ctx_list *entry) | ||
388 | { | ||
389 | entry->next->prev = entry->prev; | ||
390 | entry->prev->next = entry->next; | ||
391 | } | ||
392 | |||
393 | extern __inline__ void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry) | ||
394 | { | ||
395 | entry->next = head; | ||
396 | (entry->prev = head->prev)->next = entry; | ||
397 | head->prev = entry; | ||
398 | } | ||
399 | #define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry) | ||
400 | #define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry) | ||
401 | |||
402 | extern __inline__ unsigned long | ||
403 | __get_phys (unsigned long addr) | ||
404 | { | ||
405 | switch (sparc_cpu_model){ | ||
406 | case sun4: | ||
407 | case sun4c: | ||
408 | return sun4c_get_pte (addr) << PAGE_SHIFT; | ||
409 | case sun4m: | ||
410 | case sun4d: | ||
411 | return ((srmmu_get_pte (addr) & 0xffffff00) << 4); | ||
412 | default: | ||
413 | return 0; | ||
414 | } | ||
415 | } | ||
416 | |||
417 | extern __inline__ int | ||
418 | __get_iospace (unsigned long addr) | ||
419 | { | ||
420 | switch (sparc_cpu_model){ | ||
421 | case sun4: | ||
422 | case sun4c: | ||
423 | return -1; /* Don't check iospace on sun4c */ | ||
424 | case sun4m: | ||
425 | case sun4d: | ||
426 | return (srmmu_get_pte (addr) >> 28); | ||
427 | default: | ||
428 | return -1; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | extern unsigned long *sparc_valid_addr_bitmap; | ||
433 | |||
434 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | ||
435 | #define kern_addr_valid(addr) \ | ||
436 | (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) | ||
437 | |||
438 | extern int io_remap_page_range(struct vm_area_struct *vma, | ||
439 | unsigned long from, unsigned long to, | ||
440 | unsigned long size, pgprot_t prot, int space); | ||
441 | extern int io_remap_pfn_range(struct vm_area_struct *vma, | ||
442 | unsigned long from, unsigned long pfn, | ||
443 | unsigned long size, pgprot_t prot); | ||
444 | |||
445 | /* | ||
446 | * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in | ||
447 | * its high 4 bits. These macros/functions put it there or get it from there. | ||
448 | */ | ||
449 | #define MK_IOSPACE_PFN(space, pfn) (pfn | (space << (BITS_PER_LONG - 4))) | ||
450 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) | ||
451 | #define GET_PFN(pfn) (pfn & 0x0fffffffUL) | ||
452 | |||
453 | #include <asm-generic/pgtable.h> | ||
454 | |||
455 | #endif /* !(__ASSEMBLY__) */ | ||
456 | |||
457 | /* We provide our own get_unmapped_area to cope with VA holes for userland */ | ||
458 | #define HAVE_ARCH_UNMAPPED_AREA | ||
459 | |||
460 | /* | ||
461 | * No page table caches to initialise | ||
462 | */ | ||
463 | #define pgtable_cache_init() do { } while (0) | ||
464 | |||
465 | #endif /* !(_SPARC_PGTABLE_H) */ | ||
diff --git a/include/asm-sparc/pgtsrmmu.h b/include/asm-sparc/pgtsrmmu.h new file mode 100644 index 000000000000..ee3b9d93187c --- /dev/null +++ b/include/asm-sparc/pgtsrmmu.h | |||
@@ -0,0 +1,298 @@ | |||
1 | /* $Id: pgtsrmmu.h,v 1.31 2000/07/16 21:48:52 anton Exp $ | ||
2 | * pgtsrmmu.h: SRMMU page table defines and code. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_PGTSRMMU_H | ||
8 | #define _SPARC_PGTSRMMU_H | ||
9 | |||
10 | #include <asm/page.h> | ||
11 | |||
12 | #ifdef __ASSEMBLY__ | ||
13 | #include <asm/thread_info.h> /* TI_UWINMASK for WINDOW_FLUSH */ | ||
14 | #endif | ||
15 | |||
16 | /* Number of contexts is implementation-dependent; 64k is the most we support */ | ||
17 | #define SRMMU_MAX_CONTEXTS 65536 | ||
18 | |||
19 | /* PMD_SHIFT determines the size of the area a second-level page table entry can map */ | ||
20 | #define SRMMU_REAL_PMD_SHIFT 18 | ||
21 | #define SRMMU_REAL_PMD_SIZE (1UL << SRMMU_REAL_PMD_SHIFT) | ||
22 | #define SRMMU_REAL_PMD_MASK (~(SRMMU_REAL_PMD_SIZE-1)) | ||
23 | #define SRMMU_REAL_PMD_ALIGN(__addr) (((__addr)+SRMMU_REAL_PMD_SIZE-1)&SRMMU_REAL_PMD_MASK) | ||
24 | |||
25 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
26 | #define SRMMU_PGDIR_SHIFT 24 | ||
27 | #define SRMMU_PGDIR_SIZE (1UL << SRMMU_PGDIR_SHIFT) | ||
28 | #define SRMMU_PGDIR_MASK (~(SRMMU_PGDIR_SIZE-1)) | ||
29 | #define SRMMU_PGDIR_ALIGN(addr) (((addr)+SRMMU_PGDIR_SIZE-1)&SRMMU_PGDIR_MASK) | ||
30 | |||
31 | #define SRMMU_REAL_PTRS_PER_PTE 64 | ||
32 | #define SRMMU_REAL_PTRS_PER_PMD 64 | ||
33 | #define SRMMU_PTRS_PER_PGD 256 | ||
34 | |||
35 | #define SRMMU_REAL_PTE_TABLE_SIZE (SRMMU_REAL_PTRS_PER_PTE*4) | ||
36 | #define SRMMU_PMD_TABLE_SIZE (SRMMU_REAL_PTRS_PER_PMD*4) | ||
37 | #define SRMMU_PGD_TABLE_SIZE (SRMMU_PTRS_PER_PGD*4) | ||
38 | |||
39 | /* | ||
40 | * To support pagetables in highmem, Linux introduces APIs which | ||
41 | * return struct page* and generally manipulate page tables when | ||
42 | * they are not mapped into kernel space. Our hardware page tables | ||
43 | * are smaller than pages. We lump hardware tabes into big, page sized | ||
44 | * software tables. | ||
45 | * | ||
46 | * PMD_SHIFT determines the size of the area a second-level page table entry | ||
47 | * can map, and our pmd_t is 16 times larger than normal. The values which | ||
48 | * were once defined here are now generic for 4c and srmmu, so they're | ||
49 | * found in pgtable.h. | ||
50 | */ | ||
51 | #define SRMMU_PTRS_PER_PMD 4 | ||
52 | |||
53 | /* Definition of the values in the ET field of PTD's and PTE's */ | ||
54 | #define SRMMU_ET_MASK 0x3 | ||
55 | #define SRMMU_ET_INVALID 0x0 | ||
56 | #define SRMMU_ET_PTD 0x1 | ||
57 | #define SRMMU_ET_PTE 0x2 | ||
58 | #define SRMMU_ET_REPTE 0x3 /* AIEEE, SuperSparc II reverse endian page! */ | ||
59 | |||
60 | /* Physical page extraction from PTP's and PTE's. */ | ||
61 | #define SRMMU_CTX_PMASK 0xfffffff0 | ||
62 | #define SRMMU_PTD_PMASK 0xfffffff0 | ||
63 | #define SRMMU_PTE_PMASK 0xffffff00 | ||
64 | |||
65 | /* The pte non-page bits. Some notes: | ||
66 | * 1) cache, dirty, valid, and ref are frobbable | ||
67 | * for both supervisor and user pages. | ||
68 | * 2) exec and write will only give the desired effect | ||
69 | * on user pages | ||
70 | * 3) use priv and priv_readonly for changing the | ||
71 | * characteristics of supervisor ptes | ||
72 | */ | ||
73 | #define SRMMU_CACHE 0x80 | ||
74 | #define SRMMU_DIRTY 0x40 | ||
75 | #define SRMMU_REF 0x20 | ||
76 | #define SRMMU_NOREAD 0x10 | ||
77 | #define SRMMU_EXEC 0x08 | ||
78 | #define SRMMU_WRITE 0x04 | ||
79 | #define SRMMU_VALID 0x02 /* SRMMU_ET_PTE */ | ||
80 | #define SRMMU_PRIV 0x1c | ||
81 | #define SRMMU_PRIV_RDONLY 0x18 | ||
82 | |||
83 | #define SRMMU_FILE 0x40 /* Implemented in software */ | ||
84 | |||
85 | #define SRMMU_PTE_FILE_SHIFT 8 /* == 32-PTE_FILE_MAX_BITS */ | ||
86 | |||
87 | #define SRMMU_CHG_MASK (0xffffff00 | SRMMU_REF | SRMMU_DIRTY) | ||
88 | |||
89 | /* SRMMU swap entry encoding | ||
90 | * | ||
91 | * We use 5 bits for the type and 19 for the offset. This gives us | ||
92 | * 32 swapfiles of 4GB each. Encoding looks like: | ||
93 | * | ||
94 | * oooooooooooooooooootttttRRRRRRRR | ||
95 | * fedcba9876543210fedcba9876543210 | ||
96 | * | ||
97 | * The bottom 8 bits are reserved for protection and status bits, especially | ||
98 | * FILE and PRESENT. | ||
99 | */ | ||
100 | #define SRMMU_SWP_TYPE_MASK 0x1f | ||
101 | #define SRMMU_SWP_TYPE_SHIFT SRMMU_PTE_FILE_SHIFT | ||
102 | #define SRMMU_SWP_OFF_MASK 0x7ffff | ||
103 | #define SRMMU_SWP_OFF_SHIFT (SRMMU_PTE_FILE_SHIFT + 5) | ||
104 | |||
105 | /* Some day I will implement true fine grained access bits for | ||
106 | * user pages because the SRMMU gives us the capabilities to | ||
107 | * enforce all the protection levels that vma's can have. | ||
108 | * XXX But for now... | ||
109 | */ | ||
110 | #define SRMMU_PAGE_NONE __pgprot(SRMMU_CACHE | \ | ||
111 | SRMMU_PRIV | SRMMU_REF) | ||
112 | #define SRMMU_PAGE_SHARED __pgprot(SRMMU_VALID | SRMMU_CACHE | \ | ||
113 | SRMMU_EXEC | SRMMU_WRITE | SRMMU_REF) | ||
114 | #define SRMMU_PAGE_COPY __pgprot(SRMMU_VALID | SRMMU_CACHE | \ | ||
115 | SRMMU_EXEC | SRMMU_REF) | ||
116 | #define SRMMU_PAGE_RDONLY __pgprot(SRMMU_VALID | SRMMU_CACHE | \ | ||
117 | SRMMU_EXEC | SRMMU_REF) | ||
118 | #define SRMMU_PAGE_KERNEL __pgprot(SRMMU_VALID | SRMMU_CACHE | SRMMU_PRIV | \ | ||
119 | SRMMU_DIRTY | SRMMU_REF) | ||
120 | |||
121 | /* SRMMU Register addresses in ASI 0x4. These are valid for all | ||
122 | * current SRMMU implementations that exist. | ||
123 | */ | ||
124 | #define SRMMU_CTRL_REG 0x00000000 | ||
125 | #define SRMMU_CTXTBL_PTR 0x00000100 | ||
126 | #define SRMMU_CTX_REG 0x00000200 | ||
127 | #define SRMMU_FAULT_STATUS 0x00000300 | ||
128 | #define SRMMU_FAULT_ADDR 0x00000400 | ||
129 | |||
130 | #define WINDOW_FLUSH(tmp1, tmp2) \ | ||
131 | mov 0, tmp1; \ | ||
132 | 98: ld [%g6 + TI_UWINMASK], tmp2; \ | ||
133 | orcc %g0, tmp2, %g0; \ | ||
134 | add tmp1, 1, tmp1; \ | ||
135 | bne 98b; \ | ||
136 | save %sp, -64, %sp; \ | ||
137 | 99: subcc tmp1, 1, tmp1; \ | ||
138 | bne 99b; \ | ||
139 | restore %g0, %g0, %g0; | ||
140 | |||
141 | #ifndef __ASSEMBLY__ | ||
142 | |||
143 | /* This makes sense. Honest it does - Anton */ | ||
144 | /* XXX Yes but it's ugly as sin. FIXME. -KMW */ | ||
145 | extern void *srmmu_nocache_pool; | ||
146 | #define __nocache_pa(VADDR) (((unsigned long)VADDR) - SRMMU_NOCACHE_VADDR + __pa((unsigned long)srmmu_nocache_pool)) | ||
147 | #define __nocache_va(PADDR) (__va((unsigned long)PADDR) - (unsigned long)srmmu_nocache_pool + SRMMU_NOCACHE_VADDR) | ||
148 | #define __nocache_fix(VADDR) __va(__nocache_pa(VADDR)) | ||
149 | |||
150 | /* Accessing the MMU control register. */ | ||
151 | extern __inline__ unsigned int srmmu_get_mmureg(void) | ||
152 | { | ||
153 | unsigned int retval; | ||
154 | __asm__ __volatile__("lda [%%g0] %1, %0\n\t" : | ||
155 | "=r" (retval) : | ||
156 | "i" (ASI_M_MMUREGS)); | ||
157 | return retval; | ||
158 | } | ||
159 | |||
160 | extern __inline__ void srmmu_set_mmureg(unsigned long regval) | ||
161 | { | ||
162 | __asm__ __volatile__("sta %0, [%%g0] %1\n\t" : : | ||
163 | "r" (regval), "i" (ASI_M_MMUREGS) : "memory"); | ||
164 | |||
165 | } | ||
166 | |||
167 | extern __inline__ void srmmu_set_ctable_ptr(unsigned long paddr) | ||
168 | { | ||
169 | paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); | ||
170 | __asm__ __volatile__("sta %0, [%1] %2\n\t" : : | ||
171 | "r" (paddr), "r" (SRMMU_CTXTBL_PTR), | ||
172 | "i" (ASI_M_MMUREGS) : | ||
173 | "memory"); | ||
174 | } | ||
175 | |||
176 | extern __inline__ unsigned long srmmu_get_ctable_ptr(void) | ||
177 | { | ||
178 | unsigned int retval; | ||
179 | |||
180 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
181 | "=r" (retval) : | ||
182 | "r" (SRMMU_CTXTBL_PTR), | ||
183 | "i" (ASI_M_MMUREGS)); | ||
184 | return (retval & SRMMU_CTX_PMASK) << 4; | ||
185 | } | ||
186 | |||
187 | extern __inline__ void srmmu_set_context(int context) | ||
188 | { | ||
189 | __asm__ __volatile__("sta %0, [%1] %2\n\t" : : | ||
190 | "r" (context), "r" (SRMMU_CTX_REG), | ||
191 | "i" (ASI_M_MMUREGS) : "memory"); | ||
192 | } | ||
193 | |||
194 | extern __inline__ int srmmu_get_context(void) | ||
195 | { | ||
196 | register int retval; | ||
197 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
198 | "=r" (retval) : | ||
199 | "r" (SRMMU_CTX_REG), | ||
200 | "i" (ASI_M_MMUREGS)); | ||
201 | return retval; | ||
202 | } | ||
203 | |||
204 | extern __inline__ unsigned int srmmu_get_fstatus(void) | ||
205 | { | ||
206 | unsigned int retval; | ||
207 | |||
208 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
209 | "=r" (retval) : | ||
210 | "r" (SRMMU_FAULT_STATUS), "i" (ASI_M_MMUREGS)); | ||
211 | return retval; | ||
212 | } | ||
213 | |||
214 | extern __inline__ unsigned int srmmu_get_faddr(void) | ||
215 | { | ||
216 | unsigned int retval; | ||
217 | |||
218 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
219 | "=r" (retval) : | ||
220 | "r" (SRMMU_FAULT_ADDR), "i" (ASI_M_MMUREGS)); | ||
221 | return retval; | ||
222 | } | ||
223 | |||
224 | /* This is guaranteed on all SRMMU's. */ | ||
225 | extern __inline__ void srmmu_flush_whole_tlb(void) | ||
226 | { | ||
227 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
228 | "r" (0x400), /* Flush entire TLB!! */ | ||
229 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
230 | |||
231 | } | ||
232 | |||
233 | /* These flush types are not available on all chips... */ | ||
234 | extern __inline__ void srmmu_flush_tlb_ctx(void) | ||
235 | { | ||
236 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
237 | "r" (0x300), /* Flush TLB ctx.. */ | ||
238 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
239 | |||
240 | } | ||
241 | |||
242 | extern __inline__ void srmmu_flush_tlb_region(unsigned long addr) | ||
243 | { | ||
244 | addr &= SRMMU_PGDIR_MASK; | ||
245 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
246 | "r" (addr | 0x200), /* Flush TLB region.. */ | ||
247 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
248 | |||
249 | } | ||
250 | |||
251 | |||
252 | extern __inline__ void srmmu_flush_tlb_segment(unsigned long addr) | ||
253 | { | ||
254 | addr &= SRMMU_REAL_PMD_MASK; | ||
255 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
256 | "r" (addr | 0x100), /* Flush TLB segment.. */ | ||
257 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
258 | |||
259 | } | ||
260 | |||
261 | extern __inline__ void srmmu_flush_tlb_page(unsigned long page) | ||
262 | { | ||
263 | page &= PAGE_MASK; | ||
264 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
265 | "r" (page), /* Flush TLB page.. */ | ||
266 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
267 | |||
268 | } | ||
269 | |||
270 | extern __inline__ unsigned long srmmu_hwprobe(unsigned long vaddr) | ||
271 | { | ||
272 | unsigned long retval; | ||
273 | |||
274 | vaddr &= PAGE_MASK; | ||
275 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
276 | "=r" (retval) : | ||
277 | "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); | ||
278 | |||
279 | return retval; | ||
280 | } | ||
281 | |||
282 | extern __inline__ int | ||
283 | srmmu_get_pte (unsigned long addr) | ||
284 | { | ||
285 | register unsigned long entry; | ||
286 | |||
287 | __asm__ __volatile__("\n\tlda [%1] %2,%0\n\t" : | ||
288 | "=r" (entry): | ||
289 | "r" ((addr & 0xfffff000) | 0x400), "i" (ASI_M_FLUSH_PROBE)); | ||
290 | return entry; | ||
291 | } | ||
292 | |||
293 | extern unsigned long (*srmmu_read_physical)(unsigned long paddr); | ||
294 | extern void (*srmmu_write_physical)(unsigned long paddr, unsigned long word); | ||
295 | |||
296 | #endif /* !(__ASSEMBLY__) */ | ||
297 | |||
298 | #endif /* !(_SPARC_PGTSRMMU_H) */ | ||
diff --git a/include/asm-sparc/pgtsun4.h b/include/asm-sparc/pgtsun4.h new file mode 100644 index 000000000000..60bda107f206 --- /dev/null +++ b/include/asm-sparc/pgtsun4.h | |||
@@ -0,0 +1,171 @@ | |||
1 | /* $Id: pgtsun4.h,v 1.5 2000/06/05 06:08:46 anton Exp $ | ||
2 | * pgtsun4.h: Sun4 specific pgtable.h defines and code. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
6 | */ | ||
7 | #ifndef _SPARC_PGTSUN4C_H | ||
8 | #define _SPARC_PGTSUN4C_H | ||
9 | |||
10 | #include <asm/contregs.h> | ||
11 | |||
12 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ | ||
13 | #define SUN4C_PMD_SHIFT 23 | ||
14 | |||
15 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
16 | #define SUN4C_PGDIR_SHIFT 23 | ||
17 | #define SUN4C_PGDIR_SIZE (1UL << SUN4C_PGDIR_SHIFT) | ||
18 | #define SUN4C_PGDIR_MASK (~(SUN4C_PGDIR_SIZE-1)) | ||
19 | #define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK) | ||
20 | |||
21 | /* To represent how the sun4c mmu really lays things out. */ | ||
22 | #define SUN4C_REAL_PGDIR_SHIFT 18 | ||
23 | #define SUN4C_REAL_PGDIR_SIZE (1UL << SUN4C_REAL_PGDIR_SHIFT) | ||
24 | #define SUN4C_REAL_PGDIR_MASK (~(SUN4C_REAL_PGDIR_SIZE-1)) | ||
25 | #define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK) | ||
26 | |||
27 | /* 19 bit PFN on sun4 */ | ||
28 | #define SUN4C_PFN_MASK 0x7ffff | ||
29 | |||
30 | /* Don't increase these unless the structures in sun4c.c are fixed */ | ||
31 | #define SUN4C_MAX_SEGMAPS 256 | ||
32 | #define SUN4C_MAX_CONTEXTS 16 | ||
33 | |||
34 | /* | ||
35 | * To be efficient, and not have to worry about allocating such | ||
36 | * a huge pgd, we make the kernel sun4c tables each hold 1024 | ||
37 | * entries and the pgd similarly just like the i386 tables. | ||
38 | */ | ||
39 | #define SUN4C_PTRS_PER_PTE 1024 | ||
40 | #define SUN4C_PTRS_PER_PMD 1 | ||
41 | #define SUN4C_PTRS_PER_PGD 1024 | ||
42 | |||
43 | /* | ||
44 | * Sparc SUN4C pte fields. | ||
45 | */ | ||
46 | #define _SUN4C_PAGE_VALID 0x80000000 | ||
47 | #define _SUN4C_PAGE_SILENT_READ 0x80000000 /* synonym */ | ||
48 | #define _SUN4C_PAGE_DIRTY 0x40000000 | ||
49 | #define _SUN4C_PAGE_SILENT_WRITE 0x40000000 /* synonym */ | ||
50 | #define _SUN4C_PAGE_PRIV 0x20000000 /* privileged page */ | ||
51 | #define _SUN4C_PAGE_NOCACHE 0x10000000 /* non-cacheable page */ | ||
52 | #define _SUN4C_PAGE_PRESENT 0x08000000 /* implemented in software */ | ||
53 | #define _SUN4C_PAGE_IO 0x04000000 /* I/O page */ | ||
54 | #define _SUN4C_PAGE_FILE 0x02000000 /* implemented in software */ | ||
55 | #define _SUN4C_PAGE_READ 0x00800000 /* implemented in software */ | ||
56 | #define _SUN4C_PAGE_WRITE 0x00400000 /* implemented in software */ | ||
57 | #define _SUN4C_PAGE_ACCESSED 0x00200000 /* implemented in software */ | ||
58 | #define _SUN4C_PAGE_MODIFIED 0x00100000 /* implemented in software */ | ||
59 | |||
60 | #define _SUN4C_READABLE (_SUN4C_PAGE_READ|_SUN4C_PAGE_SILENT_READ|\ | ||
61 | _SUN4C_PAGE_ACCESSED) | ||
62 | #define _SUN4C_WRITEABLE (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE|\ | ||
63 | _SUN4C_PAGE_MODIFIED) | ||
64 | |||
65 | #define _SUN4C_PAGE_CHG_MASK (0xffff|_SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_MODIFIED) | ||
66 | |||
67 | #define SUN4C_PAGE_NONE __pgprot(_SUN4C_PAGE_PRESENT) | ||
68 | #define SUN4C_PAGE_SHARED __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE|\ | ||
69 | _SUN4C_PAGE_WRITE) | ||
70 | #define SUN4C_PAGE_COPY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) | ||
71 | #define SUN4C_PAGE_READONLY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) | ||
72 | #define SUN4C_PAGE_KERNEL __pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\ | ||
73 | _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV) | ||
74 | |||
75 | /* SUN4C swap entry encoding | ||
76 | * | ||
77 | * We use 5 bits for the type and 19 for the offset. This gives us | ||
78 | * 32 swapfiles of 4GB each. Encoding looks like: | ||
79 | * | ||
80 | * RRRRRRRRooooooooooooooooooottttt | ||
81 | * fedcba9876543210fedcba9876543210 | ||
82 | * | ||
83 | * The top 8 bits are reserved for protection and status bits, especially | ||
84 | * FILE and PRESENT. | ||
85 | */ | ||
86 | #define SUN4C_SWP_TYPE_MASK 0x1f | ||
87 | #define SUN4C_SWP_OFF_MASK 0x7ffff | ||
88 | #define SUN4C_SWP_OFF_SHIFT 5 | ||
89 | |||
90 | #ifndef __ASSEMBLY__ | ||
91 | |||
92 | static inline unsigned long sun4c_get_synchronous_error(void) | ||
93 | { | ||
94 | unsigned long sync_err; | ||
95 | |||
96 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
97 | "=r" (sync_err) : | ||
98 | "r" (AC_SYNC_ERR), "i" (ASI_CONTROL)); | ||
99 | return sync_err; | ||
100 | } | ||
101 | |||
102 | static inline unsigned long sun4c_get_synchronous_address(void) | ||
103 | { | ||
104 | unsigned long sync_addr; | ||
105 | |||
106 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
107 | "=r" (sync_addr) : | ||
108 | "r" (AC_SYNC_VA), "i" (ASI_CONTROL)); | ||
109 | return sync_addr; | ||
110 | } | ||
111 | |||
112 | /* SUN4 pte, segmap, and context manipulation */ | ||
113 | static inline unsigned long sun4c_get_segmap(unsigned long addr) | ||
114 | { | ||
115 | register unsigned long entry; | ||
116 | |||
117 | __asm__ __volatile__("\n\tlduha [%1] %2, %0\n\t" : | ||
118 | "=r" (entry) : | ||
119 | "r" (addr), "i" (ASI_SEGMAP)); | ||
120 | return entry; | ||
121 | } | ||
122 | |||
123 | static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry) | ||
124 | { | ||
125 | __asm__ __volatile__("\n\tstha %1, [%0] %2; nop; nop; nop;\n\t" : : | ||
126 | "r" (addr), "r" (entry), | ||
127 | "i" (ASI_SEGMAP) | ||
128 | : "memory"); | ||
129 | } | ||
130 | |||
131 | static inline unsigned long sun4c_get_pte(unsigned long addr) | ||
132 | { | ||
133 | register unsigned long entry; | ||
134 | |||
135 | __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" : | ||
136 | "=r" (entry) : | ||
137 | "r" (addr), "i" (ASI_PTE)); | ||
138 | return entry; | ||
139 | } | ||
140 | |||
141 | static inline void sun4c_put_pte(unsigned long addr, unsigned long entry) | ||
142 | { | ||
143 | __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : : | ||
144 | "r" (addr), | ||
145 | "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE) | ||
146 | : "memory"); | ||
147 | } | ||
148 | |||
149 | static inline int sun4c_get_context(void) | ||
150 | { | ||
151 | register int ctx; | ||
152 | |||
153 | __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : | ||
154 | "=r" (ctx) : | ||
155 | "r" (AC_CONTEXT), "i" (ASI_CONTROL)); | ||
156 | |||
157 | return ctx; | ||
158 | } | ||
159 | |||
160 | static inline int sun4c_set_context(int ctx) | ||
161 | { | ||
162 | __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : : | ||
163 | "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL) | ||
164 | : "memory"); | ||
165 | |||
166 | return ctx; | ||
167 | } | ||
168 | |||
169 | #endif /* !(__ASSEMBLY__) */ | ||
170 | |||
171 | #endif /* !(_SPARC_PGTSUN4_H) */ | ||
diff --git a/include/asm-sparc/pgtsun4c.h b/include/asm-sparc/pgtsun4c.h new file mode 100644 index 000000000000..f53b6dbc5fe3 --- /dev/null +++ b/include/asm-sparc/pgtsun4c.h | |||
@@ -0,0 +1,172 @@ | |||
1 | /* $Id: pgtsun4c.h,v 1.37 2000/06/05 06:08:46 anton Exp $ | ||
2 | * pgtsun4c.h: Sun4c specific pgtable.h defines and code. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | #ifndef _SPARC_PGTSUN4C_H | ||
7 | #define _SPARC_PGTSUN4C_H | ||
8 | |||
9 | #include <asm/contregs.h> | ||
10 | |||
11 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ | ||
12 | #define SUN4C_PMD_SHIFT 22 | ||
13 | |||
14 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
15 | #define SUN4C_PGDIR_SHIFT 22 | ||
16 | #define SUN4C_PGDIR_SIZE (1UL << SUN4C_PGDIR_SHIFT) | ||
17 | #define SUN4C_PGDIR_MASK (~(SUN4C_PGDIR_SIZE-1)) | ||
18 | #define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK) | ||
19 | |||
20 | /* To represent how the sun4c mmu really lays things out. */ | ||
21 | #define SUN4C_REAL_PGDIR_SHIFT 18 | ||
22 | #define SUN4C_REAL_PGDIR_SIZE (1UL << SUN4C_REAL_PGDIR_SHIFT) | ||
23 | #define SUN4C_REAL_PGDIR_MASK (~(SUN4C_REAL_PGDIR_SIZE-1)) | ||
24 | #define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK) | ||
25 | |||
26 | /* 16 bit PFN on sun4c */ | ||
27 | #define SUN4C_PFN_MASK 0xffff | ||
28 | |||
29 | /* Don't increase these unless the structures in sun4c.c are fixed */ | ||
30 | #define SUN4C_MAX_SEGMAPS 256 | ||
31 | #define SUN4C_MAX_CONTEXTS 16 | ||
32 | |||
33 | /* | ||
34 | * To be efficient, and not have to worry about allocating such | ||
35 | * a huge pgd, we make the kernel sun4c tables each hold 1024 | ||
36 | * entries and the pgd similarly just like the i386 tables. | ||
37 | */ | ||
38 | #define SUN4C_PTRS_PER_PTE 1024 | ||
39 | #define SUN4C_PTRS_PER_PMD 1 | ||
40 | #define SUN4C_PTRS_PER_PGD 1024 | ||
41 | |||
42 | /* | ||
43 | * Sparc SUN4C pte fields. | ||
44 | */ | ||
45 | #define _SUN4C_PAGE_VALID 0x80000000 | ||
46 | #define _SUN4C_PAGE_SILENT_READ 0x80000000 /* synonym */ | ||
47 | #define _SUN4C_PAGE_DIRTY 0x40000000 | ||
48 | #define _SUN4C_PAGE_SILENT_WRITE 0x40000000 /* synonym */ | ||
49 | #define _SUN4C_PAGE_PRIV 0x20000000 /* privileged page */ | ||
50 | #define _SUN4C_PAGE_NOCACHE 0x10000000 /* non-cacheable page */ | ||
51 | #define _SUN4C_PAGE_PRESENT 0x08000000 /* implemented in software */ | ||
52 | #define _SUN4C_PAGE_IO 0x04000000 /* I/O page */ | ||
53 | #define _SUN4C_PAGE_FILE 0x02000000 /* implemented in software */ | ||
54 | #define _SUN4C_PAGE_READ 0x00800000 /* implemented in software */ | ||
55 | #define _SUN4C_PAGE_WRITE 0x00400000 /* implemented in software */ | ||
56 | #define _SUN4C_PAGE_ACCESSED 0x00200000 /* implemented in software */ | ||
57 | #define _SUN4C_PAGE_MODIFIED 0x00100000 /* implemented in software */ | ||
58 | |||
59 | #define _SUN4C_READABLE (_SUN4C_PAGE_READ|_SUN4C_PAGE_SILENT_READ|\ | ||
60 | _SUN4C_PAGE_ACCESSED) | ||
61 | #define _SUN4C_WRITEABLE (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE|\ | ||
62 | _SUN4C_PAGE_MODIFIED) | ||
63 | |||
64 | #define _SUN4C_PAGE_CHG_MASK (0xffff|_SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_MODIFIED) | ||
65 | |||
66 | #define SUN4C_PAGE_NONE __pgprot(_SUN4C_PAGE_PRESENT) | ||
67 | #define SUN4C_PAGE_SHARED __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE|\ | ||
68 | _SUN4C_PAGE_WRITE) | ||
69 | #define SUN4C_PAGE_COPY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) | ||
70 | #define SUN4C_PAGE_READONLY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) | ||
71 | #define SUN4C_PAGE_KERNEL __pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\ | ||
72 | _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV) | ||
73 | |||
74 | /* SUN4C swap entry encoding | ||
75 | * | ||
76 | * We use 5 bits for the type and 19 for the offset. This gives us | ||
77 | * 32 swapfiles of 4GB each. Encoding looks like: | ||
78 | * | ||
79 | * RRRRRRRRooooooooooooooooooottttt | ||
80 | * fedcba9876543210fedcba9876543210 | ||
81 | * | ||
82 | * The top 8 bits are reserved for protection and status bits, especially | ||
83 | * FILE and PRESENT. | ||
84 | */ | ||
85 | #define SUN4C_SWP_TYPE_MASK 0x1f | ||
86 | #define SUN4C_SWP_OFF_MASK 0x7ffff | ||
87 | #define SUN4C_SWP_OFF_SHIFT 5 | ||
88 | |||
89 | #ifndef __ASSEMBLY__ | ||
90 | |||
91 | static inline unsigned long sun4c_get_synchronous_error(void) | ||
92 | { | ||
93 | unsigned long sync_err; | ||
94 | |||
95 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
96 | "=r" (sync_err) : | ||
97 | "r" (AC_SYNC_ERR), "i" (ASI_CONTROL)); | ||
98 | return sync_err; | ||
99 | } | ||
100 | |||
101 | static inline unsigned long sun4c_get_synchronous_address(void) | ||
102 | { | ||
103 | unsigned long sync_addr; | ||
104 | |||
105 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
106 | "=r" (sync_addr) : | ||
107 | "r" (AC_SYNC_VA), "i" (ASI_CONTROL)); | ||
108 | return sync_addr; | ||
109 | } | ||
110 | |||
111 | /* SUN4C pte, segmap, and context manipulation */ | ||
112 | static inline unsigned long sun4c_get_segmap(unsigned long addr) | ||
113 | { | ||
114 | register unsigned long entry; | ||
115 | |||
116 | __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : | ||
117 | "=r" (entry) : | ||
118 | "r" (addr), "i" (ASI_SEGMAP)); | ||
119 | |||
120 | return entry; | ||
121 | } | ||
122 | |||
123 | static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry) | ||
124 | { | ||
125 | |||
126 | __asm__ __volatile__("\n\tstba %1, [%0] %2; nop; nop; nop;\n\t" : : | ||
127 | "r" (addr), "r" (entry), | ||
128 | "i" (ASI_SEGMAP) | ||
129 | : "memory"); | ||
130 | } | ||
131 | |||
132 | static inline unsigned long sun4c_get_pte(unsigned long addr) | ||
133 | { | ||
134 | register unsigned long entry; | ||
135 | |||
136 | __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" : | ||
137 | "=r" (entry) : | ||
138 | "r" (addr), "i" (ASI_PTE)); | ||
139 | return entry; | ||
140 | } | ||
141 | |||
142 | static inline void sun4c_put_pte(unsigned long addr, unsigned long entry) | ||
143 | { | ||
144 | __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : : | ||
145 | "r" (addr), | ||
146 | "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE) | ||
147 | : "memory"); | ||
148 | } | ||
149 | |||
150 | static inline int sun4c_get_context(void) | ||
151 | { | ||
152 | register int ctx; | ||
153 | |||
154 | __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : | ||
155 | "=r" (ctx) : | ||
156 | "r" (AC_CONTEXT), "i" (ASI_CONTROL)); | ||
157 | |||
158 | return ctx; | ||
159 | } | ||
160 | |||
161 | static inline int sun4c_set_context(int ctx) | ||
162 | { | ||
163 | __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : : | ||
164 | "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL) | ||
165 | : "memory"); | ||
166 | |||
167 | return ctx; | ||
168 | } | ||
169 | |||
170 | #endif /* !(__ASSEMBLY__) */ | ||
171 | |||
172 | #endif /* !(_SPARC_PGTSUN4C_H) */ | ||
diff --git a/include/asm-sparc/poll.h b/include/asm-sparc/poll.h new file mode 100644 index 000000000000..3ddcc6481f09 --- /dev/null +++ b/include/asm-sparc/poll.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __SPARC_POLL_H | ||
2 | #define __SPARC_POLL_H | ||
3 | |||
4 | #define POLLIN 1 | ||
5 | #define POLLPRI 2 | ||
6 | #define POLLOUT 4 | ||
7 | #define POLLERR 8 | ||
8 | #define POLLHUP 16 | ||
9 | #define POLLNVAL 32 | ||
10 | #define POLLRDNORM 64 | ||
11 | #define POLLWRNORM POLLOUT | ||
12 | #define POLLRDBAND 128 | ||
13 | #define POLLWRBAND 256 | ||
14 | #define POLLMSG 512 | ||
15 | #define POLLREMOVE 1024 | ||
16 | |||
17 | struct pollfd { | ||
18 | int fd; | ||
19 | short events; | ||
20 | short revents; | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/include/asm-sparc/posix_types.h b/include/asm-sparc/posix_types.h new file mode 100644 index 000000000000..9ef1b3db4cbf --- /dev/null +++ b/include/asm-sparc/posix_types.h | |||
@@ -0,0 +1,122 @@ | |||
1 | #ifndef __ARCH_SPARC_POSIX_TYPES_H | ||
2 | #define __ARCH_SPARC_POSIX_TYPES_H | ||
3 | |||
4 | /* | ||
5 | * This file is generally used by user-level software, so you need to | ||
6 | * be a little careful about namespace pollution etc. Also, we cannot | ||
7 | * assume GCC is being used. | ||
8 | */ | ||
9 | |||
10 | typedef unsigned int __kernel_size_t; | ||
11 | typedef int __kernel_ssize_t; | ||
12 | typedef long int __kernel_ptrdiff_t; | ||
13 | typedef long __kernel_time_t; | ||
14 | typedef long __kernel_suseconds_t; | ||
15 | typedef long __kernel_clock_t; | ||
16 | typedef int __kernel_pid_t; | ||
17 | typedef unsigned short __kernel_ipc_pid_t; | ||
18 | typedef unsigned short __kernel_uid_t; | ||
19 | typedef unsigned short __kernel_gid_t; | ||
20 | typedef unsigned long __kernel_ino_t; | ||
21 | typedef unsigned short __kernel_mode_t; | ||
22 | typedef unsigned short __kernel_umode_t; | ||
23 | typedef short __kernel_nlink_t; | ||
24 | typedef long __kernel_daddr_t; | ||
25 | typedef long __kernel_off_t; | ||
26 | typedef char * __kernel_caddr_t; | ||
27 | typedef unsigned short __kernel_uid16_t; | ||
28 | typedef unsigned short __kernel_gid16_t; | ||
29 | typedef unsigned int __kernel_uid32_t; | ||
30 | typedef unsigned int __kernel_gid32_t; | ||
31 | typedef unsigned short __kernel_old_uid_t; | ||
32 | typedef unsigned short __kernel_old_gid_t; | ||
33 | typedef unsigned short __kernel_old_dev_t; | ||
34 | typedef int __kernel_clockid_t; | ||
35 | typedef int __kernel_timer_t; | ||
36 | |||
37 | #ifdef __GNUC__ | ||
38 | typedef long long __kernel_loff_t; | ||
39 | #endif | ||
40 | |||
41 | typedef struct { | ||
42 | #if defined(__KERNEL__) || defined(__USE_ALL) | ||
43 | int val[2]; | ||
44 | #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
45 | int __val[2]; | ||
46 | #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
47 | } __kernel_fsid_t; | ||
48 | |||
49 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | ||
50 | |||
51 | #undef __FD_SET | ||
52 | static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) | ||
53 | { | ||
54 | unsigned long _tmp = fd / __NFDBITS; | ||
55 | unsigned long _rem = fd % __NFDBITS; | ||
56 | fdsetp->fds_bits[_tmp] |= (1UL<<_rem); | ||
57 | } | ||
58 | |||
59 | #undef __FD_CLR | ||
60 | static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) | ||
61 | { | ||
62 | unsigned long _tmp = fd / __NFDBITS; | ||
63 | unsigned long _rem = fd % __NFDBITS; | ||
64 | fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); | ||
65 | } | ||
66 | |||
67 | #undef __FD_ISSET | ||
68 | static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p) | ||
69 | { | ||
70 | unsigned long _tmp = fd / __NFDBITS; | ||
71 | unsigned long _rem = fd % __NFDBITS; | ||
72 | return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; | ||
73 | } | ||
74 | |||
75 | /* | ||
76 | * This will unroll the loop for the normal constant cases (8 or 32 longs, | ||
77 | * for 256 and 1024-bit fd_sets respectively) | ||
78 | */ | ||
79 | #undef __FD_ZERO | ||
80 | static __inline__ void __FD_ZERO(__kernel_fd_set *p) | ||
81 | { | ||
82 | unsigned long *tmp = p->fds_bits; | ||
83 | int i; | ||
84 | |||
85 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
86 | switch (__FDSET_LONGS) { | ||
87 | case 32: | ||
88 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
89 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
90 | tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; | ||
91 | tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; | ||
92 | tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0; | ||
93 | tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0; | ||
94 | tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0; | ||
95 | tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0; | ||
96 | return; | ||
97 | case 16: | ||
98 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
99 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
100 | tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; | ||
101 | tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; | ||
102 | return; | ||
103 | case 8: | ||
104 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
105 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
106 | return; | ||
107 | case 4: | ||
108 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
109 | return; | ||
110 | } | ||
111 | } | ||
112 | i = __FDSET_LONGS; | ||
113 | while (i) { | ||
114 | i--; | ||
115 | *tmp = 0; | ||
116 | tmp++; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | ||
121 | |||
122 | #endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */ | ||
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h new file mode 100644 index 000000000000..32c9699367cf --- /dev/null +++ b/include/asm-sparc/processor.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* $Id: processor.h,v 1.83 2001/10/08 09:32:13 davem Exp $ | ||
2 | * include/asm-sparc/processor.h | ||
3 | * | ||
4 | * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef __ASM_SPARC_PROCESSOR_H | ||
8 | #define __ASM_SPARC_PROCESSOR_H | ||
9 | |||
10 | /* | ||
11 | * Sparc32 implementation of macro that returns current | ||
12 | * instruction pointer ("program counter"). | ||
13 | */ | ||
14 | #define current_text_addr() ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; }) | ||
15 | |||
16 | #include <linux/a.out.h> | ||
17 | |||
18 | #include <asm/psr.h> | ||
19 | #include <asm/ptrace.h> | ||
20 | #include <asm/head.h> | ||
21 | #include <asm/signal.h> | ||
22 | #include <asm/segment.h> | ||
23 | #include <asm/btfixup.h> | ||
24 | #include <asm/page.h> | ||
25 | |||
26 | /* | ||
27 | * The sparc has no problems with write protection | ||
28 | */ | ||
29 | #define wp_works_ok 1 | ||
30 | #define wp_works_ok__is_a_macro /* for versions in ksyms.c */ | ||
31 | |||
32 | /* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too... | ||
33 | * That one page is used to protect kernel from intruders, so that | ||
34 | * we can make our access_ok test faster | ||
35 | */ | ||
36 | #define TASK_SIZE PAGE_OFFSET | ||
37 | |||
38 | struct task_struct; | ||
39 | |||
40 | #ifdef __KERNEL__ | ||
41 | struct fpq { | ||
42 | unsigned long *insn_addr; | ||
43 | unsigned long insn; | ||
44 | }; | ||
45 | #endif | ||
46 | |||
47 | typedef struct { | ||
48 | int seg; | ||
49 | } mm_segment_t; | ||
50 | |||
51 | /* The Sparc processor specific thread struct. */ | ||
52 | struct thread_struct { | ||
53 | struct pt_regs *kregs; | ||
54 | unsigned int _pad1; | ||
55 | |||
56 | /* Special child fork kpsr/kwim values. */ | ||
57 | unsigned long fork_kpsr __attribute__ ((aligned (8))); | ||
58 | unsigned long fork_kwim; | ||
59 | |||
60 | /* Floating point regs */ | ||
61 | unsigned long float_regs[32] __attribute__ ((aligned (8))); | ||
62 | unsigned long fsr; | ||
63 | unsigned long fpqdepth; | ||
64 | struct fpq fpqueue[16]; | ||
65 | unsigned long flags; | ||
66 | mm_segment_t current_ds; | ||
67 | struct exec core_exec; /* just what it says. */ | ||
68 | int new_signal; | ||
69 | }; | ||
70 | |||
71 | #define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */ | ||
72 | #define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */ | ||
73 | |||
74 | #define INIT_THREAD { \ | ||
75 | .flags = SPARC_FLAG_KTHREAD, \ | ||
76 | .current_ds = KERNEL_DS, \ | ||
77 | } | ||
78 | |||
79 | /* Return saved PC of a blocked thread. */ | ||
80 | extern unsigned long thread_saved_pc(struct task_struct *t); | ||
81 | |||
82 | /* Do necessary setup to start up a newly executed thread. */ | ||
83 | extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, | ||
84 | unsigned long sp) | ||
85 | { | ||
86 | register unsigned long zero asm("g1"); | ||
87 | |||
88 | regs->psr = (regs->psr & (PSR_CWP)) | PSR_S; | ||
89 | regs->pc = ((pc & (~3)) - 4); | ||
90 | regs->npc = regs->pc + 4; | ||
91 | regs->y = 0; | ||
92 | zero = 0; | ||
93 | __asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t" | ||
94 | "std\t%%g0, [%0 + %3 + 0x08]\n\t" | ||
95 | "std\t%%g0, [%0 + %3 + 0x10]\n\t" | ||
96 | "std\t%%g0, [%0 + %3 + 0x18]\n\t" | ||
97 | "std\t%%g0, [%0 + %3 + 0x20]\n\t" | ||
98 | "std\t%%g0, [%0 + %3 + 0x28]\n\t" | ||
99 | "std\t%%g0, [%0 + %3 + 0x30]\n\t" | ||
100 | "st\t%1, [%0 + %3 + 0x38]\n\t" | ||
101 | "st\t%%g0, [%0 + %3 + 0x3c]" | ||
102 | : /* no outputs */ | ||
103 | : "r" (regs), | ||
104 | "r" (sp - sizeof(struct reg_window)), | ||
105 | "r" (zero), | ||
106 | "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])) | ||
107 | : "memory"); | ||
108 | } | ||
109 | |||
110 | /* Free all resources held by a thread. */ | ||
111 | #define release_thread(tsk) do { } while(0) | ||
112 | extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
113 | |||
114 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
115 | #define prepare_to_copy(tsk) do { } while (0) | ||
116 | |||
117 | extern unsigned long get_wchan(struct task_struct *); | ||
118 | |||
119 | #define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc) | ||
120 | #define KSTK_ESP(tsk) ((tsk)->thread.kregs->u_regs[UREG_FP]) | ||
121 | |||
122 | #ifdef __KERNEL__ | ||
123 | |||
124 | extern struct task_struct *last_task_used_math; | ||
125 | |||
126 | #define cpu_relax() barrier() | ||
127 | |||
128 | #endif | ||
129 | |||
130 | #endif /* __ASM_SPARC_PROCESSOR_H */ | ||
diff --git a/include/asm-sparc/psr.h b/include/asm-sparc/psr.h new file mode 100644 index 000000000000..9778b8c8b15b --- /dev/null +++ b/include/asm-sparc/psr.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* $Id: psr.h,v 1.15 1997/10/04 08:54:22 ecd Exp $ | ||
2 | * psr.h: This file holds the macros for masking off various parts of | ||
3 | * the processor status register on the Sparc. This is valid | ||
4 | * for Version 8. On the V9 this is renamed to the PSTATE | ||
5 | * register and its members are accessed as fields like | ||
6 | * PSTATE.PRIV for the current CPU privilege level. | ||
7 | * | ||
8 | * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) | ||
9 | */ | ||
10 | |||
11 | #ifndef __LINUX_SPARC_PSR_H | ||
12 | #define __LINUX_SPARC_PSR_H | ||
13 | |||
14 | /* The Sparc PSR fields are laid out as the following: | ||
15 | * | ||
16 | * ------------------------------------------------------------------------ | ||
17 | * | impl | vers | icc | resv | EC | EF | PIL | S | PS | ET | CWP | | ||
18 | * | 31-28 | 27-24 | 23-20 | 19-14 | 13 | 12 | 11-8 | 7 | 6 | 5 | 4-0 | | ||
19 | * ------------------------------------------------------------------------ | ||
20 | */ | ||
21 | #define PSR_CWP 0x0000001f /* current window pointer */ | ||
22 | #define PSR_ET 0x00000020 /* enable traps field */ | ||
23 | #define PSR_PS 0x00000040 /* previous privilege level */ | ||
24 | #define PSR_S 0x00000080 /* current privilege level */ | ||
25 | #define PSR_PIL 0x00000f00 /* processor interrupt level */ | ||
26 | #define PSR_EF 0x00001000 /* enable floating point */ | ||
27 | #define PSR_EC 0x00002000 /* enable co-processor */ | ||
28 | #define PSR_LE 0x00008000 /* SuperSparcII little-endian */ | ||
29 | #define PSR_ICC 0x00f00000 /* integer condition codes */ | ||
30 | #define PSR_C 0x00100000 /* carry bit */ | ||
31 | #define PSR_V 0x00200000 /* overflow bit */ | ||
32 | #define PSR_Z 0x00400000 /* zero bit */ | ||
33 | #define PSR_N 0x00800000 /* negative bit */ | ||
34 | #define PSR_VERS 0x0f000000 /* cpu-version field */ | ||
35 | #define PSR_IMPL 0xf0000000 /* cpu-implementation field */ | ||
36 | |||
37 | #ifdef __KERNEL__ | ||
38 | |||
39 | #ifndef __ASSEMBLY__ | ||
40 | /* Get the %psr register. */ | ||
41 | extern __inline__ unsigned int get_psr(void) | ||
42 | { | ||
43 | unsigned int psr; | ||
44 | __asm__ __volatile__( | ||
45 | "rd %%psr, %0\n\t" | ||
46 | "nop\n\t" | ||
47 | "nop\n\t" | ||
48 | "nop\n\t" | ||
49 | : "=r" (psr) | ||
50 | : /* no inputs */ | ||
51 | : "memory"); | ||
52 | |||
53 | return psr; | ||
54 | } | ||
55 | |||
56 | extern __inline__ void put_psr(unsigned int new_psr) | ||
57 | { | ||
58 | __asm__ __volatile__( | ||
59 | "wr %0, 0x0, %%psr\n\t" | ||
60 | "nop\n\t" | ||
61 | "nop\n\t" | ||
62 | "nop\n\t" | ||
63 | : /* no outputs */ | ||
64 | : "r" (new_psr) | ||
65 | : "memory", "cc"); | ||
66 | } | ||
67 | |||
68 | /* Get the %fsr register. Be careful, make sure the floating point | ||
69 | * enable bit is set in the %psr when you execute this or you will | ||
70 | * incur a trap. | ||
71 | */ | ||
72 | |||
73 | extern unsigned int fsr_storage; | ||
74 | |||
75 | extern __inline__ unsigned int get_fsr(void) | ||
76 | { | ||
77 | unsigned int fsr = 0; | ||
78 | |||
79 | __asm__ __volatile__( | ||
80 | "st %%fsr, %1\n\t" | ||
81 | "ld %1, %0\n\t" | ||
82 | : "=r" (fsr) | ||
83 | : "m" (fsr_storage)); | ||
84 | |||
85 | return fsr; | ||
86 | } | ||
87 | |||
88 | #endif /* !(__ASSEMBLY__) */ | ||
89 | |||
90 | #endif /* (__KERNEL__) */ | ||
91 | |||
92 | #endif /* !(__LINUX_SPARC_PSR_H) */ | ||
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h new file mode 100644 index 000000000000..dd9d94d7e0ae --- /dev/null +++ b/include/asm-sparc/ptrace.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* $Id: ptrace.h,v 1.25 1997/03/04 16:27:25 jj Exp $ */ | ||
2 | #ifndef _SPARC_PTRACE_H | ||
3 | #define _SPARC_PTRACE_H | ||
4 | |||
5 | #include <asm/psr.h> | ||
6 | |||
7 | /* This struct defines the way the registers are stored on the | ||
8 | * stack during a system call and basically all traps. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASSEMBLY__ | ||
12 | |||
13 | struct pt_regs { | ||
14 | unsigned long psr; | ||
15 | unsigned long pc; | ||
16 | unsigned long npc; | ||
17 | unsigned long y; | ||
18 | unsigned long u_regs[16]; /* globals and ins */ | ||
19 | }; | ||
20 | |||
21 | #define UREG_G0 0 | ||
22 | #define UREG_G1 1 | ||
23 | #define UREG_G2 2 | ||
24 | #define UREG_G3 3 | ||
25 | #define UREG_G4 4 | ||
26 | #define UREG_G5 5 | ||
27 | #define UREG_G6 6 | ||
28 | #define UREG_G7 7 | ||
29 | #define UREG_I0 8 | ||
30 | #define UREG_I1 9 | ||
31 | #define UREG_I2 10 | ||
32 | #define UREG_I3 11 | ||
33 | #define UREG_I4 12 | ||
34 | #define UREG_I5 13 | ||
35 | #define UREG_I6 14 | ||
36 | #define UREG_I7 15 | ||
37 | #define UREG_WIM UREG_G0 | ||
38 | #define UREG_FADDR UREG_G0 | ||
39 | #define UREG_FP UREG_I6 | ||
40 | #define UREG_RETPC UREG_I7 | ||
41 | |||
42 | /* A register window */ | ||
43 | struct reg_window { | ||
44 | unsigned long locals[8]; | ||
45 | unsigned long ins[8]; | ||
46 | }; | ||
47 | |||
48 | /* A Sparc stack frame */ | ||
49 | struct sparc_stackf { | ||
50 | unsigned long locals[8]; | ||
51 | unsigned long ins[6]; | ||
52 | struct sparc_stackf *fp; | ||
53 | unsigned long callers_pc; | ||
54 | char *structptr; | ||
55 | unsigned long xargs[6]; | ||
56 | unsigned long xxargs[1]; | ||
57 | }; | ||
58 | |||
59 | #define TRACEREG_SZ sizeof(struct pt_regs) | ||
60 | #define STACKFRAME_SZ sizeof(struct sparc_stackf) | ||
61 | |||
62 | #ifdef __KERNEL__ | ||
63 | #define user_mode(regs) (!((regs)->psr & PSR_PS)) | ||
64 | #define instruction_pointer(regs) ((regs)->pc) | ||
65 | unsigned long profile_pc(struct pt_regs *); | ||
66 | extern void show_regs(struct pt_regs *); | ||
67 | #endif | ||
68 | |||
69 | #else /* __ASSEMBLY__ */ | ||
70 | /* For assembly code. */ | ||
71 | #define TRACEREG_SZ 0x50 | ||
72 | #define STACKFRAME_SZ 0x60 | ||
73 | #endif | ||
74 | |||
75 | /* | ||
76 | * The asm_offsets.h is a generated file, so we cannot include it. | ||
77 | * It may be OK for glibc headers, but it's utterly pointless for C code. | ||
78 | * The assembly code using those offsets has to include it explicitly. | ||
79 | */ | ||
80 | /* #include <asm/asm_offsets.h> */ | ||
81 | |||
82 | /* These are for pt_regs. */ | ||
83 | #define PT_PSR 0x0 | ||
84 | #define PT_PC 0x4 | ||
85 | #define PT_NPC 0x8 | ||
86 | #define PT_Y 0xc | ||
87 | #define PT_G0 0x10 | ||
88 | #define PT_WIM PT_G0 | ||
89 | #define PT_G1 0x14 | ||
90 | #define PT_G2 0x18 | ||
91 | #define PT_G3 0x1c | ||
92 | #define PT_G4 0x20 | ||
93 | #define PT_G5 0x24 | ||
94 | #define PT_G6 0x28 | ||
95 | #define PT_G7 0x2c | ||
96 | #define PT_I0 0x30 | ||
97 | #define PT_I1 0x34 | ||
98 | #define PT_I2 0x38 | ||
99 | #define PT_I3 0x3c | ||
100 | #define PT_I4 0x40 | ||
101 | #define PT_I5 0x44 | ||
102 | #define PT_I6 0x48 | ||
103 | #define PT_FP PT_I6 | ||
104 | #define PT_I7 0x4c | ||
105 | |||
106 | /* Reg_window offsets */ | ||
107 | #define RW_L0 0x00 | ||
108 | #define RW_L1 0x04 | ||
109 | #define RW_L2 0x08 | ||
110 | #define RW_L3 0x0c | ||
111 | #define RW_L4 0x10 | ||
112 | #define RW_L5 0x14 | ||
113 | #define RW_L6 0x18 | ||
114 | #define RW_L7 0x1c | ||
115 | #define RW_I0 0x20 | ||
116 | #define RW_I1 0x24 | ||
117 | #define RW_I2 0x28 | ||
118 | #define RW_I3 0x2c | ||
119 | #define RW_I4 0x30 | ||
120 | #define RW_I5 0x34 | ||
121 | #define RW_I6 0x38 | ||
122 | #define RW_I7 0x3c | ||
123 | |||
124 | /* Stack_frame offsets */ | ||
125 | #define SF_L0 0x00 | ||
126 | #define SF_L1 0x04 | ||
127 | #define SF_L2 0x08 | ||
128 | #define SF_L3 0x0c | ||
129 | #define SF_L4 0x10 | ||
130 | #define SF_L5 0x14 | ||
131 | #define SF_L6 0x18 | ||
132 | #define SF_L7 0x1c | ||
133 | #define SF_I0 0x20 | ||
134 | #define SF_I1 0x24 | ||
135 | #define SF_I2 0x28 | ||
136 | #define SF_I3 0x2c | ||
137 | #define SF_I4 0x30 | ||
138 | #define SF_I5 0x34 | ||
139 | #define SF_FP 0x38 | ||
140 | #define SF_PC 0x3c | ||
141 | #define SF_RETP 0x40 | ||
142 | #define SF_XARG0 0x44 | ||
143 | #define SF_XARG1 0x48 | ||
144 | #define SF_XARG2 0x4c | ||
145 | #define SF_XARG3 0x50 | ||
146 | #define SF_XARG4 0x54 | ||
147 | #define SF_XARG5 0x58 | ||
148 | #define SF_XXARG 0x5c | ||
149 | |||
150 | /* Stuff for the ptrace system call */ | ||
151 | #define PTRACE_SUNATTACH 10 | ||
152 | #define PTRACE_SUNDETACH 11 | ||
153 | #define PTRACE_GETREGS 12 | ||
154 | #define PTRACE_SETREGS 13 | ||
155 | #define PTRACE_GETFPREGS 14 | ||
156 | #define PTRACE_SETFPREGS 15 | ||
157 | #define PTRACE_READDATA 16 | ||
158 | #define PTRACE_WRITEDATA 17 | ||
159 | #define PTRACE_READTEXT 18 | ||
160 | #define PTRACE_WRITETEXT 19 | ||
161 | #define PTRACE_GETFPAREGS 20 | ||
162 | #define PTRACE_SETFPAREGS 21 | ||
163 | |||
164 | #define PTRACE_GETUCODE 29 /* stupid bsd-ism */ | ||
165 | |||
166 | |||
167 | #endif /* !(_SPARC_PTRACE_H) */ | ||
diff --git a/include/asm-sparc/reg.h b/include/asm-sparc/reg.h new file mode 100644 index 000000000000..ed60ebec5930 --- /dev/null +++ b/include/asm-sparc/reg.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * linux/asm-sparc/reg.h | ||
3 | * Layout of the registers as expected by gdb on the Sparc | ||
4 | * we should replace the user.h definitions with those in | ||
5 | * this file, we don't even use the other | ||
6 | * -miguel | ||
7 | * | ||
8 | * The names of the structures, constants and aliases in this file | ||
9 | * have the same names as the sunos ones, some programs rely on these | ||
10 | * names (gdb for example). | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef __SPARC_REG_H | ||
15 | #define __SPARC_REG_H | ||
16 | |||
17 | struct regs { | ||
18 | int r_psr; | ||
19 | #define r_ps r_psr | ||
20 | int r_pc; | ||
21 | int r_npc; | ||
22 | int r_y; | ||
23 | int r_g1; | ||
24 | int r_g2; | ||
25 | int r_g3; | ||
26 | int r_g4; | ||
27 | int r_g5; | ||
28 | int r_g6; | ||
29 | int r_g7; | ||
30 | int r_o0; | ||
31 | int r_o1; | ||
32 | int r_o2; | ||
33 | int r_o3; | ||
34 | int r_o4; | ||
35 | int r_o5; | ||
36 | int r_o6; | ||
37 | int r_o7; | ||
38 | }; | ||
39 | |||
40 | struct fpq { | ||
41 | unsigned long *addr; | ||
42 | unsigned long instr; | ||
43 | }; | ||
44 | |||
45 | struct fq { | ||
46 | union { | ||
47 | double whole; | ||
48 | struct fpq fpq; | ||
49 | } FQu; | ||
50 | }; | ||
51 | |||
52 | #define FPU_REGS_TYPE unsigned int | ||
53 | #define FPU_FSR_TYPE unsigned | ||
54 | |||
55 | struct fp_status { | ||
56 | union { | ||
57 | FPU_REGS_TYPE Fpu_regs[32]; | ||
58 | double Fpu_dregs[16]; | ||
59 | } fpu_fr; | ||
60 | FPU_FSR_TYPE Fpu_fsr; | ||
61 | unsigned Fpu_flags; | ||
62 | unsigned Fpu_extra; | ||
63 | unsigned Fpu_qcnt; | ||
64 | struct fq Fpu_q[16]; | ||
65 | }; | ||
66 | |||
67 | #define fpu_regs f_fpstatus.fpu_fr.Fpu_regs | ||
68 | #define fpu_dregs f_fpstatus.fpu_fr.Fpu_dregs | ||
69 | #define fpu_fsr f_fpstatus.Fpu_fsr | ||
70 | #define fpu_flags f_fpstatus.Fpu_flags | ||
71 | #define fpu_extra f_fpstatus.Fpu_extra | ||
72 | #define fpu_q f_fpstatus.Fpu_q | ||
73 | #define fpu_qcnt f_fpstatus.Fpu_qcnt | ||
74 | |||
75 | struct fpu { | ||
76 | struct fp_status f_fpstatus; | ||
77 | }; | ||
78 | |||
79 | #endif /* __SPARC_REG_H */ | ||
diff --git a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h new file mode 100644 index 000000000000..0514c304e130 --- /dev/null +++ b/include/asm-sparc/resource.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* $Id: resource.h,v 1.12 2000/09/23 02:09:21 davem Exp $ | ||
2 | * resource.h: Resource definitions. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_RESOURCE_H | ||
8 | #define _SPARC_RESOURCE_H | ||
9 | |||
10 | /* | ||
11 | * These two resource limit IDs have a Sparc/Linux-specific ordering, | ||
12 | * the rest comes from the generic header: | ||
13 | */ | ||
14 | #define RLIMIT_NOFILE 6 /* max number of open files */ | ||
15 | #define RLIMIT_NPROC 7 /* max number of processes */ | ||
16 | |||
17 | /* | ||
18 | * SuS says limits have to be unsigned. | ||
19 | * We make this unsigned, but keep the | ||
20 | * old value for compatibility: | ||
21 | */ | ||
22 | #define RLIM_INFINITY 0x7fffffff | ||
23 | |||
24 | #include <asm-generic/resource.h> | ||
25 | |||
26 | #endif /* !(_SPARC_RESOURCE_H) */ | ||
diff --git a/include/asm-sparc/ross.h b/include/asm-sparc/ross.h new file mode 100644 index 000000000000..f2c14b5080ed --- /dev/null +++ b/include/asm-sparc/ross.h | |||
@@ -0,0 +1,191 @@ | |||
1 | /* $Id: ross.h,v 1.13 1998/01/07 06:49:11 baccala Exp $ | ||
2 | * ross.h: Ross module specific definitions and defines. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_ROSS_H | ||
8 | #define _SPARC_ROSS_H | ||
9 | |||
10 | #include <asm/asi.h> | ||
11 | #include <asm/page.h> | ||
12 | |||
13 | /* Ross made Hypersparcs have a %psr 'impl' field of '0001'. The 'vers' | ||
14 | * field has '1111'. | ||
15 | */ | ||
16 | |||
17 | /* The MMU control register fields on the HyperSparc. | ||
18 | * | ||
19 | * ----------------------------------------------------------------- | ||
20 | * |implvers| RSV |CWR|SE|WBE| MID |BM| C|CS|MR|CM|RSV|CE|RSV|NF|ME| | ||
21 | * ----------------------------------------------------------------- | ||
22 | * 31 24 23-22 21 20 19 18-15 14 13 12 11 10 9 8 7-2 1 0 | ||
23 | * | ||
24 | * Phew, lots of fields there ;-) | ||
25 | * | ||
26 | * CWR: Cache Wrapping Enabled, if one cache wrapping is on. | ||
27 | * SE: Snoop Enable, turns on bus snooping for cache activity if one. | ||
28 | * WBE: Write Buffer Enable, one turns it on. | ||
29 | * MID: The ModuleID of the chip for MBus transactions. | ||
30 | * BM: Boot-Mode. One indicates the MMU is in boot mode. | ||
31 | * C: Indicates whether accesses are cachable while the MMU is | ||
32 | * disabled. | ||
33 | * CS: Cache Size -- 0 = 128k, 1 = 256k | ||
34 | * MR: Memory Reflection, one indicates that the memory bus connected | ||
35 | * to the MBus supports memory reflection. | ||
36 | * CM: Cache Mode -- 0 = write-through, 1 = copy-back | ||
37 | * CE: Cache Enable -- 0 = no caching, 1 = cache is on | ||
38 | * NF: No Fault -- 0 = faults trap the CPU from supervisor mode | ||
39 | * 1 = faults from supervisor mode do not generate traps | ||
40 | * ME: MMU Enable -- 0 = MMU is off, 1 = MMU is on | ||
41 | */ | ||
42 | |||
43 | #define HYPERSPARC_CWENABLE 0x00200000 | ||
44 | #define HYPERSPARC_SBENABLE 0x00100000 | ||
45 | #define HYPERSPARC_WBENABLE 0x00080000 | ||
46 | #define HYPERSPARC_MIDMASK 0x00078000 | ||
47 | #define HYPERSPARC_BMODE 0x00004000 | ||
48 | #define HYPERSPARC_ACENABLE 0x00002000 | ||
49 | #define HYPERSPARC_CSIZE 0x00001000 | ||
50 | #define HYPERSPARC_MRFLCT 0x00000800 | ||
51 | #define HYPERSPARC_CMODE 0x00000400 | ||
52 | #define HYPERSPARC_CENABLE 0x00000100 | ||
53 | #define HYPERSPARC_NFAULT 0x00000002 | ||
54 | #define HYPERSPARC_MENABLE 0x00000001 | ||
55 | |||
56 | |||
57 | /* The ICCR instruction cache register on the HyperSparc. | ||
58 | * | ||
59 | * ----------------------------------------------- | ||
60 | * | | FTD | ICE | | ||
61 | * ----------------------------------------------- | ||
62 | * 31 1 0 | ||
63 | * | ||
64 | * This register is accessed using the V8 'wrasr' and 'rdasr' | ||
65 | * opcodes, since not all assemblers understand them and those | ||
66 | * that do use different semantics I will just hard code the | ||
67 | * instruction with a '.word' statement. | ||
68 | * | ||
69 | * FTD: If set to one flush instructions executed during an | ||
70 | * instruction cache hit occurs, the corresponding line | ||
71 | * for said cache-hit is invalidated. If FTD is zero, | ||
72 | * an unimplemented 'flush' trap will occur when any | ||
73 | * flush is executed by the processor. | ||
74 | * | ||
75 | * ICE: If set to one, the instruction cache is enabled. If | ||
76 | * zero, the cache will not be used for instruction fetches. | ||
77 | * | ||
78 | * All other bits are read as zeros, and writes to them have no | ||
79 | * effect. | ||
80 | * | ||
81 | * Wheee, not many assemblers understand the %iccr register nor | ||
82 | * the generic asr r/w instructions. | ||
83 | * | ||
84 | * 1000 0011 0100 0111 1100 0000 0000 0000 ! rd %iccr, %g1 | ||
85 | * | ||
86 | * 0x 8 3 4 7 c 0 0 0 ! 0x8347c000 | ||
87 | * | ||
88 | * 1011 1111 1000 0000 0110 0000 0000 0000 ! wr %g1, 0x0, %iccr | ||
89 | * | ||
90 | * 0x b f 8 0 6 0 0 0 ! 0xbf806000 | ||
91 | * | ||
92 | */ | ||
93 | |||
94 | #define HYPERSPARC_ICCR_FTD 0x00000002 | ||
95 | #define HYPERSPARC_ICCR_ICE 0x00000001 | ||
96 | |||
97 | #ifndef __ASSEMBLY__ | ||
98 | |||
99 | static inline unsigned int get_ross_icr(void) | ||
100 | { | ||
101 | unsigned int icreg; | ||
102 | |||
103 | __asm__ __volatile__(".word 0x8347c000\n\t" /* rd %iccr, %g1 */ | ||
104 | "mov %%g1, %0\n\t" | ||
105 | : "=r" (icreg) | ||
106 | : /* no inputs */ | ||
107 | : "g1", "memory"); | ||
108 | |||
109 | return icreg; | ||
110 | } | ||
111 | |||
112 | static inline void put_ross_icr(unsigned int icreg) | ||
113 | { | ||
114 | __asm__ __volatile__("or %%g0, %0, %%g1\n\t" | ||
115 | ".word 0xbf806000\n\t" /* wr %g1, 0x0, %iccr */ | ||
116 | "nop\n\t" | ||
117 | "nop\n\t" | ||
118 | "nop\n\t" | ||
119 | : /* no outputs */ | ||
120 | : "r" (icreg) | ||
121 | : "g1", "memory"); | ||
122 | |||
123 | return; | ||
124 | } | ||
125 | |||
126 | /* HyperSparc specific cache flushing. */ | ||
127 | |||
128 | /* This is for the on-chip instruction cache. */ | ||
129 | static inline void hyper_flush_whole_icache(void) | ||
130 | { | ||
131 | __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" | ||
132 | : /* no outputs */ | ||
133 | : "i" (ASI_M_FLUSH_IWHOLE) | ||
134 | : "memory"); | ||
135 | return; | ||
136 | } | ||
137 | |||
138 | extern int vac_cache_size; | ||
139 | extern int vac_line_size; | ||
140 | |||
141 | static inline void hyper_clear_all_tags(void) | ||
142 | { | ||
143 | unsigned long addr; | ||
144 | |||
145 | for(addr = 0; addr < vac_cache_size; addr += vac_line_size) | ||
146 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
147 | : /* no outputs */ | ||
148 | : "r" (addr), "i" (ASI_M_DATAC_TAG) | ||
149 | : "memory"); | ||
150 | } | ||
151 | |||
152 | static inline void hyper_flush_unconditional_combined(void) | ||
153 | { | ||
154 | unsigned long addr; | ||
155 | |||
156 | for (addr = 0; addr < vac_cache_size; addr += vac_line_size) | ||
157 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
158 | : /* no outputs */ | ||
159 | : "r" (addr), "i" (ASI_M_FLUSH_CTX) | ||
160 | : "memory"); | ||
161 | } | ||
162 | |||
163 | static inline void hyper_flush_cache_user(void) | ||
164 | { | ||
165 | unsigned long addr; | ||
166 | |||
167 | for (addr = 0; addr < vac_cache_size; addr += vac_line_size) | ||
168 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
169 | : /* no outputs */ | ||
170 | : "r" (addr), "i" (ASI_M_FLUSH_USER) | ||
171 | : "memory"); | ||
172 | } | ||
173 | |||
174 | static inline void hyper_flush_cache_page(unsigned long page) | ||
175 | { | ||
176 | unsigned long end; | ||
177 | |||
178 | page &= PAGE_MASK; | ||
179 | end = page + PAGE_SIZE; | ||
180 | while (page < end) { | ||
181 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
182 | : /* no outputs */ | ||
183 | : "r" (page), "i" (ASI_M_FLUSH_PAGE) | ||
184 | : "memory"); | ||
185 | page += vac_line_size; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | #endif /* !(__ASSEMBLY__) */ | ||
190 | |||
191 | #endif /* !(_SPARC_ROSS_H) */ | ||
diff --git a/include/asm-sparc/rtc.h b/include/asm-sparc/rtc.h new file mode 100644 index 000000000000..f4f261dde699 --- /dev/null +++ b/include/asm-sparc/rtc.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* $Id: rtc.h,v 1.2 1996/08/21 23:17:39 ecd Exp $ | ||
2 | * | ||
3 | * rtc.h: Definitions for access to the Mostek real time clock | ||
4 | * | ||
5 | * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _RTC_H | ||
9 | #define _RTC_H | ||
10 | |||
11 | #include <linux/ioctl.h> | ||
12 | |||
13 | struct rtc_time | ||
14 | { | ||
15 | int sec; /* Seconds (0-59) */ | ||
16 | int min; /* Minutes (0-59) */ | ||
17 | int hour; /* Hour (0-23) */ | ||
18 | int dow; /* Day of the week (1-7) */ | ||
19 | int dom; /* Day of the month (1-31) */ | ||
20 | int month; /* Month of year (1-12) */ | ||
21 | int year; /* Year (0-99) */ | ||
22 | }; | ||
23 | |||
24 | #define RTCGET _IOR('p', 20, struct rtc_time) | ||
25 | #define RTCSET _IOW('p', 21, struct rtc_time) | ||
26 | |||
27 | #endif | ||
diff --git a/include/asm-sparc/sbi.h b/include/asm-sparc/sbi.h new file mode 100644 index 000000000000..739ccac5dcf2 --- /dev/null +++ b/include/asm-sparc/sbi.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /* $Id: sbi.h,v 1.2 1998/03/09 14:04:48 jj Exp $ | ||
2 | * sbi.h: SBI (Sbus Interface on sun4d) definitions | ||
3 | * | ||
4 | * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz> | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_SBI_H | ||
8 | #define _SPARC_SBI_H | ||
9 | |||
10 | #include <asm/obio.h> | ||
11 | |||
12 | /* SBI */ | ||
13 | struct sbi_regs { | ||
14 | /* 0x0000 */ u32 cid; /* Component ID */ | ||
15 | /* 0x0004 */ u32 ctl; /* Control */ | ||
16 | /* 0x0008 */ u32 status; /* Status */ | ||
17 | u32 _unused1; | ||
18 | |||
19 | /* 0x0010 */ u32 cfg0; /* Slot0 config reg */ | ||
20 | /* 0x0014 */ u32 cfg1; /* Slot1 config reg */ | ||
21 | /* 0x0018 */ u32 cfg2; /* Slot2 config reg */ | ||
22 | /* 0x001c */ u32 cfg3; /* Slot3 config reg */ | ||
23 | |||
24 | /* 0x0020 */ u32 stb0; /* Streaming buf control for slot 0 */ | ||
25 | /* 0x0024 */ u32 stb1; /* Streaming buf control for slot 1 */ | ||
26 | /* 0x0028 */ u32 stb2; /* Streaming buf control for slot 2 */ | ||
27 | /* 0x002c */ u32 stb3; /* Streaming buf control for slot 3 */ | ||
28 | |||
29 | /* 0x0030 */ u32 intr_state; /* Interrupt state */ | ||
30 | /* 0x0034 */ u32 intr_tid; /* Interrupt target ID */ | ||
31 | /* 0x0038 */ u32 intr_diag; /* Interrupt diagnostics */ | ||
32 | }; | ||
33 | |||
34 | #define SBI_CID 0x02800000 | ||
35 | #define SBI_CTL 0x02800004 | ||
36 | #define SBI_STATUS 0x02800008 | ||
37 | #define SBI_CFG0 0x02800010 | ||
38 | #define SBI_CFG1 0x02800014 | ||
39 | #define SBI_CFG2 0x02800018 | ||
40 | #define SBI_CFG3 0x0280001c | ||
41 | #define SBI_STB0 0x02800020 | ||
42 | #define SBI_STB1 0x02800024 | ||
43 | #define SBI_STB2 0x02800028 | ||
44 | #define SBI_STB3 0x0280002c | ||
45 | #define SBI_INTR_STATE 0x02800030 | ||
46 | #define SBI_INTR_TID 0x02800034 | ||
47 | #define SBI_INTR_DIAG 0x02800038 | ||
48 | |||
49 | /* Burst bits for 8, 16, 32, 64 are in cfgX registers at bits 2, 3, 4, 5 respectively */ | ||
50 | #define SBI_CFG_BURST_MASK 0x0000001e | ||
51 | |||
52 | /* How to make devid from sbi no */ | ||
53 | #define SBI2DEVID(sbino) ((sbino<<4)|2) | ||
54 | |||
55 | /* intr_state has 4 bits for slots 0 .. 3 and these bits are repeated for each sbus irq level | ||
56 | * | ||
57 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | ||
58 | * SBUS IRQ LEVEL | 7 | 6 | 5 | 4 | 3 | 2 | 1 | | | ||
59 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Reser | | ||
60 | * SLOT # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0| ved | | ||
61 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------+ | ||
62 | * Bits 31 27 23 19 15 11 7 3 0 | ||
63 | */ | ||
64 | |||
65 | |||
66 | #ifndef __ASSEMBLY__ | ||
67 | |||
68 | extern __inline__ int acquire_sbi(int devid, int mask) | ||
69 | { | ||
70 | __asm__ __volatile__ ("swapa [%2] %3, %0" : | ||
71 | "=r" (mask) : | ||
72 | "0" (mask), | ||
73 | "r" (ECSR_DEV_BASE(devid) | SBI_INTR_STATE), | ||
74 | "i" (ASI_M_CTL)); | ||
75 | return mask; | ||
76 | } | ||
77 | |||
78 | extern __inline__ void release_sbi(int devid, int mask) | ||
79 | { | ||
80 | __asm__ __volatile__ ("sta %0, [%1] %2" : : | ||
81 | "r" (mask), | ||
82 | "r" (ECSR_DEV_BASE(devid) | SBI_INTR_STATE), | ||
83 | "i" (ASI_M_CTL)); | ||
84 | } | ||
85 | |||
86 | extern __inline__ void set_sbi_tid(int devid, int targetid) | ||
87 | { | ||
88 | __asm__ __volatile__ ("sta %0, [%1] %2" : : | ||
89 | "r" (targetid), | ||
90 | "r" (ECSR_DEV_BASE(devid) | SBI_INTR_TID), | ||
91 | "i" (ASI_M_CTL)); | ||
92 | } | ||
93 | |||
94 | extern __inline__ int get_sbi_ctl(int devid, int cfgno) | ||
95 | { | ||
96 | int cfg; | ||
97 | |||
98 | __asm__ __volatile__ ("lda [%1] %2, %0" : | ||
99 | "=r" (cfg) : | ||
100 | "r" ((ECSR_DEV_BASE(devid) | SBI_CFG0) + (cfgno<<2)), | ||
101 | "i" (ASI_M_CTL)); | ||
102 | return cfg; | ||
103 | } | ||
104 | |||
105 | extern __inline__ void set_sbi_ctl(int devid, int cfgno, int cfg) | ||
106 | { | ||
107 | __asm__ __volatile__ ("sta %0, [%1] %2" : : | ||
108 | "r" (cfg), | ||
109 | "r" ((ECSR_DEV_BASE(devid) | SBI_CFG0) + (cfgno<<2)), | ||
110 | "i" (ASI_M_CTL)); | ||
111 | } | ||
112 | |||
113 | #endif /* !__ASSEMBLY__ */ | ||
114 | |||
115 | #endif /* !(_SPARC_SBI_H) */ | ||
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h new file mode 100644 index 000000000000..3a8b3908728a --- /dev/null +++ b/include/asm-sparc/sbus.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* $Id: sbus.h,v 1.22 2000/02/18 13:50:50 davem Exp $ | ||
2 | * sbus.h: Defines for the Sun SBus. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_SBUS_H | ||
8 | #define _SPARC_SBUS_H | ||
9 | |||
10 | #include <linux/dma-mapping.h> | ||
11 | #include <linux/ioport.h> | ||
12 | |||
13 | #include <asm/oplib.h> | ||
14 | /* #include <asm/iommu.h> */ /* Unused since we use opaque iommu (|io-unit) */ | ||
15 | #include <asm/scatterlist.h> | ||
16 | |||
17 | /* We scan which devices are on the SBus using the PROM node device | ||
18 | * tree. SBus devices are described in two different ways. You can | ||
19 | * either get an absolute address at which to access the device, or | ||
20 | * you can get a SBus 'slot' number and an offset within that slot. | ||
21 | */ | ||
22 | |||
23 | /* The base address at which to calculate device OBIO addresses. */ | ||
24 | #define SUN_SBUS_BVADDR 0xf8000000 | ||
25 | #define SBUS_OFF_MASK 0x01ffffff | ||
26 | |||
27 | /* These routines are used to calculate device address from slot | ||
28 | * numbers + offsets, and vice versa. | ||
29 | */ | ||
30 | |||
31 | extern __inline__ unsigned long sbus_devaddr(int slotnum, unsigned long offset) | ||
32 | { | ||
33 | return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<25)+(offset)); | ||
34 | } | ||
35 | |||
36 | extern __inline__ int sbus_dev_slot(unsigned long dev_addr) | ||
37 | { | ||
38 | return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>25); | ||
39 | } | ||
40 | |||
41 | struct sbus_bus; | ||
42 | |||
43 | /* Linux SBUS device tables */ | ||
44 | struct sbus_dev { | ||
45 | struct sbus_bus *bus; /* Back ptr to sbus */ | ||
46 | struct sbus_dev *next; /* next device on this SBus or null */ | ||
47 | struct sbus_dev *child; /* For ledma and espdma on sun4m */ | ||
48 | struct sbus_dev *parent; /* Parent device if not toplevel */ | ||
49 | int prom_node; /* PROM device tree node for this device */ | ||
50 | char prom_name[64]; /* PROM device name */ | ||
51 | int slot; | ||
52 | |||
53 | struct resource resource[PROMREG_MAX]; | ||
54 | |||
55 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; | ||
56 | int num_registers, ranges_applied; | ||
57 | |||
58 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; | ||
59 | int num_device_ranges; | ||
60 | |||
61 | unsigned int irqs[4]; | ||
62 | int num_irqs; | ||
63 | }; | ||
64 | |||
65 | /* This struct describes the SBus(s) found on this machine. */ | ||
66 | struct sbus_bus { | ||
67 | void *iommu; /* Opaque IOMMU cookie */ | ||
68 | struct sbus_dev *devices; /* Link to devices on this SBus */ | ||
69 | struct sbus_bus *next; /* next SBus, if more than one SBus */ | ||
70 | int prom_node; /* PROM device tree node for this SBus */ | ||
71 | char prom_name[64]; /* Usually "sbus" or "sbi" */ | ||
72 | int clock_freq; | ||
73 | |||
74 | struct linux_prom_ranges sbus_ranges[PROMREG_MAX]; | ||
75 | int num_sbus_ranges; | ||
76 | |||
77 | int devid; | ||
78 | int board; | ||
79 | }; | ||
80 | |||
81 | extern struct sbus_bus *sbus_root; | ||
82 | |||
83 | extern __inline__ int | ||
84 | sbus_is_slave(struct sbus_dev *dev) | ||
85 | { | ||
86 | /* XXX Have to write this for sun4c's */ | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | /* Device probing routines could find these handy */ | ||
91 | #define for_each_sbus(bus) \ | ||
92 | for((bus) = sbus_root; (bus); (bus)=(bus)->next) | ||
93 | |||
94 | #define for_each_sbusdev(device, bus) \ | ||
95 | for((device) = (bus)->devices; (device); (device)=(device)->next) | ||
96 | |||
97 | #define for_all_sbusdev(device, bus) \ | ||
98 | for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \ | ||
99 | for ((device) = (bus)->devices; (device); (device) = (device)->next) | ||
100 | |||
101 | /* Driver DVMA interfaces. */ | ||
102 | #define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */ | ||
103 | #define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */ | ||
104 | extern void sbus_set_sbus64(struct sbus_dev *, int); | ||
105 | |||
106 | /* These yield IOMMU mappings in consistent mode. */ | ||
107 | extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); | ||
108 | extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); | ||
109 | void prom_adjust_ranges(struct linux_prom_ranges *, int, | ||
110 | struct linux_prom_ranges *, int); | ||
111 | |||
112 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL | ||
113 | #define SBUS_DMA_TODEVICE DMA_TO_DEVICE | ||
114 | #define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE | ||
115 | #define SBUS_DMA_NONE DMA_NONE | ||
116 | |||
117 | /* All the rest use streaming mode mappings. */ | ||
118 | extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); | ||
119 | extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); | ||
120 | extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); | ||
121 | extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); | ||
122 | |||
123 | /* Finally, allow explicit synchronization of streamable mappings. */ | ||
124 | extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); | ||
125 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu | ||
126 | extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int); | ||
127 | extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int); | ||
128 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu | ||
129 | extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); | ||
130 | |||
131 | /* Eric Brower (ebrower@usa.net) | ||
132 | * Translate SBus interrupt levels to ino values-- | ||
133 | * this is used when converting sbus "interrupts" OBP | ||
134 | * node values to "intr" node values, and is platform | ||
135 | * dependent. If only we could call OBP with | ||
136 | * "sbus-intr>cpu (sbint -- ino)" from kernel... | ||
137 | * See .../drivers/sbus/sbus.c for details. | ||
138 | */ | ||
139 | BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) | ||
140 | #define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) | ||
141 | |||
142 | #endif /* !(_SPARC_SBUS_H) */ | ||
diff --git a/include/asm-sparc/scatterlist.h b/include/asm-sparc/scatterlist.h new file mode 100644 index 000000000000..a4fcf9ac9649 --- /dev/null +++ b/include/asm-sparc/scatterlist.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* $Id: scatterlist.h,v 1.8 2001/12/17 07:05:15 davem Exp $ */ | ||
2 | #ifndef _SPARC_SCATTERLIST_H | ||
3 | #define _SPARC_SCATTERLIST_H | ||
4 | |||
5 | #include <linux/types.h> | ||
6 | |||
7 | struct scatterlist { | ||
8 | struct page *page; | ||
9 | unsigned int offset; | ||
10 | |||
11 | unsigned int length; | ||
12 | |||
13 | __u32 dvma_address; /* A place to hang host-specific addresses at. */ | ||
14 | __u32 dvma_length; | ||
15 | }; | ||
16 | |||
17 | #define sg_dma_address(sg) ((sg)->dvma_address) | ||
18 | #define sg_dma_len(sg) ((sg)->dvma_length) | ||
19 | |||
20 | #define ISA_DMA_THRESHOLD (~0UL) | ||
21 | |||
22 | #endif /* !(_SPARC_SCATTERLIST_H) */ | ||
diff --git a/include/asm-sparc/sections.h b/include/asm-sparc/sections.h new file mode 100644 index 000000000000..6832841df051 --- /dev/null +++ b/include/asm-sparc/sections.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _SPARC_SECTIONS_H | ||
2 | #define _SPARC_SECTIONS_H | ||
3 | |||
4 | #include <asm-generic/sections.h> | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-sparc/segment.h b/include/asm-sparc/segment.h new file mode 100644 index 000000000000..a1b7ffc9eec9 --- /dev/null +++ b/include/asm-sparc/segment.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __SPARC_SEGMENT_H | ||
2 | #define __SPARC_SEGMENT_H | ||
3 | |||
4 | /* Only here because we have some old header files that expect it.. */ | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h new file mode 100644 index 000000000000..60ac5fd9eb48 --- /dev/null +++ b/include/asm-sparc/semaphore.h | |||
@@ -0,0 +1,196 @@ | |||
1 | #ifndef _SPARC_SEMAPHORE_H | ||
2 | #define _SPARC_SEMAPHORE_H | ||
3 | |||
4 | /* Dinky, good for nothing, just barely irq safe, Sparc semaphores. */ | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | |||
8 | #include <asm/atomic.h> | ||
9 | #include <linux/wait.h> | ||
10 | #include <linux/rwsem.h> | ||
11 | |||
12 | struct semaphore { | ||
13 | atomic24_t count; | ||
14 | int sleepers; | ||
15 | wait_queue_head_t wait; | ||
16 | }; | ||
17 | |||
18 | #define __SEMAPHORE_INITIALIZER(name, n) \ | ||
19 | { \ | ||
20 | .count = ATOMIC24_INIT(n), \ | ||
21 | .sleepers = 0, \ | ||
22 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ | ||
23 | } | ||
24 | |||
25 | #define __MUTEX_INITIALIZER(name) \ | ||
26 | __SEMAPHORE_INITIALIZER(name,1) | ||
27 | |||
28 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ | ||
29 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | ||
30 | |||
31 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) | ||
32 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) | ||
33 | |||
34 | static inline void sema_init (struct semaphore *sem, int val) | ||
35 | { | ||
36 | atomic24_set(&sem->count, val); | ||
37 | sem->sleepers = 0; | ||
38 | init_waitqueue_head(&sem->wait); | ||
39 | } | ||
40 | |||
41 | static inline void init_MUTEX (struct semaphore *sem) | ||
42 | { | ||
43 | sema_init(sem, 1); | ||
44 | } | ||
45 | |||
46 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) | ||
47 | { | ||
48 | sema_init(sem, 0); | ||
49 | } | ||
50 | |||
51 | extern void __down(struct semaphore * sem); | ||
52 | extern int __down_interruptible(struct semaphore * sem); | ||
53 | extern int __down_trylock(struct semaphore * sem); | ||
54 | extern void __up(struct semaphore * sem); | ||
55 | |||
56 | static inline void down(struct semaphore * sem) | ||
57 | { | ||
58 | register volatile int *ptr asm("g1"); | ||
59 | register int increment asm("g2"); | ||
60 | |||
61 | might_sleep(); | ||
62 | |||
63 | ptr = &(sem->count.counter); | ||
64 | increment = 1; | ||
65 | |||
66 | __asm__ __volatile__( | ||
67 | "mov %%o7, %%g4\n\t" | ||
68 | "call ___atomic24_sub\n\t" | ||
69 | " add %%o7, 8, %%o7\n\t" | ||
70 | "tst %%g2\n\t" | ||
71 | "bl 2f\n\t" | ||
72 | " nop\n" | ||
73 | "1:\n\t" | ||
74 | ".subsection 2\n" | ||
75 | "2:\n\t" | ||
76 | "save %%sp, -64, %%sp\n\t" | ||
77 | "mov %%g1, %%l1\n\t" | ||
78 | "mov %%g5, %%l5\n\t" | ||
79 | "call %3\n\t" | ||
80 | " mov %%g1, %%o0\n\t" | ||
81 | "mov %%l1, %%g1\n\t" | ||
82 | "ba 1b\n\t" | ||
83 | " restore %%l5, %%g0, %%g5\n\t" | ||
84 | ".previous\n" | ||
85 | : "=&r" (increment) | ||
86 | : "0" (increment), "r" (ptr), "i" (__down) | ||
87 | : "g3", "g4", "g7", "memory", "cc"); | ||
88 | } | ||
89 | |||
90 | static inline int down_interruptible(struct semaphore * sem) | ||
91 | { | ||
92 | register volatile int *ptr asm("g1"); | ||
93 | register int increment asm("g2"); | ||
94 | |||
95 | might_sleep(); | ||
96 | |||
97 | ptr = &(sem->count.counter); | ||
98 | increment = 1; | ||
99 | |||
100 | __asm__ __volatile__( | ||
101 | "mov %%o7, %%g4\n\t" | ||
102 | "call ___atomic24_sub\n\t" | ||
103 | " add %%o7, 8, %%o7\n\t" | ||
104 | "tst %%g2\n\t" | ||
105 | "bl 2f\n\t" | ||
106 | " clr %%g2\n" | ||
107 | "1:\n\t" | ||
108 | ".subsection 2\n" | ||
109 | "2:\n\t" | ||
110 | "save %%sp, -64, %%sp\n\t" | ||
111 | "mov %%g1, %%l1\n\t" | ||
112 | "mov %%g5, %%l5\n\t" | ||
113 | "call %3\n\t" | ||
114 | " mov %%g1, %%o0\n\t" | ||
115 | "mov %%l1, %%g1\n\t" | ||
116 | "mov %%l5, %%g5\n\t" | ||
117 | "ba 1b\n\t" | ||
118 | " restore %%o0, %%g0, %%g2\n\t" | ||
119 | ".previous\n" | ||
120 | : "=&r" (increment) | ||
121 | : "0" (increment), "r" (ptr), "i" (__down_interruptible) | ||
122 | : "g3", "g4", "g7", "memory", "cc"); | ||
123 | |||
124 | return increment; | ||
125 | } | ||
126 | |||
127 | static inline int down_trylock(struct semaphore * sem) | ||
128 | { | ||
129 | register volatile int *ptr asm("g1"); | ||
130 | register int increment asm("g2"); | ||
131 | |||
132 | ptr = &(sem->count.counter); | ||
133 | increment = 1; | ||
134 | |||
135 | __asm__ __volatile__( | ||
136 | "mov %%o7, %%g4\n\t" | ||
137 | "call ___atomic24_sub\n\t" | ||
138 | " add %%o7, 8, %%o7\n\t" | ||
139 | "tst %%g2\n\t" | ||
140 | "bl 2f\n\t" | ||
141 | " clr %%g2\n" | ||
142 | "1:\n\t" | ||
143 | ".subsection 2\n" | ||
144 | "2:\n\t" | ||
145 | "save %%sp, -64, %%sp\n\t" | ||
146 | "mov %%g1, %%l1\n\t" | ||
147 | "mov %%g5, %%l5\n\t" | ||
148 | "call %3\n\t" | ||
149 | " mov %%g1, %%o0\n\t" | ||
150 | "mov %%l1, %%g1\n\t" | ||
151 | "mov %%l5, %%g5\n\t" | ||
152 | "ba 1b\n\t" | ||
153 | " restore %%o0, %%g0, %%g2\n\t" | ||
154 | ".previous\n" | ||
155 | : "=&r" (increment) | ||
156 | : "0" (increment), "r" (ptr), "i" (__down_trylock) | ||
157 | : "g3", "g4", "g7", "memory", "cc"); | ||
158 | |||
159 | return increment; | ||
160 | } | ||
161 | |||
162 | static inline void up(struct semaphore * sem) | ||
163 | { | ||
164 | register volatile int *ptr asm("g1"); | ||
165 | register int increment asm("g2"); | ||
166 | |||
167 | ptr = &(sem->count.counter); | ||
168 | increment = 1; | ||
169 | |||
170 | __asm__ __volatile__( | ||
171 | "mov %%o7, %%g4\n\t" | ||
172 | "call ___atomic24_add\n\t" | ||
173 | " add %%o7, 8, %%o7\n\t" | ||
174 | "tst %%g2\n\t" | ||
175 | "ble 2f\n\t" | ||
176 | " nop\n" | ||
177 | "1:\n\t" | ||
178 | ".subsection 2\n" | ||
179 | "2:\n\t" | ||
180 | "save %%sp, -64, %%sp\n\t" | ||
181 | "mov %%g1, %%l1\n\t" | ||
182 | "mov %%g5, %%l5\n\t" | ||
183 | "call %3\n\t" | ||
184 | " mov %%g1, %%o0\n\t" | ||
185 | "mov %%l1, %%g1\n\t" | ||
186 | "ba 1b\n\t" | ||
187 | " restore %%l5, %%g0, %%g5\n\t" | ||
188 | ".previous\n" | ||
189 | : "=&r" (increment) | ||
190 | : "0" (increment), "r" (ptr), "i" (__up) | ||
191 | : "g3", "g4", "g7", "memory", "cc"); | ||
192 | } | ||
193 | |||
194 | #endif /* __KERNEL__ */ | ||
195 | |||
196 | #endif /* !(_SPARC_SEMAPHORE_H) */ | ||
diff --git a/include/asm-sparc/sembuf.h b/include/asm-sparc/sembuf.h new file mode 100644 index 000000000000..a79c4bb3c08a --- /dev/null +++ b/include/asm-sparc/sembuf.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _SPARC_SEMBUF_H | ||
2 | #define _SPARC_SEMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The semid64_ds structure for sparc architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct semid64_ds { | ||
15 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
16 | unsigned int __pad1; | ||
17 | __kernel_time_t sem_otime; /* last semop time */ | ||
18 | unsigned int __pad2; | ||
19 | __kernel_time_t sem_ctime; /* last change time */ | ||
20 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
21 | unsigned long __unused1; | ||
22 | unsigned long __unused2; | ||
23 | }; | ||
24 | |||
25 | #endif /* _SPARC64_SEMBUF_H */ | ||
diff --git a/include/asm-sparc/setup.h b/include/asm-sparc/setup.h new file mode 100644 index 000000000000..b3af958a2ad2 --- /dev/null +++ b/include/asm-sparc/setup.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Just a place holder. | ||
3 | */ | ||
4 | |||
5 | #ifndef _SPARC_SETUP_H | ||
6 | #define _SPARC_SETUP_H | ||
7 | |||
8 | #define COMMAND_LINE_SIZE 256 | ||
9 | |||
10 | #endif /* _SPARC_SETUP_H */ | ||
diff --git a/include/asm-sparc/sfp-machine.h b/include/asm-sparc/sfp-machine.h new file mode 100644 index 000000000000..b4ca2d94bf08 --- /dev/null +++ b/include/asm-sparc/sfp-machine.h | |||
@@ -0,0 +1,207 @@ | |||
1 | /* Machine-dependent software floating-point definitions. | ||
2 | Sparc userland (_Q_*) version. | ||
3 | Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. | ||
4 | This file is part of the GNU C Library. | ||
5 | Contributed by Richard Henderson (rth@cygnus.com), | ||
6 | Jakub Jelinek (jj@ultra.linux.cz), | ||
7 | David S. Miller (davem@redhat.com) and | ||
8 | Peter Maydell (pmaydell@chiark.greenend.org.uk). | ||
9 | |||
10 | The GNU C Library is free software; you can redistribute it and/or | ||
11 | modify it under the terms of the GNU Library General Public License as | ||
12 | published by the Free Software Foundation; either version 2 of the | ||
13 | License, or (at your option) any later version. | ||
14 | |||
15 | The GNU C Library is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
18 | Library General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU Library General Public | ||
21 | License along with the GNU C Library; see the file COPYING.LIB. If | ||
22 | not, write to the Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
24 | |||
25 | #ifndef _SFP_MACHINE_H | ||
26 | #define _SFP_MACHINE_H | ||
27 | |||
28 | #include <linux/config.h> | ||
29 | |||
30 | #define _FP_W_TYPE_SIZE 32 | ||
31 | #define _FP_W_TYPE unsigned long | ||
32 | #define _FP_WS_TYPE signed long | ||
33 | #define _FP_I_TYPE long | ||
34 | |||
35 | #define _FP_MUL_MEAT_S(R,X,Y) \ | ||
36 | _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) | ||
37 | #define _FP_MUL_MEAT_D(R,X,Y) \ | ||
38 | _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) | ||
39 | #define _FP_MUL_MEAT_Q(R,X,Y) \ | ||
40 | _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) | ||
41 | |||
42 | #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) | ||
43 | #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) | ||
44 | #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) | ||
45 | |||
46 | #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) | ||
47 | #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 | ||
48 | #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 | ||
49 | #define _FP_NANSIGN_S 0 | ||
50 | #define _FP_NANSIGN_D 0 | ||
51 | #define _FP_NANSIGN_Q 0 | ||
52 | |||
53 | #define _FP_KEEPNANFRACP 1 | ||
54 | |||
55 | /* If one NaN is signaling and the other is not, | ||
56 | * we choose that one, otherwise we choose X. | ||
57 | */ | ||
58 | /* For _Qp_* and _Q_*, this should prefer X, for | ||
59 | * CPU instruction emulation this should prefer Y. | ||
60 | * (see SPAMv9 B.2.2 section). | ||
61 | */ | ||
62 | #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ | ||
63 | do { \ | ||
64 | if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \ | ||
65 | && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ | ||
66 | { \ | ||
67 | R##_s = X##_s; \ | ||
68 | _FP_FRAC_COPY_##wc(R,X); \ | ||
69 | } \ | ||
70 | else \ | ||
71 | { \ | ||
72 | R##_s = Y##_s; \ | ||
73 | _FP_FRAC_COPY_##wc(R,Y); \ | ||
74 | } \ | ||
75 | R##_c = FP_CLS_NAN; \ | ||
76 | } while (0) | ||
77 | |||
78 | /* Some assembly to speed things up. */ | ||
79 | #define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ | ||
80 | __asm__ ("addcc %r7,%8,%2\n\t" \ | ||
81 | "addxcc %r5,%6,%1\n\t" \ | ||
82 | "addx %r3,%4,%0\n" \ | ||
83 | : "=r" ((USItype)(r2)), \ | ||
84 | "=&r" ((USItype)(r1)), \ | ||
85 | "=&r" ((USItype)(r0)) \ | ||
86 | : "%rJ" ((USItype)(x2)), \ | ||
87 | "rI" ((USItype)(y2)), \ | ||
88 | "%rJ" ((USItype)(x1)), \ | ||
89 | "rI" ((USItype)(y1)), \ | ||
90 | "%rJ" ((USItype)(x0)), \ | ||
91 | "rI" ((USItype)(y0)) \ | ||
92 | : "cc") | ||
93 | |||
94 | #define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ | ||
95 | __asm__ ("subcc %r7,%8,%2\n\t" \ | ||
96 | "subxcc %r5,%6,%1\n\t" \ | ||
97 | "subx %r3,%4,%0\n" \ | ||
98 | : "=r" ((USItype)(r2)), \ | ||
99 | "=&r" ((USItype)(r1)), \ | ||
100 | "=&r" ((USItype)(r0)) \ | ||
101 | : "%rJ" ((USItype)(x2)), \ | ||
102 | "rI" ((USItype)(y2)), \ | ||
103 | "%rJ" ((USItype)(x1)), \ | ||
104 | "rI" ((USItype)(y1)), \ | ||
105 | "%rJ" ((USItype)(x0)), \ | ||
106 | "rI" ((USItype)(y0)) \ | ||
107 | : "cc") | ||
108 | |||
109 | #define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ | ||
110 | do { \ | ||
111 | /* We need to fool gcc, as we need to pass more than 10 \ | ||
112 | input/outputs. */ \ | ||
113 | register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ | ||
114 | __asm__ __volatile__ ( \ | ||
115 | "addcc %r8,%9,%1\n\t" \ | ||
116 | "addxcc %r6,%7,%0\n\t" \ | ||
117 | "addxcc %r4,%5,%%g2\n\t" \ | ||
118 | "addx %r2,%3,%%g1\n\t" \ | ||
119 | : "=&r" ((USItype)(r1)), \ | ||
120 | "=&r" ((USItype)(r0)) \ | ||
121 | : "%rJ" ((USItype)(x3)), \ | ||
122 | "rI" ((USItype)(y3)), \ | ||
123 | "%rJ" ((USItype)(x2)), \ | ||
124 | "rI" ((USItype)(y2)), \ | ||
125 | "%rJ" ((USItype)(x1)), \ | ||
126 | "rI" ((USItype)(y1)), \ | ||
127 | "%rJ" ((USItype)(x0)), \ | ||
128 | "rI" ((USItype)(y0)) \ | ||
129 | : "cc", "g1", "g2"); \ | ||
130 | __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ | ||
131 | r3 = _t1; r2 = _t2; \ | ||
132 | } while (0) | ||
133 | |||
134 | #define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ | ||
135 | do { \ | ||
136 | /* We need to fool gcc, as we need to pass more than 10 \ | ||
137 | input/outputs. */ \ | ||
138 | register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ | ||
139 | __asm__ __volatile__ ( \ | ||
140 | "subcc %r8,%9,%1\n\t" \ | ||
141 | "subxcc %r6,%7,%0\n\t" \ | ||
142 | "subxcc %r4,%5,%%g2\n\t" \ | ||
143 | "subx %r2,%3,%%g1\n\t" \ | ||
144 | : "=&r" ((USItype)(r1)), \ | ||
145 | "=&r" ((USItype)(r0)) \ | ||
146 | : "%rJ" ((USItype)(x3)), \ | ||
147 | "rI" ((USItype)(y3)), \ | ||
148 | "%rJ" ((USItype)(x2)), \ | ||
149 | "rI" ((USItype)(y2)), \ | ||
150 | "%rJ" ((USItype)(x1)), \ | ||
151 | "rI" ((USItype)(y1)), \ | ||
152 | "%rJ" ((USItype)(x0)), \ | ||
153 | "rI" ((USItype)(y0)) \ | ||
154 | : "cc", "g1", "g2"); \ | ||
155 | __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ | ||
156 | r3 = _t1; r2 = _t2; \ | ||
157 | } while (0) | ||
158 | |||
159 | #define __FP_FRAC_DEC_3(x2,x1,x0,y2,y1,y0) __FP_FRAC_SUB_3(x2,x1,x0,x2,x1,x0,y2,y1,y0) | ||
160 | |||
161 | #define __FP_FRAC_DEC_4(x3,x2,x1,x0,y3,y2,y1,y0) __FP_FRAC_SUB_4(x3,x2,x1,x0,x3,x2,x1,x0,y3,y2,y1,y0) | ||
162 | |||
163 | #define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \ | ||
164 | __asm__ ("addcc %3,%4,%3\n\t" \ | ||
165 | "addxcc %2,%%g0,%2\n\t" \ | ||
166 | "addxcc %1,%%g0,%1\n\t" \ | ||
167 | "addx %0,%%g0,%0\n\t" \ | ||
168 | : "=&r" ((USItype)(x3)), \ | ||
169 | "=&r" ((USItype)(x2)), \ | ||
170 | "=&r" ((USItype)(x1)), \ | ||
171 | "=&r" ((USItype)(x0)) \ | ||
172 | : "rI" ((USItype)(i)), \ | ||
173 | "0" ((USItype)(x3)), \ | ||
174 | "1" ((USItype)(x2)), \ | ||
175 | "2" ((USItype)(x1)), \ | ||
176 | "3" ((USItype)(x0)) \ | ||
177 | : "cc") | ||
178 | |||
179 | #ifndef CONFIG_SMP | ||
180 | extern struct task_struct *last_task_used_math; | ||
181 | #endif | ||
182 | |||
183 | /* Obtain the current rounding mode. */ | ||
184 | #ifndef FP_ROUNDMODE | ||
185 | #ifdef CONFIG_SMP | ||
186 | #define FP_ROUNDMODE ((current->thread.fsr >> 30) & 0x3) | ||
187 | #else | ||
188 | #define FP_ROUNDMODE ((last_task_used_math->thread.fsr >> 30) & 0x3) | ||
189 | #endif | ||
190 | #endif | ||
191 | |||
192 | /* Exception flags. */ | ||
193 | #define FP_EX_INVALID (1 << 4) | ||
194 | #define FP_EX_OVERFLOW (1 << 3) | ||
195 | #define FP_EX_UNDERFLOW (1 << 2) | ||
196 | #define FP_EX_DIVZERO (1 << 1) | ||
197 | #define FP_EX_INEXACT (1 << 0) | ||
198 | |||
199 | #define FP_HANDLE_EXCEPTIONS return _fex | ||
200 | |||
201 | #ifdef CONFIG_SMP | ||
202 | #define FP_INHIBIT_RESULTS ((current->thread.fsr >> 23) & _fex) | ||
203 | #else | ||
204 | #define FP_INHIBIT_RESULTS ((last_task_used_math->thread.fsr >> 23) & _fex) | ||
205 | #endif | ||
206 | |||
207 | #endif | ||
diff --git a/include/asm-sparc/shmbuf.h b/include/asm-sparc/shmbuf.h new file mode 100644 index 000000000000..1ff9da8bec73 --- /dev/null +++ b/include/asm-sparc/shmbuf.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _SPARC_SHMBUF_H | ||
2 | #define _SPARC_SHMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The shmid64_ds structure for sparc architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct shmid64_ds { | ||
15 | struct ipc64_perm shm_perm; /* operation perms */ | ||
16 | unsigned int __pad1; | ||
17 | __kernel_time_t shm_atime; /* last attach time */ | ||
18 | unsigned int __pad2; | ||
19 | __kernel_time_t shm_dtime; /* last detach time */ | ||
20 | unsigned int __pad3; | ||
21 | __kernel_time_t shm_ctime; /* last change time */ | ||
22 | size_t shm_segsz; /* size of segment (bytes) */ | ||
23 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
24 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
25 | unsigned long shm_nattch; /* no. of current attaches */ | ||
26 | unsigned long __unused1; | ||
27 | unsigned long __unused2; | ||
28 | }; | ||
29 | |||
30 | struct shminfo64 { | ||
31 | unsigned long shmmax; | ||
32 | unsigned long shmmin; | ||
33 | unsigned long shmmni; | ||
34 | unsigned long shmseg; | ||
35 | unsigned long shmall; | ||
36 | unsigned long __unused1; | ||
37 | unsigned long __unused2; | ||
38 | unsigned long __unused3; | ||
39 | unsigned long __unused4; | ||
40 | }; | ||
41 | |||
42 | #endif /* _SPARC_SHMBUF_H */ | ||
diff --git a/include/asm-sparc/shmparam.h b/include/asm-sparc/shmparam.h new file mode 100644 index 000000000000..bb93a6f74a38 --- /dev/null +++ b/include/asm-sparc/shmparam.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* $Id: shmparam.h,v 1.6 1999/12/09 10:32:41 davem Exp $ */ | ||
2 | #ifndef _ASMSPARC_SHMPARAM_H | ||
3 | #define _ASMSPARC_SHMPARAM_H | ||
4 | |||
5 | #define __ARCH_FORCE_SHMLBA 1 | ||
6 | |||
7 | extern int vac_cache_size; | ||
8 | #define SHMLBA (vac_cache_size ? vac_cache_size : \ | ||
9 | (sparc_cpu_model == sun4c ? (64 * 1024) : \ | ||
10 | (sparc_cpu_model == sun4 ? (128 * 1024) : PAGE_SIZE))) | ||
11 | |||
12 | #endif /* _ASMSPARC_SHMPARAM_H */ | ||
diff --git a/include/asm-sparc/sigcontext.h b/include/asm-sparc/sigcontext.h new file mode 100644 index 000000000000..7fa2c7d01ab4 --- /dev/null +++ b/include/asm-sparc/sigcontext.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* $Id: sigcontext.h,v 1.14 1999/09/06 08:22:05 jj Exp $ */ | ||
2 | #ifndef __SPARC_SIGCONTEXT_H | ||
3 | #define __SPARC_SIGCONTEXT_H | ||
4 | |||
5 | #ifdef __KERNEL__ | ||
6 | #include <asm/ptrace.h> | ||
7 | |||
8 | #ifndef __ASSEMBLY__ | ||
9 | |||
10 | #define __SUNOS_MAXWIN 31 | ||
11 | |||
12 | /* This is what SunOS does, so shall I. */ | ||
13 | struct sigcontext { | ||
14 | int sigc_onstack; /* state to restore */ | ||
15 | int sigc_mask; /* sigmask to restore */ | ||
16 | int sigc_sp; /* stack pointer */ | ||
17 | int sigc_pc; /* program counter */ | ||
18 | int sigc_npc; /* next program counter */ | ||
19 | int sigc_psr; /* for condition codes etc */ | ||
20 | int sigc_g1; /* User uses these two registers */ | ||
21 | int sigc_o0; /* within the trampoline code. */ | ||
22 | |||
23 | /* Now comes information regarding the users window set | ||
24 | * at the time of the signal. | ||
25 | */ | ||
26 | int sigc_oswins; /* outstanding windows */ | ||
27 | |||
28 | /* stack ptrs for each regwin buf */ | ||
29 | char *sigc_spbuf[__SUNOS_MAXWIN]; | ||
30 | |||
31 | /* Windows to restore after signal */ | ||
32 | struct { | ||
33 | unsigned long locals[8]; | ||
34 | unsigned long ins[8]; | ||
35 | } sigc_wbuf[__SUNOS_MAXWIN]; | ||
36 | }; | ||
37 | |||
38 | typedef struct { | ||
39 | struct { | ||
40 | unsigned long psr; | ||
41 | unsigned long pc; | ||
42 | unsigned long npc; | ||
43 | unsigned long y; | ||
44 | unsigned long u_regs[16]; /* globals and ins */ | ||
45 | } si_regs; | ||
46 | int si_mask; | ||
47 | } __siginfo_t; | ||
48 | |||
49 | typedef struct { | ||
50 | unsigned long si_float_regs [32]; | ||
51 | unsigned long si_fsr; | ||
52 | unsigned long si_fpqdepth; | ||
53 | struct { | ||
54 | unsigned long *insn_addr; | ||
55 | unsigned long insn; | ||
56 | } si_fpqueue [16]; | ||
57 | } __siginfo_fpu_t; | ||
58 | |||
59 | #endif /* !(__ASSEMBLY__) */ | ||
60 | |||
61 | #endif /* (__KERNEL__) */ | ||
62 | |||
63 | #endif /* !(__SPARC_SIGCONTEXT_H) */ | ||
diff --git a/include/asm-sparc/siginfo.h b/include/asm-sparc/siginfo.h new file mode 100644 index 000000000000..2c3ea8b22448 --- /dev/null +++ b/include/asm-sparc/siginfo.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* $Id: siginfo.h,v 1.9 2002/02/08 03:57:18 davem Exp $ | ||
2 | * siginfo.c: | ||
3 | */ | ||
4 | |||
5 | #ifndef _SPARC_SIGINFO_H | ||
6 | #define _SPARC_SIGINFO_H | ||
7 | |||
8 | #define __ARCH_SI_UID_T unsigned int | ||
9 | #define __ARCH_SI_TRAPNO | ||
10 | |||
11 | #include <asm-generic/siginfo.h> | ||
12 | |||
13 | #define SI_NOINFO 32767 /* no information in siginfo_t */ | ||
14 | |||
15 | /* | ||
16 | * SIGEMT si_codes | ||
17 | */ | ||
18 | #define EMT_TAGOVF (__SI_FAULT|1) /* tag overflow */ | ||
19 | #define NSIGEMT 1 | ||
20 | |||
21 | #endif /* !(_SPARC_SIGINFO_H) */ | ||
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h new file mode 100644 index 000000000000..d8211cb6e6b4 --- /dev/null +++ b/include/asm-sparc/signal.h | |||
@@ -0,0 +1,234 @@ | |||
1 | /* $Id: signal.h,v 1.35 1999/09/06 08:22:04 jj Exp $ */ | ||
2 | #ifndef _ASMSPARC_SIGNAL_H | ||
3 | #define _ASMSPARC_SIGNAL_H | ||
4 | |||
5 | #include <asm/sigcontext.h> | ||
6 | #include <linux/compiler.h> | ||
7 | |||
8 | #ifdef __KERNEL__ | ||
9 | #ifndef __ASSEMBLY__ | ||
10 | #include <linux/personality.h> | ||
11 | #include <linux/types.h> | ||
12 | #endif | ||
13 | #endif | ||
14 | |||
15 | /* On the Sparc the signal handlers get passed a 'sub-signal' code | ||
16 | * for certain signal types, which we document here. | ||
17 | */ | ||
18 | #define SIGHUP 1 | ||
19 | #define SIGINT 2 | ||
20 | #define SIGQUIT 3 | ||
21 | #define SIGILL 4 | ||
22 | #define SUBSIG_STACK 0 | ||
23 | #define SUBSIG_ILLINST 2 | ||
24 | #define SUBSIG_PRIVINST 3 | ||
25 | #define SUBSIG_BADTRAP(t) (0x80 + (t)) | ||
26 | |||
27 | #define SIGTRAP 5 | ||
28 | #define SIGABRT 6 | ||
29 | #define SIGIOT 6 | ||
30 | |||
31 | #define SIGEMT 7 | ||
32 | #define SUBSIG_TAG 10 | ||
33 | |||
34 | #define SIGFPE 8 | ||
35 | #define SUBSIG_FPDISABLED 0x400 | ||
36 | #define SUBSIG_FPERROR 0x404 | ||
37 | #define SUBSIG_FPINTOVFL 0x001 | ||
38 | #define SUBSIG_FPSTSIG 0x002 | ||
39 | #define SUBSIG_IDIVZERO 0x014 | ||
40 | #define SUBSIG_FPINEXACT 0x0c4 | ||
41 | #define SUBSIG_FPDIVZERO 0x0c8 | ||
42 | #define SUBSIG_FPUNFLOW 0x0cc | ||
43 | #define SUBSIG_FPOPERROR 0x0d0 | ||
44 | #define SUBSIG_FPOVFLOW 0x0d4 | ||
45 | |||
46 | #define SIGKILL 9 | ||
47 | #define SIGBUS 10 | ||
48 | #define SUBSIG_BUSTIMEOUT 1 | ||
49 | #define SUBSIG_ALIGNMENT 2 | ||
50 | #define SUBSIG_MISCERROR 5 | ||
51 | |||
52 | #define SIGSEGV 11 | ||
53 | #define SUBSIG_NOMAPPING 3 | ||
54 | #define SUBSIG_PROTECTION 4 | ||
55 | #define SUBSIG_SEGERROR 5 | ||
56 | |||
57 | #define SIGSYS 12 | ||
58 | |||
59 | #define SIGPIPE 13 | ||
60 | #define SIGALRM 14 | ||
61 | #define SIGTERM 15 | ||
62 | #define SIGURG 16 | ||
63 | |||
64 | /* SunOS values which deviate from the Linux/i386 ones */ | ||
65 | #define SIGSTOP 17 | ||
66 | #define SIGTSTP 18 | ||
67 | #define SIGCONT 19 | ||
68 | #define SIGCHLD 20 | ||
69 | #define SIGTTIN 21 | ||
70 | #define SIGTTOU 22 | ||
71 | #define SIGIO 23 | ||
72 | #define SIGPOLL SIGIO /* SysV name for SIGIO */ | ||
73 | #define SIGXCPU 24 | ||
74 | #define SIGXFSZ 25 | ||
75 | #define SIGVTALRM 26 | ||
76 | #define SIGPROF 27 | ||
77 | #define SIGWINCH 28 | ||
78 | #define SIGLOST 29 | ||
79 | #define SIGPWR SIGLOST | ||
80 | #define SIGUSR1 30 | ||
81 | #define SIGUSR2 31 | ||
82 | |||
83 | /* Most things should be clean enough to redefine this at will, if care | ||
84 | * is taken to make libc match. | ||
85 | */ | ||
86 | |||
87 | #define __OLD_NSIG 32 | ||
88 | #define __NEW_NSIG 64 | ||
89 | #define _NSIG_BPW 32 | ||
90 | #define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW) | ||
91 | |||
92 | #define SIGRTMIN 32 | ||
93 | #define SIGRTMAX __NEW_NSIG | ||
94 | |||
95 | #if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__) | ||
96 | #define _NSIG __NEW_NSIG | ||
97 | #define __new_sigset_t sigset_t | ||
98 | #define __new_sigaction sigaction | ||
99 | #define __old_sigset_t old_sigset_t | ||
100 | #define __old_sigaction old_sigaction | ||
101 | #else | ||
102 | #define _NSIG __OLD_NSIG | ||
103 | #define __old_sigset_t sigset_t | ||
104 | #define __old_sigaction sigaction | ||
105 | #endif | ||
106 | |||
107 | #ifndef __ASSEMBLY__ | ||
108 | |||
109 | typedef unsigned long __old_sigset_t; | ||
110 | |||
111 | typedef struct { | ||
112 | unsigned long sig[_NSIG_WORDS]; | ||
113 | } __new_sigset_t; | ||
114 | |||
115 | |||
116 | #ifdef __KERNEL__ | ||
117 | /* A SunOS sigstack */ | ||
118 | struct sigstack { | ||
119 | char *the_stack; | ||
120 | int cur_status; | ||
121 | }; | ||
122 | #endif | ||
123 | |||
124 | /* Sigvec flags */ | ||
125 | #define _SV_SSTACK 1u /* This signal handler should use sig-stack */ | ||
126 | #define _SV_INTR 2u /* Sig return should not restart system call */ | ||
127 | #define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */ | ||
128 | #define _SV_IGNCHILD 8u /* Do not send SIGCHLD */ | ||
129 | |||
130 | /* | ||
131 | * sa_flags values: SA_STACK is not currently supported, but will allow the | ||
132 | * usage of signal stacks by using the (now obsolete) sa_restorer field in | ||
133 | * the sigaction structure as a stack pointer. This is now possible due to | ||
134 | * the changes in signal handling. LBT 010493. | ||
135 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
136 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
137 | * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. | ||
138 | */ | ||
139 | #define SA_NOCLDSTOP _SV_IGNCHILD | ||
140 | #define SA_STACK _SV_SSTACK | ||
141 | #define SA_ONSTACK _SV_SSTACK | ||
142 | #define SA_RESTART _SV_INTR | ||
143 | #define SA_ONESHOT _SV_RESET | ||
144 | #define SA_INTERRUPT 0x10u | ||
145 | #define SA_NOMASK 0x20u | ||
146 | #define SA_SHIRQ 0x40u | ||
147 | #define SA_NOCLDWAIT 0x100u | ||
148 | #define SA_SIGINFO 0x200u | ||
149 | |||
150 | #define SIG_BLOCK 0x01 /* for blocking signals */ | ||
151 | #define SIG_UNBLOCK 0x02 /* for unblocking signals */ | ||
152 | #define SIG_SETMASK 0x04 /* for setting the signal mask */ | ||
153 | |||
154 | /* | ||
155 | * sigaltstack controls | ||
156 | */ | ||
157 | #define SS_ONSTACK 1 | ||
158 | #define SS_DISABLE 2 | ||
159 | |||
160 | #define MINSIGSTKSZ 4096 | ||
161 | #define SIGSTKSZ 16384 | ||
162 | |||
163 | #ifdef __KERNEL__ | ||
164 | /* | ||
165 | * These values of sa_flags are used only by the kernel as part of the | ||
166 | * irq handling routines. | ||
167 | * | ||
168 | * SA_INTERRUPT is also used by the irq handling routines. | ||
169 | * | ||
170 | * DJHR | ||
171 | * SA_STATIC_ALLOC is used for the SPARC system to indicate that this | ||
172 | * interrupt handler's irq structure should be statically allocated | ||
173 | * by the request_irq routine. | ||
174 | * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge | ||
175 | * of interrupt usage and that sucks. Also without a flag like this | ||
176 | * it may be possible for the free_irq routine to attempt to free | ||
177 | * statically allocated data.. which is NOT GOOD. | ||
178 | * | ||
179 | */ | ||
180 | #define SA_PROBE SA_ONESHOT | ||
181 | #define SA_SAMPLE_RANDOM SA_RESTART | ||
182 | #define SA_STATIC_ALLOC 0x80 | ||
183 | #endif | ||
184 | |||
185 | /* Type of a signal handler. */ | ||
186 | #ifdef __KERNEL__ | ||
187 | typedef void (*__sighandler_t)(int, int, struct sigcontext *, char *); | ||
188 | #else | ||
189 | typedef void (*__sighandler_t)(int); | ||
190 | #endif | ||
191 | |||
192 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ | ||
193 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ | ||
194 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ | ||
195 | |||
196 | #ifdef __KERNEL__ | ||
197 | struct __new_sigaction { | ||
198 | __sighandler_t sa_handler; | ||
199 | unsigned long sa_flags; | ||
200 | void (*sa_restorer)(void); /* Not used by Linux/SPARC */ | ||
201 | __new_sigset_t sa_mask; | ||
202 | }; | ||
203 | |||
204 | struct k_sigaction { | ||
205 | struct __new_sigaction sa; | ||
206 | void __user *ka_restorer; | ||
207 | }; | ||
208 | |||
209 | struct __old_sigaction { | ||
210 | __sighandler_t sa_handler; | ||
211 | __old_sigset_t sa_mask; | ||
212 | unsigned long sa_flags; | ||
213 | void (*sa_restorer) (void); /* not used by Linux/SPARC */ | ||
214 | }; | ||
215 | |||
216 | typedef struct sigaltstack { | ||
217 | void __user *ss_sp; | ||
218 | int ss_flags; | ||
219 | size_t ss_size; | ||
220 | } stack_t; | ||
221 | |||
222 | struct sparc_deliver_cookie { | ||
223 | int restart_syscall; | ||
224 | unsigned long orig_i0; | ||
225 | }; | ||
226 | |||
227 | struct pt_regs; | ||
228 | extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie); | ||
229 | |||
230 | #endif /* !(__KERNEL__) */ | ||
231 | |||
232 | #endif /* !(__ASSEMBLY__) */ | ||
233 | |||
234 | #endif /* !(_ASMSPARC_SIGNAL_H) */ | ||
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h new file mode 100644 index 000000000000..f986c0d0922a --- /dev/null +++ b/include/asm-sparc/smp.h | |||
@@ -0,0 +1,176 @@ | |||
1 | /* smp.h: Sparc specific SMP stuff. | ||
2 | * | ||
3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
4 | */ | ||
5 | |||
6 | #ifndef _SPARC_SMP_H | ||
7 | #define _SPARC_SMP_H | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <linux/threads.h> | ||
11 | #include <asm/head.h> | ||
12 | #include <asm/btfixup.h> | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | #include <linux/cpumask.h> | ||
17 | |||
18 | #endif /* __ASSEMBLY__ */ | ||
19 | |||
20 | #ifdef CONFIG_SMP | ||
21 | |||
22 | #ifndef __ASSEMBLY__ | ||
23 | |||
24 | #include <asm/ptrace.h> | ||
25 | #include <asm/asi.h> | ||
26 | #include <asm/atomic.h> | ||
27 | |||
28 | /* | ||
29 | * Private routines/data | ||
30 | */ | ||
31 | |||
32 | extern unsigned char boot_cpu_id; | ||
33 | extern cpumask_t phys_cpu_present_map; | ||
34 | #define cpu_possible_map phys_cpu_present_map | ||
35 | |||
36 | typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, | ||
37 | unsigned long, unsigned long); | ||
38 | |||
39 | /* | ||
40 | * General functions that each host system must provide. | ||
41 | */ | ||
42 | |||
43 | void sun4m_init_smp(void); | ||
44 | void sun4d_init_smp(void); | ||
45 | |||
46 | void smp_callin(void); | ||
47 | void smp_boot_cpus(void); | ||
48 | void smp_store_cpu_info(int); | ||
49 | |||
50 | struct seq_file; | ||
51 | void smp_bogo(struct seq_file *); | ||
52 | void smp_info(struct seq_file *); | ||
53 | |||
54 | BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) | ||
55 | BTFIXUPDEF_CALL(void, smp_message_pass, int, int, unsigned long, int) | ||
56 | BTFIXUPDEF_CALL(int, __hard_smp_processor_id, void) | ||
57 | BTFIXUPDEF_BLACKBOX(hard_smp_processor_id) | ||
58 | BTFIXUPDEF_BLACKBOX(load_current) | ||
59 | |||
60 | #define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5) | ||
61 | #define smp_message_pass(target,msg,data,wait) BTFIXUP_CALL(smp_message_pass)(target,msg,data,wait) | ||
62 | |||
63 | extern __inline__ void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); } | ||
64 | extern __inline__ void xc1(smpfunc_t func, unsigned long arg1) | ||
65 | { smp_cross_call(func, arg1, 0, 0, 0, 0); } | ||
66 | extern __inline__ void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2) | ||
67 | { smp_cross_call(func, arg1, arg2, 0, 0, 0); } | ||
68 | extern __inline__ void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, | ||
69 | unsigned long arg3) | ||
70 | { smp_cross_call(func, arg1, arg2, arg3, 0, 0); } | ||
71 | extern __inline__ void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, | ||
72 | unsigned long arg3, unsigned long arg4) | ||
73 | { smp_cross_call(func, arg1, arg2, arg3, arg4, 0); } | ||
74 | extern __inline__ void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg2, | ||
75 | unsigned long arg3, unsigned long arg4, unsigned long arg5) | ||
76 | { smp_cross_call(func, arg1, arg2, arg3, arg4, arg5); } | ||
77 | |||
78 | extern __inline__ int smp_call_function(void (*func)(void *info), void *info, int nonatomic, int wait) | ||
79 | { | ||
80 | xc1((smpfunc_t)func, (unsigned long)info); | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | extern __volatile__ int __cpu_number_map[NR_CPUS]; | ||
85 | extern __volatile__ int __cpu_logical_map[NR_CPUS]; | ||
86 | |||
87 | extern __inline__ int cpu_logical_map(int cpu) | ||
88 | { | ||
89 | return __cpu_logical_map[cpu]; | ||
90 | } | ||
91 | extern __inline__ int cpu_number_map(int cpu) | ||
92 | { | ||
93 | return __cpu_number_map[cpu]; | ||
94 | } | ||
95 | |||
96 | extern __inline__ int hard_smp4m_processor_id(void) | ||
97 | { | ||
98 | int cpuid; | ||
99 | |||
100 | __asm__ __volatile__("rd %%tbr, %0\n\t" | ||
101 | "srl %0, 12, %0\n\t" | ||
102 | "and %0, 3, %0\n\t" : | ||
103 | "=&r" (cpuid)); | ||
104 | return cpuid; | ||
105 | } | ||
106 | |||
107 | extern __inline__ int hard_smp4d_processor_id(void) | ||
108 | { | ||
109 | int cpuid; | ||
110 | |||
111 | __asm__ __volatile__("lda [%%g0] %1, %0\n\t" : | ||
112 | "=&r" (cpuid) : "i" (ASI_M_VIKING_TMP1)); | ||
113 | return cpuid; | ||
114 | } | ||
115 | |||
116 | #ifndef MODULE | ||
117 | extern __inline__ int hard_smp_processor_id(void) | ||
118 | { | ||
119 | int cpuid; | ||
120 | |||
121 | /* Black box - sun4m | ||
122 | __asm__ __volatile__("rd %%tbr, %0\n\t" | ||
123 | "srl %0, 12, %0\n\t" | ||
124 | "and %0, 3, %0\n\t" : | ||
125 | "=&r" (cpuid)); | ||
126 | - sun4d | ||
127 | __asm__ __volatile__("lda [%g0] ASI_M_VIKING_TMP1, %0\n\t" | ||
128 | "nop; nop" : | ||
129 | "=&r" (cpuid)); | ||
130 | See btfixup.h and btfixupprep.c to understand how a blackbox works. | ||
131 | */ | ||
132 | __asm__ __volatile__("sethi %%hi(___b_hard_smp_processor_id), %0\n\t" | ||
133 | "sethi %%hi(boot_cpu_id), %0\n\t" | ||
134 | "ldub [%0 + %%lo(boot_cpu_id)], %0\n\t" : | ||
135 | "=&r" (cpuid)); | ||
136 | return cpuid; | ||
137 | } | ||
138 | #else | ||
139 | extern __inline__ int hard_smp_processor_id(void) | ||
140 | { | ||
141 | int cpuid; | ||
142 | |||
143 | __asm__ __volatile__("mov %%o7, %%g1\n\t" | ||
144 | "call ___f___hard_smp_processor_id\n\t" | ||
145 | " nop\n\t" | ||
146 | "mov %%g2, %0\n\t" : "=r"(cpuid) : : "g1", "g2"); | ||
147 | return cpuid; | ||
148 | } | ||
149 | #endif | ||
150 | |||
151 | #define smp_processor_id() (current_thread_info()->cpu) | ||
152 | |||
153 | #define prof_multiplier(__cpu) cpu_data(__cpu).multiplier | ||
154 | #define prof_counter(__cpu) cpu_data(__cpu).counter | ||
155 | |||
156 | #endif /* !(__ASSEMBLY__) */ | ||
157 | |||
158 | /* Sparc specific messages. */ | ||
159 | #define MSG_CROSS_CALL 0x0005 /* run func on cpus */ | ||
160 | |||
161 | /* Empirical PROM processor mailbox constants. If the per-cpu mailbox | ||
162 | * contains something other than one of these then the ipi is from | ||
163 | * Linux's active_kernel_processor. This facility exists so that | ||
164 | * the boot monitor can capture all the other cpus when one catches | ||
165 | * a watchdog reset or the user enters the monitor using L1-A keys. | ||
166 | */ | ||
167 | #define MBOX_STOPCPU 0xFB | ||
168 | #define MBOX_IDLECPU 0xFC | ||
169 | #define MBOX_IDLECPU2 0xFD | ||
170 | #define MBOX_STOPCPU2 0xFE | ||
171 | |||
172 | #endif /* SMP */ | ||
173 | |||
174 | #define NO_PROC_ID 0xFF | ||
175 | |||
176 | #endif /* !(_SPARC_SMP_H) */ | ||
diff --git a/include/asm-sparc/smpprim.h b/include/asm-sparc/smpprim.h new file mode 100644 index 000000000000..9b9c28ed748e --- /dev/null +++ b/include/asm-sparc/smpprim.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* $Id: smpprim.h,v 1.5 1996/08/29 09:48:49 davem Exp $ | ||
2 | * smpprim.h: SMP locking primitives on the Sparc | ||
3 | * | ||
4 | * God knows we won't be actually using this code for some time | ||
5 | * but I thought I'd write it since I knew how. | ||
6 | * | ||
7 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
8 | */ | ||
9 | |||
10 | #ifndef __SPARC_SMPPRIM_H | ||
11 | #define __SPARC_SMPPRIM_H | ||
12 | |||
13 | /* Test and set the unsigned byte at ADDR to 1. Returns the previous | ||
14 | * value. On the Sparc we use the ldstub instruction since it is | ||
15 | * atomic. | ||
16 | */ | ||
17 | |||
18 | extern __inline__ __volatile__ char test_and_set(void *addr) | ||
19 | { | ||
20 | char state = 0; | ||
21 | |||
22 | __asm__ __volatile__("ldstub [%0], %1 ! test_and_set\n\t" | ||
23 | "=r" (addr), "=r" (state) : | ||
24 | "0" (addr), "1" (state) : "memory"); | ||
25 | |||
26 | return state; | ||
27 | } | ||
28 | |||
29 | /* Initialize a spin-lock. */ | ||
30 | extern __inline__ __volatile__ smp_initlock(void *spinlock) | ||
31 | { | ||
32 | /* Unset the lock. */ | ||
33 | *((unsigned char *) spinlock) = 0; | ||
34 | |||
35 | return; | ||
36 | } | ||
37 | |||
38 | /* This routine spins until it acquires the lock at ADDR. */ | ||
39 | extern __inline__ __volatile__ smp_lock(void *addr) | ||
40 | { | ||
41 | while(test_and_set(addr) == 0xff) | ||
42 | ; | ||
43 | |||
44 | /* We now have the lock */ | ||
45 | return; | ||
46 | } | ||
47 | |||
48 | /* This routine releases the lock at ADDR. */ | ||
49 | extern __inline__ __volatile__ smp_unlock(void *addr) | ||
50 | { | ||
51 | *((unsigned char *) addr) = 0; | ||
52 | } | ||
53 | |||
54 | #endif /* !(__SPARC_SMPPRIM_H) */ | ||
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h new file mode 100644 index 000000000000..c1154e3ecfdf --- /dev/null +++ b/include/asm-sparc/socket.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* $Id: socket.h,v 1.17 2001/06/13 16:25:03 davem Exp $ */ | ||
2 | #ifndef _ASM_SOCKET_H | ||
3 | #define _ASM_SOCKET_H | ||
4 | |||
5 | #include <asm/sockios.h> | ||
6 | |||
7 | /* For setsockopt(2) */ | ||
8 | #define SOL_SOCKET 0xffff | ||
9 | |||
10 | #define SO_DEBUG 0x0001 | ||
11 | #define SO_PASSCRED 0x0002 | ||
12 | #define SO_REUSEADDR 0x0004 | ||
13 | #define SO_KEEPALIVE 0x0008 | ||
14 | #define SO_DONTROUTE 0x0010 | ||
15 | #define SO_BROADCAST 0x0020 | ||
16 | #define SO_PEERCRED 0x0040 | ||
17 | #define SO_LINGER 0x0080 | ||
18 | #define SO_OOBINLINE 0x0100 | ||
19 | /* To add :#define SO_REUSEPORT 0x0200 */ | ||
20 | #define SO_BSDCOMPAT 0x0400 | ||
21 | #define SO_RCVLOWAT 0x0800 | ||
22 | #define SO_SNDLOWAT 0x1000 | ||
23 | #define SO_RCVTIMEO 0x2000 | ||
24 | #define SO_SNDTIMEO 0x4000 | ||
25 | #define SO_ACCEPTCONN 0x8000 | ||
26 | |||
27 | /* wha!??? */ | ||
28 | #define SO_DONTLINGER (~SO_LINGER) /* Older SunOS compat. hack */ | ||
29 | |||
30 | #define SO_SNDBUF 0x1001 | ||
31 | #define SO_RCVBUF 0x1002 | ||
32 | #define SO_ERROR 0x1007 | ||
33 | #define SO_TYPE 0x1008 | ||
34 | |||
35 | /* Linux specific, keep the same. */ | ||
36 | #define SO_NO_CHECK 0x000b | ||
37 | #define SO_PRIORITY 0x000c | ||
38 | |||
39 | #define SO_BINDTODEVICE 0x000d | ||
40 | |||
41 | #define SO_ATTACH_FILTER 0x001a | ||
42 | #define SO_DETACH_FILTER 0x001b | ||
43 | |||
44 | #define SO_PEERNAME 0x001c | ||
45 | #define SO_TIMESTAMP 0x001d | ||
46 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
47 | |||
48 | #define SO_PEERSEC 0x100e | ||
49 | |||
50 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
51 | #define SO_SECURITY_AUTHENTICATION 0x5001 | ||
52 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 | ||
53 | #define SO_SECURITY_ENCRYPTION_NETWORK 0x5004 | ||
54 | |||
55 | #endif /* _ASM_SOCKET_H */ | ||
diff --git a/include/asm-sparc/sockios.h b/include/asm-sparc/sockios.h new file mode 100644 index 000000000000..0c01b597b06f --- /dev/null +++ b/include/asm-sparc/sockios.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _ASM_SPARC_SOCKIOS_H | ||
2 | #define _ASM_SPARC_SOCKIOS_H | ||
3 | |||
4 | /* Socket-level I/O control calls. */ | ||
5 | #define FIOSETOWN 0x8901 | ||
6 | #define SIOCSPGRP 0x8902 | ||
7 | #define FIOGETOWN 0x8903 | ||
8 | #define SIOCGPGRP 0x8904 | ||
9 | #define SIOCATMARK 0x8905 | ||
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | ||
11 | |||
12 | #endif /* !(_ASM_SPARC_SOCKIOS_H) */ | ||
13 | |||
diff --git a/include/asm-sparc/solerrno.h b/include/asm-sparc/solerrno.h new file mode 100644 index 000000000000..8abce7e4639f --- /dev/null +++ b/include/asm-sparc/solerrno.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /* $Id: solerrno.h,v 1.5 1996/04/25 06:13:32 davem Exp $ | ||
2 | * solerrno.h: Solaris error return codes for compatibility. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_SOLERRNO_H | ||
8 | #define _SPARC_SOLERRNO_H | ||
9 | |||
10 | #define SOL_EPERM 1 /* Required superuser access perms */ | ||
11 | #define SOL_ENOENT 2 /* File or directory does not exist */ | ||
12 | #define SOL_ESRCH 3 /* Process did not exist */ | ||
13 | #define SOL_EINTR 4 /* System call was interrupted */ | ||
14 | #define SOL_EIO 5 /* An i/o error occurred */ | ||
15 | #define SOL_ENXIO 6 /* Device or Address does not exist */ | ||
16 | #define SOL_E2BIG 7 /* Too many arguments were given */ | ||
17 | #define SOL_ENOEXEC 8 /* Header of executable was munged */ | ||
18 | #define SOL_EBADF 9 /* Bogus file number */ | ||
19 | #define SOL_ECHILD 10 /* No children of process exist */ | ||
20 | #define SOL_EAGAIN 11 /* beep beep, "try again later" */ | ||
21 | #define SOL_ENOMEM 12 /* No memory available */ | ||
22 | #define SOL_EACCES 13 /* Access not allowed */ | ||
23 | #define SOL_EFAULT 14 /* Address passed was invalid */ | ||
24 | #define SOL_ENOTBLK 15 /* blkdev op on non-block device */ | ||
25 | #define SOL_EBUSY 16 /* Mounted device was busy */ | ||
26 | #define SOL_EEXIST 17 /* File specified already exists */ | ||
27 | #define SOL_EXDEV 18 /* Link request across diff devices */ | ||
28 | #define SOL_ENODEV 19 /* Device does not exist on system */ | ||
29 | #define SOL_ENOTDIR 20 /* Dir operation on non-directory */ | ||
30 | #define SOL_EISDIR 21 /* File was of directory type */ | ||
31 | #define SOL_EINVAL 22 /* Argument passed was invalid */ | ||
32 | #define SOL_ENFILE 23 /* No more room in file table */ | ||
33 | #define SOL_EMFILE 24 /* Proc has too many files open */ | ||
34 | #define SOL_ENOTTY 25 /* Ioctl was invalid for req device */ | ||
35 | #define SOL_ETXTBSY 26 /* Text file in busy state */ | ||
36 | #define SOL_EFBIG 27 /* Too big of a file for operation */ | ||
37 | #define SOL_ENOSPC 28 /* Disk is full */ | ||
38 | #define SOL_ESPIPE 29 /* Seek attempted on non-seeking dev*/ | ||
39 | #define SOL_EROFS 30 /* Write attempted on read-only fs */ | ||
40 | #define SOL_EMLINK 31 /* Too many links in file search */ | ||
41 | #define SOL_EPIPE 32 /* Call a plumber */ | ||
42 | #define SOL_EDOM 33 /* Argument was out of fct domain */ | ||
43 | #define SOL_ERANGE 34 /* Could not represent math result */ | ||
44 | #define SOL_ENOMSG 35 /* Message of req type doesn't exist */ | ||
45 | #define SOL_EIDRM 36 /* Identifier has been removed */ | ||
46 | #define SOL_ECHRNG 37 /* Req channel number out of range */ | ||
47 | #define SOL_EL2NSYNC 38 /* Could not sync at run level 2 */ | ||
48 | #define SOL_EL3HLT 39 /* Halted at run level 3 */ | ||
49 | #define SOL_EL3RST 40 /* Reset at run level 3 */ | ||
50 | #define SOL_ELNRNG 41 /* Out of range link number */ | ||
51 | #define SOL_EUNATCH 42 /* Driver for protocol not attached */ | ||
52 | #define SOL_ENOCSI 43 /* CSI structure not around */ | ||
53 | #define SOL_EL2HLT 44 /* Halted at run level 2 */ | ||
54 | #define SOL_EDEADLK 45 /* Deadlock condition detected */ | ||
55 | #define SOL_ENOLCK 46 /* Record locks unavailable */ | ||
56 | #define SOL_ECANCELED 47 /* Cancellation of oper. happened */ | ||
57 | #define SOL_ENOTSUP 48 /* Attempt of unsupported operation */ | ||
58 | #define SOL_EDQUOT 49 /* Users disk quota exceeded */ | ||
59 | #define SOL_EBADE 50 /* Invalid exchange */ | ||
60 | #define SOL_EBADR 51 /* Request descriptor was invalid */ | ||
61 | #define SOL_EXFULL 52 /* Full exchange */ | ||
62 | #define SOL_ENOANO 53 /* ano does not exist */ | ||
63 | #define SOL_EBADRQC 54 /* Req code was invalid */ | ||
64 | #define SOL_EBADSLT 55 /* Bad slot number */ | ||
65 | #define SOL_EDEADLOCK 56 /* Deadlock in fs error */ | ||
66 | #define SOL_EBFONT 57 /* Font file format invalid */ | ||
67 | /* YOW, I LOVE SYSV STREAMS!!!! */ | ||
68 | #define SOL_ENOSTR 60 /* Stream-op on non-stream dev */ | ||
69 | #define SOL_ENODATA 61 /* No data avail at this time */ | ||
70 | #define SOL_ETIME 62 /* Expiration of time occurred */ | ||
71 | #define SOL_ENOSR 63 /* Streams resources exhausted */ | ||
72 | #define SOL_ENONET 64 /* No network connected */ | ||
73 | #define SOL_ENOPKG 65 /* Non-installed package */ | ||
74 | #define SOL_EREMOTE 66 /* Object was on remote machine */ | ||
75 | #define SOL_ENOLINK 67 /* Cut link */ | ||
76 | #define SOL_EADV 68 /* Error in advertise */ | ||
77 | #define SOL_ESRMNT 69 /* Some magic srmount problem */ | ||
78 | #define SOL_ECOMM 70 /* During send, comm error occurred */ | ||
79 | #define SOL_EPROTO 71 /* Protocol botch */ | ||
80 | #define SOL_EMULTIHOP 74 /* Multihop attempted */ | ||
81 | #define SOL_EBADMSG 77 /* Message was unreadable */ | ||
82 | #define SOL_ENAMETOOLONG 78 /* Too long of a path name */ | ||
83 | #define SOL_EOVERFLOW 79 /* Data type too small for datum */ | ||
84 | #define SOL_ENOTUNIQ 80 /* Logical name was not unique */ | ||
85 | #define SOL_EBADFD 81 /* Op cannot be performed on fd */ | ||
86 | #define SOL_EREMCHG 82 /* Remote address is now different */ | ||
87 | #define SOL_ELIBACC 83 /* Shared lib could not be accessed */ | ||
88 | #define SOL_ELIBBAD 84 /* ShLib is corrupted in some way */ | ||
89 | #define SOL_ELIBSCN 85 /* A.out ShLib problems */ | ||
90 | #define SOL_ELIBMAX 86 /* Exceeded ShLib linkage limit */ | ||
91 | #define SOL_ELIBEXEC 87 /* Execution of ShLib attempted */ | ||
92 | #define SOL_EILSEQ 88 /* Bad byte sequence found */ | ||
93 | #define SOL_ENOSYS 89 /* Invalid filesystem operation */ | ||
94 | #define SOL_ELOOP 90 /* Detected loop in symbolic links */ | ||
95 | #define SOL_ERESTART 91 /* System call is restartable */ | ||
96 | #define SOL_ESTRPIPE 92 /* Do not sleep in head of stream */ | ||
97 | #define SOL_ENOTEMPTY 93 /* Rmdir of non-empty directory */ | ||
98 | #define SOL_EUSERS 94 /* Over abundance of users for ufs */ | ||
99 | #define SOL_ENOTSOCK 95 /* Sock-op on non-sock */ | ||
100 | #define SOL_EDESTADDRREQ 96 /* No dest addr given, but needed */ | ||
101 | #define SOL_EMSGSIZE 97 /* Msg too big */ | ||
102 | #define SOL_EPROTOTYPE 98 /* Bad socket protocol */ | ||
103 | #define SOL_ENOPROTOOPT 99 /* Unavailable protocol */ | ||
104 | #define SOL_EPROTONOSUPPORT 120 /* Unsupported protocol */ | ||
105 | #define SOL_ESOCKTNOSUPPORT 121 /* Unsupported socket type */ | ||
106 | #define SOL_EOPNOTSUPP 122 /* Unsupported sock-op */ | ||
107 | #define SOL_EPFNOSUPPORT 123 /* Unsupported protocol family */ | ||
108 | #define SOL_EAFNOSUPPORT 124 /* Unsup addr family for protocol */ | ||
109 | #define SOL_EADDRINUSE 125 /* Req addr is already in use */ | ||
110 | #define SOL_EADDRNOTAVAIL 126 /* Req addr not available right now */ | ||
111 | #define SOL_ENETDOWN 127 /* Your subnet is on fire */ | ||
112 | #define SOL_ENETUNREACH 128 /* Someone playing with gateway and */ | ||
113 | /* did not tell you he was going to */ | ||
114 | #define SOL_ENETRESET 129 /* Buy less-buggy ethernet cards */ | ||
115 | #define SOL_ECONNABORTED 130 /* Aborted connection due to sw */ | ||
116 | #define SOL_ECONNRESET 131 /* Your peers reset your connection */ | ||
117 | #define SOL_ENOBUFS 132 /* No buffer space available */ | ||
118 | #define SOL_EISCONN 133 /* Connect on already connected */ | ||
119 | /* socket attempted */ | ||
120 | #define SOL_ENOTCONN 134 /* Comm on non-connected socket */ | ||
121 | #define SOL_ESHUTDOWN 143 /* Op attempted after sock-shutdown */ | ||
122 | #define SOL_ETOOMANYREFS 144 /* Reference limit exceeded */ | ||
123 | #define SOL_ETIMEDOUT 145 /* Timed out connection */ | ||
124 | #define SOL_ECONNREFUSED 146 /* Connection refused by remote host*/ | ||
125 | #define SOL_EHOSTDOWN 147 /* Remote host is up in flames */ | ||
126 | #define SOL_EHOSTUNREACH 148 /* Make a left at Easton Ave..... */ | ||
127 | #define SOL_EWOULDBLOCK EAGAIN /* Just an alias */ | ||
128 | #define SOL_EALREADY 149 /* Operation is already occurring */ | ||
129 | #define SOL_EINPROGRESS 150 /* Operation is happening now */ | ||
130 | #define SOL_ESTALE 151 /* Fungus growth on NFS file handle */ | ||
131 | |||
132 | #endif /* !(_SPARC_SOLERRNO_H) */ | ||
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h new file mode 100644 index 000000000000..0cbd87ad4912 --- /dev/null +++ b/include/asm-sparc/spinlock.h | |||
@@ -0,0 +1,238 @@ | |||
1 | /* spinlock.h: 32-bit Sparc spinlock support. | ||
2 | * | ||
3 | * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) | ||
4 | */ | ||
5 | |||
6 | #ifndef __SPARC_SPINLOCK_H | ||
7 | #define __SPARC_SPINLOCK_H | ||
8 | |||
9 | #include <linux/threads.h> /* For NR_CPUS */ | ||
10 | |||
11 | #ifndef __ASSEMBLY__ | ||
12 | |||
13 | #include <asm/psr.h> | ||
14 | |||
15 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
16 | struct _spinlock_debug { | ||
17 | unsigned char lock; | ||
18 | unsigned long owner_pc; | ||
19 | #ifdef CONFIG_PREEMPT | ||
20 | unsigned int break_lock; | ||
21 | #endif | ||
22 | }; | ||
23 | typedef struct _spinlock_debug spinlock_t; | ||
24 | |||
25 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0 } | ||
26 | #define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) | ||
27 | #define spin_is_locked(lp) (*((volatile unsigned char *)(&((lp)->lock))) != 0) | ||
28 | #define spin_unlock_wait(lp) do { barrier(); } while(*(volatile unsigned char *)(&(lp)->lock)) | ||
29 | |||
30 | extern void _do_spin_lock(spinlock_t *lock, char *str); | ||
31 | extern int _spin_trylock(spinlock_t *lock); | ||
32 | extern void _do_spin_unlock(spinlock_t *lock); | ||
33 | |||
34 | #define _raw_spin_trylock(lp) _spin_trylock(lp) | ||
35 | #define _raw_spin_lock(lock) _do_spin_lock(lock, "spin_lock") | ||
36 | #define _raw_spin_unlock(lock) _do_spin_unlock(lock) | ||
37 | |||
38 | struct _rwlock_debug { | ||
39 | volatile unsigned int lock; | ||
40 | unsigned long owner_pc; | ||
41 | unsigned long reader_pc[NR_CPUS]; | ||
42 | #ifdef CONFIG_PREEMPT | ||
43 | unsigned int break_lock; | ||
44 | #endif | ||
45 | }; | ||
46 | typedef struct _rwlock_debug rwlock_t; | ||
47 | |||
48 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, {0} } | ||
49 | |||
50 | #define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) | ||
51 | |||
52 | extern void _do_read_lock(rwlock_t *rw, char *str); | ||
53 | extern void _do_read_unlock(rwlock_t *rw, char *str); | ||
54 | extern void _do_write_lock(rwlock_t *rw, char *str); | ||
55 | extern void _do_write_unlock(rwlock_t *rw); | ||
56 | |||
57 | #define _raw_read_lock(lock) \ | ||
58 | do { unsigned long flags; \ | ||
59 | local_irq_save(flags); \ | ||
60 | _do_read_lock(lock, "read_lock"); \ | ||
61 | local_irq_restore(flags); \ | ||
62 | } while(0) | ||
63 | |||
64 | #define _raw_read_unlock(lock) \ | ||
65 | do { unsigned long flags; \ | ||
66 | local_irq_save(flags); \ | ||
67 | _do_read_unlock(lock, "read_unlock"); \ | ||
68 | local_irq_restore(flags); \ | ||
69 | } while(0) | ||
70 | |||
71 | #define _raw_write_lock(lock) \ | ||
72 | do { unsigned long flags; \ | ||
73 | local_irq_save(flags); \ | ||
74 | _do_write_lock(lock, "write_lock"); \ | ||
75 | local_irq_restore(flags); \ | ||
76 | } while(0) | ||
77 | |||
78 | #define _raw_write_unlock(lock) \ | ||
79 | do { unsigned long flags; \ | ||
80 | local_irq_save(flags); \ | ||
81 | _do_write_unlock(lock); \ | ||
82 | local_irq_restore(flags); \ | ||
83 | } while(0) | ||
84 | |||
85 | #else /* !CONFIG_DEBUG_SPINLOCK */ | ||
86 | |||
87 | typedef struct { | ||
88 | unsigned char lock; | ||
89 | #ifdef CONFIG_PREEMPT | ||
90 | unsigned int break_lock; | ||
91 | #endif | ||
92 | } spinlock_t; | ||
93 | |||
94 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
95 | |||
96 | #define spin_lock_init(lock) (*((unsigned char *)(lock)) = 0) | ||
97 | #define spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) | ||
98 | |||
99 | #define spin_unlock_wait(lock) \ | ||
100 | do { \ | ||
101 | barrier(); \ | ||
102 | } while(*((volatile unsigned char *)lock)) | ||
103 | |||
104 | extern __inline__ void _raw_spin_lock(spinlock_t *lock) | ||
105 | { | ||
106 | __asm__ __volatile__( | ||
107 | "\n1:\n\t" | ||
108 | "ldstub [%0], %%g2\n\t" | ||
109 | "orcc %%g2, 0x0, %%g0\n\t" | ||
110 | "bne,a 2f\n\t" | ||
111 | " ldub [%0], %%g2\n\t" | ||
112 | ".subsection 2\n" | ||
113 | "2:\n\t" | ||
114 | "orcc %%g2, 0x0, %%g0\n\t" | ||
115 | "bne,a 2b\n\t" | ||
116 | " ldub [%0], %%g2\n\t" | ||
117 | "b,a 1b\n\t" | ||
118 | ".previous\n" | ||
119 | : /* no outputs */ | ||
120 | : "r" (lock) | ||
121 | : "g2", "memory", "cc"); | ||
122 | } | ||
123 | |||
124 | extern __inline__ int _raw_spin_trylock(spinlock_t *lock) | ||
125 | { | ||
126 | unsigned int result; | ||
127 | __asm__ __volatile__("ldstub [%1], %0" | ||
128 | : "=r" (result) | ||
129 | : "r" (lock) | ||
130 | : "memory"); | ||
131 | return (result == 0); | ||
132 | } | ||
133 | |||
134 | extern __inline__ void _raw_spin_unlock(spinlock_t *lock) | ||
135 | { | ||
136 | __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); | ||
137 | } | ||
138 | |||
139 | /* Read-write spinlocks, allowing multiple readers | ||
140 | * but only one writer. | ||
141 | * | ||
142 | * NOTE! it is quite common to have readers in interrupts | ||
143 | * but no interrupt writers. For those circumstances we | ||
144 | * can "mix" irq-safe locks - any writer needs to get a | ||
145 | * irq-safe write-lock, but readers can get non-irqsafe | ||
146 | * read-locks. | ||
147 | * | ||
148 | * XXX This might create some problems with my dual spinlock | ||
149 | * XXX scheme, deadlocks etc. -DaveM | ||
150 | */ | ||
151 | typedef struct { | ||
152 | volatile unsigned int lock; | ||
153 | #ifdef CONFIG_PREEMPT | ||
154 | unsigned int break_lock; | ||
155 | #endif | ||
156 | } rwlock_t; | ||
157 | |||
158 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
159 | |||
160 | #define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) | ||
161 | |||
162 | |||
163 | /* Sort of like atomic_t's on Sparc, but even more clever. | ||
164 | * | ||
165 | * ------------------------------------ | ||
166 | * | 24-bit counter | wlock | rwlock_t | ||
167 | * ------------------------------------ | ||
168 | * 31 8 7 0 | ||
169 | * | ||
170 | * wlock signifies the one writer is in or somebody is updating | ||
171 | * counter. For a writer, if he successfully acquires the wlock, | ||
172 | * but counter is non-zero, he has to release the lock and wait, | ||
173 | * till both counter and wlock are zero. | ||
174 | * | ||
175 | * Unfortunately this scheme limits us to ~16,000,000 cpus. | ||
176 | */ | ||
177 | extern __inline__ void _read_lock(rwlock_t *rw) | ||
178 | { | ||
179 | register rwlock_t *lp asm("g1"); | ||
180 | lp = rw; | ||
181 | __asm__ __volatile__( | ||
182 | "mov %%o7, %%g4\n\t" | ||
183 | "call ___rw_read_enter\n\t" | ||
184 | " ldstub [%%g1 + 3], %%g2\n" | ||
185 | : /* no outputs */ | ||
186 | : "r" (lp) | ||
187 | : "g2", "g4", "memory", "cc"); | ||
188 | } | ||
189 | |||
190 | #define _raw_read_lock(lock) \ | ||
191 | do { unsigned long flags; \ | ||
192 | local_irq_save(flags); \ | ||
193 | _read_lock(lock); \ | ||
194 | local_irq_restore(flags); \ | ||
195 | } while(0) | ||
196 | |||
197 | extern __inline__ void _read_unlock(rwlock_t *rw) | ||
198 | { | ||
199 | register rwlock_t *lp asm("g1"); | ||
200 | lp = rw; | ||
201 | __asm__ __volatile__( | ||
202 | "mov %%o7, %%g4\n\t" | ||
203 | "call ___rw_read_exit\n\t" | ||
204 | " ldstub [%%g1 + 3], %%g2\n" | ||
205 | : /* no outputs */ | ||
206 | : "r" (lp) | ||
207 | : "g2", "g4", "memory", "cc"); | ||
208 | } | ||
209 | |||
210 | #define _raw_read_unlock(lock) \ | ||
211 | do { unsigned long flags; \ | ||
212 | local_irq_save(flags); \ | ||
213 | _read_unlock(lock); \ | ||
214 | local_irq_restore(flags); \ | ||
215 | } while(0) | ||
216 | |||
217 | extern __inline__ void _raw_write_lock(rwlock_t *rw) | ||
218 | { | ||
219 | register rwlock_t *lp asm("g1"); | ||
220 | lp = rw; | ||
221 | __asm__ __volatile__( | ||
222 | "mov %%o7, %%g4\n\t" | ||
223 | "call ___rw_write_enter\n\t" | ||
224 | " ldstub [%%g1 + 3], %%g2\n" | ||
225 | : /* no outputs */ | ||
226 | : "r" (lp) | ||
227 | : "g2", "g4", "memory", "cc"); | ||
228 | } | ||
229 | |||
230 | #define _raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) | ||
231 | |||
232 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
233 | |||
234 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
235 | |||
236 | #endif /* !(__ASSEMBLY__) */ | ||
237 | |||
238 | #endif /* __SPARC_SPINLOCK_H */ | ||
diff --git a/include/asm-sparc/stat.h b/include/asm-sparc/stat.h new file mode 100644 index 000000000000..a5b4272f2894 --- /dev/null +++ b/include/asm-sparc/stat.h | |||
@@ -0,0 +1,77 @@ | |||
1 | /* $Id: stat.h,v 1.12 2000/08/04 05:35:55 davem Exp $ */ | ||
2 | #ifndef _SPARC_STAT_H | ||
3 | #define _SPARC_STAT_H | ||
4 | |||
5 | #include <linux/types.h> | ||
6 | |||
7 | struct __old_kernel_stat { | ||
8 | unsigned short st_dev; | ||
9 | unsigned short st_ino; | ||
10 | unsigned short st_mode; | ||
11 | unsigned short st_nlink; | ||
12 | unsigned short st_uid; | ||
13 | unsigned short st_gid; | ||
14 | unsigned short st_rdev; | ||
15 | unsigned long st_size; | ||
16 | unsigned long st_atime; | ||
17 | unsigned long st_mtime; | ||
18 | unsigned long st_ctime; | ||
19 | }; | ||
20 | |||
21 | struct stat { | ||
22 | unsigned short st_dev; | ||
23 | unsigned long st_ino; | ||
24 | unsigned short st_mode; | ||
25 | short st_nlink; | ||
26 | unsigned short st_uid; | ||
27 | unsigned short st_gid; | ||
28 | unsigned short st_rdev; | ||
29 | long st_size; | ||
30 | long st_atime; | ||
31 | unsigned long st_atime_nsec; | ||
32 | long st_mtime; | ||
33 | unsigned long st_mtime_nsec; | ||
34 | long st_ctime; | ||
35 | unsigned long st_ctime_nsec; | ||
36 | long st_blksize; | ||
37 | long st_blocks; | ||
38 | unsigned long __unused4[2]; | ||
39 | }; | ||
40 | |||
41 | #define STAT_HAVE_NSEC 1 | ||
42 | |||
43 | struct stat64 { | ||
44 | unsigned long long st_dev; | ||
45 | |||
46 | unsigned long long st_ino; | ||
47 | |||
48 | unsigned int st_mode; | ||
49 | unsigned int st_nlink; | ||
50 | |||
51 | unsigned int st_uid; | ||
52 | unsigned int st_gid; | ||
53 | |||
54 | unsigned long long st_rdev; | ||
55 | |||
56 | unsigned char __pad3[8]; | ||
57 | |||
58 | long long st_size; | ||
59 | unsigned int st_blksize; | ||
60 | |||
61 | unsigned char __pad4[8]; | ||
62 | unsigned int st_blocks; | ||
63 | |||
64 | unsigned int st_atime; | ||
65 | unsigned int st_atime_nsec; | ||
66 | |||
67 | unsigned int st_mtime; | ||
68 | unsigned int st_mtime_nsec; | ||
69 | |||
70 | unsigned int st_ctime; | ||
71 | unsigned int st_ctime_nsec; | ||
72 | |||
73 | unsigned int __unused4; | ||
74 | unsigned int __unused5; | ||
75 | }; | ||
76 | |||
77 | #endif | ||
diff --git a/include/asm-sparc/statfs.h b/include/asm-sparc/statfs.h new file mode 100644 index 000000000000..d623f144247d --- /dev/null +++ b/include/asm-sparc/statfs.h | |||
@@ -0,0 +1,7 @@ | |||
1 | /* $Id: statfs.h,v 1.4 1996/06/07 00:41:05 ecd Exp $ */ | ||
2 | #ifndef _SPARC_STATFS_H | ||
3 | #define _SPARC_STATFS_H | ||
4 | |||
5 | #include <asm-generic/statfs.h> | ||
6 | |||
7 | #endif | ||
diff --git a/include/asm-sparc/string.h b/include/asm-sparc/string.h new file mode 100644 index 000000000000..cb1e923356c6 --- /dev/null +++ b/include/asm-sparc/string.h | |||
@@ -0,0 +1,205 @@ | |||
1 | /* $Id: string.h,v 1.36 2001/12/21 00:54:31 davem Exp $ | ||
2 | * string.h: External definitions for optimized assembly string | ||
3 | * routines for the Linux Kernel. | ||
4 | * | ||
5 | * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu) | ||
6 | * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
7 | */ | ||
8 | |||
9 | #ifndef __SPARC_STRING_H__ | ||
10 | #define __SPARC_STRING_H__ | ||
11 | |||
12 | #include <asm/page.h> | ||
13 | |||
14 | /* Really, userland/ksyms should not see any of this stuff. */ | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | extern void __memmove(void *,const void *,__kernel_size_t); | ||
19 | extern __kernel_size_t __memcpy(void *,const void *,__kernel_size_t); | ||
20 | extern __kernel_size_t __memset(void *,int,__kernel_size_t); | ||
21 | |||
22 | #ifndef EXPORT_SYMTAB_STROPS | ||
23 | |||
24 | /* First the mem*() things. */ | ||
25 | #define __HAVE_ARCH_MEMMOVE | ||
26 | #undef memmove | ||
27 | #define memmove(_to, _from, _n) \ | ||
28 | ({ \ | ||
29 | void *_t = (_to); \ | ||
30 | __memmove(_t, (_from), (_n)); \ | ||
31 | _t; \ | ||
32 | }) | ||
33 | |||
34 | #define __HAVE_ARCH_MEMCPY | ||
35 | |||
36 | static inline void *__constant_memcpy(void *to, const void *from, __kernel_size_t n) | ||
37 | { | ||
38 | extern void __copy_1page(void *, const void *); | ||
39 | |||
40 | if(n <= 32) { | ||
41 | __builtin_memcpy(to, from, n); | ||
42 | } else if (((unsigned int) to & 7) != 0) { | ||
43 | /* Destination is not aligned on the double-word boundary */ | ||
44 | __memcpy(to, from, n); | ||
45 | } else { | ||
46 | switch(n) { | ||
47 | case PAGE_SIZE: | ||
48 | __copy_1page(to, from); | ||
49 | break; | ||
50 | default: | ||
51 | __memcpy(to, from, n); | ||
52 | break; | ||
53 | } | ||
54 | } | ||
55 | return to; | ||
56 | } | ||
57 | |||
58 | static inline void *__nonconstant_memcpy(void *to, const void *from, __kernel_size_t n) | ||
59 | { | ||
60 | __memcpy(to, from, n); | ||
61 | return to; | ||
62 | } | ||
63 | |||
64 | #undef memcpy | ||
65 | #define memcpy(t, f, n) \ | ||
66 | (__builtin_constant_p(n) ? \ | ||
67 | __constant_memcpy((t),(f),(n)) : \ | ||
68 | __nonconstant_memcpy((t),(f),(n))) | ||
69 | |||
70 | #define __HAVE_ARCH_MEMSET | ||
71 | |||
72 | static inline void *__constant_c_and_count_memset(void *s, char c, __kernel_size_t count) | ||
73 | { | ||
74 | extern void bzero_1page(void *); | ||
75 | extern __kernel_size_t __bzero(void *, __kernel_size_t); | ||
76 | |||
77 | if(!c) { | ||
78 | if(count == PAGE_SIZE) | ||
79 | bzero_1page(s); | ||
80 | else | ||
81 | __bzero(s, count); | ||
82 | } else { | ||
83 | __memset(s, c, count); | ||
84 | } | ||
85 | return s; | ||
86 | } | ||
87 | |||
88 | static inline void *__constant_c_memset(void *s, char c, __kernel_size_t count) | ||
89 | { | ||
90 | extern __kernel_size_t __bzero(void *, __kernel_size_t); | ||
91 | |||
92 | if(!c) | ||
93 | __bzero(s, count); | ||
94 | else | ||
95 | __memset(s, c, count); | ||
96 | return s; | ||
97 | } | ||
98 | |||
99 | static inline void *__nonconstant_memset(void *s, char c, __kernel_size_t count) | ||
100 | { | ||
101 | __memset(s, c, count); | ||
102 | return s; | ||
103 | } | ||
104 | |||
105 | #undef memset | ||
106 | #define memset(s, c, count) \ | ||
107 | (__builtin_constant_p(c) ? (__builtin_constant_p(count) ? \ | ||
108 | __constant_c_and_count_memset((s), (c), (count)) : \ | ||
109 | __constant_c_memset((s), (c), (count))) \ | ||
110 | : __nonconstant_memset((s), (c), (count))) | ||
111 | |||
112 | #define __HAVE_ARCH_MEMSCAN | ||
113 | |||
114 | #undef memscan | ||
115 | #define memscan(__arg0, __char, __arg2) \ | ||
116 | ({ \ | ||
117 | extern void *__memscan_zero(void *, size_t); \ | ||
118 | extern void *__memscan_generic(void *, int, size_t); \ | ||
119 | void *__retval, *__addr = (__arg0); \ | ||
120 | size_t __size = (__arg2); \ | ||
121 | \ | ||
122 | if(__builtin_constant_p(__char) && !(__char)) \ | ||
123 | __retval = __memscan_zero(__addr, __size); \ | ||
124 | else \ | ||
125 | __retval = __memscan_generic(__addr, (__char), __size); \ | ||
126 | \ | ||
127 | __retval; \ | ||
128 | }) | ||
129 | |||
130 | #define __HAVE_ARCH_MEMCMP | ||
131 | extern int memcmp(const void *,const void *,__kernel_size_t); | ||
132 | |||
133 | /* Now the str*() stuff... */ | ||
134 | #define __HAVE_ARCH_STRLEN | ||
135 | extern __kernel_size_t strlen(const char *); | ||
136 | |||
137 | #define __HAVE_ARCH_STRNCMP | ||
138 | |||
139 | extern int __strncmp(const char *, const char *, __kernel_size_t); | ||
140 | |||
141 | static inline int __constant_strncmp(const char *src, const char *dest, __kernel_size_t count) | ||
142 | { | ||
143 | register int retval; | ||
144 | switch(count) { | ||
145 | case 0: return 0; | ||
146 | case 1: return (src[0] - dest[0]); | ||
147 | case 2: retval = (src[0] - dest[0]); | ||
148 | if(!retval && src[0]) | ||
149 | retval = (src[1] - dest[1]); | ||
150 | return retval; | ||
151 | case 3: retval = (src[0] - dest[0]); | ||
152 | if(!retval && src[0]) { | ||
153 | retval = (src[1] - dest[1]); | ||
154 | if(!retval && src[1]) | ||
155 | retval = (src[2] - dest[2]); | ||
156 | } | ||
157 | return retval; | ||
158 | case 4: retval = (src[0] - dest[0]); | ||
159 | if(!retval && src[0]) { | ||
160 | retval = (src[1] - dest[1]); | ||
161 | if(!retval && src[1]) { | ||
162 | retval = (src[2] - dest[2]); | ||
163 | if (!retval && src[2]) | ||
164 | retval = (src[3] - dest[3]); | ||
165 | } | ||
166 | } | ||
167 | return retval; | ||
168 | case 5: retval = (src[0] - dest[0]); | ||
169 | if(!retval && src[0]) { | ||
170 | retval = (src[1] - dest[1]); | ||
171 | if(!retval && src[1]) { | ||
172 | retval = (src[2] - dest[2]); | ||
173 | if (!retval && src[2]) { | ||
174 | retval = (src[3] - dest[3]); | ||
175 | if (!retval && src[3]) | ||
176 | retval = (src[4] - dest[4]); | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | return retval; | ||
181 | default: | ||
182 | retval = (src[0] - dest[0]); | ||
183 | if(!retval && src[0]) { | ||
184 | retval = (src[1] - dest[1]); | ||
185 | if(!retval && src[1]) { | ||
186 | retval = (src[2] - dest[2]); | ||
187 | if(!retval && src[2]) | ||
188 | retval = __strncmp(src+3,dest+3,count-3); | ||
189 | } | ||
190 | } | ||
191 | return retval; | ||
192 | } | ||
193 | } | ||
194 | |||
195 | #undef strncmp | ||
196 | #define strncmp(__arg0, __arg1, __arg2) \ | ||
197 | (__builtin_constant_p(__arg2) ? \ | ||
198 | __constant_strncmp(__arg0, __arg1, __arg2) : \ | ||
199 | __strncmp(__arg0, __arg1, __arg2)) | ||
200 | |||
201 | #endif /* !EXPORT_SYMTAB_STROPS */ | ||
202 | |||
203 | #endif /* __KERNEL__ */ | ||
204 | |||
205 | #endif /* !(__SPARC_STRING_H__) */ | ||
diff --git a/include/asm-sparc/sun4paddr.h b/include/asm-sparc/sun4paddr.h new file mode 100644 index 000000000000..d863bfd5f09a --- /dev/null +++ b/include/asm-sparc/sun4paddr.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* $Id: sun4paddr.h,v 1.3 1998/07/28 16:53:27 jj Exp $ | ||
2 | * sun4paddr.h: Various physical addresses on sun4 machines | ||
3 | * | ||
4 | * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au) | ||
5 | * Copyright (C) 1998 Chris Davis (cdavis@cois.on.ca) | ||
6 | * | ||
7 | * Now supports more sun4's | ||
8 | */ | ||
9 | |||
10 | #ifndef _SPARC_SUN4PADDR_H | ||
11 | #define _SPARC_SUN4PADDR_H | ||
12 | |||
13 | #define SUN4_IE_PHYSADDR 0xf5000000 | ||
14 | #define SUN4_UNUSED_PHYSADDR 0 | ||
15 | |||
16 | /* these work for me */ | ||
17 | #define SUN4_200_MEMREG_PHYSADDR 0xf4000000 | ||
18 | #define SUN4_200_CLOCK_PHYSADDR 0xf3000000 | ||
19 | #define SUN4_200_BWTWO_PHYSADDR 0xfd000000 | ||
20 | #define SUN4_200_ETH_PHYSADDR 0xf6000000 | ||
21 | #define SUN4_200_SI_PHYSADDR 0xff200000 | ||
22 | |||
23 | /* these were here before */ | ||
24 | #define SUN4_300_MEMREG_PHYSADDR 0xf4000000 | ||
25 | #define SUN4_300_CLOCK_PHYSADDR 0xf2000000 | ||
26 | #define SUN4_300_TIMER_PHYSADDR 0xef000000 | ||
27 | #define SUN4_300_ETH_PHYSADDR 0xf9000000 | ||
28 | #define SUN4_300_BWTWO_PHYSADDR 0xfb400000 | ||
29 | #define SUN4_300_DMA_PHYSADDR 0xfa001000 | ||
30 | #define SUN4_300_ESP_PHYSADDR 0xfa000000 | ||
31 | |||
32 | /* Are these right? */ | ||
33 | #define SUN4_400_MEMREG_PHYSADDR 0xf4000000 | ||
34 | #define SUN4_400_CLOCK_PHYSADDR 0xf2000000 | ||
35 | #define SUN4_400_TIMER_PHYSADDR 0xef000000 | ||
36 | #define SUN4_400_ETH_PHYSADDR 0xf9000000 | ||
37 | #define SUN4_400_BWTWO_PHYSADDR 0xfb400000 | ||
38 | #define SUN4_400_DMA_PHYSADDR 0xfa001000 | ||
39 | #define SUN4_400_ESP_PHYSADDR 0xfa000000 | ||
40 | |||
41 | /* | ||
42 | these are the actual values set and used in the code. Unused items set | ||
43 | to SUN_UNUSED_PHYSADDR | ||
44 | */ | ||
45 | |||
46 | extern int sun4_memreg_physaddr; /* memory register (ecc?) */ | ||
47 | extern int sun4_clock_physaddr; /* system clock */ | ||
48 | extern int sun4_timer_physaddr; /* timer, where applicable */ | ||
49 | extern int sun4_eth_physaddr; /* onboard ethernet (ie/le) */ | ||
50 | extern int sun4_si_physaddr; /* sun3 scsi adapter */ | ||
51 | extern int sun4_bwtwo_physaddr; /* onboard bw2 */ | ||
52 | extern int sun4_dma_physaddr; /* scsi dma */ | ||
53 | extern int sun4_esp_physaddr; /* esp scsi */ | ||
54 | extern int sun4_ie_physaddr; /* interrupt enable */ | ||
55 | |||
56 | #endif /* !(_SPARC_SUN4PADDR_H) */ | ||
diff --git a/include/asm-sparc/sun4prom.h b/include/asm-sparc/sun4prom.h new file mode 100644 index 000000000000..9c8b4cbf629a --- /dev/null +++ b/include/asm-sparc/sun4prom.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * sun4prom.h -- interface to sun4 PROM monitor. We don't use most of this, | ||
3 | * so most of these are just placeholders. | ||
4 | */ | ||
5 | |||
6 | #ifndef _SUN4PROM_H_ | ||
7 | #define _SUN4PROM_H_ | ||
8 | |||
9 | /* | ||
10 | * Although this looks similar to an romvec for a OpenProm machine, it is | ||
11 | * actually closer to what was used in the Sun2 and Sun3. | ||
12 | * | ||
13 | * V2 entries exist only in version 2 PROMs and later, V3 in version 3 and later. | ||
14 | * | ||
15 | * Many of the function prototypes are guesses. Some are certainly wrong. | ||
16 | * Use with care. | ||
17 | */ | ||
18 | |||
19 | typedef struct { | ||
20 | char *initSP; /* Initial system stack ptr */ | ||
21 | void (*startmon)(void); /* Initial PC for hardware */ | ||
22 | int *diagberr; /* Bus err handler for diags */ | ||
23 | struct linux_arguments_v0 **bootParam; /* Info for bootstrapped pgm */ | ||
24 | unsigned int *memorysize; /* Usable memory in bytes */ | ||
25 | unsigned char (*getchar)(void); /* Get char from input device */ | ||
26 | void (*putchar)(char); /* Put char to output device */ | ||
27 | int (*mayget)(void); /* Maybe get char, or -1 */ | ||
28 | int (*mayput)(int); /* Maybe put char, or -1 */ | ||
29 | unsigned char *echo; /* Should getchar echo? */ | ||
30 | unsigned char *insource; /* Input source selector */ | ||
31 | unsigned char *outsink; /* Output sink selector */ | ||
32 | int (*getkey)(void); /* Get next key if one exists */ | ||
33 | void (*initgetkey)(void); /* Initialize get key */ | ||
34 | unsigned int *translation; /* Kbd translation selector */ | ||
35 | unsigned char *keybid; /* Keyboard ID byte */ | ||
36 | int *screen_x; /* V2: Screen x pos (r/o) */ | ||
37 | int *screen_y; /* V2: Screen y pos (r/o) */ | ||
38 | struct keybuf *keybuf; /* Up/down keycode buffer */ | ||
39 | char *monid; /* Monitor version ID */ | ||
40 | void (*fbwritechar)(char); /* Write a character to FB */ | ||
41 | int *fbAddr; /* Address of frame buffer */ | ||
42 | char **font; /* Font table for FB */ | ||
43 | void (*fbwritestr)(char *); /* Write string to FB */ | ||
44 | void (*reboot)(char *); /* e.g. reboot("sd()vmlinux") */ | ||
45 | unsigned char *linebuf; /* The line input buffer */ | ||
46 | unsigned char **lineptr; /* Cur pointer into linebuf */ | ||
47 | int *linesize; /* length of line in linebuf */ | ||
48 | void (*getline)(char *); /* Get line from user */ | ||
49 | unsigned char (*getnextchar)(void); /* Get next char from linebuf */ | ||
50 | unsigned char (*peeknextchar)(void); /* Peek at next char */ | ||
51 | int *fbthere; /* =1 if frame buffer there */ | ||
52 | int (*getnum)(void); /* Grab hex num from line */ | ||
53 | int (*printf)(char *, ...); /* See prom_printf() instead */ | ||
54 | void (*printhex)(int); /* Format N digits in hex */ | ||
55 | unsigned char *leds; /* RAM copy of LED register */ | ||
56 | void (*setLEDs)(unsigned char *); /* Sets LED's and RAM copy */ | ||
57 | void (*NMIaddr)(void *); /* Addr for level 7 vector */ | ||
58 | void (*abortentry)(void); /* Entry for keyboard abort */ | ||
59 | int *nmiclock; /* Counts up in msec */ | ||
60 | int *FBtype; /* Frame buffer type */ | ||
61 | unsigned int romvecversion; /* Version number for this romvec */ | ||
62 | struct globram *globram; /* monitor global variables ??? */ | ||
63 | void * kbdaddr; /* Addr of keyboard in use */ | ||
64 | int *keyrinit; /* ms before kbd repeat */ | ||
65 | unsigned char *keyrtick; /* ms between repetitions */ | ||
66 | unsigned int *memoryavail; /* V1: Main mem usable size */ | ||
67 | long *resetaddr; /* where to jump on a reset */ | ||
68 | long *resetmap; /* pgmap entry for resetaddr */ | ||
69 | void (*exittomon)(void); /* Exit from user program */ | ||
70 | unsigned char **memorybitmap; /* V1: &{0 or &bits} */ | ||
71 | void (*setcxsegmap)(int ctxt, char *va, int pmeg); /* Set seg in any context */ | ||
72 | void (**vector_cmd)(void *); /* V2: Handler for 'v' cmd */ | ||
73 | unsigned long *expectedtrapsig; /* V3: Location of the expected trap signal */ | ||
74 | unsigned long *trapvectorbasetable; /* V3: Address of the trap vector table */ | ||
75 | int unused1; | ||
76 | int unused2; | ||
77 | int unused3; | ||
78 | int unused4; | ||
79 | } linux_sun4_romvec; | ||
80 | |||
81 | extern linux_sun4_romvec *sun4_romvec; | ||
82 | |||
83 | #endif /* _SUN4PROM_H_ */ | ||
diff --git a/include/asm-sparc/sunbpp.h b/include/asm-sparc/sunbpp.h new file mode 100644 index 000000000000..568db79b730d --- /dev/null +++ b/include/asm-sparc/sunbpp.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* $Id: sunbpp.h,v 1.1 1999/08/08 14:09:49 shadow Exp $ | ||
2 | * include/asm-sparc/sunbpp.h | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASM_SPARC_SUNBPP_H | ||
6 | #define _ASM_SPARC_SUNBPP_H | ||
7 | |||
8 | struct bpp_regs { | ||
9 | /* DMA registers */ | ||
10 | __volatile__ __u32 p_csr; /* DMA Control/Status Register */ | ||
11 | __volatile__ __u32 p_addr; /* Address Register */ | ||
12 | __volatile__ __u32 p_bcnt; /* Byte Count Register */ | ||
13 | __volatile__ __u32 p_tst_csr; /* Test Control/Status (DMA2 only) */ | ||
14 | /* Parallel Port registers */ | ||
15 | __volatile__ __u16 p_hcr; /* Hardware Configuration Register */ | ||
16 | __volatile__ __u16 p_ocr; /* Operation Configuration Register */ | ||
17 | __volatile__ __u8 p_dr; /* Parallel Data Register */ | ||
18 | __volatile__ __u8 p_tcr; /* Transfer Control Register */ | ||
19 | __volatile__ __u8 p_or; /* Output Register */ | ||
20 | __volatile__ __u8 p_ir; /* Input Register */ | ||
21 | __volatile__ __u16 p_icr; /* Interrupt Control Register */ | ||
22 | }; | ||
23 | |||
24 | /* P_HCR. Time is in increments of SBus clock. */ | ||
25 | #define P_HCR_TEST 0x8000 /* Allows buried counters to be read */ | ||
26 | #define P_HCR_DSW 0x7f00 /* Data strobe width (in ticks) */ | ||
27 | #define P_HCR_DDS 0x007f /* Data setup before strobe (in ticks) */ | ||
28 | |||
29 | /* P_OCR. */ | ||
30 | #define P_OCR_MEM_CLR 0x8000 | ||
31 | #define P_OCR_DATA_SRC 0x4000 /* ) */ | ||
32 | #define P_OCR_DS_DSEL 0x2000 /* ) Bidirectional */ | ||
33 | #define P_OCR_BUSY_DSEL 0x1000 /* ) selects */ | ||
34 | #define P_OCR_ACK_DSEL 0x0800 /* ) */ | ||
35 | #define P_OCR_EN_DIAG 0x0400 | ||
36 | #define P_OCR_BUSY_OP 0x0200 /* Busy operation */ | ||
37 | #define P_OCR_ACK_OP 0x0100 /* Ack operation */ | ||
38 | #define P_OCR_SRST 0x0080 /* Reset state machines. Not selfcleaning. */ | ||
39 | #define P_OCR_IDLE 0x0008 /* PP data transfer state machine is idle */ | ||
40 | #define P_OCR_V_ILCK 0x0002 /* Versatec faded. Zebra only. */ | ||
41 | #define P_OCR_EN_VER 0x0001 /* Enable Versatec (0 - enable). Zebra only. */ | ||
42 | |||
43 | /* P_TCR */ | ||
44 | #define P_TCR_DIR 0x08 | ||
45 | #define P_TCR_BUSY 0x04 | ||
46 | #define P_TCR_ACK 0x02 | ||
47 | #define P_TCR_DS 0x01 /* Strobe */ | ||
48 | |||
49 | /* P_OR */ | ||
50 | #define P_OR_V3 0x20 /* ) */ | ||
51 | #define P_OR_V2 0x10 /* ) on Zebra only */ | ||
52 | #define P_OR_V1 0x08 /* ) */ | ||
53 | #define P_OR_INIT 0x04 | ||
54 | #define P_OR_AFXN 0x02 /* Auto Feed */ | ||
55 | #define P_OR_SLCT_IN 0x01 | ||
56 | |||
57 | /* P_IR */ | ||
58 | #define P_IR_PE 0x04 | ||
59 | #define P_IR_SLCT 0x02 | ||
60 | #define P_IR_ERR 0x01 | ||
61 | |||
62 | /* P_ICR */ | ||
63 | #define P_DS_IRQ 0x8000 /* RW1 */ | ||
64 | #define P_ACK_IRQ 0x4000 /* RW1 */ | ||
65 | #define P_BUSY_IRQ 0x2000 /* RW1 */ | ||
66 | #define P_PE_IRQ 0x1000 /* RW1 */ | ||
67 | #define P_SLCT_IRQ 0x0800 /* RW1 */ | ||
68 | #define P_ERR_IRQ 0x0400 /* RW1 */ | ||
69 | #define P_DS_IRQ_EN 0x0200 /* RW Always on rising edge */ | ||
70 | #define P_ACK_IRQ_EN 0x0100 /* RW Always on rising edge */ | ||
71 | #define P_BUSY_IRP 0x0080 /* RW 1= rising edge */ | ||
72 | #define P_BUSY_IRQ_EN 0x0040 /* RW */ | ||
73 | #define P_PE_IRP 0x0020 /* RW 1= rising edge */ | ||
74 | #define P_PE_IRQ_EN 0x0010 /* RW */ | ||
75 | #define P_SLCT_IRP 0x0008 /* RW 1= rising edge */ | ||
76 | #define P_SLCT_IRQ_EN 0x0004 /* RW */ | ||
77 | #define P_ERR_IRP 0x0002 /* RW1 1= rising edge */ | ||
78 | #define P_ERR_IRQ_EN 0x0001 /* RW */ | ||
79 | |||
80 | #endif /* !(_ASM_SPARC_SUNBPP_H) */ | ||
diff --git a/include/asm-sparc/svr4.h b/include/asm-sparc/svr4.h new file mode 100644 index 000000000000..da1f1c980e2d --- /dev/null +++ b/include/asm-sparc/svr4.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* Solaris/SPARC constants and definitions -- | ||
2 | * (C) 1996 Miguel de Icaza | ||
3 | * | ||
4 | * This file is not meant to be included by user level applications | ||
5 | * but the solaris syscall emulator | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_SVR4_H | ||
9 | #define _SPARC_SVR4_H | ||
10 | |||
11 | /* Signals as used by svr4 */ | ||
12 | typedef struct { /* signal set type */ | ||
13 | ulong sigbits[4]; | ||
14 | } svr4_sigset_t; | ||
15 | |||
16 | /* Values for siginfo.code */ | ||
17 | #define SVR4_SINOINFO 32767 | ||
18 | /* Siginfo, sucker expects bunch of information on those parameters */ | ||
19 | typedef union { | ||
20 | char total_size [128]; | ||
21 | struct { | ||
22 | int signo; | ||
23 | int code; | ||
24 | int error; | ||
25 | union { | ||
26 | } data; | ||
27 | } siginfo; | ||
28 | } svr4_siginfo_t; | ||
29 | |||
30 | /* Context definition */ | ||
31 | |||
32 | /* Location of the user stored registers into a greg_t */ | ||
33 | enum { | ||
34 | SVR4_PSR, SVR4_PC, SVR4_NPC, SVR4_Y, | ||
35 | SVR4_G1, SVR4_G2, SVR4_G3, SVR4_G4, | ||
36 | SVR4_G5, SVR4_G6, SVR4_G7, SVR4_O0, | ||
37 | SVR4_O1, SVR4_O2, SVR4_O3, SVR4_O4, | ||
38 | SVR4_O5, SVR4_O6, SVR4_O7 | ||
39 | }; | ||
40 | |||
41 | /* sizeof (regs) / sizeof (greg_t), defined in the ABI */ | ||
42 | #define SVR4_NREGS 19 | ||
43 | #define SVR4_MAXWIN 31 | ||
44 | |||
45 | typedef struct { | ||
46 | uint rwin_lo[8]; | ||
47 | uint rwin_in[8]; | ||
48 | } svr4_rwindow_t; | ||
49 | |||
50 | typedef struct { | ||
51 | int count; | ||
52 | int __user *winptr [SVR4_MAXWIN]; /* pointer to the windows */ | ||
53 | svr4_rwindow_t win[SVR4_MAXWIN]; /* the windows */ | ||
54 | } svr4_gwindows_t; | ||
55 | |||
56 | typedef int svr4_gregset_t[SVR4_NREGS]; | ||
57 | |||
58 | typedef struct { | ||
59 | double fpu_regs[32]; | ||
60 | void *fp_q; | ||
61 | unsigned fp_fsr; | ||
62 | u_char fp_nqel; | ||
63 | u_char fp_nqsize; | ||
64 | u_char inuse; /* if fpu is in use */ | ||
65 | } svr4_fregset_t; | ||
66 | |||
67 | typedef struct { | ||
68 | uint id; /* if this holds "xrs" string => ptr is valid */ | ||
69 | caddr_t ptr; | ||
70 | } svr4_xrs_t; | ||
71 | |||
72 | /* Machine dependent context */ | ||
73 | typedef struct { | ||
74 | svr4_gregset_t greg; /* registers 0..19 (see top) */ | ||
75 | svr4_gwindows_t __user *gwin; /* may point to register windows */ | ||
76 | svr4_fregset_t freg; /* floating point registers */ | ||
77 | svr4_xrs_t xrs; /* mhm? */ | ||
78 | long pad[19]; | ||
79 | } svr4_mcontext_t; | ||
80 | |||
81 | /* flags for stack_t.flags */ | ||
82 | enum svr4_stack_flags { | ||
83 | SVR4_SS_ONSTACK, | ||
84 | SVR4_SS_DISABLE, | ||
85 | }; | ||
86 | |||
87 | /* signal stack exection place, unsupported */ | ||
88 | typedef struct svr4_stack_t { | ||
89 | char __user *sp; | ||
90 | int size; | ||
91 | int flags; | ||
92 | } svr4_stack_t; | ||
93 | |||
94 | /* Context used by getcontext and setcontext */ | ||
95 | typedef struct svr4_ucontext_t { | ||
96 | u_long flags; /* context flags, indicate what is loaded */ | ||
97 | struct svr4_ucontext *link; | ||
98 | svr4_sigset_t sigmask; | ||
99 | svr4_stack_t stack; | ||
100 | svr4_mcontext_t mcontext; | ||
101 | long pad[23]; | ||
102 | } svr4_ucontext_t; | ||
103 | |||
104 | /* windows hold the windows as they were at signal time, | ||
105 | * ucontext->mcontext holds a pointer to them. | ||
106 | * addresses for uc and si are passed as parameters to svr4 signal | ||
107 | * handler | ||
108 | */ | ||
109 | |||
110 | /* This is the signal frame that is passed to the signal handler */ | ||
111 | typedef struct { | ||
112 | svr4_gwindows_t gw; /* windows */ | ||
113 | svr4_ucontext_t uc; /* machine context */ | ||
114 | svr4_siginfo_t si; /* siginfo */ | ||
115 | } svr4_signal_frame_t; | ||
116 | |||
117 | #define SVR4_SF_ALIGNED (((sizeof (svr4_signal_frame_t) + 7) & (~7))) | ||
118 | |||
119 | #endif /* include control */ | ||
diff --git a/include/asm-sparc/swift.h b/include/asm-sparc/swift.h new file mode 100644 index 000000000000..e535061bf755 --- /dev/null +++ b/include/asm-sparc/swift.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /* swift.h: Specific definitions for the _broken_ Swift SRMMU | ||
2 | * MMU module. | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_SWIFT_H | ||
8 | #define _SPARC_SWIFT_H | ||
9 | |||
10 | /* Swift is so brain damaged, here is the mmu control register. */ | ||
11 | #define SWIFT_ST 0x00800000 /* SW tablewalk enable */ | ||
12 | #define SWIFT_WP 0x00400000 /* Watchpoint enable */ | ||
13 | |||
14 | /* Branch folding (buggy, disable on production systems!) */ | ||
15 | #define SWIFT_BF 0x00200000 | ||
16 | #define SWIFT_PMC 0x00180000 /* Page mode control */ | ||
17 | #define SWIFT_PE 0x00040000 /* Parity enable */ | ||
18 | #define SWIFT_PC 0x00020000 /* Parity control */ | ||
19 | #define SWIFT_AP 0x00010000 /* Graphics page mode control (TCX/SX) */ | ||
20 | #define SWIFT_AC 0x00008000 /* Alternate Cacheability (see viking.h) */ | ||
21 | #define SWIFT_BM 0x00004000 /* Boot mode */ | ||
22 | #define SWIFT_RC 0x00003c00 /* DRAM refresh control */ | ||
23 | #define SWIFT_IE 0x00000200 /* Instruction cache enable */ | ||
24 | #define SWIFT_DE 0x00000100 /* Data cache enable */ | ||
25 | #define SWIFT_SA 0x00000080 /* Store Allocate */ | ||
26 | #define SWIFT_NF 0x00000002 /* No fault mode */ | ||
27 | #define SWIFT_EN 0x00000001 /* MMU enable */ | ||
28 | |||
29 | /* Bits [13:5] select one of 512 instruction cache tags */ | ||
30 | static inline void swift_inv_insn_tag(unsigned long addr) | ||
31 | { | ||
32 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
33 | : /* no outputs */ | ||
34 | : "r" (addr), "i" (ASI_M_TXTC_TAG) | ||
35 | : "memory"); | ||
36 | } | ||
37 | |||
38 | /* Bits [12:4] select one of 512 data cache tags */ | ||
39 | static inline void swift_inv_data_tag(unsigned long addr) | ||
40 | { | ||
41 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
42 | : /* no outputs */ | ||
43 | : "r" (addr), "i" (ASI_M_DATAC_TAG) | ||
44 | : "memory"); | ||
45 | } | ||
46 | |||
47 | static inline void swift_flush_dcache(void) | ||
48 | { | ||
49 | unsigned long addr; | ||
50 | |||
51 | for (addr = 0; addr < 0x2000; addr += 0x10) | ||
52 | swift_inv_data_tag(addr); | ||
53 | } | ||
54 | |||
55 | static inline void swift_flush_icache(void) | ||
56 | { | ||
57 | unsigned long addr; | ||
58 | |||
59 | for (addr = 0; addr < 0x4000; addr += 0x20) | ||
60 | swift_inv_insn_tag(addr); | ||
61 | } | ||
62 | |||
63 | static inline void swift_idflash_clear(void) | ||
64 | { | ||
65 | unsigned long addr; | ||
66 | |||
67 | for (addr = 0; addr < 0x2000; addr += 0x10) { | ||
68 | swift_inv_insn_tag(addr<<1); | ||
69 | swift_inv_data_tag(addr); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | /* Swift is so broken, it isn't even safe to use the following. */ | ||
74 | static inline void swift_flush_page(unsigned long page) | ||
75 | { | ||
76 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
77 | : /* no outputs */ | ||
78 | : "r" (page), "i" (ASI_M_FLUSH_PAGE) | ||
79 | : "memory"); | ||
80 | } | ||
81 | |||
82 | static inline void swift_flush_segment(unsigned long addr) | ||
83 | { | ||
84 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
85 | : /* no outputs */ | ||
86 | : "r" (addr), "i" (ASI_M_FLUSH_SEG) | ||
87 | : "memory"); | ||
88 | } | ||
89 | |||
90 | static inline void swift_flush_region(unsigned long addr) | ||
91 | { | ||
92 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
93 | : /* no outputs */ | ||
94 | : "r" (addr), "i" (ASI_M_FLUSH_REGION) | ||
95 | : "memory"); | ||
96 | } | ||
97 | |||
98 | static inline void swift_flush_context(void) | ||
99 | { | ||
100 | __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" | ||
101 | : /* no outputs */ | ||
102 | : "i" (ASI_M_FLUSH_CTX) | ||
103 | : "memory"); | ||
104 | } | ||
105 | |||
106 | #endif /* !(_SPARC_SWIFT_H) */ | ||
diff --git a/include/asm-sparc/sysen.h b/include/asm-sparc/sysen.h new file mode 100644 index 000000000000..692fa6f2296a --- /dev/null +++ b/include/asm-sparc/sysen.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* $Id: sysen.h,v 1.3 1995/11/25 02:32:58 davem Exp $ | ||
2 | * sysen.h: Bit fields within the "System Enable" register accessed via | ||
3 | * the ASI_CONTROL address space at address AC_SYSENABLE. | ||
4 | * | ||
5 | * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_SYSEN_H | ||
9 | #define _SPARC_SYSEN_H | ||
10 | |||
11 | #define SENABLE_DVMA 0x20 /* enable dvma transfers */ | ||
12 | #define SENABLE_CACHE 0x10 /* enable VAC cache */ | ||
13 | #define SENABLE_RESET 0x04 /* reset whole machine, danger Will Robinson */ | ||
14 | |||
15 | #endif /* _SPARC_SYSEN_H */ | ||
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h new file mode 100644 index 000000000000..80cf20cfaee1 --- /dev/null +++ b/include/asm-sparc/system.h | |||
@@ -0,0 +1,262 @@ | |||
1 | /* $Id: system.h,v 1.86 2001/10/30 04:57:10 davem Exp $ */ | ||
2 | #include <linux/config.h> | ||
3 | |||
4 | #ifndef __SPARC_SYSTEM_H | ||
5 | #define __SPARC_SYSTEM_H | ||
6 | |||
7 | #include <linux/config.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/threads.h> /* NR_CPUS */ | ||
10 | #include <linux/thread_info.h> | ||
11 | |||
12 | #include <asm/segment.h> | ||
13 | #include <asm/page.h> | ||
14 | #include <asm/psr.h> | ||
15 | #include <asm/ptrace.h> | ||
16 | #include <asm/btfixup.h> | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | |||
20 | /* | ||
21 | * Sparc (general) CPU types | ||
22 | */ | ||
23 | enum sparc_cpu { | ||
24 | sun4 = 0x00, | ||
25 | sun4c = 0x01, | ||
26 | sun4m = 0x02, | ||
27 | sun4d = 0x03, | ||
28 | sun4e = 0x04, | ||
29 | sun4u = 0x05, /* V8 ploos ploos */ | ||
30 | sun_unknown = 0x06, | ||
31 | ap1000 = 0x07, /* almost a sun4m */ | ||
32 | }; | ||
33 | |||
34 | /* Really, userland should not be looking at any of this... */ | ||
35 | #ifdef __KERNEL__ | ||
36 | |||
37 | extern enum sparc_cpu sparc_cpu_model; | ||
38 | |||
39 | #ifndef CONFIG_SUN4 | ||
40 | #define ARCH_SUN4C_SUN4 (sparc_cpu_model==sun4c) | ||
41 | #define ARCH_SUN4 0 | ||
42 | #else | ||
43 | #define ARCH_SUN4C_SUN4 1 | ||
44 | #define ARCH_SUN4 1 | ||
45 | #endif | ||
46 | |||
47 | #define SUN4M_NCPUS 4 /* Architectural limit of sun4m. */ | ||
48 | |||
49 | extern struct thread_info *current_set[NR_CPUS]; | ||
50 | |||
51 | extern unsigned long empty_bad_page; | ||
52 | extern unsigned long empty_bad_page_table; | ||
53 | extern unsigned long empty_zero_page; | ||
54 | |||
55 | extern void sun_do_break(void); | ||
56 | extern int serial_console; | ||
57 | extern int stop_a_enabled; | ||
58 | |||
59 | static __inline__ int con_is_present(void) | ||
60 | { | ||
61 | return serial_console ? 0 : 1; | ||
62 | } | ||
63 | |||
64 | /* When a context switch happens we must flush all user windows so that | ||
65 | * the windows of the current process are flushed onto its stack. This | ||
66 | * way the windows are all clean for the next process and the stack | ||
67 | * frames are up to date. | ||
68 | */ | ||
69 | extern void flush_user_windows(void); | ||
70 | extern void kill_user_windows(void); | ||
71 | extern void synchronize_user_stack(void); | ||
72 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | ||
73 | void *fpqueue, unsigned long *fpqdepth); | ||
74 | |||
75 | #ifdef CONFIG_SMP | ||
76 | #define SWITCH_ENTER(prv) \ | ||
77 | do { \ | ||
78 | if (test_tsk_thread_flag(prv, TIF_USEDFPU)) { \ | ||
79 | put_psr(get_psr() | PSR_EF); \ | ||
80 | fpsave(&(prv)->thread.float_regs[0], &(prv)->thread.fsr, \ | ||
81 | &(prv)->thread.fpqueue[0], &(prv)->thread.fpqdepth); \ | ||
82 | clear_tsk_thread_flag(prv, TIF_USEDFPU); \ | ||
83 | (prv)->thread.kregs->psr &= ~PSR_EF; \ | ||
84 | } \ | ||
85 | } while(0) | ||
86 | |||
87 | #define SWITCH_DO_LAZY_FPU(next) /* */ | ||
88 | #else | ||
89 | #define SWITCH_ENTER(prv) /* */ | ||
90 | #define SWITCH_DO_LAZY_FPU(nxt) \ | ||
91 | do { \ | ||
92 | if (last_task_used_math != (nxt)) \ | ||
93 | (nxt)->thread.kregs->psr&=~PSR_EF; \ | ||
94 | } while(0) | ||
95 | #endif | ||
96 | |||
97 | /* | ||
98 | * Flush windows so that the VM switch which follows | ||
99 | * would not pull the stack from under us. | ||
100 | * | ||
101 | * SWITCH_ENTER and SWITH_DO_LAZY_FPU do not work yet (e.g. SMP does not work) | ||
102 | * XXX WTF is the above comment? Found in late teen 2.4.x. | ||
103 | */ | ||
104 | #define prepare_arch_switch(rq, next) do { \ | ||
105 | __asm__ __volatile__( \ | ||
106 | ".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ | ||
107 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ | ||
108 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ | ||
109 | "save %sp, -0x40, %sp\n\t" \ | ||
110 | "restore; restore; restore; restore; restore; restore; restore"); \ | ||
111 | } while(0) | ||
112 | #define finish_arch_switch(rq, next) spin_unlock_irq(&(rq)->lock) | ||
113 | #define task_running(rq, p) ((rq)->curr == (p)) | ||
114 | |||
115 | /* Much care has gone into this code, do not touch it. | ||
116 | * | ||
117 | * We need to loadup regs l0/l1 for the newly forked child | ||
118 | * case because the trap return path relies on those registers | ||
119 | * holding certain values, gcc is told that they are clobbered. | ||
120 | * Gcc needs registers for 3 values in and 1 value out, so we | ||
121 | * clobber every non-fixed-usage register besides l2/l3/o4/o5. -DaveM | ||
122 | * | ||
123 | * Hey Dave, that do not touch sign is too much of an incentive | ||
124 | * - Anton & Pete | ||
125 | */ | ||
126 | #define switch_to(prev, next, last) do { \ | ||
127 | SWITCH_ENTER(prev); \ | ||
128 | SWITCH_DO_LAZY_FPU(next); \ | ||
129 | cpu_set(smp_processor_id(), next->active_mm->cpu_vm_mask); \ | ||
130 | __asm__ __volatile__( \ | ||
131 | "sethi %%hi(here - 0x8), %%o7\n\t" \ | ||
132 | "mov %%g6, %%g3\n\t" \ | ||
133 | "or %%o7, %%lo(here - 0x8), %%o7\n\t" \ | ||
134 | "rd %%psr, %%g4\n\t" \ | ||
135 | "std %%sp, [%%g6 + %4]\n\t" \ | ||
136 | "rd %%wim, %%g5\n\t" \ | ||
137 | "wr %%g4, 0x20, %%psr\n\t" \ | ||
138 | "nop\n\t" \ | ||
139 | "std %%g4, [%%g6 + %3]\n\t" \ | ||
140 | "ldd [%2 + %3], %%g4\n\t" \ | ||
141 | "mov %2, %%g6\n\t" \ | ||
142 | ".globl patchme_store_new_current\n" \ | ||
143 | "patchme_store_new_current:\n\t" \ | ||
144 | "st %2, [%1]\n\t" \ | ||
145 | "wr %%g4, 0x20, %%psr\n\t" \ | ||
146 | "nop\n\t" \ | ||
147 | "nop\n\t" \ | ||
148 | "nop\n\t" /* LEON needs all 3 nops: load to %sp depends on CWP. */ \ | ||
149 | "ldd [%%g6 + %4], %%sp\n\t" \ | ||
150 | "wr %%g5, 0x0, %%wim\n\t" \ | ||
151 | "ldd [%%sp + 0x00], %%l0\n\t" \ | ||
152 | "ldd [%%sp + 0x38], %%i6\n\t" \ | ||
153 | "wr %%g4, 0x0, %%psr\n\t" \ | ||
154 | "nop\n\t" \ | ||
155 | "nop\n\t" \ | ||
156 | "jmpl %%o7 + 0x8, %%g0\n\t" \ | ||
157 | " ld [%%g3 + %5], %0\n\t" \ | ||
158 | "here:\n" \ | ||
159 | : "=&r" (last) \ | ||
160 | : "r" (&(current_set[hard_smp_processor_id()])), \ | ||
161 | "r" ((next)->thread_info), \ | ||
162 | "i" (TI_KPSR), \ | ||
163 | "i" (TI_KSP), \ | ||
164 | "i" (TI_TASK) \ | ||
165 | : "g1", "g2", "g3", "g4", "g5", "g7", \ | ||
166 | "l0", "l1", "l3", "l4", "l5", "l6", "l7", \ | ||
167 | "i0", "i1", "i2", "i3", "i4", "i5", \ | ||
168 | "o0", "o1", "o2", "o3", "o7"); \ | ||
169 | } while(0) | ||
170 | |||
171 | /* | ||
172 | * Changing the IRQ level on the Sparc. | ||
173 | */ | ||
174 | extern void local_irq_restore(unsigned long); | ||
175 | extern unsigned long __local_irq_save(void); | ||
176 | extern void local_irq_enable(void); | ||
177 | |||
178 | static inline unsigned long getipl(void) | ||
179 | { | ||
180 | unsigned long retval; | ||
181 | |||
182 | __asm__ __volatile__("rd %%psr, %0" : "=r" (retval)); | ||
183 | return retval; | ||
184 | } | ||
185 | |||
186 | #define local_save_flags(flags) ((flags) = getipl()) | ||
187 | #define local_irq_save(flags) ((flags) = __local_irq_save()) | ||
188 | #define local_irq_disable() ((void) __local_irq_save()) | ||
189 | #define irqs_disabled() ((getipl() & PSR_PIL) != 0) | ||
190 | |||
191 | /* XXX Change this if we ever use a PSO mode kernel. */ | ||
192 | #define mb() __asm__ __volatile__ ("" : : : "memory") | ||
193 | #define rmb() mb() | ||
194 | #define wmb() mb() | ||
195 | #define read_barrier_depends() do { } while(0) | ||
196 | #define set_mb(__var, __value) do { __var = __value; mb(); } while(0) | ||
197 | #define set_wmb(__var, __value) set_mb(__var, __value) | ||
198 | #define smp_mb() __asm__ __volatile__("":::"memory") | ||
199 | #define smp_rmb() __asm__ __volatile__("":::"memory") | ||
200 | #define smp_wmb() __asm__ __volatile__("":::"memory") | ||
201 | #define smp_read_barrier_depends() do { } while(0) | ||
202 | |||
203 | #define nop() __asm__ __volatile__ ("nop") | ||
204 | |||
205 | /* This has special calling conventions */ | ||
206 | #ifndef CONFIG_SMP | ||
207 | BTFIXUPDEF_CALL(void, ___xchg32, void) | ||
208 | #endif | ||
209 | |||
210 | extern __inline__ unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) | ||
211 | { | ||
212 | #ifdef CONFIG_SMP | ||
213 | __asm__ __volatile__("swap [%2], %0" | ||
214 | : "=&r" (val) | ||
215 | : "0" (val), "r" (m) | ||
216 | : "memory"); | ||
217 | return val; | ||
218 | #else | ||
219 | register unsigned long *ptr asm("g1"); | ||
220 | register unsigned long ret asm("g2"); | ||
221 | |||
222 | ptr = (unsigned long *) m; | ||
223 | ret = val; | ||
224 | |||
225 | /* Note: this is magic and the nop there is | ||
226 | really needed. */ | ||
227 | __asm__ __volatile__( | ||
228 | "mov %%o7, %%g4\n\t" | ||
229 | "call ___f____xchg32\n\t" | ||
230 | " nop\n\t" | ||
231 | : "=&r" (ret) | ||
232 | : "0" (ret), "r" (ptr) | ||
233 | : "g3", "g4", "g7", "memory", "cc"); | ||
234 | |||
235 | return ret; | ||
236 | #endif | ||
237 | } | ||
238 | |||
239 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
240 | #define tas(ptr) (xchg((ptr),1)) | ||
241 | |||
242 | extern void __xchg_called_with_bad_pointer(void); | ||
243 | |||
244 | static __inline__ unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) | ||
245 | { | ||
246 | switch (size) { | ||
247 | case 4: | ||
248 | return xchg_u32(ptr, x); | ||
249 | }; | ||
250 | __xchg_called_with_bad_pointer(); | ||
251 | return x; | ||
252 | } | ||
253 | |||
254 | extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); | ||
255 | |||
256 | #endif /* __KERNEL__ */ | ||
257 | |||
258 | #endif /* __ASSEMBLY__ */ | ||
259 | |||
260 | #define arch_align_stack(x) (x) | ||
261 | |||
262 | #endif /* !(__SPARC_SYSTEM_H) */ | ||
diff --git a/include/asm-sparc/termbits.h b/include/asm-sparc/termbits.h new file mode 100644 index 000000000000..1794d71134b7 --- /dev/null +++ b/include/asm-sparc/termbits.h | |||
@@ -0,0 +1,234 @@ | |||
1 | #ifndef _SPARC_TERMBITS_H | ||
2 | #define _SPARC_TERMBITS_H | ||
3 | |||
4 | #include <linux/posix_types.h> | ||
5 | |||
6 | typedef unsigned char cc_t; | ||
7 | typedef unsigned int speed_t; | ||
8 | typedef unsigned long tcflag_t; | ||
9 | |||
10 | #define NCC 8 | ||
11 | struct termio { | ||
12 | unsigned short c_iflag; /* input mode flags */ | ||
13 | unsigned short c_oflag; /* output mode flags */ | ||
14 | unsigned short c_cflag; /* control mode flags */ | ||
15 | unsigned short c_lflag; /* local mode flags */ | ||
16 | unsigned char c_line; /* line discipline */ | ||
17 | unsigned char c_cc[NCC]; /* control characters */ | ||
18 | }; | ||
19 | |||
20 | #define NCCS 17 | ||
21 | struct termios { | ||
22 | tcflag_t c_iflag; /* input mode flags */ | ||
23 | tcflag_t c_oflag; /* output mode flags */ | ||
24 | tcflag_t c_cflag; /* control mode flags */ | ||
25 | tcflag_t c_lflag; /* local mode flags */ | ||
26 | cc_t c_line; /* line discipline */ | ||
27 | cc_t c_cc[NCCS]; /* control characters */ | ||
28 | #ifdef __KERNEL__ | ||
29 | #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t)) | ||
30 | cc_t _x_cc[2]; /* We need them to hold vmin/vtime */ | ||
31 | #endif | ||
32 | }; | ||
33 | |||
34 | /* c_cc characters */ | ||
35 | #define VINTR 0 | ||
36 | #define VQUIT 1 | ||
37 | #define VERASE 2 | ||
38 | #define VKILL 3 | ||
39 | #define VEOF 4 | ||
40 | #define VEOL 5 | ||
41 | #define VEOL2 6 | ||
42 | #define VSWTC 7 | ||
43 | #define VSTART 8 | ||
44 | #define VSTOP 9 | ||
45 | |||
46 | |||
47 | |||
48 | #define VSUSP 10 | ||
49 | #define VDSUSP 11 /* SunOS POSIX nicety I do believe... */ | ||
50 | #define VREPRINT 12 | ||
51 | #define VDISCARD 13 | ||
52 | #define VWERASE 14 | ||
53 | #define VLNEXT 15 | ||
54 | |||
55 | /* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is | ||
56 | * shared with eof/eol | ||
57 | */ | ||
58 | #ifdef __KERNEL__ | ||
59 | #define VMIN 16 | ||
60 | #define VTIME 17 | ||
61 | #else | ||
62 | #define VMIN VEOF | ||
63 | #define VTIME VEOL | ||
64 | #endif | ||
65 | |||
66 | /* c_iflag bits */ | ||
67 | #define IGNBRK 0x00000001 | ||
68 | #define BRKINT 0x00000002 | ||
69 | #define IGNPAR 0x00000004 | ||
70 | #define PARMRK 0x00000008 | ||
71 | #define INPCK 0x00000010 | ||
72 | #define ISTRIP 0x00000020 | ||
73 | #define INLCR 0x00000040 | ||
74 | #define IGNCR 0x00000080 | ||
75 | #define ICRNL 0x00000100 | ||
76 | #define IUCLC 0x00000200 | ||
77 | #define IXON 0x00000400 | ||
78 | #define IXANY 0x00000800 | ||
79 | #define IXOFF 0x00001000 | ||
80 | #define IMAXBEL 0x00002000 | ||
81 | #define IUTF8 0x00004000 | ||
82 | |||
83 | /* c_oflag bits */ | ||
84 | #define OPOST 0x00000001 | ||
85 | #define OLCUC 0x00000002 | ||
86 | #define ONLCR 0x00000004 | ||
87 | #define OCRNL 0x00000008 | ||
88 | #define ONOCR 0x00000010 | ||
89 | #define ONLRET 0x00000020 | ||
90 | #define OFILL 0x00000040 | ||
91 | #define OFDEL 0x00000080 | ||
92 | #define NLDLY 0x00000100 | ||
93 | #define NL0 0x00000000 | ||
94 | #define NL1 0x00000100 | ||
95 | #define CRDLY 0x00000600 | ||
96 | #define CR0 0x00000000 | ||
97 | #define CR1 0x00000200 | ||
98 | #define CR2 0x00000400 | ||
99 | #define CR3 0x00000600 | ||
100 | #define TABDLY 0x00001800 | ||
101 | #define TAB0 0x00000000 | ||
102 | #define TAB1 0x00000800 | ||
103 | #define TAB2 0x00001000 | ||
104 | #define TAB3 0x00001800 | ||
105 | #define XTABS 0x00001800 | ||
106 | #define BSDLY 0x00002000 | ||
107 | #define BS0 0x00000000 | ||
108 | #define BS1 0x00002000 | ||
109 | #define VTDLY 0x00004000 | ||
110 | #define VT0 0x00000000 | ||
111 | #define VT1 0x00004000 | ||
112 | #define FFDLY 0x00008000 | ||
113 | #define FF0 0x00000000 | ||
114 | #define FF1 0x00008000 | ||
115 | #define PAGEOUT 0x00010000 /* SUNOS specific */ | ||
116 | #define WRAP 0x00020000 /* SUNOS specific */ | ||
117 | |||
118 | /* c_cflag bit meaning */ | ||
119 | #define CBAUD 0x0000100f | ||
120 | #define B0 0x00000000 /* hang up */ | ||
121 | #define B50 0x00000001 | ||
122 | #define B75 0x00000002 | ||
123 | #define B110 0x00000003 | ||
124 | #define B134 0x00000004 | ||
125 | #define B150 0x00000005 | ||
126 | #define B200 0x00000006 | ||
127 | #define B300 0x00000007 | ||
128 | #define B600 0x00000008 | ||
129 | #define B1200 0x00000009 | ||
130 | #define B1800 0x0000000a | ||
131 | #define B2400 0x0000000b | ||
132 | #define B4800 0x0000000c | ||
133 | #define B9600 0x0000000d | ||
134 | #define B19200 0x0000000e | ||
135 | #define B38400 0x0000000f | ||
136 | #define EXTA B19200 | ||
137 | #define EXTB B38400 | ||
138 | #define CSIZE 0x00000030 | ||
139 | #define CS5 0x00000000 | ||
140 | #define CS6 0x00000010 | ||
141 | #define CS7 0x00000020 | ||
142 | #define CS8 0x00000030 | ||
143 | #define CSTOPB 0x00000040 | ||
144 | #define CREAD 0x00000080 | ||
145 | #define PARENB 0x00000100 | ||
146 | #define PARODD 0x00000200 | ||
147 | #define HUPCL 0x00000400 | ||
148 | #define CLOCAL 0x00000800 | ||
149 | #define CBAUDEX 0x00001000 | ||
150 | /* We'll never see these speeds with the Zilogs, but for completeness... */ | ||
151 | #define B57600 0x00001001 | ||
152 | #define B115200 0x00001002 | ||
153 | #define B230400 0x00001003 | ||
154 | #define B460800 0x00001004 | ||
155 | /* This is what we can do with the Zilogs. */ | ||
156 | #define B76800 0x00001005 | ||
157 | /* This is what we can do with the SAB82532. */ | ||
158 | #define B153600 0x00001006 | ||
159 | #define B307200 0x00001007 | ||
160 | #define B614400 0x00001008 | ||
161 | #define B921600 0x00001009 | ||
162 | /* And these are the rest... */ | ||
163 | #define B500000 0x0000100a | ||
164 | #define B576000 0x0000100b | ||
165 | #define B1000000 0x0000100c | ||
166 | #define B1152000 0x0000100d | ||
167 | #define B1500000 0x0000100e | ||
168 | #define B2000000 0x0000100f | ||
169 | /* These have totally bogus values and nobody uses them | ||
170 | so far. Later on we'd have to use say 0x10000x and | ||
171 | adjust CBAUD constant and drivers accordingly. | ||
172 | #define B2500000 0x00001010 | ||
173 | #define B3000000 0x00001011 | ||
174 | #define B3500000 0x00001012 | ||
175 | #define B4000000 0x00001013 */ | ||
176 | #define CIBAUD 0x100f0000 /* input baud rate (not used) */ | ||
177 | #define CMSPAR 0x40000000 /* mark or space (stick) parity */ | ||
178 | #define CRTSCTS 0x80000000 /* flow control */ | ||
179 | |||
180 | /* c_lflag bits */ | ||
181 | #define ISIG 0x00000001 | ||
182 | #define ICANON 0x00000002 | ||
183 | #define XCASE 0x00000004 | ||
184 | #define ECHO 0x00000008 | ||
185 | #define ECHOE 0x00000010 | ||
186 | #define ECHOK 0x00000020 | ||
187 | #define ECHONL 0x00000040 | ||
188 | #define NOFLSH 0x00000080 | ||
189 | #define TOSTOP 0x00000100 | ||
190 | #define ECHOCTL 0x00000200 | ||
191 | #define ECHOPRT 0x00000400 | ||
192 | #define ECHOKE 0x00000800 | ||
193 | #define DEFECHO 0x00001000 /* SUNOS thing, what is it? */ | ||
194 | #define FLUSHO 0x00002000 | ||
195 | #define PENDIN 0x00004000 | ||
196 | #define IEXTEN 0x00008000 | ||
197 | |||
198 | /* modem lines */ | ||
199 | #define TIOCM_LE 0x001 | ||
200 | #define TIOCM_DTR 0x002 | ||
201 | #define TIOCM_RTS 0x004 | ||
202 | #define TIOCM_ST 0x008 | ||
203 | #define TIOCM_SR 0x010 | ||
204 | #define TIOCM_CTS 0x020 | ||
205 | #define TIOCM_CAR 0x040 | ||
206 | #define TIOCM_RNG 0x080 | ||
207 | #define TIOCM_DSR 0x100 | ||
208 | #define TIOCM_CD TIOCM_CAR | ||
209 | #define TIOCM_RI TIOCM_RNG | ||
210 | #define TIOCM_OUT1 0x2000 | ||
211 | #define TIOCM_OUT2 0x4000 | ||
212 | #define TIOCM_LOOP 0x8000 | ||
213 | |||
214 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
215 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
216 | |||
217 | |||
218 | /* tcflow() and TCXONC use these */ | ||
219 | #define TCOOFF 0 | ||
220 | #define TCOON 1 | ||
221 | #define TCIOFF 2 | ||
222 | #define TCION 3 | ||
223 | |||
224 | /* tcflush() and TCFLSH use these */ | ||
225 | #define TCIFLUSH 0 | ||
226 | #define TCOFLUSH 1 | ||
227 | #define TCIOFLUSH 2 | ||
228 | |||
229 | /* tcsetattr uses these */ | ||
230 | #define TCSANOW 0 | ||
231 | #define TCSADRAIN 1 | ||
232 | #define TCSAFLUSH 2 | ||
233 | |||
234 | #endif /* !(_SPARC_TERMBITS_H) */ | ||
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h new file mode 100644 index 000000000000..0a8ad4cac125 --- /dev/null +++ b/include/asm-sparc/termios.h | |||
@@ -0,0 +1,174 @@ | |||
1 | /* $Id: termios.h,v 1.32 2001/06/01 08:12:11 davem Exp $ */ | ||
2 | #ifndef _SPARC_TERMIOS_H | ||
3 | #define _SPARC_TERMIOS_H | ||
4 | |||
5 | #include <asm/ioctls.h> | ||
6 | #include <asm/termbits.h> | ||
7 | |||
8 | #if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS) | ||
9 | struct sgttyb { | ||
10 | char sg_ispeed; | ||
11 | char sg_ospeed; | ||
12 | char sg_erase; | ||
13 | char sg_kill; | ||
14 | short sg_flags; | ||
15 | }; | ||
16 | |||
17 | struct tchars { | ||
18 | char t_intrc; | ||
19 | char t_quitc; | ||
20 | char t_startc; | ||
21 | char t_stopc; | ||
22 | char t_eofc; | ||
23 | char t_brkc; | ||
24 | }; | ||
25 | |||
26 | struct ltchars { | ||
27 | char t_suspc; | ||
28 | char t_dsuspc; | ||
29 | char t_rprntc; | ||
30 | char t_flushc; | ||
31 | char t_werasc; | ||
32 | char t_lnextc; | ||
33 | }; | ||
34 | #endif /* __KERNEL__ */ | ||
35 | |||
36 | struct sunos_ttysize { | ||
37 | int st_lines; /* Lines on the terminal */ | ||
38 | int st_columns; /* Columns on the terminal */ | ||
39 | }; | ||
40 | |||
41 | /* Used for packet mode */ | ||
42 | #define TIOCPKT_DATA 0 | ||
43 | #define TIOCPKT_FLUSHREAD 1 | ||
44 | #define TIOCPKT_FLUSHWRITE 2 | ||
45 | #define TIOCPKT_STOP 4 | ||
46 | #define TIOCPKT_START 8 | ||
47 | #define TIOCPKT_NOSTOP 16 | ||
48 | #define TIOCPKT_DOSTOP 32 | ||
49 | |||
50 | struct winsize { | ||
51 | unsigned short ws_row; | ||
52 | unsigned short ws_col; | ||
53 | unsigned short ws_xpixel; | ||
54 | unsigned short ws_ypixel; | ||
55 | }; | ||
56 | |||
57 | /* line disciplines */ | ||
58 | #define N_TTY 0 | ||
59 | #define N_SLIP 1 | ||
60 | #define N_MOUSE 2 | ||
61 | #define N_PPP 3 | ||
62 | #define N_STRIP 4 | ||
63 | #define N_AX25 5 | ||
64 | #define N_X25 6 | ||
65 | #define N_6PACK 7 | ||
66 | #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ | ||
67 | #define N_R3964 9 /* Reserved for Simatic R3964 module */ | ||
68 | #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ | ||
69 | #define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ | ||
70 | #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ | ||
71 | #define N_HDLC 13 /* synchronous HDLC */ | ||
72 | #define N_SYNC_PPP 14 /* synchronous PPP */ | ||
73 | #define N_HCI 15 /* Bluetooth HCI UART */ | ||
74 | |||
75 | #ifdef __KERNEL__ | ||
76 | #include <linux/module.h> | ||
77 | |||
78 | /* | ||
79 | * c_cc characters in the termio structure. Oh, how I love being | ||
80 | * backwardly compatible. Notice that character 4 and 5 are | ||
81 | * interpreted differently depending on whether ICANON is set in | ||
82 | * c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise | ||
83 | * as _VMIN and V_TIME. This is for compatibility with OSF/1 (which | ||
84 | * is compatible with sysV)... | ||
85 | */ | ||
86 | #define _VMIN 4 | ||
87 | #define _VTIME 5 | ||
88 | |||
89 | |||
90 | /* intr=^C quit=^\ erase=del kill=^U | ||
91 | eof=^D eol=\0 eol2=\0 sxtc=\0 | ||
92 | start=^Q stop=^S susp=^Z dsusp=^Y | ||
93 | reprint=^R discard=^U werase=^W lnext=^V | ||
94 | vmin=\1 vtime=\0 | ||
95 | */ | ||
96 | #define INIT_C_CC "\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001" | ||
97 | |||
98 | /* | ||
99 | * Translate a "termio" structure into a "termios". Ugh. | ||
100 | */ | ||
101 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
102 | ({ \ | ||
103 | unsigned short tmp; \ | ||
104 | get_user(tmp, &(termio)->c_iflag); \ | ||
105 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ | ||
106 | get_user(tmp, &(termio)->c_oflag); \ | ||
107 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ | ||
108 | get_user(tmp, &(termio)->c_cflag); \ | ||
109 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ | ||
110 | get_user(tmp, &(termio)->c_lflag); \ | ||
111 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ | ||
112 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
113 | 0; \ | ||
114 | }) | ||
115 | |||
116 | /* | ||
117 | * Translate a "termios" structure into a "termio". Ugh. | ||
118 | * | ||
119 | * Note the "fun" _VMIN overloading. | ||
120 | */ | ||
121 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
122 | ({ \ | ||
123 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
124 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
125 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
126 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
127 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
128 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
129 | if (!((termios)->c_lflag & ICANON)) { \ | ||
130 | put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \ | ||
131 | put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \ | ||
132 | } \ | ||
133 | 0; \ | ||
134 | }) | ||
135 | |||
136 | #define user_termios_to_kernel_termios(k, u) \ | ||
137 | ({ \ | ||
138 | get_user((k)->c_iflag, &(u)->c_iflag); \ | ||
139 | get_user((k)->c_oflag, &(u)->c_oflag); \ | ||
140 | get_user((k)->c_cflag, &(u)->c_cflag); \ | ||
141 | get_user((k)->c_lflag, &(u)->c_lflag); \ | ||
142 | get_user((k)->c_line, &(u)->c_line); \ | ||
143 | copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | ||
144 | if((k)->c_lflag & ICANON) { \ | ||
145 | get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
146 | get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
147 | } else { \ | ||
148 | get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
149 | get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
150 | } \ | ||
151 | 0; \ | ||
152 | }) | ||
153 | |||
154 | #define kernel_termios_to_user_termios(u, k) \ | ||
155 | ({ \ | ||
156 | put_user((k)->c_iflag, &(u)->c_iflag); \ | ||
157 | put_user((k)->c_oflag, &(u)->c_oflag); \ | ||
158 | put_user((k)->c_cflag, &(u)->c_cflag); \ | ||
159 | put_user((k)->c_lflag, &(u)->c_lflag); \ | ||
160 | put_user((k)->c_line, &(u)->c_line); \ | ||
161 | copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | ||
162 | if(!((k)->c_lflag & ICANON)) { \ | ||
163 | put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
164 | put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
165 | } else { \ | ||
166 | put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
167 | put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
168 | } \ | ||
169 | 0; \ | ||
170 | }) | ||
171 | |||
172 | #endif /* __KERNEL__ */ | ||
173 | |||
174 | #endif /* _SPARC_TERMIOS_H */ | ||
diff --git a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h new file mode 100644 index 000000000000..104f03c55416 --- /dev/null +++ b/include/asm-sparc/thread_info.h | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * thread_info.h: sparc low-level thread information | ||
3 | * adapted from the ppc version by Pete Zaitcev, which was | ||
4 | * adapted from the i386 version by Paul Mackerras | ||
5 | * | ||
6 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) | ||
7 | * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com) | ||
8 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_THREAD_INFO_H | ||
12 | #define _ASM_THREAD_INFO_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | |||
18 | #include <asm/btfixup.h> | ||
19 | #include <asm/ptrace.h> | ||
20 | #include <asm/page.h> | ||
21 | |||
22 | /* | ||
23 | * Low level task data. | ||
24 | * | ||
25 | * If you change this, change the TI_* offsets below to match. | ||
26 | */ | ||
27 | #define NSWINS 8 | ||
28 | struct thread_info { | ||
29 | unsigned long uwinmask; | ||
30 | struct task_struct *task; /* main task structure */ | ||
31 | struct exec_domain *exec_domain; /* execution domain */ | ||
32 | unsigned long flags; /* low level flags */ | ||
33 | |||
34 | int cpu; /* cpu we're on */ | ||
35 | int preempt_count; | ||
36 | int softirq_count; | ||
37 | int hardirq_count; | ||
38 | |||
39 | /* Context switch saved kernel state. */ | ||
40 | unsigned long ksp; /* ... ksp __attribute__ ((aligned (8))); */ | ||
41 | unsigned long kpc; | ||
42 | unsigned long kpsr; | ||
43 | unsigned long kwim; | ||
44 | |||
45 | /* A place to store user windows and stack pointers | ||
46 | * when the stack needs inspection. | ||
47 | */ | ||
48 | struct reg_window reg_window[NSWINS]; /* align for ldd! */ | ||
49 | unsigned long rwbuf_stkptrs[NSWINS]; | ||
50 | unsigned long w_saved; | ||
51 | |||
52 | struct restart_block restart_block; | ||
53 | }; | ||
54 | |||
55 | /* | ||
56 | * macros/functions for gaining access to the thread information structure | ||
57 | * | ||
58 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
59 | */ | ||
60 | #define INIT_THREAD_INFO(tsk) \ | ||
61 | { \ | ||
62 | .uwinmask = 0, \ | ||
63 | .task = &tsk, \ | ||
64 | .exec_domain = &default_exec_domain, \ | ||
65 | .flags = 0, \ | ||
66 | .cpu = 0, \ | ||
67 | .preempt_count = 1, \ | ||
68 | .restart_block = { \ | ||
69 | .fn = do_no_restart_syscall, \ | ||
70 | }, \ | ||
71 | } | ||
72 | |||
73 | #define init_thread_info (init_thread_union.thread_info) | ||
74 | #define init_stack (init_thread_union.stack) | ||
75 | |||
76 | /* how to get the thread information struct from C */ | ||
77 | register struct thread_info *current_thread_info_reg asm("g6"); | ||
78 | #define current_thread_info() (current_thread_info_reg) | ||
79 | |||
80 | /* | ||
81 | * thread information allocation | ||
82 | */ | ||
83 | #if PAGE_SHIFT == 13 | ||
84 | #define THREAD_INFO_ORDER 0 | ||
85 | #else /* PAGE_SHIFT */ | ||
86 | #define THREAD_INFO_ORDER 1 | ||
87 | #endif | ||
88 | |||
89 | BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void) | ||
90 | #define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)() | ||
91 | |||
92 | BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) | ||
93 | #define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti) | ||
94 | |||
95 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
96 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
97 | |||
98 | #endif /* __ASSEMBLY__ */ | ||
99 | |||
100 | /* | ||
101 | * Size of kernel stack for each process. | ||
102 | * Observe the order of get_free_pages() in alloc_thread_info(). | ||
103 | * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste. | ||
104 | */ | ||
105 | #define THREAD_SIZE 8192 | ||
106 | |||
107 | /* | ||
108 | * Offsets in thread_info structure, used in assembly code | ||
109 | * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications. | ||
110 | */ | ||
111 | #define TI_UWINMASK 0x00 /* uwinmask */ | ||
112 | #define TI_TASK 0x04 | ||
113 | #define TI_EXECDOMAIN 0x08 /* exec_domain */ | ||
114 | #define TI_FLAGS 0x0c | ||
115 | #define TI_CPU 0x10 | ||
116 | #define TI_PREEMPT 0x14 /* preempt_count */ | ||
117 | #define TI_SOFTIRQ 0x18 /* softirq_count */ | ||
118 | #define TI_HARDIRQ 0x1c /* hardirq_count */ | ||
119 | #define TI_KSP 0x20 /* ksp */ | ||
120 | #define TI_KPC 0x24 /* kpc (ldd'ed with kpc) */ | ||
121 | #define TI_KPSR 0x28 /* kpsr */ | ||
122 | #define TI_KWIM 0x2c /* kwim (ldd'ed with kpsr) */ | ||
123 | #define TI_REG_WINDOW 0x30 | ||
124 | #define TI_RWIN_SPTRS 0x230 | ||
125 | #define TI_W_SAVED 0x250 | ||
126 | /* #define TI_RESTART_BLOCK 0x25n */ /* Nobody cares */ | ||
127 | |||
128 | #define PREEMPT_ACTIVE 0x4000000 | ||
129 | |||
130 | /* | ||
131 | * thread information flag bit numbers | ||
132 | */ | ||
133 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
134 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
135 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
136 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
137 | #define TIF_USEDFPU 8 /* FPU was used by this task | ||
138 | * this quantum (SMP) */ | ||
139 | #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling | ||
140 | * TIF_NEED_RESCHED */ | ||
141 | #define TIF_MEMDIE 10 | ||
142 | |||
143 | /* as above, but as bit values */ | ||
144 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
145 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
146 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
147 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
148 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | ||
149 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
150 | |||
151 | #endif /* __KERNEL__ */ | ||
152 | |||
153 | #endif /* _ASM_THREAD_INFO_H */ | ||
diff --git a/include/asm-sparc/timer.h b/include/asm-sparc/timer.h new file mode 100644 index 000000000000..b16eb739dddb --- /dev/null +++ b/include/asm-sparc/timer.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* $Id: timer.h,v 1.21 1999/04/20 13:22:51 anton Exp $ | ||
2 | * timer.h: Definitions for the timer chips on the Sparc. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #include <linux/config.h> | ||
8 | |||
9 | #ifndef _SPARC_TIMER_H | ||
10 | #define _SPARC_TIMER_H | ||
11 | |||
12 | #include <asm/system.h> /* For SUN4M_NCPUS */ | ||
13 | #include <asm/sun4paddr.h> | ||
14 | #include <asm/btfixup.h> | ||
15 | |||
16 | /* Timer structures. The interrupt timer has two properties which | ||
17 | * are the counter (which is handled in do_timer in sched.c) and the limit. | ||
18 | * This limit is where the timer's counter 'wraps' around. Oddly enough, | ||
19 | * the sun4c timer when it hits the limit wraps back to 1 and not zero | ||
20 | * thus when calculating the value at which it will fire a microsecond you | ||
21 | * must adjust by one. Thanks SUN for designing such great hardware ;( | ||
22 | */ | ||
23 | |||
24 | /* Note that I am only going to use the timer that interrupts at | ||
25 | * Sparc IRQ 10. There is another one available that can fire at | ||
26 | * IRQ 14. Currently it is left untouched, we keep the PROM's limit | ||
27 | * register value and let the prom take these interrupts. This allows | ||
28 | * L1-A to work. | ||
29 | */ | ||
30 | |||
31 | struct sun4c_timer_info { | ||
32 | __volatile__ unsigned int cur_count10; | ||
33 | __volatile__ unsigned int timer_limit10; | ||
34 | __volatile__ unsigned int cur_count14; | ||
35 | __volatile__ unsigned int timer_limit14; | ||
36 | }; | ||
37 | |||
38 | #define SUN4C_TIMER_PHYSADDR 0xf3000000 | ||
39 | #ifdef CONFIG_SUN4 | ||
40 | #define SUN_TIMER_PHYSADDR SUN4_300_TIMER_PHYSADDR | ||
41 | #else | ||
42 | #define SUN_TIMER_PHYSADDR SUN4C_TIMER_PHYSADDR | ||
43 | #endif | ||
44 | |||
45 | /* A sun4m has two blocks of registers which are probably of the same | ||
46 | * structure. LSI Logic's L64851 is told to _decrement_ from the limit | ||
47 | * value. Aurora behaves similarly but its limit value is compacted in | ||
48 | * other fashion (it's wider). Documented fields are defined here. | ||
49 | */ | ||
50 | |||
51 | /* As with the interrupt register, we have two classes of timer registers | ||
52 | * which are per-cpu and master. Per-cpu timers only hit that cpu and are | ||
53 | * only level 14 ticks, master timer hits all cpus and is level 10. | ||
54 | */ | ||
55 | |||
56 | #define SUN4M_PRM_CNT_L 0x80000000 | ||
57 | #define SUN4M_PRM_CNT_LVALUE 0x7FFFFC00 | ||
58 | |||
59 | struct sun4m_timer_percpu_info { | ||
60 | __volatile__ unsigned int l14_timer_limit; /* Initial value is 0x009c4000 */ | ||
61 | __volatile__ unsigned int l14_cur_count; | ||
62 | |||
63 | /* This register appears to be write only and/or inaccessible | ||
64 | * on Uni-Processor sun4m machines. | ||
65 | */ | ||
66 | __volatile__ unsigned int l14_limit_noclear; /* Data access error is here */ | ||
67 | |||
68 | __volatile__ unsigned int cntrl; /* =1 after POST on Aurora */ | ||
69 | __volatile__ unsigned char space[PAGE_SIZE - 16]; | ||
70 | }; | ||
71 | |||
72 | struct sun4m_timer_regs { | ||
73 | struct sun4m_timer_percpu_info cpu_timers[SUN4M_NCPUS]; | ||
74 | volatile unsigned int l10_timer_limit; | ||
75 | volatile unsigned int l10_cur_count; | ||
76 | |||
77 | /* Again, this appears to be write only and/or inaccessible | ||
78 | * on uni-processor sun4m machines. | ||
79 | */ | ||
80 | volatile unsigned int l10_limit_noclear; | ||
81 | |||
82 | /* This register too, it must be magic. */ | ||
83 | volatile unsigned int foobar; | ||
84 | |||
85 | volatile unsigned int cfg; /* equals zero at boot time... */ | ||
86 | }; | ||
87 | |||
88 | extern struct sun4m_timer_regs *sun4m_timers; | ||
89 | |||
90 | #define SUN4D_PRM_CNT_L 0x80000000 | ||
91 | #define SUN4D_PRM_CNT_LVALUE 0x7FFFFC00 | ||
92 | |||
93 | struct sun4d_timer_regs { | ||
94 | volatile unsigned int l10_timer_limit; | ||
95 | volatile unsigned int l10_cur_countx; | ||
96 | volatile unsigned int l10_limit_noclear; | ||
97 | volatile unsigned int ctrl; | ||
98 | volatile unsigned int l10_cur_count; | ||
99 | }; | ||
100 | |||
101 | extern struct sun4d_timer_regs *sun4d_timers; | ||
102 | |||
103 | extern __volatile__ unsigned int *master_l10_counter; | ||
104 | extern __volatile__ unsigned int *master_l10_limit; | ||
105 | |||
106 | /* FIXME: Make do_[gs]ettimeofday btfixup calls */ | ||
107 | BTFIXUPDEF_CALL(int, bus_do_settimeofday, struct timespec *tv) | ||
108 | #define bus_do_settimeofday(tv) BTFIXUP_CALL(bus_do_settimeofday)(tv) | ||
109 | |||
110 | #endif /* !(_SPARC_TIMER_H) */ | ||
diff --git a/include/asm-sparc/timex.h b/include/asm-sparc/timex.h new file mode 100644 index 000000000000..71b45c90ccae --- /dev/null +++ b/include/asm-sparc/timex.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * linux/include/asm-sparc/timex.h | ||
3 | * | ||
4 | * sparc architecture timex specifications | ||
5 | */ | ||
6 | #ifndef _ASMsparc_TIMEX_H | ||
7 | #define _ASMsparc_TIMEX_H | ||
8 | |||
9 | #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ | ||
10 | |||
11 | /* XXX Maybe do something better at some point... -DaveM */ | ||
12 | typedef unsigned long cycles_t; | ||
13 | #define get_cycles() (0) | ||
14 | |||
15 | #endif | ||
diff --git a/include/asm-sparc/tlb.h b/include/asm-sparc/tlb.h new file mode 100644 index 000000000000..6d02d1ce53f3 --- /dev/null +++ b/include/asm-sparc/tlb.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _SPARC_TLB_H | ||
2 | #define _SPARC_TLB_H | ||
3 | |||
4 | #define tlb_start_vma(tlb, vma) \ | ||
5 | do { \ | ||
6 | flush_cache_range(vma, vma->vm_start, vma->vm_end); \ | ||
7 | } while (0) | ||
8 | |||
9 | #define tlb_end_vma(tlb, vma) \ | ||
10 | do { \ | ||
11 | flush_tlb_range(vma, vma->vm_start, vma->vm_end); \ | ||
12 | } while (0) | ||
13 | |||
14 | #define __tlb_remove_tlb_entry(tlb, pte, address) \ | ||
15 | do { } while (0) | ||
16 | |||
17 | #define tlb_flush(tlb) \ | ||
18 | do { \ | ||
19 | flush_tlb_mm((tlb)->mm); \ | ||
20 | } while (0) | ||
21 | |||
22 | #include <asm-generic/tlb.h> | ||
23 | |||
24 | #endif /* _SPARC_TLB_H */ | ||
diff --git a/include/asm-sparc/tlbflush.h b/include/asm-sparc/tlbflush.h new file mode 100644 index 000000000000..5643ca31ead9 --- /dev/null +++ b/include/asm-sparc/tlbflush.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef _SPARC_TLBFLUSH_H | ||
2 | #define _SPARC_TLBFLUSH_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <linux/mm.h> | ||
6 | // #include <asm/processor.h> | ||
7 | |||
8 | /* | ||
9 | * TLB flushing: | ||
10 | * | ||
11 | * - flush_tlb() flushes the current mm struct TLBs XXX Exists? | ||
12 | * - flush_tlb_all() flushes all processes TLBs | ||
13 | * - flush_tlb_mm(mm) flushes the specified mm context TLB's | ||
14 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
15 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
16 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
17 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | ||
18 | */ | ||
19 | |||
20 | #ifdef CONFIG_SMP | ||
21 | |||
22 | BTFIXUPDEF_CALL(void, local_flush_tlb_all, void) | ||
23 | BTFIXUPDEF_CALL(void, local_flush_tlb_mm, struct mm_struct *) | ||
24 | BTFIXUPDEF_CALL(void, local_flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long) | ||
25 | BTFIXUPDEF_CALL(void, local_flush_tlb_page, struct vm_area_struct *, unsigned long) | ||
26 | |||
27 | #define local_flush_tlb_all() BTFIXUP_CALL(local_flush_tlb_all)() | ||
28 | #define local_flush_tlb_mm(mm) BTFIXUP_CALL(local_flush_tlb_mm)(mm) | ||
29 | #define local_flush_tlb_range(vma,start,end) BTFIXUP_CALL(local_flush_tlb_range)(vma,start,end) | ||
30 | #define local_flush_tlb_page(vma,addr) BTFIXUP_CALL(local_flush_tlb_page)(vma,addr) | ||
31 | |||
32 | extern void smp_flush_tlb_all(void); | ||
33 | extern void smp_flush_tlb_mm(struct mm_struct *mm); | ||
34 | extern void smp_flush_tlb_range(struct vm_area_struct *vma, | ||
35 | unsigned long start, | ||
36 | unsigned long end); | ||
37 | extern void smp_flush_tlb_page(struct vm_area_struct *mm, unsigned long page); | ||
38 | |||
39 | #endif /* CONFIG_SMP */ | ||
40 | |||
41 | BTFIXUPDEF_CALL(void, flush_tlb_all, void) | ||
42 | BTFIXUPDEF_CALL(void, flush_tlb_mm, struct mm_struct *) | ||
43 | BTFIXUPDEF_CALL(void, flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long) | ||
44 | BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long) | ||
45 | |||
46 | // Thanks to Anton Blanchard, our pagetables became uncached in 2.4. Wee! | ||
47 | // extern void flush_tlb_pgtables(struct mm_struct *mm, | ||
48 | // unsigned long start, unsigned long end); | ||
49 | #define flush_tlb_pgtables(mm, start, end) do{ }while(0) | ||
50 | |||
51 | #define flush_tlb_all() BTFIXUP_CALL(flush_tlb_all)() | ||
52 | #define flush_tlb_mm(mm) BTFIXUP_CALL(flush_tlb_mm)(mm) | ||
53 | #define flush_tlb_range(vma,start,end) BTFIXUP_CALL(flush_tlb_range)(vma,start,end) | ||
54 | #define flush_tlb_page(vma,addr) BTFIXUP_CALL(flush_tlb_page)(vma,addr) | ||
55 | |||
56 | // #define flush_tlb() flush_tlb_mm(current->active_mm) /* XXX Sure? */ | ||
57 | |||
58 | /* | ||
59 | * This is a kludge, until I know better. --zaitcev XXX | ||
60 | */ | ||
61 | #define flush_tlb_kernel_range(start, end) flush_tlb_all() | ||
62 | |||
63 | #endif /* _SPARC_TLBFLUSH_H */ | ||
diff --git a/include/asm-sparc/topology.h b/include/asm-sparc/topology.h new file mode 100644 index 000000000000..ee5ac9c9da28 --- /dev/null +++ b/include/asm-sparc/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SPARC_TOPOLOGY_H | ||
2 | #define _ASM_SPARC_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* _ASM_SPARC_TOPOLOGY_H */ | ||
diff --git a/include/asm-sparc/traps.h b/include/asm-sparc/traps.h new file mode 100644 index 000000000000..6690ab956ea6 --- /dev/null +++ b/include/asm-sparc/traps.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /* $Id: traps.h,v 1.9 1998/03/09 14:04:53 jj Exp $ | ||
2 | * traps.h: Format of entries for the Sparc trap table. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_TRAPS_H | ||
8 | #define _SPARC_TRAPS_H | ||
9 | |||
10 | #define NUM_SPARC_TRAPS 255 | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | /* This is for V8 compliant Sparc CPUS */ | ||
15 | struct tt_entry { | ||
16 | unsigned long inst_one; | ||
17 | unsigned long inst_two; | ||
18 | unsigned long inst_three; | ||
19 | unsigned long inst_four; | ||
20 | }; | ||
21 | |||
22 | /* We set this to _start in system setup. */ | ||
23 | extern struct tt_entry *sparc_ttable; | ||
24 | |||
25 | extern __inline__ unsigned long get_tbr(void) | ||
26 | { | ||
27 | unsigned long tbr; | ||
28 | |||
29 | __asm__ __volatile__("rd %%tbr, %0\n\t" : "=r" (tbr)); | ||
30 | return tbr; | ||
31 | } | ||
32 | |||
33 | #endif /* !(__ASSEMBLY__) */ | ||
34 | |||
35 | /* For patching the trap table at boot time, we need to know how to | ||
36 | * form various common Sparc instructions. Thus these macros... | ||
37 | */ | ||
38 | |||
39 | #define SPARC_MOV_CONST_L3(const) (0xa6102000 | (const&0xfff)) | ||
40 | |||
41 | /* The following assumes that the branch lies before the place we | ||
42 | * are branching to. This is the case for a trap vector... | ||
43 | * You have been warned. | ||
44 | */ | ||
45 | #define SPARC_BRANCH(dest_addr, inst_addr) \ | ||
46 | (0x10800000 | (((dest_addr-inst_addr)>>2)&0x3fffff)) | ||
47 | |||
48 | #define SPARC_RD_PSR_L0 (0xa1480000) | ||
49 | #define SPARC_RD_WIM_L3 (0xa7500000) | ||
50 | #define SPARC_NOP (0x01000000) | ||
51 | |||
52 | /* Various interesting trap levels. */ | ||
53 | /* First, hardware traps. */ | ||
54 | #define SP_TRAP_TFLT 0x1 /* Text fault */ | ||
55 | #define SP_TRAP_II 0x2 /* Illegal Instruction */ | ||
56 | #define SP_TRAP_PI 0x3 /* Privileged Instruction */ | ||
57 | #define SP_TRAP_FPD 0x4 /* Floating Point Disabled */ | ||
58 | #define SP_TRAP_WOVF 0x5 /* Window Overflow */ | ||
59 | #define SP_TRAP_WUNF 0x6 /* Window Underflow */ | ||
60 | #define SP_TRAP_MNA 0x7 /* Memory Address Unaligned */ | ||
61 | #define SP_TRAP_FPE 0x8 /* Floating Point Exception */ | ||
62 | #define SP_TRAP_DFLT 0x9 /* Data Fault */ | ||
63 | #define SP_TRAP_TOF 0xa /* Tag Overflow */ | ||
64 | #define SP_TRAP_WDOG 0xb /* Watchpoint Detected */ | ||
65 | #define SP_TRAP_IRQ1 0x11 /* IRQ level 1 */ | ||
66 | #define SP_TRAP_IRQ2 0x12 /* IRQ level 2 */ | ||
67 | #define SP_TRAP_IRQ3 0x13 /* IRQ level 3 */ | ||
68 | #define SP_TRAP_IRQ4 0x14 /* IRQ level 4 */ | ||
69 | #define SP_TRAP_IRQ5 0x15 /* IRQ level 5 */ | ||
70 | #define SP_TRAP_IRQ6 0x16 /* IRQ level 6 */ | ||
71 | #define SP_TRAP_IRQ7 0x17 /* IRQ level 7 */ | ||
72 | #define SP_TRAP_IRQ8 0x18 /* IRQ level 8 */ | ||
73 | #define SP_TRAP_IRQ9 0x19 /* IRQ level 9 */ | ||
74 | #define SP_TRAP_IRQ10 0x1a /* IRQ level 10 */ | ||
75 | #define SP_TRAP_IRQ11 0x1b /* IRQ level 11 */ | ||
76 | #define SP_TRAP_IRQ12 0x1c /* IRQ level 12 */ | ||
77 | #define SP_TRAP_IRQ13 0x1d /* IRQ level 13 */ | ||
78 | #define SP_TRAP_IRQ14 0x1e /* IRQ level 14 */ | ||
79 | #define SP_TRAP_IRQ15 0x1f /* IRQ level 15 Non-maskable */ | ||
80 | #define SP_TRAP_RACC 0x20 /* Register Access Error ??? */ | ||
81 | #define SP_TRAP_IACC 0x21 /* Instruction Access Error */ | ||
82 | #define SP_TRAP_CPDIS 0x24 /* Co-Processor Disabled */ | ||
83 | #define SP_TRAP_BADFL 0x25 /* Unimplemented Flush Instruction */ | ||
84 | #define SP_TRAP_CPEXP 0x28 /* Co-Processor Exception */ | ||
85 | #define SP_TRAP_DACC 0x29 /* Data Access Error */ | ||
86 | #define SP_TRAP_DIVZ 0x2a /* Divide By Zero */ | ||
87 | #define SP_TRAP_DSTORE 0x2b /* Data Store Error ??? */ | ||
88 | #define SP_TRAP_DMM 0x2c /* Data Access MMU Miss ??? */ | ||
89 | #define SP_TRAP_IMM 0x3c /* Instruction Access MMU Miss ??? */ | ||
90 | |||
91 | /* Now the Software Traps... */ | ||
92 | #define SP_TRAP_SUNOS 0x80 /* SunOS System Call */ | ||
93 | #define SP_TRAP_SBPT 0x81 /* Software Breakpoint */ | ||
94 | #define SP_TRAP_SDIVZ 0x82 /* Software Divide-by-Zero trap */ | ||
95 | #define SP_TRAP_FWIN 0x83 /* Flush Windows */ | ||
96 | #define SP_TRAP_CWIN 0x84 /* Clean Windows */ | ||
97 | #define SP_TRAP_RCHK 0x85 /* Range Check */ | ||
98 | #define SP_TRAP_FUNA 0x86 /* Fix Unaligned Access */ | ||
99 | #define SP_TRAP_IOWFL 0x87 /* Integer Overflow */ | ||
100 | #define SP_TRAP_SOLARIS 0x88 /* Solaris System Call */ | ||
101 | #define SP_TRAP_NETBSD 0x89 /* NetBSD System Call */ | ||
102 | #define SP_TRAP_LINUX 0x90 /* Linux System Call */ | ||
103 | |||
104 | /* Names used for compatibility with SunOS */ | ||
105 | #define ST_SYSCALL 0x00 | ||
106 | #define ST_BREAKPOINT 0x01 | ||
107 | #define ST_DIV0 0x02 | ||
108 | #define ST_FLUSH_WINDOWS 0x03 | ||
109 | #define ST_CLEAN_WINDOWS 0x04 | ||
110 | #define ST_RANGE_CHECK 0x05 | ||
111 | #define ST_FIX_ALIGN 0x06 | ||
112 | #define ST_INT_OVERFLOW 0x07 | ||
113 | |||
114 | /* Special traps... */ | ||
115 | #define SP_TRAP_KBPT1 0xfe /* KADB/PROM Breakpoint one */ | ||
116 | #define SP_TRAP_KBPT2 0xff /* KADB/PROM Breakpoint two */ | ||
117 | |||
118 | /* Handy Macros */ | ||
119 | /* Is this a trap we never expect to get? */ | ||
120 | #define BAD_TRAP_P(level) \ | ||
121 | ((level > SP_TRAP_WDOG && level < SP_TRAP_IRQ1) || \ | ||
122 | (level > SP_TRAP_IACC && level < SP_TRAP_CPDIS) || \ | ||
123 | (level > SP_TRAP_BADFL && level < SP_TRAP_CPEXP) || \ | ||
124 | (level > SP_TRAP_DMM && level < SP_TRAP_IMM) || \ | ||
125 | (level > SP_TRAP_IMM && level < SP_TRAP_SUNOS) || \ | ||
126 | (level > SP_TRAP_LINUX && level < SP_TRAP_KBPT1)) | ||
127 | |||
128 | /* Is this a Hardware trap? */ | ||
129 | #define HW_TRAP_P(level) ((level > 0) && (level < SP_TRAP_SUNOS)) | ||
130 | |||
131 | /* Is this a Software trap? */ | ||
132 | #define SW_TRAP_P(level) ((level >= SP_TRAP_SUNOS) && (level <= SP_TRAP_KBPT2)) | ||
133 | |||
134 | /* Is this a system call for some OS we know about? */ | ||
135 | #define SCALL_TRAP_P(level) ((level == SP_TRAP_SUNOS) || \ | ||
136 | (level == SP_TRAP_SOLARIS) || \ | ||
137 | (level == SP_TRAP_NETBSD) || \ | ||
138 | (level == SP_TRAP_LINUX)) | ||
139 | |||
140 | #endif /* !(_SPARC_TRAPS_H) */ | ||
diff --git a/include/asm-sparc/tsunami.h b/include/asm-sparc/tsunami.h new file mode 100644 index 000000000000..887add5c466b --- /dev/null +++ b/include/asm-sparc/tsunami.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* $Id: tsunami.h,v 1.5 1996/08/29 09:49:03 davem Exp $ | ||
2 | * tsunami.h: Module specific definitions for Tsunami V8 Sparcs | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_TSUNAMI_H | ||
8 | #define _SPARC_TSUNAMI_H | ||
9 | |||
10 | #include <asm/asi.h> | ||
11 | |||
12 | /* The MMU control register on the Tsunami: | ||
13 | * | ||
14 | * ----------------------------------------------------------------------- | ||
15 | * | implvers |SW|AV|DV|MV| RSV |PC|ITD|ALC| RSV |PE| RC |IE|DE|RSV|NF|ME| | ||
16 | * ----------------------------------------------------------------------- | ||
17 | * 31 24 23 22 21 20 19-18 17 16 14 13-12 11 10-9 8 7 6-2 1 0 | ||
18 | * | ||
19 | * SW: Enable Software Table Walks 0=off 1=on | ||
20 | * AV: Address View bit | ||
21 | * DV: Data View bit | ||
22 | * MV: Memory View bit | ||
23 | * PC: Parity Control | ||
24 | * ITD: ITBR disable | ||
25 | * ALC: Alternate Cacheable | ||
26 | * PE: Parity Enable 0=off 1=on | ||
27 | * RC: Refresh Control | ||
28 | * IE: Instruction cache Enable 0=off 1=on | ||
29 | * DE: Data cache Enable 0=off 1=on | ||
30 | * NF: No Fault, same as all other SRMMUs | ||
31 | * ME: MMU Enable, same as all other SRMMUs | ||
32 | */ | ||
33 | |||
34 | #define TSUNAMI_SW 0x00800000 | ||
35 | #define TSUNAMI_AV 0x00400000 | ||
36 | #define TSUNAMI_DV 0x00200000 | ||
37 | #define TSUNAMI_MV 0x00100000 | ||
38 | #define TSUNAMI_PC 0x00020000 | ||
39 | #define TSUNAMI_ITD 0x00010000 | ||
40 | #define TSUNAMI_ALC 0x00008000 | ||
41 | #define TSUNAMI_PE 0x00001000 | ||
42 | #define TSUNAMI_RCMASK 0x00000C00 | ||
43 | #define TSUNAMI_IENAB 0x00000200 | ||
44 | #define TSUNAMI_DENAB 0x00000100 | ||
45 | #define TSUNAMI_NF 0x00000002 | ||
46 | #define TSUNAMI_ME 0x00000001 | ||
47 | |||
48 | static inline void tsunami_flush_icache(void) | ||
49 | { | ||
50 | __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" | ||
51 | : /* no outputs */ | ||
52 | : "i" (ASI_M_IC_FLCLEAR) | ||
53 | : "memory"); | ||
54 | } | ||
55 | |||
56 | static inline void tsunami_flush_dcache(void) | ||
57 | { | ||
58 | __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" | ||
59 | : /* no outputs */ | ||
60 | : "i" (ASI_M_DC_FLCLEAR) | ||
61 | : "memory"); | ||
62 | } | ||
63 | |||
64 | #endif /* !(_SPARC_TSUNAMI_H) */ | ||
diff --git a/include/asm-sparc/turbosparc.h b/include/asm-sparc/turbosparc.h new file mode 100644 index 000000000000..31d2350a5818 --- /dev/null +++ b/include/asm-sparc/turbosparc.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* $Id: turbosparc.h,v 1.4 1998/08/16 16:02:42 ecd Exp $ | ||
2 | * turbosparc.h: Defines specific to the TurboSparc module. | ||
3 | * This is SRMMU stuff. | ||
4 | * | ||
5 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
6 | */ | ||
7 | #ifndef _SPARC_TURBOSPARC_H | ||
8 | #define _SPARC_TURBOSPARC_H | ||
9 | |||
10 | #include <asm/asi.h> | ||
11 | #include <asm/pgtsrmmu.h> | ||
12 | |||
13 | /* Bits in the SRMMU control register for TurboSparc modules. | ||
14 | * | ||
15 | * ------------------------------------------------------------------- | ||
16 | * |impl-vers| RSV| PMC |PE|PC| RSV |BM| RFR |IC|DC|PSO|RSV|ICS|NF|ME| | ||
17 | * ------------------------------------------------------------------- | ||
18 | * 31 24 23-21 20-19 18 17 16-15 14 13-10 9 8 7 6-3 2 1 0 | ||
19 | * | ||
20 | * BM: Boot Mode -- 0 = not in boot mode, 1 = in boot mode | ||
21 | * | ||
22 | * This indicates whether the TurboSparc is in boot-mode or not. | ||
23 | * | ||
24 | * IC: Instruction Cache -- 0 = off, 1 = on | ||
25 | * DC: Data Cache -- 0 = off, 1 = 0n | ||
26 | * | ||
27 | * These bits enable the on-cpu TurboSparc split I/D caches. | ||
28 | * | ||
29 | * ICS: ICache Snooping -- 0 = disable, 1 = enable snooping of icache | ||
30 | * NF: No Fault -- 0 = faults generate traps, 1 = faults don't trap | ||
31 | * ME: MMU enable -- 0 = mmu not translating, 1 = mmu translating | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #define TURBOSPARC_MMUENABLE 0x00000001 | ||
36 | #define TURBOSPARC_NOFAULT 0x00000002 | ||
37 | #define TURBOSPARC_ICSNOOP 0x00000004 | ||
38 | #define TURBOSPARC_PSO 0x00000080 | ||
39 | #define TURBOSPARC_DCENABLE 0x00000100 /* Enable data cache */ | ||
40 | #define TURBOSPARC_ICENABLE 0x00000200 /* Enable instruction cache */ | ||
41 | #define TURBOSPARC_BMODE 0x00004000 | ||
42 | #define TURBOSPARC_PARITYODD 0x00020000 /* Parity odd, if enabled */ | ||
43 | #define TURBOSPARC_PCENABLE 0x00040000 /* Enable parity checking */ | ||
44 | |||
45 | /* Bits in the CPU configuration register for TurboSparc modules. | ||
46 | * | ||
47 | * ------------------------------------------------------- | ||
48 | * |IOClk|SNP|AXClk| RAH | WS | RSV |SBC|WT|uS2|SE|SCC| | ||
49 | * ------------------------------------------------------- | ||
50 | * 31 30 29-28 27-26 25-23 22-8 7-6 5 4 3 2-0 | ||
51 | * | ||
52 | */ | ||
53 | |||
54 | #define TURBOSPARC_SCENABLE 0x00000008 /* Secondary cache enable */ | ||
55 | #define TURBOSPARC_uS2 0x00000010 /* Swift compatibility mode */ | ||
56 | #define TURBOSPARC_WTENABLE 0x00000020 /* Write thru for dcache */ | ||
57 | #define TURBOSPARC_SNENABLE 0x40000000 /* DVMA snoop enable */ | ||
58 | |||
59 | #ifndef __ASSEMBLY__ | ||
60 | |||
61 | /* Bits [13:5] select one of 512 instruction cache tags */ | ||
62 | static inline void turbosparc_inv_insn_tag(unsigned long addr) | ||
63 | { | ||
64 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
65 | : /* no outputs */ | ||
66 | : "r" (addr), "i" (ASI_M_TXTC_TAG) | ||
67 | : "memory"); | ||
68 | } | ||
69 | |||
70 | /* Bits [13:5] select one of 512 data cache tags */ | ||
71 | static inline void turbosparc_inv_data_tag(unsigned long addr) | ||
72 | { | ||
73 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
74 | : /* no outputs */ | ||
75 | : "r" (addr), "i" (ASI_M_DATAC_TAG) | ||
76 | : "memory"); | ||
77 | } | ||
78 | |||
79 | static inline void turbosparc_flush_icache(void) | ||
80 | { | ||
81 | unsigned long addr; | ||
82 | |||
83 | for (addr = 0; addr < 0x4000; addr += 0x20) | ||
84 | turbosparc_inv_insn_tag(addr); | ||
85 | } | ||
86 | |||
87 | static inline void turbosparc_flush_dcache(void) | ||
88 | { | ||
89 | unsigned long addr; | ||
90 | |||
91 | for (addr = 0; addr < 0x4000; addr += 0x20) | ||
92 | turbosparc_inv_data_tag(addr); | ||
93 | } | ||
94 | |||
95 | static inline void turbosparc_idflash_clear(void) | ||
96 | { | ||
97 | unsigned long addr; | ||
98 | |||
99 | for (addr = 0; addr < 0x4000; addr += 0x20) { | ||
100 | turbosparc_inv_insn_tag(addr); | ||
101 | turbosparc_inv_data_tag(addr); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | static inline void turbosparc_set_ccreg(unsigned long regval) | ||
106 | { | ||
107 | __asm__ __volatile__("sta %0, [%1] %2\n\t" | ||
108 | : /* no outputs */ | ||
109 | : "r" (regval), "r" (0x600), "i" (ASI_M_MMUREGS) | ||
110 | : "memory"); | ||
111 | } | ||
112 | |||
113 | static inline unsigned long turbosparc_get_ccreg(void) | ||
114 | { | ||
115 | unsigned long regval; | ||
116 | |||
117 | __asm__ __volatile__("lda [%1] %2, %0\n\t" | ||
118 | : "=r" (regval) | ||
119 | : "r" (0x600), "i" (ASI_M_MMUREGS)); | ||
120 | return regval; | ||
121 | } | ||
122 | |||
123 | #endif /* !__ASSEMBLY__ */ | ||
124 | |||
125 | #endif /* !(_SPARC_TURBOSPARC_H) */ | ||
diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h new file mode 100644 index 000000000000..9eabf6e61ccc --- /dev/null +++ b/include/asm-sparc/types.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* $Id: types.h,v 1.13 2001/12/21 01:22:59 davem Exp $ */ | ||
2 | #ifndef _SPARC_TYPES_H | ||
3 | #define _SPARC_TYPES_H | ||
4 | |||
5 | /* | ||
6 | * _xx is ok: it doesn't pollute the POSIX namespace. Use these in the | ||
7 | * header files exported to user space. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * This file is never included by application software unless | ||
12 | * explicitly requested (e.g., via linux/types.h) in which case the | ||
13 | * application is Linux specific so (user-) name space pollution is | ||
14 | * not a major issue. However, for interoperability, libraries still | ||
15 | * need to be careful to avoid a name clashes. | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | |||
20 | typedef unsigned short umode_t; | ||
21 | |||
22 | typedef __signed__ char __s8; | ||
23 | typedef unsigned char __u8; | ||
24 | |||
25 | typedef __signed__ short __s16; | ||
26 | typedef unsigned short __u16; | ||
27 | |||
28 | typedef __signed__ int __s32; | ||
29 | typedef unsigned int __u32; | ||
30 | |||
31 | typedef __signed__ long long __s64; | ||
32 | typedef unsigned long long __u64; | ||
33 | |||
34 | #endif /* __ASSEMBLY__ */ | ||
35 | |||
36 | #ifdef __KERNEL__ | ||
37 | |||
38 | #define BITS_PER_LONG 32 | ||
39 | |||
40 | #ifndef __ASSEMBLY__ | ||
41 | |||
42 | typedef __signed__ char s8; | ||
43 | typedef unsigned char u8; | ||
44 | |||
45 | typedef __signed__ short s16; | ||
46 | typedef unsigned short u16; | ||
47 | |||
48 | typedef __signed__ int s32; | ||
49 | typedef unsigned int u32; | ||
50 | |||
51 | typedef __signed__ long long s64; | ||
52 | typedef unsigned long long u64; | ||
53 | |||
54 | typedef u32 dma_addr_t; | ||
55 | typedef u32 dma64_addr_t; | ||
56 | |||
57 | typedef unsigned short kmem_bufctl_t; | ||
58 | |||
59 | #endif /* __ASSEMBLY__ */ | ||
60 | |||
61 | #endif /* __KERNEL__ */ | ||
62 | |||
63 | #endif /* defined(_SPARC_TYPES_H) */ | ||
diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h new file mode 100644 index 000000000000..3f47889883b7 --- /dev/null +++ b/include/asm-sparc/uaccess.h | |||
@@ -0,0 +1,389 @@ | |||
1 | /* $Id: uaccess.h,v 1.24 2001/10/30 04:32:24 davem Exp $ | ||
2 | * uaccess.h: User space memore access functions. | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
5 | * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
6 | */ | ||
7 | #ifndef _ASM_UACCESS_H | ||
8 | #define _ASM_UACCESS_H | ||
9 | |||
10 | #ifdef __KERNEL__ | ||
11 | #include <linux/compiler.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/errno.h> | ||
15 | #include <asm/vac-ops.h> | ||
16 | #include <asm/a.out.h> | ||
17 | #endif | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | /* Sparc is not segmented, however we need to be able to fool verify_area() | ||
22 | * when doing system calls from kernel mode legitimately. | ||
23 | * | ||
24 | * "For historical reasons, these macros are grossly misnamed." -Linus | ||
25 | */ | ||
26 | |||
27 | #define KERNEL_DS ((mm_segment_t) { 0 }) | ||
28 | #define USER_DS ((mm_segment_t) { -1 }) | ||
29 | |||
30 | #define VERIFY_READ 0 | ||
31 | #define VERIFY_WRITE 1 | ||
32 | |||
33 | #define get_ds() (KERNEL_DS) | ||
34 | #define get_fs() (current->thread.current_ds) | ||
35 | #define set_fs(val) ((current->thread.current_ds) = (val)) | ||
36 | |||
37 | #define segment_eq(a,b) ((a).seg == (b).seg) | ||
38 | |||
39 | /* We have there a nice not-mapped page at PAGE_OFFSET - PAGE_SIZE, so that this test | ||
40 | * can be fairly lightweight. | ||
41 | * No one can read/write anything from userland in the kernel space by setting | ||
42 | * large size and address near to PAGE_OFFSET - a fault will break his intentions. | ||
43 | */ | ||
44 | #define __user_ok(addr,size) ((addr) < STACK_TOP) | ||
45 | #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) | ||
46 | #define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size))) | ||
47 | #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) | ||
48 | |||
49 | /* this function will go away soon - use access_ok() instead */ | ||
50 | static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size) | ||
51 | { | ||
52 | return access_ok(type,addr,size) ? 0 : -EFAULT; | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * The exception table consists of pairs of addresses: the first is the | ||
57 | * address of an instruction that is allowed to fault, and the second is | ||
58 | * the address at which the program should continue. No registers are | ||
59 | * modified, so it is entirely up to the continuation code to figure out | ||
60 | * what to do. | ||
61 | * | ||
62 | * All the routines below use bits of fixup code that are out of line | ||
63 | * with the main instruction path. This means when everything is well, | ||
64 | * we don't even have to jump over them. Further, they do not intrude | ||
65 | * on our cache or tlb entries. | ||
66 | * | ||
67 | * There is a special way how to put a range of potentially faulting | ||
68 | * insns (like twenty ldd/std's with now intervening other instructions) | ||
69 | * You specify address of first in insn and 0 in fixup and in the next | ||
70 | * exception_table_entry you specify last potentially faulting insn + 1 | ||
71 | * and in fixup the routine which should handle the fault. | ||
72 | * That fixup code will get | ||
73 | * (faulting_insn_address - first_insn_in_the_range_address)/4 | ||
74 | * in %g2 (ie. index of the faulting instruction in the range). | ||
75 | */ | ||
76 | |||
77 | struct exception_table_entry | ||
78 | { | ||
79 | unsigned long insn, fixup; | ||
80 | }; | ||
81 | |||
82 | /* Returns 0 if exception not found and fixup otherwise. */ | ||
83 | extern unsigned long search_extables_range(unsigned long addr, unsigned long *g2); | ||
84 | |||
85 | extern void __ret_efault(void); | ||
86 | |||
87 | /* Uh, these should become the main single-value transfer routines.. | ||
88 | * They automatically use the right size if we just have the right | ||
89 | * pointer type.. | ||
90 | * | ||
91 | * This gets kind of ugly. We want to return _two_ values in "get_user()" | ||
92 | * and yet we don't want to do any pointers, because that is too much | ||
93 | * of a performance impact. Thus we have a few rather ugly macros here, | ||
94 | * and hide all the ugliness from the user. | ||
95 | */ | ||
96 | #define put_user(x,ptr) ({ \ | ||
97 | unsigned long __pu_addr = (unsigned long)(ptr); \ | ||
98 | __chk_user_ptr(ptr); \ | ||
99 | __put_user_check((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); }) | ||
100 | |||
101 | #define get_user(x,ptr) ({ \ | ||
102 | unsigned long __gu_addr = (unsigned long)(ptr); \ | ||
103 | __chk_user_ptr(ptr); \ | ||
104 | __get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); }) | ||
105 | |||
106 | /* | ||
107 | * The "__xxx" versions do not do address space checking, useful when | ||
108 | * doing multiple accesses to the same area (the user has to do the | ||
109 | * checks by hand with "access_ok()") | ||
110 | */ | ||
111 | #define __put_user(x,ptr) __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) | ||
112 | #define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr)),__typeof__(*(ptr))) | ||
113 | |||
114 | struct __large_struct { unsigned long buf[100]; }; | ||
115 | #define __m(x) ((struct __large_struct __user *)(x)) | ||
116 | |||
117 | #define __put_user_check(x,addr,size) ({ \ | ||
118 | register int __pu_ret; \ | ||
119 | if (__access_ok(addr,size)) { \ | ||
120 | switch (size) { \ | ||
121 | case 1: __put_user_asm(x,b,addr,__pu_ret); break; \ | ||
122 | case 2: __put_user_asm(x,h,addr,__pu_ret); break; \ | ||
123 | case 4: __put_user_asm(x,,addr,__pu_ret); break; \ | ||
124 | case 8: __put_user_asm(x,d,addr,__pu_ret); break; \ | ||
125 | default: __pu_ret = __put_user_bad(); break; \ | ||
126 | } } else { __pu_ret = -EFAULT; } __pu_ret; }) | ||
127 | |||
128 | #define __put_user_check_ret(x,addr,size,retval) ({ \ | ||
129 | register int __foo __asm__ ("l1"); \ | ||
130 | if (__access_ok(addr,size)) { \ | ||
131 | switch (size) { \ | ||
132 | case 1: __put_user_asm_ret(x,b,addr,retval,__foo); break; \ | ||
133 | case 2: __put_user_asm_ret(x,h,addr,retval,__foo); break; \ | ||
134 | case 4: __put_user_asm_ret(x,,addr,retval,__foo); break; \ | ||
135 | case 8: __put_user_asm_ret(x,d,addr,retval,__foo); break; \ | ||
136 | default: if (__put_user_bad()) return retval; break; \ | ||
137 | } } else return retval; }) | ||
138 | |||
139 | #define __put_user_nocheck(x,addr,size) ({ \ | ||
140 | register int __pu_ret; \ | ||
141 | switch (size) { \ | ||
142 | case 1: __put_user_asm(x,b,addr,__pu_ret); break; \ | ||
143 | case 2: __put_user_asm(x,h,addr,__pu_ret); break; \ | ||
144 | case 4: __put_user_asm(x,,addr,__pu_ret); break; \ | ||
145 | case 8: __put_user_asm(x,d,addr,__pu_ret); break; \ | ||
146 | default: __pu_ret = __put_user_bad(); break; \ | ||
147 | } __pu_ret; }) | ||
148 | |||
149 | #define __put_user_nocheck_ret(x,addr,size,retval) ({ \ | ||
150 | register int __foo __asm__ ("l1"); \ | ||
151 | switch (size) { \ | ||
152 | case 1: __put_user_asm_ret(x,b,addr,retval,__foo); break; \ | ||
153 | case 2: __put_user_asm_ret(x,h,addr,retval,__foo); break; \ | ||
154 | case 4: __put_user_asm_ret(x,,addr,retval,__foo); break; \ | ||
155 | case 8: __put_user_asm_ret(x,d,addr,retval,__foo); break; \ | ||
156 | default: if (__put_user_bad()) return retval; break; \ | ||
157 | } }) | ||
158 | |||
159 | #define __put_user_asm(x,size,addr,ret) \ | ||
160 | __asm__ __volatile__( \ | ||
161 | "/* Put user asm, inline. */\n" \ | ||
162 | "1:\t" "st"#size " %1, %2\n\t" \ | ||
163 | "clr %0\n" \ | ||
164 | "2:\n\n\t" \ | ||
165 | ".section .fixup,#alloc,#execinstr\n\t" \ | ||
166 | ".align 4\n" \ | ||
167 | "3:\n\t" \ | ||
168 | "b 2b\n\t" \ | ||
169 | " mov %3, %0\n\t" \ | ||
170 | ".previous\n\n\t" \ | ||
171 | ".section __ex_table,#alloc\n\t" \ | ||
172 | ".align 4\n\t" \ | ||
173 | ".word 1b, 3b\n\t" \ | ||
174 | ".previous\n\n\t" \ | ||
175 | : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \ | ||
176 | "i" (-EFAULT)) | ||
177 | |||
178 | #define __put_user_asm_ret(x,size,addr,ret,foo) \ | ||
179 | if (__builtin_constant_p(ret) && ret == -EFAULT) \ | ||
180 | __asm__ __volatile__( \ | ||
181 | "/* Put user asm ret, inline. */\n" \ | ||
182 | "1:\t" "st"#size " %1, %2\n\n\t" \ | ||
183 | ".section __ex_table,#alloc\n\t" \ | ||
184 | ".align 4\n\t" \ | ||
185 | ".word 1b, __ret_efault\n\n\t" \ | ||
186 | ".previous\n\n\t" \ | ||
187 | : "=r" (foo) : "r" (x), "m" (*__m(addr))); \ | ||
188 | else \ | ||
189 | __asm__ __volatile( \ | ||
190 | "/* Put user asm ret, inline. */\n" \ | ||
191 | "1:\t" "st"#size " %1, %2\n\n\t" \ | ||
192 | ".section .fixup,#alloc,#execinstr\n\t" \ | ||
193 | ".align 4\n" \ | ||
194 | "3:\n\t" \ | ||
195 | "ret\n\t" \ | ||
196 | " restore %%g0, %3, %%o0\n\t" \ | ||
197 | ".previous\n\n\t" \ | ||
198 | ".section __ex_table,#alloc\n\t" \ | ||
199 | ".align 4\n\t" \ | ||
200 | ".word 1b, 3b\n\n\t" \ | ||
201 | ".previous\n\n\t" \ | ||
202 | : "=r" (foo) : "r" (x), "m" (*__m(addr)), "i" (ret)) | ||
203 | |||
204 | extern int __put_user_bad(void); | ||
205 | |||
206 | #define __get_user_check(x,addr,size,type) ({ \ | ||
207 | register int __gu_ret; \ | ||
208 | register unsigned long __gu_val; \ | ||
209 | if (__access_ok(addr,size)) { \ | ||
210 | switch (size) { \ | ||
211 | case 1: __get_user_asm(__gu_val,ub,addr,__gu_ret); break; \ | ||
212 | case 2: __get_user_asm(__gu_val,uh,addr,__gu_ret); break; \ | ||
213 | case 4: __get_user_asm(__gu_val,,addr,__gu_ret); break; \ | ||
214 | case 8: __get_user_asm(__gu_val,d,addr,__gu_ret); break; \ | ||
215 | default: __gu_val = 0; __gu_ret = __get_user_bad(); break; \ | ||
216 | } } else { __gu_val = 0; __gu_ret = -EFAULT; } x = (type) __gu_val; __gu_ret; }) | ||
217 | |||
218 | #define __get_user_check_ret(x,addr,size,type,retval) ({ \ | ||
219 | register unsigned long __gu_val __asm__ ("l1"); \ | ||
220 | if (__access_ok(addr,size)) { \ | ||
221 | switch (size) { \ | ||
222 | case 1: __get_user_asm_ret(__gu_val,ub,addr,retval); break; \ | ||
223 | case 2: __get_user_asm_ret(__gu_val,uh,addr,retval); break; \ | ||
224 | case 4: __get_user_asm_ret(__gu_val,,addr,retval); break; \ | ||
225 | case 8: __get_user_asm_ret(__gu_val,d,addr,retval); break; \ | ||
226 | default: if (__get_user_bad()) return retval; \ | ||
227 | } x = (type) __gu_val; } else return retval; }) | ||
228 | |||
229 | #define __get_user_nocheck(x,addr,size,type) ({ \ | ||
230 | register int __gu_ret; \ | ||
231 | register unsigned long __gu_val; \ | ||
232 | switch (size) { \ | ||
233 | case 1: __get_user_asm(__gu_val,ub,addr,__gu_ret); break; \ | ||
234 | case 2: __get_user_asm(__gu_val,uh,addr,__gu_ret); break; \ | ||
235 | case 4: __get_user_asm(__gu_val,,addr,__gu_ret); break; \ | ||
236 | case 8: __get_user_asm(__gu_val,d,addr,__gu_ret); break; \ | ||
237 | default: __gu_val = 0; __gu_ret = __get_user_bad(); break; \ | ||
238 | } x = (type) __gu_val; __gu_ret; }) | ||
239 | |||
240 | #define __get_user_nocheck_ret(x,addr,size,type,retval) ({ \ | ||
241 | register unsigned long __gu_val __asm__ ("l1"); \ | ||
242 | switch (size) { \ | ||
243 | case 1: __get_user_asm_ret(__gu_val,ub,addr,retval); break; \ | ||
244 | case 2: __get_user_asm_ret(__gu_val,uh,addr,retval); break; \ | ||
245 | case 4: __get_user_asm_ret(__gu_val,,addr,retval); break; \ | ||
246 | case 8: __get_user_asm_ret(__gu_val,d,addr,retval); break; \ | ||
247 | default: if (__get_user_bad()) return retval; \ | ||
248 | } x = (type) __gu_val; }) | ||
249 | |||
250 | #define __get_user_asm(x,size,addr,ret) \ | ||
251 | __asm__ __volatile__( \ | ||
252 | "/* Get user asm, inline. */\n" \ | ||
253 | "1:\t" "ld"#size " %2, %1\n\t" \ | ||
254 | "clr %0\n" \ | ||
255 | "2:\n\n\t" \ | ||
256 | ".section .fixup,#alloc,#execinstr\n\t" \ | ||
257 | ".align 4\n" \ | ||
258 | "3:\n\t" \ | ||
259 | "clr %1\n\t" \ | ||
260 | "b 2b\n\t" \ | ||
261 | " mov %3, %0\n\n\t" \ | ||
262 | ".previous\n\t" \ | ||
263 | ".section __ex_table,#alloc\n\t" \ | ||
264 | ".align 4\n\t" \ | ||
265 | ".word 1b, 3b\n\n\t" \ | ||
266 | ".previous\n\t" \ | ||
267 | : "=&r" (ret), "=&r" (x) : "m" (*__m(addr)), \ | ||
268 | "i" (-EFAULT)) | ||
269 | |||
270 | #define __get_user_asm_ret(x,size,addr,retval) \ | ||
271 | if (__builtin_constant_p(retval) && retval == -EFAULT) \ | ||
272 | __asm__ __volatile__( \ | ||
273 | "/* Get user asm ret, inline. */\n" \ | ||
274 | "1:\t" "ld"#size " %1, %0\n\n\t" \ | ||
275 | ".section __ex_table,#alloc\n\t" \ | ||
276 | ".align 4\n\t" \ | ||
277 | ".word 1b,__ret_efault\n\n\t" \ | ||
278 | ".previous\n\t" \ | ||
279 | : "=&r" (x) : "m" (*__m(addr))); \ | ||
280 | else \ | ||
281 | __asm__ __volatile__( \ | ||
282 | "/* Get user asm ret, inline. */\n" \ | ||
283 | "1:\t" "ld"#size " %1, %0\n\n\t" \ | ||
284 | ".section .fixup,#alloc,#execinstr\n\t" \ | ||
285 | ".align 4\n" \ | ||
286 | "3:\n\t" \ | ||
287 | "ret\n\t" \ | ||
288 | " restore %%g0, %2, %%o0\n\n\t" \ | ||
289 | ".previous\n\t" \ | ||
290 | ".section __ex_table,#alloc\n\t" \ | ||
291 | ".align 4\n\t" \ | ||
292 | ".word 1b, 3b\n\n\t" \ | ||
293 | ".previous\n\t" \ | ||
294 | : "=&r" (x) : "m" (*__m(addr)), "i" (retval)) | ||
295 | |||
296 | extern int __get_user_bad(void); | ||
297 | |||
298 | extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size); | ||
299 | |||
300 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) | ||
301 | { | ||
302 | if (n && __access_ok((unsigned long) to, n)) | ||
303 | return __copy_user(to, (__force void __user *) from, n); | ||
304 | else | ||
305 | return n; | ||
306 | } | ||
307 | |||
308 | static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) | ||
309 | { | ||
310 | return __copy_user(to, (__force void __user *) from, n); | ||
311 | } | ||
312 | |||
313 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) | ||
314 | { | ||
315 | if (n && __access_ok((unsigned long) from, n)) | ||
316 | return __copy_user((__force void __user *) to, from, n); | ||
317 | else | ||
318 | return n; | ||
319 | } | ||
320 | |||
321 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) | ||
322 | { | ||
323 | return __copy_user((__force void __user *) to, from, n); | ||
324 | } | ||
325 | |||
326 | #define __copy_to_user_inatomic __copy_to_user | ||
327 | #define __copy_from_user_inatomic __copy_from_user | ||
328 | |||
329 | static inline unsigned long __clear_user(void __user *addr, unsigned long size) | ||
330 | { | ||
331 | unsigned long ret; | ||
332 | |||
333 | __asm__ __volatile__ ( | ||
334 | ".section __ex_table,#alloc\n\t" | ||
335 | ".align 4\n\t" | ||
336 | ".word 1f,3\n\t" | ||
337 | ".previous\n\t" | ||
338 | "mov %2, %%o1\n" | ||
339 | "1:\n\t" | ||
340 | "call __bzero\n\t" | ||
341 | " mov %1, %%o0\n\t" | ||
342 | "mov %%o0, %0\n" | ||
343 | : "=r" (ret) : "r" (addr), "r" (size) : | ||
344 | "o0", "o1", "o2", "o3", "o4", "o5", "o7", | ||
345 | "g1", "g2", "g3", "g4", "g5", "g7", "cc"); | ||
346 | |||
347 | return ret; | ||
348 | } | ||
349 | |||
350 | static inline unsigned long clear_user(void __user *addr, unsigned long n) | ||
351 | { | ||
352 | if (n && __access_ok((unsigned long) addr, n)) | ||
353 | return __clear_user(addr, n); | ||
354 | else | ||
355 | return n; | ||
356 | } | ||
357 | |||
358 | extern long __strncpy_from_user(char *dest, const char __user *src, long count); | ||
359 | |||
360 | static inline long strncpy_from_user(char *dest, const char __user *src, long count) | ||
361 | { | ||
362 | if (__access_ok((unsigned long) src, count)) | ||
363 | return __strncpy_from_user(dest, src, count); | ||
364 | else | ||
365 | return -EFAULT; | ||
366 | } | ||
367 | |||
368 | extern long __strlen_user(const char __user *); | ||
369 | extern long __strnlen_user(const char __user *, long len); | ||
370 | |||
371 | static inline long strlen_user(const char __user *str) | ||
372 | { | ||
373 | if (!access_ok(VERIFY_READ, str, 0)) | ||
374 | return 0; | ||
375 | else | ||
376 | return __strlen_user(str); | ||
377 | } | ||
378 | |||
379 | static inline long strnlen_user(const char __user *str, long len) | ||
380 | { | ||
381 | if (!access_ok(VERIFY_READ, str, 0)) | ||
382 | return 0; | ||
383 | else | ||
384 | return __strnlen_user(str, len); | ||
385 | } | ||
386 | |||
387 | #endif /* __ASSEMBLY__ */ | ||
388 | |||
389 | #endif /* _ASM_UACCESS_H */ | ||
diff --git a/include/asm-sparc/unaligned.h b/include/asm-sparc/unaligned.h new file mode 100644 index 000000000000..b6f8eddd30af --- /dev/null +++ b/include/asm-sparc/unaligned.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SPARC_UNALIGNED_H_ | ||
2 | #define _ASM_SPARC_UNALIGNED_H_ | ||
3 | |||
4 | #include <asm-generic/unaligned.h> | ||
5 | |||
6 | #endif /* _ASM_SPARC_UNALIGNED_H */ | ||
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h new file mode 100644 index 000000000000..d1f63caaa326 --- /dev/null +++ b/include/asm-sparc/unistd.h | |||
@@ -0,0 +1,518 @@ | |||
1 | /* $Id: unistd.h,v 1.74 2002/02/08 03:57:18 davem Exp $ */ | ||
2 | #ifndef _SPARC_UNISTD_H | ||
3 | #define _SPARC_UNISTD_H | ||
4 | |||
5 | /* | ||
6 | * System calls under the Sparc. | ||
7 | * | ||
8 | * Don't be scared by the ugly clobbers, it is the only way I can | ||
9 | * think of right now to force the arguments into fixed registers | ||
10 | * before the trap into the system call with gcc 'asm' statements. | ||
11 | * | ||
12 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
13 | * | ||
14 | * SunOS compatibility based upon preliminary work which is: | ||
15 | * | ||
16 | * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) | ||
17 | */ | ||
18 | |||
19 | #define __NR_restart_syscall 0 /* Linux Specific */ | ||
20 | #define __NR_exit 1 /* Common */ | ||
21 | #define __NR_fork 2 /* Common */ | ||
22 | #define __NR_read 3 /* Common */ | ||
23 | #define __NR_write 4 /* Common */ | ||
24 | #define __NR_open 5 /* Common */ | ||
25 | #define __NR_close 6 /* Common */ | ||
26 | #define __NR_wait4 7 /* Common */ | ||
27 | #define __NR_creat 8 /* Common */ | ||
28 | #define __NR_link 9 /* Common */ | ||
29 | #define __NR_unlink 10 /* Common */ | ||
30 | #define __NR_execv 11 /* SunOS Specific */ | ||
31 | #define __NR_chdir 12 /* Common */ | ||
32 | #define __NR_chown 13 /* Common */ | ||
33 | #define __NR_mknod 14 /* Common */ | ||
34 | #define __NR_chmod 15 /* Common */ | ||
35 | #define __NR_lchown 16 /* Common */ | ||
36 | #define __NR_brk 17 /* Common */ | ||
37 | #define __NR_perfctr 18 /* Performance counter operations */ | ||
38 | #define __NR_lseek 19 /* Common */ | ||
39 | #define __NR_getpid 20 /* Common */ | ||
40 | #define __NR_capget 21 /* Linux Specific */ | ||
41 | #define __NR_capset 22 /* Linux Specific */ | ||
42 | #define __NR_setuid 23 /* Implemented via setreuid in SunOS */ | ||
43 | #define __NR_getuid 24 /* Common */ | ||
44 | /* #define __NR_time alias 25 ENOSYS under SunOS */ | ||
45 | #define __NR_ptrace 26 /* Common */ | ||
46 | #define __NR_alarm 27 /* Implemented via setitimer in SunOS */ | ||
47 | #define __NR_sigaltstack 28 /* Common */ | ||
48 | #define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */ | ||
49 | #define __NR_utime 30 /* Implemented via utimes() under SunOS */ | ||
50 | #define __NR_lchown32 31 /* Linux sparc32 specific */ | ||
51 | #define __NR_fchown32 32 /* Linux sparc32 specific */ | ||
52 | #define __NR_access 33 /* Common */ | ||
53 | #define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */ | ||
54 | #define __NR_chown32 35 /* Linux sparc32 specific */ | ||
55 | #define __NR_sync 36 /* Common */ | ||
56 | #define __NR_kill 37 /* Common */ | ||
57 | #define __NR_stat 38 /* Common */ | ||
58 | #define __NR_sendfile 39 /* Linux Specific */ | ||
59 | #define __NR_lstat 40 /* Common */ | ||
60 | #define __NR_dup 41 /* Common */ | ||
61 | #define __NR_pipe 42 /* Common */ | ||
62 | #define __NR_times 43 /* Implemented via getrusage() in SunOS */ | ||
63 | #define __NR_getuid32 44 /* Linux sparc32 specific */ | ||
64 | #define __NR_umount2 45 /* Linux Specific */ | ||
65 | #define __NR_setgid 46 /* Implemented via setregid() in SunOS */ | ||
66 | #define __NR_getgid 47 /* Common */ | ||
67 | #define __NR_signal 48 /* Implemented via sigvec() in SunOS */ | ||
68 | #define __NR_geteuid 49 /* SunOS calls getuid() */ | ||
69 | #define __NR_getegid 50 /* SunOS calls getgid() */ | ||
70 | #define __NR_acct 51 /* Common */ | ||
71 | /* #define __NR_memory_ordering 52 Linux sparc64 specific */ | ||
72 | #define __NR_getgid32 53 /* Linux sparc32 specific */ | ||
73 | #define __NR_ioctl 54 /* Common */ | ||
74 | #define __NR_reboot 55 /* Common */ | ||
75 | #define __NR_mmap2 56 /* Linux sparc32 Specific */ | ||
76 | #define __NR_symlink 57 /* Common */ | ||
77 | #define __NR_readlink 58 /* Common */ | ||
78 | #define __NR_execve 59 /* Common */ | ||
79 | #define __NR_umask 60 /* Common */ | ||
80 | #define __NR_chroot 61 /* Common */ | ||
81 | #define __NR_fstat 62 /* Common */ | ||
82 | #define __NR_fstat64 63 /* Linux sparc32 Specific */ | ||
83 | #define __NR_getpagesize 64 /* Common */ | ||
84 | #define __NR_msync 65 /* Common in newer 1.3.x revs... */ | ||
85 | #define __NR_vfork 66 /* Common */ | ||
86 | #define __NR_pread64 67 /* Linux Specific */ | ||
87 | #define __NR_pwrite64 68 /* Linux Specific */ | ||
88 | #define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */ | ||
89 | #define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */ | ||
90 | #define __NR_mmap 71 /* Common */ | ||
91 | #define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */ | ||
92 | #define __NR_munmap 73 /* Common */ | ||
93 | #define __NR_mprotect 74 /* Common */ | ||
94 | #define __NR_madvise 75 /* Common */ | ||
95 | #define __NR_vhangup 76 /* Common */ | ||
96 | #define __NR_truncate64 77 /* Linux sparc32 Specific */ | ||
97 | #define __NR_mincore 78 /* Common */ | ||
98 | #define __NR_getgroups 79 /* Common */ | ||
99 | #define __NR_setgroups 80 /* Common */ | ||
100 | #define __NR_getpgrp 81 /* Common */ | ||
101 | #define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */ | ||
102 | #define __NR_setitimer 83 /* Common */ | ||
103 | #define __NR_ftruncate64 84 /* Linux sparc32 Specific */ | ||
104 | #define __NR_swapon 85 /* Common */ | ||
105 | #define __NR_getitimer 86 /* Common */ | ||
106 | #define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */ | ||
107 | #define __NR_sethostname 88 /* Common */ | ||
108 | #define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */ | ||
109 | #define __NR_dup2 90 /* Common */ | ||
110 | #define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */ | ||
111 | #define __NR_fcntl 92 /* Common */ | ||
112 | #define __NR_select 93 /* Common */ | ||
113 | #define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */ | ||
114 | #define __NR_fsync 95 /* Common */ | ||
115 | #define __NR_setpriority 96 /* Common */ | ||
116 | #define __NR_socket 97 /* Common */ | ||
117 | #define __NR_connect 98 /* Common */ | ||
118 | #define __NR_accept 99 /* Common */ | ||
119 | #define __NR_getpriority 100 /* Common */ | ||
120 | #define __NR_rt_sigreturn 101 /* Linux Specific */ | ||
121 | #define __NR_rt_sigaction 102 /* Linux Specific */ | ||
122 | #define __NR_rt_sigprocmask 103 /* Linux Specific */ | ||
123 | #define __NR_rt_sigpending 104 /* Linux Specific */ | ||
124 | #define __NR_rt_sigtimedwait 105 /* Linux Specific */ | ||
125 | #define __NR_rt_sigqueueinfo 106 /* Linux Specific */ | ||
126 | #define __NR_rt_sigsuspend 107 /* Linux Specific */ | ||
127 | #define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */ | ||
128 | #define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */ | ||
129 | #define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */ | ||
130 | #define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */ | ||
131 | #define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */ | ||
132 | #define __NR_recvmsg 113 /* Common */ | ||
133 | #define __NR_sendmsg 114 /* Common */ | ||
134 | #define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */ | ||
135 | #define __NR_gettimeofday 116 /* Common */ | ||
136 | #define __NR_getrusage 117 /* Common */ | ||
137 | #define __NR_getsockopt 118 /* Common */ | ||
138 | #define __NR_getcwd 119 /* Linux Specific */ | ||
139 | #define __NR_readv 120 /* Common */ | ||
140 | #define __NR_writev 121 /* Common */ | ||
141 | #define __NR_settimeofday 122 /* Common */ | ||
142 | #define __NR_fchown 123 /* Common */ | ||
143 | #define __NR_fchmod 124 /* Common */ | ||
144 | #define __NR_recvfrom 125 /* Common */ | ||
145 | #define __NR_setreuid 126 /* Common */ | ||
146 | #define __NR_setregid 127 /* Common */ | ||
147 | #define __NR_rename 128 /* Common */ | ||
148 | #define __NR_truncate 129 /* Common */ | ||
149 | #define __NR_ftruncate 130 /* Common */ | ||
150 | #define __NR_flock 131 /* Common */ | ||
151 | #define __NR_lstat64 132 /* Linux sparc32 Specific */ | ||
152 | #define __NR_sendto 133 /* Common */ | ||
153 | #define __NR_shutdown 134 /* Common */ | ||
154 | #define __NR_socketpair 135 /* Common */ | ||
155 | #define __NR_mkdir 136 /* Common */ | ||
156 | #define __NR_rmdir 137 /* Common */ | ||
157 | #define __NR_utimes 138 /* SunOS Specific */ | ||
158 | #define __NR_stat64 139 /* Linux sparc32 Specific */ | ||
159 | #define __NR_sendfile64 140 /* adjtime under SunOS */ | ||
160 | #define __NR_getpeername 141 /* Common */ | ||
161 | #define __NR_futex 142 /* gethostid under SunOS */ | ||
162 | #define __NR_gettid 143 /* ENOSYS under SunOS */ | ||
163 | #define __NR_getrlimit 144 /* Common */ | ||
164 | #define __NR_setrlimit 145 /* Common */ | ||
165 | #define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */ | ||
166 | #define __NR_prctl 147 /* ENOSYS under SunOS */ | ||
167 | #define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ | ||
168 | #define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ | ||
169 | #define __NR_getsockname 150 /* Common */ | ||
170 | /* #define __NR_getmsg 151 SunOS Specific */ | ||
171 | /* #define __NR_putmsg 152 SunOS Specific */ | ||
172 | #define __NR_poll 153 /* Common */ | ||
173 | #define __NR_getdents64 154 /* Linux specific */ | ||
174 | #define __NR_fcntl64 155 /* Linux sparc32 Specific */ | ||
175 | /* #define __NR_getdirentires 156 SunOS Specific */ | ||
176 | #define __NR_statfs 157 /* Common */ | ||
177 | #define __NR_fstatfs 158 /* Common */ | ||
178 | #define __NR_umount 159 /* Common */ | ||
179 | #define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */ | ||
180 | #define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */ | ||
181 | #define __NR_getdomainname 162 /* SunOS Specific */ | ||
182 | #define __NR_setdomainname 163 /* Common */ | ||
183 | /* #define __NR_ni_syscall 164 ENOSYS under SunOS */ | ||
184 | #define __NR_quotactl 165 /* Common */ | ||
185 | #define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */ | ||
186 | #define __NR_mount 167 /* Common */ | ||
187 | #define __NR_ustat 168 /* Common */ | ||
188 | #define __NR_setxattr 169 /* SunOS: semsys */ | ||
189 | #define __NR_lsetxattr 170 /* SunOS: msgsys */ | ||
190 | #define __NR_fsetxattr 171 /* SunOS: shmsys */ | ||
191 | #define __NR_getxattr 172 /* SunOS: auditsys */ | ||
192 | #define __NR_lgetxattr 173 /* SunOS: rfssys */ | ||
193 | #define __NR_getdents 174 /* Common */ | ||
194 | #define __NR_setsid 175 /* Common */ | ||
195 | #define __NR_fchdir 176 /* Common */ | ||
196 | #define __NR_fgetxattr 177 /* SunOS: fchroot */ | ||
197 | #define __NR_listxattr 178 /* SunOS: vpixsys */ | ||
198 | #define __NR_llistxattr 179 /* SunOS: aioread */ | ||
199 | #define __NR_flistxattr 180 /* SunOS: aiowrite */ | ||
200 | #define __NR_removexattr 181 /* SunOS: aiowait */ | ||
201 | #define __NR_lremovexattr 182 /* SunOS: aiocancel */ | ||
202 | #define __NR_sigpending 183 /* Common */ | ||
203 | #define __NR_query_module 184 /* Linux Specific */ | ||
204 | #define __NR_setpgid 185 /* Common */ | ||
205 | #define __NR_fremovexattr 186 /* SunOS: pathconf */ | ||
206 | #define __NR_tkill 187 /* SunOS: fpathconf */ | ||
207 | #define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */ | ||
208 | #define __NR_uname 189 /* Linux Specific */ | ||
209 | #define __NR_init_module 190 /* Linux Specific */ | ||
210 | #define __NR_personality 191 /* Linux Specific */ | ||
211 | #define __NR_remap_file_pages 192 /* Linux Specific */ | ||
212 | #define __NR_epoll_create 193 /* Linux Specific */ | ||
213 | #define __NR_epoll_ctl 194 /* Linux Specific */ | ||
214 | #define __NR_epoll_wait 195 /* Linux Specific */ | ||
215 | /* #define __NR_ulimit 196 Linux Specific */ | ||
216 | #define __NR_getppid 197 /* Linux Specific */ | ||
217 | #define __NR_sigaction 198 /* Linux Specific */ | ||
218 | #define __NR_sgetmask 199 /* Linux Specific */ | ||
219 | #define __NR_ssetmask 200 /* Linux Specific */ | ||
220 | #define __NR_sigsuspend 201 /* Linux Specific */ | ||
221 | #define __NR_oldlstat 202 /* Linux Specific */ | ||
222 | #define __NR_uselib 203 /* Linux Specific */ | ||
223 | #define __NR_readdir 204 /* Linux Specific */ | ||
224 | #define __NR_readahead 205 /* Linux Specific */ | ||
225 | #define __NR_socketcall 206 /* Linux Specific */ | ||
226 | #define __NR_syslog 207 /* Linux Specific */ | ||
227 | #define __NR_lookup_dcookie 208 /* Linux Specific */ | ||
228 | #define __NR_fadvise64 209 /* Linux Specific */ | ||
229 | #define __NR_fadvise64_64 210 /* Linux Specific */ | ||
230 | #define __NR_tgkill 211 /* Linux Specific */ | ||
231 | #define __NR_waitpid 212 /* Linux Specific */ | ||
232 | #define __NR_swapoff 213 /* Linux Specific */ | ||
233 | #define __NR_sysinfo 214 /* Linux Specific */ | ||
234 | #define __NR_ipc 215 /* Linux Specific */ | ||
235 | #define __NR_sigreturn 216 /* Linux Specific */ | ||
236 | #define __NR_clone 217 /* Linux Specific */ | ||
237 | /* #define __NR_modify_ldt 218 Linux Specific - i386 specific, unused */ | ||
238 | #define __NR_adjtimex 219 /* Linux Specific */ | ||
239 | #define __NR_sigprocmask 220 /* Linux Specific */ | ||
240 | #define __NR_create_module 221 /* Linux Specific */ | ||
241 | #define __NR_delete_module 222 /* Linux Specific */ | ||
242 | #define __NR_get_kernel_syms 223 /* Linux Specific */ | ||
243 | #define __NR_getpgid 224 /* Linux Specific */ | ||
244 | #define __NR_bdflush 225 /* Linux Specific */ | ||
245 | #define __NR_sysfs 226 /* Linux Specific */ | ||
246 | #define __NR_afs_syscall 227 /* Linux Specific */ | ||
247 | #define __NR_setfsuid 228 /* Linux Specific */ | ||
248 | #define __NR_setfsgid 229 /* Linux Specific */ | ||
249 | #define __NR__newselect 230 /* Linux Specific */ | ||
250 | #define __NR_time 231 /* Linux Specific */ | ||
251 | /* #define __NR_oldstat 232 Linux Specific */ | ||
252 | #define __NR_stime 233 /* Linux Specific */ | ||
253 | #define __NR_statfs64 234 /* Linux Specific */ | ||
254 | #define __NR_fstatfs64 235 /* Linux Specific */ | ||
255 | #define __NR__llseek 236 /* Linux Specific */ | ||
256 | #define __NR_mlock 237 | ||
257 | #define __NR_munlock 238 | ||
258 | #define __NR_mlockall 239 | ||
259 | #define __NR_munlockall 240 | ||
260 | #define __NR_sched_setparam 241 | ||
261 | #define __NR_sched_getparam 242 | ||
262 | #define __NR_sched_setscheduler 243 | ||
263 | #define __NR_sched_getscheduler 244 | ||
264 | #define __NR_sched_yield 245 | ||
265 | #define __NR_sched_get_priority_max 246 | ||
266 | #define __NR_sched_get_priority_min 247 | ||
267 | #define __NR_sched_rr_get_interval 248 | ||
268 | #define __NR_nanosleep 249 | ||
269 | #define __NR_mremap 250 | ||
270 | #define __NR__sysctl 251 | ||
271 | #define __NR_getsid 252 | ||
272 | #define __NR_fdatasync 253 | ||
273 | #define __NR_nfsservctl 254 | ||
274 | #define __NR_aplib 255 | ||
275 | #define __NR_clock_settime 256 | ||
276 | #define __NR_clock_gettime 257 | ||
277 | #define __NR_clock_getres 258 | ||
278 | #define __NR_clock_nanosleep 259 | ||
279 | #define __NR_sched_getaffinity 260 | ||
280 | #define __NR_sched_setaffinity 261 | ||
281 | #define __NR_timer_settime 262 | ||
282 | #define __NR_timer_gettime 263 | ||
283 | #define __NR_timer_getoverrun 264 | ||
284 | #define __NR_timer_delete 265 | ||
285 | #define __NR_timer_create 266 | ||
286 | /* #define __NR_vserver 267 Reserved for VSERVER */ | ||
287 | #define __NR_io_setup 268 | ||
288 | #define __NR_io_destroy 269 | ||
289 | #define __NR_io_submit 270 | ||
290 | #define __NR_io_cancel 271 | ||
291 | #define __NR_io_getevents 272 | ||
292 | #define __NR_mq_open 273 | ||
293 | #define __NR_mq_unlink 274 | ||
294 | #define __NR_mq_timedsend 275 | ||
295 | #define __NR_mq_timedreceive 276 | ||
296 | #define __NR_mq_notify 277 | ||
297 | #define __NR_mq_getsetattr 278 | ||
298 | #define __NR_waitid 279 | ||
299 | #define __NR_sys_setaltroot 280 | ||
300 | #define __NR_add_key 281 | ||
301 | #define __NR_request_key 282 | ||
302 | #define __NR_keyctl 283 | ||
303 | |||
304 | /* WARNING: You MAY NOT add syscall numbers larger than 283, since | ||
305 | * all of the syscall tables in the Sparc kernel are | ||
306 | * sized to have 283 entries (starting at zero). Therefore | ||
307 | * find a free slot in the 0-282 range. | ||
308 | */ | ||
309 | |||
310 | #define _syscall0(type,name) \ | ||
311 | type name(void) \ | ||
312 | { \ | ||
313 | long __res; \ | ||
314 | register long __g1 __asm__ ("g1") = __NR_##name; \ | ||
315 | __asm__ __volatile__ ("t 0x10\n\t" \ | ||
316 | "bcc 1f\n\t" \ | ||
317 | "mov %%o0, %0\n\t" \ | ||
318 | "sub %%g0, %%o0, %0\n\t" \ | ||
319 | "1:\n\t" \ | ||
320 | : "=r" (__res)\ | ||
321 | : "r" (__g1) \ | ||
322 | : "o0", "cc"); \ | ||
323 | if (__res < -255 || __res >= 0) \ | ||
324 | return (type) __res; \ | ||
325 | errno = -__res; \ | ||
326 | return -1; \ | ||
327 | } | ||
328 | |||
329 | #define _syscall1(type,name,type1,arg1) \ | ||
330 | type name(type1 arg1) \ | ||
331 | { \ | ||
332 | long __res; \ | ||
333 | register long __g1 __asm__ ("g1") = __NR_##name; \ | ||
334 | register long __o0 __asm__ ("o0") = (long)(arg1); \ | ||
335 | __asm__ __volatile__ ("t 0x10\n\t" \ | ||
336 | "bcc 1f\n\t" \ | ||
337 | "mov %%o0, %0\n\t" \ | ||
338 | "sub %%g0, %%o0, %0\n\t" \ | ||
339 | "1:\n\t" \ | ||
340 | : "=r" (__res), "=&r" (__o0) \ | ||
341 | : "1" (__o0), "r" (__g1) \ | ||
342 | : "cc"); \ | ||
343 | if (__res < -255 || __res >= 0) \ | ||
344 | return (type) __res; \ | ||
345 | errno = -__res; \ | ||
346 | return -1; \ | ||
347 | } | ||
348 | |||
349 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ | ||
350 | type name(type1 arg1,type2 arg2) \ | ||
351 | { \ | ||
352 | long __res; \ | ||
353 | register long __g1 __asm__ ("g1") = __NR_##name; \ | ||
354 | register long __o0 __asm__ ("o0") = (long)(arg1); \ | ||
355 | register long __o1 __asm__ ("o1") = (long)(arg2); \ | ||
356 | __asm__ __volatile__ ("t 0x10\n\t" \ | ||
357 | "bcc 1f\n\t" \ | ||
358 | "mov %%o0, %0\n\t" \ | ||
359 | "sub %%g0, %%o0, %0\n\t" \ | ||
360 | "1:\n\t" \ | ||
361 | : "=r" (__res), "=&r" (__o0) \ | ||
362 | : "1" (__o0), "r" (__o1), "r" (__g1) \ | ||
363 | : "cc"); \ | ||
364 | if (__res < -255 || __res >= 0) \ | ||
365 | return (type) __res; \ | ||
366 | errno = -__res; \ | ||
367 | return -1; \ | ||
368 | } | ||
369 | |||
370 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ | ||
371 | type name(type1 arg1,type2 arg2,type3 arg3) \ | ||
372 | { \ | ||
373 | long __res; \ | ||
374 | register long __g1 __asm__ ("g1") = __NR_##name; \ | ||
375 | register long __o0 __asm__ ("o0") = (long)(arg1); \ | ||
376 | register long __o1 __asm__ ("o1") = (long)(arg2); \ | ||
377 | register long __o2 __asm__ ("o2") = (long)(arg3); \ | ||
378 | __asm__ __volatile__ ("t 0x10\n\t" \ | ||
379 | "bcc 1f\n\t" \ | ||
380 | "mov %%o0, %0\n\t" \ | ||
381 | "sub %%g0, %%o0, %0\n\t" \ | ||
382 | "1:\n\t" \ | ||
383 | : "=r" (__res), "=&r" (__o0) \ | ||
384 | : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ | ||
385 | : "cc"); \ | ||
386 | if (__res < -255 || __res>=0) \ | ||
387 | return (type) __res; \ | ||
388 | errno = -__res; \ | ||
389 | return -1; \ | ||
390 | } | ||
391 | |||
392 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ | ||
393 | type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ | ||
394 | { \ | ||
395 | long __res; \ | ||
396 | register long __g1 __asm__ ("g1") = __NR_##name; \ | ||
397 | register long __o0 __asm__ ("o0") = (long)(arg1); \ | ||
398 | register long __o1 __asm__ ("o1") = (long)(arg2); \ | ||
399 | register long __o2 __asm__ ("o2") = (long)(arg3); \ | ||
400 | register long __o3 __asm__ ("o3") = (long)(arg4); \ | ||
401 | __asm__ __volatile__ ("t 0x10\n\t" \ | ||
402 | "bcc 1f\n\t" \ | ||
403 | "mov %%o0, %0\n\t" \ | ||
404 | "sub %%g0, %%o0, %0\n\t" \ | ||
405 | "1:\n\t" \ | ||
406 | : "=r" (__res), "=&r" (__o0) \ | ||
407 | : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ | ||
408 | : "cc"); \ | ||
409 | if (__res < -255 || __res>=0) \ | ||
410 | return (type) __res; \ | ||
411 | errno = -__res; \ | ||
412 | return -1; \ | ||
413 | } | ||
414 | |||
415 | #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ | ||
416 | type5,arg5) \ | ||
417 | type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ | ||
418 | { \ | ||
419 | long __res; \ | ||
420 | register long __g1 __asm__ ("g1") = __NR_##name; \ | ||
421 | register long __o0 __asm__ ("o0") = (long)(arg1); \ | ||
422 | register long __o1 __asm__ ("o1") = (long)(arg2); \ | ||
423 | register long __o2 __asm__ ("o2") = (long)(arg3); \ | ||
424 | register long __o3 __asm__ ("o3") = (long)(arg4); \ | ||
425 | register long __o4 __asm__ ("o4") = (long)(arg5); \ | ||
426 | __asm__ __volatile__ ("t 0x10\n\t" \ | ||
427 | "bcc 1f\n\t" \ | ||
428 | "mov %%o0, %0\n\t" \ | ||
429 | "sub %%g0, %%o0, %0\n\t" \ | ||
430 | "1:\n\t" \ | ||
431 | : "=r" (__res), "=&r" (__o0) \ | ||
432 | : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \ | ||
433 | : "cc"); \ | ||
434 | if (__res < -255 || __res>=0) \ | ||
435 | return (type) __res; \ | ||
436 | errno = -__res; \ | ||
437 | return -1; \ | ||
438 | } | ||
439 | |||
440 | #ifdef __KERNEL__ | ||
441 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
442 | #define __ARCH_WANT_OLD_READDIR | ||
443 | #define __ARCH_WANT_STAT64 | ||
444 | #define __ARCH_WANT_SYS_ALARM | ||
445 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
446 | #define __ARCH_WANT_SYS_PAUSE | ||
447 | #define __ARCH_WANT_SYS_SGETMASK | ||
448 | #define __ARCH_WANT_SYS_SIGNAL | ||
449 | #define __ARCH_WANT_SYS_TIME | ||
450 | #define __ARCH_WANT_SYS_UTIME | ||
451 | #define __ARCH_WANT_SYS_WAITPID | ||
452 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
453 | #define __ARCH_WANT_SYS_FADVISE64 | ||
454 | #define __ARCH_WANT_SYS_GETPGRP | ||
455 | #define __ARCH_WANT_SYS_LLSEEK | ||
456 | #define __ARCH_WANT_SYS_NICE | ||
457 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
458 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
459 | #define __ARCH_WANT_SYS_SIGPENDING | ||
460 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
461 | #endif | ||
462 | |||
463 | #ifdef __KERNEL_SYSCALLS__ | ||
464 | |||
465 | #include <linux/compiler.h> | ||
466 | #include <linux/types.h> | ||
467 | |||
468 | /* | ||
469 | * we need this inline - forking from kernel space will result | ||
470 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
471 | * is no problem, but for the stack. This is handled by not letting | ||
472 | * main() use the stack at all after fork(). Thus, no function | ||
473 | * calls - which means inline code for fork too, as otherwise we | ||
474 | * would use the stack upon exit from 'fork()'. | ||
475 | * | ||
476 | * Actually only pause and fork are needed inline, so that there | ||
477 | * won't be any messing with the stack from main(), but we define | ||
478 | * some others too. | ||
479 | */ | ||
480 | #define __NR__exit __NR_exit | ||
481 | static __inline__ _syscall0(pid_t,setsid) | ||
482 | static __inline__ _syscall3(int,write,int,fd,__const__ char *,buf,off_t,count) | ||
483 | static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) | ||
484 | static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) | ||
485 | static __inline__ _syscall1(int,dup,int,fd) | ||
486 | static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp) | ||
487 | static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode) | ||
488 | static __inline__ _syscall1(int,close,int,fd) | ||
489 | static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) | ||
490 | |||
491 | #include <linux/linkage.h> | ||
492 | |||
493 | asmlinkage unsigned long sys_mmap( | ||
494 | unsigned long addr, unsigned long len, | ||
495 | unsigned long prot, unsigned long flags, | ||
496 | unsigned long fd, unsigned long off); | ||
497 | asmlinkage unsigned long sys_mmap2( | ||
498 | unsigned long addr, unsigned long len, | ||
499 | unsigned long prot, unsigned long flags, | ||
500 | unsigned long fd, unsigned long pgoff); | ||
501 | struct sigaction; | ||
502 | asmlinkage long sys_rt_sigaction(int sig, | ||
503 | const struct sigaction __user *act, | ||
504 | struct sigaction __user *oact, | ||
505 | void __user *restorer, | ||
506 | size_t sigsetsize); | ||
507 | |||
508 | #endif /* __KERNEL_SYSCALLS__ */ | ||
509 | |||
510 | /* | ||
511 | * "Conditional" syscalls | ||
512 | * | ||
513 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
514 | * but it doesn't work on all toolchains, so we just do it by hand | ||
515 | */ | ||
516 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | ||
517 | |||
518 | #endif /* _SPARC_UNISTD_H */ | ||
diff --git a/include/asm-sparc/user.h b/include/asm-sparc/user.h new file mode 100644 index 000000000000..b5f1abf733d5 --- /dev/null +++ b/include/asm-sparc/user.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* $Id: user.h,v 1.5 1998/02/23 01:49:22 rth Exp $ | ||
2 | * asm-sparc/user.h: Core file definitions for the Sparc. | ||
3 | * | ||
4 | * Keep in sync with reg.h. Actually, we could get rid of this | ||
5 | * one, since we won't a.out core dump that much anyways - miguel. | ||
6 | * Copyright (C) 1995 (davem@caip.rutgers.edu) | ||
7 | */ | ||
8 | #ifndef _SPARC_USER_H | ||
9 | #define _SPARC_USER_H | ||
10 | |||
11 | #include <asm/a.out.h> | ||
12 | struct sunos_regs { | ||
13 | unsigned long psr, pc, npc, y; | ||
14 | unsigned long regs[15]; | ||
15 | }; | ||
16 | |||
17 | struct sunos_fpqueue { | ||
18 | unsigned long *addr; | ||
19 | unsigned long inst; | ||
20 | }; | ||
21 | |||
22 | struct sunos_fp { | ||
23 | union { | ||
24 | unsigned long regs[32]; | ||
25 | double reg_dbls[16]; | ||
26 | } fregs; | ||
27 | unsigned long fsr; | ||
28 | unsigned long flags; | ||
29 | unsigned long extra; | ||
30 | unsigned long fpq_count; | ||
31 | struct sunos_fpqueue fpq[16]; | ||
32 | }; | ||
33 | |||
34 | struct sunos_fpu { | ||
35 | struct sunos_fp fpstatus; | ||
36 | }; | ||
37 | |||
38 | /* The SunOS core file header layout. */ | ||
39 | struct user { | ||
40 | unsigned long magic; | ||
41 | unsigned long len; | ||
42 | struct sunos_regs regs; | ||
43 | struct exec uexec; | ||
44 | int signal; | ||
45 | size_t u_tsize; /* all of these in bytes! */ | ||
46 | size_t u_dsize; | ||
47 | size_t u_ssize; | ||
48 | char u_comm[17]; | ||
49 | struct sunos_fpu fpu; | ||
50 | unsigned long sigcode; /* Special sigcontext subcode, if any */ | ||
51 | }; | ||
52 | |||
53 | #define NBPG 0x2000 | ||
54 | #define UPAGES 1 | ||
55 | #define HOST_TEXT_START_ADDR (u.start_code) | ||
56 | #define HOST_DATA_START_ADDR (u.uexec.a_data) | ||
57 | #define HOST_STACK_END_ADDR (- u.u_ssize * NBPG) | ||
58 | #define SUNOS_CORE_MAGIC 0x080456 | ||
59 | |||
60 | #endif /* !(_SPARC_USER_H) */ | ||
diff --git a/include/asm-sparc/vac-ops.h b/include/asm-sparc/vac-ops.h new file mode 100644 index 000000000000..9e0172323042 --- /dev/null +++ b/include/asm-sparc/vac-ops.h | |||
@@ -0,0 +1,136 @@ | |||
1 | /* $Id: vac-ops.h,v 1.13 1998/01/30 10:59:59 jj Exp $ */ | ||
2 | #ifndef _SPARC_VAC_OPS_H | ||
3 | #define _SPARC_VAC_OPS_H | ||
4 | |||
5 | /* vac-ops.h: Inline assembly routines to do operations on the Sparc | ||
6 | * VAC (virtual address cache) for the sun4c. | ||
7 | * | ||
8 | * Copyright (C) 1994, David S. Miller (davem@caip.rutgers.edu) | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <asm/sysen.h> | ||
13 | #include <asm/contregs.h> | ||
14 | #include <asm/asi.h> | ||
15 | |||
16 | /* The SUN4C models have a virtually addressed write-through | ||
17 | * cache. | ||
18 | * | ||
19 | * The cache tags are directly accessible through an ASI and | ||
20 | * each have the form: | ||
21 | * | ||
22 | * ------------------------------------------------------------ | ||
23 | * | MBZ | CONTEXT | WRITE | PRIV | VALID | MBZ | TagID | MBZ | | ||
24 | * ------------------------------------------------------------ | ||
25 | * 31 25 24 22 21 20 19 18 16 15 2 1 0 | ||
26 | * | ||
27 | * MBZ: These bits are either unused and/or reserved and should | ||
28 | * be written as zeroes. | ||
29 | * | ||
30 | * CONTEXT: Records the context to which this cache line belongs. | ||
31 | * | ||
32 | * WRITE: A copy of the writable bit from the mmu pte access bits. | ||
33 | * | ||
34 | * PRIV: A copy of the privileged bit from the pte access bits. | ||
35 | * | ||
36 | * VALID: If set, this line is valid, else invalid. | ||
37 | * | ||
38 | * TagID: Fourteen bits of tag ID. | ||
39 | * | ||
40 | * Every virtual address is seen by the cache like this: | ||
41 | * | ||
42 | * ---------------------------------------- | ||
43 | * | RESV | TagID | LINE | BYTE-in-LINE | | ||
44 | * ---------------------------------------- | ||
45 | * 31 30 29 16 15 4 3 0 | ||
46 | * | ||
47 | * RESV: Unused/reserved. | ||
48 | * | ||
49 | * TagID: Used to match the Tag-ID in that vac tags. | ||
50 | * | ||
51 | * LINE: Which line within the cache | ||
52 | * | ||
53 | * BYTE-in-LINE: Which byte within the cache line. | ||
54 | */ | ||
55 | |||
56 | /* Sun4c VAC Tags */ | ||
57 | #define S4CVACTAG_CID 0x01c00000 | ||
58 | #define S4CVACTAG_W 0x00200000 | ||
59 | #define S4CVACTAG_P 0x00100000 | ||
60 | #define S4CVACTAG_V 0x00080000 | ||
61 | #define S4CVACTAG_TID 0x0000fffc | ||
62 | |||
63 | /* Sun4c VAC Virtual Address */ | ||
64 | /* These aren't used, why bother? (Anton) */ | ||
65 | #if 0 | ||
66 | #define S4CVACVA_TID 0x3fff0000 | ||
67 | #define S4CVACVA_LINE 0x0000fff0 | ||
68 | #define S4CVACVA_BIL 0x0000000f | ||
69 | #endif | ||
70 | |||
71 | /* The indexing of cache lines creates a problem. Because the line | ||
72 | * field of a virtual address extends past the page offset within | ||
73 | * the virtual address it is possible to have what are called | ||
74 | * 'bad aliases' which will create inconsistencies. So we must make | ||
75 | * sure that within a context that if a physical page is mapped | ||
76 | * more than once, that 'extra' line bits are the same. If this is | ||
77 | * not the case, and thus is a 'bad alias' we must turn off the | ||
78 | * cacheable bit in the pte's of all such pages. | ||
79 | */ | ||
80 | |||
81 | #ifdef CONFIG_SUN4 | ||
82 | #define S4CVAC_BADBITS 0x0001e000 | ||
83 | #else | ||
84 | #define S4CVAC_BADBITS 0x0000f000 | ||
85 | #endif | ||
86 | |||
87 | /* The following is true if vaddr1 and vaddr2 would cause | ||
88 | * a 'bad alias'. | ||
89 | */ | ||
90 | #define S4CVAC_BADALIAS(vaddr1, vaddr2) \ | ||
91 | ((((unsigned long) (vaddr1)) ^ ((unsigned long) (vaddr2))) & \ | ||
92 | (S4CVAC_BADBITS)) | ||
93 | |||
94 | /* The following structure describes the characteristics of a sun4c | ||
95 | * VAC as probed from the prom during boot time. | ||
96 | */ | ||
97 | struct sun4c_vac_props { | ||
98 | unsigned int num_bytes; /* Size of the cache */ | ||
99 | unsigned int num_lines; /* Number of cache lines */ | ||
100 | unsigned int do_hwflushes; /* Hardware flushing available? */ | ||
101 | enum { VAC_NONE, VAC_WRITE_THROUGH, | ||
102 | VAC_WRITE_BACK } type; /* What type of VAC? */ | ||
103 | unsigned int linesize; /* Size of each line in bytes */ | ||
104 | unsigned int log2lsize; /* log2(linesize) */ | ||
105 | unsigned int on; /* VAC is enabled */ | ||
106 | }; | ||
107 | |||
108 | extern struct sun4c_vac_props sun4c_vacinfo; | ||
109 | |||
110 | /* sun4c_enable_vac() enables the sun4c virtual address cache. */ | ||
111 | static inline void sun4c_enable_vac(void) | ||
112 | { | ||
113 | __asm__ __volatile__("lduba [%0] %1, %%g1\n\t" | ||
114 | "or %%g1, %2, %%g1\n\t" | ||
115 | "stba %%g1, [%0] %1\n\t" | ||
116 | : /* no outputs */ | ||
117 | : "r" ((unsigned int) AC_SENABLE), | ||
118 | "i" (ASI_CONTROL), "i" (SENABLE_CACHE) | ||
119 | : "g1", "memory"); | ||
120 | sun4c_vacinfo.on = 1; | ||
121 | } | ||
122 | |||
123 | /* sun4c_disable_vac() disables the virtual address cache. */ | ||
124 | static inline void sun4c_disable_vac(void) | ||
125 | { | ||
126 | __asm__ __volatile__("lduba [%0] %1, %%g1\n\t" | ||
127 | "andn %%g1, %2, %%g1\n\t" | ||
128 | "stba %%g1, [%0] %1\n\t" | ||
129 | : /* no outputs */ | ||
130 | : "r" ((unsigned int) AC_SENABLE), | ||
131 | "i" (ASI_CONTROL), "i" (SENABLE_CACHE) | ||
132 | : "g1", "memory"); | ||
133 | sun4c_vacinfo.on = 0; | ||
134 | } | ||
135 | |||
136 | #endif /* !(_SPARC_VAC_OPS_H) */ | ||
diff --git a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h new file mode 100644 index 000000000000..91097392c8cc --- /dev/null +++ b/include/asm-sparc/vaddrs.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* $Id: vaddrs.h,v 1.27 2001/07/04 00:18:18 davem Exp $ */ | ||
2 | #ifndef _SPARC_VADDRS_H | ||
3 | #define _SPARC_VADDRS_H | ||
4 | |||
5 | #include <asm/head.h> | ||
6 | |||
7 | /* | ||
8 | * asm-sparc/vaddrs.h: Here we define the virtual addresses at | ||
9 | * which important things will be mapped. | ||
10 | * | ||
11 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
12 | * Copyright (C) 2000 Anton Blanchard (anton@samba.org) | ||
13 | */ | ||
14 | |||
15 | #define SRMMU_MAXMEM 0x0c000000 | ||
16 | |||
17 | #define SRMMU_NOCACHE_VADDR (KERNBASE + SRMMU_MAXMEM) | ||
18 | /* = 0x0fc000000 */ | ||
19 | /* XXX Empiricals - this needs to go away - KMW */ | ||
20 | #define SRMMU_MIN_NOCACHE_PAGES (550) | ||
21 | #define SRMMU_MAX_NOCACHE_PAGES (1280) | ||
22 | |||
23 | /* The following constant is used in mm/srmmu.c::srmmu_nocache_calcsize() | ||
24 | * to determine the amount of memory that will be reserved as nocache: | ||
25 | * | ||
26 | * 256 pages will be taken as nocache per each | ||
27 | * SRMMU_NOCACHE_ALCRATIO MB of system memory. | ||
28 | * | ||
29 | * limits enforced: nocache minimum = 256 pages | ||
30 | * nocache maximum = 1280 pages | ||
31 | */ | ||
32 | #define SRMMU_NOCACHE_ALCRATIO 64 /* 256 pages per 64MB of system RAM */ | ||
33 | |||
34 | #define SUN4M_IOBASE_VADDR 0xfd000000 /* Base for mapping pages */ | ||
35 | #define IOBASE_VADDR 0xfe000000 | ||
36 | #define IOBASE_END 0xfe600000 | ||
37 | |||
38 | #define VMALLOC_START 0xfe600000 | ||
39 | |||
40 | /* XXX Alter this when I get around to fixing sun4c - Anton */ | ||
41 | #define VMALLOC_END 0xffc00000 | ||
42 | |||
43 | /* | ||
44 | * On the sun4/4c we need a place | ||
45 | * to reliably map locked down kernel data. This includes the | ||
46 | * task_struct and kernel stack pages of each process plus the | ||
47 | * scsi buffers during dvma IO transfers, also the floppy buffers | ||
48 | * during pseudo dma which runs with traps off (no faults allowed). | ||
49 | * Some quick calculations yield: | ||
50 | * NR_TASKS <512> * (3 * PAGE_SIZE) == 0x600000 | ||
51 | * Subtract this from 0xc00000 and you get 0x927C0 of vm left | ||
52 | * over to map SCSI dvma + floppy pseudo-dma buffers. So be | ||
53 | * careful if you change NR_TASKS or else there won't be enough | ||
54 | * room for it all. | ||
55 | */ | ||
56 | #define SUN4C_LOCK_VADDR 0xff000000 | ||
57 | #define SUN4C_LOCK_END 0xffc00000 | ||
58 | |||
59 | #define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */ | ||
60 | #define KADB_DEBUGGER_ENDVM 0xffd00000 | ||
61 | #define DEBUG_FIRSTVADDR KADB_DEBUGGER_BEGVM | ||
62 | #define DEBUG_LASTVADDR KADB_DEBUGGER_ENDVM | ||
63 | |||
64 | #define LINUX_OPPROM_BEGVM 0xffd00000 | ||
65 | #define LINUX_OPPROM_ENDVM 0xfff00000 | ||
66 | |||
67 | #define DVMA_VADDR 0xfff00000 /* Base area of the DVMA on suns */ | ||
68 | #define DVMA_END 0xfffc0000 | ||
69 | |||
70 | #endif /* !(_SPARC_VADDRS_H) */ | ||
diff --git a/include/asm-sparc/vfc_ioctls.h b/include/asm-sparc/vfc_ioctls.h new file mode 100644 index 000000000000..af8b69007b22 --- /dev/null +++ b/include/asm-sparc/vfc_ioctls.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* Copyright (c) 1996 by Manish Vachharajani */ | ||
2 | |||
3 | #ifndef _LINUX_VFC_IOCTLS_H_ | ||
4 | #define _LINUX_VFC_IOCTLS_H_ | ||
5 | |||
6 | /* IOCTLs */ | ||
7 | #define VFC_IOCTL(a) (('j' << 8) | a) | ||
8 | #define VFCGCTRL (VFC_IOCTL (0)) /* get vfc attributes */ | ||
9 | #define VFCSCTRL (VFC_IOCTL (1)) /* set vfc attributes */ | ||
10 | #define VFCGVID (VFC_IOCTL (2)) /* get video decoder attributes */ | ||
11 | #define VFCSVID (VFC_IOCTL (3)) /* set video decoder attributes */ | ||
12 | #define VFCHUE (VFC_IOCTL (4)) /* set hue */ | ||
13 | #define VFCPORTCHG (VFC_IOCTL (5)) /* change port */ | ||
14 | #define VFCRDINFO (VFC_IOCTL (6)) /* read info */ | ||
15 | |||
16 | /* Options for setting the vfc attributes and status */ | ||
17 | #define MEMPRST 0x1 /* reset FIFO ptr. */ | ||
18 | #define CAPTRCMD 0x2 /* start capture and wait */ | ||
19 | #define DIAGMODE 0x3 /* diag mode */ | ||
20 | #define NORMMODE 0x4 /* normal mode */ | ||
21 | #define CAPTRSTR 0x5 /* start capture */ | ||
22 | #define CAPTRWAIT 0x6 /* wait for capture to finish */ | ||
23 | |||
24 | |||
25 | /* Options for the decoder */ | ||
26 | #define STD_NTSC 0x1 /* NTSC mode */ | ||
27 | #define STD_PAL 0x2 /* PAL mode */ | ||
28 | #define COLOR_ON 0x3 /* force color ON */ | ||
29 | #define MONO 0x4 /* force color OFF */ | ||
30 | |||
31 | /* Values returned by ioctl 2 */ | ||
32 | |||
33 | #define NO_LOCK 1 | ||
34 | #define NTSC_COLOR 2 | ||
35 | #define NTSC_NOCOLOR 3 | ||
36 | #define PAL_COLOR 4 | ||
37 | #define PAL_NOCOLOR 5 | ||
38 | |||
39 | /* Not too sure what this does yet */ | ||
40 | /* Options for setting Field number */ | ||
41 | #define ODD_FIELD 0x1 | ||
42 | #define EVEN_FIELD 0x0 | ||
43 | #define ACTIVE_ONLY 0x2 | ||
44 | #define NON_ACTIVE 0x0 | ||
45 | |||
46 | /* Debug options */ | ||
47 | #define VFC_I2C_SEND 0 | ||
48 | #define VFC_I2C_RECV 1 | ||
49 | |||
50 | struct vfc_debug_inout | ||
51 | { | ||
52 | unsigned long addr; | ||
53 | unsigned long ret; | ||
54 | unsigned long len; | ||
55 | unsigned char __user *buffer; | ||
56 | }; | ||
57 | |||
58 | #endif /* _LINUX_VFC_IOCTLS_H_ */ | ||
diff --git a/include/asm-sparc/viking.h b/include/asm-sparc/viking.h new file mode 100644 index 000000000000..7541da71b9d6 --- /dev/null +++ b/include/asm-sparc/viking.h | |||
@@ -0,0 +1,253 @@ | |||
1 | /* $Id: viking.h,v 1.19 1997/04/20 14:11:48 ecd Exp $ | ||
2 | * viking.h: Defines specific to the GNU/Viking MBUS module. | ||
3 | * This is SRMMU stuff. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | #ifndef _SPARC_VIKING_H | ||
8 | #define _SPARC_VIKING_H | ||
9 | |||
10 | #include <asm/asi.h> | ||
11 | #include <asm/mxcc.h> | ||
12 | #include <asm/pgtsrmmu.h> | ||
13 | |||
14 | /* Bits in the SRMMU control register for GNU/Viking modules. | ||
15 | * | ||
16 | * ----------------------------------------------------------- | ||
17 | * |impl-vers| RSV |TC|AC|SP|BM|PC|MBM|SB|IC|DC|PSO|RSV|NF|ME| | ||
18 | * ----------------------------------------------------------- | ||
19 | * 31 24 23-17 16 15 14 13 12 11 10 9 8 7 6-2 1 0 | ||
20 | * | ||
21 | * TC: Tablewalk Cacheable -- 0 = Twalks are not cacheable in E-cache | ||
22 | * 1 = Twalks are cacheable in E-cache | ||
23 | * | ||
24 | * GNU/Viking will only cache tablewalks in the E-cache (mxcc) if present | ||
25 | * and never caches them internally (or so states the docs). Therefore | ||
26 | * for machines lacking an E-cache (ie. in MBUS mode) this bit must | ||
27 | * remain cleared. | ||
28 | * | ||
29 | * AC: Alternate Cacheable -- 0 = Passthru physical accesses not cacheable | ||
30 | * 1 = Passthru physical accesses cacheable | ||
31 | * | ||
32 | * This indicates whether accesses are cacheable when no cachable bit | ||
33 | * is present in the pte when the processor is in boot-mode or the | ||
34 | * access does not need pte's for translation (ie. pass-thru ASI's). | ||
35 | * "Cachable" is only referring to E-cache (if present) and not the | ||
36 | * on chip split I/D caches of the GNU/Viking. | ||
37 | * | ||
38 | * SP: SnooP Enable -- 0 = bus snooping off, 1 = bus snooping on | ||
39 | * | ||
40 | * This enables snooping on the GNU/Viking bus. This must be on | ||
41 | * for the hardware cache consistency mechanisms of the GNU/Viking | ||
42 | * to work at all. On non-mxcc GNU/Viking modules the split I/D | ||
43 | * caches will snoop regardless of whether they are enabled, this | ||
44 | * takes care of the case where the I or D or both caches are turned | ||
45 | * off yet still contain valid data. Note also that this bit does | ||
46 | * not affect GNU/Viking store-buffer snoops, those happen if the | ||
47 | * store-buffer is enabled no matter what. | ||
48 | * | ||
49 | * BM: Boot Mode -- 0 = not in boot mode, 1 = in boot mode | ||
50 | * | ||
51 | * This indicates whether the GNU/Viking is in boot-mode or not, | ||
52 | * if it is then all instruction fetch physical addresses are | ||
53 | * computed as 0xff0000000 + low 28 bits of requested address. | ||
54 | * GNU/Viking boot-mode does not affect data accesses. Also, | ||
55 | * in boot mode instruction accesses bypass the split on chip I/D | ||
56 | * caches, they may be cached by the GNU/MXCC if present and enabled. | ||
57 | * | ||
58 | * MBM: MBus Mode -- 0 = not in MBus mode, 1 = in MBus mode | ||
59 | * | ||
60 | * This indicated the GNU/Viking configuration present. If in | ||
61 | * MBUS mode, the GNU/Viking lacks a GNU/MXCC E-cache. If it is | ||
62 | * not then the GNU/Viking is on a module VBUS connected directly | ||
63 | * to a GNU/MXCC cache controller. The GNU/MXCC can be thus connected | ||
64 | * to either an GNU/MBUS (sun4m) or the packet-switched GNU/XBus (sun4d). | ||
65 | * | ||
66 | * SB: StoreBuffer enable -- 0 = store buffer off, 1 = store buffer on | ||
67 | * | ||
68 | * The GNU/Viking store buffer allows the chip to continue execution | ||
69 | * after a store even if the data cannot be placed in one of the | ||
70 | * caches during that cycle. If disabled, all stores operations | ||
71 | * occur synchronously. | ||
72 | * | ||
73 | * IC: Instruction Cache -- 0 = off, 1 = on | ||
74 | * DC: Data Cache -- 0 = off, 1 = 0n | ||
75 | * | ||
76 | * These bits enable the on-cpu GNU/Viking split I/D caches. Note, | ||
77 | * as mentioned above, these caches will snoop the bus in GNU/MBUS | ||
78 | * configurations even when disabled to avoid data corruption. | ||
79 | * | ||
80 | * NF: No Fault -- 0 = faults generate traps, 1 = faults don't trap | ||
81 | * ME: MMU enable -- 0 = mmu not translating, 1 = mmu translating | ||
82 | * | ||
83 | */ | ||
84 | |||
85 | #define VIKING_MMUENABLE 0x00000001 | ||
86 | #define VIKING_NOFAULT 0x00000002 | ||
87 | #define VIKING_PSO 0x00000080 | ||
88 | #define VIKING_DCENABLE 0x00000100 /* Enable data cache */ | ||
89 | #define VIKING_ICENABLE 0x00000200 /* Enable instruction cache */ | ||
90 | #define VIKING_SBENABLE 0x00000400 /* Enable store buffer */ | ||
91 | #define VIKING_MMODE 0x00000800 /* MBUS mode */ | ||
92 | #define VIKING_PCENABLE 0x00001000 /* Enable parity checking */ | ||
93 | #define VIKING_BMODE 0x00002000 | ||
94 | #define VIKING_SPENABLE 0x00004000 /* Enable bus cache snooping */ | ||
95 | #define VIKING_ACENABLE 0x00008000 /* Enable alternate caching */ | ||
96 | #define VIKING_TCENABLE 0x00010000 /* Enable table-walks to be cached */ | ||
97 | #define VIKING_DPENABLE 0x00040000 /* Enable the data prefetcher */ | ||
98 | |||
99 | /* | ||
100 | * GNU/Viking Breakpoint Action Register fields. | ||
101 | */ | ||
102 | #define VIKING_ACTION_MIX 0x00001000 /* Enable multiple instructions */ | ||
103 | |||
104 | /* | ||
105 | * GNU/Viking Cache Tags. | ||
106 | */ | ||
107 | #define VIKING_PTAG_VALID 0x01000000 /* Cache block is valid */ | ||
108 | #define VIKING_PTAG_DIRTY 0x00010000 /* Block has been modified */ | ||
109 | #define VIKING_PTAG_SHARED 0x00000100 /* Shared with some other cache */ | ||
110 | |||
111 | #ifndef __ASSEMBLY__ | ||
112 | |||
113 | static inline void viking_flush_icache(void) | ||
114 | { | ||
115 | __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" | ||
116 | : /* no outputs */ | ||
117 | : "i" (ASI_M_IC_FLCLEAR) | ||
118 | : "memory"); | ||
119 | } | ||
120 | |||
121 | static inline void viking_flush_dcache(void) | ||
122 | { | ||
123 | __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" | ||
124 | : /* no outputs */ | ||
125 | : "i" (ASI_M_DC_FLCLEAR) | ||
126 | : "memory"); | ||
127 | } | ||
128 | |||
129 | static inline void viking_unlock_icache(void) | ||
130 | { | ||
131 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
132 | : /* no outputs */ | ||
133 | : "r" (0x80000000), "i" (ASI_M_IC_FLCLEAR) | ||
134 | : "memory"); | ||
135 | } | ||
136 | |||
137 | static inline void viking_unlock_dcache(void) | ||
138 | { | ||
139 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t" | ||
140 | : /* no outputs */ | ||
141 | : "r" (0x80000000), "i" (ASI_M_DC_FLCLEAR) | ||
142 | : "memory"); | ||
143 | } | ||
144 | |||
145 | static inline void viking_set_bpreg(unsigned long regval) | ||
146 | { | ||
147 | __asm__ __volatile__("sta %0, [%%g0] %1\n\t" | ||
148 | : /* no outputs */ | ||
149 | : "r" (regval), "i" (ASI_M_ACTION) | ||
150 | : "memory"); | ||
151 | } | ||
152 | |||
153 | static inline unsigned long viking_get_bpreg(void) | ||
154 | { | ||
155 | unsigned long regval; | ||
156 | |||
157 | __asm__ __volatile__("lda [%%g0] %1, %0\n\t" | ||
158 | : "=r" (regval) | ||
159 | : "i" (ASI_M_ACTION)); | ||
160 | return regval; | ||
161 | } | ||
162 | |||
163 | static inline void viking_get_dcache_ptag(int set, int block, | ||
164 | unsigned long *data) | ||
165 | { | ||
166 | unsigned long ptag = ((set & 0x7f) << 5) | ((block & 0x3) << 26) | | ||
167 | 0x80000000; | ||
168 | unsigned long info, page; | ||
169 | |||
170 | __asm__ __volatile__ ("ldda [%2] %3, %%g2\n\t" | ||
171 | "or %%g0, %%g2, %0\n\t" | ||
172 | "or %%g0, %%g3, %1\n\t" | ||
173 | : "=r" (info), "=r" (page) | ||
174 | : "r" (ptag), "i" (ASI_M_DATAC_TAG) | ||
175 | : "g2", "g3"); | ||
176 | data[0] = info; | ||
177 | data[1] = page; | ||
178 | } | ||
179 | |||
180 | static inline void viking_mxcc_turn_off_parity(unsigned long *mregp, | ||
181 | unsigned long *mxcc_cregp) | ||
182 | { | ||
183 | unsigned long mreg = *mregp; | ||
184 | unsigned long mxcc_creg = *mxcc_cregp; | ||
185 | |||
186 | mreg &= ~(VIKING_PCENABLE); | ||
187 | mxcc_creg &= ~(MXCC_CTL_PARE); | ||
188 | |||
189 | __asm__ __volatile__ ("set 1f, %%g2\n\t" | ||
190 | "andcc %%g2, 4, %%g0\n\t" | ||
191 | "bne 2f\n\t" | ||
192 | " nop\n" | ||
193 | "1:\n\t" | ||
194 | "sta %0, [%%g0] %3\n\t" | ||
195 | "sta %1, [%2] %4\n\t" | ||
196 | "b 1f\n\t" | ||
197 | " nop\n\t" | ||
198 | "nop\n" | ||
199 | "2:\n\t" | ||
200 | "sta %0, [%%g0] %3\n\t" | ||
201 | "sta %1, [%2] %4\n" | ||
202 | "1:\n\t" | ||
203 | : /* no output */ | ||
204 | : "r" (mreg), "r" (mxcc_creg), | ||
205 | "r" (MXCC_CREG), "i" (ASI_M_MMUREGS), | ||
206 | "i" (ASI_M_MXCC) | ||
207 | : "g2", "memory", "cc"); | ||
208 | *mregp = mreg; | ||
209 | *mxcc_cregp = mxcc_creg; | ||
210 | } | ||
211 | |||
212 | static inline unsigned long viking_hwprobe(unsigned long vaddr) | ||
213 | { | ||
214 | unsigned long val; | ||
215 | |||
216 | vaddr &= PAGE_MASK; | ||
217 | /* Probe all MMU entries. */ | ||
218 | __asm__ __volatile__("lda [%1] %2, %0\n\t" | ||
219 | : "=r" (val) | ||
220 | : "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); | ||
221 | if (!val) | ||
222 | return 0; | ||
223 | |||
224 | /* Probe region. */ | ||
225 | __asm__ __volatile__("lda [%1] %2, %0\n\t" | ||
226 | : "=r" (val) | ||
227 | : "r" (vaddr | 0x200), "i" (ASI_M_FLUSH_PROBE)); | ||
228 | if ((val & SRMMU_ET_MASK) == SRMMU_ET_PTE) { | ||
229 | vaddr &= ~SRMMU_PGDIR_MASK; | ||
230 | vaddr >>= PAGE_SHIFT; | ||
231 | return val | (vaddr << 8); | ||
232 | } | ||
233 | |||
234 | /* Probe segment. */ | ||
235 | __asm__ __volatile__("lda [%1] %2, %0\n\t" | ||
236 | : "=r" (val) | ||
237 | : "r" (vaddr | 0x100), "i" (ASI_M_FLUSH_PROBE)); | ||
238 | if ((val & SRMMU_ET_MASK) == SRMMU_ET_PTE) { | ||
239 | vaddr &= ~SRMMU_REAL_PMD_MASK; | ||
240 | vaddr >>= PAGE_SHIFT; | ||
241 | return val | (vaddr << 8); | ||
242 | } | ||
243 | |||
244 | /* Probe page. */ | ||
245 | __asm__ __volatile__("lda [%1] %2, %0\n\t" | ||
246 | : "=r" (val) | ||
247 | : "r" (vaddr), "i" (ASI_M_FLUSH_PROBE)); | ||
248 | return val; | ||
249 | } | ||
250 | |||
251 | #endif /* !__ASSEMBLY__ */ | ||
252 | |||
253 | #endif /* !(_SPARC_VIKING_H) */ | ||
diff --git a/include/asm-sparc/vuid_event.h b/include/asm-sparc/vuid_event.h new file mode 100644 index 000000000000..7781e9f2fdd3 --- /dev/null +++ b/include/asm-sparc/vuid_event.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* SunOS Virtual User Input Device (VUID) compatibility */ | ||
2 | |||
3 | |||
4 | typedef struct firm_event { | ||
5 | unsigned short id; /* tag for this event */ | ||
6 | unsigned char pair_type; /* unused by X11 */ | ||
7 | unsigned char pair; /* unused by X11 */ | ||
8 | int value; /* VKEY_UP, VKEY_DOWN or delta */ | ||
9 | struct timeval time; | ||
10 | } Firm_event; | ||
11 | |||
12 | enum { | ||
13 | FE_PAIR_NONE, | ||
14 | FE_PAIR_SET, | ||
15 | FE_PAIR_DELTA, | ||
16 | FE_PAIR_ABSOLUTE | ||
17 | }; | ||
18 | |||
19 | /* VUID stream formats */ | ||
20 | #define VUID_NATIVE 0 /* Native byte stream format */ | ||
21 | #define VUID_FIRM_EVENT 1 /* send firm_event structures */ | ||
22 | |||
23 | /* ioctls */ | ||
24 | /* Set input device byte stream format (any of VUID_{NATIVE,FIRM_EVENT}) */ | ||
25 | #define VUIDSFORMAT _IOW('v', 1, int) | ||
26 | /* Retrieve input device byte stream format */ | ||
27 | #define VUIDGFORMAT _IOR('v', 2, int) | ||
28 | |||
29 | /* Possible tag values */ | ||
30 | /* mouse buttons: */ | ||
31 | #define MS_LEFT 0x7f20 | ||
32 | #define MS_MIDDLE 0x7f21 | ||
33 | #define MS_RIGHT 0x7f22 | ||
34 | /* motion: */ | ||
35 | #define LOC_X_DELTA 0x7f80 | ||
36 | #define LOC_Y_DELTA 0x7f81 | ||
37 | #define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */ | ||
38 | #define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */ | ||
39 | |||
40 | #define VKEY_UP 0 | ||
41 | #define VKEY_DOWN 1 | ||
diff --git a/include/asm-sparc/winmacro.h b/include/asm-sparc/winmacro.h new file mode 100644 index 000000000000..557257eef3f9 --- /dev/null +++ b/include/asm-sparc/winmacro.h | |||
@@ -0,0 +1,136 @@ | |||
1 | /* $Id: winmacro.h,v 1.22 2000/05/09 17:40:15 davem Exp $ | ||
2 | * winmacro.h: Window loading-unloading macros. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_WINMACRO_H | ||
8 | #define _SPARC_WINMACRO_H | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <asm/ptrace.h> | ||
12 | |||
13 | /* Store the register window onto the 8-byte aligned area starting | ||
14 | * at %reg. It might be %sp, it might not, we don't care. | ||
15 | */ | ||
16 | #define STORE_WINDOW(reg) \ | ||
17 | std %l0, [%reg + RW_L0]; \ | ||
18 | std %l2, [%reg + RW_L2]; \ | ||
19 | std %l4, [%reg + RW_L4]; \ | ||
20 | std %l6, [%reg + RW_L6]; \ | ||
21 | std %i0, [%reg + RW_I0]; \ | ||
22 | std %i2, [%reg + RW_I2]; \ | ||
23 | std %i4, [%reg + RW_I4]; \ | ||
24 | std %i6, [%reg + RW_I6]; | ||
25 | |||
26 | /* Load a register window from the area beginning at %reg. */ | ||
27 | #define LOAD_WINDOW(reg) \ | ||
28 | ldd [%reg + RW_L0], %l0; \ | ||
29 | ldd [%reg + RW_L2], %l2; \ | ||
30 | ldd [%reg + RW_L4], %l4; \ | ||
31 | ldd [%reg + RW_L6], %l6; \ | ||
32 | ldd [%reg + RW_I0], %i0; \ | ||
33 | ldd [%reg + RW_I2], %i2; \ | ||
34 | ldd [%reg + RW_I4], %i4; \ | ||
35 | ldd [%reg + RW_I6], %i6; | ||
36 | |||
37 | /* Loading and storing struct pt_reg trap frames. */ | ||
38 | #define LOAD_PT_INS(base_reg) \ | ||
39 | ldd [%base_reg + STACKFRAME_SZ + PT_I0], %i0; \ | ||
40 | ldd [%base_reg + STACKFRAME_SZ + PT_I2], %i2; \ | ||
41 | ldd [%base_reg + STACKFRAME_SZ + PT_I4], %i4; \ | ||
42 | ldd [%base_reg + STACKFRAME_SZ + PT_I6], %i6; | ||
43 | |||
44 | #define LOAD_PT_GLOBALS(base_reg) \ | ||
45 | ld [%base_reg + STACKFRAME_SZ + PT_G1], %g1; \ | ||
46 | ldd [%base_reg + STACKFRAME_SZ + PT_G2], %g2; \ | ||
47 | ldd [%base_reg + STACKFRAME_SZ + PT_G4], %g4; \ | ||
48 | ldd [%base_reg + STACKFRAME_SZ + PT_G6], %g6; | ||
49 | |||
50 | #define LOAD_PT_YREG(base_reg, scratch) \ | ||
51 | ld [%base_reg + STACKFRAME_SZ + PT_Y], %scratch; \ | ||
52 | wr %scratch, 0x0, %y; | ||
53 | |||
54 | #define LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \ | ||
55 | ld [%base_reg + STACKFRAME_SZ + PT_PSR], %pt_psr; \ | ||
56 | ld [%base_reg + STACKFRAME_SZ + PT_PC], %pt_pc; \ | ||
57 | ld [%base_reg + STACKFRAME_SZ + PT_NPC], %pt_npc; | ||
58 | |||
59 | #define LOAD_PT_ALL(base_reg, pt_psr, pt_pc, pt_npc, scratch) \ | ||
60 | LOAD_PT_YREG(base_reg, scratch) \ | ||
61 | LOAD_PT_INS(base_reg) \ | ||
62 | LOAD_PT_GLOBALS(base_reg) \ | ||
63 | LOAD_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) | ||
64 | |||
65 | #define STORE_PT_INS(base_reg) \ | ||
66 | std %i0, [%base_reg + STACKFRAME_SZ + PT_I0]; \ | ||
67 | std %i2, [%base_reg + STACKFRAME_SZ + PT_I2]; \ | ||
68 | std %i4, [%base_reg + STACKFRAME_SZ + PT_I4]; \ | ||
69 | std %i6, [%base_reg + STACKFRAME_SZ + PT_I6]; | ||
70 | |||
71 | #define STORE_PT_GLOBALS(base_reg) \ | ||
72 | st %g1, [%base_reg + STACKFRAME_SZ + PT_G1]; \ | ||
73 | std %g2, [%base_reg + STACKFRAME_SZ + PT_G2]; \ | ||
74 | std %g4, [%base_reg + STACKFRAME_SZ + PT_G4]; \ | ||
75 | std %g6, [%base_reg + STACKFRAME_SZ + PT_G6]; | ||
76 | |||
77 | #define STORE_PT_YREG(base_reg, scratch) \ | ||
78 | rd %y, %scratch; \ | ||
79 | st %scratch, [%base_reg + STACKFRAME_SZ + PT_Y]; | ||
80 | |||
81 | #define STORE_PT_PRIV(base_reg, pt_psr, pt_pc, pt_npc) \ | ||
82 | st %pt_psr, [%base_reg + STACKFRAME_SZ + PT_PSR]; \ | ||
83 | st %pt_pc, [%base_reg + STACKFRAME_SZ + PT_PC]; \ | ||
84 | st %pt_npc, [%base_reg + STACKFRAME_SZ + PT_NPC]; | ||
85 | |||
86 | #define STORE_PT_ALL(base_reg, reg_psr, reg_pc, reg_npc, g_scratch) \ | ||
87 | STORE_PT_PRIV(base_reg, reg_psr, reg_pc, reg_npc) \ | ||
88 | STORE_PT_GLOBALS(base_reg) \ | ||
89 | STORE_PT_YREG(base_reg, g_scratch) \ | ||
90 | STORE_PT_INS(base_reg) | ||
91 | |||
92 | #define SAVE_BOLIXED_USER_STACK(cur_reg, scratch) \ | ||
93 | ld [%cur_reg + TI_W_SAVED], %scratch; \ | ||
94 | sll %scratch, 2, %scratch; \ | ||
95 | add %scratch, %cur_reg, %scratch; \ | ||
96 | st %sp, [%scratch + TI_RWIN_SPTRS]; \ | ||
97 | sub %scratch, %cur_reg, %scratch; \ | ||
98 | sll %scratch, 4, %scratch; \ | ||
99 | add %scratch, %cur_reg, %scratch; \ | ||
100 | STORE_WINDOW(scratch + TI_REG_WINDOW); \ | ||
101 | sub %scratch, %cur_reg, %scratch; \ | ||
102 | srl %scratch, 6, %scratch; \ | ||
103 | add %scratch, 1, %scratch; \ | ||
104 | st %scratch, [%cur_reg + TI_W_SAVED]; | ||
105 | |||
106 | #ifdef CONFIG_SMP | ||
107 | #define LOAD_CURRENT4M(dest_reg, idreg) \ | ||
108 | rd %tbr, %idreg; \ | ||
109 | sethi %hi(current_set), %dest_reg; \ | ||
110 | srl %idreg, 10, %idreg; \ | ||
111 | or %dest_reg, %lo(current_set), %dest_reg; \ | ||
112 | and %idreg, 0xc, %idreg; \ | ||
113 | ld [%idreg + %dest_reg], %dest_reg; | ||
114 | |||
115 | #define LOAD_CURRENT4D(dest_reg, idreg) \ | ||
116 | lda [%g0] ASI_M_VIKING_TMP1, %idreg; \ | ||
117 | sethi %hi(C_LABEL(current_set)), %dest_reg; \ | ||
118 | sll %idreg, 2, %idreg; \ | ||
119 | or %dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \ | ||
120 | ld [%idreg + %dest_reg], %dest_reg; | ||
121 | |||
122 | /* Blackbox - take care with this... - check smp4m and smp4d before changing this. */ | ||
123 | #define LOAD_CURRENT(dest_reg, idreg) \ | ||
124 | sethi %hi(___b_load_current), %idreg; \ | ||
125 | sethi %hi(current_set), %dest_reg; \ | ||
126 | sethi %hi(boot_cpu_id4), %idreg; \ | ||
127 | or %dest_reg, %lo(current_set), %dest_reg; \ | ||
128 | ldub [%idreg + %lo(boot_cpu_id4)], %idreg; \ | ||
129 | ld [%idreg + %dest_reg], %dest_reg; | ||
130 | #else | ||
131 | #define LOAD_CURRENT(dest_reg, idreg) \ | ||
132 | sethi %hi(current_set), %idreg; \ | ||
133 | ld [%idreg + %lo(current_set)], %dest_reg; | ||
134 | #endif | ||
135 | |||
136 | #endif /* !(_SPARC_WINMACRO_H) */ | ||
diff --git a/include/asm-sparc/xor.h b/include/asm-sparc/xor.h new file mode 100644 index 000000000000..f34b2cfa8206 --- /dev/null +++ b/include/asm-sparc/xor.h | |||
@@ -0,0 +1,269 @@ | |||
1 | /* | ||
2 | * include/asm-sparc/xor.h | ||
3 | * | ||
4 | * Optimized RAID-5 checksumming functions for 32-bit Sparc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2, or (at your option) | ||
9 | * any later version. | ||
10 | * | ||
11 | * You should have received a copy of the GNU General Public License | ||
12 | * (for example /usr/src/linux/COPYING); if not, write to the Free | ||
13 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * High speed xor_block operation for RAID4/5 utilizing the | ||
18 | * ldd/std SPARC instructions. | ||
19 | * | ||
20 | * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz) | ||
21 | */ | ||
22 | |||
23 | static void | ||
24 | sparc_2(unsigned long bytes, unsigned long *p1, unsigned long *p2) | ||
25 | { | ||
26 | int lines = bytes / (sizeof (long)) / 8; | ||
27 | |||
28 | do { | ||
29 | __asm__ __volatile__( | ||
30 | "ldd [%0 + 0x00], %%g2\n\t" | ||
31 | "ldd [%0 + 0x08], %%g4\n\t" | ||
32 | "ldd [%0 + 0x10], %%o0\n\t" | ||
33 | "ldd [%0 + 0x18], %%o2\n\t" | ||
34 | "ldd [%1 + 0x00], %%o4\n\t" | ||
35 | "ldd [%1 + 0x08], %%l0\n\t" | ||
36 | "ldd [%1 + 0x10], %%l2\n\t" | ||
37 | "ldd [%1 + 0x18], %%l4\n\t" | ||
38 | "xor %%g2, %%o4, %%g2\n\t" | ||
39 | "xor %%g3, %%o5, %%g3\n\t" | ||
40 | "xor %%g4, %%l0, %%g4\n\t" | ||
41 | "xor %%g5, %%l1, %%g5\n\t" | ||
42 | "xor %%o0, %%l2, %%o0\n\t" | ||
43 | "xor %%o1, %%l3, %%o1\n\t" | ||
44 | "xor %%o2, %%l4, %%o2\n\t" | ||
45 | "xor %%o3, %%l5, %%o3\n\t" | ||
46 | "std %%g2, [%0 + 0x00]\n\t" | ||
47 | "std %%g4, [%0 + 0x08]\n\t" | ||
48 | "std %%o0, [%0 + 0x10]\n\t" | ||
49 | "std %%o2, [%0 + 0x18]\n" | ||
50 | : | ||
51 | : "r" (p1), "r" (p2) | ||
52 | : "g2", "g3", "g4", "g5", | ||
53 | "o0", "o1", "o2", "o3", "o4", "o5", | ||
54 | "l0", "l1", "l2", "l3", "l4", "l5"); | ||
55 | p1 += 8; | ||
56 | p2 += 8; | ||
57 | } while (--lines > 0); | ||
58 | } | ||
59 | |||
60 | static void | ||
61 | sparc_3(unsigned long bytes, unsigned long *p1, unsigned long *p2, | ||
62 | unsigned long *p3) | ||
63 | { | ||
64 | int lines = bytes / (sizeof (long)) / 8; | ||
65 | |||
66 | do { | ||
67 | __asm__ __volatile__( | ||
68 | "ldd [%0 + 0x00], %%g2\n\t" | ||
69 | "ldd [%0 + 0x08], %%g4\n\t" | ||
70 | "ldd [%0 + 0x10], %%o0\n\t" | ||
71 | "ldd [%0 + 0x18], %%o2\n\t" | ||
72 | "ldd [%1 + 0x00], %%o4\n\t" | ||
73 | "ldd [%1 + 0x08], %%l0\n\t" | ||
74 | "ldd [%1 + 0x10], %%l2\n\t" | ||
75 | "ldd [%1 + 0x18], %%l4\n\t" | ||
76 | "xor %%g2, %%o4, %%g2\n\t" | ||
77 | "xor %%g3, %%o5, %%g3\n\t" | ||
78 | "ldd [%2 + 0x00], %%o4\n\t" | ||
79 | "xor %%g4, %%l0, %%g4\n\t" | ||
80 | "xor %%g5, %%l1, %%g5\n\t" | ||
81 | "ldd [%2 + 0x08], %%l0\n\t" | ||
82 | "xor %%o0, %%l2, %%o0\n\t" | ||
83 | "xor %%o1, %%l3, %%o1\n\t" | ||
84 | "ldd [%2 + 0x10], %%l2\n\t" | ||
85 | "xor %%o2, %%l4, %%o2\n\t" | ||
86 | "xor %%o3, %%l5, %%o3\n\t" | ||
87 | "ldd [%2 + 0x18], %%l4\n\t" | ||
88 | "xor %%g2, %%o4, %%g2\n\t" | ||
89 | "xor %%g3, %%o5, %%g3\n\t" | ||
90 | "xor %%g4, %%l0, %%g4\n\t" | ||
91 | "xor %%g5, %%l1, %%g5\n\t" | ||
92 | "xor %%o0, %%l2, %%o0\n\t" | ||
93 | "xor %%o1, %%l3, %%o1\n\t" | ||
94 | "xor %%o2, %%l4, %%o2\n\t" | ||
95 | "xor %%o3, %%l5, %%o3\n\t" | ||
96 | "std %%g2, [%0 + 0x00]\n\t" | ||
97 | "std %%g4, [%0 + 0x08]\n\t" | ||
98 | "std %%o0, [%0 + 0x10]\n\t" | ||
99 | "std %%o2, [%0 + 0x18]\n" | ||
100 | : | ||
101 | : "r" (p1), "r" (p2), "r" (p3) | ||
102 | : "g2", "g3", "g4", "g5", | ||
103 | "o0", "o1", "o2", "o3", "o4", "o5", | ||
104 | "l0", "l1", "l2", "l3", "l4", "l5"); | ||
105 | p1 += 8; | ||
106 | p2 += 8; | ||
107 | p3 += 8; | ||
108 | } while (--lines > 0); | ||
109 | } | ||
110 | |||
111 | static void | ||
112 | sparc_4(unsigned long bytes, unsigned long *p1, unsigned long *p2, | ||
113 | unsigned long *p3, unsigned long *p4) | ||
114 | { | ||
115 | int lines = bytes / (sizeof (long)) / 8; | ||
116 | |||
117 | do { | ||
118 | __asm__ __volatile__( | ||
119 | "ldd [%0 + 0x00], %%g2\n\t" | ||
120 | "ldd [%0 + 0x08], %%g4\n\t" | ||
121 | "ldd [%0 + 0x10], %%o0\n\t" | ||
122 | "ldd [%0 + 0x18], %%o2\n\t" | ||
123 | "ldd [%1 + 0x00], %%o4\n\t" | ||
124 | "ldd [%1 + 0x08], %%l0\n\t" | ||
125 | "ldd [%1 + 0x10], %%l2\n\t" | ||
126 | "ldd [%1 + 0x18], %%l4\n\t" | ||
127 | "xor %%g2, %%o4, %%g2\n\t" | ||
128 | "xor %%g3, %%o5, %%g3\n\t" | ||
129 | "ldd [%2 + 0x00], %%o4\n\t" | ||
130 | "xor %%g4, %%l0, %%g4\n\t" | ||
131 | "xor %%g5, %%l1, %%g5\n\t" | ||
132 | "ldd [%2 + 0x08], %%l0\n\t" | ||
133 | "xor %%o0, %%l2, %%o0\n\t" | ||
134 | "xor %%o1, %%l3, %%o1\n\t" | ||
135 | "ldd [%2 + 0x10], %%l2\n\t" | ||
136 | "xor %%o2, %%l4, %%o2\n\t" | ||
137 | "xor %%o3, %%l5, %%o3\n\t" | ||
138 | "ldd [%2 + 0x18], %%l4\n\t" | ||
139 | "xor %%g2, %%o4, %%g2\n\t" | ||
140 | "xor %%g3, %%o5, %%g3\n\t" | ||
141 | "ldd [%3 + 0x00], %%o4\n\t" | ||
142 | "xor %%g4, %%l0, %%g4\n\t" | ||
143 | "xor %%g5, %%l1, %%g5\n\t" | ||
144 | "ldd [%3 + 0x08], %%l0\n\t" | ||
145 | "xor %%o0, %%l2, %%o0\n\t" | ||
146 | "xor %%o1, %%l3, %%o1\n\t" | ||
147 | "ldd [%3 + 0x10], %%l2\n\t" | ||
148 | "xor %%o2, %%l4, %%o2\n\t" | ||
149 | "xor %%o3, %%l5, %%o3\n\t" | ||
150 | "ldd [%3 + 0x18], %%l4\n\t" | ||
151 | "xor %%g2, %%o4, %%g2\n\t" | ||
152 | "xor %%g3, %%o5, %%g3\n\t" | ||
153 | "xor %%g4, %%l0, %%g4\n\t" | ||
154 | "xor %%g5, %%l1, %%g5\n\t" | ||
155 | "xor %%o0, %%l2, %%o0\n\t" | ||
156 | "xor %%o1, %%l3, %%o1\n\t" | ||
157 | "xor %%o2, %%l4, %%o2\n\t" | ||
158 | "xor %%o3, %%l5, %%o3\n\t" | ||
159 | "std %%g2, [%0 + 0x00]\n\t" | ||
160 | "std %%g4, [%0 + 0x08]\n\t" | ||
161 | "std %%o0, [%0 + 0x10]\n\t" | ||
162 | "std %%o2, [%0 + 0x18]\n" | ||
163 | : | ||
164 | : "r" (p1), "r" (p2), "r" (p3), "r" (p4) | ||
165 | : "g2", "g3", "g4", "g5", | ||
166 | "o0", "o1", "o2", "o3", "o4", "o5", | ||
167 | "l0", "l1", "l2", "l3", "l4", "l5"); | ||
168 | p1 += 8; | ||
169 | p2 += 8; | ||
170 | p3 += 8; | ||
171 | p4 += 8; | ||
172 | } while (--lines > 0); | ||
173 | } | ||
174 | |||
175 | static void | ||
176 | sparc_5(unsigned long bytes, unsigned long *p1, unsigned long *p2, | ||
177 | unsigned long *p3, unsigned long *p4, unsigned long *p5) | ||
178 | { | ||
179 | int lines = bytes / (sizeof (long)) / 8; | ||
180 | |||
181 | do { | ||
182 | __asm__ __volatile__( | ||
183 | "ldd [%0 + 0x00], %%g2\n\t" | ||
184 | "ldd [%0 + 0x08], %%g4\n\t" | ||
185 | "ldd [%0 + 0x10], %%o0\n\t" | ||
186 | "ldd [%0 + 0x18], %%o2\n\t" | ||
187 | "ldd [%1 + 0x00], %%o4\n\t" | ||
188 | "ldd [%1 + 0x08], %%l0\n\t" | ||
189 | "ldd [%1 + 0x10], %%l2\n\t" | ||
190 | "ldd [%1 + 0x18], %%l4\n\t" | ||
191 | "xor %%g2, %%o4, %%g2\n\t" | ||
192 | "xor %%g3, %%o5, %%g3\n\t" | ||
193 | "ldd [%2 + 0x00], %%o4\n\t" | ||
194 | "xor %%g4, %%l0, %%g4\n\t" | ||
195 | "xor %%g5, %%l1, %%g5\n\t" | ||
196 | "ldd [%2 + 0x08], %%l0\n\t" | ||
197 | "xor %%o0, %%l2, %%o0\n\t" | ||
198 | "xor %%o1, %%l3, %%o1\n\t" | ||
199 | "ldd [%2 + 0x10], %%l2\n\t" | ||
200 | "xor %%o2, %%l4, %%o2\n\t" | ||
201 | "xor %%o3, %%l5, %%o3\n\t" | ||
202 | "ldd [%2 + 0x18], %%l4\n\t" | ||
203 | "xor %%g2, %%o4, %%g2\n\t" | ||
204 | "xor %%g3, %%o5, %%g3\n\t" | ||
205 | "ldd [%3 + 0x00], %%o4\n\t" | ||
206 | "xor %%g4, %%l0, %%g4\n\t" | ||
207 | "xor %%g5, %%l1, %%g5\n\t" | ||
208 | "ldd [%3 + 0x08], %%l0\n\t" | ||
209 | "xor %%o0, %%l2, %%o0\n\t" | ||
210 | "xor %%o1, %%l3, %%o1\n\t" | ||
211 | "ldd [%3 + 0x10], %%l2\n\t" | ||
212 | "xor %%o2, %%l4, %%o2\n\t" | ||
213 | "xor %%o3, %%l5, %%o3\n\t" | ||
214 | "ldd [%3 + 0x18], %%l4\n\t" | ||
215 | "xor %%g2, %%o4, %%g2\n\t" | ||
216 | "xor %%g3, %%o5, %%g3\n\t" | ||
217 | "ldd [%4 + 0x00], %%o4\n\t" | ||
218 | "xor %%g4, %%l0, %%g4\n\t" | ||
219 | "xor %%g5, %%l1, %%g5\n\t" | ||
220 | "ldd [%4 + 0x08], %%l0\n\t" | ||
221 | "xor %%o0, %%l2, %%o0\n\t" | ||
222 | "xor %%o1, %%l3, %%o1\n\t" | ||
223 | "ldd [%4 + 0x10], %%l2\n\t" | ||
224 | "xor %%o2, %%l4, %%o2\n\t" | ||
225 | "xor %%o3, %%l5, %%o3\n\t" | ||
226 | "ldd [%4 + 0x18], %%l4\n\t" | ||
227 | "xor %%g2, %%o4, %%g2\n\t" | ||
228 | "xor %%g3, %%o5, %%g3\n\t" | ||
229 | "xor %%g4, %%l0, %%g4\n\t" | ||
230 | "xor %%g5, %%l1, %%g5\n\t" | ||
231 | "xor %%o0, %%l2, %%o0\n\t" | ||
232 | "xor %%o1, %%l3, %%o1\n\t" | ||
233 | "xor %%o2, %%l4, %%o2\n\t" | ||
234 | "xor %%o3, %%l5, %%o3\n\t" | ||
235 | "std %%g2, [%0 + 0x00]\n\t" | ||
236 | "std %%g4, [%0 + 0x08]\n\t" | ||
237 | "std %%o0, [%0 + 0x10]\n\t" | ||
238 | "std %%o2, [%0 + 0x18]\n" | ||
239 | : | ||
240 | : "r" (p1), "r" (p2), "r" (p3), "r" (p4), "r" (p5) | ||
241 | : "g2", "g3", "g4", "g5", | ||
242 | "o0", "o1", "o2", "o3", "o4", "o5", | ||
243 | "l0", "l1", "l2", "l3", "l4", "l5"); | ||
244 | p1 += 8; | ||
245 | p2 += 8; | ||
246 | p3 += 8; | ||
247 | p4 += 8; | ||
248 | p5 += 8; | ||
249 | } while (--lines > 0); | ||
250 | } | ||
251 | |||
252 | static struct xor_block_template xor_block_SPARC = { | ||
253 | .name = "SPARC", | ||
254 | .do_2 = sparc_2, | ||
255 | .do_3 = sparc_3, | ||
256 | .do_4 = sparc_4, | ||
257 | .do_5 = sparc_5, | ||
258 | }; | ||
259 | |||
260 | /* For grins, also test the generic routines. */ | ||
261 | #include <asm-generic/xor.h> | ||
262 | |||
263 | #undef XOR_TRY_TEMPLATES | ||
264 | #define XOR_TRY_TEMPLATES \ | ||
265 | do { \ | ||
266 | xor_speed(&xor_block_8regs); \ | ||
267 | xor_speed(&xor_block_32regs); \ | ||
268 | xor_speed(&xor_block_SPARC); \ | ||
269 | } while (0) | ||